2005-06-20 17:14:36 +02:00
|
|
|
#ifndef _lib_sdl_H
|
|
|
|
#define _lib_sdl_H
|
|
|
|
|
|
|
|
#define SDL_BUTTON_INDEX_COUNT 5
|
|
|
|
|
2004-03-03 00:56:51 +01:00
|
|
|
#if defined(_WIN32) && !defined(NO_WSDL)
|
2004-05-06 19:14:30 +02:00
|
|
|
# include "sysdep/win/wsdl.h"
|
2005-06-20 17:14:36 +02:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2004-03-03 00:56:51 +01:00
|
|
|
#else
|
2004-05-06 19:14:30 +02:00
|
|
|
# include <SDL/SDL.h>
|
|
|
|
# include <SDL/SDL_thread.h>
|
2004-05-31 14:21:14 +02:00
|
|
|
# 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.
|
2005-06-20 17:14:36 +02:00
|
|
|
|
|
|
|
#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
|
|
|
|
|
2004-05-06 19:14:30 +02:00
|
|
|
#endif
|
2005-06-20 17:14:36 +02:00
|
|
|
|
|
|
|
#endif // _lib_sdl_H
|