Mercurial > sdl-ios-xcode
comparison src/video/gapi/SDL_gapivideo.h @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | 420b3f47806d |
children | 4da1ee79c9af |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
28 #include "SDL_mutex.h" | 28 #include "SDL_mutex.h" |
29 #include "../SDL_sysvideo.h" | 29 #include "../SDL_sysvideo.h" |
30 | 30 |
31 /* From gx.h, since it's not really C compliant */ | 31 /* From gx.h, since it's not really C compliant */ |
32 | 32 |
33 struct GXDisplayProperties { | 33 struct GXDisplayProperties |
34 { | |
34 DWORD cxWidth; | 35 DWORD cxWidth; |
35 DWORD cyHeight; // notice lack of 'th' in the word height. | 36 DWORD cyHeight; // notice lack of 'th' in the word height. |
36 long cbxPitch; // number of bytes to move right one x pixel - can be negative. | 37 long cbxPitch; // number of bytes to move right one x pixel - can be negative. |
37 long cbyPitch; // number of bytes to move down one y pixel - can be negative. | 38 long cbyPitch; // number of bytes to move down one y pixel - can be negative. |
38 long cBPP; // # of bits in each pixel | 39 long cBPP; // # of bits in each pixel |
39 DWORD ffFormat; // format flags. | 40 DWORD ffFormat; // format flags. |
40 }; | 41 }; |
41 | 42 |
42 struct GXKeyList { | 43 struct GXKeyList |
43 short vkUp; // key for up | 44 { |
44 POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates. | 45 short vkUp; // key for up |
46 POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates. | |
45 short vkDown; | 47 short vkDown; |
46 POINT ptDown; | 48 POINT ptDown; |
47 short vkLeft; | 49 short vkLeft; |
48 POINT ptLeft; | 50 POINT ptLeft; |
49 short vkRight; | 51 short vkRight; |
56 POINT ptC; | 58 POINT ptC; |
57 short vkStart; | 59 short vkStart; |
58 POINT ptStart; | 60 POINT ptStart; |
59 }; | 61 }; |
60 | 62 |
61 typedef int (*PFNGXOpenDisplay)(HWND hWnd, DWORD dwFlags); | 63 typedef int (*PFNGXOpenDisplay) (HWND hWnd, DWORD dwFlags); |
62 typedef int (*PFNGXCloseDisplay)(); | 64 typedef int (*PFNGXCloseDisplay) (); |
63 typedef void* (*PFNGXBeginDraw)(); | 65 typedef void *(*PFNGXBeginDraw) (); |
64 typedef int (*PFNGXEndDraw)(); | 66 typedef int (*PFNGXEndDraw) (); |
65 typedef int (*PFNGXOpenInput)(); | 67 typedef int (*PFNGXOpenInput) (); |
66 typedef int (*PFNGXCloseInput)(); | 68 typedef int (*PFNGXCloseInput) (); |
67 typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties)(); | 69 typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties) (); |
68 typedef struct GXKeyList (*PFNGXGetDefaultKeys)(int iOptions); | 70 typedef struct GXKeyList (*PFNGXGetDefaultKeys) (int iOptions); |
69 typedef int (*PFNGXSuspend)(); | 71 typedef int (*PFNGXSuspend) (); |
70 typedef int (*PFNGXResume)(); | 72 typedef int (*PFNGXResume) (); |
71 typedef int (*PFNGXSetViewport)( DWORD dwTop, DWORD dwHeight, DWORD dwReserved1, DWORD dwReserved2 ); | 73 typedef int (*PFNGXSetViewport) (DWORD dwTop, DWORD dwHeight, |
72 typedef BOOL (*PFNGXIsDisplayDRAMBuffer)(); | 74 DWORD dwReserved1, DWORD dwReserved2); |
75 typedef BOOL (*PFNGXIsDisplayDRAMBuffer) (); | |
73 | 76 |
74 struct GapiFunc | 77 struct GapiFunc |
75 { | 78 { |
76 PFNGXOpenDisplay GXOpenDisplay; | 79 PFNGXOpenDisplay GXOpenDisplay; |
77 PFNGXCloseDisplay GXCloseDisplay; | 80 PFNGXCloseDisplay GXCloseDisplay; |
78 PFNGXBeginDraw GXBeginDraw; | 81 PFNGXBeginDraw GXBeginDraw; |
79 PFNGXEndDraw GXEndDraw; | 82 PFNGXEndDraw GXEndDraw; |
80 PFNGXOpenInput GXOpenInput; | 83 PFNGXOpenInput GXOpenInput; |
81 PFNGXCloseInput GXCloseInput; | 84 PFNGXCloseInput GXCloseInput; |
82 PFNGXGetDisplayProperties GXGetDisplayProperties; | 85 PFNGXGetDisplayProperties GXGetDisplayProperties; |
83 PFNGXGetDefaultKeys GXGetDefaultKeys; | 86 PFNGXGetDefaultKeys GXGetDefaultKeys; |
84 PFNGXSuspend GXSuspend; | 87 PFNGXSuspend GXSuspend; |
85 PFNGXResume GXResume; | 88 PFNGXResume GXResume; |
86 PFNGXSetViewport GXSetViewport; | 89 PFNGXSetViewport GXSetViewport; |
87 PFNGXIsDisplayDRAMBuffer GXIsDisplayDRAMBuffer; | 90 PFNGXIsDisplayDRAMBuffer GXIsDisplayDRAMBuffer; |
88 }; | 91 }; |
89 | 92 |
90 #define kfLandscape 0x8 // Screen is rotated 270 degrees | 93 #define kfLandscape 0x8 // Screen is rotated 270 degrees |
91 #define kfPalette 0x10 // Pixel values are indexes into a palette | 94 #define kfPalette 0x10 // Pixel values are indexes into a palette |
92 #define kfDirect 0x20 // Pixel values contain actual level information | 95 #define kfDirect 0x20 // Pixel values contain actual level information |
93 #define kfDirect555 0x40 // 5 bits each for red, green and blue values in a pixel. | 96 #define kfDirect555 0x40 // 5 bits each for red, green and blue values in a pixel. |
94 #define kfDirect565 0x80 // 5 red bits, 6 green bits and 5 blue bits per pixel | 97 #define kfDirect565 0x80 // 5 red bits, 6 green bits and 5 blue bits per pixel |
95 #define kfDirect888 0x100 // 8 bits each for red, green and blue values in a pixel. | 98 #define kfDirect888 0x100 // 8 bits each for red, green and blue values in a pixel. |
96 #define kfDirect444 0x200 // 4 red, 4 green, 4 blue | 99 #define kfDirect444 0x200 // 4 red, 4 green, 4 blue |
97 #define kfDirectInverted 0x400 | 100 #define kfDirectInverted 0x400 |
98 | 101 |
99 #define GX_FULLSCREEN 0x01 // for OpenDisplay() | 102 #define GX_FULLSCREEN 0x01 // for OpenDisplay() |
100 #define GX_NORMALKEYS 0x02 | 103 #define GX_NORMALKEYS 0x02 |
101 #define GX_LANDSCAPEKEYS 0x03 | 104 #define GX_LANDSCAPEKEYS 0x03 |
102 | 105 |
103 typedef enum | 106 typedef enum |
104 { | 107 { |
105 SDL_ORIENTATION_UP, | 108 SDL_ORIENTATION_UP, |
106 SDL_ORIENTATION_DOWN, | 109 SDL_ORIENTATION_DOWN, |
107 SDL_ORIENTATION_LEFT, | 110 SDL_ORIENTATION_LEFT, |
108 SDL_ORIENTATION_RIGHT | 111 SDL_ORIENTATION_RIGHT |
109 } SDL_ScreenOrientation; | 112 } SDL_ScreenOrientation; |
110 | 113 |
111 /* GAPI video mode */ | 114 /* GAPI video mode */ |
112 typedef enum { | 115 typedef enum |
113 GAPI_NONE = 0, | 116 { |
114 GAPI_DIRECT_565, | 117 GAPI_NONE = 0, |
115 GAPI_DIRECT_555, | 118 GAPI_DIRECT_565, |
116 GAPI_MONO, | 119 GAPI_DIRECT_555, |
117 GAPI_PALETTE | 120 GAPI_MONO, |
118 } GAPIVideoMode; | 121 GAPI_PALETTE |
122 } GAPIVideoMode; | |
119 | 123 |
120 /* Hidden "this" pointer for the video functions */ | 124 /* Hidden "this" pointer for the video functions */ |
121 #define _THIS SDL_VideoDevice *this | 125 #define _THIS SDL_VideoDevice *this |
122 | 126 |
123 typedef unsigned short PIXEL; | 127 typedef unsigned short PIXEL; |
124 | 128 |
125 /* Private display data | 129 /* Private display data |
126 begin with DIB private structure to allow DIB events code sharing | 130 begin with DIB private structure to allow DIB events code sharing |
127 */ | 131 */ |
128 struct SDL_PrivateVideoData { | 132 struct SDL_PrivateVideoData |
133 { | |
129 HBITMAP screen_bmp; | 134 HBITMAP screen_bmp; |
130 HPALETTE screen_pal; | 135 HPALETTE screen_pal; |
131 | 136 |
132 #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ | 137 #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ |
133 int SDL_nummodes[NUM_MODELISTS]; | 138 int SDL_nummodes[NUM_MODELISTS]; |
134 SDL_Rect **SDL_modelist[NUM_MODELISTS]; | 139 SDL_Rect **SDL_modelist[NUM_MODELISTS]; |
135 enum SDL_ScreenOrientation userOrientation; | 140 enum SDL_ScreenOrientation userOrientation; |
136 int invert; | 141 int invert; |
137 char hiresFix; // using hires mode without defining hires resource | 142 char hiresFix; // using hires mode without defining hires resource |
138 // -------------- | 143 // -------------- |
139 int useGXOpenDisplay; /* use GXOpenDispplay */ | 144 int useGXOpenDisplay; /* use GXOpenDispplay */ |
140 int w, h; | 145 int w, h; |
141 enum SDL_ScreenOrientation gapiOrientation; | 146 enum SDL_ScreenOrientation gapiOrientation; |
142 | 147 |
143 void *buffer; // may be 8, 16, 24, 32 bpp | 148 void *buffer; // may be 8, 16, 24, 32 bpp |
144 PIXEL *videoMem; | 149 PIXEL *videoMem; |
145 BOOL needUpdate; | 150 BOOL needUpdate; |
146 struct GXKeyList keyList; | 151 struct GXKeyList keyList; |
147 struct GapiFunc gxFunc; | 152 struct GapiFunc gxFunc; |
148 struct GXDisplayProperties gxProperties; | 153 struct GXDisplayProperties gxProperties; |
149 enum GAPIVideoMode videoMode; | 154 enum GAPIVideoMode videoMode; |
150 int colorscale; | 155 int colorscale; |
151 int dstLineStep; // in bytes | 156 int dstLineStep; // in bytes |
152 int dstPixelStep; // in bytes | 157 int dstPixelStep; // in bytes |
153 int startOffset; // in bytes | 158 int startOffset; // in bytes |
154 int useVga; | 159 int useVga; |
155 int suspended; // do not pu anything into video memory | 160 int suspended; // do not pu anything into video memory |
156 }; | 161 }; |
157 | 162 |
158 | 163 |
159 #define gapiBuffer this->hidden->buffer | 164 #define gapiBuffer this->hidden->buffer |
160 #define gapi this->hidden | 165 #define gapi this->hidden |
161 | 166 |
162 #endif /* _SDL_gapivideo_h */ | 167 #endif /* _SDL_gapivideo_h */ |
168 /* vi: set ts=4 sw=4 expandtab: */ |