diff glfw/glfw.d @ 27:d63faa81a5e4

removed Dog, added derelict and glfw
author zzzzrrr <mason.green@gmail.com>
date Mon, 30 Mar 2009 12:41:29 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/glfw/glfw.d	Mon Mar 30 12:41:29 2009 -0400
@@ -0,0 +1,558 @@
+/*
+ * Copyright (c) 2004-2007 Derelict Developers
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the names 'Derelict', 'DerelictGLFW', nor the names of its contributors
+ *   may be used to endorse or promote products derived from this software
+ *   without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+module openmelee.glfw.glfw;
+
+private
+{
+    import derelict.util.loader;
+}
+
+private void load(SharedLib lib)
+{
+	bindFunc(glfwInit)("glfwInit", lib);
+	bindFunc(glfwTerminate)("glfwTerminate", lib);
+	bindFunc(glfwGetVersion)("glfwGetVersion", lib);
+	bindFunc(glfwOpenWindow)("glfwOpenWindow", lib);
+	bindFunc(glfwOpenWindowHint)("glfwOpenWindowHint", lib);
+	bindFunc(glfwCloseWindow)("glfwCloseWindow", lib);
+	bindFunc(glfwSetWindowTitle)("glfwSetWindowTitle", lib);
+	bindFunc(glfwGetWindowSize)("glfwGetWindowSize", lib);
+	bindFunc(glfwSetWindowSize)("glfwSetWindowSize", lib);
+	bindFunc(glfwSetWindowPos)("glfwSetWindowPos", lib);
+	bindFunc(glfwIconifyWindow)("glfwIconifyWindow", lib);
+	bindFunc(glfwRestoreWindow)("glfwRestoreWindow", lib);
+	bindFunc(glfwSwapBuffers)("glfwSwapBuffers", lib);
+	bindFunc(glfwSwapInterval)("glfwSwapInterval", lib);
+	bindFunc(glfwGetWindowParam)("glfwGetWindowParam", lib);
+	bindFunc(glfwSetWindowSizeCallback)("glfwSetWindowSizeCallback", lib); 
+	bindFunc(glfwSetWindowCloseCallback)("glfwSetWindowCloseCallback", lib);
+	bindFunc(glfwSetWindowRefreshCallback)("glfwSetWindowRefreshCallback", lib);
+	bindFunc(glfwGetVideoModes)("glfwGetVideoModes", lib);
+	bindFunc(glfwGetDesktopMode)("glfwGetDesktopMode", lib);
+	bindFunc(glfwPollEvents)("glfwPollEvents", lib);
+	bindFunc(glfwWaitEvents)("glfwWaitEvents", lib);
+	bindFunc(glfwGetKey)("glfwGetKey", lib);
+	bindFunc(glfwGetMouseButton)("glfwGetMouseButton", lib);
+	bindFunc(glfwGetMousePos)("glfwGetMousePos", lib);
+	bindFunc(glfwSetMousePos)("glfwSetMousePos", lib);
+	bindFunc(glfwGetMouseWheel)("glfwGetMouseWheel", lib);
+	bindFunc(glfwSetMouseWheel)("glfwSetMouseWheel", lib);
+	bindFunc(glfwSetKeyCallback)("glfwSetKeyCallback", lib);
+	bindFunc(glfwSetCharCallback)("glfwSetCharCallback", lib); 
+	bindFunc(glfwSetMouseButtonCallback)("glfwSetMouseButtonCallback", lib);
+	bindFunc(glfwSetMousePosCallback)("glfwSetMousePosCallback", lib);
+	bindFunc(glfwSetMouseWheelCallback)("glfwSetMouseWheelCallback", lib);
+	bindFunc(glfwGetJoystickParam)("glfwGetJoystickParam", lib);
+	bindFunc(glfwGetJoystickPos)("glfwGetJoystickPos", lib);
+	bindFunc(glfwGetJoystickButtons)("glfwGetJoystickButtons", lib);
+	bindFunc(glfwGetTime)("glfwGetTime", lib);
+	bindFunc(glfwSetTime)("glfwSetTime", lib);
+	bindFunc(glfwSleep)("glfwSetTime", lib);
+	bindFunc(glfwExtensionSupported)("glfwExtensionSupported", lib);
+	bindFunc(glfwGetProcAddress)("glfwGetProcAddress", lib);
+	bindFunc(glfwGetGLVersion)("glfwGetGLVersion", lib);
+	bindFunc(glfwCreateThread)("glfwCreateThread", lib);
+	bindFunc(glfwDestroyThread)("glfwDestroyThread", lib);
+	bindFunc(glfwWaitThread)("glfwWaitThread", lib);
+	bindFunc(glfwGetThreadID)("glfwGetThreadID", lib);
+	bindFunc(glfwCreateMutex)("glfwCreateMutex", lib);
+	bindFunc(glfwDestroyMutex)("glfwDestroyMutex", lib);
+	bindFunc(glfwLockMutex)("glfwLockMutex", lib);
+	bindFunc(glfwUnlockMutex)("glfwUnlockMutex", lib);
+	bindFunc(glfwCreateCond)("glfwCreateCond", lib);
+	bindFunc(glfwDestroyCond)("glfwDestroyCond", lib);
+	bindFunc(glfwWaitCond)("glfwWaitCond", lib);
+	bindFunc(glfwSignalCond)("glfwSignalCond", lib);
+	bindFunc(glfwBroadcastCond)("glfwBroadcastCond", lib);
+	bindFunc(glfwGetNumberOfProcessors)("glfwGetNumberOfProcessors", lib);
+	bindFunc(glfwEnable)("glfwEnable", lib);
+	bindFunc(glfwDisable)("glfwDisable", lib);
+	bindFunc(glfwReadImage)("glfwReadImage", lib);
+	bindFunc(glfwReadMemoryImage)("glfwReadMemoryImage", lib);
+	bindFunc(glfwFreeImage)("glfwFreeImage", lib);
+	bindFunc(glfwLoadTexture2D)("glfwLoadTexture2D", lib);
+	bindFunc(glfwLoadMemoryTexture2D)("glfwLoadMemoryTexture2D", lib);
+	bindFunc(glfwLoadTextureImage2D)("glfwLoadTextureImage2D", lib);
+}
+
+GenericLoader DerelictGLFW;
+static this() {
+    DerelictGLFW.setup(
+        "glfw.dll",
+        "libglfw.so",
+        "",
+        &load
+    );
+}
+
+//==============================================================================
+//DLL FUNCTIONS
+//==============================================================================
+private const char[] Funcs =
+"
+//	GLFW initialization, termination and version querying
+	/*! @fn glfwInit
+	 */
+	typedef int   function() pfglfwInit;
+	typedef void  function() pfglfwTerminate;
+	typedef void  function( int *major, int *minor, int *rev ) pfglfwGetVersion;
+
+//	 Window handling
+	typedef int   function( int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode ) pfglfwOpenWindow;
+	typedef void  function( int target, int hint ) pfglfwOpenWindowHint;
+	typedef void  function() pfglfwCloseWindow;
+	typedef void  function( char *title ) pfglfwSetWindowTitle;
+	typedef void  function( int *width, int *height ) pfglfwGetWindowSize;
+	typedef void  function( int width, int height ) pfglfwSetWindowSize;
+	typedef void  function( int x, int y ) pfglfwSetWindowPos;
+	typedef void  function() pfglfwIconifyWindow;
+	typedef void  function() pfglfwRestoreWindow;
+	typedef void  function() pfglfwSwapBuffers;
+	typedef void function(  int interval ) pfglfwSwapInterval;
+	typedef int  function(  int param ) pfglfwGetWindowParam;
+	typedef void  function( GLFWwindowsizefun cbfun ) pfglfwSetWindowSizeCallback;
+	typedef void  function( GLFWwindowclosefun cbfun ) pfglfwSetWindowCloseCallback;
+	typedef void  function( GLFWwindowrefreshfun cbfun ) pfglfwSetWindowRefreshCallback;
+
+//	 Video mode functions
+	typedef int   function( GLFWvidmode *list, int maxcount ) pfglfwGetVideoModes;
+	typedef void  function( GLFWvidmode *mode ) pfglfwGetDesktopMode;
+
+//	 Input handling
+	typedef void  function() pfglfwPollEvents;
+	typedef void function( ) pfglfwWaitEvents;
+	typedef int   function( int key ) pfglfwGetKey;
+	typedef int   function( int button ) pfglfwGetMouseButton;
+	typedef void  function( int *xpos, int *ypos ) pfglfwGetMousePos;
+	typedef void  function( int xpos, int ypos ) pfglfwSetMousePos;
+	typedef int   function() pfglfwGetMouseWheel;
+	typedef void  function( int pos ) pfglfwSetMouseWheel;
+	typedef void  function( GLFWkeyfun cbfun ) pfglfwSetKeyCallback;
+	typedef void  function( GLFWcharfun cbfun ) pfglfwSetCharCallback;
+	typedef void  function( GLFWmousebuttonfun cbfun ) pfglfwSetMouseButtonCallback;
+	typedef void  function( GLFWmouseposfun cbfun ) pfglfwSetMousePosCallback;
+	typedef void  function( GLFWmousewheelfun cbfun ) pfglfwSetMouseWheelCallback;
+
+//	 Joystick input
+	typedef int  function( int joy, int param ) pfglfwGetJoystickParam;
+	typedef int  function( int joy, float *pos, int numaxes ) pfglfwGetJoystickPos;
+	typedef int  function( int joy, ubyte* buttons, int numbuttons ) pfglfwGetJoystickButtons;
+
+//	 Time
+	typedef double  function() pfglfwGetTime;
+	typedef void    function( double time ) pfglfwSetTime;
+	typedef void    function( double time ) pfglfwSleep;
+
+//	 Extension support
+	typedef int   function( char *extension ) pfglfwExtensionSupported;
+	typedef void*  function( char *procname ) pfglfwGetProcAddress;
+	typedef void   function( int *major, int *minor, int *rev ) pfglfwGetGLVersion;
+
+//	 Threading support
+	typedef GLFWthread function( GLFWthreadfun fun, void *arg ) pfglfwCreateThread;
+	typedef void  function( GLFWthread ID ) pfglfwDestroyThread;
+	typedef int   function( GLFWthread ID, int waitmode ) pfglfwWaitThread;
+	typedef GLFWthread function() pfglfwGetThreadID;
+	typedef GLFWmutex  function() pfglfwCreateMutex;
+	typedef void  function(GLFWmutex mutex ) pfglfwDestroyMutex;
+	typedef void  function(GLFWmutex mutex ) pfglfwLockMutex;
+	typedef void  function(GLFWmutex mutex ) pfglfwUnlockMutex;
+	typedef GLFWcond function() pfglfwCreateCond;
+	typedef void  function(GLFWcond cond ) pfglfwDestroyCond;
+	typedef void  function(GLFWcond cond, GLFWmutex mutex, double timeout ) pfglfwWaitCond;
+	typedef void  function(GLFWcond cond ) pfglfwSignalCond;
+	typedef void function( GLFWcond cond ) pfglfwBroadcastCond;
+	typedef int  function( ) pfglfwGetNumberOfProcessors;
+
+//	 Enable/disable functions
+	typedef void  function(int token ) pfglfwEnable;
+	typedef void  function(int token ) pfglfwDisable;
+
+//	 Image/texture I/O support
+	typedef int   function(char *name, GLFWimage *img, int flags ) pfglfwReadImage;
+	typedef int   function( void *data, long size, GLFWimage *img, int flags ) pfglfwReadMemoryImage;
+	typedef void  function( GLFWimage *img ) pfglfwFreeImage;
+	typedef int   function( char *name, int flags ) pfglfwLoadTexture2D;
+	typedef int  function( void *data, long size, int flags ) pfglfwLoadMemoryTexture2D;
+	typedef int  function(GLFWimage *img, int flags ) pfglfwLoadTextureImage2D;
+";
+
+version(Windows)
+{
+	extern(Windows): mixin(Funcs);
+}
+else
+{
+	extern(C): mixin(Funcs);
+}
+
+pfglfwInit glfwInit;
+pfglfwTerminate glfwTerminate;
+pfglfwGetVersion glfwGetVersion;
+pfglfwOpenWindow glfwOpenWindow;
+pfglfwOpenWindowHint glfwOpenWindowHint;
+pfglfwCloseWindow glfwCloseWindow;
+pfglfwSetWindowTitle glfwSetWindowTitle;
+pfglfwGetWindowSize glfwGetWindowSize;
+pfglfwSetWindowSize glfwSetWindowSize;
+pfglfwSetWindowPos glfwSetWindowPos;
+pfglfwIconifyWindow glfwIconifyWindow;
+pfglfwRestoreWindow glfwRestoreWindow;
+pfglfwSwapBuffers glfwSwapBuffers;
+pfglfwSwapInterval glfwSwapInterval;
+pfglfwGetWindowParam glfwGetWindowParam;
+pfglfwSetWindowSizeCallback glfwSetWindowSizeCallback; 
+pfglfwSetWindowCloseCallback glfwSetWindowCloseCallback;
+pfglfwSetWindowRefreshCallback glfwSetWindowRefreshCallback;
+pfglfwGetVideoModes glfwGetVideoModes;
+pfglfwGetDesktopMode glfwGetDesktopMode;
+pfglfwPollEvents glfwPollEvents;
+pfglfwWaitEvents glfwWaitEvents;
+pfglfwGetKey glfwGetKey;
+pfglfwGetMouseButton glfwGetMouseButton;
+pfglfwGetMousePos glfwGetMousePos;
+pfglfwSetMousePos glfwSetMousePos;
+pfglfwGetMouseWheel glfwGetMouseWheel;
+pfglfwSetMouseWheel glfwSetMouseWheel;
+pfglfwSetKeyCallback glfwSetKeyCallback;
+pfglfwSetCharCallback glfwSetCharCallback; 
+pfglfwSetMouseButtonCallback glfwSetMouseButtonCallback;
+pfglfwSetMousePosCallback glfwSetMousePosCallback;
+pfglfwSetMouseWheelCallback glfwSetMouseWheelCallback;
+pfglfwGetJoystickParam glfwGetJoystickParam;
+pfglfwGetJoystickPos glfwGetJoystickPos;
+pfglfwGetJoystickButtons glfwGetJoystickButtons;
+pfglfwGetTime glfwGetTime;
+pfglfwSetTime glfwSetTime;
+pfglfwSleep glfwSleep;
+pfglfwExtensionSupported glfwExtensionSupported;
+pfglfwGetProcAddress glfwGetProcAddress;
+pfglfwGetGLVersion glfwGetGLVersion;
+pfglfwCreateThread glfwCreateThread;
+pfglfwDestroyThread glfwDestroyThread;
+pfglfwWaitThread glfwWaitThread;
+pfglfwGetThreadID glfwGetThreadID;
+pfglfwCreateMutex glfwCreateMutex;
+pfglfwDestroyMutex glfwDestroyMutex;
+pfglfwLockMutex glfwLockMutex;;
+pfglfwUnlockMutex glfwUnlockMutex;
+pfglfwCreateCond glfwCreateCond;;
+pfglfwDestroyCond glfwDestroyCond;
+pfglfwWaitCond glfwWaitCond;;
+pfglfwSignalCond glfwSignalCond;
+pfglfwBroadcastCond glfwBroadcastCond;;
+pfglfwGetNumberOfProcessors glfwGetNumberOfProcessors;;
+pfglfwEnable glfwEnable;;
+pfglfwDisable glfwDisable;
+pfglfwReadImage glfwReadImage;
+pfglfwReadMemoryImage glfwReadMemoryImage;
+pfglfwFreeImage glfwFreeImage;
+pfglfwLoadTexture2D glfwLoadTexture2D;
+pfglfwLoadMemoryTexture2D glfwLoadMemoryTexture2D;
+pfglfwLoadTextureImage2D glfwLoadTextureImage2D;
+
+//========================================================================
+//GLFW version
+//========================================================================
+
+enum
+{
+	GLFW_VERSION_MAJOR    = 2,
+	GLFW_VERSION_MINOR    = 6,
+	GLFW_VERSION_REVISION = 0
+}
+
+//========================================================================
+//Input handling definitions
+//========================================================================
+
+//Key and button state/action definitions
+enum
+{
+  GLFW_RELEASE            = 0,
+  GLFW_PRESS              = 1
+}
+
+//Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
+//for printable keys (such as A-Z, 0-9 etc), and values above 256
+//represent special (non-printable) keys (e.g. F1, Page Up etc).
+enum
+{
+GLFW_KEY_UNKNOWN      = -1,
+  GLFW_KEY_SPACE        = 32,
+  GLFW_KEY_SPECIAL      = 256,
+  GLFW_KEY_ESC          = (GLFW_KEY_SPECIAL+1),
+  GLFW_KEY_F1          =  (GLFW_KEY_SPECIAL+2),
+  GLFW_KEY_F2           = (GLFW_KEY_SPECIAL+3),
+  GLFW_KEY_F3           = (GLFW_KEY_SPECIAL+4),
+  GLFW_KEY_F4          =  (GLFW_KEY_SPECIAL+5),
+  GLFW_KEY_F5          =  (GLFW_KEY_SPECIAL+6),
+  GLFW_KEY_F6          =  (GLFW_KEY_SPECIAL+7),
+  GLFW_KEY_F7          =  (GLFW_KEY_SPECIAL+8),
+  GLFW_KEY_F8          =  (GLFW_KEY_SPECIAL+9),
+  GLFW_KEY_F9          =  (GLFW_KEY_SPECIAL+10),
+  GLFW_KEY_F10         =  (GLFW_KEY_SPECIAL+11),
+  GLFW_KEY_F11         =  (GLFW_KEY_SPECIAL+12),
+  GLFW_KEY_F12         =  (GLFW_KEY_SPECIAL+13),
+  GLFW_KEY_F13         =  (GLFW_KEY_SPECIAL+14),
+  GLFW_KEY_F14         =  (GLFW_KEY_SPECIAL+15),
+  GLFW_KEY_F15          = (GLFW_KEY_SPECIAL+16),
+  GLFW_KEY_F16         =  (GLFW_KEY_SPECIAL+17),
+  GLFW_KEY_F17         =  (GLFW_KEY_SPECIAL+18),
+  GLFW_KEY_F18          = (GLFW_KEY_SPECIAL+19),
+  GLFW_KEY_F19          = (GLFW_KEY_SPECIAL+20),
+  GLFW_KEY_F20          = (GLFW_KEY_SPECIAL+21),
+  GLFW_KEY_F21          = (GLFW_KEY_SPECIAL+22),
+  GLFW_KEY_F22          = (GLFW_KEY_SPECIAL+23),
+  GLFW_KEY_F23          = (GLFW_KEY_SPECIAL+24),
+  GLFW_KEY_F24          = (GLFW_KEY_SPECIAL+25),
+  GLFW_KEY_F25          = (GLFW_KEY_SPECIAL+26),
+  GLFW_KEY_UP           = (GLFW_KEY_SPECIAL+27),
+  GLFW_KEY_DOWN         = (GLFW_KEY_SPECIAL+28),
+  GLFW_KEY_LEFT         = (GLFW_KEY_SPECIAL+29),
+  GLFW_KEY_RIGHT        = (GLFW_KEY_SPECIAL+30),
+  GLFW_KEY_LSHIFT       = (GLFW_KEY_SPECIAL+31),
+  GLFW_KEY_RSHIFT       = (GLFW_KEY_SPECIAL+32),
+  GLFW_KEY_LCTRL        = (GLFW_KEY_SPECIAL+33),
+  GLFW_KEY_RCTRL        = (GLFW_KEY_SPECIAL+34),
+  GLFW_KEY_LALT         = (GLFW_KEY_SPECIAL+35),
+  GLFW_KEY_RALT         = (GLFW_KEY_SPECIAL+36),
+  GLFW_KEY_TAB          = (GLFW_KEY_SPECIAL+37),
+  GLFW_KEY_ENTER        = (GLFW_KEY_SPECIAL+38),
+  GLFW_KEY_BACKSPACE    = (GLFW_KEY_SPECIAL+39),
+  GLFW_KEY_INSERT       = (GLFW_KEY_SPECIAL+40),
+  GLFW_KEY_DEL          = (GLFW_KEY_SPECIAL+41),
+  GLFW_KEY_PAGEUP       = (GLFW_KEY_SPECIAL+42),
+  GLFW_KEY_PAGEDOWN     = (GLFW_KEY_SPECIAL+43),
+  GLFW_KEY_HOME         = (GLFW_KEY_SPECIAL+44),
+  GLFW_KEY_END          = (GLFW_KEY_SPECIAL+45),
+  GLFW_KEY_KP_0         = (GLFW_KEY_SPECIAL+46),
+  GLFW_KEY_KP_1         = (GLFW_KEY_SPECIAL+47),
+  GLFW_KEY_KP_2         = (GLFW_KEY_SPECIAL+48),
+  GLFW_KEY_KP_3         = (GLFW_KEY_SPECIAL+49),
+  GLFW_KEY_KP_4         = (GLFW_KEY_SPECIAL+50),
+  GLFW_KEY_KP_5         = (GLFW_KEY_SPECIAL+51),
+  GLFW_KEY_KP_6         = (GLFW_KEY_SPECIAL+52),
+  GLFW_KEY_KP_7         = (GLFW_KEY_SPECIAL+53),
+  GLFW_KEY_KP_8         = (GLFW_KEY_SPECIAL+54),
+  GLFW_KEY_KP_9         = (GLFW_KEY_SPECIAL+55),
+  GLFW_KEY_KP_DIVIDE    = (GLFW_KEY_SPECIAL+56),
+  GLFW_KEY_KP_MULTIPLY  = (GLFW_KEY_SPECIAL+57),
+  GLFW_KEY_KP_SUBTRACT  = (GLFW_KEY_SPECIAL+58),
+  GLFW_KEY_KP_ADD       = (GLFW_KEY_SPECIAL+59),
+  GLFW_KEY_KP_DECIMAL   = (GLFW_KEY_SPECIAL+60),
+  GLFW_KEY_KP_EQUAL     = (GLFW_KEY_SPECIAL+61),
+  GLFW_KEY_KP_ENTER     = (GLFW_KEY_SPECIAL+62),
+  GLFW_KEY_LAST         = GLFW_KEY_KP_ENTER
+}
+
+//Mouse button definitions
+enum
+{
+	GLFW_MOUSE_BUTTON_1      = 0,
+  GLFW_MOUSE_BUTTON_2      = 1,
+  GLFW_MOUSE_BUTTON_3      = 2,
+  GLFW_MOUSE_BUTTON_4      = 3,
+  GLFW_MOUSE_BUTTON_5      = 4,
+  GLFW_MOUSE_BUTTON_6      = 5,
+  GLFW_MOUSE_BUTTON_7      = 6,
+  GLFW_MOUSE_BUTTON_8      = 7,
+  GLFW_MOUSE_BUTTON_LAST   = GLFW_MOUSE_BUTTON_8
+}
+
+//Mouse button aliases
+enum
+{
+	GLFW_MOUSE_BUTTON_LEFT   = GLFW_MOUSE_BUTTON_1,
+  GLFW_MOUSE_BUTTON_RIGHT  = GLFW_MOUSE_BUTTON_2,
+  GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3
+}
+
+
+//Joystick identifiers
+enum
+{
+  GLFW_JOYSTICK_1          = 0,
+  GLFW_JOYSTICK_2          = 1,
+  GLFW_JOYSTICK_3          = 2,
+  GLFW_JOYSTICK_4          = 3,
+  GLFW_JOYSTICK_5          = 4,
+  GLFW_JOYSTICK_6          = 5,
+  GLFW_JOYSTICK_7          = 6,
+  GLFW_JOYSTICK_8          = 7,
+  GLFW_JOYSTICK_9          = 8,
+  GLFW_JOYSTICK_10         = 9,
+  GLFW_JOYSTICK_11         = 10,
+  GLFW_JOYSTICK_12         = 11,
+  GLFW_JOYSTICK_13         = 12,
+  GLFW_JOYSTICK_14         = 13,
+  GLFW_JOYSTICK_15         = 14,
+  GLFW_JOYSTICK_16         = 15,
+  GLFW_JOYSTICK_LAST       = GLFW_JOYSTICK_16
+}
+
+//========================================================================
+//Other definitions
+//========================================================================
+
+//glfwOpenWindow modes
+enum
+{
+  GLFW_WINDOW               = 0x00010001,
+  GLFW_FULLSCREEN           = 0x00010002
+}
+
+//glfwGetWindowParam tokens
+enum
+{
+  GLFW_OPENED               = 0x00020001,
+  GLFW_ACTIVE               = 0x00020002,
+  GLFW_ICONIFIED            = 0x00020003,
+  GLFW_ACCELERATED          = 0x00020004,
+  GLFW_RED_BITS             = 0x00020005,
+  GLFW_GREEN_BITS           = 0x00020006,
+  GLFW_BLUE_BITS            = 0x00020007,
+  GLFW_ALPHA_BITS           = 0x00020008,
+  GLFW_DEPTH_BITS           = 0x00020009,
+  GLFW_STENCIL_BITS         = 0x0002000A
+}
+
+//The following constants are used for both glfwGetWindowParam
+//and glfwOpenWindowHint
+enum
+{
+  GLFW_REFRESH_RATE         = 0x0002000B,
+  GLFW_ACCUM_RED_BITS       = 0x0002000C,
+  GLFW_ACCUM_GREEN_BITS     = 0x0002000D,
+  GLFW_ACCUM_BLUE_BITS      = 0x0002000E,
+  GLFW_ACCUM_ALPHA_BITS     = 0x0002000F,
+  GLFW_AUX_BUFFERS          = 0x00020010,
+  GLFW_STEREO               = 0x00020011,
+  GLFW_WINDOW_NO_RESIZE     = 0x00020012,
+  GLFW_FSAA_SAMPLES         = 0x00020013
+}
+
+//glfwEnable/glfwDisable tokens
+enum
+{
+  GLFW_MOUSE_CURSOR         = 0x00030001,
+  GLFW_STICKY_KEYS          = 0x00030002,
+  GLFW_STICKY_MOUSE_BUTTONS = 0x00030003,
+  GLFW_SYSTEM_KEYS          = 0x00030004,
+  GLFW_KEY_REPEAT           = 0x00030005,
+  GLFW_AUTO_POLL_EVENTS     = 0x00030006
+}
+
+//glfwWaitThread wait modes
+enum
+{
+  GLFW_WAIT                 = 0x00040001,
+  GLFW_NOWAIT               = 0x00040002
+}
+
+//glfwGetJoystickParam tokens
+enum
+{
+  GLFW_PRESENT              = 0x00050001,
+  GLFW_AXES                 = 0x00050002,
+  GLFW_BUTTONS              = 0x00050003
+}
+
+//glfwReadImage/glfwLoadTexture2D flags
+enum
+{
+  GLFW_NO_RESCALE_BIT       = 0x00000001, // Only for glfwReadImage
+  GLFW_ORIGIN_UL_BIT        = 0x00000002,
+  GLFW_BUILD_MIPMAPS_BIT    = 0x00000004, // Only for glfwLoadTexture2D
+  GLFW_ALPHA_MAP_BIT        = 0x00000008
+}
+
+//Time spans longer than this (seconds) are considered to be infinity
+enum
+{
+  GLFW_INFINITY = 100000
+}
+
+//========================================================================
+// Structs
+//========================================================================
+
+//The video mode structure used by glfwGetVideoModes()
+struct GLFWvidmode 
+{
+ int Width, Height;
+ int RedBits, BlueBits, GreenBits;
+} 
+
+//Image/texture information
+struct GLFWimage 
+{
+ int Width, Height;
+ int Format;
+ int BytesPerPixel;
+ ubyte *Data;
+}
+
+//Thread ID
+alias int GLFWthread;
+
+//Mutex object
+alias void* GLFWmutex;
+
+//Condition variable object
+alias void* GLFWcond;
+
+//Function pointer types
+typedef void function(int, int) GLFWwindowsizefun;
+typedef int function() GLFWwindowclosefun;
+typedef void function() GLFWwindowrefreshfun;
+typedef void function(int, int) GLFWmousebuttonfun;
+typedef void function(int, int) GLFWmouseposfun;
+typedef void function(int) GLFWmousewheelfun;
+typedef void function(int, int) GLFWkeyfun;
+typedef void function(int, int) GLFWcharfun;
+typedef void function(void*) GLFWthreadfun; 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+