Commit 3b77e568 authored by Philip Trettner's avatar Philip Trettner
Browse files

Initial commit

Pipeline #1553 skipped
--- AntTweakBar library change log ---
* Version 1.16 (2013/03/21)
- Moved AntTweakBar documentation to sourceforge, available at:
- AntTweakBar source code repository is now on sourceforge too at:
- Fixed several issues with the core profile on OSX 10.8 (Thanks to
Christoph G., George P. and Robert H. for their help).
- Fixed unwanted repeated key pressed (Thanks to Alec J. for the patch).
- Added Visual Studio 2012 projects to the repository.
- Memory representation of std::string has changed again with Visual Studio
2012. Handled it.
- Modified Linux and OSX Makefiles to build also static version of the library
in addition to dynamic library (Thanks to Luigi R.).
- Fonts can be scaled globally through the "fontscaling" parameter, may be
useful for high density display (Suggested by Eric RH.).
- Fixed compilation issue with different system locale (Reported by Arnaud M.)
* Version 1.15 (2012/07/22)
- Added support for OpenGL Core Profile (3.2 and higher); it is enabled by
setting the TwGraphAPI parameter of the TwInit function to TW_OPENGL_CORE
(Thanks to Oystein E. and Arnaud M. for their contribution).
- Added a simple example that uses OpenGL Core Profile and SDL; see
TwGLCoreSDL.c .
- Added helper function TwEventX11 to handle native X11 events (Thanks to
Greg P. for the code).
- Added builtin fixed-width font for tweak bars; it is enabled through
the fontstyle bar parameter; it is not resizable (Thanks to Jay D. for
the font).
- Store and restore states of OpenGL vertex attribute arrays (Thanks to
Jerry J. and Eduard B.).
- Fixed memory access violation caused by the popup bar (Thanks to Matthias R.
for reporting it).
- Added code to overcome issue caused by the memory representation change
of std::string that occurs between Visual Studio 2008 and 2010.
* Version 1.14 (2011/03/26)
- Added 64 bit version of the library.
- Added multiple windows support (Inspired by comments and code from Evan F.
and Ivo H.)
- Better MacOSX support (Thanks to Alexis DH., Fabrice N., Diederick H.,
Alec J.).
- Improved readability of overlapped transparent bars. Content of overlapped
regions is clipped and not drawn. This behavior can be disabled using
the bar parameter "overlap".
- Added support for Direct3D11 (Thanks to Jorge H., Lukasz M., Se1zen).
- Added an example based on DirectX 11.
- Added support for SDL 1.3 integration in addition to SDL 1.2.
ABI modification: TwEventSDL takes SDL version as an additional parameter.
- Added support for SFML 1.6 integration.
- Added support for GLFW 2.7 integration in addition to GLFW 2.6. This may
imply changing the calling convention of event callbacks. Can be done by
defining GLFW_CDECL before including AntTweakBar.h if needed.
- Added function TwKeyTest that checks if a key event would be processed by
AntTweakBar but without processing it. Needed to fix bad handling report of
WM_KEYUP and WM_KEYDOWN in TwEventWin (Thanks to Ryan DB. for reporting it).
- Added check sign for vars of type boolean.
- Added new bar parameter "buttonalign" to center or left-align buttons
(Suggested by Michael R.).
- Allowed values column width to be adjusted to fit its content. This is done
by setting the bar parameter valueswidth=fit (Requested by Koshmaar and
Michael R.). The user can also click in the left or right area near the
value width slider to fit column content.
- Added new helper function TwDefineEnumFromString to ease the defining of an
enum through a string of comma-separated enum values (Thanks to Bruno L.
for the suggestion and code).
- Fixed compilation issues with gcc4 (missing includes, warnings).
- Fixes for the fedora package maintained by Sean Middleditch.
- Fixed rotation widget display and interaction issues when the library is
compiled with gcc -O3 (Thanks to Ares L. for reporting this).
- Fixed SDL key event SDLK_RETURN handling after a bar is minimized (Thanks
to Sean M. for reporting this).
- Fixed issue with SDL_ShowCursor (Thanks to Hugues M. for reporting it).
- Fixed DirectX10 resource issue.
- Store and restore GL_TEXTURE_COORD_ARRAY state (Thanks to Jerry J. for
reporting this).
- Fixed mouse click repetition issue with passive event loop (Thanks to
Bruno L. for reporting it).
- Fixed issue with mouse button event when glut windows doesn't have focus
(Thanks to Scott J. for the fix).
- Reset enum content each time the var parameter "enum" is set using TwDefine
or TwSetParam (Following Carsten W. and Sulaiman remarks).
- Fixed memory corruption when more than one std_string are defined in a
custom struct (Thanks to Sulaiman for reporting it).
- Fixed mouse position issue with Direct3D9 fullscreen mode in TwSimpleDX9
(Thanks to Paolo S. for pointing this out).
- Fixed ignored double-click in TwEvenWin (Thanks to H. Seungho for this).
* Version 1.13 (2009/04/19)
- Now compiles on Mac OSX (Many thanks to Evan F. for rewriting the OS
specific code, and to Tyler S. and Konstantin L. for their feedback).
- Added functions TwGetBarCount, TwGetBarByIndex, TwGetBarByName,
- Fixed bug related to var of type TW_TYPE_STDSTRING on Windows: Microsoft
implementation of std::string does not have the same size in Debug and
Release mode (hidden member added for debugging), which caused a crash when
mixing the Release version of AntTweakBar with a program compiled in Debug
mode (Thanks to Minh D. for reporting it).
- Added function TwGetParam and TwSetParam to allow access to the parameters
defining the behavior of bars and variables.
- Changed the bar/var parameters without value (like "show"/"hide") to
parameters with value ("visible=true or false") to be compatible with the
new TwGetParam and TwSetParam functions (the old syntax is still kept
for backward compatibility).
- Arrow keys and Return key can now be used to navigate and tweak values.
- Bars can now be moved partly outside of the window. They can still be
constrained to be fully contained in the window by setting the parameter
- Added another way to move a bar by pressing mouse middle button in the bar.
* Version 1.12 (2008/09/27)
- Added new var types TW_TYPE_QUAT* and TW_TYPE_DIR* allowing for the
interactive tweaking of rotations (through quaternions) and 3D vectors
- Better management of transparent tweak bars. New bar parameters added:
alpha=n text=dark/light.
- Default color scheme changed (now transparent by default). To reactivate the
previous scheme, call TwDefine("GLOBAL colorscheme=0") before creating bars.
- Added paramters to manage the bar behavior: resizable, movable, iconifiable,
fontresizable, alwaystop, alwaysbottom, visible, iconified (following
Jeppe F. B. feedback).
- Added functions TwSetBottomBar and TwGetBottomBar.
- The library can now be recompiled without requiring to install GLUT, GLFW
and SDL.
- New var parameters arrow, arrowcolor, axisx, axusy, axisz and showval added
for quaternion and direction types.
- Msvc specific keyword removed from PrefTimer (thanks to Tim J. for pointing
this out).
- Fixed bug related to popup behavior when the help bar is visible.
- GL_TEXTURE_RECTANGLE_ARB/EXT state is now saved and restored by TwDraw
(thanks to Cyril C. for suggesting this).
- glBlendFunc and glBlendEquationEXT are now saved and restored by TwDraw
(thanks to Sebastion B. for reporting the problem).
- Fixed bug related cursor visibility state with SDL (Thanks to Jeppe F. B.
for reporting it).
* Version 1.11 (2007/12/10)
- Now DirectX10 is also supported in addition to OpenGL and DirectX9.
Initialization of AntTweakBar with DX10: TwInit(TW_DIRECT3D10, d3d10Device).
- A new example that uses DirectX10 has been added: see TwSimpleDX10 in the
examples directory.
- Recap for string variables added to the doc. See
- An example that illustrates the use of the different types of string
variables has been added. See TwString in the examples directory.
- Added some code for multi-thread safety (thanks to Daniel 'DrUiD' B. for
the tip).
- Cleanup of the Help bar. Now only variables having help are displayed in
the Help bar.
- Function TwHandleErrors documented.
- Separators don't require a name anymore.
- Var parameter 'order' becomes 'colororder', and its values become 'rgba' and
'argb' (order=ogl and order=dx still exist but are deprecated).
- A small icon added for variables of type bool.
- Function TwCopyCDStringToLibrary added.
- The keyword 'GLOBAL' has been added for TwDefine commands that don't apply
to a specific tweak bar (suggested by Koshmaar).
- TwEventWin32 becomes TwEventWin (a #define has been added to keep
compatibility with previous applications).
- TwWindowSize(0,0) now releases graphics resources allocated by AntTweakBar
(may be useful for Direct3D applications, before resizing for instance).
- A wrong assert removed from TwMgr.cpp (thanks to Chris W. for reporting it).
- Some slight cosmetic changes (again).
* Version 1.10 (2007/08/31)
- Variable values can now also be entered and edited via keyboard input
(implementation based on modifications made by Laury M., thank you Laury).
- Variables of type string are now handled: 3 types of string added
- Text selection and copy/paste added.
- Position of bar icons is modifiable (cf. TwBar paramters iconPos, iconAlign
and iconMargin).
- Separators can be added in a bar (TwAddSeparator).
- OpenGL: states related to 3D textures and multitexturing are now saved and
restored by TwDraw (thanks to Dylan D. for pointing this out).
- Selected element of a listbox now highlighted.
- ReadOnly and ReadWrite behavior of buttons revisited.
- Documentation improved (examples for TwType, new functions documented,...).
- Some slight cosmetic changes.
* Version 1.05 (2007/03/01)
- Listbox and rotoslider buttons added.
- Icon resources (AntTweakBar.rc) no more required for static linkage (thanks
to Joe C. for pointing this out).
- Fixed a rotoslider precision problem when mouse button is released.
* Version 1.04 (2006/12/16)
- OpenGL: Vertex buffer object state and Vertex/fragment program and object
states are now reset and restored by TwDraw (thanks to Dylan D. and Siva K.
for pointing this out).
- Fixed problem that occurs when an initialized variable of type float/double
is displayed.
* Version 1.03 (2006/10/28)
- Medium font antialiased.
- Now also compiles on 64 bits x86 platform (thanks to Herling G. for this).
- Slight changes to avoid visual 8 secure crt warnings.
- Corrected behaviour if min/max values are not defined.
- Modif to avoid looping to max value when reaching zero with unsigned types.
- Min/max/step parameters for type TW_TYPE_CHAR now read ascii codes (not
- Added FPU precision control (because DirectX changes it).
- Fixed problem that occurs when the lib is initialized/uninitialized more
than once (thanks Lukasz P. for reporting it).
- Distribution follows Savannah's recommendations.
* Version 1.02 (2006/09/27)
- Library sources released.
* Version 1.01 (2006/09/14)
- First official release.
\ No newline at end of file
--- AntTweakBar license ---
Copyright (C) 2005-2013 Philippe Decaudin
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the
use of this software.
Permission is granted to anyone to use this software for any purpose, including
commercial applications, and to alter it and redistribute it freely, subject to
the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is not
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
AntTweakBar development library
AntTweakBar is a small and easy-to-use C/C++ library that allows programmers
to quickly add a light and intuitive GUI into OpenGL and DirectX based
graphic programs to interactively tweak parameters.
This package includes the development version of the AntTweakBar library
for Windows, GNU/Linux and OSX, and some program examples (sources + binaries).
For installation and documentation please refer to:
// ----------------------------------------------------------------------------
// @file AntTweakBar.h
// @brief AntTweakBar is a light and intuitive graphical user interface
// that can be readily integrated into OpenGL and DirectX
// applications in order to interactively tweak parameters.
// @author Philippe Decaudin
// @doc
// @license This file is part of the AntTweakBar library.
// AntTweakBar is a free software released under the zlib license.
// For conditions of distribution and use, see License.txt
// ----------------------------------------------------------------------------
#if !defined TW_INCLUDED
#include <stddef.h>
#define TW_VERSION 116 // Version Mmm : M=Major mm=minor (e.g., 102 is version 1.02)
#ifdef __cplusplus
# if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4995 4530)
# include <string>
# pragma warning(pop)
# else
# include <string>
# endif
extern "C" {
#endif // __cplusplus
// ----------------------------------------------------------------------------
// OS specific definitions
// ----------------------------------------------------------------------------
#if (defined(_WIN32) || defined(_WIN64)) && !defined(TW_STATIC)
# define TW_CALL __stdcall
# define TW_CDECL_CALL __cdecl
# define TW_EXPORT_API __declspec(dllexport)
# define TW_IMPORT_API __declspec(dllimport)
# define TW_CALL
# define TW_CDECL_CALL
# define TW_EXPORT_API
# define TW_IMPORT_API
#if defined TW_EXPORTS
#elif defined TW_STATIC
# define TW_API
# if defined(_MSC_VER) && !defined(TW_NO_LIB_PRAGMA)
# ifdef _WIN64
# pragma comment(lib, "AntTweakBarStatic64")
# else
# pragma comment(lib, "AntTweakBarStatic")
# endif
# endif
# if defined(_MSC_VER) && !defined(TW_NO_LIB_PRAGMA)
# ifdef _WIN64
# pragma comment(lib, "AntTweakBar64")
# else
# pragma comment(lib, "AntTweakBar")
# endif
# endif
// ----------------------------------------------------------------------------
// Bar functions and definitions
// ----------------------------------------------------------------------------
typedef struct CTwBar TwBar; // structure CTwBar is not exposed.
TW_API TwBar * TW_CALL TwNewBar(const char *barName);
TW_API int TW_CALL TwDeleteBar(TwBar *bar);
TW_API int TW_CALL TwDeleteAllBars();
TW_API int TW_CALL TwSetTopBar(const TwBar *bar);
TW_API TwBar * TW_CALL TwGetTopBar();
TW_API int TW_CALL TwSetBottomBar(const TwBar *bar);
TW_API TwBar * TW_CALL TwGetBottomBar();
TW_API const char * TW_CALL TwGetBarName(const TwBar *bar);
TW_API int TW_CALL TwGetBarCount();
TW_API TwBar * TW_CALL TwGetBarByIndex(int barIndex);
TW_API TwBar * TW_CALL TwGetBarByName(const char *barName);
TW_API int TW_CALL TwRefreshBar(TwBar *bar);
// ----------------------------------------------------------------------------
// Var functions and definitions
// ----------------------------------------------------------------------------
typedef enum ETwType
#ifdef __cplusplus
#endif // __cplusplus
TW_TYPE_COLOR32, // 32 bits color. Order is RGBA if API is OpenGL or Direct3D10, and inversed if API is Direct3D9 (can be modified by defining 'colorOrder=...', see doc)
TW_TYPE_COLOR3F, // 3 floats color. Order is RGB.
TW_TYPE_COLOR4F, // 4 floats color. Order is RGBA.
TW_TYPE_CDSTRING, // Null-terminated C Dynamic String (pointer to an array of char dynamically allocated with malloc/realloc/strdup)
#ifdef __cplusplus
# if defined(_MSC_VER) && (_MSC_VER == 1600)
TW_TYPE_STDSTRING = (0x2ffe0000+sizeof(std::string)), // VS2010 C++ STL string (std::string)
# else
TW_TYPE_STDSTRING = (0x2fff0000+sizeof(std::string)), // C++ STL string (std::string)
# endif
#endif // __cplusplus
TW_TYPE_QUAT4F = TW_TYPE_CDSTRING+2, // 4 floats encoding a quaternion {qx,qy,qz,qs}
TW_TYPE_QUAT4D, // 4 doubles encoding a quaternion {qx,qy,qz,qs}
TW_TYPE_DIR3F, // direction vector represented by 3 floats
TW_TYPE_DIR3D // direction vector represented by 3 doubles
} TwType;
#define TW_TYPE_CSSTRING(n) ((TwType)(0x30000000+((n)&0xfffffff))) // Null-terminated C Static String of size n (defined as char[n], with n<2^28)
typedef void (TW_CALL * TwSetVarCallback)(const void *value, void *clientData);
typedef void (TW_CALL * TwGetVarCallback)(void *value, void *clientData);
typedef void (TW_CALL * TwButtonCallback)(void *clientData);
TW_API int TW_CALL TwAddVarRW(TwBar *bar, const char *name, TwType type, void *var, const char *def);
TW_API int TW_CALL TwAddVarRO(TwBar *bar, const char *name, TwType type, const void *var, const char *def);
TW_API int TW_CALL TwAddVarCB(TwBar *bar, const char *name, TwType type, TwSetVarCallback setCallback, TwGetVarCallback getCallback, void *clientData, const char *def);
TW_API int TW_CALL TwAddButton(TwBar *bar, const char *name, TwButtonCallback callback, void *clientData, const char *def);
TW_API int TW_CALL TwAddSeparator(TwBar *bar, const char *name, const char *def);
TW_API int TW_CALL TwRemoveVar(TwBar *bar, const char *name);
TW_API int TW_CALL TwRemoveAllVars(TwBar *bar);
typedef struct CTwEnumVal
int Value;
const char * Label;
} TwEnumVal;
typedef struct CTwStructMember
const char * Name;
TwType Type;
size_t Offset;
const char * DefString;
} TwStructMember;
typedef void (TW_CALL * TwSummaryCallback)(char *summaryString, size_t summaryMaxLength, const void *value, void *clientData);
TW_API int TW_CALL TwDefine(const char *def);
TW_API TwType TW_CALL TwDefineEnum(const char *name, const TwEnumVal *enumValues, unsigned int nbValues);
TW_API TwType TW_CALL TwDefineEnumFromString(const char *name, const char *enumString);
TW_API TwType TW_CALL TwDefineStruct(const char *name, const TwStructMember *structMembers, unsigned int nbMembers, size_t structSize, TwSummaryCallback summaryCallback, void *summaryClientData);
typedef void (TW_CALL * TwCopyCDStringToClient)(char **destinationClientStringPtr, const char *sourceString);
TW_API void TW_CALL TwCopyCDStringToClientFunc(TwCopyCDStringToClient copyCDStringFunc);
TW_API void TW_CALL TwCopyCDStringToLibrary(char **destinationLibraryStringPtr, const char *sourceClientString);
#ifdef __cplusplus
typedef void (TW_CALL * TwCopyStdStringToClient)(std::string& destinationClientString, const std::string& sourceString);
TW_API void TW_CALL TwCopyStdStringToClientFunc(TwCopyStdStringToClient copyStdStringToClientFunc);
TW_API void TW_CALL TwCopyStdStringToLibrary(std::string& destinationLibraryString, const std::string& sourceClientString);
#endif // __cplusplus
typedef enum ETwParamValueType
TW_PARAM_CSTRING // Null-terminated array of char (ie, c-string)
} TwParamValueType;
TW_API int TW_CALL TwGetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int outValueMaxCount, void *outValues);
TW_API int TW_CALL TwSetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int inValueCount, const void *inValues);
// ----------------------------------------------------------------------------
// Management functions and definitions
// ----------------------------------------------------------------------------
typedef enum ETwGraphAPI
TW_DIRECT3D10 = 3,
TW_DIRECT3D11 = 4,
} TwGraphAPI;
TW_API int TW_CALL TwInit(TwGraphAPI graphAPI, void *device);
TW_API int TW_CALL TwTerminate();
TW_API int TW_CALL TwDraw();
TW_API int TW_CALL TwWindowSize(int width, int height);
TW_API int TW_CALL TwSetCurrentWindow(int windowID); // multi-windows support
TW_API int TW_CALL TwGetCurrentWindow();
TW_API int TW_CALL TwWindowExists(int windowID);
typedef enum ETwKeyModifier
TW_KMOD_NONE = 0x0000, // same codes as SDL keysym.mod
TW_KMOD_SHIFT = 0x0003,
TW_KMOD_CTRL = 0x00c0,
TW_KMOD_ALT = 0x0100,
TW_KMOD_META = 0x0c00
} TwKeyModifier;
typedef enum EKeySpecial
TW_KEY_TAB = '\t',
TW_KEY_CLEAR = 0x0c,
TW_KEY_PAUSE = 0x13,
TW_KEY_UP = 273, // same codes and order as SDL 1.2 keysym.sym
} TwKeySpecial;
TW_API int TW_CALL TwKeyPressed(int key, int modifiers);
TW_API int TW_CALL TwKeyTest(int key, int modifiers);
typedef enum ETwMouseAction
} TwMouseAction;
typedef enum ETwMouseButtonID
TW_MOUSE_LEFT = 1, // same code as SDL_BUTTON_LEFT
} TwMouseButtonID;
TW_API int TW_CALL TwMouseButton(TwMouseAction action, TwMouseButtonID button);
TW_API int TW_CALL TwMouseMotion(int mouseX, int mouseY);
TW_API int TW_CALL TwMouseWheel(int pos);
TW_API const char * TW_CALL TwGetLastError();
typedef void (TW_CALL * TwErrorHandler)(const char *errorMessage);
TW_API void TW_CALL TwHandleErrors(TwErrorHandler errorHandler);
// ----------------------------------------------------------------------------
// Helper functions to translate events from some common window management
// frameworks to AntTweakBar.
// They call TwKeyPressed, TwMouse* and TwWindowSize for you (implemented in
// files TwEventWin.c TwEventSDL*.c TwEventGLFW.c TwEventGLUT.c)
// ----------------------------------------------------------------------------
// For Windows message proc
#ifndef _W64 // Microsoft specific (detection of 64 bits portability issues)
# define _W64
#endif // _W64
#ifdef _WIN64
TW_API int TW_CALL TwEventWin(void *wnd, unsigned int msg, unsigned __int64 _W64 wParam, __int64 _W64 lParam);
TW_API int TW_CALL TwEventWin(void *wnd, unsigned int msg, unsigned int _W64 wParam, int _W64 lParam);
#define TwEventWin32 TwEventWin // For compatibility with AntTweakBar versions prior to 1.11
// For libSDL event loop
TW_API int TW_CALL TwEventSDL(const void *sdlEvent, unsigned char sdlMajorVersion, unsigned char sdlMinorVersion);
// For GLFW event callbacks
// You should define GLFW_CDECL before including AntTweakBar.h if your version of GLFW uses cdecl calling convensions
TW_API int TW_CDECL_CALL TwEventMouseButtonGLFWcdecl(int glfwButton, int glfwAction);
TW_API int TW_CDECL_CALL TwEventKeyGLFWcdecl(int glfwKey, int glfwAction);
TW_API int TW_CDECL_CALL TwEventCharGLFWcdecl(int glfwChar, int glfwAction);
TW_API int TW_CDECL_CALL TwEventMousePosGLFWcdecl(int mouseX, int mouseY);
TW_API int TW_CDECL_CALL TwEventMouseWheelGLFWcdecl(int wheelPos);
# define TwEventMouseButtonGLFW TwEventMouseButtonGLFWcdecl
# define TwEventKeyGLFW TwEventKeyGLFWcdecl
# define TwEventCharGLFW TwEventCharGLFWcdecl
# define TwEventMousePosGLFW TwEventMousePosGLFWcdecl
# define TwEventMouseWheelGLFW TwEventMouseWheelGLFWcdecl
TW_API int TW_CALL TwEventMouseButtonGLFW(int glfwButton, int glfwAction);
TW_API int TW_CALL TwEventKeyGLFW(int glfwKey, int glfwAction);
TW_API int TW_CALL TwEventCharGLFW(int glfwChar, int glfwAction);
# define TwEventMousePosGLFW TwMouseMotion
# define TwEventMouseWheelGLFW TwMouseWheel
// For GLUT event callbacks (Windows calling convention for GLUT callbacks is cdecl)
#if defined(_WIN32) || defined(_WIN64)
# define TW_GLUT_CALL
TW_API int TW_GLUT_CALL TwEventMouseButtonGLUT(int glutButton, int glutState, int mouseX, int mouseY);
TW_API int TW_GLUT_CALL TwEventMouseMotionGLUT(int mouseX, int mouseY);
TW_API int TW_GLUT_CALL TwEventKeyboardGLUT(unsigned char glutKey, int mouseX, int mouseY);
TW_API int TW_GLUT_CALL TwEventSpecialGLUT(int glutKey, int mouseX, int mouseY);
TW_API int TW_CALL TwGLUTModifiersFunc(int (TW_CALL *glutGetModifiersFunc)(void));
typedef void (TW_GLUT_CALL *GLUTmousebuttonfun)(int glutButton, int glutState, int mouseX, int mouseY);
typedef void (TW_GLUT_CALL *GLUTmousemotionfun)(int mouseX, int mouseY);
typedef void (TW_GLUT_CALL *GLUTkeyboardfun)(unsigned char glutKey, int mouseX, int mouseY);
typedef void (TW_GLUT_CALL *GLUTspecialfun)(int glutKey, int mouseX, int mouseY);
// For SFML event loop
TW_API int TW_CALL TwEventSFML(const void *sfmlEvent, unsigned char sfmlMajorVersion, unsigned char sfmlMinorVersion);
// For X11 event loop
#if defined(_UNIX)
TW_API int TW_CDECL_CALL TwEventX11(void *xevent);
// ----------------------------------------------------------------------------
// Make sure the types have the right sizes
// ----------------------------------------------------------------------------
#define TW_COMPILE_TIME_ASSERT(name, x) typedef int TW_DUMMY_ ## name[(x) * 2 - 1]
TW_COMPILE_TIME_ASSERT(TW_CHAR, sizeof(char) == 1);
TW_COMPILE_TIME_ASSERT(TW_SHORT, sizeof(short) == 2);
TW_COMPILE_TIME_ASSERT(TW_INT, sizeof(int) == 4);
TW_COMPILE_TIME_ASSERT(TW_FLOAT, sizeof(float) == 4);
TW_COMPILE_TIME_ASSERT(TW_DOUBLE, sizeof(double) == 8);
// Check pointer size on Windows
#if !defined(_WIN64) && defined(_WIN32)
// If the following assert failed, the platform is not 32-bit and _WIN64 is not defined.
// When targetting 64-bit Windows platform, _WIN64 must be defined.
TW_COMPILE_TIME_ASSERT(TW_PTR32, sizeof(void*) == 4);
#elif defined(_WIN64)