src/video/gapi/SDL_gapivideo.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 02 Aug 2009 18:39:57 +0000
changeset 3227 458e53d8662c
parent 2859 99210400e8b9
permissions -rw-r--r--
Clarified API documentation
icculus@1251
     1
/*
icculus@1251
     2
    SDL - Simple DirectMedia Layer
slouken@2859
     3
    Copyright (C) 1997-2009 Sam Lantinga
icculus@1251
     4
icculus@1251
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
icculus@1251
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
icculus@1251
     9
icculus@1251
    10
    This library is distributed in the hope that it will be useful,
icculus@1251
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
icculus@1251
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
icculus@1251
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
icculus@1251
    18
icculus@1251
    19
    Sam Lantinga
icculus@1251
    20
    slouken@libsdl.org
icculus@1251
    21
*/
slouken@1402
    22
#include "SDL_config.h"
icculus@1251
    23
icculus@1251
    24
#ifndef _SDL_gapivideo_h
icculus@1251
    25
#define _SDL_gapivideo_h
icculus@1251
    26
icculus@1251
    27
#include "SDL_mouse.h"
icculus@1251
    28
#include "SDL_mutex.h"
slouken@1361
    29
#include "../SDL_sysvideo.h"
icculus@1251
    30
icculus@1251
    31
/* From gx.h, since it's not really C compliant */
icculus@1251
    32
slouken@1895
    33
struct GXDisplayProperties
slouken@1895
    34
{
icculus@1251
    35
    DWORD cxWidth;
slouken@1895
    36
    DWORD cyHeight;             // notice lack of 'th' in the word height.
slouken@1895
    37
    long cbxPitch;              // number of bytes to move right one x pixel - can be negative.
slouken@1895
    38
    long cbyPitch;              // number of bytes to move down one y pixel - can be negative.
slouken@1895
    39
    long cBPP;                  // # of bits in each pixel
slouken@1895
    40
    DWORD ffFormat;             // format flags.
icculus@1251
    41
};
icculus@1251
    42
slouken@1895
    43
struct GXKeyList
slouken@1895
    44
{
slouken@1895
    45
    short vkUp;                 // key for up
slouken@1895
    46
    POINT ptUp;                 // x,y position of key/button.  Not on screen but in screen coordinates.
icculus@1251
    47
    short vkDown;
icculus@1251
    48
    POINT ptDown;
icculus@1251
    49
    short vkLeft;
icculus@1251
    50
    POINT ptLeft;
icculus@1251
    51
    short vkRight;
icculus@1251
    52
    POINT ptRight;
icculus@1251
    53
    short vkA;
icculus@1251
    54
    POINT ptA;
icculus@1251
    55
    short vkB;
icculus@1251
    56
    POINT ptB;
icculus@1251
    57
    short vkC;
icculus@1251
    58
    POINT ptC;
icculus@1251
    59
    short vkStart;
icculus@1251
    60
    POINT ptStart;
icculus@1251
    61
};
icculus@1251
    62
slouken@1895
    63
typedef int (*PFNGXOpenDisplay) (HWND hWnd, DWORD dwFlags);
slouken@1895
    64
typedef int (*PFNGXCloseDisplay) ();
slouken@1895
    65
typedef void *(*PFNGXBeginDraw) ();
slouken@1895
    66
typedef int (*PFNGXEndDraw) ();
slouken@1895
    67
typedef int (*PFNGXOpenInput) ();
slouken@1895
    68
typedef int (*PFNGXCloseInput) ();
slouken@1895
    69
typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties) ();
slouken@1895
    70
typedef struct GXKeyList (*PFNGXGetDefaultKeys) (int iOptions);
slouken@1895
    71
typedef int (*PFNGXSuspend) ();
slouken@1895
    72
typedef int (*PFNGXResume) ();
slouken@1895
    73
typedef int (*PFNGXSetViewport) (DWORD dwTop, DWORD dwHeight,
slouken@1895
    74
                                 DWORD dwReserved1, DWORD dwReserved2);
slouken@1895
    75
typedef BOOL(*PFNGXIsDisplayDRAMBuffer) ();
icculus@1251
    76
icculus@1251
    77
struct GapiFunc
icculus@1251
    78
{
slouken@1895
    79
    PFNGXOpenDisplay GXOpenDisplay;
slouken@1895
    80
    PFNGXCloseDisplay GXCloseDisplay;
slouken@1895
    81
    PFNGXBeginDraw GXBeginDraw;
slouken@1895
    82
    PFNGXEndDraw GXEndDraw;
slouken@1895
    83
    PFNGXOpenInput GXOpenInput;
slouken@1895
    84
    PFNGXCloseInput GXCloseInput;
icculus@1251
    85
    PFNGXGetDisplayProperties GXGetDisplayProperties;
slouken@1895
    86
    PFNGXGetDefaultKeys GXGetDefaultKeys;
slouken@1895
    87
    PFNGXSuspend GXSuspend;
slouken@1895
    88
    PFNGXResume GXResume;
slouken@1895
    89
    PFNGXSetViewport GXSetViewport;
slouken@1895
    90
    PFNGXIsDisplayDRAMBuffer GXIsDisplayDRAMBuffer;
icculus@1251
    91
};
icculus@1251
    92
slouken@1895
    93
#define kfLandscape	0x8     // Screen is rotated 270 degrees
slouken@1895
    94
#define kfPalette	0x10    // Pixel values are indexes into a palette
slouken@1895
    95
#define kfDirect	0x20    // Pixel values contain actual level information
slouken@1895
    96
#define kfDirect555	0x40    // 5 bits each for red, green and blue values in a pixel.
slouken@1895
    97
#define kfDirect565	0x80    // 5 red bits, 6 green bits and 5 blue bits per pixel
slouken@1895
    98
#define kfDirect888	0x100   // 8 bits each for red, green and blue values in a pixel.
slouken@1895
    99
#define kfDirect444	0x200   // 4 red, 4 green, 4 blue
icculus@1251
   100
#define kfDirectInverted 0x400
icculus@1251
   101
slouken@1895
   102
#define GX_FULLSCREEN	0x01    // for OpenDisplay()
icculus@1251
   103
#define GX_NORMALKEYS   0x02
icculus@1251
   104
#define GX_LANDSCAPEKEYS        0x03
icculus@1251
   105
icculus@1251
   106
typedef enum
icculus@1251
   107
{
slouken@1895
   108
    SDL_ORIENTATION_UP,
slouken@1895
   109
    SDL_ORIENTATION_DOWN,
slouken@1895
   110
    SDL_ORIENTATION_LEFT,
slouken@1895
   111
    SDL_ORIENTATION_RIGHT
icculus@1251
   112
} SDL_ScreenOrientation;
icculus@1251
   113
icculus@1251
   114
/* GAPI video mode */
slouken@1895
   115
typedef enum
slouken@1895
   116
{
slouken@1895
   117
    GAPI_NONE = 0,
slouken@1895
   118
    GAPI_DIRECT_565,
slouken@1895
   119
    GAPI_DIRECT_555,
slouken@1895
   120
    GAPI_MONO,
slouken@1895
   121
    GAPI_PALETTE
slouken@1895
   122
} GAPIVideoMode;
icculus@1251
   123
icculus@1251
   124
/* Hidden "this" pointer for the video functions */
icculus@1251
   125
#define _THIS	SDL_VideoDevice *this
icculus@1251
   126
icculus@1251
   127
typedef unsigned short PIXEL;
icculus@1251
   128
icculus@1251
   129
/* Private display data 
icculus@1251
   130
   begin with DIB private structure to allow DIB events code sharing
icculus@1251
   131
*/
slouken@1895
   132
struct SDL_PrivateVideoData
slouken@1895
   133
{
icculus@1251
   134
    HBITMAP screen_bmp;
icculus@1251
   135
    HPALETTE screen_pal;
icculus@1251
   136
slouken@1895
   137
#define NUM_MODELISTS	4       /* 8, 16, 24, and 32 bits-per-pixel */
icculus@1251
   138
    int SDL_nummodes[NUM_MODELISTS];
icculus@1251
   139
    SDL_Rect **SDL_modelist[NUM_MODELISTS];
slouken@1895
   140
    enum SDL_ScreenOrientation userOrientation;
slouken@1895
   141
    int invert;
slouken@1895
   142
    char hiresFix;              // using hires mode without defining hires resource
icculus@1251
   143
// --------------
slouken@1895
   144
    int useGXOpenDisplay;       /* use GXOpenDispplay */
icculus@1251
   145
    int w, h;
slouken@1895
   146
    enum SDL_ScreenOrientation gapiOrientation;
icculus@1251
   147
slouken@1895
   148
    void *buffer;               // may be 8, 16, 24, 32 bpp
slouken@1895
   149
    PIXEL *videoMem;
slouken@1895
   150
    BOOL needUpdate;
slouken@1895
   151
    struct GXKeyList keyList;
slouken@1895
   152
    struct GapiFunc gxFunc;
slouken@1895
   153
    struct GXDisplayProperties gxProperties;
slouken@1895
   154
    enum GAPIVideoMode videoMode;
slouken@1895
   155
    int colorscale;
slouken@1895
   156
    int dstLineStep;            // in bytes
slouken@1895
   157
    int dstPixelStep;           // in bytes
slouken@1895
   158
    int startOffset;            // in bytes
slouken@1895
   159
    int useVga;
slouken@1895
   160
    int suspended;              // do not pu anything into video memory
icculus@1251
   161
};
icculus@1251
   162
icculus@1251
   163
icculus@1251
   164
#define gapiBuffer this->hidden->buffer
icculus@1251
   165
#define gapi this->hidden
icculus@1251
   166
icculus@1251
   167
#endif /* _SDL_gapivideo_h */
slouken@1895
   168
/* vi: set ts=4 sw=4 expandtab: */