blob: 0b3cc0779bdf56fe6cd3b2302b3f06dee1df3eca [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund611006a2014-01-22 01:32:00 +01002 * GLFW 3.1 - www.glfw.org
Camilla Berglund3cfc4002013-07-29 20:53:17 +02003 * 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 Berglund3f5843f2012-12-13 02:22:39 +010041/*! @defgroup context Context handling
Camilla Berglund4591ad22014-09-18 15:03:29 +020042 *
43 * This is the reference documentation for context related functions. For more
44 * information, see the @ref context.
Camilla Berglund3f5843f2012-12-13 02:22:39 +010045 */
Camilla Berglund4591ad22014-09-18 15:03:29 +020046/*! @defgroup init Initialization, version and errors
47 *
48 * This is the reference documentation for initialization and termination of
49 * the library, version management and error handling. For more information,
50 * see the @ref intro.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010051 */
52/*! @defgroup input Input handling
Camilla Berglund4591ad22014-09-18 15:03:29 +020053 *
54 * This is the reference documentation for input related functions and types.
55 * For more information, see the @ref input.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010056 */
Camilla Berglund5f68e122012-11-27 17:07:28 +010057/*! @defgroup monitor Monitor handling
Camilla Berglundf5f55e32013-06-17 12:56:36 +020058 *
59 * This is the reference documentation for monitor related functions and types.
60 * For more information, see the @ref monitor.
Camilla Berglund5f68e122012-11-27 17:07:28 +010061 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010062/*! @defgroup window Window handling
63 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +020064 * This is the reference documentation for window related functions and types,
65 * including creation, deletion and event polling. For more information, see
66 * the @ref window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010067 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010068
69
70/*************************************************************************
Camilla Berglund3249f812010-09-07 17:34:51 +020071 * Global definitions
72 *************************************************************************/
73
Camilla Berglund3249f812010-09-07 17:34:51 +020074/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
75
Camilla Berglund06e7a962012-11-22 19:14:27 +010076/* Please report any problems that you find with your compiler, which may
Camilla Berglund3249f812010-09-07 17:34:51 +020077 * be solved in this section! There are several compilers that I have not
78 * been able to test this file with yet.
79 *
80 * First: If we are we on Windows, we want a single define for it (_WIN32)
81 * (Note: For Cygwin the compiler flag -mwin32 should be used, but to
82 * make sure that things run smoothly for Cygwin users, we add __CYGWIN__
83 * to the list of "valid Win32 identifiers", which removes the need for
84 * -mwin32)
85 */
86#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
87 #define _WIN32
88#endif /* _WIN32 */
89
90/* In order for extension support to be portable, we need to define an
91 * OpenGL function call method. We use the keyword APIENTRY, which is
92 * defined for Win32. (Note: Windows also needs this for <GL/gl.h>)
93 */
94#ifndef APIENTRY
95 #ifdef _WIN32
96 #define APIENTRY __stdcall
97 #else
98 #define APIENTRY
99 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200100#endif /* APIENTRY */
101
Camilla Berglund3249f812010-09-07 17:34:51 +0200102/* The following three defines are here solely to make some Windows-based
103 * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but
104 * it has the major drawback of severely polluting our namespace.
105 */
106
107/* Under Windows, we need WINGDIAPI defined */
108#if !defined(WINGDIAPI) && defined(_WIN32)
109 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
110 /* Microsoft Visual C++, Borland C++ Builder and Pelles C */
111 #define WINGDIAPI __declspec(dllimport)
112 #elif defined(__LCC__)
113 /* LCC-Win32 */
114 #define WINGDIAPI __stdcall
115 #else
116 /* Others (e.g. MinGW, Cygwin) */
117 #define WINGDIAPI extern
118 #endif
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200119 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200120#endif /* WINGDIAPI */
121
122/* Some <GL/glu.h> files also need CALLBACK defined */
123#if !defined(CALLBACK) && defined(_WIN32)
124 #if defined(_MSC_VER)
125 /* Microsoft Visual C++ */
126 #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
127 #define CALLBACK __stdcall
128 #else
129 #define CALLBACK
130 #endif
131 #else
132 /* Other Windows compilers */
133 #define CALLBACK __stdcall
134 #endif
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200135 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200136#endif /* CALLBACK */
137
Camilla Berglundbea59f62013-07-23 00:20:23 +0200138/* Most GL/glu.h variants on Windows need wchar_t
139 * OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */
Camilla Berglundc93b1202013-09-08 16:07:34 +0200140#if !defined(GLFW_INCLUDE_NONE)
141 #include <stddef.h>
142#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200143
Camilla Berglundc93b1202013-09-08 16:07:34 +0200144/* Include the chosen client API headers.
145 */
146#if defined(__APPLE_CC__)
147 #if defined(GLFW_INCLUDE_GLCOREARB)
148 #include <OpenGL/gl3.h>
149 #elif !defined(GLFW_INCLUDE_NONE)
150 #define GL_GLEXT_LEGACY
151 #include <OpenGL/gl.h>
152 #endif
153 #if defined(GLFW_INCLUDE_GLU)
154 #include <OpenGL/glu.h>
155 #endif
156#else
157 #if defined(GLFW_INCLUDE_GLCOREARB)
158 #include <GL/glcorearb.h>
159 #elif defined(GLFW_INCLUDE_ES1)
160 #include <GLES/gl.h>
161 #elif defined(GLFW_INCLUDE_ES2)
162 #include <GLES2/gl2.h>
163 #elif defined(GLFW_INCLUDE_ES3)
164 #include <GLES3/gl3.h>
Camilla Berglund7ebd10a2014-03-19 23:01:20 +0100165 #elif defined(GLFW_INCLUDE_ES31)
166 #include <GLES3/gl31.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200167 #elif !defined(GLFW_INCLUDE_NONE)
168 #include <GL/gl.h>
169 #endif
170 #if defined(GLFW_INCLUDE_GLU)
171 #include <GL/glu.h>
172 #endif
173#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200174
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200175#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200176 /* GLFW_DLL must be defined by applications that are linking against the DLL
177 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
178 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200179 */
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200180 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
181#endif
182
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200183#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3249f812010-09-07 17:34:51 +0200184
Camilla Berglund3afa8312014-10-13 14:13:08 +0200185 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100186 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200187
188#elif defined(_WIN32) && defined(GLFW_DLL)
189
Camilla Berglund3afa8312014-10-13 14:13:08 +0200190 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund3249f812010-09-07 17:34:51 +0200191 #if defined(__LCC__)
Camilla Berglund2955cd32010-11-17 15:42:55 +0100192 #define GLFWAPI extern
Camilla Berglund3249f812010-09-07 17:34:51 +0200193 #else
Camilla Berglund2955cd32010-11-17 15:42:55 +0100194 #define GLFWAPI __declspec(dllimport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200195 #endif
196
John Bartholomew93f4eff2013-05-01 13:08:09 +0100197#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
198
Camilla Berglund3afa8312014-10-13 14:13:08 +0200199 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100200 #define GLFWAPI __attribute__((visibility("default")))
201
Camilla Berglund3249f812010-09-07 17:34:51 +0200202#else
203
Camilla Berglund3afa8312014-10-13 14:13:08 +0200204 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200205 #define GLFWAPI
206
207#endif
208
209/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
210
Camilla Berglund3249f812010-09-07 17:34:51 +0200211
212/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100213 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200214 *************************************************************************/
215
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100216/*! @name GLFW version macros
217 * @{ */
218/*! @brief The major version number of the GLFW library.
219 *
220 * This is incremented when the API is changed in non-compatible ways.
221 * @ingroup init
222 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100223#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100224/*! @brief The minor version number of the GLFW library.
225 *
226 * This is incremented when features are added to the API but it remains
227 * backward-compatible.
228 * @ingroup init
229 */
Camilla Berglund7e806a82014-01-01 15:29:57 +0100230#define GLFW_VERSION_MINOR 1
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100231/*! @brief The revision number of the GLFW library.
232 *
233 * This is incremented when a bug fix release is made that does not contain any
234 * API changes.
235 * @ingroup init
236 */
Camilla Berglund7e806a82014-01-01 15:29:57 +0100237#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100238/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200239
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100240/*! @name Key and button actions
241 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200242/*! @brief The key or mouse button was released.
243 *
244 * The key or mouse button was released.
245 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100246 * @ingroup input
247 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100248#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200249/*! @brief The key or mouse button was pressed.
250 *
251 * The key or mouse button was pressed.
252 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100253 * @ingroup input
254 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100255#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100256/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200257 *
258 * The key was held down until it repeated.
259 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100260 * @ingroup input
261 */
262#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100263/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200264
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200265/*! @defgroup keys Keyboard keys
266 *
Camilla Berglund95654cf2014-10-02 17:35:10 +0200267 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
Marcusc0cb4c22011-01-02 11:18:14 +0100268 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
269 * put in the 256+ range).
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200270 *
Marcusc0cb4c22011-01-02 11:18:14 +0100271 * The naming of the key codes follow these rules:
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200272 * - The US keyboard layout is used
Marcusc0cb4c22011-01-02 11:18:14 +0100273 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200274 * "3", etc.)
Marcusc0cb4c22011-01-02 11:18:14 +0100275 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200276 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
277 * correspond to the Unicode standard (usually for brevity)
278 * - Keys that lack a clear US mapping are named "WORLD_x"
Marcusc0cb4c22011-01-02 11:18:14 +0100279 * - For non-printable keys, custom names are used (e.g. "F4",
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200280 * "BACKSPACE", etc.)
281 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100282 * @ingroup input
283 * @{
284 */
285
Camilla Berglund11615fc2013-05-30 17:19:12 +0200286/* The unknown key */
287#define GLFW_KEY_UNKNOWN -1
288
Marcusc0cb4c22011-01-02 11:18:14 +0100289/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100290#define GLFW_KEY_SPACE 32
291#define GLFW_KEY_APOSTROPHE 39 /* ' */
292#define GLFW_KEY_COMMA 44 /* , */
293#define GLFW_KEY_MINUS 45 /* - */
294#define GLFW_KEY_PERIOD 46 /* . */
295#define GLFW_KEY_SLASH 47 /* / */
296#define GLFW_KEY_0 48
297#define GLFW_KEY_1 49
298#define GLFW_KEY_2 50
299#define GLFW_KEY_3 51
300#define GLFW_KEY_4 52
301#define GLFW_KEY_5 53
302#define GLFW_KEY_6 54
303#define GLFW_KEY_7 55
304#define GLFW_KEY_8 56
305#define GLFW_KEY_9 57
306#define GLFW_KEY_SEMICOLON 59 /* ; */
307#define GLFW_KEY_EQUAL 61 /* = */
308#define GLFW_KEY_A 65
309#define GLFW_KEY_B 66
310#define GLFW_KEY_C 67
311#define GLFW_KEY_D 68
312#define GLFW_KEY_E 69
313#define GLFW_KEY_F 70
314#define GLFW_KEY_G 71
315#define GLFW_KEY_H 72
316#define GLFW_KEY_I 73
317#define GLFW_KEY_J 74
318#define GLFW_KEY_K 75
319#define GLFW_KEY_L 76
320#define GLFW_KEY_M 77
321#define GLFW_KEY_N 78
322#define GLFW_KEY_O 79
323#define GLFW_KEY_P 80
324#define GLFW_KEY_Q 81
325#define GLFW_KEY_R 82
326#define GLFW_KEY_S 83
327#define GLFW_KEY_T 84
328#define GLFW_KEY_U 85
329#define GLFW_KEY_V 86
330#define GLFW_KEY_W 87
331#define GLFW_KEY_X 88
332#define GLFW_KEY_Y 89
333#define GLFW_KEY_Z 90
334#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
335#define GLFW_KEY_BACKSLASH 92 /* \ */
336#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
337#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
338#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
339#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100340
341/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100342#define GLFW_KEY_ESCAPE 256
343#define GLFW_KEY_ENTER 257
344#define GLFW_KEY_TAB 258
345#define GLFW_KEY_BACKSPACE 259
346#define GLFW_KEY_INSERT 260
347#define GLFW_KEY_DELETE 261
348#define GLFW_KEY_RIGHT 262
349#define GLFW_KEY_LEFT 263
350#define GLFW_KEY_DOWN 264
351#define GLFW_KEY_UP 265
352#define GLFW_KEY_PAGE_UP 266
353#define GLFW_KEY_PAGE_DOWN 267
354#define GLFW_KEY_HOME 268
355#define GLFW_KEY_END 269
356#define GLFW_KEY_CAPS_LOCK 280
357#define GLFW_KEY_SCROLL_LOCK 281
358#define GLFW_KEY_NUM_LOCK 282
359#define GLFW_KEY_PRINT_SCREEN 283
360#define GLFW_KEY_PAUSE 284
361#define GLFW_KEY_F1 290
362#define GLFW_KEY_F2 291
363#define GLFW_KEY_F3 292
364#define GLFW_KEY_F4 293
365#define GLFW_KEY_F5 294
366#define GLFW_KEY_F6 295
367#define GLFW_KEY_F7 296
368#define GLFW_KEY_F8 297
369#define GLFW_KEY_F9 298
370#define GLFW_KEY_F10 299
371#define GLFW_KEY_F11 300
372#define GLFW_KEY_F12 301
373#define GLFW_KEY_F13 302
374#define GLFW_KEY_F14 303
375#define GLFW_KEY_F15 304
376#define GLFW_KEY_F16 305
377#define GLFW_KEY_F17 306
378#define GLFW_KEY_F18 307
379#define GLFW_KEY_F19 308
380#define GLFW_KEY_F20 309
381#define GLFW_KEY_F21 310
382#define GLFW_KEY_F22 311
383#define GLFW_KEY_F23 312
384#define GLFW_KEY_F24 313
385#define GLFW_KEY_F25 314
386#define GLFW_KEY_KP_0 320
387#define GLFW_KEY_KP_1 321
388#define GLFW_KEY_KP_2 322
389#define GLFW_KEY_KP_3 323
390#define GLFW_KEY_KP_4 324
391#define GLFW_KEY_KP_5 325
392#define GLFW_KEY_KP_6 326
393#define GLFW_KEY_KP_7 327
394#define GLFW_KEY_KP_8 328
395#define GLFW_KEY_KP_9 329
396#define GLFW_KEY_KP_DECIMAL 330
397#define GLFW_KEY_KP_DIVIDE 331
398#define GLFW_KEY_KP_MULTIPLY 332
399#define GLFW_KEY_KP_SUBTRACT 333
400#define GLFW_KEY_KP_ADD 334
401#define GLFW_KEY_KP_ENTER 335
402#define GLFW_KEY_KP_EQUAL 336
403#define GLFW_KEY_LEFT_SHIFT 340
404#define GLFW_KEY_LEFT_CONTROL 341
405#define GLFW_KEY_LEFT_ALT 342
406#define GLFW_KEY_LEFT_SUPER 343
407#define GLFW_KEY_RIGHT_SHIFT 344
408#define GLFW_KEY_RIGHT_CONTROL 345
409#define GLFW_KEY_RIGHT_ALT 346
410#define GLFW_KEY_RIGHT_SUPER 347
411#define GLFW_KEY_MENU 348
412#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100413
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100414/*! @} */
415
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200416/*! @defgroup mods Modifier key flags
417 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100418 * @{ */
419
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200420/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100421 */
422#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200423/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100424 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200425#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200426/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100427 */
428#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200429/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200430 */
431#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100432
433/*! @} */
434
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100435/*! @defgroup buttons Mouse buttons
436 * @ingroup input
437 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100438#define GLFW_MOUSE_BUTTON_1 0
439#define GLFW_MOUSE_BUTTON_2 1
440#define GLFW_MOUSE_BUTTON_3 2
441#define GLFW_MOUSE_BUTTON_4 3
442#define GLFW_MOUSE_BUTTON_5 4
443#define GLFW_MOUSE_BUTTON_6 5
444#define GLFW_MOUSE_BUTTON_7 6
445#define GLFW_MOUSE_BUTTON_8 7
446#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
447#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
448#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
449#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100450/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200451
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100452/*! @defgroup joysticks Joysticks
453 * @ingroup input
454 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100455#define GLFW_JOYSTICK_1 0
456#define GLFW_JOYSTICK_2 1
457#define GLFW_JOYSTICK_3 2
458#define GLFW_JOYSTICK_4 3
459#define GLFW_JOYSTICK_5 4
460#define GLFW_JOYSTICK_6 5
461#define GLFW_JOYSTICK_7 6
462#define GLFW_JOYSTICK_8 7
463#define GLFW_JOYSTICK_9 8
464#define GLFW_JOYSTICK_10 9
465#define GLFW_JOYSTICK_11 10
466#define GLFW_JOYSTICK_12 11
467#define GLFW_JOYSTICK_13 12
468#define GLFW_JOYSTICK_14 13
469#define GLFW_JOYSTICK_15 14
470#define GLFW_JOYSTICK_16 15
471#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100472/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200473
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100474/*! @defgroup errors Error codes
Camilla Berglund4591ad22014-09-18 15:03:29 +0200475 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100476 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100477/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200478 *
479 * This occurs if a GLFW function was called that may not be called unless the
480 * library is [initialized](@ref intro_init).
481 *
482 * @par Analysis
483 * Application programmer error. Initialize GLFW before calling any function
484 * that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100485 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200486#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100487/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200488 *
489 * This occurs if a GLFW function was called that needs and operates on the
490 * current OpenGL or OpenGL ES context but no context is current on the calling
491 * thread. One such function is @ref glfwSwapInterval.
492 *
493 * @par Analysis
494 * Application programmer error. Ensure a context is current before calling
495 * functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100496 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200497#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200498/*! @brief One of the arguments to the function was an invalid enum value.
499 *
500 * One of the arguments to the function was an invalid enum value, for example
501 * requesting `GLFW_RED_BITS` with @ref glfwGetWindowAttrib.
502 *
503 * @par Analysis
504 * Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100505 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200506#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200507/*! @brief One of the arguments to the function was an invalid value.
508 *
509 * One of the arguments to the function was an invalid value, for example
510 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
511 *
512 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
513 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
514 *
515 * @par Analysis
516 * Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100517 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200518#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100519/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200520 *
521 * A memory allocation failed.
522 *
523 * @par Analysis
524 * A bug in GLFW or the underlying operating system. Report the bug to our
525 * [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100526 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200527#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100528/*! @brief GLFW could not find support for the requested client API on the
529 * system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200530 *
531 * GLFW could not find support for the requested client API on the system.
532 *
533 * @par Analysis
534 * The installed graphics driver does not support the requested client API, or
535 * does not support it via the chosen context creation backend. Below are
536 * a few examples.
537 *
538 * @par
539 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
540 * supports OpenGL ES via EGL, while nVidia and Intel only supports it via
541 * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa
542 * EGL, OpenGL and OpenGL ES libraries do not interface with the nVidia binary
543 * driver.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100544 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200545#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200546/*! @brief The requested OpenGL or OpenGL ES version is not available.
547 *
548 * The requested OpenGL or OpenGL ES version (including any requested profile
549 * or context option) is not available on this machine.
550 *
551 * @par Analysis
552 * The machine does not support your requirements. If your application is
553 * sufficiently flexible, downgrade your requirements and try again.
554 * Otherwise, inform the user that their machine does not match your
555 * requirements.
556 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200557 * @par
558 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
559 * comes out before the 4.x series gets that far, also fail with this error and
560 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
561 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100562 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200563#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100564/*! @brief A platform-specific error occurred that does not match any of the
565 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200566 *
567 * A platform-specific error occurred that does not match any of the more
568 * specific categories.
569 *
570 * @par Analysis
571 * A bug in GLFW or the underlying operating system. Report the bug to our
572 * [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100573 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200574#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200575/*! @brief The requested format is not supported or available.
576 *
577 * If emitted during window creation, the requested pixel format is not
578 * supported.
579 *
580 * If emitted when querying the clipboard, the contents of the clipboard could
581 * not be converted to the requested format.
582 *
583 * @par Analysis
584 * If emitted during window creation, one or more
585 * [hard constraints](@ref window_hints_hard) did not match any of the
586 * available pixel formats. If your application is sufficiently flexible,
587 * downgrade your requirements and try again. Otherwise, inform the user that
588 * their machine does not match your requirements.
589 *
590 * @par
591 * If emitted when querying the clipboard, ignore the error or report it to
592 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100593 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200594#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100595/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200596
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100597#define GLFW_FOCUSED 0x00020001
598#define GLFW_ICONIFIED 0x00020002
Camilla Berglund393e4392013-05-27 22:16:59 +0200599#define GLFW_RESIZABLE 0x00020003
600#define GLFW_VISIBLE 0x00020004
601#define GLFW_DECORATED 0x00020005
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200602#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200603#define GLFW_FLOATING 0x00020007
Camilla Berglund2c091572010-09-09 21:09:11 +0200604
Camilla Berglund53b39a62013-05-30 18:55:45 +0200605#define GLFW_RED_BITS 0x00021001
606#define GLFW_GREEN_BITS 0x00021002
607#define GLFW_BLUE_BITS 0x00021003
608#define GLFW_ALPHA_BITS 0x00021004
609#define GLFW_DEPTH_BITS 0x00021005
610#define GLFW_STENCIL_BITS 0x00021006
611#define GLFW_ACCUM_RED_BITS 0x00021007
612#define GLFW_ACCUM_GREEN_BITS 0x00021008
613#define GLFW_ACCUM_BLUE_BITS 0x00021009
614#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
615#define GLFW_AUX_BUFFERS 0x0002100B
616#define GLFW_STEREO 0x0002100C
617#define GLFW_SAMPLES 0x0002100D
618#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Berglund2cd34382013-05-30 20:42:50 +0200619#define GLFW_REFRESH_RATE 0x0002100F
Camilla Berglundc9808582014-04-24 19:21:10 +0200620#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Berglunddeb0b3d2012-12-02 21:00:15 +0100621
Camilla Berglund53b39a62013-05-30 18:55:45 +0200622#define GLFW_CLIENT_API 0x00022001
623#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
624#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
625#define GLFW_CONTEXT_REVISION 0x00022004
626#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
627#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
628#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
629#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Berglund44c899c2014-08-21 19:21:45 +0200630#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100631
Camilla Berglund393e4392013-05-27 22:16:59 +0200632#define GLFW_OPENGL_API 0x00030001
633#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100634
Camilla Berglund393e4392013-05-27 22:16:59 +0200635#define GLFW_NO_ROBUSTNESS 0
636#define GLFW_NO_RESET_NOTIFICATION 0x00031001
637#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100638
Camilla Berglund44e84012013-06-05 16:13:30 +0200639#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200640#define GLFW_OPENGL_CORE_PROFILE 0x00032001
641#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100642
Camilla Berglund393e4392013-05-27 22:16:59 +0200643#define GLFW_CURSOR 0x00033001
644#define GLFW_STICKY_KEYS 0x00033002
645#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100646
Camilla Berglund393e4392013-05-27 22:16:59 +0200647#define GLFW_CURSOR_NORMAL 0x00034001
648#define GLFW_CURSOR_HIDDEN 0x00034002
649#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100650
Camilla Berglund44c899c2014-08-21 19:21:45 +0200651#define GLFW_ANY_RELEASE_BEHAVIOR 0
652#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
653#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
654
Camilla Berglund393e4392013-05-27 22:16:59 +0200655#define GLFW_CONNECTED 0x00040001
656#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100657
Camilla Berglund28101302014-04-08 18:57:43 +0200658#define GLFW_DONT_CARE -1
659
Camilla Berglund97387282011-10-06 23:28:56 +0200660
Camilla Berglund3249f812010-09-07 17:34:51 +0200661/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100662 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200663 *************************************************************************/
664
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100665/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200666 *
667 * Generic function pointer used for returning client API function pointers
668 * without forcing a cast from a regular pointer.
669 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100670 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100671 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200672typedef void (*GLFWglproc)(void);
673
Camilla Berglunddba2d802013-01-17 23:06:56 +0100674/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200675 *
676 * Opaque monitor object.
677 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100678 * @ingroup monitor
679 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100680typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200681
Camilla Berglunddba2d802013-01-17 23:06:56 +0100682/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200683 *
684 * Opaque window object.
685 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100686 * @ingroup window
687 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100688typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200689
urraka40c04a72013-12-04 10:19:22 -0300690/*! @brief Opaque cursor object.
691 *
692 * Opaque cursor object.
693 *
694 * @ingroup cursor
695 */
696typedef struct GLFWcursor GLFWcursor;
697
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100698/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200699 *
700 * This is the function signature for error callback functions.
701 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100702 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100703 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100704 *
705 * @sa glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100706 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200707 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100708 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100709typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100710
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100711/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200712 *
713 * This is the function signature for window position callback functions.
714 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200715 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200716 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
717 * upper-left corner of the client area of the window.
718 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
719 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100720 *
721 * @sa glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100722 *
723 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100724 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100725typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100726
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100727/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200728 *
729 * This is the function signature for window size callback functions.
730 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200731 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200732 * @param[in] width The new width, in screen coordinates, of the window.
733 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100734 *
735 * @sa glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100736 *
737 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100738 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100739typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100740
741/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200742 *
743 * This is the function signature for window close callback functions.
744 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100745 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100746 *
747 * @sa glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100748 *
749 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100750 */
Camilla Berglund64afb192013-03-06 23:29:37 +0100751typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100752
753/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200754 *
755 * This is the function signature for window refresh callback functions.
756 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100757 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100758 *
759 * @sa glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100760 *
761 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100762 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100763typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100764
765/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200766 *
767 * This is the function signature for window focus callback functions.
768 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100769 * @param[in] window The window that was focused or defocused.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100770 * @param[in] focused `GL_TRUE` if the window was focused, or `GL_FALSE` if
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100771 * it was defocused.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100772 *
773 * @sa glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100774 *
775 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100776 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100777typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100778
Camilla Berglund06e7a962012-11-22 19:14:27 +0100779/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200780 *
781 * This is the function signature for window iconify/restore callback
782 * functions.
783 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100784 * @param[in] window The window that was iconified or restored.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100785 * @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE`
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100786 * if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100787 *
788 * @sa glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100789 *
790 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100791 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100792typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100793
Camilla Berglund34981632013-06-03 12:51:57 +0200794/*! @brief The function signature for framebuffer resize callbacks.
795 *
796 * This is the function signature for framebuffer resize callback
797 * functions.
798 *
799 * @param[in] window The window whose framebuffer was resized.
800 * @param[in] width The new width, in pixels, of the framebuffer.
801 * @param[in] height The new height, in pixels, of the framebuffer.
802 *
803 * @sa glfwSetFramebufferSizeCallback
804 *
805 * @ingroup window
806 */
807typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
808
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100809/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200810 *
811 * This is the function signature for mouse button callback functions.
812 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100813 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100814 * @param[in] button The [mouse button](@ref buttons) that was pressed or
815 * released.
816 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200817 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
818 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100819 *
820 * @sa glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100821 *
822 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100823 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100824typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100825
826/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200827 *
828 * This is the function signature for cursor position callback functions.
829 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100830 * @param[in] window The window that received the event.
Camilla Berglund6d9d8562013-09-28 22:12:50 +0200831 * @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor.
832 * @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100833 *
834 * @sa glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100835 *
836 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100837 */
Camilla Berglund129e94d2013-04-04 16:16:21 +0200838typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100839
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200840/*! @brief The function signature for cursor enter/leave callbacks.
841 *
842 * This is the function signature for cursor enter/leave callback functions.
843 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100844 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100845 * @param[in] entered `GL_TRUE` if the cursor entered the window's client
846 * area, or `GL_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100847 *
848 * @sa glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100849 *
850 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100851 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100852typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100853
854/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200855 *
856 * This is the function signature for scroll callback functions.
857 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100858 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +0200859 * @param[in] xoffset The scroll offset along the x-axis.
860 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100861 *
862 * @sa glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100863 *
864 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100865 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100866typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100867
868/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200869 *
870 * This is the function signature for keyboard key callback functions.
871 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100872 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100873 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +0200874 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +0200875 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200876 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
877 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100878 *
879 * @sa glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100880 *
881 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100882 */
Camilla Berglund11615fc2013-05-30 17:19:12 +0200883typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100884
885/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200886 *
887 * This is the function signature for Unicode character callback functions.
888 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100889 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +0200890 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100891 *
892 * @sa glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100893 *
894 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100895 */
Camilla Berglund182e0af2013-02-25 17:02:28 +0100896typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +0100897
Camilla Berglund96b12ee2014-06-12 23:04:20 +0200898/*! @brief The function signature for Unicode character with modifiers
899 * callbacks.
900 *
901 * This is the function signature for Unicode character with modifiers callback
902 * functions. It is called for each input character, regardless of what
903 * modifier keys are held down.
904 *
905 * @param[in] window The window that received the event.
906 * @param[in] codepoint The Unicode code point of the character.
907 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
908 * held down.
909 *
910 * @sa glfwSetCharModsCallback
911 *
912 * @ingroup input
913 */
914typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
915
Camilla Berglund5c8121e2014-03-29 21:35:21 +0100916/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +0200917 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +0100918 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +0200919 *
920 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +0100921 * @param[in] count The number of dropped files.
922 * @param[in] names The UTF-8 encoded path names of the dropped files.
arturo89d07232013-07-10 11:42:14 +0200923 *
924 * @sa glfwSetDropCallback
925 *
926 * @ingroup input
927 */
Camilla Berglund8f349e82013-12-22 19:28:46 +0100928typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +0200929
Camilla Berglund5f68e122012-11-27 17:07:28 +0100930/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200931 *
932 * This is the function signature for monitor configuration callback functions.
933 *
Camilla Berglund5f68e122012-11-27 17:07:28 +0100934 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100935 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100936 *
937 * @sa glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100938 *
939 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +0100940 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100941typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +0100942
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200943/*! @brief Video mode type.
944 *
945 * This describes a single video mode.
946 *
947 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100948 */
Systemclusterd0a0e372013-08-29 06:15:55 +0200949typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200950{
Camilla Berglund95835af2013-05-30 13:53:25 +0200951 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +0200952 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200953 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +0200954 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +0200955 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200956 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +0200957 /*! The bit depth of the red channel of the video mode.
958 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200959 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +0200960 /*! The bit depth of the green channel of the video mode.
961 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +0200962 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +0200963 /*! The bit depth of the blue channel of the video mode.
964 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +0200965 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +0200966 /*! The refresh rate, in Hz, of the video mode.
967 */
968 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +0200969} GLFWvidmode;
970
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100971/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200972 *
973 * This describes the gamma ramp for a monitor.
974 *
975 * @sa glfwGetGammaRamp glfwSetGammaRamp
976 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +0200977 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100978 */
Systemclusterd0a0e372013-08-29 06:15:55 +0200979typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +0200980{
Camilla Berglundc1594112013-05-27 22:29:06 +0200981 /*! An array of value describing the response of the red channel.
982 */
Camilla Berglund5d308db2013-05-19 15:46:44 +0200983 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +0200984 /*! An array of value describing the response of the green channel.
985 */
Camilla Berglund5d308db2013-05-19 15:46:44 +0200986 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +0200987 /*! An array of value describing the response of the blue channel.
988 */
Camilla Berglund5d308db2013-05-19 15:46:44 +0200989 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +0200990 /*! The number of elements in each array.
991 */
Camilla Berglund5d308db2013-05-19 15:46:44 +0200992 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +0200993} GLFWgammaramp;
994
Camilla Berglund8fa9cc02014-02-23 16:43:17 +0100995/*! @brief Image data.
996 *
997 * @ingroup window
998 */
999typedef struct GLFWimage
1000{
1001 /*! The width, in pixels, of this image.
1002 */
1003 int width;
1004 /*! The height, in pixels, of this image.
1005 */
1006 int height;
1007 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1008 */
1009 unsigned char* pixels;
1010} GLFWimage;
1011
Camilla Berglund3249f812010-09-07 17:34:51 +02001012
1013/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001014 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001015 *************************************************************************/
1016
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001017/*! @brief Initializes the GLFW library.
1018 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001019 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001020 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001021 * should be terminated in order to free any resources allocated during or
1022 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001023 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001024 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001025 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001026 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001027 * Additional calls to this function after successful initialization but before
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001028 * termination will return `GL_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001029 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001030 * @return `GL_TRUE` if successful, or `GL_FALSE` if an
1031 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001032 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001033 * @remarks __OS X:__ This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001034 * application to the `Contents/Resources` subdirectory of the application's
Camilla Berglund4591ad22014-09-18 15:03:29 +02001035 * bundle, if present. This can be disabled with a
1036 * [compile-time option](@ref compile_options_osx).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001037 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001038 * @par Thread Safety
1039 * This function may only be called from the main thread.
1040 *
1041 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001042 * @sa glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001043 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001044 * @par History
1045 * Added in GLFW 1.0.
1046 *
1047 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001048 * __GLFW 3:__ This function no longer registers @ref glfwTerminate with `atexit`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001049 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001050 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001051 */
1052GLFWAPI int glfwInit(void);
1053
1054/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001055 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001056 * This function destroys all remaining windows and cursors, restores any
1057 * modified gamma ramps and frees any other allocated resources. Once this
1058 * function is called, you must again call @ref glfwInit successfully before
1059 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001060 *
1061 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001062 * before the application exits. If initialization fails, there is no need to
1063 * call this function, as it is called by @ref glfwInit before it returns
1064 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001065 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001066 * @remarks This function may be called before @ref glfwInit.
1067 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001068 * @warning No window's context may be current on another thread when this
1069 * function is called.
1070 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001071 * @par Thread Safety
1072 * This function may only be called from the main thread.
1073 *
1074 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001075 * @sa glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001076 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001077 * @par History
1078 * Added in GLFW 1.0.
1079 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001080 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001081 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001082GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001083
1084/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001085 *
1086 * This function retrieves the major, minor and revision numbers of the GLFW
1087 * library. It is intended for when you are using GLFW as a shared library and
1088 * want to ensure that you are using the minimum required version.
1089 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001090 * Any or all of the version arguments may be `NULL`. This function always
1091 * succeeds.
1092 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001093 * @param[out] major Where to store the major version number, or `NULL`.
1094 * @param[out] minor Where to store the minor version number, or `NULL`.
1095 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001096 *
1097 * @remarks This function may be called before @ref glfwInit.
1098 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001099 * @par Thread Safety
1100 * This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001101 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001102 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001103 * @sa glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001104 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001105 * @par History
1106 * Added in GLFW 1.0.
1107 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001108 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001109 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001110GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001111
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001112/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001113 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001114 * This function returns the compile-time generated
1115 * [version string](@ref intro_version_string) of the GLFW library binary. It
1116 * describes the version, platform, compiler and any platform-specific
1117 * compile-time options.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001118 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001119 * This function always succeeds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001120 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001121 * @return The GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001122 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001123 * @remarks This function may be called before @ref glfwInit.
1124 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001125 * @par Pointer Lifetime
1126 * The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001127 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001128 * @par Thread Safety
1129 * This function may be called from any thread.
1130 *
1131 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001132 * @sa glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001133 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001134 * @par History
1135 * Added in GLFW 3.0.
1136 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001137 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001138 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001139GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001140
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001141/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001142 *
1143 * This function sets the error callback, which is called with an error code
1144 * and a human-readable description each time a GLFW error occurs.
1145 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001146 * The error callback is called on the thread where the error occurred. If you
1147 * are using GLFW from multiple threads, your error callback needs to be
1148 * written accordingly.
1149 *
1150 * Because the description string may have been generated specifically for that
1151 * error, it is not guaranteed to be valid after the callback has returned. If
1152 * you wish to use it after the callback returns, you need to make a copy.
1153 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001154 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001155 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001156 * @return The previously set callback, or `NULL` if no callback was set.
1157 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001158 * @remarks This function may be called before @ref glfwInit.
1159 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001160 * @par Thread Safety
1161 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001162 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001163 * @sa @ref error_handling
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001164 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001165 * @par History
1166 * Added in GLFW 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001167 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001168 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001169 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001170GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001171
Camilla Berglund5f68e122012-11-27 17:07:28 +01001172/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001173 *
1174 * This function returns an array of handles for all currently connected
1175 * monitors.
1176 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001177 * @param[out] count Where to store the number of monitors in the returned
1178 * array. This is set to zero if an error occurred.
1179 * @return An array of monitor handles, or `NULL` if an
1180 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001181 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001182 * @par Pointer Lifetime
1183 * The returned array is allocated and freed by GLFW. You should not free it
1184 * yourself. It is guaranteed to be valid only until the monitor configuration
Camilla Berglund6be821c2014-10-06 23:18:33 +02001185 * changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001186 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001187 * @par Thread Safety
1188 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001189 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001190 * @sa @ref monitor_monitors
1191 * @sa @ref monitor_event
Camilla Berglunddba2d802013-01-17 23:06:56 +01001192 * @sa glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001193 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001194 * @par History
1195 * Added in GLFW 3.0.
1196 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001197 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001198 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001199GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001200
Camilla Berglund5f68e122012-11-27 17:07:28 +01001201/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001202 *
1203 * This function returns the primary monitor. This is usually the monitor
1204 * where elements like the Windows task bar or the OS X menu bar is located.
1205 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001206 * @return The primary monitor, or `NULL` if an [error](@ref error_handling)
1207 * occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001208 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001209 * @par Thread Safety
1210 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001211 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001212 * @sa @ref monitor_monitors
Camilla Berglunddba2d802013-01-17 23:06:56 +01001213 * @sa glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001214 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001215 * @par History
1216 * Added in GLFW 3.0.
1217 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001218 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001219 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001220GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001221
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001222/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001223 *
1224 * This function returns the position, in screen coordinates, of the upper-left
1225 * corner of the specified monitor.
1226 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001227 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1228 * non-`NULL` position arguments will be set to zero.
1229 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001230 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001231 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1232 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001233 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001234 * @par Thread Safety
1235 * This function may only be called from the main thread.
1236 *
1237 * @sa @ref monitor_properties
1238 *
1239 * @par History
1240 * Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001241 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001242 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001243 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001244GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1245
1246/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001247 *
1248 * This function returns the size, in millimetres, of the display area of the
1249 * specified monitor.
1250 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001251 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1252 * non-`NULL` size arguments will be set to zero.
1253 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001254 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001255 * @param[out] width Where to store the width, in mm, of the monitor's display
1256 * area, or `NULL`.
1257 * @param[out] height Where to store the height, in mm, of the monitor's
1258 * display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001259 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001260 * @note Some systems do not provide accurate monitor size information, either
1261 * because the EDID data is incorrect, or because the driver does not report it
1262 * accurately.
Camilla Berglund0e205772014-03-24 11:58:35 +01001263 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001264 * @par Thread Safety
1265 * This function may only be called from the main thread.
1266 *
1267 * @sa @ref monitor_properties
1268 *
1269 * @par History
1270 * Added in GLFW 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001271 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001272 * @ingroup monitor
1273 */
1274GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001275
Camilla Berglund5f68e122012-11-27 17:07:28 +01001276/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001277 *
1278 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001279 * specified monitor. The name typically reflects the make and model of the
1280 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001281 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001282 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001283 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1284 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001285 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001286 * @par Pointer Lifetime
1287 * The returned string is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02001288 * yourself. It is valid until the specified monitor is disconnected or the
1289 * library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001290 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001291 * @par Thread Safety
1292 * This function may only be called from the main thread.
1293 *
1294 * @sa @ref monitor_properties
1295 *
1296 * @par History
1297 * Added in GLFW 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001298 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001299 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001300 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001301GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001302
Camilla Berglund5f68e122012-11-27 17:07:28 +01001303/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001304 *
1305 * This function sets the monitor configuration callback, or removes the
1306 * currently set callback. This is called when a monitor is connected to or
1307 * disconnected from the system.
1308 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001309 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001310 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001311 * @return The previously set callback, or `NULL` if no callback was set or the
1312 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001313 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001314 * @bug __X11:__ This callback is not yet called on monitor configuration
Camilla Berglundc347b072013-06-12 20:57:37 +02001315 * changes.
Camilla Berglund948cc042013-04-16 02:02:22 +02001316 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001317 * @par Thread Safety
1318 * This function may only be called from the main thread.
1319 *
1320 * @sa @ref monitor_event
1321 *
1322 * @par History
1323 * Added in GLFW 3.0.
1324 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001325 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001326 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001327GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001328
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001329/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001330 *
1331 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001332 * monitor. The returned array is sorted in ascending order, first by color
1333 * bit depth (the sum of all channel depths) and then by resolution area (the
1334 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001335 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001336 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001337 * @param[out] count Where to store the number of video modes in the returned
1338 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001339 * @return An array of video modes, or `NULL` if an
1340 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001341 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001342 * @par Pointer Lifetime
1343 * The returned array is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02001344 * yourself. It is valid until the specified monitor is disconnected, this
1345 * function is called again for that monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001346 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001347 * @par Thread Safety
1348 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001349 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001350 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001351 * @sa glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001352 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001353 * @par History
1354 * Added in GLFW 1.0.
1355 *
1356 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001357 * __GLFW 3:__ Changed to return a dynamic array of video modes for a specific
Camilla Berglund4591ad22014-09-18 15:03:29 +02001358 * monitor.
1359 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001360 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001361 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001362GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001363
Camilla Berglund5f68e122012-11-27 17:07:28 +01001364/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001365 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001366 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001367 * you have created a full screen window for that monitor, the return value
1368 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001369 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001370 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001371 * @return The current mode of the monitor, or `NULL` if an
1372 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001373 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001374 * @par Pointer Lifetime
1375 * The returned array is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02001376 * yourself. It is valid until the specified monitor is disconnected or the
1377 * library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001378 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001379 * @par Thread Safety
1380 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001381 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001382 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001383 * @sa glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001384 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001385 * @par History
1386 * Added in GLFW 3.0. Replaced `glfwGetDesktopMode`.
1387 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001388 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001389 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001390GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001391
Camilla Berglund92a71e02013-02-12 13:50:41 +01001392/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001393 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001394 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglundf1c88b42013-06-14 12:12:16 +02001395 * and then calls @ref glfwSetGammaRamp with it.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001396 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001397 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001398 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001399 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001400 * @par Thread Safety
1401 * This function may only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001402 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001403 * @sa @ref monitor_gamma
1404 *
1405 * @par History
1406 * Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001407 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001408 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001409 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001410GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001411
Camilla Berglund4591ad22014-09-18 15:03:29 +02001412/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001413 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001414 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001415 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001416 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001417 * @return The current gamma ramp, or `NULL` if an
1418 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001419 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001420 * @par Pointer Lifetime
1421 * The returned structure and its arrays are allocated and freed by GLFW. You
1422 * should not free them yourself. They are valid until the specified monitor
Camilla Berglund6be821c2014-10-06 23:18:33 +02001423 * is disconnected, this function is called again for that monitor or the
1424 * library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001425 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001426 * @par Thread Safety
1427 * This function may only be called from the main thread.
1428 *
1429 * @sa @ref monitor_gamma
1430 *
1431 * @par History
1432 * Added in GLFW 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001433 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001434 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001435 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001436GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001437
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001438/*! @brief Sets the current gamma ramp for the specified monitor.
1439 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001440 * This function sets the current gamma ramp for the specified monitor. The
1441 * original gamma ramp for that monitor is saved by GLFW the first time this
1442 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001443 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001444 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001445 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001446 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001447 * @note Gamma ramp sizes other than 256 are not supported by all hardware.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001448 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001449 * @par Pointer Lifetime
1450 * The specified gamma ramp is copied before this function returns.
1451 *
1452 * @par Thread Safety
1453 * This function may only be called from the main thread.
1454 *
1455 * @sa @ref monitor_gamma
1456 *
1457 * @par History
1458 * Added in GLFW 3.0.
1459 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001460 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001461 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001462GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001463
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001464/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001465 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001466 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001467 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001468 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001469 * @par Thread Safety
1470 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001471 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001472 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001473 * @sa glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001474 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001475 * @par History
1476 * Added in GLFW 3.0.
1477 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001478 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001479 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001480GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001481
1482/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001483 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001484 * This function sets hints for the next call to @ref glfwCreateWindow. The
1485 * hints, once set, retain their values until changed by a call to @ref
1486 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02001487 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01001488 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001489 * @param[in] target The [window hint](@ref window_hints) to set.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001490 * @param[in] hint The new value of the window hint.
1491 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001492 * @par Thread Safety
1493 * This function may only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01001494 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001495 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001496 * @sa glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001497 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001498 * @par History
1499 * Added in GLFW 2.2.
1500 *
1501 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001502 * __GLFW 3:__ Renamed from `glfwOpenWindowHint`. Hints are no longer reset to
Camilla Berglund4591ad22014-09-18 15:03:29 +02001503 * default values on window creation.
1504 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001505 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001506 */
Camilla Berglundaff30d02012-08-06 17:56:41 +02001507GLFWAPI void glfwWindowHint(int target, int hint);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001508
1509/*! @brief Creates a window and its associated context.
1510 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001511 * This function creates a window and its associated OpenGL or OpenGL ES
1512 * context. Most of the options controlling how the window and its context
1513 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001514 *
1515 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02001516 * can use the newly created context, you need to
1517 * [make it current](@ref context_current). For information about the `share`
1518 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001519 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001520 * The created window, framebuffer and context may differ from what you
1521 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001522 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001523 * window, especially for full screen windows. To query the actual attributes
1524 * of the created window, framebuffer and context, use queries like @ref
1525 * glfwGetWindowAttrib and @ref glfwGetWindowSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001526 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001527 * To create a full screen window, you need to specify the monitor the window
1528 * will cover. If no monitor is specified, windowed mode will be used. Unless
1529 * you have a way for the user to choose a specific monitor, it is recommended
Camilla Berglund4591ad22014-09-18 15:03:29 +02001530 * that you pick the primary monitor. For more information on how to query
1531 * connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001532 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001533 * For full screen windows, the specified size becomes the resolution of the
1534 * window's _desired video mode_. As long as a full screen window has input
1535 * focus, the supported video mode most closely matching the desired video mode
1536 * is set for the specified monitor. For more information about full screen
1537 * windows, including the creation of so called _windowed full screen_ or
1538 * _borderless full screen_ windows, see @ref window_full_screen.
1539 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001540 * By default, newly created windows use the placement recommended by the
1541 * window system. To create the window at a specific position, make it
Camilla Berglund95654cf2014-10-02 17:35:10 +02001542 * initially invisible using the `GLFW_VISIBLE` window hint, set its
1543 * [position](@ref window_pos) and then [show](@ref window_hide) it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001544 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001545 * If a full screen window is focused, the screensaver is prohibited from
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001546 * starting.
1547 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001548 * Window systems put limits on window sizes. Very large or very small window
1549 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02001550 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001551 *
1552 * The [swap interval](@ref window_swap) is not set during window creation and
1553 * the initial value may vary depending on driver settings and defaults.
1554 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001555 * @param[in] width The desired width, in screen coordinates, of the window.
1556 * This must be greater than zero.
1557 * @param[in] height The desired height, in screen coordinates, of the window.
1558 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001559 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001560 * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001561 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001562 * @param[in] share The window whose context to share resources with, or `NULL`
1563 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001564 * @return The handle of the created window, or `NULL` if an
1565 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001566 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001567 * @remarks __Windows:__ Window creation will fail if the Microsoft GDI
Camilla Berglund07db5da2013-09-26 19:15:36 +02001568 * software OpenGL implementation is the only one available.
1569 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001570 * @remarks __Windows:__ If the executable has an icon resource named
Camilla Berglund71d2b572013-03-12 15:33:05 +01001571 * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is
1572 * present, the `IDI_WINLOGO` icon will be used instead.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001573 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001574 * @remarks __OS X:__ The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01001575 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001576 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001577 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1578 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001579 *
Camilla Berglund96d230b2014-10-07 02:15:36 +02001580 * @remarks __OS X:__ The first time a window is created the menu bar is
1581 * populated with common commands like Hide, Quit and About. The About entry
1582 * opens a minimal about dialog with information from the application's bundle.
1583 * The menu bar can be disabled with a
1584 * [compile-time option](@ref compile_options_osx).
Camilla Berglund4591ad22014-09-18 15:03:29 +02001585 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001586 * @remarks __X11:__ There is no mechanism for setting the window icon yet.
Camilla Berglundb9fb45f2013-10-27 11:03:47 +01001587 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001588 * @remarks __X11:__ Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001589 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02001590 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001591 * @note This function may not be called from a callback.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001592 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001593 * @par Thread Safety
1594 * This function may only be called from the main thread.
1595 *
1596 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001597 * @sa glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001598 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001599 * @par History
1600 * Added in GLFW 1.0.
1601 *
1602 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001603 * __GLFW 3:__ Renamed from `glfwOpenWindow`. Complete signature overhaul.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001604 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001605 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001606 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001607GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001608
1609/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001610 *
1611 * This function destroys the specified window and its context. On calling
1612 * this function, no further callbacks will be called for that window.
1613 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001614 * If the context of the specified window is current on the main thread, it is
1615 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001616 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001617 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001618 *
Camilla Berglundb48128f2013-02-14 18:49:03 +01001619 * @note This function may not be called from a callback.
1620 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001621 * @note The context of the specified window must not be current on any other
1622 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001623 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001624 * @par Thread Safety
1625 * This function may only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001626 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001627 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001628 * @sa glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001629 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001630 * @par History
1631 * Added in GLFW 1.0.
1632 *
1633 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001634 * __GLFW 3:__ Renamed from `glfwCloseWindow`. Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001635 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001636 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001637 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001638GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001639
Camilla Berglund64afb192013-03-06 23:29:37 +01001640/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001641 *
1642 * This function returns the value of the close flag of the specified window.
1643 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001644 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01001645 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001646 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001647 * @par Thread Safety
1648 * This function may be called from any thread. Access is not synchronized.
1649 *
1650 * @sa @ref window_close
1651 *
1652 * @par History
1653 * Added in GLFW 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001654 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001655 * @ingroup window
1656 */
1657GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1658
Camilla Berglund64afb192013-03-06 23:29:37 +01001659/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001660 *
1661 * This function sets the value of the close flag of the specified window.
1662 * This can be used to override the user's attempt to close the window, or
1663 * to signal that it should be closed.
1664 *
Camilla Berglund64afb192013-03-06 23:29:37 +01001665 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01001666 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001667 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001668 * @par Thread Safety
1669 * This function may be called from any thread. Access is not synchronized.
1670 *
1671 * @sa @ref window_close
1672 *
1673 * @par History
1674 * Added in GLFW 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001675 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001676 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01001677 */
1678GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1679
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001680/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001681 *
1682 * This function sets the window title, encoded as UTF-8, of the specified
1683 * window.
1684 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001685 * @param[in] window The window whose title to change.
1686 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001687 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001688 * @par Thread Safety
1689 * This function may only be called from the main thread.
1690 *
1691 * @sa @ref window_title
1692 *
1693 * @par History
1694 * Added in GLFW 1.0.
1695 *
1696 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001697 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001698 *
1699 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001700 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001701GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001702
Camilla Berglund7c193232013-01-24 19:30:31 +01001703/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001704 *
1705 * This function retrieves the position, in screen coordinates, of the
1706 * upper-left corner of the client area of the specified window.
1707 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001708 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1709 * non-`NULL` position arguments will be set to zero.
1710 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001711 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001712 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
1713 * the client area, or `NULL`.
1714 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
1715 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01001716 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001717 * @par Thread Safety
1718 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001719 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001720 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01001721 * @sa glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001722 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001723 * @par History
1724 * Added in GLFW 3.0.
1725 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001726 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001727 */
1728GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
1729
1730/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001731 *
1732 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02001733 * corner of the client area of the specified windowed mode window. If the
1734 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001735 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001736 * @param[in] window The window to query.
1737 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
1738 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01001739 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001740 * @note It is very rarely a good idea to move an already visible window, as it
1741 * will confuse and annoy the user.
1742 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001743 * @note The window manager may put limits on what positions are allowed.
1744 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001745 * @par Thread Safety
1746 * This function may only be called from the main thread.
1747 *
1748 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01001749 * @sa glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001750 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001751 * @par History
1752 * Added in GLFW 1.0.
1753 *
1754 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001755 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001756 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001757 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001758 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01001759GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01001760
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001761/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001762 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001763 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02001764 * of the specified window. If you wish to retrieve the size of the
1765 * framebuffer in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001766 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001767 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1768 * non-`NULL` size arguments will be set to zero.
1769 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001770 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001771 * @param[out] width Where to store the width, in screen coordinates, of the
1772 * client area, or `NULL`.
1773 * @param[out] height Where to store the height, in screen coordinates, of the
1774 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001775 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001776 * @par Thread Safety
1777 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001778 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001779 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001780 * @sa glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001781 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001782 * @par History
1783 * Added in GLFW 1.0.
1784 *
1785 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001786 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001787 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001788 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001789 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001790GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001791
1792/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001793 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001794 * This function sets the size, in screen coordinates, of the client area of
1795 * the specified window.
1796 *
1797 * For full screen windows, this function selects and switches to the resolution
1798 * closest to the specified size, without affecting the window's context. As
1799 * the context is unaffected, the bit depths of the framebuffer remain
1800 * unchanged.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001801 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001802 * @param[in] window The window to resize.
1803 * @param[in] width The desired width of the specified window.
1804 * @param[in] height The desired height of the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001805 *
1806 * @note The window manager may put limits on what window sizes are allowed.
1807 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001808 * @par Thread Safety
1809 * This function may only be called from the main thread.
1810 *
1811 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001812 * @sa glfwGetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001813 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001814 * @par History
1815 * Added in GLFW 1.0.
1816 *
1817 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001818 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001819 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001820 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001821 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001822GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001823
Camilla Berglund34981632013-06-03 12:51:57 +02001824/*! @brief Retrieves the size of the framebuffer of the specified window.
1825 *
1826 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02001827 * specified window. If you wish to retrieve the size of the window in screen
1828 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02001829 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001830 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1831 * non-`NULL` size arguments will be set to zero.
1832 *
Camilla Berglund34981632013-06-03 12:51:57 +02001833 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001834 * @param[out] width Where to store the width, in pixels, of the framebuffer,
1835 * or `NULL`.
1836 * @param[out] height Where to store the height, in pixels, of the framebuffer,
1837 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02001838 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001839 * @par Thread Safety
1840 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001841 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001842 * @sa @ref window_fbsize
Camilla Berglund34981632013-06-03 12:51:57 +02001843 * @sa glfwSetFramebufferSizeCallback
1844 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001845 * @par History
1846 * Added in GLFW 3.0.
1847 *
Camilla Berglund34981632013-06-03 12:51:57 +02001848 * @ingroup window
1849 */
1850GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
1851
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01001852/*! @brief Retrieves the size of the frame of the window.
1853 *
1854 * This function retrieves the size, in screen coordinates, of each edge of the
1855 * frame of the specified window. This size includes the title bar, if the
1856 * window has one. The size of the frame may vary depending on the
1857 * [window-related hints](@ref window_hints_wnd) used to create it.
1858 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001859 * Because this function retrieves the size of each window frame edge and not
1860 * the offset along a particular coordinate axis, the retrieved values will
1861 * always be zero or positive.
1862 *
1863 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1864 * non-`NULL` size arguments will be set to zero.
1865 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01001866 * @param[in] window The window whose frame size to query.
1867 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02001868 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02001869 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02001870 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02001871 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001872 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02001873 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001874 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01001875 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001876 * @par Thread Safety
1877 * This function may only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01001878 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001879 * @sa @ref window_size
1880 *
1881 * @par History
1882 * Added in GLFW 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01001883 *
1884 * @ingroup window
1885 */
1886GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
1887
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001888/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001889 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001890 * This function iconifies (minimizes) the specified window if it was
1891 * previously restored. If the window is already iconified, this function does
1892 * nothing.
1893 *
1894 * If the specified window is a full screen window, the original monitor
1895 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001896 *
1897 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001898 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001899 * @par Thread Safety
1900 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001901 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001902 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001903 * @sa glfwRestoreWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001904 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001905 * @par History
1906 * Added in GLFW 2.1.
1907 *
1908 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001909 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001910 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001911 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001912 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001913GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001914
1915/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001916 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001917 * This function restores the specified window if it was previously iconified
1918 * (minimized). If the window is already restored, this function does nothing.
1919 *
1920 * If the specified window is a full screen window, the resolution chosen for
1921 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001922 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001923 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001924 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001925 * @par Thread Safety
1926 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001927 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001928 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001929 * @sa glfwIconifyWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01001930 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001931 * @par History
1932 * Added in GLFW 2.1.
1933 *
1934 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001935 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001936 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001937 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001938 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001939GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001940
1941/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001942 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001943 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001944 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01001945 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001946 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001947 * @param[in] window The window to make visible.
1948 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001949 * @par Thread Safety
1950 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001951 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001952 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001953 * @sa glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001954 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001955 * @par History
1956 * Added in GLFW 3.0.
1957 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001958 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001959 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001960GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001961
1962/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001963 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001964 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001965 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001966 * nothing.
1967 *
1968 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001969 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001970 * @par Thread Safety
1971 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001972 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001973 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001974 * @sa glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001975 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001976 * @par History
1977 * Added in GLFW 3.0.
1978 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001979 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001980 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001981GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001982
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001983/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001984 *
1985 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001986 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001987 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001988 * @param[in] window The window to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001989 * @return The monitor, or `NULL` if the window is in windowed mode or an error
1990 * occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001991 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001992 * @par Thread Safety
1993 * This function may only be called from the main thread.
1994 *
1995 * @sa @ref window_monitor
1996 *
1997 * @par History
1998 * Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001999 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002000 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002001 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002002GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002003
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002004/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002005 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002006 * This function returns the value of an attribute of the specified window or
2007 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002008 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002009 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002010 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2011 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002012 * @return The value of the attribute, or zero if an
2013 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002014 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002015 * @par Thread Safety
2016 * This function may only be called from the main thread.
2017 *
2018 * @sa @ref window_attribs
2019 *
2020 * @par History
2021 * Added in GLFW 1.0.
2022 *
2023 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002024 * __GLFW 3:__ Renamed from `glfwGetWindowParam`. Added window handle
Camilla Berglund4591ad22014-09-18 15:03:29 +02002025 * parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01002026 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002027 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002028 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002029GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002030
2031/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002032 *
2033 * This function sets the user-defined pointer of the specified window. The
2034 * current value is retained until the window is destroyed. The initial value
2035 * is `NULL`.
2036 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002037 * @param[in] window The window whose pointer to set.
2038 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002039 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002040 * @par Thread Safety
2041 * This function may be called from any thread. Access is not synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002042 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002043 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002044 * @sa glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002045 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002046 * @par History
2047 * Added in GLFW 3.0.
2048 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002049 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002050 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002051GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002052
2053/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002054 *
2055 * This function returns the current value of the user-defined pointer of the
2056 * specified window. The initial value is `NULL`.
2057 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002058 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002059 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002060 * @par Thread Safety
2061 * This function may be called from any thread. Access is not synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002062 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002063 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002064 * @sa glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002065 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002066 * @par History
2067 * Added in GLFW 3.0.
2068 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002069 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002070 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002071GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002072
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002073/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002074 *
2075 * This function sets the position callback of the specified window, which is
2076 * called when the window is moved. The callback is provided with the screen
2077 * position of the upper-left corner of the client area of the window.
2078 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002079 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002080 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002081 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002082 * @return The previously set callback, or `NULL` if no callback was set or the
2083 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002084 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002085 * @par Thread Safety
2086 * This function may only be called from the main thread.
2087 *
2088 * @sa @ref window_pos
2089 *
2090 * @par History
2091 * Added in GLFW 3.0.
2092 *
2093 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002094 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002095 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002096 * @ingroup window
2097 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002098GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002099
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002100/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002101 *
2102 * This function sets the size callback of the specified window, which is
2103 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002104 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002105 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002106 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002107 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002108 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002109 * @return The previously set callback, or `NULL` if no callback was set or the
2110 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002111 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002112 * @par Thread Safety
2113 * This function may only be called from the main thread.
2114 *
2115 * @sa @ref window_size
2116 *
2117 * @par History
2118 * Added in GLFW 1.0.
2119 *
2120 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002121 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002122 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002123 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002124 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002125GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002126
2127/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002128 *
2129 * This function sets the close callback of the specified window, which is
2130 * called when the user attempts to close the window, for example by clicking
2131 * the close widget in the title bar.
2132 *
2133 * The close flag is set before this callback is called, but you can modify it
2134 * at any time with @ref glfwSetWindowShouldClose.
2135 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002136 * The close callback is not triggered by @ref glfwDestroyWindow.
2137 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002138 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002139 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002140 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002141 * @return The previously set callback, or `NULL` if no callback was set or the
2142 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002143 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002144 * @remarks __OS X:__ Selecting Quit from the application menu will
Camilla Berglund1bd59842013-01-13 21:28:18 +01002145 * trigger the close callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002146 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002147 * @par Thread Safety
2148 * This function may only be called from the main thread.
2149 *
2150 * @sa @ref window_close
2151 *
2152 * @par History
2153 * Added in GLFW 2.5.
2154 *
2155 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002156 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002157 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002158 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002159 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002160GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002161
2162/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002163 *
2164 * This function sets the refresh callback of the specified window, which is
2165 * called when the client area of the window needs to be redrawn, for example
2166 * if the window has been exposed after having been covered by another window.
2167 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002168 * On compositing window systems such as Aero, Compiz or Aqua, where the window
2169 * contents are saved off-screen, this callback may be called only very
2170 * infrequently or never at all.
2171 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002172 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002173 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002174 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002175 * @return The previously set callback, or `NULL` if no callback was set or the
2176 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002177 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002178 * @par Thread Safety
2179 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002180 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002181 * @sa @ref window_refresh
2182 *
2183 * @par History
2184 * Added in GLFW 2.5.
2185 *
2186 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002187 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002188 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002189 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002190 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002191GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002192
2193/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002194 *
2195 * This function sets the focus callback of the specified window, which is
2196 * called when the window gains or loses focus.
2197 *
Camilla Berglund4538a522013-04-24 19:49:46 +02002198 * After the focus callback is called for a window that lost focus, synthetic
2199 * key and mouse button release events will be generated for all such that had
2200 * been pressed. For more information, see @ref glfwSetKeyCallback and @ref
2201 * glfwSetMouseButtonCallback.
2202 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002203 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002204 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002205 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002206 * @return The previously set callback, or `NULL` if no callback was set or the
2207 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002208 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002209 * @par Thread Safety
2210 * This function may only be called from the main thread.
2211 *
2212 * @sa @ref window_focus
2213 *
2214 * @par History
2215 * Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002216 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002217 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002218 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002219GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002220
2221/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002222 *
2223 * This function sets the iconification callback of the specified window, which
2224 * is called when the window is iconified or restored.
2225 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002226 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002227 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002228 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002229 * @return The previously set callback, or `NULL` if no callback was set or the
2230 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002231 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002232 * @par Thread Safety
2233 * This function may only be called from the main thread.
2234 *
2235 * @sa @ref window_iconify
2236 *
2237 * @par History
2238 * Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002239 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002240 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002241 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002242GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02002243
Camilla Berglund34981632013-06-03 12:51:57 +02002244/*! @brief Sets the framebuffer resize callback for the specified window.
2245 *
2246 * This function sets the framebuffer resize callback of the specified window,
2247 * which is called when the framebuffer of the specified window is resized.
2248 *
2249 * @param[in] window The window whose callback to set.
2250 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2251 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002252 * @return The previously set callback, or `NULL` if no callback was set or the
2253 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02002254 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002255 * @par Thread Safety
2256 * This function may only be called from the main thread.
2257 *
2258 * @sa @ref window_fbsize
2259 *
2260 * @par History
2261 * Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002262 *
Camilla Berglund34981632013-06-03 12:51:57 +02002263 * @ingroup window
2264 */
2265GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
2266
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002267/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002268 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002269 * This function processes only those events that are already in the event
2270 * queue and then returns immediately. Processing events will cause the window
2271 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002272 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002273 * On some platforms, a window move, resize or menu operation will cause event
2274 * processing to block. This is due to how event processing is designed on
2275 * those platforms. You can use the
2276 * [window refresh callback](@ref window_refresh) to redraw the contents of
2277 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002278 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002279 * On some platforms, certain events are sent directly to the application
2280 * without going through the event queue, causing callbacks to be called
2281 * outside of a call to one of the event processing functions.
Camilla Berglund401033c2013-03-12 19:17:07 +01002282 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002283 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002284 *
Camilla Berglundb48128f2013-02-14 18:49:03 +01002285 * @note This function may not be called from a callback.
2286 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002287 * @par Thread Safety
2288 * This function may only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02002289 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002290 * @sa @ref input_event
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002291 * @sa glfwWaitEvents
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002292 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002293 * @par History
2294 * Added in GLFW 1.0.
2295 *
2296 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002297 * __GLFW 3:__ This function is no longer called by @ref glfwSwapBuffers.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002298 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002299 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002300 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002301GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002302
Camilla Berglund4591ad22014-09-18 15:03:29 +02002303/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002304 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002305 * This function puts the calling thread to sleep until at least one event is
2306 * available in the event queue. Once one or more events are available,
2307 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
2308 * are processed and the function then returns immediately. Processing events
2309 * will cause the window and input callbacks associated with those events to be
2310 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02002311 *
2312 * Since not all events are associated with callbacks, this function may return
2313 * without a callback having been called even if you are monitoring all
2314 * callbacks.
2315 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002316 * On some platforms, a window move, resize or menu operation will cause event
2317 * processing to block. This is due to how event processing is designed on
2318 * those platforms. You can use the
2319 * [window refresh callback](@ref window_refresh) to redraw the contents of
2320 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002321 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002322 * If no windows exist, this function returns immediately. For synchronization
2323 * of threads in applications that do not create windows, use your threading
2324 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01002325 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002326 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002327 *
Camilla Berglundb48128f2013-02-14 18:49:03 +01002328 * @note This function may not be called from a callback.
2329 *
Camilla Berglund948cc042013-04-16 02:02:22 +02002330 * @note On some platforms, certain callbacks may be called outside of a call
2331 * to one of the event processing functions.
2332 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002333 * @par Thread Safety
2334 * This function may only be called from the main thread.
2335 *
2336 * @sa @ref input_event
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002337 * @sa glfwPollEvents
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002338 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002339 * @par History
2340 * Added in GLFW 2.5.
2341 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002342 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002343 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002344GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02002345
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002346/*! @brief Posts an empty event to the event queue.
2347 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002348 * This function posts an empty event from the current thread to the event
2349 * queue, causing @ref glfwWaitEvents to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002350 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002351 * If no windows exist, this function returns immediately. For synchronization
2352 * of threads in applications that do not create windows, use your threading
2353 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002354 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002355 * @par Thread Safety
2356 * This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002357 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002358 * @sa @ref input_event
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002359 * @sa glfwWaitEvents
2360 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002361 * @par History
2362 * Added in GLFW 3.1.
2363 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002364 * @ingroup window
2365 */
2366GLFWAPI void glfwPostEmptyEvent(void);
2367
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002368/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002369 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002370 * This function returns the value of an input option for the specified window.
2371 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2372 * `GLFW_STICKY_MOUSE_BUTTONS`.
2373 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002374 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02002375 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002376 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002377 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002378 * @par Thread Safety
2379 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002380 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002381 * @sa glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002382 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002383 * @par History
2384 * Added in GLFW 3.0.
2385 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002386 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002387 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002388GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002389
2390/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002391 *
2392 * This function sets an input mode option for the specified window. The mode
2393 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund71d2b572013-03-12 15:33:05 +01002394 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002395 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002396 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002397 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02002398 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
2399 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglunda18b1872013-12-05 03:27:12 +01002400 * area of the window but does not restrict the cursor from leaving. This is
2401 * useful if you wish to render your own cursor or have no visible cursor at
2402 * all.
2403 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
2404 * and unlimited cursor movement. This is useful for implementing for
2405 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002406 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002407 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002408 * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02002409 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
2410 * the next time it is called even if the key had been released before the
2411 * call. This is useful when you are only interested in whether keys have been
2412 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002413 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002414 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
2415 * `GL_TRUE` to enable sticky mouse buttons, or `GL_FALSE` to disable it. If
2416 * sticky mouse buttons are enabled, a mouse button press will ensure that @ref
Camilla Berglund95654cf2014-10-02 17:35:10 +02002417 * glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even if
2418 * the mouse button had been released before the call. This is useful when you
2419 * are only interested in whether mouse buttons have been pressed but not when
2420 * or in which order.
2421 *
2422 * @param[in] window The window whose input mode to set.
2423 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2424 * `GLFW_STICKY_MOUSE_BUTTONS`.
2425 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002426 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002427 * @par Thread Safety
2428 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002429 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002430 * @sa glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01002431 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002432 * @par History
2433 * Added in GLFW 3.0. Replaced `glfwEnable` and `glfwDisable`.
2434 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002435 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002436 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002437GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002438
2439/*! @brief Returns the last reported state of a keyboard key for the specified
2440 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002441 *
2442 * This function returns the last state reported for the specified key to the
2443 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02002444 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002445 * the key callback.
2446 *
2447 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02002448 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
2449 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002450 *
2451 * The key functions deal with physical keys, with [key tokens](@ref keys)
2452 * named after their use on the standard US keyboard layout. If you want to
2453 * input text, use the Unicode character callback instead.
2454 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002455 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
2456 * used with this function.
2457 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002458 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002459 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
2460 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002461 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002462 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002463 * @par Thread Safety
2464 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002465 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002466 * @sa @ref input_key
2467 *
2468 * @par History
2469 * Added in GLFW 1.0.
2470 *
2471 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002472 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02002473 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002474 * @ingroup input
2475 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002476GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002477
2478/*! @brief Returns the last reported state of a mouse button for the specified
2479 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002480 *
2481 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02002482 * to the specified window. The returned state is one of `GLFW_PRESS` or
2483 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
2484 * the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002485 *
2486 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02002487 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
2488 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002489 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002490 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002491 * @param[in] button The desired [mouse button](@ref buttons).
2492 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002493 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002494 * @par Thread Safety
2495 * This function may only be called from the main thread.
2496 *
2497 * @sa @ref input_mouse_button
2498 *
2499 * @par History
2500 * Added in GLFW 1.0.
2501 *
2502 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002503 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01002504 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002505 * @ingroup input
2506 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002507GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002508
2509/*! @brief Retrieves the last reported cursor position, relative to the client
2510 * area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002511 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002512 * This function returns the last reported position of the cursor, in screen
2513 * coordinates, relative to the upper-left corner of the client area of the
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002514 * specified window.
2515 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02002516 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
2517 * position is unbounded and limited only by the minimum and maximum values of
2518 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02002519 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02002520 * The coordinate can be converted to their integer equivalents with the
2521 * `floor` function. Casting directly to an integer type works for positive
2522 * coordinates, but fails for negative ones.
2523 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002524 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2525 * non-`NULL` position arguments will be set to zero.
2526 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002527 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002528 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
2529 * left edge of the client area, or `NULL`.
2530 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
2531 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002532 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002533 * @par Thread Safety
2534 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002535 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002536 * @sa @ref input_cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002537 * @sa glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002538 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002539 * @par History
2540 * Added in GLFW 1.0.
2541 *
2542 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002543 * __GLFW 3:__ Renamed from `glfwGetMousePos`. Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002544 * Moved to floating-point coordinates.
2545 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002546 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002547 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02002548GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002549
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002550/*! @brief Sets the position of the cursor, relative to the client area of the
2551 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002552 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002553 * This function sets the position, in screen coordinates, of the cursor
2554 * relative to the upper-left corner of the client area of the specified
2555 * window. The window must be focused. If the window does not have focus when
2556 * this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002557 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02002558 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
2559 * position is unbounded and limited only by the minimum and maximum values of
2560 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02002561 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002562 * @param[in] window The desired window.
2563 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02002564 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002565 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02002566 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002567 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002568 * @remarks __X11:__ Due to the asynchronous nature of a modern X desktop, it
Camilla Berglund2eb5ed32014-08-31 13:10:06 +02002569 * may take a moment for the window focus event to arrive. This means you will
2570 * not be able to set the cursor position directly after window creation.
2571 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002572 * @par Thread Safety
2573 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002574 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002575 * @sa @ref input_cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002576 * @sa glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002577 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002578 * @par History
2579 * Added in GLFW 1.0.
2580 *
2581 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002582 * __GLFW 3:__ Renamed from `glfwSetMousePos`. Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002583 * Moved to floating-point coordinates.
2584 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002585 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002586 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02002587GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002588
urraka40c04a72013-12-04 10:19:22 -03002589/*! @brief Creates a cursor.
2590 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002591 * Creates a new cursor that can be made the system cursor for a window with
2592 * @ref glfwSetCursor. The cursor can be destroyed with @ref
2593 * glfwDestroyCursor. Any remaining cursors are destroyed by @ref
2594 * glfwTerminate.
2595 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002596 * The image data is 32-bit RGBA, i.e. eight bits per channel. The pixels are
2597 * arranged canonically as sequental rows, starting from the top-left corner.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002598 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01002599 * @param[in] image The desired cursor image.
urraka40c04a72013-12-04 10:19:22 -03002600 * @param[in] xhot The desired x-coordinate of the cursor hotspot.
2601 * @param[in] yhot The desired y-coordinate of the cursor hotspot.
urraka40c04a72013-12-04 10:19:22 -03002602 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002603 * @return A new cursor ready to use or `NULL` if an
2604 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03002605 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002606 * @note This function may not be called from a callback.
2607 *
2608 * @par Pointer Lifetime
2609 * The specified image data is copied before this function returns.
2610 *
2611 * @par Thread Safety
2612 * This function may only be called from the main thread.
2613 *
2614 * @sa @ref input_cursor
2615 * @sa glfwDestroyCursor
2616 *
2617 * @par History
2618 * Added in GLFW 3.1.
urraka40c04a72013-12-04 10:19:22 -03002619 *
2620 * @ingroup input
2621 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01002622GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03002623
2624/*! @brief Destroys a cursor.
2625 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002626 * This function destroys a cursor previously created with @ref
2627 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
2628 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03002629 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002630 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03002631 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002632 * @note This function may not be called from a callback.
2633 *
2634 * @par Thread Safety
2635 * This function may only be called from the main thread.
2636 *
2637 * @sa @ref input_cursor
2638 * @sa glfwCreateCursor
2639 *
2640 * @par History
2641 * Added in GLFW 3.1.
urraka40c04a72013-12-04 10:19:22 -03002642 *
2643 * @ingroup input
2644 */
2645GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
2646
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002647/*! @brief Sets the system cursor for a given window.
urraka40c04a72013-12-04 10:19:22 -03002648 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002649 * This function sets the system cursor for the specified window.
2650 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002651 * @param[in] window The window to set the system cursor for.
2652 * @param[in] cursor The cursor to change to, or `NULL` to switch back
2653 * to the default system cursor.
urraka40c04a72013-12-04 10:19:22 -03002654 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002655 * @par Thread Safety
2656 * This function may only be called from the main thread.
2657 *
2658 * @sa @ref input_cursor
2659 *
2660 * @par History
2661 * Added in GLFW 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01002662 *
urraka40c04a72013-12-04 10:19:22 -03002663 * @ingroup input
2664 */
2665GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
2666
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002667/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002668 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002669 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002670 * when a key is pressed, repeated or released.
2671 *
Camilla Berglund948cc042013-04-16 02:02:22 +02002672 * The key functions deal with physical keys, with layout independent
2673 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002674 * layout. If you want to input text, use the
2675 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002676 *
Camilla Berglund4538a522013-04-24 19:49:46 +02002677 * When a window loses focus, it will generate synthetic key release events
2678 * for all pressed keys. You can tell these events from user-generated events
2679 * by the fact that the synthetic ones are generated after the window has lost
2680 * focus, i.e. `GLFW_FOCUSED` will be false and the focus callback will have
2681 * already been called.
2682 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02002683 * The scancode of a key is specific to that platform or sometimes even to that
2684 * machine. Scancodes are intended to allow users to bind keys that don't have
2685 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02002686 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02002687 *
2688 * Sometimes GLFW needs to generate synthetic key events, in which case the
2689 * scancode may be zero.
2690 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002691 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002692 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002693 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002694 * @return The previously set callback, or `NULL` if no callback was set or the
2695 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002696 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002697 * @par Thread Safety
2698 * This function may only be called from the main thread.
2699 *
2700 * @sa @ref input_key
2701 *
2702 * @par History
2703 * Added in GLFW 1.0.
2704 *
2705 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002706 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002707 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002708 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002709 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002710GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002711
2712/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002713 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002714 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002715 * called when a Unicode character is input.
2716 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02002717 * The character callback is intended for Unicode text input. As it deals with
2718 * characters, it is keyboard layout dependent, whereas the
2719 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
2720 * to physical keys, as a key may produce zero, one or more characters. If you
2721 * want to know whether a specific physical key was pressed or released, see
2722 * the key callback instead.
2723 *
2724 * The character callback behaves as system text input normally does and will
2725 * not be called if modifier keys are held down that would prevent normal text
2726 * input on that platform, for example a Super (Command) key on OS X or Alt key
2727 * on Windows. There is a
2728 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
2729 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002730 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002731 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002732 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002733 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002734 * @return The previously set callback, or `NULL` if no callback was set or the
2735 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002736 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002737 * @par Thread Safety
2738 * This function may only be called from the main thread.
2739 *
2740 * @sa @ref input_char
2741 *
2742 * @par History
2743 * Added in GLFW 2.4.
2744 *
2745 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002746 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002747 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002748 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002749 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002750GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002751
Camilla Berglund96b12ee2014-06-12 23:04:20 +02002752/*! @brief Sets the Unicode character with modifiers callback.
2753 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002754 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02002755 * window, which is called when a Unicode character is input regardless of what
2756 * modifier keys are used.
2757 *
2758 * The character with modifiers callback is intended for implementing custom
2759 * Unicode character input. For regular Unicode text input, see the
2760 * [character callback](@ref glfwSetCharCallback). Like the character
2761 * callback, the character with modifiers callback deals with characters and is
2762 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
2763 * a key may produce zero, one or more characters. If you want to know whether
2764 * a specific physical key was pressed or released, see the
2765 * [key callback](@ref glfwSetKeyCallback) instead.
2766 *
2767 * @param[in] window The window whose callback to set.
2768 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2769 * callback.
2770 * @return The previously set callback, or `NULL` if no callback was set or an
2771 * error occurred.
2772 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002773 * @par Thread Safety
2774 * This function may only be called from the main thread.
2775 *
2776 * @sa @ref input_char
2777 *
2778 * @par History
2779 * Added in GLFW 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02002780 *
2781 * @ingroup input
2782 */
2783GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
2784
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002785/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002786 *
2787 * This function sets the mouse button callback of the specified window, which
2788 * is called when a mouse button is pressed or released.
2789 *
Camilla Berglund4538a522013-04-24 19:49:46 +02002790 * When a window loses focus, it will generate synthetic mouse button release
2791 * events for all pressed mouse buttons. You can tell these events from
2792 * user-generated events by the fact that the synthetic ones are generated
2793 * after the window has lost focus, i.e. `GLFW_FOCUSED` will be false and the
2794 * focus callback will have already been called.
2795 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002796 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002797 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002798 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002799 * @return The previously set callback, or `NULL` if no callback was set or the
2800 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002801 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002802 * @par Thread Safety
2803 * This function may only be called from the main thread.
2804 *
2805 * @sa @ref input_mouse_button
2806 *
2807 * @par History
2808 * Added in GLFW 1.0.
2809 *
2810 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002811 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002812 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002813 * @ingroup input
2814 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002815GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002816
2817/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002818 *
2819 * This function sets the cursor position callback of the specified window,
2820 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002821 * position, in screen coordinates, relative to the upper-left corner of the
2822 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002823 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002824 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002825 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002826 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002827 * @return The previously set callback, or `NULL` if no callback was set or the
2828 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002829 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002830 * @par Thread Safety
2831 * This function may only be called from the main thread.
2832 *
2833 * @sa @ref input_cursor_pos
2834 *
2835 * @par History
2836 * Added in GLFW 1.0.
2837 *
2838 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002839 * __GLFW 3:__ Renamed from `glfwSetMousePosCallback`. Added window handle
Camilla Berglund4591ad22014-09-18 15:03:29 +02002840 * parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002841 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002842 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002843 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002844GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002845
2846/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002847 *
2848 * This function sets the cursor boundary crossing callback of the specified
2849 * window, which is called when the cursor enters or leaves the client area of
2850 * the window.
2851 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002852 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002853 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002854 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002855 * @return The previously set callback, or `NULL` if no callback was set or the
2856 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002857 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002858 * @par Thread Safety
2859 * This function may only be called from the main thread.
2860 *
2861 * @sa @ref input_cursor_enter
2862 *
2863 * @par History
2864 * Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002865 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002866 * @ingroup input
2867 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002868GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002869
2870/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01002871 *
2872 * This function sets the scroll callback of the specified window, which is
2873 * called when a scrolling device is used, such as a mouse wheel or scrolling
2874 * area of a touchpad.
2875 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002876 * The scroll callback receives all scrolling input, like that from a mouse
2877 * wheel or a touchpad scrolling area.
2878 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002879 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002880 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002881 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002882 * @return The previously set callback, or `NULL` if no callback was set or the
2883 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002884 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002885 * @par Thread Safety
2886 * This function may only be called from the main thread.
2887 *
2888 * @sa @ref input_scroll
2889 *
2890 * @par History
2891 * Added in GLFW 2.1.
2892 *
2893 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002894 * __GLFW 3:__ Renamed from `glfwSetMouseWheelCallback`. Added window handle.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002895 * Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002896 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002897 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002898 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002899GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02002900
Camilla Berglund5c8121e2014-03-29 21:35:21 +01002901/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02002902 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01002903 * This function sets the file drop callback of the specified window, which is
2904 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02002905 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002906 * Because the path array and its strings may have been generated specifically
2907 * for that event, they are not guaranteed to be valid after the callback has
2908 * returned. If you wish to use them after the callback returns, you need to
2909 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02002910 *
2911 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01002912 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
2913 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002914 * @return The previously set callback, or `NULL` if no callback was set or the
2915 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02002916 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002917 * @par Thread Safety
2918 * This function may only be called from the main thread.
2919 *
2920 * @sa @ref input_drop
2921 *
2922 * @par History
2923 * Added in GLFW 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01002924 *
arturo89d07232013-07-10 11:42:14 +02002925 * @ingroup input
2926 */
2927GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
2928
Camilla Berglundfdd45182013-05-27 15:13:09 +02002929/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002930 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02002931 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002932 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002933 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglundfdd45182013-05-27 15:13:09 +02002934 * @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002935 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002936 * @par Thread Safety
2937 * This function may only be called from the main thread.
2938 *
2939 * @sa @ref input_joy
2940 *
2941 * @par History
2942 * Added in GLFW 3.0. Replaced `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002943 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002944 * @ingroup input
2945 */
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002946GLFWAPI int glfwJoystickPresent(int joy);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002947
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002948/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002949 *
2950 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002951 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002952 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002953 * @param[in] joy The [joystick](@ref joysticks) to query.
2954 * @param[out] count Where to store the number of axis values in the returned
2955 * array. This is set to zero if an error occurred.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002956 * @return An array of axis values, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002957 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002958 * @par Pointer Lifetime
2959 * The returned array is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02002960 * yourself. It is valid until the specified joystick is disconnected, this
2961 * function is called again for that joystick or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01002962 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002963 * @par Thread Safety
2964 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002965 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002966 * @sa @ref input_joy_axis
2967 *
2968 * @par History
2969 * Added in GLFW 2.2.
2970 *
2971 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002972 * __GLFW 3:__ Renamed from `glfwGetJoystickPos`. Changed to return a dynamic
Camilla Berglund4591ad22014-09-18 15:03:29 +02002973 * array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002974 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002975 * @ingroup input
2976 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02002977GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002978
Camilla Berglunde93bade2013-06-16 02:33:33 +02002979/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002980 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02002981 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002982 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002983 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002984 * @param[in] joy The [joystick](@ref joysticks) to query.
2985 * @param[out] count Where to store the number of button states in the returned
2986 * array. This is set to zero if an error occurred.
Camilla Berglunde93bade2013-06-16 02:33:33 +02002987 * @return An array of button states, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02002988 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002989 * @par Pointer Lifetime
2990 * The returned array is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02002991 * yourself. It is valid until the specified joystick is disconnected, this
2992 * function is called again for that joystick or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01002993 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002994 * @par Thread Safety
2995 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002996 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002997 * @sa @ref input_joy_button
2998 *
2999 * @par History
3000 * Added in GLFW 2.2.
3001 *
3002 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02003003 * __GLFW 3:__ Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003004 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003005 * @ingroup input
3006 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003007GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02003008
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003009/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003010 *
3011 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003012 * The returned string is allocated and freed by GLFW. You should not free it
3013 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003014 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003015 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003016 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003017 * is not present.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01003018 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003019 * @par Pointer Lifetime
3020 * The returned string is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02003021 * yourself. It is valid until the specified joystick is disconnected, this
3022 * function is called again for that joystick or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003023 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003024 * @par Thread Safety
3025 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003026 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003027 * @sa @ref input_joy_name
3028 *
3029 * @par History
3030 * Added in GLFW 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003031 *
3032 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003033 */
Camilla Berglund93a1d1c2012-09-07 01:01:34 +02003034GLFWAPI const char* glfwGetJoystickName(int joy);
Camilla Berglund3249f812010-09-07 17:34:51 +02003035
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003036/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003037 *
3038 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02003039 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003040 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003041 * @param[in] window The window that will own the clipboard contents.
3042 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003043 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003044 * @par Pointer Lifetime
3045 * The specified string is copied before this function returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003046 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003047 * @par Thread Safety
3048 * This function may only be called from the main thread.
3049 *
3050 * @sa @ref input_clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003051 * @sa glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003052 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003053 * @par History
3054 * Added in GLFW 3.0.
3055 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003056 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003057 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003058GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003059
Camilla Berglund4591ad22014-09-18 15:03:29 +02003060/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003061 *
3062 * This function returns the contents of the system clipboard, if it contains
3063 * or is convertible to a UTF-8 encoded string.
3064 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003065 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003066 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02003067 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003068 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003069 * @par Pointer Lifetime
3070 * The returned string is allocated and freed by GLFW. You should not free it
3071 * yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02003072 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
3073 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003074 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003075 * @par Thread Safety
3076 * This function may only be called from the main thread.
3077 *
3078 * @sa @ref input_clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003079 * @sa glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003080 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003081 * @par History
3082 * Added in GLFW 3.0.
3083 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003084 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003085 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003086GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01003087
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003088/*! @brief Returns the value of the GLFW timer.
3089 *
3090 * This function returns the value of the GLFW timer. Unless the timer has
3091 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
3092 * was initialized.
3093 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003094 * The resolution of the timer is system dependent, but is usually on the order
3095 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
3096 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003097 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003098 * @return The current value, in seconds, or zero if an
3099 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003100 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003101 * @par Thread Safety
3102 * This function may be called from any thread. Access is not synchronized.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003103 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003104 * @sa @ref input_time
3105 *
3106 * @par History
3107 * Added in GLFW 1.0.
3108 *
3109 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003110 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003111GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02003112
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003113/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003114 *
3115 * This function sets the value of the GLFW timer. It then continues to count
3116 * up from that value.
3117 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003118 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003119 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003120 * @par Thread Safety
3121 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003122 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003123 * @sa @ref input_time
Camilla Berglunde248fb62013-03-29 14:06:23 +01003124 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003125 * @par History
3126 * Added in GLFW 2.2.
3127 *
3128 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003129 */
3130GLFWAPI void glfwSetTime(double time);
3131
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003132/*! @brief Makes the context of the specified window current for the calling
3133 * thread.
3134 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003135 * This function makes the OpenGL or OpenGL ES context of the specified window
3136 * current on the calling thread. A context can only be made current on
3137 * a single thread at a time and each thread can have only a single current
3138 * context at a time.
3139 *
3140 * By default, making a context non-current implicitly forces a pipeline flush.
3141 * On machines that support `GL_KHR_context_flush_control`, you can control
3142 * whether a context performs this flush by setting the
3143 * `GLFW_CONTEXT_RELEASE_BEHAVIOR` [window hint](@ref window_hints_ctx).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003144 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003145 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003146 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003147 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003148 * @par Thread Safety
3149 * This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003150 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003151 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003152 * @sa glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01003153 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003154 * @par History
3155 * Added in GLFW 3.0.
3156 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003157 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003158 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003159GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003160
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003161/*! @brief Returns the window whose context is current on the calling thread.
3162 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003163 * This function returns the window whose OpenGL or OpenGL ES context is
3164 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003165 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003166 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003167 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003168 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003169 * @par Thread Safety
3170 * This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003171 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003172 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003173 * @sa glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01003174 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003175 * @par History
3176 * Added in GLFW 3.0.
3177 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003178 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003179 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003180GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003181
3182/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003183 *
3184 * This function swaps the front and back buffers of the specified window. If
3185 * the swap interval is greater than zero, the GPU driver waits the specified
3186 * number of screen updates before swapping the buffers.
3187 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003188 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003189 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003190 * @par Thread Safety
3191 * This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01003192 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003193 * @sa @ref window_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003194 * @sa glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01003195 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003196 * @par History
3197 * Added in GLFW 1.0.
3198 *
3199 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02003200 * __GLFW 3:__ Added window handle parameter. Removed call to @ref
Camilla Berglund4591ad22014-09-18 15:03:29 +02003201 * glfwPollEvents.
3202 *
3203 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003204 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003205GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003206
3207/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003208 *
3209 * This function sets the swap interval for the current context, i.e. the
Camilla Berglund4591ad22014-09-18 15:03:29 +02003210 * number of screen updates to wait from the time @ref glfwSwapBuffers was
3211 * called before swapping the buffers and returning. This is sometimes called
3212 * 'vertical synchronization', 'vertical retrace synchronization' or 'vsync'.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003213 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003214 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003215 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
3216 * which allow the driver to swap even if a frame arrives a little bit late.
3217 * You can check for the presence of these extensions using @ref
3218 * glfwExtensionSupported. For more information about swap tearing, see the
3219 * extension specifications.
3220 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003221 * A context must be current on the calling thread. Calling this function
3222 * without a current context will cause a `GLFW_NO_CURRENT_CONTEXT` error.
3223 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003224 * @param[in] interval The minimum number of screen updates to wait for
3225 * until the buffers are swapped by @ref glfwSwapBuffers.
3226 *
Camilla Berglund3af1c412013-09-19 21:37:01 +02003227 * @note This function is not called during window creation, leaving the swap
3228 * interval set to whatever is the default on that platform. This is done
3229 * because some swap interval extensions used by GLFW do not allow the swap
3230 * interval to be reset to zero once it has been set to a non-zero value.
3231 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003232 * @note Some GPU drivers do not honor the requested swap interval, either
3233 * because of user settings that override the request or due to bugs in the
3234 * driver.
3235 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003236 * @par Thread Safety
3237 * This function may be called from any thread.
3238 *
3239 * @sa @ref window_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003240 * @sa glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01003241 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003242 * @par History
3243 * Added in GLFW 1.0.
3244 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003245 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003246 */
3247GLFWAPI void glfwSwapInterval(int interval);
3248
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003249/*! @brief Returns whether the specified extension is available.
3250 *
Camilla Berglund608109c2013-04-11 20:18:46 +02003251 * This function returns whether the specified
Camilla Berglund4591ad22014-09-18 15:03:29 +02003252 * [API extension](@ref context_glext) is supported by the current OpenGL or
3253 * OpenGL ES context. It searches both for OpenGL and OpenGL ES extension and
3254 * platform-specific context creation API extensions.
3255 *
3256 * A context must be current on the calling thread. Calling this function
3257 * without a current context will cause a `GLFW_NO_CURRENT_CONTEXT` error.
3258 *
3259 * As this functions retrieves and searches one or more extension strings each
3260 * call, it is recommended that you cache its results if it is going to be used
3261 * frequently. The extension strings will not change during the lifetime of
3262 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003263 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003264 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003265 * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003266 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003267 * @par Thread Safety
3268 * This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003269 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003270 * @sa @ref context_glext
3271 * @sa glfwGetProcAddress
3272 *
3273 * @par History
3274 * Added in GLFW 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003275 *
3276 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003277 */
3278GLFWAPI int glfwExtensionSupported(const char* extension);
3279
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003280/*! @brief Returns the address of the specified function for the current
3281 * context.
3282 *
Camilla Berglund608109c2013-04-11 20:18:46 +02003283 * This function returns the address of the specified
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02003284 * [client API or extension function](@ref context_glext), if it is supported
3285 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003286 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003287 * A context must be current on the calling thread. Calling this function
3288 * without a current context will cause a `GLFW_NO_CURRENT_CONTEXT` error.
3289 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003290 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003291 * @return The address of the function, or `NULL` if the function is
Camilla Berglund4591ad22014-09-18 15:03:29 +02003292 * unavailable or an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003293 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003294 * @note The addresses of a given function is not guaranteed to be the same
3295 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003296 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003297 * @par Pointer Lifetime
Camilla Berglund6be821c2014-10-06 23:18:33 +02003298 * The returned function pointer is valid until the context is destroyed or the
3299 * library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003300 *
3301 * @par Thread Safety
3302 * This function may be called from any thread.
3303 *
3304 * @sa @ref context_glext
3305 * @sa glfwExtensionSupported
3306 *
3307 * @par History
3308 * Added in GLFW 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003309 *
3310 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003311 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02003312GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02003313
Camilla Berglund3249f812010-09-07 17:34:51 +02003314
Camilla Berglund4afc67c2011-07-27 17:09:17 +02003315/*************************************************************************
3316 * Global definition cleanup
3317 *************************************************************************/
3318
3319/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
3320
Camilla Berglund4afc67c2011-07-27 17:09:17 +02003321#ifdef GLFW_WINGDIAPI_DEFINED
3322 #undef WINGDIAPI
3323 #undef GLFW_WINGDIAPI_DEFINED
3324#endif
3325
3326#ifdef GLFW_CALLBACK_DEFINED
3327 #undef CALLBACK
3328 #undef GLFW_CALLBACK_DEFINED
3329#endif
3330
3331/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
3332
3333
Camilla Berglund3249f812010-09-07 17:34:51 +02003334#ifdef __cplusplus
3335}
3336#endif
3337
Camilla Berglundf8df91d2013-01-15 01:59:56 +01003338#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02003339