SDL_windows.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /* This is an include file for windows.h with the SDL build settings */
  19. #ifndef _INCLUDED_WINDOWS_H
  20. #define _INCLUDED_WINDOWS_H
  21. #if defined(__WIN32__)
  22. #define WIN32_LEAN_AND_MEAN
  23. #define STRICT
  24. #ifndef UNICODE
  25. #define UNICODE 1
  26. #endif
  27. #undef _WIN32_WINNT
  28. #define _WIN32_WINNT 0x501 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */
  29. #endif
  30. #include <windows.h>
  31. /* Routines to convert from UTF8 to native Windows text */
  32. #if UNICODE
  33. #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR))
  34. #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", (char *)(S), SDL_strlen(S)+1)
  35. #else
  36. #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)(S), (SDL_strlen(S)+1))
  37. #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1)
  38. #endif
  39. /* Sets an error message based on a given HRESULT */
  40. extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
  41. /* Sets an error message based on GetLastError(). Always return -1. */
  42. extern int WIN_SetError(const char *prefix);
  43. /* Wrap up the oddities of CoInitialize() into a common function. */
  44. extern HRESULT WIN_CoInitialize(void);
  45. extern void WIN_CoUninitialize(void);
  46. #endif /* _INCLUDED_WINDOWS_H */
  47. /* vi: set ts=4 sw=4 expandtab: */