1
0
forked from 0ad/0ad
0ad/source/lib/sdl.h
janwas 5299dcad86 - config: all macros are defined as 1 / 0. testing with #if allows compiler warnings (testing undefined macro) to spot misspelled macros
- debug: add provision for naming threads. allows adding current thread
name to log messages and displays their names in the debugger.
- replaced various if(err < 0) complain() sequences with new variants of
CHECK_ERR (see lib.h)
- fixes to mmgr/VC debug alloc enable code
- improved h_mgr error reporting (now complains when h_free fails)
- US -> UK english (partial)
- fix tex_load double-free bug
- move win32 mouse cursor code into sysdep
- error dialog is now topmost to make sure it's visible (was a problem)
- handle WM_QUIT before displaying error dialog (makes sure it's shown)

also as in previous 3 revisions.

This was SVN commit r2588.
2005-08-09 16:23:19 +00:00

41 lines
1.1 KiB
C
Executable File

#ifndef _lib_sdl_H
#define _lib_sdl_H
#define SDL_BUTTON_INDEX_COUNT 5
#if OS_WIN && !defined(NO_WSDL)
# include "sysdep/win/wsdl.h"
// The SDL_BUTTON_* enum is zero-based and in the range [0..4] in wsdl.h
#define SDL_BUTTON_TO_INDEX(_but) _but
#define SDL_INDEX_TO_BUTTON(_idx) _idx
#else
# include <SDL/SDL.h>
# include <SDL/SDL_thread.h>
# include <SDL/SDL_endian.h>
// if the compiler doesn't support inlining, this header will pull
// in static bswap routines. doesn't matter - modern compilers
// will strip them if unused, and this is more convenient than
// another header that toggles between wsdl and SDL_endian.h.
#if SDL_BUTTON_LEFT == 1 && SDL_BUTTON_MIDDLE == 2 && SDL_BUTTON_RIGHT == 3 \
&& SDL_BUTTON_WHEELUP == 4 && SDL_BUTTON_WHEELDOWN == 5
#define SDL_BUTTON_TO_INDEX(_but) ((_but) - 1)
#define SDL_INDEX_TO_BUTTON(_idx) ((_idx) - 1)
#else
/* Add a test like the one above for your set of button constants, and implement
the BUTTON_TO_INDEX macros so that the resulting indices are within the range
[0, SDL_BUTTON_INDEX_COUNT-1]
*/
#error "Platform with unrecognized SDL constants. Update sdl.h"
#endif
#endif
#endif // _lib_sdl_H