2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 Sam Lantinga
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.
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.
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
22 #include "SDL_config.h"
24 #ifndef _SDL_gapivideo_h
25 #define _SDL_gapivideo_h
27 #include "SDL_mouse.h"
28 #include "SDL_mutex.h"
29 #include "../SDL_sysvideo.h"
30 #include "../windib/SDL_gapidibvideo.h"
32 /* From gx.h, since it's not really C compliant */
34 struct GXDisplayProperties {
36 DWORD cyHeight; // notice lack of 'th' in the word height.
37 long cbxPitch; // number of bytes to move right one x pixel - can be negative.
38 long cbyPitch; // number of bytes to move down one y pixel - can be negative.
39 long cBPP; // # of bits in each pixel
40 DWORD ffFormat; // format flags.
44 short vkUp; // key for up
45 POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates.
62 typedef int (*PFNGXOpenDisplay)(HWND hWnd, DWORD dwFlags);
63 typedef int (*PFNGXCloseDisplay)();
64 typedef void* (*PFNGXBeginDraw)();
65 typedef int (*PFNGXEndDraw)();
66 typedef int (*PFNGXOpenInput)();
67 typedef int (*PFNGXCloseInput)();
68 typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties)();
69 typedef struct GXKeyList (*PFNGXGetDefaultKeys)(int iOptions);
70 typedef int (*PFNGXSuspend)();
71 typedef int (*PFNGXResume)();
72 typedef int (*PFNGXSetViewport)( DWORD dwTop, DWORD dwHeight, DWORD dwReserved1, DWORD dwReserved2 );
73 typedef BOOL (*PFNGXIsDisplayDRAMBuffer)();
77 PFNGXOpenDisplay GXOpenDisplay;
78 PFNGXCloseDisplay GXCloseDisplay;
79 PFNGXBeginDraw GXBeginDraw;
80 PFNGXEndDraw GXEndDraw;
81 PFNGXOpenInput GXOpenInput;
82 PFNGXCloseInput GXCloseInput;
83 PFNGXGetDisplayProperties GXGetDisplayProperties;
84 PFNGXGetDefaultKeys GXGetDefaultKeys;
85 PFNGXSuspend GXSuspend;
87 PFNGXSetViewport GXSetViewport;
88 PFNGXIsDisplayDRAMBuffer GXIsDisplayDRAMBuffer;
91 #define kfLandscape 0x8 // Screen is rotated 270 degrees
92 #define kfPalette 0x10 // Pixel values are indexes into a palette
93 #define kfDirect 0x20 // Pixel values contain actual level information
94 #define kfDirect555 0x40 // 5 bits each for red, green and blue values in a pixel.
95 #define kfDirect565 0x80 // 5 red bits, 6 green bits and 5 blue bits per pixel
96 #define kfDirect888 0x100 // 8 bits each for red, green and blue values in a pixel.
97 #define kfDirect444 0x200 // 4 red, 4 green, 4 blue
98 #define kfDirectInverted 0x400
100 #define GX_FULLSCREEN 0x01 // for OpenDisplay()
101 #define GX_NORMALKEYS 0x02
102 #define GX_LANDSCAPEKEYS 0x03
105 /* GAPI video mode */
114 typedef unsigned short PIXEL;
116 /* Private display data
117 begin with DIB private structure to allow DIB events code sharing
120 /* Rotation which has to be applied to the key (arrow keys) and mouse events measured in quarters of a circle
121 * counter clockwise */
122 int coordinateTransform;
123 char hiresFix; /* using hires mode without defining hires resource */
124 int invert; //TODO this is only written but never read, so it should be removed
126 #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
127 int SDL_nummodes[NUM_MODELISTS];
128 SDL_Rect **SDL_modelist[NUM_MODELISTS];
131 // The orientation of the video mode user wants to get
132 // Probably restricted to UP and RIGHT
133 SDL_ScreenOrientation userOrientation;
134 SDL_ScreenOrientation systemOrientation;
136 int useGXOpenDisplay; /* use GXOpenDispplay */
139 // The orientation of GAPI framebuffer.
140 // Never changes on the same device.
141 SDL_ScreenOrientation gapiOrientation;
143 void *buffer; // may be 8, 16, 24, 32 bpp
146 struct GXKeyList keyList;
147 struct GapiFunc gxFunc;
148 struct GXDisplayProperties gxProperties;
149 GAPIVideoMode videoMode;
151 int dstLineStep; // in bytes
152 int dstPixelStep; // in bytes
153 int startOffset; // in bytes
155 int suspended; // do not pu anything into video memory
160 #endif /* _SDL_gapivideo_h */