SDL-1.2.14
[sdl_omap.git] / src / video / gapi / SDL_gapivideo.h
CommitLineData
e14743d1 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#include "SDL_config.h"
23
24#ifndef _SDL_gapivideo_h
25#define _SDL_gapivideo_h
26
27#include "SDL_mouse.h"
28#include "SDL_mutex.h"
29#include "../SDL_sysvideo.h"
30#include "../windib/SDL_gapidibvideo.h"
31
32/* From gx.h, since it's not really C compliant */
33
34struct GXDisplayProperties {
35 DWORD cxWidth;
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.
41};
42
43struct GXKeyList {
44 short vkUp; // key for up
45 POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates.
46 short vkDown;
47 POINT ptDown;
48 short vkLeft;
49 POINT ptLeft;
50 short vkRight;
51 POINT ptRight;
52 short vkA;
53 POINT ptA;
54 short vkB;
55 POINT ptB;
56 short vkC;
57 POINT ptC;
58 short vkStart;
59 POINT ptStart;
60};
61
62typedef int (*PFNGXOpenDisplay)(HWND hWnd, DWORD dwFlags);
63typedef int (*PFNGXCloseDisplay)();
64typedef void* (*PFNGXBeginDraw)();
65typedef int (*PFNGXEndDraw)();
66typedef int (*PFNGXOpenInput)();
67typedef int (*PFNGXCloseInput)();
68typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties)();
69typedef struct GXKeyList (*PFNGXGetDefaultKeys)(int iOptions);
70typedef int (*PFNGXSuspend)();
71typedef int (*PFNGXResume)();
72typedef int (*PFNGXSetViewport)( DWORD dwTop, DWORD dwHeight, DWORD dwReserved1, DWORD dwReserved2 );
73typedef BOOL (*PFNGXIsDisplayDRAMBuffer)();
74
75struct GapiFunc
76{
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;
86 PFNGXResume GXResume;
87 PFNGXSetViewport GXSetViewport;
88 PFNGXIsDisplayDRAMBuffer GXIsDisplayDRAMBuffer;
89};
90
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
99
100#define GX_FULLSCREEN 0x01 // for OpenDisplay()
101#define GX_NORMALKEYS 0x02
102#define GX_LANDSCAPEKEYS 0x03
103
104
105/* GAPI video mode */
106typedef enum {
107 GAPI_NONE = 0,
108 GAPI_DIRECT_565,
109 GAPI_DIRECT_555,
110 GAPI_MONO,
111 GAPI_PALETTE
112} GAPIVideoMode;
113
114typedef unsigned short PIXEL;
115
116/* Private display data
117 begin with DIB private structure to allow DIB events code sharing
118*/
119struct GapiInfo {
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
125
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];
129
130
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;
135// --------------
136 int useGXOpenDisplay; /* use GXOpenDispplay */
137 int alreadyGXOpened;
138 int w, h;
139 // The orientation of GAPI framebuffer.
140 // Never changes on the same device.
141 SDL_ScreenOrientation gapiOrientation;
142
143 void *buffer; // may be 8, 16, 24, 32 bpp
144 PIXEL *videoMem;
145 BOOL needUpdate;
146 struct GXKeyList keyList;
147 struct GapiFunc gxFunc;
148 struct GXDisplayProperties gxProperties;
149 GAPIVideoMode videoMode;
150 int colorscale;
151 int dstLineStep; // in bytes
152 int dstPixelStep; // in bytes
153 int startOffset; // in bytes
154 int useVga;
155 int suspended; // do not pu anything into video memory
156};
157
158
159
160#endif /* _SDL_gapivideo_h */