comparison src/video/gapi/SDL_gapivideo.h @ 1251:86d0d01290ea

Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode, updated project files, VS2005 support, VGA mode, more device support, etc, etc, etc. Fixes Bugzilla #47 and #28. --ryan.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 19 Jan 2006 08:43:00 +0000
parents
children c9b51268668f
comparison
equal deleted inserted replaced
1250:a4d515d0fc3a 1251:86d0d01290ea
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2004 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22
23 #ifdef SAVE_RCSID
24 static char rcsid =
25 "@(#) $Id$";
26 #endif
27
28 #ifndef _SDL_gapivideo_h
29 #define _SDL_gapivideo_h
30
31 #include "SDL_mouse.h"
32 #include "SDL_sysvideo.h"
33 #include "SDL_mutex.h"
34
35 /* From gx.h, since it's not really C compliant */
36
37 struct GXDisplayProperties {
38 DWORD cxWidth;
39 DWORD cyHeight; // notice lack of 'th' in the word height.
40 long cbxPitch; // number of bytes to move right one x pixel - can be negative.
41 long cbyPitch; // number of bytes to move down one y pixel - can be negative.
42 long cBPP; // # of bits in each pixel
43 DWORD ffFormat; // format flags.
44 };
45
46 struct GXKeyList {
47 short vkUp; // key for up
48 POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates.
49 short vkDown;
50 POINT ptDown;
51 short vkLeft;
52 POINT ptLeft;
53 short vkRight;
54 POINT ptRight;
55 short vkA;
56 POINT ptA;
57 short vkB;
58 POINT ptB;
59 short vkC;
60 POINT ptC;
61 short vkStart;
62 POINT ptStart;
63 };
64
65 typedef int (*PFNGXOpenDisplay)(HWND hWnd, DWORD dwFlags);
66 typedef int (*PFNGXCloseDisplay)();
67 typedef void* (*PFNGXBeginDraw)();
68 typedef int (*PFNGXEndDraw)();
69 typedef int (*PFNGXOpenInput)();
70 typedef int (*PFNGXCloseInput)();
71 typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties)();
72 typedef struct GXKeyList (*PFNGXGetDefaultKeys)(int iOptions);
73 typedef int (*PFNGXSuspend)();
74 typedef int (*PFNGXResume)();
75 typedef int (*PFNGXSetViewport)( DWORD dwTop, DWORD dwHeight, DWORD dwReserved1, DWORD dwReserved2 );
76 typedef BOOL (*PFNGXIsDisplayDRAMBuffer)();
77
78 struct GapiFunc
79 {
80 PFNGXOpenDisplay GXOpenDisplay;
81 PFNGXCloseDisplay GXCloseDisplay;
82 PFNGXBeginDraw GXBeginDraw;
83 PFNGXEndDraw GXEndDraw;
84 PFNGXOpenInput GXOpenInput;
85 PFNGXCloseInput GXCloseInput;
86 PFNGXGetDisplayProperties GXGetDisplayProperties;
87 PFNGXGetDefaultKeys GXGetDefaultKeys;
88 PFNGXSuspend GXSuspend;
89 PFNGXResume GXResume;
90 PFNGXSetViewport GXSetViewport;
91 PFNGXIsDisplayDRAMBuffer GXIsDisplayDRAMBuffer;
92 };
93
94 #define kfLandscape 0x8 // Screen is rotated 270 degrees
95 #define kfPalette 0x10 // Pixel values are indexes into a palette
96 #define kfDirect 0x20 // Pixel values contain actual level information
97 #define kfDirect555 0x40 // 5 bits each for red, green and blue values in a pixel.
98 #define kfDirect565 0x80 // 5 red bits, 6 green bits and 5 blue bits per pixel
99 #define kfDirect888 0x100 // 8 bits each for red, green and blue values in a pixel.
100 #define kfDirect444 0x200 // 4 red, 4 green, 4 blue
101 #define kfDirectInverted 0x400
102
103 #define GX_FULLSCREEN 0x01 // for OpenDisplay()
104 #define GX_NORMALKEYS 0x02
105 #define GX_LANDSCAPEKEYS 0x03
106
107 typedef enum
108 {
109 SDL_ORIENTATION_UP,
110 SDL_ORIENTATION_DOWN,
111 SDL_ORIENTATION_LEFT,
112 SDL_ORIENTATION_RIGHT
113 } SDL_ScreenOrientation;
114
115 /* GAPI video mode */
116 typedef enum {
117 GAPI_NONE = 0,
118 GAPI_DIRECT_565,
119 GAPI_DIRECT_555,
120 GAPI_MONO,
121 GAPI_PALETTE
122 } GAPIVideoMode;
123
124 /* Hidden "this" pointer for the video functions */
125 #define _THIS SDL_VideoDevice *this
126
127 typedef unsigned short PIXEL;
128
129 /* Private display data
130 begin with DIB private structure to allow DIB events code sharing
131 */
132 struct SDL_PrivateVideoData {
133 HBITMAP screen_bmp;
134 HPALETTE screen_pal;
135
136 #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
137 int SDL_nummodes[NUM_MODELISTS];
138 SDL_Rect **SDL_modelist[NUM_MODELISTS];
139 enum SDL_ScreenOrientation userOrientation;
140 int invert;
141 char hiresFix; // using hires mode without defining hires resource
142 // --------------
143 int w, h;
144 enum SDL_ScreenOrientation gapiOrientation;
145
146 void *buffer; // may be 8, 16, 24, 32 bpp
147 PIXEL *videoMem;
148 BOOL needUpdate;
149 struct GXKeyList keyList;
150 struct GapiFunc gxFunc;
151 struct GXDisplayProperties gxProperties;
152 enum GAPIVideoMode videoMode;
153 int colorscale;
154 int dstLineStep; // in bytes
155 int dstPixelStep; // in bytes
156 int startOffset; // in bytes
157 int useVga;
158 };
159
160
161 #define gapiBuffer this->hidden->buffer
162 #define gapi this->hidden
163
164 #endif /* _SDL_gapivideo_h */