blob: ac19e9a7dddb8ca78d6747da45a73ba10161bad7 [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund3cfc4002013-07-29 20:53:17 +02002 * GLFW 3.0 - www.glfw.org
3 * A library for OpenGL, window and input
Camilla Berglund3249f812010-09-07 17:34:51 +02004 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
Camilla Berglundf8105ed2010-11-09 02:57:46 +01006 * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
Camilla Berglund3249f812010-09-07 17:34:51 +02007 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
Camilla Berglundf8df91d2013-01-15 01:59:56 +010029#ifndef _glfw3_h_
30#define _glfw3_h_
Camilla Berglund3249f812010-09-07 17:34:51 +020031
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
Camilla Berglundbce2cd62012-11-22 16:38:24 +010038 * Doxygen documentation
39 *************************************************************************/
40
Camilla Berglundbce2cd62012-11-22 16:38:24 +010041/*! @defgroup clipboard Clipboard support
42 */
Camilla Berglund3f5843f2012-12-13 02:22:39 +010043/*! @defgroup context Context handling
44 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010045/*! @defgroup error Error handling
46 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010047/*! @defgroup init Initialization and version information
48 */
49/*! @defgroup input Input handling
50 */
Camilla Berglund5f68e122012-11-27 17:07:28 +010051/*! @defgroup monitor Monitor handling
Camilla Berglundf5f55e32013-06-17 12:56:36 +020052 *
53 * This is the reference documentation for monitor related functions and types.
54 * For more information, see the @ref monitor.
Camilla Berglund5f68e122012-11-27 17:07:28 +010055 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010056/*! @defgroup time Time input
57 */
58/*! @defgroup window Window handling
59 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +020060 * This is the reference documentation for window related functions and types,
61 * including creation, deletion and event polling. For more information, see
62 * the @ref window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010063 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010064
65
66/*************************************************************************
Camilla Berglund3249f812010-09-07 17:34:51 +020067 * Global definitions
68 *************************************************************************/
69
Camilla Berglund3249f812010-09-07 17:34:51 +020070/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
71
Camilla Berglund06e7a962012-11-22 19:14:27 +010072/* Please report any problems that you find with your compiler, which may
Camilla Berglund3249f812010-09-07 17:34:51 +020073 * be solved in this section! There are several compilers that I have not
74 * been able to test this file with yet.
75 *
76 * First: If we are we on Windows, we want a single define for it (_WIN32)
77 * (Note: For Cygwin the compiler flag -mwin32 should be used, but to
78 * make sure that things run smoothly for Cygwin users, we add __CYGWIN__
79 * to the list of "valid Win32 identifiers", which removes the need for
80 * -mwin32)
81 */
82#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
83 #define _WIN32
84#endif /* _WIN32 */
85
86/* In order for extension support to be portable, we need to define an
87 * OpenGL function call method. We use the keyword APIENTRY, which is
88 * defined for Win32. (Note: Windows also needs this for <GL/gl.h>)
89 */
90#ifndef APIENTRY
91 #ifdef _WIN32
92 #define APIENTRY __stdcall
93 #else
94 #define APIENTRY
95 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +020096#endif /* APIENTRY */
97
Camilla Berglund3249f812010-09-07 17:34:51 +020098/* The following three defines are here solely to make some Windows-based
99 * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but
100 * it has the major drawback of severely polluting our namespace.
101 */
102
103/* Under Windows, we need WINGDIAPI defined */
104#if !defined(WINGDIAPI) && defined(_WIN32)
105 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
106 /* Microsoft Visual C++, Borland C++ Builder and Pelles C */
107 #define WINGDIAPI __declspec(dllimport)
108 #elif defined(__LCC__)
109 /* LCC-Win32 */
110 #define WINGDIAPI __stdcall
111 #else
112 /* Others (e.g. MinGW, Cygwin) */
113 #define WINGDIAPI extern
114 #endif
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200115 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200116#endif /* WINGDIAPI */
117
118/* Some <GL/glu.h> files also need CALLBACK defined */
119#if !defined(CALLBACK) && defined(_WIN32)
120 #if defined(_MSC_VER)
121 /* Microsoft Visual C++ */
122 #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
123 #define CALLBACK __stdcall
124 #else
125 #define CALLBACK
126 #endif
127 #else
128 /* Other Windows compilers */
129 #define CALLBACK __stdcall
130 #endif
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200131 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200132#endif /* CALLBACK */
133
Camilla Berglundbea59f62013-07-23 00:20:23 +0200134/* Most GL/glu.h variants on Windows need wchar_t
135 * OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */
Camilla Berglundc93b1202013-09-08 16:07:34 +0200136#if !defined(GLFW_INCLUDE_NONE)
137 #include <stddef.h>
138#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200139
Camilla Berglundc93b1202013-09-08 16:07:34 +0200140/* Include the chosen client API headers.
141 */
142#if defined(__APPLE_CC__)
143 #if defined(GLFW_INCLUDE_GLCOREARB)
144 #include <OpenGL/gl3.h>
145 #elif !defined(GLFW_INCLUDE_NONE)
146 #define GL_GLEXT_LEGACY
147 #include <OpenGL/gl.h>
148 #endif
149 #if defined(GLFW_INCLUDE_GLU)
150 #include <OpenGL/glu.h>
151 #endif
152#else
153 #if defined(GLFW_INCLUDE_GLCOREARB)
154 #include <GL/glcorearb.h>
155 #elif defined(GLFW_INCLUDE_ES1)
156 #include <GLES/gl.h>
157 #elif defined(GLFW_INCLUDE_ES2)
158 #include <GLES2/gl2.h>
159 #elif defined(GLFW_INCLUDE_ES3)
160 #include <GLES3/gl3.h>
161 #elif !defined(GLFW_INCLUDE_NONE)
162 #include <GL/gl.h>
163 #endif
164 #if defined(GLFW_INCLUDE_GLU)
165 #include <GL/glu.h>
166 #endif
167#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200168
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200169#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200170 /* GLFW_DLL is defined by users of GLFW when compiling programs that will link
171 * to the DLL version of the GLFW library. _GLFW_BUILD_DLL is defined by the
172 * GLFW configuration header when compiling the DLL version of the library.
173 */
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200174 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
175#endif
176
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200177#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3249f812010-09-07 17:34:51 +0200178
179 /* We are building a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100180 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200181
182#elif defined(_WIN32) && defined(GLFW_DLL)
183
184 /* We are calling a Win32 DLL */
185 #if defined(__LCC__)
Camilla Berglund2955cd32010-11-17 15:42:55 +0100186 #define GLFWAPI extern
Camilla Berglund3249f812010-09-07 17:34:51 +0200187 #else
Camilla Berglund2955cd32010-11-17 15:42:55 +0100188 #define GLFWAPI __declspec(dllimport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200189 #endif
190
John Bartholomew93f4eff2013-05-01 13:08:09 +0100191#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
192
193 #define GLFWAPI __attribute__((visibility("default")))
194
Camilla Berglund3249f812010-09-07 17:34:51 +0200195#else
196
197 /* We are either building/calling a static lib or we are non-win32 */
198 #define GLFWAPI
199
200#endif
201
202/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
203
Camilla Berglund3249f812010-09-07 17:34:51 +0200204
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 Berglund59422ec2013-09-24 21:35:37 +0200230#define GLFW_VERSION_REVISION 4
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 Berglund253e0d62013-01-12 17:06:35 +0100243/*! @brief The key was held down until it repeated.
244 * @ingroup input
245 */
246#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100247/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200248
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200249/*! @defgroup keys Keyboard keys
250 *
251 * These key codes are inspired by the *USB HID Usage Tables v1.12* (p. 53-60),
Marcusc0cb4c22011-01-02 11:18:14 +0100252 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
253 * put in the 256+ range).
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200254 *
Marcusc0cb4c22011-01-02 11:18:14 +0100255 * The naming of the key codes follow these rules:
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200256 * - The US keyboard layout is used
Marcusc0cb4c22011-01-02 11:18:14 +0100257 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200258 * "3", etc.)
Marcusc0cb4c22011-01-02 11:18:14 +0100259 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200260 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
261 * correspond to the Unicode standard (usually for brevity)
262 * - Keys that lack a clear US mapping are named "WORLD_x"
Marcusc0cb4c22011-01-02 11:18:14 +0100263 * - For non-printable keys, custom names are used (e.g. "F4",
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200264 * "BACKSPACE", etc.)
265 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100266 * @ingroup input
267 * @{
268 */
269
Camilla Berglund11615fc2013-05-30 17:19:12 +0200270/* The unknown key */
271#define GLFW_KEY_UNKNOWN -1
272
Marcusc0cb4c22011-01-02 11:18:14 +0100273/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100274#define GLFW_KEY_SPACE 32
275#define GLFW_KEY_APOSTROPHE 39 /* ' */
276#define GLFW_KEY_COMMA 44 /* , */
277#define GLFW_KEY_MINUS 45 /* - */
278#define GLFW_KEY_PERIOD 46 /* . */
279#define GLFW_KEY_SLASH 47 /* / */
280#define GLFW_KEY_0 48
281#define GLFW_KEY_1 49
282#define GLFW_KEY_2 50
283#define GLFW_KEY_3 51
284#define GLFW_KEY_4 52
285#define GLFW_KEY_5 53
286#define GLFW_KEY_6 54
287#define GLFW_KEY_7 55
288#define GLFW_KEY_8 56
289#define GLFW_KEY_9 57
290#define GLFW_KEY_SEMICOLON 59 /* ; */
291#define GLFW_KEY_EQUAL 61 /* = */
292#define GLFW_KEY_A 65
293#define GLFW_KEY_B 66
294#define GLFW_KEY_C 67
295#define GLFW_KEY_D 68
296#define GLFW_KEY_E 69
297#define GLFW_KEY_F 70
298#define GLFW_KEY_G 71
299#define GLFW_KEY_H 72
300#define GLFW_KEY_I 73
301#define GLFW_KEY_J 74
302#define GLFW_KEY_K 75
303#define GLFW_KEY_L 76
304#define GLFW_KEY_M 77
305#define GLFW_KEY_N 78
306#define GLFW_KEY_O 79
307#define GLFW_KEY_P 80
308#define GLFW_KEY_Q 81
309#define GLFW_KEY_R 82
310#define GLFW_KEY_S 83
311#define GLFW_KEY_T 84
312#define GLFW_KEY_U 85
313#define GLFW_KEY_V 86
314#define GLFW_KEY_W 87
315#define GLFW_KEY_X 88
316#define GLFW_KEY_Y 89
317#define GLFW_KEY_Z 90
318#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
319#define GLFW_KEY_BACKSLASH 92 /* \ */
320#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
321#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
322#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
323#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100324
325/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100326#define GLFW_KEY_ESCAPE 256
327#define GLFW_KEY_ENTER 257
328#define GLFW_KEY_TAB 258
329#define GLFW_KEY_BACKSPACE 259
330#define GLFW_KEY_INSERT 260
331#define GLFW_KEY_DELETE 261
332#define GLFW_KEY_RIGHT 262
333#define GLFW_KEY_LEFT 263
334#define GLFW_KEY_DOWN 264
335#define GLFW_KEY_UP 265
336#define GLFW_KEY_PAGE_UP 266
337#define GLFW_KEY_PAGE_DOWN 267
338#define GLFW_KEY_HOME 268
339#define GLFW_KEY_END 269
340#define GLFW_KEY_CAPS_LOCK 280
341#define GLFW_KEY_SCROLL_LOCK 281
342#define GLFW_KEY_NUM_LOCK 282
343#define GLFW_KEY_PRINT_SCREEN 283
344#define GLFW_KEY_PAUSE 284
345#define GLFW_KEY_F1 290
346#define GLFW_KEY_F2 291
347#define GLFW_KEY_F3 292
348#define GLFW_KEY_F4 293
349#define GLFW_KEY_F5 294
350#define GLFW_KEY_F6 295
351#define GLFW_KEY_F7 296
352#define GLFW_KEY_F8 297
353#define GLFW_KEY_F9 298
354#define GLFW_KEY_F10 299
355#define GLFW_KEY_F11 300
356#define GLFW_KEY_F12 301
357#define GLFW_KEY_F13 302
358#define GLFW_KEY_F14 303
359#define GLFW_KEY_F15 304
360#define GLFW_KEY_F16 305
361#define GLFW_KEY_F17 306
362#define GLFW_KEY_F18 307
363#define GLFW_KEY_F19 308
364#define GLFW_KEY_F20 309
365#define GLFW_KEY_F21 310
366#define GLFW_KEY_F22 311
367#define GLFW_KEY_F23 312
368#define GLFW_KEY_F24 313
369#define GLFW_KEY_F25 314
370#define GLFW_KEY_KP_0 320
371#define GLFW_KEY_KP_1 321
372#define GLFW_KEY_KP_2 322
373#define GLFW_KEY_KP_3 323
374#define GLFW_KEY_KP_4 324
375#define GLFW_KEY_KP_5 325
376#define GLFW_KEY_KP_6 326
377#define GLFW_KEY_KP_7 327
378#define GLFW_KEY_KP_8 328
379#define GLFW_KEY_KP_9 329
380#define GLFW_KEY_KP_DECIMAL 330
381#define GLFW_KEY_KP_DIVIDE 331
382#define GLFW_KEY_KP_MULTIPLY 332
383#define GLFW_KEY_KP_SUBTRACT 333
384#define GLFW_KEY_KP_ADD 334
385#define GLFW_KEY_KP_ENTER 335
386#define GLFW_KEY_KP_EQUAL 336
387#define GLFW_KEY_LEFT_SHIFT 340
388#define GLFW_KEY_LEFT_CONTROL 341
389#define GLFW_KEY_LEFT_ALT 342
390#define GLFW_KEY_LEFT_SUPER 343
391#define GLFW_KEY_RIGHT_SHIFT 344
392#define GLFW_KEY_RIGHT_CONTROL 345
393#define GLFW_KEY_RIGHT_ALT 346
394#define GLFW_KEY_RIGHT_SUPER 347
395#define GLFW_KEY_MENU 348
396#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100397
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100398/*! @} */
399
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200400/*! @defgroup mods Modifier key flags
401 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100402 * @{ */
403
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200404/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100405 */
406#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200407/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100408 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200409#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200410/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100411 */
412#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200413/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200414 */
415#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100416
417/*! @} */
418
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100419/*! @defgroup buttons Mouse buttons
420 * @ingroup input
421 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100422#define GLFW_MOUSE_BUTTON_1 0
423#define GLFW_MOUSE_BUTTON_2 1
424#define GLFW_MOUSE_BUTTON_3 2
425#define GLFW_MOUSE_BUTTON_4 3
426#define GLFW_MOUSE_BUTTON_5 4
427#define GLFW_MOUSE_BUTTON_6 5
428#define GLFW_MOUSE_BUTTON_7 6
429#define GLFW_MOUSE_BUTTON_8 7
430#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
431#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
432#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
433#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100434/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200435
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100436/*! @defgroup joysticks Joysticks
437 * @ingroup input
438 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100439#define GLFW_JOYSTICK_1 0
440#define GLFW_JOYSTICK_2 1
441#define GLFW_JOYSTICK_3 2
442#define GLFW_JOYSTICK_4 3
443#define GLFW_JOYSTICK_5 4
444#define GLFW_JOYSTICK_6 5
445#define GLFW_JOYSTICK_7 6
446#define GLFW_JOYSTICK_8 7
447#define GLFW_JOYSTICK_9 8
448#define GLFW_JOYSTICK_10 9
449#define GLFW_JOYSTICK_11 10
450#define GLFW_JOYSTICK_12 11
451#define GLFW_JOYSTICK_13 12
452#define GLFW_JOYSTICK_14 13
453#define GLFW_JOYSTICK_15 14
454#define GLFW_JOYSTICK_16 15
455#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100456/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200457
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100458/*! @defgroup errors Error codes
459 * @ingroup error
460 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100461/*! @brief GLFW has not been initialized.
462 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200463#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100464/*! @brief No context is current for this thread.
465 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200466#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100467/*! @brief One of the enum parameters for the function was given an invalid
468 * enum.
469 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200470#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100471/*! @brief One of the parameters for the function was given an invalid value.
472 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200473#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100474/*! @brief A memory allocation failed.
475 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200476#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100477/*! @brief GLFW could not find support for the requested client API on the
478 * system.
479 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200480#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100481/*! @brief The requested client API version is not available.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100482 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200483#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100484/*! @brief A platform-specific error occurred that does not match any of the
485 * more specific categories.
486 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200487#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100488/*! @brief The clipboard did not contain data in the requested format.
489 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200490#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100491/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200492
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100493#define GLFW_FOCUSED 0x00020001
494#define GLFW_ICONIFIED 0x00020002
Camilla Berglund393e4392013-05-27 22:16:59 +0200495#define GLFW_RESIZABLE 0x00020003
496#define GLFW_VISIBLE 0x00020004
497#define GLFW_DECORATED 0x00020005
Camilla Berglund2c091572010-09-09 21:09:11 +0200498
Camilla Berglund53b39a62013-05-30 18:55:45 +0200499#define GLFW_RED_BITS 0x00021001
500#define GLFW_GREEN_BITS 0x00021002
501#define GLFW_BLUE_BITS 0x00021003
502#define GLFW_ALPHA_BITS 0x00021004
503#define GLFW_DEPTH_BITS 0x00021005
504#define GLFW_STENCIL_BITS 0x00021006
505#define GLFW_ACCUM_RED_BITS 0x00021007
506#define GLFW_ACCUM_GREEN_BITS 0x00021008
507#define GLFW_ACCUM_BLUE_BITS 0x00021009
508#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
509#define GLFW_AUX_BUFFERS 0x0002100B
510#define GLFW_STEREO 0x0002100C
511#define GLFW_SAMPLES 0x0002100D
512#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Berglund2cd34382013-05-30 20:42:50 +0200513#define GLFW_REFRESH_RATE 0x0002100F
Camilla Berglunddeb0b3d2012-12-02 21:00:15 +0100514
Camilla Berglund53b39a62013-05-30 18:55:45 +0200515#define GLFW_CLIENT_API 0x00022001
516#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
517#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
518#define GLFW_CONTEXT_REVISION 0x00022004
519#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
520#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
521#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
522#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100523
Camilla Berglund393e4392013-05-27 22:16:59 +0200524#define GLFW_OPENGL_API 0x00030001
525#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100526
Camilla Berglund393e4392013-05-27 22:16:59 +0200527#define GLFW_NO_ROBUSTNESS 0
528#define GLFW_NO_RESET_NOTIFICATION 0x00031001
529#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100530
Camilla Berglund44e84012013-06-05 16:13:30 +0200531#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200532#define GLFW_OPENGL_CORE_PROFILE 0x00032001
533#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100534
Camilla Berglund393e4392013-05-27 22:16:59 +0200535#define GLFW_CURSOR 0x00033001
536#define GLFW_STICKY_KEYS 0x00033002
537#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100538
Camilla Berglund393e4392013-05-27 22:16:59 +0200539#define GLFW_CURSOR_NORMAL 0x00034001
540#define GLFW_CURSOR_HIDDEN 0x00034002
541#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100542
Camilla Berglund393e4392013-05-27 22:16:59 +0200543#define GLFW_CONNECTED 0x00040001
544#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100545
Camilla Berglund97387282011-10-06 23:28:56 +0200546
Camilla Berglund3249f812010-09-07 17:34:51 +0200547/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100548 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200549 *************************************************************************/
550
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100551/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200552 *
553 * Generic function pointer used for returning client API function pointers
554 * without forcing a cast from a regular pointer.
555 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100556 * @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 Berglund8282a8f2013-04-10 23:01:12 +0200561 *
562 * Opaque monitor object.
563 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100564 * @ingroup monitor
565 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100566typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200567
Camilla Berglunddba2d802013-01-17 23:06:56 +0100568/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200569 *
570 * Opaque window object.
571 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100572 * @ingroup window
573 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100574typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200575
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100576/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200577 *
578 * This is the function signature for error callback functions.
579 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100580 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100581 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100582 *
583 * @sa glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100584 *
585 * @ingroup error
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100586 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100587typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100588
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100589/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200590 *
591 * This is the function signature for window position callback functions.
592 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100593 * @param[in] window The window that the user moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200594 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
595 * upper-left corner of the client area of the window.
596 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
597 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100598 *
599 * @sa glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100600 *
601 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100602 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100603typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100604
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100605/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200606 *
607 * This is the function signature for window size callback functions.
608 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100609 * @param[in] window The window that the user resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200610 * @param[in] width The new width, in screen coordinates, of the window.
611 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100612 *
613 * @sa glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100614 *
615 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100616 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100617typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100618
619/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200620 *
621 * This is the function signature for window close callback functions.
622 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100623 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100624 *
625 * @sa glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100626 *
627 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100628 */
Camilla Berglund64afb192013-03-06 23:29:37 +0100629typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100630
631/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200632 *
633 * This is the function signature for window refresh callback functions.
634 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100635 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100636 *
637 * @sa glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100638 *
639 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100640 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100641typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100642
643/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200644 *
645 * This is the function signature for window focus callback functions.
646 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100647 * @param[in] window The window that was focused or defocused.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100648 * @param[in] focused `GL_TRUE` if the window was focused, or `GL_FALSE` if
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100649 * it was defocused.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100650 *
651 * @sa glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100652 *
653 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100654 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100655typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100656
Camilla Berglund06e7a962012-11-22 19:14:27 +0100657/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200658 *
659 * This is the function signature for window iconify/restore callback
660 * functions.
661 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100662 * @param[in] window The window that was iconified or restored.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100663 * @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE`
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100664 * if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100665 *
666 * @sa glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100667 *
668 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100669 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100670typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100671
Camilla Berglund34981632013-06-03 12:51:57 +0200672/*! @brief The function signature for framebuffer resize callbacks.
673 *
674 * This is the function signature for framebuffer resize callback
675 * functions.
676 *
677 * @param[in] window The window whose framebuffer was resized.
678 * @param[in] width The new width, in pixels, of the framebuffer.
679 * @param[in] height The new height, in pixels, of the framebuffer.
680 *
681 * @sa glfwSetFramebufferSizeCallback
682 *
683 * @ingroup window
684 */
685typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
686
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100687/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200688 *
689 * This is the function signature for mouse button callback functions.
690 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100691 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100692 * @param[in] button The [mouse button](@ref buttons) that was pressed or
693 * released.
694 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200695 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
696 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100697 *
698 * @sa glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100699 *
700 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100701 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100702typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100703
704/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200705 *
706 * This is the function signature for cursor position callback functions.
707 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100708 * @param[in] window The window that received the event.
Camilla Berglund52f718d2013-02-12 12:01:12 +0100709 * @param[in] xpos The new x-coordinate of the cursor.
710 * @param[in] ypos The new y-coordinate of the cursor.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100711 *
712 * @sa glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100713 *
714 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100715 */
Camilla Berglund129e94d2013-04-04 16:16:21 +0200716typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100717
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200718/*! @brief The function signature for cursor enter/leave callbacks.
719 *
720 * This is the function signature for cursor enter/leave callback functions.
721 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100722 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100723 * @param[in] entered `GL_TRUE` if the cursor entered the window's client
724 * area, or `GL_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100725 *
726 * @sa glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100727 *
728 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100729 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100730typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100731
732/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200733 *
734 * This is the function signature for scroll callback functions.
735 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100736 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +0200737 * @param[in] xoffset The scroll offset along the x-axis.
738 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100739 *
740 * @sa glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100741 *
742 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100743 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100744typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100745
746/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200747 *
748 * This is the function signature for keyboard key callback functions.
749 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100750 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100751 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +0200752 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund253e0d62013-01-12 17:06:35 +0100753 * @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200754 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
755 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100756 *
757 * @sa glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100758 *
759 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100760 */
Camilla Berglund11615fc2013-05-30 17:19:12 +0200761typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100762
763/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200764 *
765 * This is the function signature for Unicode character callback functions.
766 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100767 * @param[in] window The window that received the event.
768 * @param[in] character The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100769 *
770 * @sa glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100771 *
772 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100773 */
Camilla Berglund182e0af2013-02-25 17:02:28 +0100774typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +0100775
776/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200777 *
778 * This is the function signature for monitor configuration callback functions.
779 *
Camilla Berglund5f68e122012-11-27 17:07:28 +0100780 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100781 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100782 *
783 * @sa glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100784 *
785 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +0100786 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100787typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +0100788
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200789/*! @brief Video mode type.
790 *
791 * This describes a single video mode.
792 *
793 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100794 */
Systemclusterd0a0e372013-08-29 06:15:55 +0200795typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200796{
Camilla Berglund95835af2013-05-30 13:53:25 +0200797 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +0200798 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200799 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +0200800 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +0200801 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200802 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +0200803 /*! The bit depth of the red channel of the video mode.
804 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200805 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +0200806 /*! The bit depth of the green channel of the video mode.
807 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200808 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +0200809 /*! The bit depth of the blue channel of the video mode.
810 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +0200811 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +0200812 /*! The refresh rate, in Hz, of the video mode.
813 */
814 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +0200815} GLFWvidmode;
816
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100817/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200818 *
819 * This describes the gamma ramp for a monitor.
820 *
821 * @sa glfwGetGammaRamp glfwSetGammaRamp
822 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +0200823 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100824 */
Systemclusterd0a0e372013-08-29 06:15:55 +0200825typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +0200826{
Camilla Berglundc1594112013-05-27 22:29:06 +0200827 /*! An array of value describing the response of the red channel.
828 */
Camilla Berglund5d308db2013-05-19 15:46:44 +0200829 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +0200830 /*! An array of value describing the response of the green channel.
831 */
Camilla Berglund5d308db2013-05-19 15:46:44 +0200832 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +0200833 /*! An array of value describing the response of the blue channel.
834 */
Camilla Berglund5d308db2013-05-19 15:46:44 +0200835 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +0200836 /*! The number of elements in each array.
837 */
Camilla Berglund5d308db2013-05-19 15:46:44 +0200838 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +0200839} GLFWgammaramp;
840
Camilla Berglund3249f812010-09-07 17:34:51 +0200841
842/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100843 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +0200844 *************************************************************************/
845
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100846/*! @brief Initializes the GLFW library.
847 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100848 * This function initializes the GLFW library. Before most GLFW functions can
849 * be used, GLFW must be initialized, and before a program terminates GLFW
850 * should be terminated in order to free any resources allocated during or
851 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100852 *
Camilla Berglund23f61762013-03-12 19:53:29 +0100853 * If this function fails, it calls @ref glfwTerminate before returning. If it
854 * succeeds, you should call @ref glfwTerminate before the program exits.
855 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100856 * Additional calls to this function after successful initialization but before
857 * termination will succeed but will do nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100858 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100859 * @return `GL_TRUE` if successful, or `GL_FALSE` if an error occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100860 *
Camilla Berglund401033c2013-03-12 19:17:07 +0100861 * @par New in GLFW 3
862 * This function no longer registers @ref glfwTerminate with `atexit`.
863 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +0100864 * @note This function may only be called from the main thread.
865 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100866 * @note This function may take several seconds to complete on some systems,
867 * while on other systems it may take only a fraction of a second to complete.
868 *
Camilla Berglundfd3813f2013-09-24 21:34:46 +0200869 * @note **OS X:** This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +0100870 * application to the `Contents/Resources` subdirectory of the application's
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100871 * bundle, if present.
872 *
873 * @sa glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100874 *
875 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100876 */
877GLFWAPI int glfwInit(void);
878
879/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100880 *
Camilla Berglund23f61762013-03-12 19:53:29 +0100881 * This function destroys all remaining windows, frees any allocated resources
882 * and sets the library to an uninitialized state. Once this is called, you
883 * must again call @ref glfwInit successfully before you will be able to use
884 * most GLFW functions.
885 *
886 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100887 * before the program exits. If initialization fails, there is no need to call
888 * this function, as it is called by @ref glfwInit before it returns failure.
Camilla Berglund23f61762013-03-12 19:53:29 +0100889 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100890 * @remarks This function may be called before @ref glfwInit.
891 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +0100892 * @note This function may only be called from the main thread.
893 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100894 * @warning No window's context may be current on another thread when this
895 * function is called.
896 *
897 * @sa glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100898 *
899 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100900 */
Camilla Berglund9a716692010-09-08 16:40:43 +0200901GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100902
903/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100904 *
905 * This function retrieves the major, minor and revision numbers of the GLFW
906 * library. It is intended for when you are using GLFW as a shared library and
907 * want to ensure that you are using the minimum required version.
908 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100909 * @param[out] major Where to store the major version number, or `NULL`.
910 * @param[out] minor Where to store the minor version number, or `NULL`.
911 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100912 *
913 * @remarks This function may be called before @ref glfwInit.
914 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100915 * @remarks This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100916 *
917 * @sa glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100918 *
919 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100920 */
Camilla Berglund9a716692010-09-08 16:40:43 +0200921GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100922
Camilla Berglund6f8084f2013-02-14 13:14:17 +0100923/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100924 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100925 * This function returns a static string generated at compile-time according to
926 * which configuration macros were defined. This is intended for use when
927 * submitting bug reports, to allow developers to see which code paths are
928 * enabled in a binary.
929 *
Camilla Berglund6f8084f2013-02-14 13:14:17 +0100930 * The format of the string is as follows:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +0200931 * - The version of GLFW
932 * - The name of the window system API
933 * - The name of the context creation API
934 * - Any additional options or APIs
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100935 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100936 * For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200937 * back ends, the version string may look something like this:
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100938 *
939 * 3.0.0 Win32 WGL MinGW
940 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100941 * @return The GLFW version string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100942 *
943 * @remarks This function may be called before @ref glfwInit.
944 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100945 * @remarks This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100946 *
947 * @sa glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100948 *
949 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100950 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +0200951GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +0200952
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100953/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100954 *
955 * This function sets the error callback, which is called with an error code
956 * and a human-readable description each time a GLFW error occurs.
957 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100958 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100959 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +0200960 * @return The previously set callback, or `NULL` if no callback was set or an
961 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +0200962 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100963 * @remarks This function may be called before @ref glfwInit.
964 *
Camilla Berglund9bfb9252013-01-07 17:22:02 +0100965 * @note The error callback is called by the thread where the error was
966 * generated. If you are using GLFW from multiple threads, your error callback
967 * needs to be written accordingly.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100968 *
969 * @note Because the description string provided to the callback may have been
970 * generated specifically for that error, it is not guaranteed to be valid
971 * after the callback has returned. If you wish to use it after that, you need
972 * to make your own copy of it before returning.
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100973 *
974 * @ingroup error
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100975 */
Camilla Berglund11a27de2013-04-08 21:21:21 +0200976GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +0200977
Camilla Berglund5f68e122012-11-27 17:07:28 +0100978/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100979 *
980 * This function returns an array of handles for all currently connected
981 * monitors.
982 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +0200983 * @param[out] count Where to store the size of the returned array. This is
984 * set to zero if an error occurred.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100985 * @return An array of monitor handles, or `NULL` if an error occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100986 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +0200987 * @note The returned array is allocated and freed by GLFW. You should not
988 * free it yourself.
989 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100990 * @note The returned array is valid only until the monitor configuration
991 * changes. See @ref glfwSetMonitorCallback to receive notifications of
992 * configuration changes.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100993 *
994 * @sa glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +0100995 *
996 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100997 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100998GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100999
Camilla Berglund5f68e122012-11-27 17:07:28 +01001000/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001001 *
1002 * This function returns the primary monitor. This is usually the monitor
1003 * where elements like the Windows task bar or the OS X menu bar is located.
1004 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001005 * @return The primary monitor, or `NULL` if an error occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001006 *
1007 * @sa glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001008 *
1009 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001010 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001011GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001012
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001013/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001014 *
1015 * This function returns the position, in screen coordinates, of the upper-left
1016 * corner of the specified monitor.
1017 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001018 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001019 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1020 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001021 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001022 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001023 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001024GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1025
1026/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001027 *
1028 * This function returns the size, in millimetres, of the display area of the
1029 * specified monitor.
1030 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001031 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001032 * @param[out] width Where to store the width, in mm, of the monitor's display
1033 * area, or `NULL`.
1034 * @param[out] height Where to store the height, in mm, of the monitor's
1035 * display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001036 *
1037 * @note Some operating systems do not provide accurate information, either
1038 * because the monitor's EDID data is incorrect, or because the driver does not
1039 * report it accurately.
1040 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001041 * @ingroup monitor
1042 */
1043GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001044
Camilla Berglund5f68e122012-11-27 17:07:28 +01001045/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001046 *
1047 * This function returns a human-readable name, encoded as UTF-8, of the
1048 * specified monitor.
1049 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001050 * @param[in] monitor The monitor to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001051 * @return The UTF-8 encoded name of the monitor, or `NULL` if an error
Camilla Berglund5d6256c2013-02-25 17:53:02 +01001052 * occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001053 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001054 * @note The returned string is allocated and freed by GLFW. You should not
1055 * free it yourself.
1056 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001057 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001058 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001059GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001060
Camilla Berglund5f68e122012-11-27 17:07:28 +01001061/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001062 *
1063 * This function sets the monitor configuration callback, or removes the
1064 * currently set callback. This is called when a monitor is connected to or
1065 * disconnected from the system.
1066 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001067 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001068 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001069 * @return The previously set callback, or `NULL` if no callback was set or an
1070 * error occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001071 *
Camilla Berglundc347b072013-06-12 20:57:37 +02001072 * @bug **X11:** This callback is not yet called on monitor configuration
1073 * changes.
Camilla Berglund948cc042013-04-16 02:02:22 +02001074 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001075 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001076 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001077GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001078
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001079/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001080 *
1081 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001082 * monitor. The returned array is sorted in ascending order, first by color
1083 * bit depth (the sum of all channel depths) and then by resolution area (the
1084 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001085 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001086 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001087 * @param[out] count Where to store the number of video modes in the returned
1088 * array. This is set to zero if an error occurred.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001089 * @return An array of video modes, or `NULL` if an error occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001090 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001091 * @note The returned array is allocated and freed by GLFW. You should not
1092 * free it yourself.
1093 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001094 * @note The returned array is valid only until this function is called again
Camilla Berglund948cc042013-04-16 02:02:22 +02001095 * for the specified monitor.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001096 *
1097 * @sa glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001098 *
1099 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001100 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001101GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001102
Camilla Berglund5f68e122012-11-27 17:07:28 +01001103/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001104 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001105 * This function returns the current video mode of the specified monitor. If
1106 * you are using a full screen window, the return value will therefore depend
1107 * on whether it is focused.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001108 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001109 * @param[in] monitor The monitor to query.
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001110 * @return The current mode of the monitor, or `NULL` if an error occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001111 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001112 * @note The returned struct is allocated and freed by GLFW. You should not
1113 * free it yourself.
1114 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001115 * @sa glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001116 *
1117 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001118 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001119GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001120
Camilla Berglund92a71e02013-02-12 13:50:41 +01001121/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001122 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001123 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglundf1c88b42013-06-14 12:12:16 +02001124 * and then calls @ref glfwSetGammaRamp with it.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001125 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001126 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001127 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001128 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001129 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001130 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001131GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001132
Camilla Berglund92a71e02013-02-12 13:50:41 +01001133/*! @brief Retrieves the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001134 *
1135 * This function retrieves the current gamma ramp of the specified monitor.
1136 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001137 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001138 * @return The current gamma ramp, or `NULL` if an error occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001139 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001140 * @note The value arrays of the returned ramp are allocated and freed by GLFW.
1141 * You should not free them yourself.
1142 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001143 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001144 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001145GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001146
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001147/*! @brief Sets the current gamma ramp for the specified monitor.
1148 *
1149 * This function sets the current gamma ramp for the specified monitor.
1150 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001151 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001152 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001153 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001154 * @note Gamma ramp sizes other than 256 are not supported by all hardware.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001155 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001156 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001157 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001158GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001159
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001160/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001161 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001162 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001163 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001164 *
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 glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001168 *
1169 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001170 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001171GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001172
1173/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001174 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001175 * This function sets hints for the next call to @ref glfwCreateWindow. The
1176 * hints, once set, retain their values until changed by a call to @ref
1177 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
1178 * terminated with @ref glfwTerminate.
1179 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001180 * @param[in] target The [window hint](@ref window_hints) to set.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001181 * @param[in] hint The new value of the window hint.
1182 *
Camilla Berglund401033c2013-03-12 19:17:07 +01001183 * @par New in GLFW 3
1184 * Hints are no longer reset to their default values on window creation. To
1185 * set default hint values, use @ref glfwDefaultWindowHints.
1186 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001187 * @note This function may only be called from the main thread.
1188 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001189 * @sa glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001190 *
1191 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001192 */
Camilla Berglundaff30d02012-08-06 17:56:41 +02001193GLFWAPI void glfwWindowHint(int target, int hint);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001194
1195/*! @brief Creates a window and its associated context.
1196 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001197 * This function creates a window and its associated context. Most of the
1198 * options controlling how the window and its context should be created are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001199 * specified through @ref glfwWindowHint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001200 *
1201 * Successful creation does not change which context is current. Before you
1202 * can use the newly created context, you need to make it current using @ref
1203 * glfwMakeContextCurrent.
1204 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001205 * Note that the created window and context may differ from what you requested,
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001206 * as not all parameters and hints are
1207 * [hard constraints](@ref window_hints_hard). This includes the size of the
1208 * window, especially for full screen windows. To retrieve the actual
Camilla Berglundad1f6f02013-05-27 15:30:32 +02001209 * attributes of the created window and context, use queries like @ref
1210 * glfwGetWindowAttrib and @ref glfwGetWindowSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001211 *
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001212 * To create a full screen window, you need to specify the monitor to use. If
1213 * no monitor is specified, windowed mode will be used. Unless you have a way
1214 * for the user to choose a specific monitor, it is recommended that you pick
1215 * the primary monitor. For more information on how to retrieve monitors, see
1216 * @ref monitor_monitors.
1217 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001218 * To create the window at a specific position, make it initially invisible
1219 * using the `GLFW_VISIBLE` window hint, set its position and then show it.
1220 *
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001221 * If a full screen window is active, the screensaver is prohibited from
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001222 * starting.
1223 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001224 * @param[in] width The desired width, in screen coordinates, of the window.
1225 * This must be greater than zero.
1226 * @param[in] height The desired height, in screen coordinates, of the window.
1227 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001228 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001229 * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001230 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001231 * @param[in] share The window whose context to share resources with, or `NULL`
1232 * to not share resources.
1233 * @return The handle of the created window, or `NULL` if an error occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001234 *
Camilla Berglund07db5da2013-09-26 19:15:36 +02001235 * @remarks **Windows:** Window creation will fail if the Microsoft GDI
1236 * software OpenGL implementation is the only one available.
1237 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001238 * @remarks **Windows:** If the executable has an icon resource named
1239 * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is
1240 * present, the `IDI_WINLOGO` icon will be used instead.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001241 *
Camilla Berglundfd3813f2013-09-24 21:34:46 +02001242 * @remarks **OS X:** The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01001243 * window, but the dock icon will be the same as the application bundle's icon.
1244 * Also, the first time a window is opened the menu bar is populated with
1245 * common commands like Hide, Quit and About. The (minimal) about dialog uses
1246 * information from the application's bundle. For more information on bundles,
1247 * see the Bundle Programming Guide provided by Apple.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001248 *
Camilla Berglund3af1c412013-09-19 21:37:01 +02001249 * @remarks The swap interval is not set during window creation, but is left at
1250 * the default value for that platform. For more information, see @ref
1251 * glfwSwapInterval.
1252 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001253 * @note This function may only be called from the main thread.
1254 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001255 * @sa glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001256 *
1257 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001258 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001259GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001260
1261/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001262 *
1263 * This function destroys the specified window and its context. On calling
1264 * this function, no further callbacks will be called for that window.
1265 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001266 * @param[in] window The window to destroy.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001267 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001268 * @note This function may only be called from the main thread.
1269 *
Camilla Berglundb48128f2013-02-14 18:49:03 +01001270 * @note This function may not be called from a callback.
1271 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001272 * @note If the window's context is current on the main thread, it is
1273 * detached before being destroyed.
1274 *
1275 * @warning The window's context must not be current on any other thread.
1276 *
1277 * @sa glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001278 *
1279 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001280 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001281GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001282
Camilla Berglund64afb192013-03-06 23:29:37 +01001283/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001284 *
1285 * This function returns the value of the close flag of the specified window.
1286 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001287 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01001288 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001289 *
Camilla Berglund6632cc72013-07-11 02:00:48 +02001290 * @remarks This function may be called from secondary threads.
1291 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001292 * @ingroup window
1293 */
1294GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1295
Camilla Berglund64afb192013-03-06 23:29:37 +01001296/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001297 *
1298 * This function sets the value of the close flag of the specified window.
1299 * This can be used to override the user's attempt to close the window, or
1300 * to signal that it should be closed.
1301 *
Camilla Berglund64afb192013-03-06 23:29:37 +01001302 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01001303 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001304 *
Camilla Berglund6632cc72013-07-11 02:00:48 +02001305 * @remarks This function may be called from secondary threads.
1306 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001307 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01001308 */
1309GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1310
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001311/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001312 *
1313 * This function sets the window title, encoded as UTF-8, of the specified
1314 * window.
1315 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001316 * @param[in] window The window whose title to change.
1317 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001318 *
1319 * @note This function may only be called from the main thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001320 *
1321 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001322 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001323GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001324
Camilla Berglund7c193232013-01-24 19:30:31 +01001325/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001326 *
1327 * This function retrieves the position, in screen coordinates, of the
1328 * upper-left corner of the client area of the specified window.
1329 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001330 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001331 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
1332 * the client area, or `NULL`.
1333 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
1334 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01001335 *
1336 * @sa glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001337 *
1338 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001339 */
1340GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
1341
1342/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001343 *
1344 * This function sets the position, in screen coordinates, of the upper-left
1345 * corner of the client area of the window.
1346 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001347 * If the specified window is a full screen window, this function does nothing.
1348 *
1349 * If you wish to set an initial window position you should create a hidden
1350 * window (using @ref glfwWindowHint and `GLFW_VISIBLE`), set its position and
1351 * then show it.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001352 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001353 * @param[in] window The window to query.
1354 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
1355 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01001356 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001357 * @note It is very rarely a good idea to move an already visible window, as it
1358 * will confuse and annoy the user.
1359 *
1360 * @note This function may only be called from the main thread.
1361 *
1362 * @note The window manager may put limits on what positions are allowed.
1363 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001364 * @bug **X11:** Some window managers ignore the set position of hidden (i.e.
1365 * unmapped) windows, instead placing them where it thinks is appropriate once
1366 * they are shown.
Camilla Berglund7c193232013-01-24 19:30:31 +01001367 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001368 * @sa glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001369 *
1370 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001371 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01001372GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01001373
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001374/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001375 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001376 * This function retrieves the size, in screen coordinates, of the client area
1377 * of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001378 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001379 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001380 * @param[out] width Where to store the width, in screen coordinates, of the
1381 * client area, or `NULL`.
1382 * @param[out] height Where to store the height, in screen coordinates, of the
1383 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001384 *
1385 * @sa glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001386 *
1387 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001388 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001389GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001390
1391/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001392 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001393 * This function sets the size, in screen coordinates, of the client area of
1394 * the specified window.
1395 *
1396 * For full screen windows, this function selects and switches to the resolution
1397 * closest to the specified size, without affecting the window's context. As
1398 * the context is unaffected, the bit depths of the framebuffer remain
1399 * unchanged.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001400 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001401 * @param[in] window The window to resize.
1402 * @param[in] width The desired width of the specified window.
1403 * @param[in] height The desired height of the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001404 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001405 * @note This function may only be called from the main thread.
1406 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001407 * @note The window manager may put limits on what window sizes are allowed.
1408 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001409 * @sa glfwGetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001410 *
1411 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001412 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001413GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001414
Camilla Berglund34981632013-06-03 12:51:57 +02001415/*! @brief Retrieves the size of the framebuffer of the specified window.
1416 *
1417 * This function retrieves the size, in pixels, of the framebuffer of the
1418 * specified window.
1419 *
1420 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001421 * @param[out] width Where to store the width, in pixels, of the framebuffer,
1422 * or `NULL`.
1423 * @param[out] height Where to store the height, in pixels, of the framebuffer,
1424 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02001425 *
1426 * @sa glfwSetFramebufferSizeCallback
1427 *
1428 * @ingroup window
1429 */
1430GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
1431
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001432/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001433 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001434 * This function iconifies/minimizes the specified window, if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001435 * restored. If it is a full screen window, the original monitor resolution is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001436 * restored until the window is restored. If the window is already iconified,
1437 * this function does nothing.
1438 *
1439 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001440 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001441 * @note This function may only be called from the main thread.
1442 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001443 * @sa glfwRestoreWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001444 *
1445 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001446 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001447GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001448
1449/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001450 *
1451 * This function restores the specified window, if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001452 * iconified/minimized. If it is a full screen window, the resolution chosen
1453 * for the window is restored on the selected monitor. If the window is
1454 * already restored, this function does nothing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001455 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001456 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001457 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001458 * @note This function may only be called from the main thread.
1459 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001460 * @sa glfwIconifyWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01001461 *
1462 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001463 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001464GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001465
1466/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001467 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001468 * This function makes the specified window visible, if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001469 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001470 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001471 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001472 * @param[in] window The window to make visible.
1473 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001474 * @note This function may only be called from the main thread.
1475 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001476 * @sa glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001477 *
1478 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001479 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001480GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001481
1482/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001483 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001484 * This function hides the specified window, if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001485 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001486 * nothing.
1487 *
1488 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001489 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001490 * @note This function may only be called from the main thread.
1491 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001492 * @sa glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001493 *
1494 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001495 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001496GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001497
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001498/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001499 *
1500 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001501 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001502 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001503 * @param[in] window The window to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001504 * @return The monitor, or `NULL` if the window is in windowed mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001505 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001506 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001507 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001508GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001509
Camilla Berglundad1f6f02013-05-27 15:30:32 +02001510/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001511 *
Camilla Berglundad1f6f02013-05-27 15:30:32 +02001512 * This function returns an attribute of the specified window. There are many
1513 * attributes, some related to the window and others to its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001514 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001515 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02001516 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
1517 * return.
Camilla Berglundad1f6f02013-05-27 15:30:32 +02001518 * @return The value of the attribute, or zero if an error occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001519 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001520 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001521 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02001522GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001523
1524/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001525 *
1526 * This function sets the user-defined pointer of the specified window. The
1527 * current value is retained until the window is destroyed. The initial value
1528 * is `NULL`.
1529 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001530 * @param[in] window The window whose pointer to set.
1531 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001532 *
1533 * @sa glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001534 *
1535 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001536 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001537GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001538
1539/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001540 *
1541 * This function returns the current value of the user-defined pointer of the
1542 * specified window. The initial value is `NULL`.
1543 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001544 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001545 *
1546 * @sa glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001547 *
1548 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001549 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001550GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001551
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001552/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001553 *
1554 * This function sets the position callback of the specified window, which is
1555 * called when the window is moved. The callback is provided with the screen
1556 * position of the upper-left corner of the client area of the window.
1557 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001558 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001559 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001560 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001561 * @return The previously set callback, or `NULL` if no callback was set or an
1562 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001563 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001564 * @ingroup window
1565 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001566GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001567
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001568/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001569 *
1570 * This function sets the size callback of the specified window, which is
1571 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001572 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001573 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001574 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001575 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001576 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001577 * @return The previously set callback, or `NULL` if no callback was set or an
1578 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001579 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001580 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001581 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001582GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001583
1584/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001585 *
1586 * This function sets the close callback of the specified window, which is
1587 * called when the user attempts to close the window, for example by clicking
1588 * the close widget in the title bar.
1589 *
1590 * The close flag is set before this callback is called, but you can modify it
1591 * at any time with @ref glfwSetWindowShouldClose.
1592 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001593 * The close callback is not triggered by @ref glfwDestroyWindow.
1594 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001595 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001596 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001597 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001598 * @return The previously set callback, or `NULL` if no callback was set or an
1599 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001600 *
Camilla Berglundfd3813f2013-09-24 21:34:46 +02001601 * @remarks **OS X:** Selecting Quit from the application menu will
Camilla Berglund1bd59842013-01-13 21:28:18 +01001602 * trigger the close callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001603 *
1604 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001605 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001606GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001607
1608/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001609 *
1610 * This function sets the refresh callback of the specified window, which is
1611 * called when the client area of the window needs to be redrawn, for example
1612 * if the window has been exposed after having been covered by another window.
1613 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001614 * On compositing window systems such as Aero, Compiz or Aqua, where the window
1615 * contents are saved off-screen, this callback may be called only very
1616 * infrequently or never at all.
1617 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001618 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001619 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001620 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001621 * @return The previously set callback, or `NULL` if no callback was set or an
1622 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001623 *
1624 * @note On compositing window systems such as Aero, Compiz or Aqua, where the
1625 * window contents are saved off-screen, this callback may be called only very
1626 * infrequently or never at all.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001627 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001628 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001629 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001630GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001631
1632/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001633 *
1634 * This function sets the focus callback of the specified window, which is
1635 * called when the window gains or loses focus.
1636 *
Camilla Berglund4538a522013-04-24 19:49:46 +02001637 * After the focus callback is called for a window that lost focus, synthetic
1638 * key and mouse button release events will be generated for all such that had
1639 * been pressed. For more information, see @ref glfwSetKeyCallback and @ref
1640 * glfwSetMouseButtonCallback.
1641 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001642 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001643 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001644 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001645 * @return The previously set callback, or `NULL` if no callback was set or an
1646 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001647 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001648 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001649 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001650GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001651
1652/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001653 *
1654 * This function sets the iconification callback of the specified window, which
1655 * is called when the window is iconified or restored.
1656 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001657 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001658 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001659 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001660 * @return The previously set callback, or `NULL` if no callback was set or an
1661 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001662 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001663 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001664 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001665GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02001666
Camilla Berglund34981632013-06-03 12:51:57 +02001667/*! @brief Sets the framebuffer resize callback for the specified window.
1668 *
1669 * This function sets the framebuffer resize callback of the specified window,
1670 * which is called when the framebuffer of the specified window is resized.
1671 *
1672 * @param[in] window The window whose callback to set.
1673 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1674 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001675 * @return The previously set callback, or `NULL` if no callback was set or an
1676 * error occurred.
Camilla Berglund34981632013-06-03 12:51:57 +02001677 *
1678 * @ingroup window
1679 */
1680GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
1681
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001682/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001683 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001684 * This function processes only those events that have already been received
Camilla Berglund948cc042013-04-16 02:02:22 +02001685 * and then returns immediately. Processing events will cause the window and
1686 * input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001687 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001688 * This function is not required for joystick input to work.
1689 *
Camilla Berglund401033c2013-03-12 19:17:07 +01001690 * @par New in GLFW 3
1691 * This function is no longer called by @ref glfwSwapBuffers. You need to call
1692 * it or @ref glfwWaitEvents yourself.
1693 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001694 * @note This function may only be called from the main thread.
1695 *
Camilla Berglundb48128f2013-02-14 18:49:03 +01001696 * @note This function may not be called from a callback.
1697 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001698 * @note On some platforms, certain callbacks may be called outside of a call
1699 * to one of the event processing functions.
1700 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001701 * @sa glfwWaitEvents
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001702 *
1703 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001704 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001705GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001706
1707/*! @brief Waits until events are pending and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001708 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001709 * This function puts the calling thread to sleep until at least one event has
Bruce Mitchener5f37d362013-06-27 17:28:31 +07001710 * been received. Once one or more events have been received, it behaves as if
Camilla Berglund948cc042013-04-16 02:02:22 +02001711 * @ref glfwPollEvents was called, i.e. the events are processed and the
1712 * function then returns immediately. Processing events will cause the window
1713 * and input callbacks associated with those events to be called.
1714 *
1715 * Since not all events are associated with callbacks, this function may return
1716 * without a callback having been called even if you are monitoring all
1717 * callbacks.
1718 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001719 * This function is not required for joystick input to work.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001720 *
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001721 * @note This function may only be called from the main thread.
1722 *
Camilla Berglundb48128f2013-02-14 18:49:03 +01001723 * @note This function may not be called from a callback.
1724 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001725 * @note On some platforms, certain callbacks may be called outside of a call
1726 * to one of the event processing functions.
1727 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001728 * @sa glfwPollEvents
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001729 *
1730 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001731 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001732GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02001733
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001734/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001735 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001736 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02001737 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01001738 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001739 *
1740 * @sa glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001741 *
1742 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001743 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001744GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001745
1746/*! @brief Sets an input option for the specified window.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001747 * @param[in] window The window whose input mode to set.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02001748 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund71d2b572013-03-12 15:33:05 +01001749 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglund9492fc52013-01-17 17:51:12 +01001750 * @param[in] value The new value of the specified input mode.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001751 *
Camilla Berglund9264b5d2013-04-26 14:29:55 +02001752 * If `mode` is `GLFW_CURSOR`, the value must be one of the supported input
Camilla Berglund39fe1f12013-03-12 19:39:36 +01001753 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02001754 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
1755 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund39fe1f12013-03-12 19:39:36 +01001756 * area of the window.
Camilla Berglund6df692b2013-04-26 17:20:31 +02001757 * - `GLFW_CURSOR_DISABLED` disables the cursor and removes any limitations on
1758 * cursor movement.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01001759 *
1760 * If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
1761 * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
1762 * enabled, a key press will ensure that @ref glfwGetKey returns @ref
1763 * GLFW_PRESS the next time it is called even if the key had been released
Camilla Berglunde6bfbba2013-06-12 16:06:21 +02001764 * before the call. This is useful when you are only interested in whether
1765 * keys have been pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01001766 *
1767 * If `mode` is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either `GL_TRUE`
1768 * to enable sticky mouse buttons, or `GL_FALSE` to disable it. If sticky
1769 * mouse buttons are enabled, a mouse button press will ensure that @ref
1770 * glfwGetMouseButton returns @ref GLFW_PRESS the next time it is called even
Camilla Berglunde6bfbba2013-06-12 16:06:21 +02001771 * if the mouse button had been released before the call. This is useful when
1772 * you are only interested in whether mouse buttons have been pressed but not
1773 * when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01001774 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001775 * @sa glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01001776 *
1777 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001778 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001779GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001780
1781/*! @brief Returns the last reported state of a keyboard key for the specified
1782 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001783 *
1784 * This function returns the last state reported for the specified key to the
1785 * specified window. The returned state is one of `GLFW_PRESS` or
1786 * `GLFW_RELEASE`. The higher-level state `GLFW_REPEAT` is only reported to
1787 * the key callback.
1788 *
1789 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
1790 * `GLFW_PRESS` the first time you call this function after a key has been
1791 * pressed, even if the key has already been released.
1792 *
1793 * The key functions deal with physical keys, with [key tokens](@ref keys)
1794 * named after their use on the standard US keyboard layout. If you want to
1795 * input text, use the Unicode character callback instead.
1796 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001797 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001798 * @param[in] key The desired [keyboard key](@ref keys).
1799 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001800 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02001801 * @note `GLFW_KEY_UNKNOWN` is not a valid key for this function.
1802 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001803 * @ingroup input
1804 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001805GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001806
1807/*! @brief Returns the last reported state of a mouse button for the specified
1808 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001809 *
1810 * This function returns the last state reported for the specified mouse button
1811 * to the specified window.
1812 *
1813 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
1814 * returns `GLFW_PRESS` the first time you call this function after a mouse
1815 * button has been pressed, even if the mouse button has already been released.
1816 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001817 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001818 * @param[in] button The desired [mouse button](@ref buttons).
1819 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001820 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001821 * @ingroup input
1822 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001823GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001824
1825/*! @brief Retrieves the last reported cursor position, relative to the client
1826 * area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001827 *
1828 * This function returns the last reported position of the cursor to the
1829 * specified window.
1830 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02001831 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
1832 * position is unbounded and limited only by the minimum and maximum values of
1833 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02001834 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02001835 * The coordinate can be converted to their integer equivalents with the
1836 * `floor` function. Casting directly to an integer type works for positive
1837 * coordinates, but fails for negative ones.
1838 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001839 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001840 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
1841 * left edge of the client area, or `NULL`.
1842 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
1843 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001844 *
1845 * @sa glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001846 *
1847 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001848 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02001849GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001850
1851/*! @brief Sets the position of the cursor, relative to the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001852 *
1853 * This function sets the position of the cursor. The specified window must be
1854 * focused. If the window does not have focus when this function is called, it
1855 * fails silently.
1856 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02001857 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
1858 * position is unbounded and limited only by the minimum and maximum values of
1859 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02001860 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001861 * @param[in] window The desired window.
1862 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02001863 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001864 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02001865 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001866 *
1867 * @sa glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001868 *
1869 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001870 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02001871GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001872
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001873/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001874 *
1875 * This function sets the key callback of the specific window, which is called
1876 * when a key is pressed, repeated or released.
1877 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001878 * The key functions deal with physical keys, with layout independent
1879 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001880 * layout. If you want to input text, use the
1881 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001882 *
Camilla Berglund4538a522013-04-24 19:49:46 +02001883 * When a window loses focus, it will generate synthetic key release events
1884 * for all pressed keys. You can tell these events from user-generated events
1885 * by the fact that the synthetic ones are generated after the window has lost
1886 * focus, i.e. `GLFW_FOCUSED` will be false and the focus callback will have
1887 * already been called.
1888 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02001889 * The scancode of a key is specific to that platform or sometimes even to that
1890 * machine. Scancodes are intended to allow users to bind keys that don't have
1891 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
1892 * state is not saved and so it cannot be retrieved with @ref glfwGetKey.
1893 *
1894 * Sometimes GLFW needs to generate synthetic key events, in which case the
1895 * scancode may be zero.
1896 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01001897 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001898 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001899 * set callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001900 * @return The previously set callback, or `NULL` if no callback was set or an
1901 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001902 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001903 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001904 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001905GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001906
1907/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001908 *
1909 * This function sets the character callback of the specific window, which is
1910 * called when a Unicode character is input.
1911 *
1912 * The character callback is intended for text input. If you want to know
1913 * whether a specific key was pressed or released, use the
1914 * [key callback](@ref glfwSetKeyCallback) instead.
1915 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01001916 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001917 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001918 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001919 * @return The previously set callback, or `NULL` if no callback was set or an
1920 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001921 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001922 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001923 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001924GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001925
1926/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001927 *
1928 * This function sets the mouse button callback of the specified window, which
1929 * is called when a mouse button is pressed or released.
1930 *
Camilla Berglund4538a522013-04-24 19:49:46 +02001931 * When a window loses focus, it will generate synthetic mouse button release
1932 * events for all pressed mouse buttons. You can tell these events from
1933 * user-generated events by the fact that the synthetic ones are generated
1934 * after the window has lost focus, i.e. `GLFW_FOCUSED` will be false and the
1935 * focus callback will have already been called.
1936 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01001937 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001938 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001939 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001940 * @return The previously set callback, or `NULL` if no callback was set or an
1941 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001942 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001943 * @ingroup input
1944 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001945GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001946
1947/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001948 *
1949 * This function sets the cursor position callback of the specified window,
1950 * which is called when the cursor is moved. The callback is provided with the
1951 * position relative to the upper-left corner of the client area of the window.
1952 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01001953 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001954 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001955 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001956 * @return The previously set callback, or `NULL` if no callback was set or an
1957 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001958 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001959 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001960 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001961GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001962
1963/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001964 *
1965 * This function sets the cursor boundary crossing callback of the specified
1966 * window, which is called when the cursor enters or leaves the client area of
1967 * the window.
1968 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01001969 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001970 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001971 * callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001972 * @return The previously set callback, or `NULL` if no callback was set or an
1973 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001974 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001975 * @ingroup input
1976 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001977GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001978
1979/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01001980 *
1981 * This function sets the scroll callback of the specified window, which is
1982 * called when a scrolling device is used, such as a mouse wheel or scrolling
1983 * area of a touchpad.
1984 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001985 * The scroll callback receives all scrolling input, like that from a mouse
1986 * wheel or a touchpad scrolling area.
1987 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01001988 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001989 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001990 * set callback.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001991 * @return The previously set callback, or `NULL` if no callback was set or an
1992 * error occurred.
Camilla Berglund11a27de2013-04-08 21:21:21 +02001993 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001994 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001995 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001996GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02001997
Camilla Berglundfdd45182013-05-27 15:13:09 +02001998/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001999 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02002000 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002001 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002002 * @param[in] joy The joystick to query.
Camilla Berglundfdd45182013-05-27 15:13:09 +02002003 * @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002004 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002005 * @ingroup input
2006 */
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002007GLFWAPI int glfwJoystickPresent(int joy);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002008
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002009/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002010 *
2011 * This function returns the values of all axes of the specified joystick.
2012 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002013 * @param[in] joy The joystick to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002014 * @param[out] count Where to store the size of the returned array. This is
2015 * set to zero if an error occurred.
2016 * @return An array of axis values, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002017 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002018 * @note The returned array is allocated and freed by GLFW. You should not
2019 * free it yourself.
2020 *
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002021 * @note The returned array is valid only until the next call to @ref
2022 * glfwGetJoystickAxes for that joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002023 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002024 * @ingroup input
2025 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02002026GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002027
Camilla Berglunde93bade2013-06-16 02:33:33 +02002028/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002029 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02002030 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002031 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002032 * @param[in] joy The joystick to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002033 * @param[out] count Where to store the size of the returned array. This is
2034 * set to zero if an error occurred.
Camilla Berglunde93bade2013-06-16 02:33:33 +02002035 * @return An array of button states, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002036 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002037 * @note The returned array is allocated and freed by GLFW. You should not
2038 * free it yourself.
2039 *
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002040 * @note The returned array is valid only until the next call to @ref
2041 * glfwGetJoystickButtons for that joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002042 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002043 * @ingroup input
2044 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02002045GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02002046
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01002047/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002048 *
2049 * This function returns the name, encoded as UTF-8, of the specified joystick.
2050 *
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01002051 * @param[in] joy The joystick to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002052 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01002053 * is not present.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01002054 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002055 * @note The returned string is allocated and freed by GLFW. You should not
2056 * free it yourself.
2057 *
Camilla Berglundd4a08b12012-12-02 17:13:41 +01002058 * @note The returned string is valid only until the next call to @ref
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002059 * glfwGetJoystickName for that joystick.
2060 *
2061 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01002062 */
Camilla Berglund93a1d1c2012-09-07 01:01:34 +02002063GLFWAPI const char* glfwGetJoystickName(int joy);
Camilla Berglund3249f812010-09-07 17:34:51 +02002064
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002065/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002066 *
2067 * This function sets the system clipboard to the specified, UTF-8 encoded
2068 * string. The string is copied before returning, so you don't have to retain
2069 * it afterwards.
2070 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002071 * @param[in] window The window that will own the clipboard contents.
2072 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002073 *
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002074 * @note This function may only be called from the main thread.
2075 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002076 * @sa glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002077 *
2078 * @ingroup clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002079 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002080GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002081
2082/*! @brief Retrieves the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002083 *
2084 * This function returns the contents of the system clipboard, if it contains
2085 * or is convertible to a UTF-8 encoded string.
2086 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002087 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002088 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund5d6256c2013-02-25 17:53:02 +01002089 * if an error occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002090 *
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002091 * @note This function may only be called from the main thread.
2092 *
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002093 * @note The returned string is allocated and freed by GLFW. You should not
2094 * free it yourself.
2095 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002096 * @note The returned string is valid only until the next call to @ref
2097 * glfwGetClipboardString or @ref glfwSetClipboardString.
2098 *
2099 * @sa glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002100 *
2101 * @ingroup clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002102 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002103GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01002104
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002105/*! @brief Returns the value of the GLFW timer.
2106 *
2107 * This function returns the value of the GLFW timer. Unless the timer has
2108 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
2109 * was initialized.
2110 *
Camilla Berglund5d6256c2013-02-25 17:53:02 +01002111 * @return The current value, in seconds, or zero if an error occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002112 *
2113 * @remarks This function may be called from secondary threads.
2114 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002115 * @note The resolution of the timer is system dependent, but is usually on the
2116 * order of a few micro- or nanoseconds. It uses the highest-resolution
2117 * monotonic time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002118 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002119 * @ingroup time
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002120 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002121GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02002122
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002123/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002124 *
2125 * This function sets the value of the GLFW timer. It then continues to count
2126 * up from that value.
2127 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002128 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002129 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002130 * @note The resolution of the timer is system dependent, but is usually on the
2131 * order of a few micro- or nanoseconds. It uses the highest-resolution
2132 * monotonic time source on each supported platform.
Camilla Berglunde248fb62013-03-29 14:06:23 +01002133 *
2134 * @ingroup time
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002135 */
2136GLFWAPI void glfwSetTime(double time);
2137
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002138/*! @brief Makes the context of the specified window current for the calling
2139 * thread.
2140 *
2141 * This function makes the context of the specified window current on the
2142 * calling thread. A context can only be made current on a single thread at
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002143 * a time and each thread can have only a single current context at a time.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002144 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01002145 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002146 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002147 *
2148 * @remarks This function may be called from secondary threads.
2149 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002150 * @sa glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01002151 *
2152 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002153 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002154GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002155
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002156/*! @brief Returns the window whose context is current on the calling thread.
2157 *
2158 * This function returns the window whose context is current on the calling
2159 * thread.
2160 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01002161 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002162 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002163 *
2164 * @remarks This function may be called from secondary threads.
2165 *
2166 * @sa glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01002167 *
2168 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002169 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002170GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002171
2172/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002173 *
2174 * This function swaps the front and back buffers of the specified window. If
2175 * the swap interval is greater than zero, the GPU driver waits the specified
2176 * number of screen updates before swapping the buffers.
2177 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002178 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002179 *
2180 * @remarks This function may be called from secondary threads.
2181 *
Camilla Berglund401033c2013-03-12 19:17:07 +01002182 * @par New in GLFW 3
2183 * This function no longer calls @ref glfwPollEvents. You need to call it or
2184 * @ref glfwWaitEvents yourself.
2185 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002186 * @sa glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01002187 *
2188 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002189 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002190GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002191
2192/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002193 *
2194 * This function sets the swap interval for the current context, i.e. the
2195 * number of screen updates to wait before swapping the buffers of a window and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002196 * returning from @ref glfwSwapBuffers. This is sometimes called 'vertical
2197 * synchronization', 'vertical retrace synchronization' or 'vsync'.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002198 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002199 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002200 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
2201 * which allow the driver to swap even if a frame arrives a little bit late.
2202 * You can check for the presence of these extensions using @ref
2203 * glfwExtensionSupported. For more information about swap tearing, see the
2204 * extension specifications.
2205 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002206 * @param[in] interval The minimum number of screen updates to wait for
2207 * until the buffers are swapped by @ref glfwSwapBuffers.
2208 *
2209 * @remarks This function may be called from secondary threads.
2210 *
Camilla Berglund3af1c412013-09-19 21:37:01 +02002211 * @note This function is not called during window creation, leaving the swap
2212 * interval set to whatever is the default on that platform. This is done
2213 * because some swap interval extensions used by GLFW do not allow the swap
2214 * interval to be reset to zero once it has been set to a non-zero value.
2215 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002216 * @note Some GPU drivers do not honor the requested swap interval, either
2217 * because of user settings that override the request or due to bugs in the
2218 * driver.
2219 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002220 * @sa glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01002221 *
2222 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002223 */
2224GLFWAPI void glfwSwapInterval(int interval);
2225
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002226/*! @brief Returns whether the specified extension is available.
2227 *
Camilla Berglund608109c2013-04-11 20:18:46 +02002228 * This function returns whether the specified
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002229 * [OpenGL or context creation API extension](@ref context_glext) is supported
2230 * by the current context. For example, on Windows both the OpenGL and WGL
2231 * extension strings are checked.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002232 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002233 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002234 * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002235 *
2236 * @remarks This function may be called from secondary threads.
2237 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002238 * @note As this functions searches one or more extension strings on each call,
2239 * it is recommended that you cache its results if it's going to be used
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002240 * frequently. The extension strings will not change during the lifetime of
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002241 * a context, so there is no danger in doing this.
Camilla Berglunde248fb62013-03-29 14:06:23 +01002242 *
2243 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002244 */
2245GLFWAPI int glfwExtensionSupported(const char* extension);
2246
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002247/*! @brief Returns the address of the specified function for the current
2248 * context.
2249 *
Camilla Berglund608109c2013-04-11 20:18:46 +02002250 * This function returns the address of the specified
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002251 * [client API or extension function](@ref context_glext), if it is supported
2252 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002253 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002254 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002255 * @return The address of the function, or `NULL` if the function is
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002256 * unavailable.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002257 *
2258 * @remarks This function may be called from secondary threads.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002259 *
2260 * @note The addresses of these functions are not guaranteed to be the same for
2261 * all contexts, especially if they use different client APIs or even different
2262 * context creation hints.
2263 *
2264 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002265 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02002266GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02002267
Camilla Berglund3249f812010-09-07 17:34:51 +02002268
Camilla Berglund4afc67c2011-07-27 17:09:17 +02002269/*************************************************************************
2270 * Global definition cleanup
2271 *************************************************************************/
2272
2273/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
2274
Camilla Berglund4afc67c2011-07-27 17:09:17 +02002275#ifdef GLFW_WINGDIAPI_DEFINED
2276 #undef WINGDIAPI
2277 #undef GLFW_WINGDIAPI_DEFINED
2278#endif
2279
2280#ifdef GLFW_CALLBACK_DEFINED
2281 #undef CALLBACK
2282 #undef GLFW_CALLBACK_DEFINED
2283#endif
2284
2285/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
2286
2287
Camilla Berglund3249f812010-09-07 17:34:51 +02002288#ifdef __cplusplus
2289}
2290#endif
2291
Camilla Berglundf8df91d2013-01-15 01:59:56 +01002292#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02002293