comparison src/video/win32/SDL_gapirender_c.h @ 3168:6338b7f2d024

Hi, I have prepared a set of patches to readd WindowsCE support to SDL 1.3. I've created a new GAPI/Rawframebuffer and a DirectDraw renderer. Both renderers are work in progress and there are several unimplemented cases. (Notably RenderLine/RenderPoint/RenderFill/QueryTexturePixels/UpdateTexture and texture blending ) Nevertheless I am successfully using these renderers together with the SDL software renderer. (On most devices the SDL software renderer will be much faster as there are only badly optimized vendor drivers available) I send these patches now in this unpolished state because there seems to be some interest in win ce and someone has to start supporting SDL 1.3 Now on to the patches: wince_events_window_fixes.patch fixes some wince incompatibilities and adds fullscreen support via SHFullScreen. NOTE: This patch shouldn't have any side effects on Windows, but I have NOT tested it on Windows, so please double-check. This patch doesn't dependent on the following ones. wince_renderers_system.patch This patch does all necessary modifications to the SDL system. - it adds the renderers to the configure system - it adds the renderers to win32video SDL_ceddrawrender.c SDL_ceddrawrender.h SDL_gapirender_c.h SDL_gapirender.c SDL_gapirender.h these files add the new render drivers and should be placed in src/video/win32 Some notes to people who want to test this: - I have only compiled sdl with ming32ce, so the VisualC files are not up to date - As mingw32ce has no ddraw.h this file must be taken from the MS SDK and modified to work with gcc - I had to modify line 2611 in configure.in to EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer -Wl,--image-base -Wl,0x10000" otherwise GetCPinfo wouldn't link. If someone knows whats causing this I'd be happy to hear about it. It would be great if these patches could make their way into SVN as this would make collaboration much much easier. I'm out of office for the next week and therefore will be unavailable via email. Regards Stefan
author Sam Lantinga <slouken@libsdl.org>
date Sun, 07 Jun 2009 02:44:46 +0000
parents
children f7b03b6838cb
comparison
equal deleted inserted replaced
3167:0c85abc61e47 3168:6338b7f2d024
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