src/video/win32/SDL_win32video.h
author Sam Lantinga <slouken@libsdl.org>
Tue, 27 Jul 2010 21:31:28 -0700
changeset 4569 e1664f94f026
parent 4504 9faebccfefb3
child 4694 c24ba2cc9583
permissions -rw-r--r--
Andrey A.

I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".

I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
+ tested all modes with WindowsMobile Emulator.

Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.

Also, I added a small fix for GDI fullscreen mode.

Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
slouken@1895
     1
/*
slouken@1895
     2
    SDL - Simple DirectMedia Layer
slouken@3697
     3
    Copyright (C) 1997-2010 Sam Lantinga
slouken@1895
     4
slouken@1895
     5
    This library is free software; you can redistribute it and/or
slouken@1895
     6
    modify it under the terms of the GNU Lesser General Public
slouken@1895
     7
    License as published by the Free Software Foundation; either
slouken@1895
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@1895
     9
slouken@1895
    10
    This library is distributed in the hope that it will be useful,
slouken@1895
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1895
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1895
    13
    Lesser General Public License for more details.
slouken@1895
    14
slouken@1895
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1895
    16
    License along with this library; if not, write to the Free Software
slouken@1895
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@1895
    18
slouken@1895
    19
    Sam Lantinga
slouken@1895
    20
    slouken@libsdl.org
slouken@1895
    21
*/
slouken@1895
    22
#include "SDL_config.h"
slouken@1895
    23
slouken@1895
    24
#ifndef _SDL_win32video_h
slouken@1895
    25
#define _SDL_win32video_h
slouken@1895
    26
slouken@1895
    27
#include "../SDL_sysvideo.h"
slouken@1895
    28
slouken@1895
    29
#define WIN32_LEAN_AND_MEAN
slouken@3706
    30
#define STRICT
slouken@4569
    31
#ifndef UNICODE
slouken@1895
    32
#define UNICODE
slouken@4569
    33
#endif
slouken@4426
    34
#undef WINVER
slouken@1895
    35
#define WINVER  0x500           /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
slouken@1895
    36
#include <windows.h>
slouken@1895
    37
slouken@1895
    38
#if SDL_VIDEO_RENDER_D3D
slouken@1901
    39
//#include <d3d9.h>
slouken@1901
    40
#define D3D_DEBUG_INFO
slouken@1901
    41
#include "d3d9.h"
slouken@1895
    42
#endif
slouken@1895
    43
slouken@3168
    44
#if SDL_VIDEO_RENDER_DDRAW
slouken@3168
    45
/* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */
slouken@3168
    46
#include <objbase.h>
slouken@3168
    47
#include "ddraw.h"
slouken@3168
    48
#endif
slouken@3168
    49
slouken@4504
    50
#include "SDL_win32clipboard.h"
slouken@1895
    51
#include "SDL_win32events.h"
slouken@1895
    52
#include "SDL_win32gamma.h"
slouken@1895
    53
#include "SDL_win32keyboard.h"
slouken@1895
    54
#include "SDL_win32modes.h"
slouken@1895
    55
#include "SDL_win32mouse.h"
slouken@1913
    56
#include "SDL_win32opengl.h"
slouken@1895
    57
#include "SDL_win32window.h"
slouken@1895
    58
slouken@1895
    59
#ifdef UNICODE
slouken@1901
    60
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
slouken@1895
    61
#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
slouken@1895
    62
#else
slouken@1901
    63
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
slouken@1895
    64
#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
slouken@1895
    65
#endif
slouken@4500
    66
extern void WIN_SetError(const char *prefix);
slouken@1895
    67
slouken@4569
    68
enum { RENDER_NONE, RENDER_D3D, RENDER_DDRAW, RENDER_GDI, RENDER_GAPI, RENDER_RAW };
slouken@4569
    69
slouken@4569
    70
typedef BOOL  (*PFNSHFullScreen)(HWND, DWORD);
slouken@4569
    71
typedef void  (*PFCoordTransform)(SDL_Window*, POINT*);
slouken@4569
    72
slouken@1895
    73
/* Private display data */
slouken@1895
    74
slouken@1895
    75
typedef struct SDL_VideoData
slouken@1895
    76
{
slouken@4569
    77
    int render;
slouken@4569
    78
slouken@1895
    79
#if SDL_VIDEO_RENDER_D3D
slouken@1895
    80
    HANDLE d3dDLL;
slouken@1895
    81
    IDirect3D9 *d3d;
slouken@1895
    82
#endif
slouken@3168
    83
#if SDL_VIDEO_RENDER_DDRAW
slouken@3168
    84
    HANDLE ddrawDLL;
slouken@3168
    85
    IDirectDraw *ddraw;
slouken@3168
    86
#endif
slouken@4569
    87
#ifdef _WIN32_WCE
slouken@4569
    88
    HMODULE hAygShell;
slouken@4569
    89
    PFNSHFullScreen SHFullScreen;
slouken@4569
    90
    PFCoordTransform CoordTransform;
slouken@4569
    91
#endif
slouken@3168
    92
slouken@4504
    93
    DWORD clipboard_count;
slouken@4504
    94
slouken@3196
    95
    const SDL_scancode *key_layout;
slouken@1895
    96
} SDL_VideoData;
slouken@1895
    97
slouken@1895
    98
#endif /* _SDL_win32video_h */
slouken@1895
    99
slouken@1895
   100
/* vi: set ts=4 sw=4 expandtab: */