blob: 91f2188a297b05f68212439cad4282005044dec1 [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 Berglundf8df91d2013-01-15 01:59:56 +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/*************************************************************************
Camilla Berglundbce2cd62012-11-22 16:38:24 +010039 * Doxygen documentation
40 *************************************************************************/
41
42/*! @mainpage notitle
43 *
44 * @section intro Introduction
45 *
46 * This is the reference documentation for the GLFW library.
47 */
48
49/*! @defgroup clipboard Clipboard support
50 */
Camilla Berglund3f5843f2012-12-13 02:22:39 +010051/*! @defgroup context Context handling
52 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010053/*! @defgroup error Error handling
54 */
55/*! @defgroup gamma Gamma ramp support
56 */
57/*! @defgroup init Initialization and version information
58 */
59/*! @defgroup input Input handling
60 */
Camilla Berglund5f68e122012-11-27 17:07:28 +010061/*! @defgroup monitor Monitor handling
62 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010063/*! @defgroup time Time input
64 */
65/*! @defgroup window Window handling
66 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +010067 * The primary purpose of GLFW is to provide a simple interface to window
68 * management and OpenGL and OpenGL ES context creation. GLFW supports
69 * multiple windows, which can be either a normal desktop window or
70 * a fullscreen window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010071 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010072
73
74/*************************************************************************
Camilla Berglund3249f812010-09-07 17:34:51 +020075 * Global definitions
76 *************************************************************************/
77
Camilla Berglund3249f812010-09-07 17:34:51 +020078/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
79
Camilla Berglund06e7a962012-11-22 19:14:27 +010080/* Please report any problems that you find with your compiler, which may
Camilla Berglund3249f812010-09-07 17:34:51 +020081 * be solved in this section! There are several compilers that I have not
82 * been able to test this file with yet.
83 *
84 * First: If we are we on Windows, we want a single define for it (_WIN32)
85 * (Note: For Cygwin the compiler flag -mwin32 should be used, but to
86 * make sure that things run smoothly for Cygwin users, we add __CYGWIN__
87 * to the list of "valid Win32 identifiers", which removes the need for
88 * -mwin32)
89 */
90#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
91 #define _WIN32
92#endif /* _WIN32 */
93
94/* In order for extension support to be portable, we need to define an
95 * OpenGL function call method. We use the keyword APIENTRY, which is
96 * defined for Win32. (Note: Windows also needs this for <GL/gl.h>)
97 */
98#ifndef APIENTRY
99 #ifdef _WIN32
100 #define APIENTRY __stdcall
101 #else
102 #define APIENTRY
103 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200104#endif /* APIENTRY */
105
Camilla Berglund3249f812010-09-07 17:34:51 +0200106/* The following three defines are here solely to make some Windows-based
107 * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but
108 * it has the major drawback of severely polluting our namespace.
109 */
110
111/* Under Windows, we need WINGDIAPI defined */
112#if !defined(WINGDIAPI) && defined(_WIN32)
113 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
114 /* Microsoft Visual C++, Borland C++ Builder and Pelles C */
115 #define WINGDIAPI __declspec(dllimport)
116 #elif defined(__LCC__)
117 /* LCC-Win32 */
118 #define WINGDIAPI __stdcall
119 #else
120 /* Others (e.g. MinGW, Cygwin) */
121 #define WINGDIAPI extern
122 #endif
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200123 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200124#endif /* WINGDIAPI */
125
126/* Some <GL/glu.h> files also need CALLBACK defined */
127#if !defined(CALLBACK) && defined(_WIN32)
128 #if defined(_MSC_VER)
129 /* Microsoft Visual C++ */
130 #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
131 #define CALLBACK __stdcall
132 #else
133 #define CALLBACK
134 #endif
135 #else
136 /* Other Windows compilers */
137 #define CALLBACK __stdcall
138 #endif
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200139 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200140#endif /* CALLBACK */
141
Camilla Berglund3c912cb2012-08-02 21:25:00 +0200142/* Most <GL/glu.h> variants on Windows need wchar_t */
143#if defined(_WIN32)
144 #include <stddef.h>
145#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200146
147
148/* ---------------- GLFW related system specific defines ----------------- */
149
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200150#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
151 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
152#endif
153
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200154#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3249f812010-09-07 17:34:51 +0200155
156 /* We are building a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100157 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200158
159#elif defined(_WIN32) && defined(GLFW_DLL)
160
161 /* We are calling a Win32 DLL */
162 #if defined(__LCC__)
Camilla Berglund2955cd32010-11-17 15:42:55 +0100163 #define GLFWAPI extern
Camilla Berglund3249f812010-09-07 17:34:51 +0200164 #else
Camilla Berglund2955cd32010-11-17 15:42:55 +0100165 #define GLFWAPI __declspec(dllimport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200166 #endif
167
168#else
169
170 /* We are either building/calling a static lib or we are non-win32 */
171 #define GLFWAPI
172
173#endif
174
175/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
176
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100177/* Include the chosen client API headers.
Camilla Berglund3249f812010-09-07 17:34:51 +0200178 */
179#if defined(__APPLE_CC__)
Camilla Berglund410a4e22012-09-27 22:28:04 +0200180 #if defined(GLFW_INCLUDE_GLCOREARB)
Camilla Berglundd88789e2011-09-16 04:44:40 +0200181 #include <OpenGL/gl3.h>
182 #else
183 #define GL_GLEXT_LEGACY
184 #include <OpenGL/gl.h>
185 #endif
Camilla Berglund22134502012-06-05 23:55:10 +0200186 #if defined(GLFW_INCLUDE_GLU)
Camilla Berglundd88789e2011-09-16 04:44:40 +0200187 #include <OpenGL/glu.h>
188 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200189#else
Camilla Berglund410a4e22012-09-27 22:28:04 +0200190 #if defined(GLFW_INCLUDE_GLCOREARB)
191 #include <GL/glcorearb.h>
Jari Vetoniemi38c4a8e2012-11-10 00:08:44 +0200192 #elif defined(GLFW_INCLUDE_ES1)
193 #include <GLES/gl.h>
Camilla Berglund3fd17742012-07-19 23:20:47 +0200194 #elif defined(GLFW_INCLUDE_ES2)
195 #include <GLES2/gl2.h>
Camilla Berglundd88789e2011-09-16 04:44:40 +0200196 #else
197 #include <GL/gl.h>
198 #endif
Camilla Berglund22134502012-06-05 23:55:10 +0200199 #if defined(GLFW_INCLUDE_GLU)
Camilla Berglundd88789e2011-09-16 04:44:40 +0200200 #include <GL/glu.h>
201 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200202#endif
203
204
205/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100206 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200207 *************************************************************************/
208
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100209/*! @name GLFW version macros
210 * @{ */
211/*! @brief The major version number of the GLFW library.
212 *
213 * This is incremented when the API is changed in non-compatible ways.
214 * @ingroup init
215 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100216#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100217/*! @brief The minor version number of the GLFW library.
218 *
219 * This is incremented when features are added to the API but it remains
220 * backward-compatible.
221 * @ingroup init
222 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100223#define GLFW_VERSION_MINOR 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100224/*! @brief The revision number of the GLFW library.
225 *
226 * This is incremented when a bug fix release is made that does not contain any
227 * API changes.
228 * @ingroup init
229 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100230#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100231/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200232
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100233/*! @name Key and button actions
234 * @{ */
235/*! @brief The key or button was released.
236 * @ingroup input
237 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100238#define GLFW_RELEASE 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100239/*! @brief The key or button was pressed.
240 * @ingroup input
241 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100242#define GLFW_PRESS 1
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100243/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200244
Marcusc0cb4c22011-01-02 11:18:14 +0100245/* Keyboard raw key codes.
246 * These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60),
247 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
248 * put in the 256+ range).
249 * The naming of the key codes follow these rules:
250 * - The US keyboard layout is used.
251 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
252 * "3", etc).
253 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
254 * "COMMA", "LEFT_SQUARE_BRACKET", etc). Note that some names do not
255 * correspond to the Unicode standard (usually for brevity).
256 * - Keys that lack a clear US mapping are named "WORLD_x".
257 * - For non-printable keys, custom names are used (e.g. "F4",
258 * "BACKSPACE", etc).
Camilla Berglund3249f812010-09-07 17:34:51 +0200259 */
Marcusc0cb4c22011-01-02 11:18:14 +0100260
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100261/*! @defgroup keys Keyboard keys
262 * @ingroup input
263 * @{
264 */
265
Marcusc0cb4c22011-01-02 11:18:14 +0100266/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100267#define GLFW_KEY_SPACE 32
268#define GLFW_KEY_APOSTROPHE 39 /* ' */
269#define GLFW_KEY_COMMA 44 /* , */
270#define GLFW_KEY_MINUS 45 /* - */
271#define GLFW_KEY_PERIOD 46 /* . */
272#define GLFW_KEY_SLASH 47 /* / */
273#define GLFW_KEY_0 48
274#define GLFW_KEY_1 49
275#define GLFW_KEY_2 50
276#define GLFW_KEY_3 51
277#define GLFW_KEY_4 52
278#define GLFW_KEY_5 53
279#define GLFW_KEY_6 54
280#define GLFW_KEY_7 55
281#define GLFW_KEY_8 56
282#define GLFW_KEY_9 57
283#define GLFW_KEY_SEMICOLON 59 /* ; */
284#define GLFW_KEY_EQUAL 61 /* = */
285#define GLFW_KEY_A 65
286#define GLFW_KEY_B 66
287#define GLFW_KEY_C 67
288#define GLFW_KEY_D 68
289#define GLFW_KEY_E 69
290#define GLFW_KEY_F 70
291#define GLFW_KEY_G 71
292#define GLFW_KEY_H 72
293#define GLFW_KEY_I 73
294#define GLFW_KEY_J 74
295#define GLFW_KEY_K 75
296#define GLFW_KEY_L 76
297#define GLFW_KEY_M 77
298#define GLFW_KEY_N 78
299#define GLFW_KEY_O 79
300#define GLFW_KEY_P 80
301#define GLFW_KEY_Q 81
302#define GLFW_KEY_R 82
303#define GLFW_KEY_S 83
304#define GLFW_KEY_T 84
305#define GLFW_KEY_U 85
306#define GLFW_KEY_V 86
307#define GLFW_KEY_W 87
308#define GLFW_KEY_X 88
309#define GLFW_KEY_Y 89
310#define GLFW_KEY_Z 90
311#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
312#define GLFW_KEY_BACKSLASH 92 /* \ */
313#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
314#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
315#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
316#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100317
318/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100319#define GLFW_KEY_ESCAPE 256
320#define GLFW_KEY_ENTER 257
321#define GLFW_KEY_TAB 258
322#define GLFW_KEY_BACKSPACE 259
323#define GLFW_KEY_INSERT 260
324#define GLFW_KEY_DELETE 261
325#define GLFW_KEY_RIGHT 262
326#define GLFW_KEY_LEFT 263
327#define GLFW_KEY_DOWN 264
328#define GLFW_KEY_UP 265
329#define GLFW_KEY_PAGE_UP 266
330#define GLFW_KEY_PAGE_DOWN 267
331#define GLFW_KEY_HOME 268
332#define GLFW_KEY_END 269
333#define GLFW_KEY_CAPS_LOCK 280
334#define GLFW_KEY_SCROLL_LOCK 281
335#define GLFW_KEY_NUM_LOCK 282
336#define GLFW_KEY_PRINT_SCREEN 283
337#define GLFW_KEY_PAUSE 284
338#define GLFW_KEY_F1 290
339#define GLFW_KEY_F2 291
340#define GLFW_KEY_F3 292
341#define GLFW_KEY_F4 293
342#define GLFW_KEY_F5 294
343#define GLFW_KEY_F6 295
344#define GLFW_KEY_F7 296
345#define GLFW_KEY_F8 297
346#define GLFW_KEY_F9 298
347#define GLFW_KEY_F10 299
348#define GLFW_KEY_F11 300
349#define GLFW_KEY_F12 301
350#define GLFW_KEY_F13 302
351#define GLFW_KEY_F14 303
352#define GLFW_KEY_F15 304
353#define GLFW_KEY_F16 305
354#define GLFW_KEY_F17 306
355#define GLFW_KEY_F18 307
356#define GLFW_KEY_F19 308
357#define GLFW_KEY_F20 309
358#define GLFW_KEY_F21 310
359#define GLFW_KEY_F22 311
360#define GLFW_KEY_F23 312
361#define GLFW_KEY_F24 313
362#define GLFW_KEY_F25 314
363#define GLFW_KEY_KP_0 320
364#define GLFW_KEY_KP_1 321
365#define GLFW_KEY_KP_2 322
366#define GLFW_KEY_KP_3 323
367#define GLFW_KEY_KP_4 324
368#define GLFW_KEY_KP_5 325
369#define GLFW_KEY_KP_6 326
370#define GLFW_KEY_KP_7 327
371#define GLFW_KEY_KP_8 328
372#define GLFW_KEY_KP_9 329
373#define GLFW_KEY_KP_DECIMAL 330
374#define GLFW_KEY_KP_DIVIDE 331
375#define GLFW_KEY_KP_MULTIPLY 332
376#define GLFW_KEY_KP_SUBTRACT 333
377#define GLFW_KEY_KP_ADD 334
378#define GLFW_KEY_KP_ENTER 335
379#define GLFW_KEY_KP_EQUAL 336
380#define GLFW_KEY_LEFT_SHIFT 340
381#define GLFW_KEY_LEFT_CONTROL 341
382#define GLFW_KEY_LEFT_ALT 342
383#define GLFW_KEY_LEFT_SUPER 343
384#define GLFW_KEY_RIGHT_SHIFT 344
385#define GLFW_KEY_RIGHT_CONTROL 345
386#define GLFW_KEY_RIGHT_ALT 346
387#define GLFW_KEY_RIGHT_SUPER 347
388#define GLFW_KEY_MENU 348
389#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100390
391/* GLFW 2.x key name aliases (deprecated) */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100392#define GLFW_KEY_ESC GLFW_KEY_ESCAPE
393#define GLFW_KEY_DEL GLFW_KEY_DELETE
394#define GLFW_KEY_PAGEUP GLFW_KEY_PAGE_UP
395#define GLFW_KEY_PAGEDOWN GLFW_KEY_PAGE_DOWN
396#define GLFW_KEY_KP_NUM_LOCK GLFW_KEY_NUM_LOCK
397#define GLFW_KEY_LCTRL GLFW_KEY_LEFT_CONTROL
398#define GLFW_KEY_LSHIFT GLFW_KEY_LEFT_SHIFT
399#define GLFW_KEY_LALT GLFW_KEY_LEFT_ALT
400#define GLFW_KEY_LSUPER GLFW_KEY_LEFT_SUPER
401#define GLFW_KEY_RCTRL GLFW_KEY_RIGHT_CONTROL
402#define GLFW_KEY_RSHIFT GLFW_KEY_RIGHT_SHIFT
403#define GLFW_KEY_RALT GLFW_KEY_RIGHT_ALT
404#define GLFW_KEY_RSUPER GLFW_KEY_RIGHT_SUPER
Camilla Berglund3249f812010-09-07 17:34:51 +0200405
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100406/*! @} */
407
408/*! @defgroup buttons Mouse buttons
409 * @ingroup input
410 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100411#define GLFW_MOUSE_BUTTON_1 0
412#define GLFW_MOUSE_BUTTON_2 1
413#define GLFW_MOUSE_BUTTON_3 2
414#define GLFW_MOUSE_BUTTON_4 3
415#define GLFW_MOUSE_BUTTON_5 4
416#define GLFW_MOUSE_BUTTON_6 5
417#define GLFW_MOUSE_BUTTON_7 6
418#define GLFW_MOUSE_BUTTON_8 7
419#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
420#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
421#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
422#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100423/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200424
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100425/*! @defgroup joysticks Joysticks
426 * @ingroup input
427 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100428#define GLFW_JOYSTICK_1 0
429#define GLFW_JOYSTICK_2 1
430#define GLFW_JOYSTICK_3 2
431#define GLFW_JOYSTICK_4 3
432#define GLFW_JOYSTICK_5 4
433#define GLFW_JOYSTICK_6 5
434#define GLFW_JOYSTICK_7 6
435#define GLFW_JOYSTICK_8 7
436#define GLFW_JOYSTICK_9 8
437#define GLFW_JOYSTICK_10 9
438#define GLFW_JOYSTICK_11 10
439#define GLFW_JOYSTICK_12 11
440#define GLFW_JOYSTICK_13 12
441#define GLFW_JOYSTICK_14 13
442#define GLFW_JOYSTICK_15 14
443#define GLFW_JOYSTICK_16 15
444#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100445/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200446
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100447/*! @defgroup errors Error codes
448 * @ingroup error
449 * @{ */
450/*! @brief No error has occurred.
451 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100452#define GLFW_NO_ERROR 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100453/*! @brief GLFW has not been initialized.
454 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100455#define GLFW_NOT_INITIALIZED 0x00070001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100456/*! @brief No context is current for this thread.
457 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100458#define GLFW_NO_CURRENT_CONTEXT 0x00070002
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100459/*! @brief One of the enum parameters for the function was given an invalid
460 * enum.
461 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100462#define GLFW_INVALID_ENUM 0x00070003
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100463/*! @brief One of the parameters for the function was given an invalid value.
464 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100465#define GLFW_INVALID_VALUE 0x00070004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100466/*! @brief A memory allocation failed.
467 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100468#define GLFW_OUT_OF_MEMORY 0x00070005
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100469/*! @brief GLFW could not find support for the requested client API on the
470 * system.
471 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100472#define GLFW_API_UNAVAILABLE 0x00070006
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100473/*! @brief The requested client API version is not available.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100474 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100475#define GLFW_VERSION_UNAVAILABLE 0x00070007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100476/*! @brief A platform-specific error occurred that does not match any of the
477 * more specific categories.
478 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100479#define GLFW_PLATFORM_ERROR 0x00070008
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100480/*! @brief The clipboard did not contain data in the requested format.
481 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100482#define GLFW_FORMAT_UNAVAILABLE 0x00070009
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100483/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200484
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100485#define GLFW_FOCUSED 0x00020001
486#define GLFW_ICONIFIED 0x00020002
487#define GLFW_SHOULD_CLOSE 0x00020003
488#define GLFW_RESIZABLE 0x00022007
489#define GLFW_VISIBLE 0x00022008
490#define GLFW_POSITION_X 0x00022009
491#define GLFW_POSITION_Y 0x0002200A
Camilla Berglund2c091572010-09-09 21:09:11 +0200492
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100493#define GLFW_CONTEXT_REVISION 0x00020004
494#define GLFW_RED_BITS 0x00021000
495#define GLFW_GREEN_BITS 0x00021001
496#define GLFW_BLUE_BITS 0x00021002
497#define GLFW_ALPHA_BITS 0x00021003
498#define GLFW_DEPTH_BITS 0x00021004
499#define GLFW_STENCIL_BITS 0x00021005
500#define GLFW_ACCUM_RED_BITS 0x00021006
501#define GLFW_ACCUM_GREEN_BITS 0x00021007
502#define GLFW_ACCUM_BLUE_BITS 0x00021008
503#define GLFW_ACCUM_ALPHA_BITS 0x00021009
504#define GLFW_AUX_BUFFERS 0x0002100A
505#define GLFW_STEREO 0x0002100B
506#define GLFW_SAMPLES 0x0002100C
507#define GLFW_SRGB_CAPABLE 0x0002100D
Camilla Berglunddeb0b3d2012-12-02 21:00:15 +0100508
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100509#define GLFW_CLIENT_API 0x00022000
510#define GLFW_CONTEXT_VERSION_MAJOR 0x00022001
511#define GLFW_CONTEXT_VERSION_MINOR 0x00022002
512#define GLFW_CONTEXT_ROBUSTNESS 0x00022003
513#define GLFW_OPENGL_FORWARD_COMPAT 0x00022004
514#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022005
515#define GLFW_OPENGL_PROFILE 0x00022006
516
517#define GLFW_OPENGL_API 0x00000001
518#define GLFW_OPENGL_ES_API 0x00000002
519
520#define GLFW_NO_ROBUSTNESS 0x00000000
521#define GLFW_NO_RESET_NOTIFICATION 0x00000001
522#define GLFW_LOSE_CONTEXT_ON_RESET 0x00000002
523
524#define GLFW_OPENGL_NO_PROFILE 0x00000000
525#define GLFW_OPENGL_CORE_PROFILE 0x00000001
526#define GLFW_OPENGL_COMPAT_PROFILE 0x00000002
527
528#define GLFW_CURSOR_MODE 0x00030001
529#define GLFW_STICKY_KEYS 0x00030002
530#define GLFW_STICKY_MOUSE_BUTTONS 0x00030003
531
532#define GLFW_CURSOR_NORMAL 0x00040001
533#define GLFW_CURSOR_HIDDEN 0x00040002
534#define GLFW_CURSOR_CAPTURED 0x00040003
535
536#define GLFW_PRESENT 0x00050001
537#define GLFW_AXES 0x00050002
538#define GLFW_BUTTONS 0x00050003
539
540#define GLFW_GAMMA_RAMP_SIZE 256
541
542#define GLFW_MONITOR_WIDTH_MM 0x00060001
543#define GLFW_MONITOR_HEIGHT_MM 0x00060002
Camilla Berglundac5fee42013-01-17 21:56:02 +0100544/* reuse GLFW_POSITION_X */
545/* reuse GLFW_POSITION_Y */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100546
547#define GLFW_CONNECTED 0x00061000
548#define GLFW_DISCONNECTED 0x00061001
549
Camilla Berglund97387282011-10-06 23:28:56 +0200550
Camilla Berglund3249f812010-09-07 17:34:51 +0200551/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100552 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200553 *************************************************************************/
554
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100555/*! @brief Client API function pointer type.
556 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100557 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200558typedef void (*GLFWglproc)(void);
559
Camilla Berglunddba2d802013-01-17 23:06:56 +0100560/*! @brief Opaque monitor object.
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100561 * @ingroup monitor
562 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100563typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200564
Camilla Berglunddba2d802013-01-17 23:06:56 +0100565/*! @brief Opaque window object.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100566 * @ingroup window
567 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100568typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200569
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100570/*! @brief The function signature for error callbacks.
571 * @param[in] error An @link errors error code @endlink.
572 * @param[in] description A UTF-8 encoded string describing the error.
573 * @ingroup error
Camilla Berglunddba2d802013-01-17 23:06:56 +0100574 *
575 * @sa glfwSetErrorCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100576 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100577typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100578
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100579/*! @brief The function signature for window position callbacks.
580 * @param[in] window The window that the user moved.
581 * @param[in] x The new x-coordinate, in pixels, of the upper-left corner of
582 * the client area of the window.
583 * @param[in] y The new y-coordinate, in pixels, of the upper-left corner of
584 * the client area of the window.
585 * @ingroup window
Camilla Berglunddba2d802013-01-17 23:06:56 +0100586 *
587 * @sa glfwSetWindowPosCallback
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100588 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100589typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100590
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100591/*! @brief The function signature for window resize callbacks.
592 * @param[in] window The window that the user resized.
593 * @param[in] width The new width, in pixels, of the window.
594 * @param[in] height The new height, in pixels, of the window.
595 * @ingroup window
Camilla Berglunddba2d802013-01-17 23:06:56 +0100596 *
597 * @sa glfwSetWindowSizeCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100598 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100599typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100600
601/*! @brief The function signature for window close callbacks.
602 * @param[in] window The window that the user attempted to close.
603 * @return @c GL_TRUE to allow the window to be closed, or @c GL_FALSE to
604 * ignore the attempt.
605 * @ingroup window
Camilla Berglunddba2d802013-01-17 23:06:56 +0100606 *
607 * @sa glfwSetWindowCloseCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100608 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100609typedef int (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100610
611/*! @brief The function signature for window content refresh callbacks.
612 * @param[in] window The window whose content needs to be refreshed.
613 * @ingroup window
Camilla Berglunddba2d802013-01-17 23:06:56 +0100614 *
615 * @sa glfwSetWindowRefreshCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100616 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100617typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100618
619/*! @brief The function signature for window focus/defocus callbacks.
620 * @param[in] window The window that was focused or defocused.
621 * @param[in] focused @c GL_TRUE if the window was focused, or @c GL_FALSE if
622 * it was defocused.
623 * @ingroup window
Camilla Berglunddba2d802013-01-17 23:06:56 +0100624 *
625 * @sa glfwSetWindowFocusCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100626 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100627typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100628
Camilla Berglund06e7a962012-11-22 19:14:27 +0100629/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100630 * @param[in] window The window that was iconified or restored.
631 * @param[in] iconified @c GL_TRUE if the window was iconified, or @c GL_FALSE
632 * if it was restored.
633 * @ingroup window
Camilla Berglunddba2d802013-01-17 23:06:56 +0100634 *
635 * @sa glfwSetWindowIconifyCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100636 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100637typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100638
639/*! @brief The function signature for mouse button callbacks.
640 * @param[in] window The window that received the event.
641 * @param[in] button The @link buttons mouse button @endlink that was pressed
642 * or released.
Camilla Berglund9492fc52013-01-17 17:51:12 +0100643 * @param[in] action One of @ref GLFW_PRESS or @ref GLFW_RELEASE.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100644 * @ingroup input
Camilla Berglunddba2d802013-01-17 23:06:56 +0100645 *
646 * @sa glfwSetMouseButtonCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100647 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100648typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100649
650/*! @brief The function signature for cursor position callbacks.
651 * @param[in] window The window that received the event.
652 * @param[in] x The new x-coordinate of the cursor.
653 * @param[in] y The new y-coordinate of the cursor.
654 * @ingroup input
Camilla Berglunddba2d802013-01-17 23:06:56 +0100655 *
656 * @sa glfwSetCursorPosCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100657 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100658typedef void (* GLFWcursorposfun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100659
660/*! @brief The function signature for cursor enter/exit callbacks.
661 * @param[in] window The window that received the event.
662 * @param[in] entered @c GL_TRUE if the cursor entered the window's client
663 * area, or @c GL_FALSE if it left it.
664 * @ingroup input
Camilla Berglunddba2d802013-01-17 23:06:56 +0100665 *
666 * @sa glfwSetCursorEnterCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100667 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100668typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100669
670/*! @brief The function signature for scroll callbacks.
671 * @param[in] window The window that received the event.
672 * @param[in] x The scroll offset along the x-axis.
673 * @param[in] y The scroll offset along the y-axis.
674 * @ingroup input
Camilla Berglunddba2d802013-01-17 23:06:56 +0100675 *
676 * @sa glfwSetScrollCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100677 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100678typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100679
680/*! @brief The function signature for keyboard key callbacks.
681 * @param[in] window The window that received the event.
682 * @param[in] key The @link keys keyboard key @endlink that was pressed or
683 * released.
Camilla Berglund9492fc52013-01-17 17:51:12 +0100684 * @param[in] action One of @ref GLFW_PRESS or @ref GLFW_RELEASE.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100685 * @ingroup input
Camilla Berglunddba2d802013-01-17 23:06:56 +0100686 *
687 * @sa glfwSetKeyCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100688 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100689typedef void (* GLFWkeyfun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100690
691/*! @brief The function signature for Unicode character callbacks.
692 * @param[in] window The window that received the event.
693 * @param[in] character The Unicode code point of the character.
694 * @ingroup input
Camilla Berglunddba2d802013-01-17 23:06:56 +0100695 *
696 * @sa glfwSetCharCallback
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100697 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100698typedef void (* GLFWcharfun)(GLFWwindow*,int);
Camilla Berglund5f68e122012-11-27 17:07:28 +0100699
700/*! @brief The function signature for monitor configuration callbacks.
701 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund9492fc52013-01-17 17:51:12 +0100702 * @param[in] event One of @ref GLFW_CONNECTED or @ref GLFW_DISCONNECTED.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100703 * @ingroup monitor
704 *
705 * @sa glfwSetMonitorCallback
Camilla Berglund5f68e122012-11-27 17:07:28 +0100706 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100707typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +0100708
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100709/* @brief Video mode type.
710 * @ingroup monitor
711 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200712typedef struct
713{
714 int width;
715 int height;
716 int redBits;
717 int blueBits;
718 int greenBits;
Camilla Berglund3249f812010-09-07 17:34:51 +0200719} GLFWvidmode;
720
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100721/*! @brief Gamma ramp.
722 * @ingroup gamma
723 */
Camilla Berglund2630d492010-10-13 04:04:43 +0200724typedef struct
725{
726 unsigned short red[GLFW_GAMMA_RAMP_SIZE];
727 unsigned short green[GLFW_GAMMA_RAMP_SIZE];
728 unsigned short blue[GLFW_GAMMA_RAMP_SIZE];
729} GLFWgammaramp;
730
Camilla Berglund3249f812010-09-07 17:34:51 +0200731
732/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100733 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +0200734 *************************************************************************/
735
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100736/*! @brief Initializes the GLFW library.
737 *
738 * Before most GLFW functions can be used, GLFW must be initialized, and before
739 * a program terminates GLFW should be terminated in order to free allocated
740 * resources, memory, etc.
741 *
742 * @return @c GL_TRUE if successful, or @c GL_FALSE if an error occurred.
743 * @ingroup init
744 *
745 * @remarks Additional calls to this function after successful initialization
746 * but before termination will succeed but will do nothing.
747 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +0100748 * @note This function may only be called from the main thread.
749 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100750 * @note This function may take several seconds to complete on some systems,
751 * while on other systems it may take only a fraction of a second to complete.
752 *
Camilla Berglund1bd59842013-01-13 21:28:18 +0100753 * @note <b>Mac OS X:</b> This function will change the current directory of the
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100754 * application to the @c Contents/Resources subdirectory of the application's
755 * bundle, if present.
756 *
757 * @sa glfwTerminate
758 */
759GLFWAPI int glfwInit(void);
760
761/*! @brief Terminates the GLFW library.
762 * @ingroup init
763 *
764 * @remarks This function may be called before @ref glfwInit.
765 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +0100766 * @note This function may only be called from the main thread.
767 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100768 * @note This function closes all GLFW windows.
769 *
770 * @note This function should be called before the program exits.
771 *
772 * @warning No window's context may be current on another thread when this
773 * function is called.
774 *
775 * @sa glfwInit
776 */
Camilla Berglund9a716692010-09-08 16:40:43 +0200777GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100778
779/*! @brief Retrieves the version of the GLFW library.
780 * @param[out] major Where to store the major version number, or @c NULL.
781 * @param[out] minor Where to store the minor version number, or @c NULL.
782 * @param[out] rev Where to store the revision number, or @c NULL.
783 * @ingroup init
784 *
785 * @remarks This function may be called before @ref glfwInit.
786 *
787 * @remarks This function may be called from secondary threads.
788 *
789 * @sa glfwGetVersionString
790 */
Camilla Berglund9a716692010-09-08 16:40:43 +0200791GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100792
793/*! @brief Returns the version string of the GLFW library.
794 *
795 * The version string contains information about what compile-time options were
796 * enabled when the library was built.
797 *
798 * @return The GLFW version string.
799 * @ingroup init
800 *
801 * @remarks This function may be called before @ref glfwInit.
802 *
803 * @remarks This function may be called from secondary threads.
804 *
805 * @sa glfwGetVersion
806 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +0200807GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +0200808
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100809/*! @brief Sets the error callback.
810 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
811 * callback.
812 * @ingroup error
813 *
814 * @remarks This function may be called before @ref glfwInit.
815 *
Camilla Berglund9bfb9252013-01-07 17:22:02 +0100816 * @note The error callback is called by the thread where the error was
817 * generated. If you are using GLFW from multiple threads, your error callback
818 * needs to be written accordingly.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100819 *
820 * @note Because the description string provided to the callback may have been
821 * generated specifically for that error, it is not guaranteed to be valid
822 * after the callback has returned. If you wish to use it after that, you need
823 * to make your own copy of it before returning.
824 */
Camilla Berglundf1e7d7c2010-11-23 17:45:23 +0100825GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +0200826
Camilla Berglund5f68e122012-11-27 17:07:28 +0100827/*! @brief Returns the currently connected monitors.
828 * @param[out] count The size of the returned array.
829 * @return An array of monitor handles.
830 * @ingroup monitor
Camilla Berglunddba2d802013-01-17 23:06:56 +0100831 *
832 * @sa glfwGetPrimaryMonitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100833 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100834GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100835
Camilla Berglund5f68e122012-11-27 17:07:28 +0100836/*! @brief Returns the primary monitor.
837 * @return The primary monitor.
838 * @ingroup monitor
Camilla Berglunddba2d802013-01-17 23:06:56 +0100839 *
840 * @sa glfwGetMonitors
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100841 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100842GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100843
Camilla Berglund5f68e122012-11-27 17:07:28 +0100844/*! @brief Returns a property of the specified monitor.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100845 * @param[in] monitor The monitor to query.
846 * @param[in] param The property whose value to return.
847 * @return The value of the property, or zero if an error occurred.
Camilla Berglund5f68e122012-11-27 17:07:28 +0100848 * @ingroup monitor
Camilla Berglunddba2d802013-01-17 23:06:56 +0100849 *
850 * @par Monitor properties
851 *
852 * The @ref GLFW_MONITOR_WIDTH_MM and @ref GLFW_MONITOR_HEIGHT_MM properties
853 * indicate the physical with, in mm, of the monitor.
854 *
855 * The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y properties indiciate the
856 * position, in virtual screen coordinates, of the monitor's viewport.
857 *
858 * @sa glfwGetVideoMode, glfwGetVideoModes, glfwGetMonitorName
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100859 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100860GLFWAPI int glfwGetMonitorParam(GLFWmonitor* monitor, int param);
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100861
Camilla Berglund5f68e122012-11-27 17:07:28 +0100862/*! @brief Returns the name of the specified monitor.
863 * @param[in] monitor The monitor to query.
864 * @return The UTF-8 encoded name of the monitor.
865 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100866 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100867GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100868
Camilla Berglund5f68e122012-11-27 17:07:28 +0100869/*! @brief Sets the monitor configuration callback.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100870 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
871 * callback.
Camilla Berglund5f68e122012-11-27 17:07:28 +0100872 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100873 */
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200874GLFWAPI void glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +0200875
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100876/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund5f68e122012-11-27 17:07:28 +0100877 * @param[in] monitor The monitor to query.
878 * @param[out] count The number of video modes in the returned array.
879 * @return An array of video modes.
Camilla Berglund1e9383d2012-11-23 11:41:53 +0100880 * @ingroup monitor
Camilla Berglunddba2d802013-01-17 23:06:56 +0100881 *
882 * @sa glfwGetVideoMode
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100883 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100884GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100885
Camilla Berglund5f68e122012-11-27 17:07:28 +0100886/*! @brief Returns the current mode of the specified monitor.
887 * @param[in] monitor The monitor to query.
Camilla Berglund9492fc52013-01-17 17:51:12 +0100888 * @return The current mode of the monitor.
Camilla Berglund5f68e122012-11-27 17:07:28 +0100889 * @ingroup monitor
Camilla Berglunddba2d802013-01-17 23:06:56 +0100890 *
891 * @sa glfwGetVideoModes
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100892 */
Camilla Berglund316ee1d2013-01-05 22:07:06 +0100893GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +0200894
Camilla Berglunddba2d802013-01-17 23:06:56 +0100895/*! @brief Sets the system gamma ramp for all connected monitors to one
896 * generated from the specified exponent.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +0100897 * @param[in] gamma The desired exponent.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100898 * @ingroup gamma
Camilla Berglunddba2d802013-01-17 23:06:56 +0100899 *
900 * @remarks This is a helper function layered on top of @ref glfwSetGammaRamp.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100901 */
Camilla Berglundca0dbdb2011-09-06 15:43:31 +0200902GLFWAPI void glfwSetGamma(float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100903
904/*! @brief Retrieves the current system gamma ramp.
905 * @param[out] ramp Where to store the gamma ramp.
906 * @ingroup gamma
907 */
Camilla Berglund2630d492010-10-13 04:04:43 +0200908GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100909
Camilla Berglunddba2d802013-01-17 23:06:56 +0100910/*! @brief Sets the system gamma ramp for all connected monitors to the one
911 * specified.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100912 * @param[in] ramp The gamma ramp to use.
913 * @ingroup gamma
914 */
Camilla Berglund2630d492010-10-13 04:04:43 +0200915GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp);
916
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100917/*! @brief Resets all window hints to their default values
918 *
919 * The @ref GLFW_RED_BITS, @ref GLFW_GREEN_BITS, @ref GLFW_BLUE_BITS, @ref
920 * GLFW_ALPHA_BITS and @ref GLFW_STENCIL_BITS hints are set to 8.
921 *
922 * The @ref GLFW_DEPTH_BITS hint is set to 24.
923 *
924 * The @ref GLFW_VISIBLE and @ref GLFW_RESIZABLE hints are set to 1.
925 *
926 * The @ref GLFW_CLIENT_API hint is set to @ref GLFW_OPENGL_API.
927 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100928 * The @ref GLFW_CONTEXT_VERSION_MAJOR and @ref GLFW_CONTEXT_VERSION_MINOR
929 * hints are set to 1 and 0, respectively.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100930 *
Camilla Berglund1395ec22012-12-22 19:21:35 +0100931 * The @ref GLFW_CONTEXT_ROBUSTNESS hint is set to @ref GLFW_NO_ROBUSTNESS.
932 *
Camilla Berglunddba2d802013-01-17 23:06:56 +0100933 * The @ref GLFW_OPENGL_PROFILE hint is set to @ref GLFW_OPENGL_NO_PROFILE.
934 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100935 * All other hints are set to 0.
936 *
937 * @ingroup window
938 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +0100939 * @note This function may only be called from the main thread.
940 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100941 * @sa glfwWindowHint
942 */
Camilla Berglund5df4df62012-10-22 02:59:05 +0200943GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100944
945/*! @brief Sets the specified window hint to the desired value.
946 * @param[in] target The window hint to set.
Camilla Berglund9492fc52013-01-17 17:51:12 +0100947 * @param[in] hint The new value of the window hint.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100948 * @ingroup window
949 *
Camilla Berglunded9e4032012-12-23 15:59:09 +0100950 * This function sets hints for the next call to @ref glfwCreateWindow. The
951 * hints, once set, retain their values until changed by a call to @ref
952 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
953 * terminated with @ref glfwTerminate.
954 *
Camilla Berglundd406b482013-01-17 18:10:28 +0100955 * @par Hard and soft constraints
956 *
Camilla Berglunded9e4032012-12-23 15:59:09 +0100957 * Some window hints are hard constraints. These must match the available
958 * capabilities @em exactly for window and context creation to succeed. Hints
959 * that are not hard constraints are matched as closely as possible, but the
960 * resulting window and context may differ from what these hints requested. To
961 * find out the actual properties of the created window and context, use the
962 * @ref glfwGetWindowParam function.
963 *
964 * The following hints are hard constraints:
965 * @arg @ref GLFW_STEREO
966 * @arg @ref GLFW_CLIENT_API
967 *
968 * The following additional hints are hard constraints if requesting an OpenGL
969 * context:
970 * @arg @ref GLFW_OPENGL_FORWARD_COMPAT
971 * @arg @ref GLFW_OPENGL_PROFILE
972 *
973 * Hints that do not apply to a given type of window or context are ignored.
974 *
975 * @par Framebuffer hints
976 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100977 * The @ref GLFW_RED_BITS, @ref GLFW_GREEN_BITS, @ref GLFW_BLUE_BITS, @ref
978 * GLFW_ALPHA_BITS, @ref GLFW_DEPTH_BITS and @ref GLFW_STENCIL_BITS hints
979 * specify the desired bit depths of the various components of the default
980 * framebuffer.
981 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100982 * The @ref GLFW_ACCUM_RED_BITS, @ref GLFW_ACCUM_GREEN_BITS, @ref
983 * GLFW_ACCUM_BLUE_BITS and @ref GLFW_ACCUM_ALPHA_BITS hints specify the
984 * desired bit depths of the various components of the accumulation buffer.
985 *
986 * The @ref GLFW_AUX_BUFFERS hint specifies the desired number of auxiliary
987 * buffers.
988 *
989 * The @ref GLFW_STEREO hint specifies whether to use stereoscopic rendering.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100990 *
Camilla Berglund21f41a22012-12-31 19:45:13 +0100991 * The @ref GLFW_SAMPLES hint specifies the desired number of samples to use
992 * for multisampling.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100993 *
Camilla Berglund69a90052012-12-02 16:10:00 +0100994 * The @ref GLFW_SRGB_CAPABLE hint specifies whether the framebuffer should be
995 * sRGB capable.
996 *
Camilla Berglunded9e4032012-12-23 15:59:09 +0100997 * @par Context hints
998 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100999 * The @ref GLFW_CLIENT_API hint specifies which client API to create the
1000 * context for. Possible values are @ref GLFW_OPENGL_API and @ref
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001001 * GLFW_OPENGL_ES_API.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001002 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001003 * The @ref GLFW_CONTEXT_VERSION_MAJOR and @ref GLFW_CONTEXT_VERSION_MINOR
1004 * hints specify the client API version that the created context must be
1005 * compatible with.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001006 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001007 * For OpenGL, these hints are @em not hard constraints, as they don't have to
1008 * match exactly, but @ref glfwCreateWindow will still fail if the resulting
1009 * OpenGL version is less than the one requested. It is therefore perfectly
1010 * safe to use the default of version 1.0 for legacy code and you will still
1011 * get backwards-compatible contexts of version 3.0 and above when available.
1012 *
1013 * For OpenGL ES, these hints are hard constraints, as there is no backward
1014 * compatibility between OpenGL ES versions.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001015 *
Camilla Berglund1395ec22012-12-22 19:21:35 +01001016 * If an OpenGL context is requested, the @ref GLFW_OPENGL_FORWARD_COMPAT hint
1017 * specifies whether the OpenGL context should be forward-compatible, i.e. one
1018 * where all functionality deprecated in the requested version of OpenGL is
1019 * removed. This may only be used if the requested OpenGL version is 3.0 or
1020 * above. If another client API is requested, this hint is ignored.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001021 *
Camilla Berglund1395ec22012-12-22 19:21:35 +01001022 * If an OpenGL context is requested, the @ref GLFW_OPENGL_DEBUG_CONTEXT hint
1023 * specifies whether to create a debug OpenGL context, which may have
1024 * additional error and performance issue reporting functionality. If another
1025 * client API is requested, this hint is ignored.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001026 *
Camilla Berglund1395ec22012-12-22 19:21:35 +01001027 * If an OpenGL context is requested, the @ref GLFW_OPENGL_PROFILE hint
1028 * specifies which OpenGL profile to create the context for. Possible values
Camilla Berglunddba2d802013-01-17 23:06:56 +01001029 * are one of @ref GLFW_OPENGL_CORE_PROFILE or @ref GLFW_OPENGL_COMPAT_PROFILE,
1030 * or @ref GLFW_OPENGL_NO_PROFILE to not request a specific profile. If
1031 * requesting an OpenGL version below 3.2, @ref GLFW_OPENGL_NO_PROFILE must be
1032 * used. If another client API is requested, this hint is ignored.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001033 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001034 * The @ref GLFW_CONTEXT_ROBUSTNESS hint specifies the robustness strategy to
Camilla Berglunddba2d802013-01-17 23:06:56 +01001035 * be used by the context. This can be one of @ref GLFW_NO_RESET_NOTIFICATION
1036 * or @ref GLFW_LOSE_CONTEXT_ON_RESET, or @ref GLFW_NO_ROBUSTNESS to not
1037 * request a robustness strategy.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001038 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001039 * @par Window hints
1040 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001041 * The @ref GLFW_RESIZABLE hint specifies whether the window will be resizable
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001042 * by the user. The window will still be resizable using the @ref
1043 * glfwSetWindowSize function. This hint is ignored for fullscreen windows.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001044 *
1045 * The @ref GLFW_VISIBLE hint specifies whether the window will be initially
1046 * visible. This hint is ignored for fullscreen windows.
1047 *
1048 * The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y hints specify the initial
1049 * position of the window. These hints are ignored for fullscreen windows.
1050 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001051 * @note This function may only be called from the main thread.
1052 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001053 * @sa glfwDefaultWindowHints
1054 */
Camilla Berglundaff30d02012-08-06 17:56:41 +02001055GLFWAPI void glfwWindowHint(int target, int hint);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001056
1057/*! @brief Creates a window and its associated context.
1058 *
Camilla Berglundb8c16e42012-11-22 17:04:54 +01001059 * @param[in] width The desired width, in pixels, of the window. This must be
1060 * greater than zero.
1061 * @param[in] height The desired height, in pixels, of the window. This must
1062 * be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001063 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001064 * @param[in] monitor The monitor to use for fullscreen mode, or @c NULL to use
1065 * windowed mode.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001066 * @param[in] share The window whose context to share resources with, or @c
1067 * NULL to not share resources.
1068 * @return The handle of the created window, or @c NULL if an error occurred.
1069 * @ingroup window
1070 *
1071 * @remarks Most of the options for how the window and its context should be
1072 * created are specified via the @ref glfwWindowHint function.
1073 *
1074 * @remarks This function does not change which context is current. Before you
1075 * can use the newly created context, you need to make it current using @ref
1076 * glfwMakeContextCurrent.
1077 *
1078 * @remarks For fullscreen windows the initial cursor mode is @ref
1079 * GLFW_CURSOR_CAPTURED and the screensaver is prohibited from starting. For
1080 * regular windows the initial cursor mode is @ref GLFW_CURSOR_NORMAL and the
1081 * screensaver is allowed to start.
1082 *
1083 * @remarks In order to determine the actual properties of an opened window,
1084 * use @ref glfwGetWindowParam and @ref glfwGetWindowSize.
1085 *
Camilla Berglund1bd59842013-01-13 21:28:18 +01001086 * @remarks <b>Windows:</b> If the executable has an icon resource named @c
1087 * GLFW_ICON, it will be set as the icon for the window. If no such icon is
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001088 * present, the @c IDI_WINLOGO icon will be used instead.
1089 *
Camilla Berglund1bd59842013-01-13 21:28:18 +01001090 * @remarks <b>Mac OS X:</b> The GLFW window has no icon, as it is not
1091 * a document window, but the dock icon will be the same as the application
1092 * bundle's icon. Also, the first time a window is opened the menu bar is
1093 * populated with common commands like Hide, Quit and About. The (minimal)
1094 * about dialog uses information from the application's bundle. For more
1095 * information on bundles, see the Bundle Programming Guide provided by Apple.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001096 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001097 * @note This function may only be called from the main thread.
1098 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001099 * @sa glfwDestroyWindow
1100 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001101GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001102
1103/*! @brief Destroys the specified window and its context.
1104 * @param[in] window The window to destroy.
1105 * @ingroup window
1106 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001107 * @note This function may only be called from the main thread.
1108 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001109 * @note If the window's context is current on the main thread, it is
1110 * detached before being destroyed.
1111 *
Camilla Berglund948be592012-12-27 18:26:51 +01001112 * @note On calling this function, no further callbacks will be called for
1113 * the specified window, even if their associated events occur during window
1114 * destruction.
1115 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001116 * @warning The window's context must not be current on any other thread.
1117 *
1118 * @sa glfwCreateWindow
1119 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001120GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001121
1122/*! @brief Sets the title of the specified window.
1123 * @param[in] window The window whose title to change.
1124 * @param[in] title The UTF-8 encoded window title.
1125 * @ingroup window
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001126 *
1127 * @note This function may only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001128 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001129GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001130
1131/*! @brief Retrieves the size of the client area of the specified window.
1132 * @param[in] window The window whose size to retrieve.
1133 * @param[out] width The width of the client area.
1134 * @param[out] height The height of the client area.
1135 * @ingroup window
1136 *
1137 * @sa glfwSetWindowSize
1138 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001139GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001140
1141/*! @brief Sets the size of the client area of the specified window.
1142 * @param[in] window The window to resize.
1143 * @param[in] width The desired width of the specified window.
1144 * @param[in] height The desired height of the specified window.
1145 * @ingroup window
1146 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001147 * @note This function may only be called from the main thread.
1148 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001149 * @note The window manager may put limits on what window sizes are allowed.
1150 *
1151 * @note For fullscreen windows, this function selects and switches to the
1152 * resolution closest to the specified size, without destroying the window's
1153 * context.
1154 *
1155 * @sa glfwGetWindowSize
1156 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001157GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001158
1159/*! @brief Iconifies the specified window.
1160 * @param[in] window The window to iconify.
1161 * @ingroup window
1162 *
1163 * @remarks If the window is already iconified, this function does nothing.
1164 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001165 * @note This function may only be called from the main thread.
1166 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001167 * @sa glfwRestoreWindow
1168 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001169GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001170
1171/*! @brief Restores the specified window.
1172 * @param[in] window The window to restore.
1173 * @ingroup window
1174 *
1175 * @remarks If the window is already restored, this function does nothing.
1176 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001177 * @note This function may only be called from the main thread.
1178 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001179 * @sa glfwIconifyWindow
1180 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001181GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001182
1183/*! @brief Makes the specified window visible.
1184 * @param[in] window The window to make visible.
1185 * @ingroup window
1186 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001187 * @remarks If the window is already visible or is in fullscreen mode, this
1188 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001189 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001190 * @note This function may only be called from the main thread.
1191 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001192 * @sa glfwHideWindow
1193 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001194GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001195
1196/*! @brief Hides the specified window.
1197 * @param[in] window The window to hide.
1198 * @ingroup window
1199 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001200 * @remarks If the window is already hidden or is in fullscreen mode, this
1201 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001202 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001203 * @note This function may only be called from the main thread.
1204 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001205 * @sa glfwShowWindow
1206 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001207GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001208
Camilla Berglund5f68e122012-11-27 17:07:28 +01001209/*! @brief Returns the monitor that the window uses for fullscreen mode
1210 * @param[in] window The window to query.
1211 * @return The monitor, or @c NULL if the window is in windowed mode.
1212 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001213 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001214GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001215
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001216/*! @brief Returns a property of the specified window.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001217 * @param[in] window The window to query.
1218 * @param[in] param The property whose value to return.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001219 * @return The value of the property, or zero if an error occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001220 * @ingroup window
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001221 *
Camilla Berglund1bd59842013-01-13 21:28:18 +01001222 * @par Window properties
1223 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001224 * The @ref GLFW_FOCUSED property indicates whether the window is focused.
1225 *
1226 * The @ref GLFW_ICONIFIED property indicates whether the window is iconified.
1227 *
1228 * The @ref GLFW_VISIBLE property indicates whether the window is visible.
1229 *
1230 * The @ref GLFW_RESIZABLE property indicates whether the window is resizable
1231 * by the user.
1232 *
Camilla Berglund21f41a22012-12-31 19:45:13 +01001233 * The @ref GLFW_SHOULD_CLOSE property indicates whether the window has been
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001234 * requested by the user to close.
1235 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001236 * The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y properties indicate the
1237 * screen position, in pixels, of the upper-left corner of the window's client
1238 * area.
1239 *
Camilla Berglund1bd59842013-01-13 21:28:18 +01001240 * @par Context properties
1241 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001242 * The @ref GLFW_CLIENT_API property indicates the client API provided by the
Camilla Berglunddba2d802013-01-17 23:06:56 +01001243 * window's context; either @ref GLFW_OPENGL_API or @ref GLFW_OPENGL_ES_API.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001244 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001245 * The @ref GLFW_CONTEXT_VERSION_MAJOR, @ref GLFW_CONTEXT_VERSION_MINOR and
1246 * @ref GLFW_CONTEXT_REVISION properties indicate the client API version of the
1247 * window's context.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001248 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001249 * The @ref GLFW_OPENGL_FORWARD_COMPAT property is @c GL_TRUE if the window's
1250 * context is an OpenGL forward-compatible one, or @c GL_FALSE otherwise.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001251 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001252 * The @ref GLFW_OPENGL_DEBUG_CONTEXT property is @c GL_TRUE if the window's
1253 * context is an OpenGL debug context, or @c GL_FALSE otherwise.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001254 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001255 * The @ref GLFW_OPENGL_PROFILE property indicates the OpenGL profile used by
1256 * the context. This is @ref GLFW_OPENGL_CORE_PROFILE or @ref
1257 * GLFW_OPENGL_COMPAT_PROFILE if the context uses a known profile, or @ref
1258 * GLFW_OPENGL_NO_PROFILE if the OpenGL profile is unknown or the context is
1259 * for another client API.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001260 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001261 * The @ref GLFW_CONTEXT_ROBUSTNESS property indicates the robustness strategy
Camilla Berglunddba2d802013-01-17 23:06:56 +01001262 * used by the context. This is @ref GLFW_LOSE_CONTEXT_ON_RESET or @ref
1263 * GLFW_NO_RESET_NOTIFICATION if the window's context supports robustness, or
1264 * @ref GLFW_NO_ROBUSTNESS otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001265 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001266GLFWAPI int glfwGetWindowParam(GLFWwindow* window, int param);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001267
1268/*! @brief Sets the user pointer of the specified window.
1269 * @param[in] window The window whose pointer to set.
1270 * @param[in] pointer The new value.
1271 * @ingroup window
1272 *
1273 * @sa glfwGetWindowUserPointer
1274 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001275GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001276
1277/*! @brief Returns the user pointer of the specified window.
1278 * @param[in] window The window whose pointer to return.
1279 * @ingroup window
1280 *
1281 * @sa glfwSetWindowUserPointer
1282 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001283GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001284
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001285/*! @brief Sets the position callback for the specified window.
1286 * @param[in] window The window whose callback to set.
1287 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1288 * callback.
1289 * @ingroup window
1290 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001291GLFWAPI void glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001292
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001293/*! @brief Sets the size callback for the specified window.
1294 * @param[in] window The window whose callback to set.
1295 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1296 * callback.
1297 * @ingroup window
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001298 *
1299 * This callback is called when the window is resized.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001300 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001301GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001302
1303/*! @brief Sets the close callback for the specified window.
1304 * @param[in] window The window whose callback to set.
1305 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1306 * callback.
1307 * @ingroup window
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001308 *
1309 * This callback is called when the user attempts to close the window, i.e.
Camilla Berglund1bd59842013-01-13 21:28:18 +01001310 * clicks the window's close widget. Calling @ref glfwDestroyWindow does not
1311 * cause this callback to be called.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001312 *
1313 * The return value of the close callback becomes the new value of the @ref
Camilla Berglund21f41a22012-12-31 19:45:13 +01001314 * GLFW_SHOULD_CLOSE window parameter.
Camilla Berglund1bd59842013-01-13 21:28:18 +01001315 *
1316 * @remarks <b>Mac OS X:</b> Selecting Quit from the application menu will
1317 * trigger the close callback for all windows.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001318 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001319GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001320
1321/*! @brief Sets the refresh callback for the specified window.
1322 * @param[in] window The window whose callback to set.
1323 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1324 * callback.
1325 * @ingroup window
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001326 *
1327 * This callback is called when the client area of the window needs to be
1328 * redrawn, for example if the window has been exposed after having been
1329 * covered by another window.
1330 *
Camilla Berglund1bd59842013-01-13 21:28:18 +01001331 * @note On compositing window systems such as Aero, Compiz or Aqua, where the
1332 * window contents are saved off-screen, this callback may be called only very
1333 * infrequently or never at all.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001334 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001335GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001336
1337/*! @brief Sets the focus callback for the specified window.
1338 * @param[in] window The window whose callback to set.
1339 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1340 * callback.
1341 * @ingroup window
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001342 *
1343 * This callback is called when the window gains or loses focus.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001344 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001345GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001346
1347/*! @brief Sets the iconify callback for the specified window.
1348 * @param[in] window The window whose callback to set.
1349 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1350 * callback.
1351 * @ingroup window
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001352 *
1353 * This callback is called when the window is iconified or restored.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001354 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001355GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02001356
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001357/*! @brief Processes all pending events.
1358 * @ingroup window
1359 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001360 * @note This function may only be called from the main thread.
1361 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001362 * @sa glfwWaitEvents
1363 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001364GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001365
1366/*! @brief Waits until events are pending and processes them.
1367 * @ingroup window
1368 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001369 * @note This function may only be called from the main thread.
1370 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001371 * @sa glfwPollEvents
1372 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001373GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02001374
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001375/*! @brief Returns the value of an input option for the specified window.
1376 * @param[in] window The window to query.
1377 * @param[in] mode One of the following:
1378 * @arg @ref GLFW_CURSOR_MODE Sets the cursor mode.
1379 * @arg @ref GLFW_STICKY_KEYS Sets whether sticky keys are enabled.
1380 * @arg @ref GLFW_STICKY_MOUSE_BUTTONS Sets whether sticky mouse buttons are enabled.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001381 * @ingroup input
1382 *
1383 * @sa glfwSetInputMode
1384 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001385GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001386
1387/*! @brief Sets an input option for the specified window.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001388 * @param[in] window The window whose input mode to set.
1389 * @param[in] mode One of @ref GLFW_CURSOR_MODE, @ref GLFW_STICKY_KEYS or @ref
1390 * GLFW_STICKY_MOUSE_BUTTONS.
1391 * @param[in] value The new value of the specified input mode.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001392 * @ingroup input
1393 *
1394 * @sa glfwGetInputMode
1395 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001396GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001397
1398/*! @brief Returns the last reported state of a keyboard key for the specified
1399 * window.
1400 * @param[in] window The desired window.
1401 * @param[in] key The desired @link keys keyboard key @endlink.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001402 * @return One of @ref GLFW_PRESS or @ref GLFW_RELEASE.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001403 * @ingroup input
1404 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001405GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001406
1407/*! @brief Returns the last reported state of a mouse button for the specified
1408 * window.
1409 * @param[in] window The desired window.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001410 * @param[in] button The desired @link buttons mouse buttons @endlink.
1411 * @return One of @ref GLFW_PRESS or @ref GLFW_RELEASE.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001412 * @ingroup input
1413 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001414GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001415
1416/*! @brief Retrieves the last reported cursor position, relative to the client
1417 * area of the window.
1418 * @param[in] window The desired window.
1419 * @param[out] xpos The cursor x-coordinate, relative to the left edge of the
1420 * client area, or @c NULL.
1421 * @param[out] ypos The cursor y-coordinate, relative to the to top edge of the
1422 * client area, or @c NULL.
1423 * @ingroup input
1424 *
1425 * @sa glfwSetCursorPos
1426 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001427GLFWAPI void glfwGetCursorPos(GLFWwindow* window, int* xpos, int* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001428
1429/*! @brief Sets the position of the cursor, relative to the client area of the window.
1430 * @param[in] window The desired window.
1431 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
1432 * client area, or @c NULL.
1433 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
1434 * client area, or @c NULL.
1435 * @ingroup input
1436 *
Camilla Berglund14355d62012-11-22 17:04:44 +01001437 * @note The specified window must be focused.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001438 *
1439 * @sa glfwGetCursorPos
1440 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001441GLFWAPI void glfwSetCursorPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001442
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001443/*! @brief Sets the key callback.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001444 * @param[in] window The window whose callback to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001445 * @param[in] cbfun The new key callback, or @c NULL to remove the currently
1446 * set callback.
1447 * @ingroup input
1448 *
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001449 * @remarks The key callback deals with physical keys, with @link keys tokens
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001450 * @endlink named after their use on the standard US keyboard layout. If you
1451 * want to input text, use the Unicode character callback instead.
1452 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001453GLFWAPI void glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001454
1455/*! @brief Sets the Unicode character callback.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001456 * @param[in] window The window whose callback to set.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001457 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1458 * callback.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001459 * @ingroup input
1460 *
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001461 * @remarks The Unicode character callback is for text input. If you want to
1462 * know whether a specific key was pressed or released, use the key callback.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001463 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001464GLFWAPI void glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001465
1466/*! @brief Sets the mouse button callback.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001467 * @param[in] window The window whose callback to set.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001468 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1469 * callback.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001470 * @ingroup input
1471 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001472GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001473
1474/*! @brief Sets the cursor position callback.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001475 * @param[in] window The window whose callback to set.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001476 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1477 * callback.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001478 * @ingroup input
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001479 *
1480 * @remarks The position is relative to the upper-left corner of the client
1481 * area of the window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001482 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001483GLFWAPI void glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001484
1485/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001486 * @param[in] window The window whose callback to set.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001487 * @param[in] cbfun The new callback, or @c NULL to remove the currently set
1488 * callback.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001489 * @ingroup input
1490 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001491GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001492
1493/*! @brief Sets the scroll callback.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001494 * @param[in] window The window whose callback to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001495 * @param[in] cbfun The new scroll callback, or @c NULL to remove the currently
1496 * set callback.
1497 * @ingroup input
1498 *
1499 * @note This receives all scrolling input, like that from a mouse wheel or
1500 * a touchpad scrolling area.
1501 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001502GLFWAPI void glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02001503
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001504/*! @brief Returns a property of the specified joystick.
1505 * @param[in] joy The joystick to query.
1506 * @param[in] param The property whose value to return.
1507 * @return The specified joystick's current value, or zero if the joystick is
1508 * not present.
1509 * @ingroup input
1510 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001511GLFWAPI int glfwGetJoystickParam(int joy, int param);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001512
1513/*! @brief Returns the values of axes of the specified joystick.
1514 * @param[in] joy The joystick to query.
1515 * @param[out] axes The array to hold the values.
1516 * @param[in] numaxes The size of the provided array.
1517 * @return The number of values written to @p axes.
1518 * @ingroup input
1519 */
Camilla Berglund2502e4d2012-08-29 18:31:12 +02001520GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001521
1522/*! @brief Returns the values of buttons of the specified joystick.
1523 * @param[in] joy The joystick to query.
1524 * @param[out] buttons The array to hold the values.
1525 * @param[in] numbuttons The size of the provided array.
1526 * @return The number of values written to @p buttons.
1527 * @ingroup input
1528 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001529GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons);
Camilla Berglund3249f812010-09-07 17:34:51 +02001530
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01001531/*! @brief Returns the name of the specified joystick.
1532 * @param[in] joy The joystick to query.
1533 * @return The UTF-8 encoded name of the joystick, or @c NULL if the joystick
1534 * is not present.
1535 * @ingroup input
Camilla Berglundd4a08b12012-12-02 17:13:41 +01001536 *
1537 * @note The returned string is valid only until the next call to @ref
1538 * glfwGetJoystickName.
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01001539 */
Camilla Berglund93a1d1c2012-09-07 01:01:34 +02001540GLFWAPI const char* glfwGetJoystickName(int joy);
Camilla Berglund3249f812010-09-07 17:34:51 +02001541
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001542/*! @brief Sets the clipboard to the specified string.
1543 * @param[in] window The window that will own the clipboard contents.
1544 * @param[in] string A UTF-8 encoded string.
1545 * @ingroup clipboard
1546 *
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001547 * @note This function may only be called from the main thread.
1548 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001549 * @sa glfwGetClipboardString
1550 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001551GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001552
1553/*! @brief Retrieves the contents of the clipboard as a string.
1554 * @param[in] window The window that will request the clipboard contents.
1555 * @return The contents of the clipboard as a UTF-8 encoded string, or @c NULL
1556 * if that format was unavailable.
1557 * @ingroup clipboard
1558 *
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001559 * @note This function may only be called from the main thread.
1560 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001561 * @note The returned string is valid only until the next call to @ref
1562 * glfwGetClipboardString or @ref glfwSetClipboardString.
1563 *
1564 * @sa glfwSetClipboardString
1565 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001566GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01001567
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001568/*! @brief Retrieves the current value of the GLFW timer.
1569 * @return The current value, in seconds.
1570 * @ingroup time
1571 *
1572 * @remarks This function may be called from secondary threads.
1573 *
1574 * @remarks Unless the timer has been set using @ref glfwSetTime, the timer
1575 * measures time elapsed since GLFW was initialized.
1576 *
1577 * @note The resolution of the timer is system dependent.
1578 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001579GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001580
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001581/*! @brief Sets the GLFW timer.
1582 * @param[in] time The new value, in seconds.
1583 * @ingroup time
1584 *
1585 * @note The resolution of the timer is system dependent.
1586 */
1587GLFWAPI void glfwSetTime(double time);
1588
1589/*! @brief Makes the context of the specified window current for this thread.
1590 * @param[in] window The window whose context to make current, or @c NULL to
1591 * detach the current context.
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001592 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001593 *
1594 * @remarks This function may be called from secondary threads.
1595 *
1596 * @note A context may only be current for a single thread at a time.
1597 *
1598 * @sa glfwGetCurrentContext
1599 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001600GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001601
1602/*! @brief Returns the window whose context is current on this thread.
1603 * @return The window whose context is current, or @c NULL if no window's
1604 * context is current.
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001605 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001606 *
1607 * @remarks This function may be called from secondary threads.
1608 *
1609 * @sa glfwMakeContextCurrent
1610 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001611GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001612
1613/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001614 * @param[in] window The window whose buffers to swap.
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001615 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001616 *
1617 * @remarks This function may be called from secondary threads.
1618 *
1619 * @sa glfwSwapInterval
1620 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001621GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001622
1623/*! @brief Sets the swap interval for the current context.
1624 * @param[in] interval The minimum number of video frame periods to wait for
1625 * until the buffers are swapped by @ref glfwSwapBuffers.
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001626 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001627 *
1628 * @remarks This function may be called from secondary threads.
1629 *
1630 * @sa glfwSwapBuffers
1631 */
1632GLFWAPI void glfwSwapInterval(int interval);
1633
1634/*! @brief Checks whether the specified extension is available.
1635 * @param[in] extension The ASCII encoded name of the extension.
1636 * @return @c GL_TRUE if the extension is available, or @c FALSE otherwise.
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001637 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001638 *
1639 * @remarks This function may be called from secondary threads.
1640 *
1641 * @note This function checks not only the client API extension string, but
1642 * also any platform-specific context creation API extension strings.
1643 */
1644GLFWAPI int glfwExtensionSupported(const char* extension);
1645
1646/*! @brief Returns the address of the specified client API function for the
1647 * current context.
1648 * @param[in] procname The ASCII encoded name of the function.
1649 * @return The address of the function, or @c NULL if the function is
1650 * unavailable.
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001651 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001652 *
1653 * @remarks This function may be called from secondary threads.
1654 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02001655GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02001656
Camilla Berglund3249f812010-09-07 17:34:51 +02001657
Camilla Berglund4afc67c2011-07-27 17:09:17 +02001658/*************************************************************************
1659 * Global definition cleanup
1660 *************************************************************************/
1661
1662/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
1663
Camilla Berglund4afc67c2011-07-27 17:09:17 +02001664#ifdef GLFW_WINGDIAPI_DEFINED
1665 #undef WINGDIAPI
1666 #undef GLFW_WINGDIAPI_DEFINED
1667#endif
1668
1669#ifdef GLFW_CALLBACK_DEFINED
1670 #undef CALLBACK
1671 #undef GLFW_CALLBACK_DEFINED
1672#endif
1673
1674/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
1675
1676
Camilla Berglund3249f812010-09-07 17:34:51 +02001677#ifdef __cplusplus
1678}
1679#endif
1680
Camilla Berglundf8df91d2013-01-15 01:59:56 +01001681#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02001682