comparison 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
comparison
equal deleted inserted replaced
26:88cca12cc8b9 27:d63faa81a5e4
1 /*
2 * Copyright (c) 2004-2007 Derelict Developers
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the names 'Derelict', 'DerelictGLFW', nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 module openmelee.glfw.glfw;
33
34 private
35 {
36 import derelict.util.loader;
37 }
38
39 private void load(SharedLib lib)
40 {
41 bindFunc(glfwInit)("glfwInit", lib);
42 bindFunc(glfwTerminate)("glfwTerminate", lib);
43 bindFunc(glfwGetVersion)("glfwGetVersion", lib);
44 bindFunc(glfwOpenWindow)("glfwOpenWindow", lib);
45 bindFunc(glfwOpenWindowHint)("glfwOpenWindowHint", lib);
46 bindFunc(glfwCloseWindow)("glfwCloseWindow", lib);
47 bindFunc(glfwSetWindowTitle)("glfwSetWindowTitle", lib);
48 bindFunc(glfwGetWindowSize)("glfwGetWindowSize", lib);
49 bindFunc(glfwSetWindowSize)("glfwSetWindowSize", lib);
50 bindFunc(glfwSetWindowPos)("glfwSetWindowPos", lib);
51 bindFunc(glfwIconifyWindow)("glfwIconifyWindow", lib);
52 bindFunc(glfwRestoreWindow)("glfwRestoreWindow", lib);
53 bindFunc(glfwSwapBuffers)("glfwSwapBuffers", lib);
54 bindFunc(glfwSwapInterval)("glfwSwapInterval", lib);
55 bindFunc(glfwGetWindowParam)("glfwGetWindowParam", lib);
56 bindFunc(glfwSetWindowSizeCallback)("glfwSetWindowSizeCallback", lib);
57 bindFunc(glfwSetWindowCloseCallback)("glfwSetWindowCloseCallback", lib);
58 bindFunc(glfwSetWindowRefreshCallback)("glfwSetWindowRefreshCallback", lib);
59 bindFunc(glfwGetVideoModes)("glfwGetVideoModes", lib);
60 bindFunc(glfwGetDesktopMode)("glfwGetDesktopMode", lib);
61 bindFunc(glfwPollEvents)("glfwPollEvents", lib);
62 bindFunc(glfwWaitEvents)("glfwWaitEvents", lib);
63 bindFunc(glfwGetKey)("glfwGetKey", lib);
64 bindFunc(glfwGetMouseButton)("glfwGetMouseButton", lib);
65 bindFunc(glfwGetMousePos)("glfwGetMousePos", lib);
66 bindFunc(glfwSetMousePos)("glfwSetMousePos", lib);
67 bindFunc(glfwGetMouseWheel)("glfwGetMouseWheel", lib);
68 bindFunc(glfwSetMouseWheel)("glfwSetMouseWheel", lib);
69 bindFunc(glfwSetKeyCallback)("glfwSetKeyCallback", lib);
70 bindFunc(glfwSetCharCallback)("glfwSetCharCallback", lib);
71 bindFunc(glfwSetMouseButtonCallback)("glfwSetMouseButtonCallback", lib);
72 bindFunc(glfwSetMousePosCallback)("glfwSetMousePosCallback", lib);
73 bindFunc(glfwSetMouseWheelCallback)("glfwSetMouseWheelCallback", lib);
74 bindFunc(glfwGetJoystickParam)("glfwGetJoystickParam", lib);
75 bindFunc(glfwGetJoystickPos)("glfwGetJoystickPos", lib);
76 bindFunc(glfwGetJoystickButtons)("glfwGetJoystickButtons", lib);
77 bindFunc(glfwGetTime)("glfwGetTime", lib);
78 bindFunc(glfwSetTime)("glfwSetTime", lib);
79 bindFunc(glfwSleep)("glfwSetTime", lib);
80 bindFunc(glfwExtensionSupported)("glfwExtensionSupported", lib);
81 bindFunc(glfwGetProcAddress)("glfwGetProcAddress", lib);
82 bindFunc(glfwGetGLVersion)("glfwGetGLVersion", lib);
83 bindFunc(glfwCreateThread)("glfwCreateThread", lib);
84 bindFunc(glfwDestroyThread)("glfwDestroyThread", lib);
85 bindFunc(glfwWaitThread)("glfwWaitThread", lib);
86 bindFunc(glfwGetThreadID)("glfwGetThreadID", lib);
87 bindFunc(glfwCreateMutex)("glfwCreateMutex", lib);
88 bindFunc(glfwDestroyMutex)("glfwDestroyMutex", lib);
89 bindFunc(glfwLockMutex)("glfwLockMutex", lib);
90 bindFunc(glfwUnlockMutex)("glfwUnlockMutex", lib);
91 bindFunc(glfwCreateCond)("glfwCreateCond", lib);
92 bindFunc(glfwDestroyCond)("glfwDestroyCond", lib);
93 bindFunc(glfwWaitCond)("glfwWaitCond", lib);
94 bindFunc(glfwSignalCond)("glfwSignalCond", lib);
95 bindFunc(glfwBroadcastCond)("glfwBroadcastCond", lib);
96 bindFunc(glfwGetNumberOfProcessors)("glfwGetNumberOfProcessors", lib);
97 bindFunc(glfwEnable)("glfwEnable", lib);
98 bindFunc(glfwDisable)("glfwDisable", lib);
99 bindFunc(glfwReadImage)("glfwReadImage", lib);
100 bindFunc(glfwReadMemoryImage)("glfwReadMemoryImage", lib);
101 bindFunc(glfwFreeImage)("glfwFreeImage", lib);
102 bindFunc(glfwLoadTexture2D)("glfwLoadTexture2D", lib);
103 bindFunc(glfwLoadMemoryTexture2D)("glfwLoadMemoryTexture2D", lib);
104 bindFunc(glfwLoadTextureImage2D)("glfwLoadTextureImage2D", lib);
105 }
106
107 GenericLoader DerelictGLFW;
108 static this() {
109 DerelictGLFW.setup(
110 "glfw.dll",
111 "libglfw.so",
112 "",
113 &load
114 );
115 }
116
117 //==============================================================================
118 //DLL FUNCTIONS
119 //==============================================================================
120 private const char[] Funcs =
121 "
122 // GLFW initialization, termination and version querying
123 /*! @fn glfwInit
124 */
125 typedef int function() pfglfwInit;
126 typedef void function() pfglfwTerminate;
127 typedef void function( int *major, int *minor, int *rev ) pfglfwGetVersion;
128
129 // Window handling
130 typedef int function( int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode ) pfglfwOpenWindow;
131 typedef void function( int target, int hint ) pfglfwOpenWindowHint;
132 typedef void function() pfglfwCloseWindow;
133 typedef void function( char *title ) pfglfwSetWindowTitle;
134 typedef void function( int *width, int *height ) pfglfwGetWindowSize;
135 typedef void function( int width, int height ) pfglfwSetWindowSize;
136 typedef void function( int x, int y ) pfglfwSetWindowPos;
137 typedef void function() pfglfwIconifyWindow;
138 typedef void function() pfglfwRestoreWindow;
139 typedef void function() pfglfwSwapBuffers;
140 typedef void function( int interval ) pfglfwSwapInterval;
141 typedef int function( int param ) pfglfwGetWindowParam;
142 typedef void function( GLFWwindowsizefun cbfun ) pfglfwSetWindowSizeCallback;
143 typedef void function( GLFWwindowclosefun cbfun ) pfglfwSetWindowCloseCallback;
144 typedef void function( GLFWwindowrefreshfun cbfun ) pfglfwSetWindowRefreshCallback;
145
146 // Video mode functions
147 typedef int function( GLFWvidmode *list, int maxcount ) pfglfwGetVideoModes;
148 typedef void function( GLFWvidmode *mode ) pfglfwGetDesktopMode;
149
150 // Input handling
151 typedef void function() pfglfwPollEvents;
152 typedef void function( ) pfglfwWaitEvents;
153 typedef int function( int key ) pfglfwGetKey;
154 typedef int function( int button ) pfglfwGetMouseButton;
155 typedef void function( int *xpos, int *ypos ) pfglfwGetMousePos;
156 typedef void function( int xpos, int ypos ) pfglfwSetMousePos;
157 typedef int function() pfglfwGetMouseWheel;
158 typedef void function( int pos ) pfglfwSetMouseWheel;
159 typedef void function( GLFWkeyfun cbfun ) pfglfwSetKeyCallback;
160 typedef void function( GLFWcharfun cbfun ) pfglfwSetCharCallback;
161 typedef void function( GLFWmousebuttonfun cbfun ) pfglfwSetMouseButtonCallback;
162 typedef void function( GLFWmouseposfun cbfun ) pfglfwSetMousePosCallback;
163 typedef void function( GLFWmousewheelfun cbfun ) pfglfwSetMouseWheelCallback;
164
165 // Joystick input
166 typedef int function( int joy, int param ) pfglfwGetJoystickParam;
167 typedef int function( int joy, float *pos, int numaxes ) pfglfwGetJoystickPos;
168 typedef int function( int joy, ubyte* buttons, int numbuttons ) pfglfwGetJoystickButtons;
169
170 // Time
171 typedef double function() pfglfwGetTime;
172 typedef void function( double time ) pfglfwSetTime;
173 typedef void function( double time ) pfglfwSleep;
174
175 // Extension support
176 typedef int function( char *extension ) pfglfwExtensionSupported;
177 typedef void* function( char *procname ) pfglfwGetProcAddress;
178 typedef void function( int *major, int *minor, int *rev ) pfglfwGetGLVersion;
179
180 // Threading support
181 typedef GLFWthread function( GLFWthreadfun fun, void *arg ) pfglfwCreateThread;
182 typedef void function( GLFWthread ID ) pfglfwDestroyThread;
183 typedef int function( GLFWthread ID, int waitmode ) pfglfwWaitThread;
184 typedef GLFWthread function() pfglfwGetThreadID;
185 typedef GLFWmutex function() pfglfwCreateMutex;
186 typedef void function(GLFWmutex mutex ) pfglfwDestroyMutex;
187 typedef void function(GLFWmutex mutex ) pfglfwLockMutex;
188 typedef void function(GLFWmutex mutex ) pfglfwUnlockMutex;
189 typedef GLFWcond function() pfglfwCreateCond;
190 typedef void function(GLFWcond cond ) pfglfwDestroyCond;
191 typedef void function(GLFWcond cond, GLFWmutex mutex, double timeout ) pfglfwWaitCond;
192 typedef void function(GLFWcond cond ) pfglfwSignalCond;
193 typedef void function( GLFWcond cond ) pfglfwBroadcastCond;
194 typedef int function( ) pfglfwGetNumberOfProcessors;
195
196 // Enable/disable functions
197 typedef void function(int token ) pfglfwEnable;
198 typedef void function(int token ) pfglfwDisable;
199
200 // Image/texture I/O support
201 typedef int function(char *name, GLFWimage *img, int flags ) pfglfwReadImage;
202 typedef int function( void *data, long size, GLFWimage *img, int flags ) pfglfwReadMemoryImage;
203 typedef void function( GLFWimage *img ) pfglfwFreeImage;
204 typedef int function( char *name, int flags ) pfglfwLoadTexture2D;
205 typedef int function( void *data, long size, int flags ) pfglfwLoadMemoryTexture2D;
206 typedef int function(GLFWimage *img, int flags ) pfglfwLoadTextureImage2D;
207 ";
208
209 version(Windows)
210 {
211 extern(Windows): mixin(Funcs);
212 }
213 else
214 {
215 extern(C): mixin(Funcs);
216 }
217
218 pfglfwInit glfwInit;
219 pfglfwTerminate glfwTerminate;
220 pfglfwGetVersion glfwGetVersion;
221 pfglfwOpenWindow glfwOpenWindow;
222 pfglfwOpenWindowHint glfwOpenWindowHint;
223 pfglfwCloseWindow glfwCloseWindow;
224 pfglfwSetWindowTitle glfwSetWindowTitle;
225 pfglfwGetWindowSize glfwGetWindowSize;
226 pfglfwSetWindowSize glfwSetWindowSize;
227 pfglfwSetWindowPos glfwSetWindowPos;
228 pfglfwIconifyWindow glfwIconifyWindow;
229 pfglfwRestoreWindow glfwRestoreWindow;
230 pfglfwSwapBuffers glfwSwapBuffers;
231 pfglfwSwapInterval glfwSwapInterval;
232 pfglfwGetWindowParam glfwGetWindowParam;
233 pfglfwSetWindowSizeCallback glfwSetWindowSizeCallback;
234 pfglfwSetWindowCloseCallback glfwSetWindowCloseCallback;
235 pfglfwSetWindowRefreshCallback glfwSetWindowRefreshCallback;
236 pfglfwGetVideoModes glfwGetVideoModes;
237 pfglfwGetDesktopMode glfwGetDesktopMode;
238 pfglfwPollEvents glfwPollEvents;
239 pfglfwWaitEvents glfwWaitEvents;
240 pfglfwGetKey glfwGetKey;
241 pfglfwGetMouseButton glfwGetMouseButton;
242 pfglfwGetMousePos glfwGetMousePos;
243 pfglfwSetMousePos glfwSetMousePos;
244 pfglfwGetMouseWheel glfwGetMouseWheel;
245 pfglfwSetMouseWheel glfwSetMouseWheel;
246 pfglfwSetKeyCallback glfwSetKeyCallback;
247 pfglfwSetCharCallback glfwSetCharCallback;
248 pfglfwSetMouseButtonCallback glfwSetMouseButtonCallback;
249 pfglfwSetMousePosCallback glfwSetMousePosCallback;
250 pfglfwSetMouseWheelCallback glfwSetMouseWheelCallback;
251 pfglfwGetJoystickParam glfwGetJoystickParam;
252 pfglfwGetJoystickPos glfwGetJoystickPos;
253 pfglfwGetJoystickButtons glfwGetJoystickButtons;
254 pfglfwGetTime glfwGetTime;
255 pfglfwSetTime glfwSetTime;
256 pfglfwSleep glfwSleep;
257 pfglfwExtensionSupported glfwExtensionSupported;
258 pfglfwGetProcAddress glfwGetProcAddress;
259 pfglfwGetGLVersion glfwGetGLVersion;
260 pfglfwCreateThread glfwCreateThread;
261 pfglfwDestroyThread glfwDestroyThread;
262 pfglfwWaitThread glfwWaitThread;
263 pfglfwGetThreadID glfwGetThreadID;
264 pfglfwCreateMutex glfwCreateMutex;
265 pfglfwDestroyMutex glfwDestroyMutex;
266 pfglfwLockMutex glfwLockMutex;;
267 pfglfwUnlockMutex glfwUnlockMutex;
268 pfglfwCreateCond glfwCreateCond;;
269 pfglfwDestroyCond glfwDestroyCond;
270 pfglfwWaitCond glfwWaitCond;;
271 pfglfwSignalCond glfwSignalCond;
272 pfglfwBroadcastCond glfwBroadcastCond;;
273 pfglfwGetNumberOfProcessors glfwGetNumberOfProcessors;;
274 pfglfwEnable glfwEnable;;
275 pfglfwDisable glfwDisable;
276 pfglfwReadImage glfwReadImage;
277 pfglfwReadMemoryImage glfwReadMemoryImage;
278 pfglfwFreeImage glfwFreeImage;
279 pfglfwLoadTexture2D glfwLoadTexture2D;
280 pfglfwLoadMemoryTexture2D glfwLoadMemoryTexture2D;
281 pfglfwLoadTextureImage2D glfwLoadTextureImage2D;
282
283 //========================================================================
284 //GLFW version
285 //========================================================================
286
287 enum
288 {
289 GLFW_VERSION_MAJOR = 2,
290 GLFW_VERSION_MINOR = 6,
291 GLFW_VERSION_REVISION = 0
292 }
293
294 //========================================================================
295 //Input handling definitions
296 //========================================================================
297
298 //Key and button state/action definitions
299 enum
300 {
301 GLFW_RELEASE = 0,
302 GLFW_PRESS = 1
303 }
304
305 //Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
306 //for printable keys (such as A-Z, 0-9 etc), and values above 256
307 //represent special (non-printable) keys (e.g. F1, Page Up etc).
308 enum
309 {
310 GLFW_KEY_UNKNOWN = -1,
311 GLFW_KEY_SPACE = 32,
312 GLFW_KEY_SPECIAL = 256,
313 GLFW_KEY_ESC = (GLFW_KEY_SPECIAL+1),
314 GLFW_KEY_F1 = (GLFW_KEY_SPECIAL+2),
315 GLFW_KEY_F2 = (GLFW_KEY_SPECIAL+3),
316 GLFW_KEY_F3 = (GLFW_KEY_SPECIAL+4),
317 GLFW_KEY_F4 = (GLFW_KEY_SPECIAL+5),
318 GLFW_KEY_F5 = (GLFW_KEY_SPECIAL+6),
319 GLFW_KEY_F6 = (GLFW_KEY_SPECIAL+7),
320 GLFW_KEY_F7 = (GLFW_KEY_SPECIAL+8),
321 GLFW_KEY_F8 = (GLFW_KEY_SPECIAL+9),
322 GLFW_KEY_F9 = (GLFW_KEY_SPECIAL+10),
323 GLFW_KEY_F10 = (GLFW_KEY_SPECIAL+11),
324 GLFW_KEY_F11 = (GLFW_KEY_SPECIAL+12),
325 GLFW_KEY_F12 = (GLFW_KEY_SPECIAL+13),
326 GLFW_KEY_F13 = (GLFW_KEY_SPECIAL+14),
327 GLFW_KEY_F14 = (GLFW_KEY_SPECIAL+15),
328 GLFW_KEY_F15 = (GLFW_KEY_SPECIAL+16),
329 GLFW_KEY_F16 = (GLFW_KEY_SPECIAL+17),
330 GLFW_KEY_F17 = (GLFW_KEY_SPECIAL+18),
331 GLFW_KEY_F18 = (GLFW_KEY_SPECIAL+19),
332 GLFW_KEY_F19 = (GLFW_KEY_SPECIAL+20),
333 GLFW_KEY_F20 = (GLFW_KEY_SPECIAL+21),
334 GLFW_KEY_F21 = (GLFW_KEY_SPECIAL+22),
335 GLFW_KEY_F22 = (GLFW_KEY_SPECIAL+23),
336 GLFW_KEY_F23 = (GLFW_KEY_SPECIAL+24),
337 GLFW_KEY_F24 = (GLFW_KEY_SPECIAL+25),
338 GLFW_KEY_F25 = (GLFW_KEY_SPECIAL+26),
339 GLFW_KEY_UP = (GLFW_KEY_SPECIAL+27),
340 GLFW_KEY_DOWN = (GLFW_KEY_SPECIAL+28),
341 GLFW_KEY_LEFT = (GLFW_KEY_SPECIAL+29),
342 GLFW_KEY_RIGHT = (GLFW_KEY_SPECIAL+30),
343 GLFW_KEY_LSHIFT = (GLFW_KEY_SPECIAL+31),
344 GLFW_KEY_RSHIFT = (GLFW_KEY_SPECIAL+32),
345 GLFW_KEY_LCTRL = (GLFW_KEY_SPECIAL+33),
346 GLFW_KEY_RCTRL = (GLFW_KEY_SPECIAL+34),
347 GLFW_KEY_LALT = (GLFW_KEY_SPECIAL+35),
348 GLFW_KEY_RALT = (GLFW_KEY_SPECIAL+36),
349 GLFW_KEY_TAB = (GLFW_KEY_SPECIAL+37),
350 GLFW_KEY_ENTER = (GLFW_KEY_SPECIAL+38),
351 GLFW_KEY_BACKSPACE = (GLFW_KEY_SPECIAL+39),
352 GLFW_KEY_INSERT = (GLFW_KEY_SPECIAL+40),
353 GLFW_KEY_DEL = (GLFW_KEY_SPECIAL+41),
354 GLFW_KEY_PAGEUP = (GLFW_KEY_SPECIAL+42),
355 GLFW_KEY_PAGEDOWN = (GLFW_KEY_SPECIAL+43),
356 GLFW_KEY_HOME = (GLFW_KEY_SPECIAL+44),
357 GLFW_KEY_END = (GLFW_KEY_SPECIAL+45),
358 GLFW_KEY_KP_0 = (GLFW_KEY_SPECIAL+46),
359 GLFW_KEY_KP_1 = (GLFW_KEY_SPECIAL+47),
360 GLFW_KEY_KP_2 = (GLFW_KEY_SPECIAL+48),
361 GLFW_KEY_KP_3 = (GLFW_KEY_SPECIAL+49),
362 GLFW_KEY_KP_4 = (GLFW_KEY_SPECIAL+50),
363 GLFW_KEY_KP_5 = (GLFW_KEY_SPECIAL+51),
364 GLFW_KEY_KP_6 = (GLFW_KEY_SPECIAL+52),
365 GLFW_KEY_KP_7 = (GLFW_KEY_SPECIAL+53),
366 GLFW_KEY_KP_8 = (GLFW_KEY_SPECIAL+54),
367 GLFW_KEY_KP_9 = (GLFW_KEY_SPECIAL+55),
368 GLFW_KEY_KP_DIVIDE = (GLFW_KEY_SPECIAL+56),
369 GLFW_KEY_KP_MULTIPLY = (GLFW_KEY_SPECIAL+57),
370 GLFW_KEY_KP_SUBTRACT = (GLFW_KEY_SPECIAL+58),
371 GLFW_KEY_KP_ADD = (GLFW_KEY_SPECIAL+59),
372 GLFW_KEY_KP_DECIMAL = (GLFW_KEY_SPECIAL+60),
373 GLFW_KEY_KP_EQUAL = (GLFW_KEY_SPECIAL+61),
374 GLFW_KEY_KP_ENTER = (GLFW_KEY_SPECIAL+62),
375 GLFW_KEY_LAST = GLFW_KEY_KP_ENTER
376 }
377
378 //Mouse button definitions
379 enum
380 {
381 GLFW_MOUSE_BUTTON_1 = 0,
382 GLFW_MOUSE_BUTTON_2 = 1,
383 GLFW_MOUSE_BUTTON_3 = 2,
384 GLFW_MOUSE_BUTTON_4 = 3,
385 GLFW_MOUSE_BUTTON_5 = 4,
386 GLFW_MOUSE_BUTTON_6 = 5,
387 GLFW_MOUSE_BUTTON_7 = 6,
388 GLFW_MOUSE_BUTTON_8 = 7,
389 GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8
390 }
391
392 //Mouse button aliases
393 enum
394 {
395 GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1,
396 GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2,
397 GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3
398 }
399
400
401 //Joystick identifiers
402 enum
403 {
404 GLFW_JOYSTICK_1 = 0,
405 GLFW_JOYSTICK_2 = 1,
406 GLFW_JOYSTICK_3 = 2,
407 GLFW_JOYSTICK_4 = 3,
408 GLFW_JOYSTICK_5 = 4,
409 GLFW_JOYSTICK_6 = 5,
410 GLFW_JOYSTICK_7 = 6,
411 GLFW_JOYSTICK_8 = 7,
412 GLFW_JOYSTICK_9 = 8,
413 GLFW_JOYSTICK_10 = 9,
414 GLFW_JOYSTICK_11 = 10,
415 GLFW_JOYSTICK_12 = 11,
416 GLFW_JOYSTICK_13 = 12,
417 GLFW_JOYSTICK_14 = 13,
418 GLFW_JOYSTICK_15 = 14,
419 GLFW_JOYSTICK_16 = 15,
420 GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16
421 }
422
423 //========================================================================
424 //Other definitions
425 //========================================================================
426
427 //glfwOpenWindow modes
428 enum
429 {
430 GLFW_WINDOW = 0x00010001,
431 GLFW_FULLSCREEN = 0x00010002
432 }
433
434 //glfwGetWindowParam tokens
435 enum
436 {
437 GLFW_OPENED = 0x00020001,
438 GLFW_ACTIVE = 0x00020002,
439 GLFW_ICONIFIED = 0x00020003,
440 GLFW_ACCELERATED = 0x00020004,
441 GLFW_RED_BITS = 0x00020005,
442 GLFW_GREEN_BITS = 0x00020006,
443 GLFW_BLUE_BITS = 0x00020007,
444 GLFW_ALPHA_BITS = 0x00020008,
445 GLFW_DEPTH_BITS = 0x00020009,
446 GLFW_STENCIL_BITS = 0x0002000A
447 }
448
449 //The following constants are used for both glfwGetWindowParam
450 //and glfwOpenWindowHint
451 enum
452 {
453 GLFW_REFRESH_RATE = 0x0002000B,
454 GLFW_ACCUM_RED_BITS = 0x0002000C,
455 GLFW_ACCUM_GREEN_BITS = 0x0002000D,
456 GLFW_ACCUM_BLUE_BITS = 0x0002000E,
457 GLFW_ACCUM_ALPHA_BITS = 0x0002000F,
458 GLFW_AUX_BUFFERS = 0x00020010,
459 GLFW_STEREO = 0x00020011,
460 GLFW_WINDOW_NO_RESIZE = 0x00020012,
461 GLFW_FSAA_SAMPLES = 0x00020013
462 }
463
464 //glfwEnable/glfwDisable tokens
465 enum
466 {
467 GLFW_MOUSE_CURSOR = 0x00030001,
468 GLFW_STICKY_KEYS = 0x00030002,
469 GLFW_STICKY_MOUSE_BUTTONS = 0x00030003,
470 GLFW_SYSTEM_KEYS = 0x00030004,
471 GLFW_KEY_REPEAT = 0x00030005,
472 GLFW_AUTO_POLL_EVENTS = 0x00030006
473 }
474
475 //glfwWaitThread wait modes
476 enum
477 {
478 GLFW_WAIT = 0x00040001,
479 GLFW_NOWAIT = 0x00040002
480 }
481
482 //glfwGetJoystickParam tokens
483 enum
484 {
485 GLFW_PRESENT = 0x00050001,
486 GLFW_AXES = 0x00050002,
487 GLFW_BUTTONS = 0x00050003
488 }
489
490 //glfwReadImage/glfwLoadTexture2D flags
491 enum
492 {
493 GLFW_NO_RESCALE_BIT = 0x00000001, // Only for glfwReadImage
494 GLFW_ORIGIN_UL_BIT = 0x00000002,
495 GLFW_BUILD_MIPMAPS_BIT = 0x00000004, // Only for glfwLoadTexture2D
496 GLFW_ALPHA_MAP_BIT = 0x00000008
497 }
498
499 //Time spans longer than this (seconds) are considered to be infinity
500 enum
501 {
502 GLFW_INFINITY = 100000
503 }
504
505 //========================================================================
506 // Structs
507 //========================================================================
508
509 //The video mode structure used by glfwGetVideoModes()
510 struct GLFWvidmode
511 {
512 int Width, Height;
513 int RedBits, BlueBits, GreenBits;
514 }
515
516 //Image/texture information
517 struct GLFWimage
518 {
519 int Width, Height;
520 int Format;
521 int BytesPerPixel;
522 ubyte *Data;
523 }
524
525 //Thread ID
526 alias int GLFWthread;
527
528 //Mutex object
529 alias void* GLFWmutex;
530
531 //Condition variable object
532 alias void* GLFWcond;
533
534 //Function pointer types
535 typedef void function(int, int) GLFWwindowsizefun;
536 typedef int function() GLFWwindowclosefun;
537 typedef void function() GLFWwindowrefreshfun;
538 typedef void function(int, int) GLFWmousebuttonfun;
539 typedef void function(int, int) GLFWmouseposfun;
540 typedef void function(int) GLFWmousewheelfun;
541 typedef void function(int, int) GLFWkeyfun;
542 typedef void function(int, int) GLFWcharfun;
543 typedef void function(void*) GLFWthreadfun;
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558