1 // ---------------------------------------------------------------------------
5 // translate and re-send mouse and keyboard events
6 // from SDL event loop to AntTweakBar
8 // @author Philippe Decaudin - http://www.antisphere.com
9 // @license This file is part of the AntTweakBar library.
10 // For conditions of distribution and use, see License.txt
12 // note: AntTweakBar.dll does not need to link with SDL,
13 // it just needs some definitions for its helper functions.
15 // ---------------------------------------------------------------------------
17 #include <AntTweakBar.h>
19 int TW_CALL TwEventSDL12(const void *sdlEvent); // implemented in TwEventSDL12.c
20 int TW_CALL TwEventSDL13(const void *sdlEvent); // implmeneted in TwEventSDL13.c
22 extern "C" { int TW_CALL TwSetLastError(const char *staticErrorMessage); }
24 int TW_CALL TwSetLastError(const char *staticErrorMessage);
28 // TwEventSDL returns zero if msg has not been handled or the SDL version
29 // is not supported, and a non-zero value if it has been handled by the
30 // AntTweakBar library.
31 int TW_CALL TwEventSDL(const void *sdlEvent, unsigned char majorVersion, unsigned char minorVersion)
33 if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 2))
35 static const char *g_ErrBadSDLVersion = "Unsupported SDL version";
36 TwSetLastError(g_ErrBadSDLVersion);
39 else if (majorVersion == 1 && minorVersion == 2)
40 return TwEventSDL12(sdlEvent);
41 else // if( majorVersion==1 && minorVersion==3 )
42 return TwEventSDL13(sdlEvent); // will probably not work for version > 1.3, but give it a chance