comparison src/core/windows/SDL_windows.h @ 5092:327f181542f1

Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share. I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c
author Sam Lantinga <slouken@libsdl.org>
date Mon, 24 Jan 2011 21:20:30 -0800
parents
children b530ef003506
comparison
equal deleted inserted replaced
5091:79bd1e289005 5092:327f181542f1
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 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
23 /* This is an include file for windows.h with the SDL build settings */
24
25 #ifndef _INCLUDED_WINDOWS_H
26 #define _INCLUDED_WINDOWS_H
27
28 #define WIN32_LEAN_AND_MEAN
29 #define STRICT
30 #ifndef UNICODE
31 #define UNICODE 1
32 #endif
33 #undef WINVER
34 #define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
35
36 #include <windows.h>
37
38
39 /* Routines to convert from UTF8 to native Windows text */
40 #if UNICODE
41 #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR))
42 #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)(S), SDL_strlen(S)+1)
43 #else
44 #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)(S), (SDL_strlen(S)+1))
45 #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1)
46 #endif
47
48 /* Sets an error message based on GetLastError() */
49 extern void WIN_SetError(const char *prefix);
50
51 #endif /* _INCLUDED_WINDOWS_H */
52
53 /* vi: set ts=4 sw=4 expandtab: */