blob: 295ff3ee539ff76f1387315156f52f709f3a3a04 [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund6e553c72011-03-06 01:46:39 +01002 * GLFW - An OpenGL library
Camilla Berglund38b0ccb2010-09-07 17:41:26 +02003 * API version: 3.0
Camilla Berglund3249f812010-09-07 17:34:51 +02004 * WWW: http://www.glfw.org/
5 *------------------------------------------------------------------------
6 * Copyright (c) 2002-2006 Marcus Geelnard
Camilla Berglundf8105ed2010-11-09 02:57:46 +01007 * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
Camilla Berglund3249f812010-09-07 17:34:51 +02008 *
9 * This software is provided 'as-is', without any express or implied
10 * warranty. In no event will the authors be held liable for any damages
11 * arising from the use of this software.
12 *
13 * Permission is granted to anyone to use this software for any purpose,
14 * including commercial applications, and to alter it and redistribute it
15 * freely, subject to the following restrictions:
16 *
17 * 1. The origin of this software must not be misrepresented; you must not
18 * claim that you wrote the original software. If you use this software
19 * in a product, an acknowledgment in the product documentation would
20 * be appreciated but is not required.
21 *
22 * 2. Altered source versions must be plainly marked as such, and must not
23 * be misrepresented as being the original software.
24 *
25 * 3. This notice may not be removed or altered from any source
26 * distribution.
27 *
28 *************************************************************************/
29
Camilla Berglund36e54092010-11-09 02:58:35 +010030#ifndef __glfw3_h__
31#define __glfw3_h__
Camilla Berglund3249f812010-09-07 17:34:51 +020032
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37
38/*************************************************************************
39 * Global definitions
40 *************************************************************************/
41
Camilla Berglund3249f812010-09-07 17:34:51 +020042/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
43
44/* Please report any probles that you find with your compiler, which may
45 * be solved in this section! There are several compilers that I have not
46 * been able to test this file with yet.
47 *
48 * First: If we are we on Windows, we want a single define for it (_WIN32)
49 * (Note: For Cygwin the compiler flag -mwin32 should be used, but to
50 * make sure that things run smoothly for Cygwin users, we add __CYGWIN__
51 * to the list of "valid Win32 identifiers", which removes the need for
52 * -mwin32)
53 */
54#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
55 #define _WIN32
56#endif /* _WIN32 */
57
58/* In order for extension support to be portable, we need to define an
59 * OpenGL function call method. We use the keyword APIENTRY, which is
60 * defined for Win32. (Note: Windows also needs this for <GL/gl.h>)
61 */
62#ifndef APIENTRY
63 #ifdef _WIN32
64 #define APIENTRY __stdcall
65 #else
66 #define APIENTRY
67 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +020068#endif /* APIENTRY */
69
Camilla Berglund3249f812010-09-07 17:34:51 +020070/* The following three defines are here solely to make some Windows-based
71 * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but
72 * it has the major drawback of severely polluting our namespace.
73 */
74
75/* Under Windows, we need WINGDIAPI defined */
76#if !defined(WINGDIAPI) && defined(_WIN32)
77 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
78 /* Microsoft Visual C++, Borland C++ Builder and Pelles C */
79 #define WINGDIAPI __declspec(dllimport)
80 #elif defined(__LCC__)
81 /* LCC-Win32 */
82 #define WINGDIAPI __stdcall
83 #else
84 /* Others (e.g. MinGW, Cygwin) */
85 #define WINGDIAPI extern
86 #endif
Camilla Berglund4afc67c2011-07-27 17:09:17 +020087 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +020088#endif /* WINGDIAPI */
89
90/* Some <GL/glu.h> files also need CALLBACK defined */
91#if !defined(CALLBACK) && defined(_WIN32)
92 #if defined(_MSC_VER)
93 /* Microsoft Visual C++ */
94 #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
95 #define CALLBACK __stdcall
96 #else
97 #define CALLBACK
98 #endif
99 #else
100 /* Other Windows compilers */
101 #define CALLBACK __stdcall
102 #endif
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200103 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200104#endif /* CALLBACK */
105
Camilla Berglund3c912cb2012-08-02 21:25:00 +0200106/* Most <GL/glu.h> variants on Windows need wchar_t */
107#if defined(_WIN32)
108 #include <stddef.h>
109#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200110
111
112/* ---------------- GLFW related system specific defines ----------------- */
113
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200114#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
115 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
116#endif
117
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200118#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3249f812010-09-07 17:34:51 +0200119
120 /* We are building a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100121 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200122
123#elif defined(_WIN32) && defined(GLFW_DLL)
124
125 /* We are calling a Win32 DLL */
126 #if defined(__LCC__)
Camilla Berglund2955cd32010-11-17 15:42:55 +0100127 #define GLFWAPI extern
Camilla Berglund3249f812010-09-07 17:34:51 +0200128 #else
Camilla Berglund2955cd32010-11-17 15:42:55 +0100129 #define GLFWAPI __declspec(dllimport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200130 #endif
131
132#else
133
134 /* We are either building/calling a static lib or we are non-win32 */
135 #define GLFWAPI
136
137#endif
138
139/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
140
Camilla Berglund22134502012-06-05 23:55:10 +0200141/* Include the chosen OpenGL header and, optionally, the GLU header.
Camilla Berglund3249f812010-09-07 17:34:51 +0200142 */
143#if defined(__APPLE_CC__)
Camilla Berglundd88789e2011-09-16 04:44:40 +0200144 #if defined(GLFW_INCLUDE_GL3)
145 #include <OpenGL/gl3.h>
146 #else
147 #define GL_GLEXT_LEGACY
148 #include <OpenGL/gl.h>
149 #endif
Camilla Berglund22134502012-06-05 23:55:10 +0200150 #if defined(GLFW_INCLUDE_GLU)
Camilla Berglundd88789e2011-09-16 04:44:40 +0200151 #include <OpenGL/glu.h>
152 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200153#else
Camilla Berglundd88789e2011-09-16 04:44:40 +0200154 #if defined(GLFW_INCLUDE_GL3)
155 #include <GL3/gl3.h>
156 #else
157 #include <GL/gl.h>
158 #endif
Camilla Berglund22134502012-06-05 23:55:10 +0200159 #if defined(GLFW_INCLUDE_GLU)
Camilla Berglundd88789e2011-09-16 04:44:40 +0200160 #include <GL/glu.h>
161 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200162#endif
163
164
165/*************************************************************************
166 * GLFW version
167 *************************************************************************/
168
Camilla Berglund38b0ccb2010-09-07 17:41:26 +0200169#define GLFW_VERSION_MAJOR 3
170#define GLFW_VERSION_MINOR 0
Camilla Berglund3249f812010-09-07 17:34:51 +0200171#define GLFW_VERSION_REVISION 0
172
173
174/*************************************************************************
175 * Input handling definitions
176 *************************************************************************/
177
178/* Key and button state/action definitions */
179#define GLFW_RELEASE 0
180#define GLFW_PRESS 1
181
Marcusc0cb4c22011-01-02 11:18:14 +0100182/* Keyboard raw key codes.
183 * These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60),
184 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
185 * put in the 256+ range).
186 * The naming of the key codes follow these rules:
187 * - The US keyboard layout is used.
188 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
189 * "3", etc).
190 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
191 * "COMMA", "LEFT_SQUARE_BRACKET", etc). Note that some names do not
192 * correspond to the Unicode standard (usually for brevity).
193 * - Keys that lack a clear US mapping are named "WORLD_x".
194 * - For non-printable keys, custom names are used (e.g. "F4",
195 * "BACKSPACE", etc).
Camilla Berglund3249f812010-09-07 17:34:51 +0200196 */
Marcusc0cb4c22011-01-02 11:18:14 +0100197
198/* Printable keys */
199#define GLFW_KEY_SPACE 32
200#define GLFW_KEY_APOSTROPHE 39 /* ' */
201#define GLFW_KEY_COMMA 44 /* , */
202#define GLFW_KEY_MINUS 45 /* - */
203#define GLFW_KEY_PERIOD 46 /* . */
204#define GLFW_KEY_SLASH 47 /* / */
205#define GLFW_KEY_0 48
206#define GLFW_KEY_1 49
207#define GLFW_KEY_2 50
208#define GLFW_KEY_3 51
209#define GLFW_KEY_4 52
210#define GLFW_KEY_5 53
211#define GLFW_KEY_6 54
212#define GLFW_KEY_7 55
213#define GLFW_KEY_8 56
214#define GLFW_KEY_9 57
215#define GLFW_KEY_SEMICOLON 59 /* ; */
216#define GLFW_KEY_EQUAL 61 /* = */
217#define GLFW_KEY_A 65
218#define GLFW_KEY_B 66
219#define GLFW_KEY_C 67
220#define GLFW_KEY_D 68
221#define GLFW_KEY_E 69
222#define GLFW_KEY_F 70
223#define GLFW_KEY_G 71
224#define GLFW_KEY_H 72
225#define GLFW_KEY_I 73
226#define GLFW_KEY_J 74
227#define GLFW_KEY_K 75
228#define GLFW_KEY_L 76
229#define GLFW_KEY_M 77
230#define GLFW_KEY_N 78
231#define GLFW_KEY_O 79
232#define GLFW_KEY_P 80
233#define GLFW_KEY_Q 81
234#define GLFW_KEY_R 82
235#define GLFW_KEY_S 83
236#define GLFW_KEY_T 84
237#define GLFW_KEY_U 85
238#define GLFW_KEY_V 86
239#define GLFW_KEY_W 87
240#define GLFW_KEY_X 88
241#define GLFW_KEY_Y 89
242#define GLFW_KEY_Z 90
Marcus3b008472011-01-03 22:07:01 +0100243#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
Marcusc0cb4c22011-01-02 11:18:14 +0100244#define GLFW_KEY_BACKSLASH 92 /* \ */
Marcus3b008472011-01-03 22:07:01 +0100245#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
Marcusc0cb4c22011-01-02 11:18:14 +0100246#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
247#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
248#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
249
250/* Function keys */
251#define GLFW_KEY_ESCAPE 256
252#define GLFW_KEY_ENTER 257
253#define GLFW_KEY_TAB 258
254#define GLFW_KEY_BACKSPACE 259
255#define GLFW_KEY_INSERT 260
256#define GLFW_KEY_DELETE 261
257#define GLFW_KEY_RIGHT 262
258#define GLFW_KEY_LEFT 263
259#define GLFW_KEY_DOWN 264
260#define GLFW_KEY_UP 265
261#define GLFW_KEY_PAGE_UP 266
262#define GLFW_KEY_PAGE_DOWN 267
263#define GLFW_KEY_HOME 268
264#define GLFW_KEY_END 269
265#define GLFW_KEY_CAPS_LOCK 280
266#define GLFW_KEY_SCROLL_LOCK 281
267#define GLFW_KEY_NUM_LOCK 282
268#define GLFW_KEY_PRINT_SCREEN 283
269#define GLFW_KEY_PAUSE 284
270#define GLFW_KEY_F1 290
271#define GLFW_KEY_F2 291
272#define GLFW_KEY_F3 292
273#define GLFW_KEY_F4 293
274#define GLFW_KEY_F5 294
275#define GLFW_KEY_F6 295
276#define GLFW_KEY_F7 296
277#define GLFW_KEY_F8 297
278#define GLFW_KEY_F9 298
279#define GLFW_KEY_F10 299
280#define GLFW_KEY_F11 300
281#define GLFW_KEY_F12 301
282#define GLFW_KEY_F13 302
283#define GLFW_KEY_F14 303
284#define GLFW_KEY_F15 304
285#define GLFW_KEY_F16 305
286#define GLFW_KEY_F17 306
287#define GLFW_KEY_F18 307
288#define GLFW_KEY_F19 308
289#define GLFW_KEY_F20 309
290#define GLFW_KEY_F21 310
291#define GLFW_KEY_F22 311
292#define GLFW_KEY_F23 312
293#define GLFW_KEY_F24 313
294#define GLFW_KEY_F25 314
295#define GLFW_KEY_KP_0 320
296#define GLFW_KEY_KP_1 321
297#define GLFW_KEY_KP_2 322
298#define GLFW_KEY_KP_3 323
299#define GLFW_KEY_KP_4 324
300#define GLFW_KEY_KP_5 325
301#define GLFW_KEY_KP_6 326
302#define GLFW_KEY_KP_7 327
303#define GLFW_KEY_KP_8 328
304#define GLFW_KEY_KP_9 329
305#define GLFW_KEY_KP_DECIMAL 330
306#define GLFW_KEY_KP_DIVIDE 331
307#define GLFW_KEY_KP_MULTIPLY 332
308#define GLFW_KEY_KP_SUBTRACT 333
309#define GLFW_KEY_KP_ADD 334
310#define GLFW_KEY_KP_ENTER 335
311#define GLFW_KEY_KP_EQUAL 336
312#define GLFW_KEY_LEFT_SHIFT 340
313#define GLFW_KEY_LEFT_CONTROL 341
314#define GLFW_KEY_LEFT_ALT 342
315#define GLFW_KEY_LEFT_SUPER 343
316#define GLFW_KEY_RIGHT_SHIFT 344
317#define GLFW_KEY_RIGHT_CONTROL 345
318#define GLFW_KEY_RIGHT_ALT 346
319#define GLFW_KEY_RIGHT_SUPER 347
320#define GLFW_KEY_MENU 348
321#define GLFW_KEY_LAST GLFW_KEY_MENU
322
323/* GLFW 2.x key name aliases (deprecated) */
324#define GLFW_KEY_ESC GLFW_KEY_ESCAPE
325#define GLFW_KEY_DEL GLFW_KEY_DELETE
326#define GLFW_KEY_PAGEUP GLFW_KEY_PAGE_UP
327#define GLFW_KEY_PAGEDOWN GLFW_KEY_PAGE_DOWN
328#define GLFW_KEY_KP_NUM_LOCK GLFW_KEY_NUM_LOCK
329#define GLFW_KEY_LCTRL GLFW_KEY_LEFT_CONTROL
330#define GLFW_KEY_LSHIFT GLFW_KEY_LEFT_SHIFT
331#define GLFW_KEY_LALT GLFW_KEY_LEFT_ALT
332#define GLFW_KEY_LSUPER GLFW_KEY_LEFT_SUPER
333#define GLFW_KEY_RCTRL GLFW_KEY_RIGHT_CONTROL
334#define GLFW_KEY_RSHIFT GLFW_KEY_RIGHT_SHIFT
335#define GLFW_KEY_RALT GLFW_KEY_RIGHT_ALT
336#define GLFW_KEY_RSUPER GLFW_KEY_RIGHT_SUPER
Camilla Berglund3249f812010-09-07 17:34:51 +0200337
338/* Mouse button definitions */
339#define GLFW_MOUSE_BUTTON_1 0
340#define GLFW_MOUSE_BUTTON_2 1
341#define GLFW_MOUSE_BUTTON_3 2
342#define GLFW_MOUSE_BUTTON_4 3
343#define GLFW_MOUSE_BUTTON_5 4
344#define GLFW_MOUSE_BUTTON_6 5
345#define GLFW_MOUSE_BUTTON_7 6
346#define GLFW_MOUSE_BUTTON_8 7
347#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
348
349/* Mouse button aliases */
350#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
351#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
352#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
353
354/* Joystick identifiers */
355#define GLFW_JOYSTICK_1 0
356#define GLFW_JOYSTICK_2 1
357#define GLFW_JOYSTICK_3 2
358#define GLFW_JOYSTICK_4 3
359#define GLFW_JOYSTICK_5 4
360#define GLFW_JOYSTICK_6 5
361#define GLFW_JOYSTICK_7 6
362#define GLFW_JOYSTICK_8 7
363#define GLFW_JOYSTICK_9 8
364#define GLFW_JOYSTICK_10 9
365#define GLFW_JOYSTICK_11 10
366#define GLFW_JOYSTICK_12 11
367#define GLFW_JOYSTICK_13 12
368#define GLFW_JOYSTICK_14 13
369#define GLFW_JOYSTICK_15 14
370#define GLFW_JOYSTICK_16 15
371#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
372
373
374/*************************************************************************
375 * Other definitions
376 *************************************************************************/
377
Camilla Berglundaff30d02012-08-06 17:56:41 +0200378/* glfwCreateWindow modes */
Camilla Berglund484a2712010-09-10 13:24:19 +0200379#define GLFW_WINDOWED 0x00010001
Camilla Berglund3249f812010-09-07 17:34:51 +0200380#define GLFW_FULLSCREEN 0x00010002
381
382/* glfwGetWindowParam tokens */
Camilla Berglund39dfa7d2010-11-15 21:39:46 +0100383#define GLFW_ACTIVE 0x00020001
384#define GLFW_ICONIFIED 0x00020002
Camilla Berglund2410e2a2012-08-10 13:31:15 +0200385#define GLFW_CLOSE_REQUESTED 0x00020003
Camilla Berglund4fb55782011-08-15 01:40:10 +0200386#define GLFW_OPENGL_REVISION 0x00020004
Camilla Berglund950a3be2010-09-09 19:58:51 +0200387
Camilla Berglundddcf5d42012-08-10 13:03:11 +0200388/* glfwWindowHint tokens */
Camilla Berglund4fb55782011-08-15 01:40:10 +0200389#define GLFW_RED_BITS 0x00021000
390#define GLFW_GREEN_BITS 0x00021001
391#define GLFW_BLUE_BITS 0x00021002
392#define GLFW_ALPHA_BITS 0x00021003
393#define GLFW_DEPTH_BITS 0x00021004
394#define GLFW_STENCIL_BITS 0x00021005
395#define GLFW_REFRESH_RATE 0x00021006
396#define GLFW_ACCUM_RED_BITS 0x00021007
397#define GLFW_ACCUM_GREEN_BITS 0x00021008
398#define GLFW_ACCUM_BLUE_BITS 0x00021009
399#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
400#define GLFW_AUX_BUFFERS 0x0002100B
401#define GLFW_STEREO 0x0002100C
Camilla Berglunda18cd1b2011-11-02 16:56:34 +0100402#define GLFW_WINDOW_RESIZABLE 0x0002100D
Camilla Berglund4fb55782011-08-15 01:40:10 +0200403#define GLFW_FSAA_SAMPLES 0x0002100E
Camilla Berglundddcf5d42012-08-10 13:03:11 +0200404
405/* The following constants are used with both glfwGetWindowParam
406 * and glfwWindowHint
407 */
Camilla Berglund4fb55782011-08-15 01:40:10 +0200408#define GLFW_OPENGL_VERSION_MAJOR 0x0002100F
409#define GLFW_OPENGL_VERSION_MINOR 0x00021010
410#define GLFW_OPENGL_FORWARD_COMPAT 0x00021011
411#define GLFW_OPENGL_DEBUG_CONTEXT 0x00021012
412#define GLFW_OPENGL_PROFILE 0x00021013
413#define GLFW_OPENGL_ROBUSTNESS 0x00021014
Camilla Berglundd43e0b52011-03-07 20:51:34 +0100414
415/* GLFW_OPENGL_ROBUSTNESS mode tokens */
416#define GLFW_OPENGL_NO_ROBUSTNESS 0x00000000
417#define GLFW_OPENGL_NO_RESET_NOTIFICATION 0x00000001
418#define GLFW_OPENGL_LOSE_CONTEXT_ON_RESET 0x00000002
Camilla Berglund3249f812010-09-07 17:34:51 +0200419
Camilla Berglund20662dd2010-11-15 21:40:43 +0100420/* GLFW_OPENGL_PROFILE bit tokens */
Camilla Berglunde2c58b02011-09-19 21:00:29 +0200421#define GLFW_OPENGL_NO_PROFILE 0x00000000
Camilla Berglund20662dd2010-11-15 21:40:43 +0100422#define GLFW_OPENGL_CORE_PROFILE 0x00000001
423#define GLFW_OPENGL_COMPAT_PROFILE 0x00000002
424#define GLFW_OPENGL_ES2_PROFILE 0x00000004
Camilla Berglund3249f812010-09-07 17:34:51 +0200425
Camilla Berglundce288a82012-02-04 00:51:35 +0100426/* glfwGetInputMode/glfwSetInputMode tokens */
427#define GLFW_CURSOR_MODE 0x00030001
Camilla Berglund3249f812010-09-07 17:34:51 +0200428#define GLFW_STICKY_KEYS 0x00030002
429#define GLFW_STICKY_MOUSE_BUTTONS 0x00030003
430#define GLFW_SYSTEM_KEYS 0x00030004
431#define GLFW_KEY_REPEAT 0x00030005
Camilla Berglund3249f812010-09-07 17:34:51 +0200432
Camilla Berglundce288a82012-02-04 00:51:35 +0100433/* GLFW_CURSOR_MODE values */
Camilla Berglundb1656d72011-09-06 13:55:29 +0200434#define GLFW_CURSOR_NORMAL 0x00040001
435#define GLFW_CURSOR_HIDDEN 0x00040002
436#define GLFW_CURSOR_CAPTURED 0x00040003
437
Camilla Berglund3249f812010-09-07 17:34:51 +0200438/* glfwGetJoystickParam tokens */
439#define GLFW_PRESENT 0x00050001
440#define GLFW_AXES 0x00050002
441#define GLFW_BUTTONS 0x00050003
442
Camilla Berglunde28543c2010-09-09 21:08:50 +0200443/* glfwGetError/glfwErrorString tokens */
444#define GLFW_NO_ERROR 0
445#define GLFW_NOT_INITIALIZED 0x00070001
Camilla Berglund957ecdc2012-08-02 15:36:15 +0200446#define GLFW_NO_CURRENT_CONTEXT 0x00070002
Camilla Berglund52546172010-10-05 00:08:19 +0200447#define GLFW_INVALID_ENUM 0x00070003
448#define GLFW_INVALID_VALUE 0x00070004
449#define GLFW_OUT_OF_MEMORY 0x00070005
450#define GLFW_OPENGL_UNAVAILABLE 0x00070006
451#define GLFW_VERSION_UNAVAILABLE 0x00070007
452#define GLFW_PLATFORM_ERROR 0x00070008
Camilla Berglundb1656d72011-09-06 13:55:29 +0200453#define GLFW_WINDOW_NOT_ACTIVE 0x00070009
Camilla Berglund7044ed62012-04-09 15:54:36 +0200454#define GLFW_FORMAT_UNAVAILABLE 0x0007000A
Camilla Berglund3249f812010-09-07 17:34:51 +0200455
Camilla Berglund2630d492010-10-13 04:04:43 +0200456/* Gamma ramps */
457#define GLFW_GAMMA_RAMP_SIZE 256
Camilla Berglund2c091572010-09-09 21:09:11 +0200458
Camilla Berglund3249f812010-09-07 17:34:51 +0200459/*************************************************************************
460 * Typedefs
461 *************************************************************************/
462
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200463/* OpenGL function pointer type */
464typedef void (*GLFWglproc)(void);
465
Camilla Berglund8d8eb0c2010-09-16 06:05:50 +0200466/* Window handle type */
Camilla Berglunda66a4cd2011-02-09 12:37:42 +0100467typedef void* GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200468
Camilla Berglund897558f2011-03-07 13:34:58 +0100469/* Function pointer types */
470typedef void (* GLFWerrorfun)(int,const char*);
471typedef void (* GLFWwindowsizefun)(GLFWwindow,int,int);
472typedef int (* GLFWwindowclosefun)(GLFWwindow);
473typedef void (* GLFWwindowrefreshfun)(GLFWwindow);
474typedef void (* GLFWwindowfocusfun)(GLFWwindow,int);
475typedef void (* GLFWwindowiconifyfun)(GLFWwindow,int);
476typedef void (* GLFWmousebuttonfun)(GLFWwindow,int,int);
Camilla Berglundcef9dea2012-06-22 13:53:02 +0200477typedef void (* GLFWcursorposfun)(GLFWwindow,int,int);
Camilla Berglundc4806b92012-01-30 22:59:38 +0100478typedef void (* GLFWcursorenterfun)(GLFWwindow,int);
Camilla Berglund4ef9aec2012-03-28 21:54:09 +0200479typedef void (* GLFWscrollfun)(GLFWwindow,double,double);
Camilla Berglund897558f2011-03-07 13:34:58 +0100480typedef void (* GLFWkeyfun)(GLFWwindow,int,int);
481typedef void (* GLFWcharfun)(GLFWwindow,int);
482
Camilla Berglund8d8eb0c2010-09-16 06:05:50 +0200483/* The video mode structure used by glfwGetVideoModes */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200484typedef struct
485{
486 int width;
487 int height;
488 int redBits;
489 int blueBits;
490 int greenBits;
Camilla Berglund3249f812010-09-07 17:34:51 +0200491} GLFWvidmode;
492
Camilla Berglund2630d492010-10-13 04:04:43 +0200493/* Gamma ramp */
494typedef struct
495{
496 unsigned short red[GLFW_GAMMA_RAMP_SIZE];
497 unsigned short green[GLFW_GAMMA_RAMP_SIZE];
498 unsigned short blue[GLFW_GAMMA_RAMP_SIZE];
499} GLFWgammaramp;
500
Camilla Berglund3249f812010-09-07 17:34:51 +0200501
502/*************************************************************************
503 * Prototypes
504 *************************************************************************/
505
Camilla Berglund16cf53b2010-09-20 00:38:06 +0200506/* Initialization, termination and version querying */
Camilla Berglund9a716692010-09-08 16:40:43 +0200507GLFWAPI int glfwInit(void);
508GLFWAPI void glfwTerminate(void);
509GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundd6fe4472010-09-13 18:05:59 +0200510GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +0200511
Camilla Berglundf5d74c42010-09-09 21:06:59 +0200512/* Error handling */
513GLFWAPI int glfwGetError(void);
514GLFWAPI const char* glfwErrorString(int error);
Camilla Berglundf1e7d7c2010-11-23 17:45:23 +0100515GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +0200516
Camilla Berglund3249f812010-09-07 17:34:51 +0200517/* Video mode functions */
Camilla Berglund871e1a72012-08-02 18:03:43 +0200518GLFWAPI GLFWvidmode* glfwGetVideoModes(int* count);
Camilla Berglund9a716692010-09-08 16:40:43 +0200519GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode);
Camilla Berglund3249f812010-09-07 17:34:51 +0200520
Camilla Berglund2630d492010-10-13 04:04:43 +0200521/* Gamma ramp functions */
Camilla Berglundca0dbdb2011-09-06 15:43:31 +0200522GLFWAPI void glfwSetGamma(float gamma);
Camilla Berglund2630d492010-10-13 04:04:43 +0200523GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp);
524GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp);
525
Camilla Berglund135194a2010-09-09 18:15:32 +0200526/* Window handling */
Camilla Berglundaff30d02012-08-06 17:56:41 +0200527GLFWAPI void glfwWindowHint(int target, int hint);
Camilla Berglund2212cd92012-08-10 13:29:45 +0200528GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, int mode, const char* title, GLFWwindow share);
Camilla Berglundaff30d02012-08-06 17:56:41 +0200529GLFWAPI void glfwDestroyWindow(GLFWwindow window);
Camilla Berglunda3390982012-09-02 15:22:56 +0200530GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title);
531GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height);
532GLFWAPI void glfwSetWindowSize(GLFWwindow window, int width, int height);
533GLFWAPI void glfwGetWindowPos(GLFWwindow window, int* xpos, int* ypos);
534GLFWAPI void glfwSetWindowPos(GLFWwindow window, int xpos, int ypos);
Camilla Berglund135194a2010-09-09 18:15:32 +0200535GLFWAPI void glfwIconifyWindow(GLFWwindow window);
536GLFWAPI void glfwRestoreWindow(GLFWwindow window);
537GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param);
Camilla Berglund48f5a7e2010-09-09 22:44:38 +0200538GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer);
539GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window);
Camilla Berglund4044c2d2010-10-24 18:28:55 +0200540GLFWAPI void glfwSetWindowSizeCallback(GLFWwindowsizefun cbfun);
541GLFWAPI void glfwSetWindowCloseCallback(GLFWwindowclosefun cbfun);
542GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindowrefreshfun cbfun);
543GLFWAPI void glfwSetWindowFocusCallback(GLFWwindowfocusfun cbfun);
544GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +0200545
546/* Event handling */
Camilla Berglund9a716692010-09-08 16:40:43 +0200547GLFWAPI void glfwPollEvents(void);
548GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +0200549
550/* Input handling */
Camilla Berglund609c0082012-02-04 01:34:12 +0100551GLFWAPI int glfwGetInputMode(GLFWwindow window, int mode);
552GLFWAPI void glfwSetInputMode(GLFWwindow window, int mode, int value);
Camilla Berglund135194a2010-09-09 18:15:32 +0200553GLFWAPI int glfwGetKey(GLFWwindow window, int key);
554GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button);
Camilla Berglundcef9dea2012-06-22 13:53:02 +0200555GLFWAPI void glfwGetCursorPos(GLFWwindow window, int* xpos, int* ypos);
556GLFWAPI void glfwSetCursorPos(GLFWwindow window, int xpos, int ypos);
Camilla Berglund4ef9aec2012-03-28 21:54:09 +0200557GLFWAPI void glfwGetScrollOffset(GLFWwindow window, double* xoffset, double* yoffset);
Camilla Berglund4044c2d2010-10-24 18:28:55 +0200558GLFWAPI void glfwSetKeyCallback(GLFWkeyfun cbfun);
559GLFWAPI void glfwSetCharCallback(GLFWcharfun cbfun);
560GLFWAPI void glfwSetMouseButtonCallback(GLFWmousebuttonfun cbfun);
Camilla Berglundcef9dea2012-06-22 13:53:02 +0200561GLFWAPI void glfwSetCursorPosCallback(GLFWcursorposfun cbfun);
Hanmac0b752b82012-01-30 22:18:05 +0100562GLFWAPI void glfwSetCursorEnterCallback(GLFWcursorenterfun cbfun);
Camilla Berglund4044c2d2010-10-24 18:28:55 +0200563GLFWAPI void glfwSetScrollCallback(GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +0200564
565/* Joystick input */
Camilla Berglund9a716692010-09-08 16:40:43 +0200566GLFWAPI int glfwGetJoystickParam(int joy, int param);
Camilla Berglund2502e4d2012-08-29 18:31:12 +0200567GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes);
Camilla Berglund9a716692010-09-08 16:40:43 +0200568GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons);
Camilla Berglund93a1d1c2012-09-07 01:01:34 +0200569GLFWAPI const char* glfwGetJoystickName(int joy);
Camilla Berglund3249f812010-09-07 17:34:51 +0200570
Ralph Eastwood31c91542011-09-21 10:09:47 +0100571/* Clipboard */
Camilla Berglund1214fa12012-04-09 16:03:14 +0200572GLFWAPI void glfwSetClipboardString(GLFWwindow window, const char* string);
Camilla Berglundf8687122012-04-12 00:51:58 +0200573GLFWAPI const char* glfwGetClipboardString(GLFWwindow window);
Ralph Eastwood31c91542011-09-21 10:09:47 +0100574
Camilla Berglund3249f812010-09-07 17:34:51 +0200575/* Time */
Camilla Berglund9a716692010-09-08 16:40:43 +0200576GLFWAPI double glfwGetTime(void);
577GLFWAPI void glfwSetTime(double time);
Camilla Berglund3249f812010-09-07 17:34:51 +0200578
Camilla Berglund135194a2010-09-09 18:15:32 +0200579/* OpenGL support */
Camilla Berglundc1ab73b2011-07-27 16:01:27 +0200580GLFWAPI void glfwMakeContextCurrent(GLFWwindow window);
581GLFWAPI GLFWwindow glfwGetCurrentContext(void);
Camilla Berglund585a8402012-08-06 18:13:37 +0200582GLFWAPI void glfwSwapBuffers(GLFWwindow window);
Camilla Berglund135194a2010-09-09 18:15:32 +0200583GLFWAPI void glfwSwapInterval(int interval);
Camilla Berglund9a716692010-09-08 16:40:43 +0200584GLFWAPI int glfwExtensionSupported(const char* extension);
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200585GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglundc1ab73b2011-07-27 16:01:27 +0200586GLFWAPI void glfwCopyContext(GLFWwindow src, GLFWwindow dst, unsigned long mask);
Camilla Berglund3249f812010-09-07 17:34:51 +0200587
Camilla Berglund3249f812010-09-07 17:34:51 +0200588
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200589/*************************************************************************
590 * Global definition cleanup
591 *************************************************************************/
592
593/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
594
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200595#ifdef GLFW_WINGDIAPI_DEFINED
596 #undef WINGDIAPI
597 #undef GLFW_WINGDIAPI_DEFINED
598#endif
599
600#ifdef GLFW_CALLBACK_DEFINED
601 #undef CALLBACK
602 #undef GLFW_CALLBACK_DEFINED
603#endif
604
605/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
606
607
Camilla Berglund3249f812010-09-07 17:34:51 +0200608#ifdef __cplusplus
609}
610#endif
611
Camilla Berglund36e54092010-11-09 02:58:35 +0100612#endif /* __glfw3_h__ */
Camilla Berglund3249f812010-09-07 17:34:51 +0200613