3168
|
1 /*
|
|
2 SDL - Simple DirectMedia Layer
|
|
3 Copyright (C) 1997-2009 Sam Lantinga
|
|
4
|
|
5 This library is free software; you can redistribute it and/or
|
|
6 modify it under the terms of the GNU Lesser General Public
|
|
7 License as published by the Free Software Foundation; either
|
|
8 version 2.1 of the License, or (at your option) any later version.
|
|
9
|
|
10 This library 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 GNU
|
|
13 Lesser General Public License for more details.
|
|
14
|
|
15 You should have received a copy of the GNU Lesser General Public
|
|
16 License along with this library; if not, write to the Free Software
|
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18
|
|
19 Sam Lantinga
|
|
20 slouken@libsdl.org
|
|
21
|
|
22 Stefan Klug
|
|
23 klug.stefan@gmx.de
|
|
24 */
|
|
25
|
|
26 #define WIN32_LEAN_AND_MEAN
|
|
27 #include <windows.h>
|
|
28
|
|
29 /* hi res definitions */
|
|
30 typedef struct _RawFrameBufferInfo
|
|
31 {
|
|
32 WORD wFormat;
|
|
33 WORD wBPP;
|
|
34 VOID *pFramePointer;
|
|
35 int cxStride;
|
|
36 int cyStride;
|
|
37 int cxPixels;
|
|
38 int cyPixels;
|
|
39 } RawFrameBufferInfo;
|
|
40
|
|
41 #define GETRAWFRAMEBUFFER 0x00020001
|
|
42
|
|
43 #define FORMAT_565 1
|
|
44 #define FORMAT_555 2
|
|
45 #define FORMAT_OTHER 3
|
|
46
|
|
47
|
|
48 /* From gx.h, since it's not really C compliant */
|
|
49
|
|
50 struct GXDisplayProperties
|
|
51 {
|
|
52 DWORD cxWidth;
|
|
53 DWORD cyHeight; // notice lack of 'th' in the word height.
|
|
54 long cbxPitch; // number of bytes to move right one x pixel - can be negative.
|
|
55 long cbyPitch; // number of bytes to move down one y pixel - can be negative.
|
|
56 long cBPP; // # of bits in each pixel
|
|
57 DWORD ffFormat; // format flags.
|
|
58 };
|
|
59
|
|
60 struct GXKeyList
|
|
61 {
|
|
62 short vkUp; // key for up
|
|
63 POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates.
|
|
64 short vkDown;
|
|
65 POINT ptDown;
|
|
66 short vkLeft;
|
|
67 POINT ptLeft;
|
|
68 short vkRight;
|
|
69 POINT ptRight;
|
|
70 short vkA;
|
|
71 POINT ptA;
|
|
72 short vkB;
|
|
73 POINT ptB;
|
|
74 short vkC;
|
|
75 POINT ptC;
|
|
76 short vkStart;
|
|
77 POINT ptStart;
|
|
78 };
|
|
79
|
|
80 typedef int (*PFNGXOpenDisplay) (HWND hWnd, DWORD dwFlags);
|
|
81 typedef int (*PFNGXCloseDisplay) ();
|
|
82 typedef void *(*PFNGXBeginDraw) ();
|
|
83 typedef int (*PFNGXEndDraw) ();
|
|
84 typedef int (*PFNGXOpenInput) ();
|
|
85 typedef int (*PFNGXCloseInput) ();
|
|
86 typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties) ();
|
|
87 typedef struct GXKeyList (*PFNGXGetDefaultKeys) (int iOptions);
|
|
88 typedef int (*PFNGXSuspend) ();
|
|
89 typedef int (*PFNGXResume) ();
|
|
90 typedef int (*PFNGXSetViewport) (DWORD dwTop, DWORD dwHeight,
|
|
91 DWORD dwReserved1, DWORD dwReserved2);
|
|
92 typedef BOOL(*PFNGXIsDisplayDRAMBuffer) ();
|
|
93
|
|
94 struct GapiFunc
|
|
95 {
|
|
96 PFNGXOpenDisplay GXOpenDisplay;
|
|
97 PFNGXCloseDisplay GXCloseDisplay;
|
|
98 PFNGXBeginDraw GXBeginDraw;
|
|
99 PFNGXEndDraw GXEndDraw;
|
|
100 PFNGXOpenInput GXOpenInput;
|
|
101 PFNGXCloseInput GXCloseInput;
|
|
102 PFNGXGetDisplayProperties GXGetDisplayProperties;
|
|
103 PFNGXGetDefaultKeys GXGetDefaultKeys;
|
|
104 PFNGXSuspend GXSuspend;
|
|
105 PFNGXResume GXResume;
|
|
106 PFNGXSetViewport GXSetViewport;
|
|
107 PFNGXIsDisplayDRAMBuffer GXIsDisplayDRAMBuffer;
|
|
108 } gx;
|
|
109
|
|
110 #define kfLandscape 0x8 // Screen is rotated 270 degrees
|
|
111 #define kfPalette 0x10 // Pixel values are indexes into a palette
|
|
112 #define kfDirect 0x20 // Pixel values contain actual level information
|
|
113 #define kfDirect555 0x40 // 5 bits each for red, green and blue values in a pixel.
|
|
114 #define kfDirect565 0x80 // 5 red bits, 6 green bits and 5 blue bits per pixel
|
|
115 #define kfDirect888 0x100 // 8 bits each for red, green and blue values in a pixel.
|
|
116 #define kfDirect444 0x200 // 4 red, 4 green, 4 blue
|
|
117 #define kfDirectInverted 0x400
|
|
118
|
|
119 #define GX_FULLSCREEN 0x01 // for OpenDisplay()
|
|
120 #define GX_NORMALKEYS 0x02
|
|
121 #define GX_LANDSCAPEKEYS 0x03
|