cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

SDL_windows.h (2468B)


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