File: fabdxlib.h

package info (click to toggle)
doomlegacy 1.32beta4-3
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 6,768 kB
  • ctags: 13,999
  • sloc: ansic: 110,665; asm: 1,413; makefile: 915; pascal: 63
file content (88 lines) | stat: -rwxr-xr-x 3,258 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Emacs style mode select   -*- C++ -*- 
//-----------------------------------------------------------------------------
//
// $Id: fabdxlib.h,v 1.2 2000/02/27 00:42:12 hurdler Exp $
//
// Copyright (C) 1998-2000 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
//
// $Log: fabdxlib.h,v $
// Revision 1.2  2000/02/27 00:42:12  hurdler
// fix CR+LF problem
//
// Revision 1.1.1.1  2000/02/22 20:32:33  hurdler
// Initial import into CVS (v1.29 pr3)
//
//
// DESCRIPTION:
//      faB's DirectX library v1.0
//
//-----------------------------------------------------------------------------


#ifndef _H_FABDXLIB_
#define _H_FABDXLIB_

#define SAFE_RELEASE(x) if(x != NULL) { x->lpVtbl->Release(x); x = NULL; }
#define SAFE_DELETE(x) if(x != NULL) { delete x; x = NULL; }

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddraw.h>

// format of function in app called with width,height
typedef BOOL (*APPENUMMODESCALLBACK)(int width, int height, int bpp);


// globals
extern IDirectDraw*                                     DDr;
extern IDirectDrawSurface*                      ScreenReal;
extern IDirectDrawSurface*                      ScreenVirtual;
extern IDirectDrawPalette*                      DDPalette;

extern BOOL                                     bAppFullScreen;                             // main code might need this to know the current
                                                                                                        // fullscreen or windowed state

extern int                                      windowPosX;                             // current position in windowed mode
extern int                                      windowPosY;

extern int                                      ScreenWidth;    
extern int                                      ScreenHeight;
extern BOOL                                     ScreenLocked;                   // Screen surface is being locked
extern int                                      ScreenPitch;                    // offset from one line to the next
extern unsigned char*           ScreenPtr;                              // memory of the surface


BOOL    EnumDirectDrawDisplayModes (APPENUMMODESCALLBACK appFunc);
BOOL    CreateDirectDrawInstance (void);

int     InitDirectDrawe (HWND appWin, int width, int height, int bpp, int fullScr);
void    CloseDirectDraw (void);

void    ReleaseChtuff (void);

void    ClearSurface (IDirectDrawSurface* surface, int color);
BOOL    ScreenFlip (int wait);
void    TextPrint (int x, int y, char* message);

void    CreateDDPalette (PALETTEENTRY* colorTable);
void    DestroyDDPalette (void);
void    SetDDPalette (PALETTEENTRY* pal);

void    WaitVbl (void);

boolean LockScreen (void);
void    UnlockScreen (void);


#endif /* _H_FABDXLIB_ */