Debian Codegraph @

dd_grwin32/ddgrWin32DX.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/ddgr_win32/ddgrWin32DX.h $
21 * $Revision: 2 $
22 * $Date: 9/12/97 4:13p $
23 * $Author: Samir $
24 *
25 * DirectX Subsystem Implementation of ddgr library
26 *
27 * $Log: /DescentIII/Main/ddgr_win32/ddgrWin32DX.h $
28 *
29 * 2 9/12/97 4:13p Samir
30 * Added some private data access functions and more DirectX
31 * functionality.
32 *
33 * $NoKeywords: $
34 */
35
36 /* Functions
37 */
38
39 #ifndef DDGRWIN32DX_H
40 #define DDGRWIN32DX_H
41
42 #include <windows.h>
43
44 #include "ddgr.h"
45 #include "ddraw.h"
46
47 class oeApplication;
48
49 /* Data structures
50 */
51 struct tDXSurface {
52 LPDIRECTDRAWSURFACE lpdds;
53 LPDIRECTDRAWSURFACE lpddsback;
54 bool backbuffer;
55 };
56
57 #define DX_MAX_DEVMODES 32
58 struct tDDGRDXInternalData // Internal data for DX subsystem
59 {
60 bool init; // is library initialized
61 LPDIRECTDRAW lpDD; // DirectDraw Object for video manipulation
62 HWND hPrimaryWnd; // window owning display
63 int vidrefs; // Number of surface references to hPrimaryWnd.
64 tDXSurface vidsurf;
65 DDSURFACEDESC vidmodes[DX_MAX_DEVMODES]; // Device modes for GDI subsystem (not GDIX)
66 };
67
68 /* Externs */
69 extern tDDGRDXInternalData DDGR_DX_lib_data;
70
71 /* Macros */
72 #define DX_DATA(_c) DDGR_DX_lib_data._c
73
74 // Initializes DX subsystem
75 bool ddgr_dx_Init(oeApplication *app);
76
77 // Closes DX subsystem
78 void ddgr_dx_Close();
79
80 // Initializes the display for use with the DX subsystem.
81 bool ddgr_dx_surf_InitVideo(ddgr_surface *sf);
82
83 // Deinitializes the video surface
84 void ddgr_dx_surf_CloseVideo(ddgr_surface *sf);
85
86 // flips the buffers in a surface. really only useful for video screens
87 bool ddgr_dx_surf_FlipVideo(ddgr_surface *sf);
88
89 /* input:
90 sf->name is optional.
91 sf->w, sf->h, sf->bpp are mandatory
92 sf->type and sf->flags are mandatory.
93 output:
94 sf->obj = surface object.
95 sf->locks = 0
96 */
97 bool ddgr_dx_surf_Create(ddgr_surface *sf);
98 void ddgr_dx_surf_Destroy(ddgr_surface *sf);
99
100 /* retrieves a pointer to surface memory. allowed to lock one surface multiple times.
101 ptr is the returned pointer to surface memory. used to unlock surface also
102 rowsize is the size in bytes of one row of memory.
103 */
104 bool ddgr_dx_surf_Lock(ddgr_surface *sf, void **ptr, int *rowsize);
105 bool ddgr_dx_surf_Unlock(ddgr_surface *sf, void *ptr);
106
107 // attaches an OS handle to a surface
108 void ddgr_dx_surf_AttachHandle(ddgr_surface *sf, unsigned handle);
109
110 // The only graphic primatives
111 // clear
112 // blt.
113 void ddgr_dx_surf_Clear(ddgr_surface *dsf, ddgr_color col, int l, int t, int w, int h);
114 bool ddgr_dx_surf_Blt(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int sx, int sy, int sw, int sh);
115
116 #endif