blob: 1348785eb1654700a4a7bf0411827904792c6f54 [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund95a07f32015-06-01 22:55:06 +02002 * GLFW 3.2 - 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 Berglund8d910d72015-02-22 18:35:10 +010071 * Compiler- and platform-specific preprocessor work
Camilla Berglund3249f812010-09-07 17:34:51 +020072 *************************************************************************/
73
Camilla Berglund8d910d72015-02-22 18:35:10 +010074/* If we are we on Windows, we want a single define for it.
Camilla Berglund3249f812010-09-07 17:34:51 +020075 */
Camilla Berglunde8ce4ab2015-02-22 18:18:43 +010076#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
Camilla Berglund3249f812010-09-07 17:34:51 +020077 #define _WIN32
78#endif /* _WIN32 */
79
Camilla Berglund8d910d72015-02-22 18:35:10 +010080/* It is customary to use APIENTRY for OpenGL function pointer declarations on
81 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
Camilla Berglund3249f812010-09-07 17:34:51 +020082 */
83#ifndef APIENTRY
84 #ifdef _WIN32
85 #define APIENTRY __stdcall
86 #else
87 #define APIENTRY
88 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +020089#endif /* APIENTRY */
90
Camilla Berglund8d910d72015-02-22 18:35:10 +010091/* Some Windows OpenGL headers need this.
Camilla Berglund3249f812010-09-07 17:34:51 +020092 */
Camilla Berglund3249f812010-09-07 17:34:51 +020093#if !defined(WINGDIAPI) && defined(_WIN32)
Camilla Berglundc5353642015-02-22 18:14:30 +010094 #define WINGDIAPI __declspec(dllimport)
Camilla Berglund4afc67c2011-07-27 17:09:17 +020095 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +020096#endif /* WINGDIAPI */
97
Camilla Berglund8d910d72015-02-22 18:35:10 +010098/* Some Windows GLU headers need this.
99 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200100#if !defined(CALLBACK) && defined(_WIN32)
Camilla Berglundd586fe62015-02-22 18:17:34 +0100101 #define CALLBACK __stdcall
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200102 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200103#endif /* CALLBACK */
104
Camilla Berglund8d910d72015-02-22 18:35:10 +0100105/* Most Windows GLU headers need wchar_t.
106 * The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h.
107 */
Camilla Berglundc93b1202013-09-08 16:07:34 +0200108#if !defined(GLFW_INCLUDE_NONE)
109 #include <stddef.h>
110#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200111
Camilla Berglundc93b1202013-09-08 16:07:34 +0200112/* Include the chosen client API headers.
113 */
114#if defined(__APPLE_CC__)
Camilla Berglund1591caa2015-01-08 06:56:17 +0100115 #if defined(GLFW_INCLUDE_GLCOREARB)
116 #include <OpenGL/gl3.h>
117 #if defined(GLFW_INCLUDE_GLEXT)
118 #include <OpenGL/gl3ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200119 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100120 #elif !defined(GLFW_INCLUDE_NONE)
121 #if !defined(GLFW_INCLUDE_GLEXT)
122 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200123 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100124 #include <OpenGL/gl.h>
125 #endif
126 #if defined(GLFW_INCLUDE_GLU)
127 #include <OpenGL/glu.h>
128 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200129#else
Camilla Berglund1591caa2015-01-08 06:56:17 +0100130 #if defined(GLFW_INCLUDE_GLCOREARB)
131 #include <GL/glcorearb.h>
132 #elif defined(GLFW_INCLUDE_ES1)
133 #include <GLES/gl.h>
134 #if defined(GLFW_INCLUDE_GLEXT)
135 #include <GLES/glext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200136 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100137 #elif defined(GLFW_INCLUDE_ES2)
138 #include <GLES2/gl2.h>
139 #if defined(GLFW_INCLUDE_GLEXT)
140 #include <GLES2/gl2ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200141 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100142 #elif defined(GLFW_INCLUDE_ES3)
143 #include <GLES3/gl3.h>
144 #if defined(GLFW_INCLUDE_GLEXT)
145 #include <GLES3/gl2ext.h>
146 #endif
147 #elif defined(GLFW_INCLUDE_ES31)
148 #include <GLES3/gl31.h>
149 #if defined(GLFW_INCLUDE_GLEXT)
150 #include <GLES3/gl2ext.h>
151 #endif
152 #elif !defined(GLFW_INCLUDE_NONE)
153 #include <GL/gl.h>
154 #if defined(GLFW_INCLUDE_GLEXT)
155 #include <GL/glext.h>
156 #endif
157 #endif
158 #if defined(GLFW_INCLUDE_GLU)
159 #include <GL/glu.h>
160 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200161#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200162
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200163#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200164 /* GLFW_DLL must be defined by applications that are linking against the DLL
165 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
166 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200167 */
Camilla Berglund8f086612015-03-17 16:33:21 +0100168 #error "You may not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200169#endif
170
Camilla Berglund1591caa2015-01-08 06:56:17 +0100171/* GLFWAPI is used to declare public API functions for export
172 * from the DLL / shared library / dynamic library.
173 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200174#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200175 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100176 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200177#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200178 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100179 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100180#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200181 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100182 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200183#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200184 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200185 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200186#endif
187
Camilla Berglund3249f812010-09-07 17:34:51 +0200188
189/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100190 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200191 *************************************************************************/
192
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100193/*! @name GLFW version macros
194 * @{ */
195/*! @brief The major version number of the GLFW library.
196 *
197 * This is incremented when the API is changed in non-compatible ways.
198 * @ingroup init
199 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100200#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100201/*! @brief The minor version number of the GLFW library.
202 *
203 * This is incremented when features are added to the API but it remains
204 * backward-compatible.
205 * @ingroup init
206 */
Camilla Berglund95a07f32015-06-01 22:55:06 +0200207#define GLFW_VERSION_MINOR 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100208/*! @brief The revision number of the GLFW library.
209 *
210 * This is incremented when a bug fix release is made that does not contain any
211 * API changes.
212 * @ingroup init
213 */
Camilla Berglund95a07f32015-06-01 22:55:06 +0200214#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100215/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200216
Camilla Berglund0eccf752015-08-23 19:30:04 +0200217/*! @name Boolean values
218 * @{ */
219/*! @brief One.
220 *
221 * One. Seriously. You don't _need_ to use this symbol in your code. It's
222 * just semantic sugar for the number 1. You can use `1` or `true` or `_True`
223 * or `GL_TRUE` or whatever you want.
224 */
225#define GLFW_TRUE 1
226/*! @brief Zero.
227 *
228 * Zero. Seriously. You don't _need_ to use this symbol in your code. It's
229 * just just semantic sugar for the number 0. You can use `0` or `false` or
230 * `_False` or `GL_FALSE` or whatever you want.
231 */
232#define GLFW_FALSE 0
233/*! @} */
234
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100235/*! @name Key and button actions
236 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200237/*! @brief The key or mouse button was released.
238 *
239 * The key or mouse button was released.
240 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100241 * @ingroup input
242 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100243#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200244/*! @brief The key or mouse button was pressed.
245 *
246 * The key or mouse button was pressed.
247 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100248 * @ingroup input
249 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100250#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100251/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200252 *
253 * The key was held down until it repeated.
254 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100255 * @ingroup input
256 */
257#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100258/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200259
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200260/*! @defgroup keys Keyboard keys
261 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100262 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200263 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100264 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
265 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
266 * put in the 256+ range).
267 *
268 * The naming of the key codes follow these rules:
269 * - The US keyboard layout is used
270 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
271 * "3", etc.)
272 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
273 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
274 * correspond to the Unicode standard (usually for brevity)
275 * - Keys that lack a clear US mapping are named "WORLD_x"
276 * - For non-printable keys, custom names are used (e.g. "F4",
277 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200278 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100279 * @ingroup input
280 * @{
281 */
282
Camilla Berglund11615fc2013-05-30 17:19:12 +0200283/* The unknown key */
284#define GLFW_KEY_UNKNOWN -1
285
Marcusc0cb4c22011-01-02 11:18:14 +0100286/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100287#define GLFW_KEY_SPACE 32
288#define GLFW_KEY_APOSTROPHE 39 /* ' */
289#define GLFW_KEY_COMMA 44 /* , */
290#define GLFW_KEY_MINUS 45 /* - */
291#define GLFW_KEY_PERIOD 46 /* . */
292#define GLFW_KEY_SLASH 47 /* / */
293#define GLFW_KEY_0 48
294#define GLFW_KEY_1 49
295#define GLFW_KEY_2 50
296#define GLFW_KEY_3 51
297#define GLFW_KEY_4 52
298#define GLFW_KEY_5 53
299#define GLFW_KEY_6 54
300#define GLFW_KEY_7 55
301#define GLFW_KEY_8 56
302#define GLFW_KEY_9 57
303#define GLFW_KEY_SEMICOLON 59 /* ; */
304#define GLFW_KEY_EQUAL 61 /* = */
305#define GLFW_KEY_A 65
306#define GLFW_KEY_B 66
307#define GLFW_KEY_C 67
308#define GLFW_KEY_D 68
309#define GLFW_KEY_E 69
310#define GLFW_KEY_F 70
311#define GLFW_KEY_G 71
312#define GLFW_KEY_H 72
313#define GLFW_KEY_I 73
314#define GLFW_KEY_J 74
315#define GLFW_KEY_K 75
316#define GLFW_KEY_L 76
317#define GLFW_KEY_M 77
318#define GLFW_KEY_N 78
319#define GLFW_KEY_O 79
320#define GLFW_KEY_P 80
321#define GLFW_KEY_Q 81
322#define GLFW_KEY_R 82
323#define GLFW_KEY_S 83
324#define GLFW_KEY_T 84
325#define GLFW_KEY_U 85
326#define GLFW_KEY_V 86
327#define GLFW_KEY_W 87
328#define GLFW_KEY_X 88
329#define GLFW_KEY_Y 89
330#define GLFW_KEY_Z 90
331#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
332#define GLFW_KEY_BACKSLASH 92 /* \ */
333#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
334#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
335#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
336#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100337
338/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100339#define GLFW_KEY_ESCAPE 256
340#define GLFW_KEY_ENTER 257
341#define GLFW_KEY_TAB 258
342#define GLFW_KEY_BACKSPACE 259
343#define GLFW_KEY_INSERT 260
344#define GLFW_KEY_DELETE 261
345#define GLFW_KEY_RIGHT 262
346#define GLFW_KEY_LEFT 263
347#define GLFW_KEY_DOWN 264
348#define GLFW_KEY_UP 265
349#define GLFW_KEY_PAGE_UP 266
350#define GLFW_KEY_PAGE_DOWN 267
351#define GLFW_KEY_HOME 268
352#define GLFW_KEY_END 269
353#define GLFW_KEY_CAPS_LOCK 280
354#define GLFW_KEY_SCROLL_LOCK 281
355#define GLFW_KEY_NUM_LOCK 282
356#define GLFW_KEY_PRINT_SCREEN 283
357#define GLFW_KEY_PAUSE 284
358#define GLFW_KEY_F1 290
359#define GLFW_KEY_F2 291
360#define GLFW_KEY_F3 292
361#define GLFW_KEY_F4 293
362#define GLFW_KEY_F5 294
363#define GLFW_KEY_F6 295
364#define GLFW_KEY_F7 296
365#define GLFW_KEY_F8 297
366#define GLFW_KEY_F9 298
367#define GLFW_KEY_F10 299
368#define GLFW_KEY_F11 300
369#define GLFW_KEY_F12 301
370#define GLFW_KEY_F13 302
371#define GLFW_KEY_F14 303
372#define GLFW_KEY_F15 304
373#define GLFW_KEY_F16 305
374#define GLFW_KEY_F17 306
375#define GLFW_KEY_F18 307
376#define GLFW_KEY_F19 308
377#define GLFW_KEY_F20 309
378#define GLFW_KEY_F21 310
379#define GLFW_KEY_F22 311
380#define GLFW_KEY_F23 312
381#define GLFW_KEY_F24 313
382#define GLFW_KEY_F25 314
383#define GLFW_KEY_KP_0 320
384#define GLFW_KEY_KP_1 321
385#define GLFW_KEY_KP_2 322
386#define GLFW_KEY_KP_3 323
387#define GLFW_KEY_KP_4 324
388#define GLFW_KEY_KP_5 325
389#define GLFW_KEY_KP_6 326
390#define GLFW_KEY_KP_7 327
391#define GLFW_KEY_KP_8 328
392#define GLFW_KEY_KP_9 329
393#define GLFW_KEY_KP_DECIMAL 330
394#define GLFW_KEY_KP_DIVIDE 331
395#define GLFW_KEY_KP_MULTIPLY 332
396#define GLFW_KEY_KP_SUBTRACT 333
397#define GLFW_KEY_KP_ADD 334
398#define GLFW_KEY_KP_ENTER 335
399#define GLFW_KEY_KP_EQUAL 336
400#define GLFW_KEY_LEFT_SHIFT 340
401#define GLFW_KEY_LEFT_CONTROL 341
402#define GLFW_KEY_LEFT_ALT 342
403#define GLFW_KEY_LEFT_SUPER 343
404#define GLFW_KEY_RIGHT_SHIFT 344
405#define GLFW_KEY_RIGHT_CONTROL 345
406#define GLFW_KEY_RIGHT_ALT 346
407#define GLFW_KEY_RIGHT_SUPER 347
408#define GLFW_KEY_MENU 348
409#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100410
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100411/*! @} */
412
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200413/*! @defgroup mods Modifier key flags
Camilla Berglund4188c262015-01-18 01:55:25 +0100414 *
415 * See [key input](@ref input_key) for how these are used.
416 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200417 * @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
Camilla Berglund4188c262015-01-18 01:55:25 +0100436 *
437 * See [mouse button input](@ref input_mouse_button) for how these are used.
438 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100439 * @ingroup input
440 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100441#define GLFW_MOUSE_BUTTON_1 0
442#define GLFW_MOUSE_BUTTON_2 1
443#define GLFW_MOUSE_BUTTON_3 2
444#define GLFW_MOUSE_BUTTON_4 3
445#define GLFW_MOUSE_BUTTON_5 4
446#define GLFW_MOUSE_BUTTON_6 5
447#define GLFW_MOUSE_BUTTON_7 6
448#define GLFW_MOUSE_BUTTON_8 7
449#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
450#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
451#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
452#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100453/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200454
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100455/*! @defgroup joysticks Joysticks
Camilla Berglund4188c262015-01-18 01:55:25 +0100456 *
457 * See [joystick input](@ref joystick) for how these are used.
458 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100459 * @ingroup input
460 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100461#define GLFW_JOYSTICK_1 0
462#define GLFW_JOYSTICK_2 1
463#define GLFW_JOYSTICK_3 2
464#define GLFW_JOYSTICK_4 3
465#define GLFW_JOYSTICK_5 4
466#define GLFW_JOYSTICK_6 5
467#define GLFW_JOYSTICK_7 6
468#define GLFW_JOYSTICK_8 7
469#define GLFW_JOYSTICK_9 8
470#define GLFW_JOYSTICK_10 9
471#define GLFW_JOYSTICK_11 10
472#define GLFW_JOYSTICK_12 11
473#define GLFW_JOYSTICK_13 12
474#define GLFW_JOYSTICK_14 13
475#define GLFW_JOYSTICK_15 14
476#define GLFW_JOYSTICK_16 15
477#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100478/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200479
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100480/*! @defgroup errors Error codes
Camilla Berglund4188c262015-01-18 01:55:25 +0100481 *
482 * See [error handling](@ref error_handling) for how these are used.
483 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200484 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100485 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100486/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200487 *
488 * This occurs if a GLFW function was called that may not be called unless the
489 * library is [initialized](@ref intro_init).
490 *
491 * @par Analysis
492 * Application programmer error. Initialize GLFW before calling any function
493 * that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100494 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200495#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100496/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200497 *
498 * This occurs if a GLFW function was called that needs and operates on the
499 * current OpenGL or OpenGL ES context but no context is current on the calling
500 * thread. One such function is @ref glfwSwapInterval.
501 *
502 * @par Analysis
503 * Application programmer error. Ensure a context is current before calling
504 * functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100505 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200506#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200507/*! @brief One of the arguments to the function was an invalid enum value.
508 *
509 * One of the arguments to the function was an invalid enum value, for example
Camilla Berglundce8f97c2015-01-11 23:33:14 +0100510 * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref
511 * glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200512 *
513 * @par Analysis
514 * Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100515 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200516#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200517/*! @brief One of the arguments to the function was an invalid value.
518 *
519 * One of the arguments to the function was an invalid value, for example
520 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
521 *
522 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
523 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
524 *
525 * @par Analysis
526 * Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100527 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200528#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100529/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200530 *
531 * A memory allocation failed.
532 *
533 * @par Analysis
534 * A bug in GLFW or the underlying operating system. Report the bug to our
535 * [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100536 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200537#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100538/*! @brief GLFW could not find support for the requested client API on the
539 * system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200540 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100541 * GLFW could not find support for the requested client API on the system. If
542 * emitted by functions other than @ref glfwCreateWindow, no supported client
543 * API was found.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200544 *
545 * @par Analysis
546 * The installed graphics driver does not support the requested client API, or
547 * does not support it via the chosen context creation backend. Below are
548 * a few examples.
549 *
550 * @par
551 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200552 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200553 * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100554 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200555 * driver.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100556 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200557#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200558/*! @brief The requested OpenGL or OpenGL ES version is not available.
559 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100560 * The requested OpenGL or OpenGL ES version (including any requested context
561 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200562 *
563 * @par Analysis
564 * The machine does not support your requirements. If your application is
565 * sufficiently flexible, downgrade your requirements and try again.
566 * Otherwise, inform the user that their machine does not match your
567 * requirements.
568 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200569 * @par
570 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
571 * comes out before the 4.x series gets that far, also fail with this error and
572 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
573 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100574 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200575#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100576/*! @brief A platform-specific error occurred that does not match any of the
577 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200578 *
579 * A platform-specific error occurred that does not match any of the more
580 * specific categories.
581 *
582 * @par Analysis
Camilla Berglundd493a822015-03-10 19:51:14 +0100583 * A bug or configuration error in GLFW, the underlying operating system or
584 * its drivers, or a lack of required resources. Report the issue to our
Camilla Berglund4591ad22014-09-18 15:03:29 +0200585 * [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100586 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200587#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200588/*! @brief The requested format is not supported or available.
589 *
590 * If emitted during window creation, the requested pixel format is not
591 * supported.
592 *
593 * If emitted when querying the clipboard, the contents of the clipboard could
594 * not be converted to the requested format.
595 *
596 * @par Analysis
597 * If emitted during window creation, one or more
598 * [hard constraints](@ref window_hints_hard) did not match any of the
599 * available pixel formats. If your application is sufficiently flexible,
600 * downgrade your requirements and try again. Otherwise, inform the user that
601 * their machine does not match your requirements.
602 *
603 * @par
604 * If emitted when querying the clipboard, ignore the error or report it to
605 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100606 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200607#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100608/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200609
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100610#define GLFW_FOCUSED 0x00020001
611#define GLFW_ICONIFIED 0x00020002
Camilla Berglund393e4392013-05-27 22:16:59 +0200612#define GLFW_RESIZABLE 0x00020003
613#define GLFW_VISIBLE 0x00020004
614#define GLFW_DECORATED 0x00020005
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200615#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200616#define GLFW_FLOATING 0x00020007
Camilla Berglund2c091572010-09-09 21:09:11 +0200617
Camilla Berglund53b39a62013-05-30 18:55:45 +0200618#define GLFW_RED_BITS 0x00021001
619#define GLFW_GREEN_BITS 0x00021002
620#define GLFW_BLUE_BITS 0x00021003
621#define GLFW_ALPHA_BITS 0x00021004
622#define GLFW_DEPTH_BITS 0x00021005
623#define GLFW_STENCIL_BITS 0x00021006
624#define GLFW_ACCUM_RED_BITS 0x00021007
625#define GLFW_ACCUM_GREEN_BITS 0x00021008
626#define GLFW_ACCUM_BLUE_BITS 0x00021009
627#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
628#define GLFW_AUX_BUFFERS 0x0002100B
629#define GLFW_STEREO 0x0002100C
630#define GLFW_SAMPLES 0x0002100D
631#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Berglund2cd34382013-05-30 20:42:50 +0200632#define GLFW_REFRESH_RATE 0x0002100F
Camilla Berglundc9808582014-04-24 19:21:10 +0200633#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Berglunddeb0b3d2012-12-02 21:00:15 +0100634
Camilla Berglund53b39a62013-05-30 18:55:45 +0200635#define GLFW_CLIENT_API 0x00022001
636#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
637#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
638#define GLFW_CONTEXT_REVISION 0x00022004
639#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
640#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
641#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
642#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Berglund44c899c2014-08-21 19:21:45 +0200643#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100644
Camilla Berglund393e4392013-05-27 22:16:59 +0200645#define GLFW_OPENGL_API 0x00030001
646#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100647
Camilla Berglund393e4392013-05-27 22:16:59 +0200648#define GLFW_NO_ROBUSTNESS 0
649#define GLFW_NO_RESET_NOTIFICATION 0x00031001
650#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100651
Camilla Berglund44e84012013-06-05 16:13:30 +0200652#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200653#define GLFW_OPENGL_CORE_PROFILE 0x00032001
654#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100655
Camilla Berglund393e4392013-05-27 22:16:59 +0200656#define GLFW_CURSOR 0x00033001
657#define GLFW_STICKY_KEYS 0x00033002
658#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100659
Camilla Berglund393e4392013-05-27 22:16:59 +0200660#define GLFW_CURSOR_NORMAL 0x00034001
661#define GLFW_CURSOR_HIDDEN 0x00034002
662#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100663
Camilla Berglund44c899c2014-08-21 19:21:45 +0200664#define GLFW_ANY_RELEASE_BEHAVIOR 0
665#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
666#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
667
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200668/*! @defgroup shapes Standard cursor shapes
Camilla Berglund4188c262015-01-18 01:55:25 +0100669 *
670 * See [standard cursor creation](@ref cursor_standard) for how these are used.
671 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200672 * @ingroup input
673 * @{ */
674
675/*! @brief The regular arrow cursor shape.
676 *
677 * The regular arrow cursor.
678 */
679#define GLFW_ARROW_CURSOR 0x00036001
680/*! @brief The text input I-beam cursor shape.
681 *
682 * The text input I-beam cursor shape.
683 */
684#define GLFW_IBEAM_CURSOR 0x00036002
685/*! @brief The crosshair shape.
686 *
687 * The crosshair shape.
688 */
689#define GLFW_CROSSHAIR_CURSOR 0x00036003
690/*! @brief The hand shape.
691 *
692 * The hand shape.
693 */
694#define GLFW_HAND_CURSOR 0x00036004
695/*! @brief The horizontal resize arrow shape.
696 *
697 * The horizontal resize arrow shape.
698 */
699#define GLFW_HRESIZE_CURSOR 0x00036005
700/*! @brief The vertical resize arrow shape.
701 *
702 * The vertical resize arrow shape.
703 */
704#define GLFW_VRESIZE_CURSOR 0x00036006
705/*! @} */
706
Camilla Berglund393e4392013-05-27 22:16:59 +0200707#define GLFW_CONNECTED 0x00040001
708#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100709
Camilla Berglund28101302014-04-08 18:57:43 +0200710#define GLFW_DONT_CARE -1
711
Camilla Berglund97387282011-10-06 23:28:56 +0200712
Camilla Berglund3249f812010-09-07 17:34:51 +0200713/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100714 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200715 *************************************************************************/
716
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100717/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200718 *
719 * Generic function pointer used for returning client API function pointers
720 * without forcing a cast from a regular pointer.
721 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100722 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100723 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200724typedef void (*GLFWglproc)(void);
725
Camilla Berglunddba2d802013-01-17 23:06:56 +0100726/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200727 *
728 * Opaque monitor object.
729 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100730 * @ingroup monitor
731 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100732typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200733
Camilla Berglunddba2d802013-01-17 23:06:56 +0100734/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200735 *
736 * Opaque window object.
737 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100738 * @ingroup window
739 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100740typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200741
urraka40c04a72013-12-04 10:19:22 -0300742/*! @brief Opaque cursor object.
743 *
744 * Opaque cursor object.
745 *
746 * @ingroup cursor
747 */
748typedef struct GLFWcursor GLFWcursor;
749
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100750/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200751 *
752 * This is the function signature for error callback functions.
753 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100754 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100755 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100756 *
757 * @sa glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100758 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200759 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100760 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100761typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100762
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100763/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200764 *
765 * This is the function signature for window position callback functions.
766 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200767 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200768 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
769 * upper-left corner of the client area of the window.
770 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
771 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100772 *
773 * @sa glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100774 *
775 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100776 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100777typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100778
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100779/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200780 *
781 * This is the function signature for window size callback functions.
782 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200783 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200784 * @param[in] width The new width, in screen coordinates, of the window.
785 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100786 *
787 * @sa glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100788 *
789 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100790 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100791typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100792
793/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200794 *
795 * This is the function signature for window close callback functions.
796 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100797 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100798 *
799 * @sa glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100800 *
801 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100802 */
Camilla Berglund64afb192013-03-06 23:29:37 +0100803typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100804
805/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200806 *
807 * This is the function signature for window refresh callback functions.
808 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100809 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100810 *
811 * @sa glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100812 *
813 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100814 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100815typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100816
817/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200818 *
819 * This is the function signature for window focus callback functions.
820 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100821 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200822 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
823 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100824 *
825 * @sa glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100826 *
827 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100828 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100829typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100830
Camilla Berglund06e7a962012-11-22 19:14:27 +0100831/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200832 *
833 * This is the function signature for window iconify/restore callback
834 * functions.
835 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100836 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200837 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
838 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100839 *
840 * @sa glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100841 *
842 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100843 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100844typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100845
Camilla Berglund34981632013-06-03 12:51:57 +0200846/*! @brief The function signature for framebuffer resize callbacks.
847 *
848 * This is the function signature for framebuffer resize callback
849 * functions.
850 *
851 * @param[in] window The window whose framebuffer was resized.
852 * @param[in] width The new width, in pixels, of the framebuffer.
853 * @param[in] height The new height, in pixels, of the framebuffer.
854 *
855 * @sa glfwSetFramebufferSizeCallback
856 *
857 * @ingroup window
858 */
859typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
860
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100861/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200862 *
863 * This is the function signature for mouse button callback functions.
864 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100865 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100866 * @param[in] button The [mouse button](@ref buttons) that was pressed or
867 * released.
868 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200869 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
870 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100871 *
872 * @sa glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100873 *
874 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100875 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100876typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100877
878/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200879 *
880 * This is the function signature for cursor position callback functions.
881 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100882 * @param[in] window The window that received the event.
Camilla Berglund6d9d8562013-09-28 22:12:50 +0200883 * @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor.
884 * @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100885 *
886 * @sa glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100887 *
888 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100889 */
Camilla Berglund129e94d2013-04-04 16:16:21 +0200890typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100891
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200892/*! @brief The function signature for cursor enter/leave callbacks.
893 *
894 * This is the function signature for cursor enter/leave callback functions.
895 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100896 * @param[in] window The window that received the event.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200897 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
898 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100899 *
900 * @sa glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100901 *
902 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100903 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100904typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100905
906/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200907 *
908 * This is the function signature for scroll callback functions.
909 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100910 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +0200911 * @param[in] xoffset The scroll offset along the x-axis.
912 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100913 *
914 * @sa glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100915 *
916 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100917 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100918typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100919
920/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200921 *
922 * This is the function signature for keyboard key callback functions.
923 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100924 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100925 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +0200926 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +0200927 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200928 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
929 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100930 *
931 * @sa glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100932 *
933 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100934 */
Camilla Berglund11615fc2013-05-30 17:19:12 +0200935typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100936
937/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200938 *
939 * This is the function signature for Unicode character callback functions.
940 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100941 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +0200942 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100943 *
944 * @sa glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100945 *
946 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100947 */
Camilla Berglund182e0af2013-02-25 17:02:28 +0100948typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +0100949
Camilla Berglund96b12ee2014-06-12 23:04:20 +0200950/*! @brief The function signature for Unicode character with modifiers
951 * callbacks.
952 *
953 * This is the function signature for Unicode character with modifiers callback
954 * functions. It is called for each input character, regardless of what
955 * modifier keys are held down.
956 *
957 * @param[in] window The window that received the event.
958 * @param[in] codepoint The Unicode code point of the character.
959 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
960 * held down.
961 *
962 * @sa glfwSetCharModsCallback
963 *
964 * @ingroup input
965 */
966typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
967
Camilla Berglund5c8121e2014-03-29 21:35:21 +0100968/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +0200969 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +0100970 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +0200971 *
972 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +0100973 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +0100974 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +0200975 *
976 * @sa glfwSetDropCallback
977 *
978 * @ingroup input
979 */
Camilla Berglund8f349e82013-12-22 19:28:46 +0100980typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +0200981
Camilla Berglund5f68e122012-11-27 17:07:28 +0100982/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200983 *
984 * This is the function signature for monitor configuration callback functions.
985 *
Camilla Berglund5f68e122012-11-27 17:07:28 +0100986 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100987 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100988 *
989 * @sa glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100990 *
991 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +0100992 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100993typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +0100994
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200995/*! @brief Video mode type.
996 *
997 * This describes a single video mode.
998 *
999 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001000 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001001typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001002{
Camilla Berglund95835af2013-05-30 13:53:25 +02001003 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001004 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001005 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001006 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001007 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001008 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001009 /*! The bit depth of the red channel of the video mode.
1010 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001011 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001012 /*! The bit depth of the green channel of the video mode.
1013 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001014 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001015 /*! The bit depth of the blue channel of the video mode.
1016 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001017 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001018 /*! The refresh rate, in Hz, of the video mode.
1019 */
1020 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001021} GLFWvidmode;
1022
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001023/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001024 *
1025 * This describes the gamma ramp for a monitor.
1026 *
1027 * @sa glfwGetGammaRamp glfwSetGammaRamp
1028 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001029 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001030 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001031typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001032{
Camilla Berglundc1594112013-05-27 22:29:06 +02001033 /*! An array of value describing the response of the red channel.
1034 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001035 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001036 /*! An array of value describing the response of the green channel.
1037 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001038 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001039 /*! An array of value describing the response of the blue channel.
1040 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001041 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001042 /*! The number of elements in each array.
1043 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001044 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001045} GLFWgammaramp;
1046
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001047/*! @brief Image data.
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001048 */
1049typedef struct GLFWimage
1050{
1051 /*! The width, in pixels, of this image.
1052 */
1053 int width;
1054 /*! The height, in pixels, of this image.
1055 */
1056 int height;
1057 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1058 */
1059 unsigned char* pixels;
1060} GLFWimage;
1061
Camilla Berglund3249f812010-09-07 17:34:51 +02001062
1063/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001064 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001065 *************************************************************************/
1066
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001067/*! @brief Initializes the GLFW library.
1068 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001069 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001070 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001071 * should be terminated in order to free any resources allocated during or
1072 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001073 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001074 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001075 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001076 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001077 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001078 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001079 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001080 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001081 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001082 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001083 * @remarks __OS X:__ This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001084 * application to the `Contents/Resources` subdirectory of the application's
Camilla Berglund4591ad22014-09-18 15:03:29 +02001085 * bundle, if present. This can be disabled with a
1086 * [compile-time option](@ref compile_options_osx).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001087 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001088 * @par Thread Safety
1089 * This function may only be called from the main thread.
1090 *
1091 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001092 * @sa glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001093 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001094 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001095 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001096 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001097 */
1098GLFWAPI int glfwInit(void);
1099
1100/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001101 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001102 * This function destroys all remaining windows and cursors, restores any
1103 * modified gamma ramps and frees any other allocated resources. Once this
1104 * function is called, you must again call @ref glfwInit successfully before
1105 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001106 *
1107 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001108 * before the application exits. If initialization fails, there is no need to
1109 * call this function, as it is called by @ref glfwInit before it returns
1110 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001111 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001112 * @remarks This function may be called before @ref glfwInit.
1113 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001114 * @warning No window's context may be current on another thread when this
1115 * function is called.
1116 *
Camilla Berglund20858762015-01-01 18:41:22 +01001117 * @par Reentrancy
1118 * This function may not be called from a callback.
1119 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001120 * @par Thread Safety
1121 * This function may only be called from the main thread.
1122 *
1123 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001124 * @sa glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001125 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001126 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001127 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001128 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001129 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001130GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001131
1132/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001133 *
1134 * This function retrieves the major, minor and revision numbers of the GLFW
1135 * library. It is intended for when you are using GLFW as a shared library and
1136 * want to ensure that you are using the minimum required version.
1137 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001138 * Any or all of the version arguments may be `NULL`. This function always
1139 * succeeds.
1140 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001141 * @param[out] major Where to store the major version number, or `NULL`.
1142 * @param[out] minor Where to store the minor version number, or `NULL`.
1143 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001144 *
1145 * @remarks This function may be called before @ref glfwInit.
1146 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001147 * @par Thread Safety
1148 * This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001149 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001150 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001151 * @sa glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001152 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001153 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001154 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001155 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001156 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001157GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001158
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001159/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001160 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001161 * This function returns the compile-time generated
1162 * [version string](@ref intro_version_string) of the GLFW library binary. It
1163 * describes the version, platform, compiler and any platform-specific
1164 * compile-time options.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001165 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001166 * __Do not use the version string__ to parse the GLFW library version. The
1167 * @ref glfwGetVersion function already provides the version of the running
1168 * library binary.
1169 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001170 * This function always succeeds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001171 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001172 * @return The GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001173 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001174 * @remarks This function may be called before @ref glfwInit.
1175 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001176 * @par Pointer Lifetime
1177 * The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001178 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001179 * @par Thread Safety
1180 * This function may be called from any thread.
1181 *
1182 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001183 * @sa glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001184 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001185 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001186 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001187 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001188 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001189GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001190
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001191/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001192 *
1193 * This function sets the error callback, which is called with an error code
1194 * and a human-readable description each time a GLFW error occurs.
1195 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001196 * The error callback is called on the thread where the error occurred. If you
1197 * are using GLFW from multiple threads, your error callback needs to be
1198 * written accordingly.
1199 *
1200 * Because the description string may have been generated specifically for that
1201 * error, it is not guaranteed to be valid after the callback has returned. If
1202 * you wish to use it after the callback returns, you need to make a copy.
1203 *
Camilla Berglund20858762015-01-01 18:41:22 +01001204 * Once set, the error callback remains set even after the library has been
1205 * terminated.
1206 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001207 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001208 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001209 * @return The previously set callback, or `NULL` if no callback was set.
1210 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001211 * @remarks This function may be called before @ref glfwInit.
1212 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001213 * @par Thread Safety
1214 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001215 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001216 * @sa @ref error_handling
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001217 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001218 * @since Added in GLFW 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001219 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001220 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001221 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001222GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001223
Camilla Berglund5f68e122012-11-27 17:07:28 +01001224/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001225 *
1226 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001227 * monitors. The primary monitor is always first in the returned array. If no
1228 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001229 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001230 * @param[out] count Where to store the number of monitors in the returned
1231 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001232 * @return An array of monitor handles, or `NULL` if no monitors were found or
1233 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001234 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001235 * @par Pointer Lifetime
1236 * The returned array is allocated and freed by GLFW. You should not free it
1237 * yourself. It is guaranteed to be valid only until the monitor configuration
Camilla Berglund6be821c2014-10-06 23:18:33 +02001238 * changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001239 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001240 * @par Thread Safety
1241 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001242 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001243 * @sa @ref monitor_monitors
1244 * @sa @ref monitor_event
Camilla Berglunddba2d802013-01-17 23:06:56 +01001245 * @sa glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001246 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001247 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001248 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001249 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001250 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001251GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001252
Camilla Berglund5f68e122012-11-27 17:07:28 +01001253/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001254 *
1255 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001256 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001257 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001258 * @return The primary monitor, or `NULL` if no monitors were found or if an
1259 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001260 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001261 * @par Thread Safety
1262 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001263 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001264 * @remarks The primary monitor is always first in the array returned by @ref
1265 * glfwGetMonitors.
1266 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001267 * @sa @ref monitor_monitors
Camilla Berglunddba2d802013-01-17 23:06:56 +01001268 * @sa glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001269 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001270 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001271 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001272 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001273 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001274GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001275
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001276/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001277 *
1278 * This function returns the position, in screen coordinates, of the upper-left
1279 * corner of the specified monitor.
1280 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001281 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1282 * non-`NULL` position arguments will be set to zero.
1283 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001284 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001285 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1286 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001287 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001288 * @par Thread Safety
1289 * This function may only be called from the main thread.
1290 *
1291 * @sa @ref monitor_properties
1292 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001293 * @since Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001294 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001295 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001296 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001297GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1298
1299/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001300 *
1301 * This function returns the size, in millimetres, of the display area of the
1302 * specified monitor.
1303 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001304 * Some systems do not provide accurate monitor size information, either
1305 * because the monitor
1306 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1307 * data is incorrect or because the driver does not report it accurately.
1308 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001309 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1310 * non-`NULL` size arguments will be set to zero.
1311 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001312 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001313 * @param[out] widthMM Where to store the width, in millimetres, of the
1314 * monitor's display area, or `NULL`.
1315 * @param[out] heightMM Where to store the height, in millimetres, of the
1316 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001317 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001318 * @remarks __Windows:__ The OS calculates the returned physical size from the
1319 * current resolution and system DPI instead of querying the monitor EDID data.
Camilla Berglund0e205772014-03-24 11:58:35 +01001320 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001321 * @par Thread Safety
1322 * This function may only be called from the main thread.
1323 *
1324 * @sa @ref monitor_properties
1325 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001326 * @since Added in GLFW 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001327 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001328 * @ingroup monitor
1329 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001330GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001331
Camilla Berglund5f68e122012-11-27 17:07:28 +01001332/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001333 *
1334 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001335 * specified monitor. The name typically reflects the make and model of the
1336 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001337 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001338 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001339 * @return The UTF-8 encoded name of the monitor, 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 string 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 or the
1345 * 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.
1349 *
1350 * @sa @ref monitor_properties
1351 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001352 * @since Added in GLFW 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001353 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001354 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001355 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001356GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001357
Camilla Berglund5f68e122012-11-27 17:07:28 +01001358/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001359 *
1360 * This function sets the monitor configuration callback, or removes the
1361 * currently set callback. This is called when a monitor is connected to or
1362 * disconnected from the system.
1363 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001364 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001365 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001366 * @return The previously set callback, or `NULL` if no callback was set or the
1367 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001368 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001369 * @bug __X11:__ This callback is not yet called on monitor configuration
Camilla Berglundc347b072013-06-12 20:57:37 +02001370 * changes.
Camilla Berglund948cc042013-04-16 02:02:22 +02001371 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001372 * @par Thread Safety
1373 * This function may only be called from the main thread.
1374 *
1375 * @sa @ref monitor_event
1376 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001377 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001378 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001379 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001380 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001381GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001382
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001383/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001384 *
1385 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001386 * monitor. The returned array is sorted in ascending order, first by color
1387 * bit depth (the sum of all channel depths) and then by resolution area (the
1388 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001389 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001390 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001391 * @param[out] count Where to store the number of video modes in the returned
1392 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001393 * @return An array of video modes, or `NULL` if an
1394 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001395 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001396 * @par Pointer Lifetime
1397 * The returned array is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02001398 * yourself. It is valid until the specified monitor is disconnected, this
1399 * function is called again for that monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001400 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001401 * @par Thread Safety
1402 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001403 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001404 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001405 * @sa glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001406 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001407 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001408 *
1409 * @par
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001410 * __GLFW 3:__ Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001411 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001412 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001413 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001414GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001415
Camilla Berglund5f68e122012-11-27 17:07:28 +01001416/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001417 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001418 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001419 * you have created a full screen window for that monitor, the return value
1420 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001421 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001422 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001423 * @return The current mode of the monitor, or `NULL` if an
1424 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001425 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001426 * @par Pointer Lifetime
1427 * The returned array is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02001428 * yourself. It is valid until the specified monitor is disconnected or the
1429 * library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001430 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001431 * @par Thread Safety
1432 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001433 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001434 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001435 * @sa glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001436 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001437 * @since Added in GLFW 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001438 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001439 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001440 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001441GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001442
Camilla Berglund92a71e02013-02-12 13:50:41 +01001443/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001444 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001445 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglund5bbc2b42015-03-15 15:40:43 +01001446 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1447 * number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001448 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001449 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001450 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001451 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001452 * @par Thread Safety
1453 * This function may only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001454 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001455 * @sa @ref monitor_gamma
1456 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001457 * @since Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001458 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001459 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001460 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001461GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001462
Camilla Berglund4591ad22014-09-18 15:03:29 +02001463/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001464 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001465 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001466 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001467 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001468 * @return The current gamma ramp, or `NULL` if an
1469 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001470 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001471 * @par Pointer Lifetime
1472 * The returned structure and its arrays are allocated and freed by GLFW. You
1473 * should not free them yourself. They are valid until the specified monitor
Camilla Berglund6be821c2014-10-06 23:18:33 +02001474 * is disconnected, this function is called again for that monitor or the
1475 * library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001476 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001477 * @par Thread Safety
1478 * This function may only be called from the main thread.
1479 *
1480 * @sa @ref monitor_gamma
1481 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001482 * @since Added in GLFW 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001483 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001484 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001485 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001486GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001487
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001488/*! @brief Sets the current gamma ramp for the specified monitor.
1489 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001490 * This function sets the current gamma ramp for the specified monitor. The
1491 * original gamma ramp for that monitor is saved by GLFW the first time this
1492 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001493 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001494 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001495 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001496 *
Camilla Berglund76fff4d2015-03-10 19:02:28 +01001497 * @remarks Gamma ramp sizes other than 256 are not supported by all platforms
1498 * or graphics hardware.
1499 *
1500 * @remarks __Windows:__ The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001501 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001502 * @par Pointer Lifetime
1503 * The specified gamma ramp is copied before this function returns.
1504 *
1505 * @par Thread Safety
1506 * This function may only be called from the main thread.
1507 *
1508 * @sa @ref monitor_gamma
1509 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001510 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001511 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001512 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001513 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001514GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001515
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001516/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001517 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001518 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001519 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001520 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001521 * @par Thread Safety
1522 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001523 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001524 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001525 * @sa glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001526 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001527 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001528 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001529 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001530 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001531GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001532
1533/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001534 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001535 * This function sets hints for the next call to @ref glfwCreateWindow. The
1536 * hints, once set, retain their values until changed by a call to @ref
1537 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02001538 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01001539 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001540 * @param[in] target The [window hint](@ref window_hints) to set.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001541 * @param[in] hint The new value of the window hint.
1542 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001543 * @par Thread Safety
1544 * This function may only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01001545 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001546 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001547 * @sa glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001548 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001549 * @since Added in GLFW 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001550 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001551 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001552 */
Camilla Berglundaff30d02012-08-06 17:56:41 +02001553GLFWAPI void glfwWindowHint(int target, int hint);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001554
1555/*! @brief Creates a window and its associated context.
1556 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001557 * This function creates a window and its associated OpenGL or OpenGL ES
1558 * context. Most of the options controlling how the window and its context
1559 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001560 *
1561 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02001562 * can use the newly created context, you need to
1563 * [make it current](@ref context_current). For information about the `share`
1564 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001565 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001566 * The created window, framebuffer and context may differ from what you
1567 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001568 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001569 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02001570 * of the created window, framebuffer and context, see @ref
1571 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001572 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001573 * To create a full screen window, you need to specify the monitor the window
1574 * will cover. If no monitor is specified, windowed mode will be used. Unless
1575 * you have a way for the user to choose a specific monitor, it is recommended
Camilla Berglund4591ad22014-09-18 15:03:29 +02001576 * that you pick the primary monitor. For more information on how to query
1577 * connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001578 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001579 * For full screen windows, the specified size becomes the resolution of the
1580 * window's _desired video mode_. As long as a full screen window has input
1581 * focus, the supported video mode most closely matching the desired video mode
1582 * is set for the specified monitor. For more information about full screen
1583 * windows, including the creation of so called _windowed full screen_ or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001584 * _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001585 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001586 * By default, newly created windows use the placement recommended by the
1587 * window system. To create the window at a specific position, make it
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001588 * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
1589 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
1590 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001591 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001592 * If a full screen window has input focus, the screensaver is prohibited from
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001593 * starting.
1594 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001595 * Window systems put limits on window sizes. Very large or very small window
1596 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02001597 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001598 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001599 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02001600 * the initial value may vary depending on driver settings and defaults.
1601 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001602 * @param[in] width The desired width, in screen coordinates, of the window.
1603 * This must be greater than zero.
1604 * @param[in] height The desired height, in screen coordinates, of the window.
1605 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001606 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001607 * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001608 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001609 * @param[in] share The window whose context to share resources with, or `NULL`
1610 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001611 * @return The handle of the created window, or `NULL` if an
1612 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001613 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001614 * @remarks __Windows:__ Window creation will fail if the Microsoft GDI
Camilla Berglund07db5da2013-09-26 19:15:36 +02001615 * software OpenGL implementation is the only one available.
1616 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001617 * @remarks __Windows:__ If the executable has an icon resource named
Camilla Berglund71d2b572013-03-12 15:33:05 +01001618 * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is
1619 * present, the `IDI_WINLOGO` icon will be used instead.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001620 *
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01001621 * @remarks __Windows:__ The context to share resources with may not be current
1622 * on any other thread.
1623 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001624 * @remarks __OS X:__ The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01001625 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001626 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001627 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1628 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001629 *
Camilla Berglund96d230b2014-10-07 02:15:36 +02001630 * @remarks __OS X:__ The first time a window is created the menu bar is
1631 * populated with common commands like Hide, Quit and About. The About entry
1632 * opens a minimal about dialog with information from the application's bundle.
1633 * The menu bar can be disabled with a
1634 * [compile-time option](@ref compile_options_osx).
Camilla Berglund4591ad22014-09-18 15:03:29 +02001635 *
Camilla Berglund821f3e62015-03-16 22:39:14 +01001636 * @remarks __OS X:__ On OS X 10.10 and later the window frame will not be
1637 * rendered at full resolution on Retina displays unless the
1638 * `NSHighResolutionCapable` key is enabled in the application bundle's
1639 * `Info.plist`. For more information, see
1640 * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
Camilla Berglundd12b3432015-07-21 17:42:01 +02001641 * in the Mac Developer Library. The GLFW test and example programs use
1642 * a custom `Info.plist` template for this, which can be found as
1643 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01001644 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001645 * @remarks __X11:__ There is no mechanism for setting the window icon yet.
Camilla Berglundb9fb45f2013-10-27 11:03:47 +01001646 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001647 * @remarks __X11:__ Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001648 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02001649 *
Camilla Berglund20ed0a12015-08-12 21:31:54 +02001650 * @remarks __X11:__ Due to the asynchronous nature of X11, it may take
1651 * a moment for a window to reach its requested state. This means you may not
1652 * be able to query the final size, position or other attributes directly after
1653 * window creation.
1654 *
Camilla Berglund44372b82014-12-17 01:31:36 +01001655 * @par Reentrancy
1656 * This function may not be called from a callback.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001657 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001658 * @par Thread Safety
1659 * This function may only be called from the main thread.
1660 *
1661 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001662 * @sa glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001663 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001664 * @since Added in GLFW 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001665 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001666 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001667 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001668GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001669
1670/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001671 *
1672 * This function destroys the specified window and its context. On calling
1673 * this function, no further callbacks will be called for that window.
1674 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001675 * If the context of the specified window is current on the main thread, it is
1676 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001677 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001678 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001679 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001680 * @note The context of the specified window must not be current on any other
1681 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001682 *
Camilla Berglund44372b82014-12-17 01:31:36 +01001683 * @par Reentrancy
1684 * This function may not be called from a callback.
1685 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001686 * @par Thread Safety
1687 * This function may only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001688 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001689 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001690 * @sa glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001691 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001692 * @since Added in GLFW 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001693 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001694 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001695 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001696GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001697
Camilla Berglund64afb192013-03-06 23:29:37 +01001698/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001699 *
1700 * This function returns the value of the close flag of the specified window.
1701 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001702 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01001703 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001704 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001705 * @par Thread Safety
1706 * This function may be called from any thread. Access is not synchronized.
1707 *
1708 * @sa @ref window_close
1709 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001710 * @since Added in GLFW 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001711 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001712 * @ingroup window
1713 */
1714GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1715
Camilla Berglund64afb192013-03-06 23:29:37 +01001716/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001717 *
1718 * This function sets the value of the close flag of the specified window.
1719 * This can be used to override the user's attempt to close the window, or
1720 * to signal that it should be closed.
1721 *
Camilla Berglund64afb192013-03-06 23:29:37 +01001722 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01001723 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001724 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001725 * @par Thread Safety
1726 * This function may be called from any thread. Access is not synchronized.
1727 *
1728 * @sa @ref window_close
1729 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001730 * @since Added in GLFW 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001731 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001732 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01001733 */
1734GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1735
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001736/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001737 *
1738 * This function sets the window title, encoded as UTF-8, of the specified
1739 * window.
1740 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001741 * @param[in] window The window whose title to change.
1742 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001743 *
Camilla Berglund6412dcb2015-04-07 21:52:29 +02001744 * @remarks __OS X:__ The window title will not be updated until the next time
1745 * you process events.
1746 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001747 * @par Thread Safety
1748 * This function may only be called from the main thread.
1749 *
1750 * @sa @ref window_title
1751 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001752 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001753 *
1754 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001755 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001756 *
1757 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001758 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001759GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001760
Camilla Berglund7c193232013-01-24 19:30:31 +01001761/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001762 *
1763 * This function retrieves the position, in screen coordinates, of the
1764 * upper-left corner of the client area of the specified window.
1765 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001766 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1767 * non-`NULL` position arguments will be set to zero.
1768 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001769 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001770 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
1771 * the client area, or `NULL`.
1772 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
1773 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01001774 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001775 * @par Thread Safety
1776 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001777 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001778 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01001779 * @sa glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001780 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001781 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001782 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001783 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001784 */
1785GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
1786
1787/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001788 *
1789 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02001790 * corner of the client area of the specified windowed mode window. If the
1791 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001792 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001793 * __Do not use this function__ to move an already visible window unless you
1794 * have very good reasons for doing so, as it will confuse and annoy the user.
1795 *
1796 * The window manager may put limits on what positions are allowed. GLFW
1797 * cannot and should not override these limits.
1798 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001799 * @param[in] window The window to query.
1800 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
1801 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01001802 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001803 * @par Thread Safety
1804 * This function may only be called from the main thread.
1805 *
1806 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01001807 * @sa glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001808 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001809 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001810 *
1811 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001812 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001813 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001814 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001815 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01001816GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01001817
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001818/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001819 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001820 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02001821 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001822 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001823 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001824 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1825 * non-`NULL` size arguments will be set to zero.
1826 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001827 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001828 * @param[out] width Where to store the width, in screen coordinates, of the
1829 * client area, or `NULL`.
1830 * @param[out] height Where to store the height, in screen coordinates, of the
1831 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001832 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001833 * @par Thread Safety
1834 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001835 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001836 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001837 * @sa glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001838 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001839 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001840 *
1841 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001842 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001843 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001844 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001845 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001846GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001847
Camilla Berglundd84772d2014-02-13 02:57:59 +01001848/*! @brief Sets the size limits of the specified window.
1849 *
1850 * This function sets the size limits of the client area of the specified
1851 * window. If the window is full screen or not resizable, this function does
1852 * nothing.
1853 *
1854 * The size limits are applied immediately and may cause the window to be
1855 * resized.
1856 *
1857 * @param[in] window The window to set limits for.
1858 * @param[in] minwidth The minimum width, in screen coordinates, of the client
1859 * area, or `GLFW_DONT_CARE`.
1860 * @param[in] minheight The minimum height, in screen coordinates, of the
1861 * client area, or `GLFW_DONT_CARE`.
1862 * @param[in] maxwidth The maximum width, in screen coordinates, of the client
1863 * area, or `GLFW_DONT_CARE`.
1864 * @param[in] maxheight The maximum height, in screen coordinates, of the
1865 * client area, or `GLFW_DONT_CARE`.
1866 *
1867 * @remarks If you set size limits and an aspect ratio that conflict, the
1868 * results are undefined.
1869 *
1870 * @par Thread Safety
1871 * This function may only be called from the main thread.
1872 *
1873 * @sa @ref window_sizelimits
1874 * @sa glfwSetWindowAspectRatio
1875 *
1876 * @since Added in GLFW 3.2.
1877 *
1878 * @ingroup window
1879 */
1880GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
1881
1882/*! @brief Sets the aspect ratio of the specified window.
1883 *
1884 * This function sets the required aspect ratio of the client area of the
1885 * specified window. If the window is full screen or not resizable, this
1886 * function does nothing.
1887 *
1888 * The aspect ratio is specified as a numerator and a denominator. For
1889 * example, the common 16:9 aspect ratio is specified as 16 and 9,
1890 * respectively. The denominator may not be zero.
1891 *
1892 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the window
1893 * may be resized to any aspect ratio permitted by the window system and any
1894 * limits set by @ref glfwSetWindowSizeLimits.
1895 *
1896 * The aspect ratio is applied immediately and may cause the window to be
1897 * resized.
1898 *
1899 * @param[in] window The window to set limits for.
1900 * @param[in] numer The numerator of the desired aspect ratio, or
1901 * `GLFW_DONT_CARE`.
1902 * @param[in] denom The denominator of the desired aspect ratio, or
1903 * `GLFW_DONT_CARE`.
1904 *
1905 * @remarks If you set size limits and an aspect ratio that conflict, the
1906 * results are undefined.
1907 *
1908 * @par Thread Safety
1909 * This function may only be called from the main thread.
1910 *
1911 * @sa @ref window_sizelimits
1912 * @sa glfwSetWindowSizeLimits
1913 *
1914 * @since Added in GLFW 3.2.
1915 *
1916 * @ingroup window
1917 */
1918GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
1919
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001920/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001921 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001922 * This function sets the size, in screen coordinates, of the client area of
1923 * the specified window.
1924 *
1925 * For full screen windows, this function selects and switches to the resolution
1926 * closest to the specified size, without affecting the window's context. As
1927 * the context is unaffected, the bit depths of the framebuffer remain
1928 * unchanged.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001929 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001930 * The window manager may put limits on what sizes are allowed. GLFW cannot
1931 * and should not override these limits.
1932 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001933 * @param[in] window The window to resize.
1934 * @param[in] width The desired width of the specified window.
1935 * @param[in] height The desired height of the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001936 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001937 * @par Thread Safety
1938 * This function may only be called from the main thread.
1939 *
1940 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001941 * @sa glfwGetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001942 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001943 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001944 *
1945 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02001946 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001947 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001948 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001949 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001950GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001951
Camilla Berglund34981632013-06-03 12:51:57 +02001952/*! @brief Retrieves the size of the framebuffer of the specified window.
1953 *
1954 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02001955 * specified window. If you wish to retrieve the size of the window in screen
1956 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02001957 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001958 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1959 * non-`NULL` size arguments will be set to zero.
1960 *
Camilla Berglund34981632013-06-03 12:51:57 +02001961 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001962 * @param[out] width Where to store the width, in pixels, of the framebuffer,
1963 * or `NULL`.
1964 * @param[out] height Where to store the height, in pixels, of the framebuffer,
1965 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02001966 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001967 * @par Thread Safety
1968 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001969 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001970 * @sa @ref window_fbsize
Camilla Berglund34981632013-06-03 12:51:57 +02001971 * @sa glfwSetFramebufferSizeCallback
1972 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001973 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001974 *
Camilla Berglund34981632013-06-03 12:51:57 +02001975 * @ingroup window
1976 */
1977GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
1978
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01001979/*! @brief Retrieves the size of the frame of the window.
1980 *
1981 * This function retrieves the size, in screen coordinates, of each edge of the
1982 * frame of the specified window. This size includes the title bar, if the
1983 * window has one. The size of the frame may vary depending on the
1984 * [window-related hints](@ref window_hints_wnd) used to create it.
1985 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001986 * Because this function retrieves the size of each window frame edge and not
1987 * the offset along a particular coordinate axis, the retrieved values will
1988 * always be zero or positive.
1989 *
1990 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1991 * non-`NULL` size arguments will be set to zero.
1992 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01001993 * @param[in] window The window whose frame size to query.
1994 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02001995 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02001996 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02001997 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02001998 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001999 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002000 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002001 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002002 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002003 * @par Thread Safety
2004 * This function may only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002005 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002006 * @sa @ref window_size
2007 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002008 * @since Added in GLFW 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002009 *
2010 * @ingroup window
2011 */
2012GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2013
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002014/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002015 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002016 * This function iconifies (minimizes) the specified window if it was
2017 * previously restored. If the window is already iconified, this function does
2018 * nothing.
2019 *
2020 * If the specified window is a full screen window, the original monitor
2021 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002022 *
2023 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002024 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002025 * @par Thread Safety
2026 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002027 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002028 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002029 * @sa glfwRestoreWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002030 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002031 * @since Added in GLFW 2.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002032 *
2033 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002034 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002035 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002036 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002037 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002038GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002039
2040/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002041 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002042 * This function restores the specified window if it was previously iconified
2043 * (minimized). If the window is already restored, this function does nothing.
2044 *
2045 * If the specified window is a full screen window, the resolution chosen for
2046 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002047 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002048 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002049 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002050 * @par Thread Safety
2051 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002052 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002053 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002054 * @sa glfwIconifyWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01002055 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002056 * @since Added in GLFW 2.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002057 *
2058 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002059 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002060 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002061 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002062 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002063GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002064
2065/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002066 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002067 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002068 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002069 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002070 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002071 * @param[in] window The window to make visible.
2072 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002073 * @par Thread Safety
2074 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002075 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002076 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002077 * @sa glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002078 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002079 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002080 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002081 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002082 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002083GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002084
2085/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002086 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002087 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002088 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002089 * nothing.
2090 *
2091 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002092 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002093 * @par Thread Safety
2094 * This function may only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002095 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002096 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002097 * @sa glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002098 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002099 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002100 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002101 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002102 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002103GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002104
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002105/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002106 *
2107 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002108 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002109 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002110 * @param[in] window The window to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002111 * @return The monitor, or `NULL` if the window is in windowed mode or an error
2112 * occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002113 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002114 * @par Thread Safety
2115 * This function may only be called from the main thread.
2116 *
2117 * @sa @ref window_monitor
2118 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002119 * @since Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002120 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002121 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002122 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002123GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002124
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002125/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002126 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002127 * This function returns the value of an attribute of the specified window or
2128 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002129 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002130 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002131 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2132 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002133 * @return The value of the attribute, or zero if an
2134 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002135 *
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002136 * @remarks Framebuffer related hints are not window attributes. See @ref
2137 * window_attribs_fb for more information.
2138 *
2139 * @remarks Zero is a valid value for many window and context related
2140 * attributes so you cannot use a return value of zero as an indication of
2141 * errors. However, this function should not fail as long as it is passed
2142 * valid arguments and the library has been [initialized](@ref intro_init).
2143 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002144 * @par Thread Safety
2145 * This function may only be called from the main thread.
2146 *
2147 * @sa @ref window_attribs
2148 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002149 * @since Added in GLFW 3.0. Replaces `glfwGetWindowParam` and
2150 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002151 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002152 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002153 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002154GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002155
2156/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002157 *
2158 * This function sets the user-defined pointer of the specified window. The
2159 * current value is retained until the window is destroyed. The initial value
2160 * is `NULL`.
2161 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002162 * @param[in] window The window whose pointer to set.
2163 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002164 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002165 * @par Thread Safety
2166 * This function may be called from any thread. Access is not synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002167 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002168 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002169 * @sa glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002170 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002171 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002172 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002173 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002174 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002175GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002176
2177/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002178 *
2179 * This function returns the current value of the user-defined pointer of the
2180 * specified window. The initial value is `NULL`.
2181 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002182 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002183 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002184 * @par Thread Safety
2185 * This function may be called from any thread. Access is not synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002186 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002187 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002188 * @sa glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002189 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002190 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002191 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002192 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002193 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002194GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002195
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002196/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002197 *
2198 * This function sets the position callback of the specified window, which is
2199 * called when the window is moved. The callback is provided with the screen
2200 * position of the upper-left corner of the client area of the window.
2201 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002202 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002203 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002204 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002205 * @return The previously set callback, or `NULL` if no callback was set or the
2206 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002207 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002208 * @par Thread Safety
2209 * This function may only be called from the main thread.
2210 *
2211 * @sa @ref window_pos
2212 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002213 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002214 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002215 * @ingroup window
2216 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002217GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002218
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002219/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002220 *
2221 * This function sets the size callback of the specified window, which is
2222 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002223 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002224 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002225 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002226 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002227 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002228 * @return The previously set callback, or `NULL` if no callback was set or the
2229 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002230 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002231 * @par Thread Safety
2232 * This function may only be called from the main thread.
2233 *
2234 * @sa @ref window_size
2235 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002236 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002237 *
2238 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002239 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002240 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002241 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002242 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002243GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002244
2245/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002246 *
2247 * This function sets the close callback of the specified window, which is
2248 * called when the user attempts to close the window, for example by clicking
2249 * the close widget in the title bar.
2250 *
2251 * The close flag is set before this callback is called, but you can modify it
2252 * at any time with @ref glfwSetWindowShouldClose.
2253 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002254 * The close callback is not triggered by @ref glfwDestroyWindow.
2255 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002256 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002257 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002258 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002259 * @return The previously set callback, or `NULL` if no callback was set or the
2260 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002261 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002262 * @remarks __OS X:__ Selecting Quit from the application menu will
Camilla Berglund1bd59842013-01-13 21:28:18 +01002263 * trigger the close callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002264 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002265 * @par Thread Safety
2266 * This function may only be called from the main thread.
2267 *
2268 * @sa @ref window_close
2269 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002270 * @since Added in GLFW 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002271 *
2272 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002273 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002274 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002275 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002276 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002277GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002278
2279/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002280 *
2281 * This function sets the refresh callback of the specified window, which is
2282 * called when the client area of the window needs to be redrawn, for example
2283 * if the window has been exposed after having been covered by another window.
2284 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002285 * On compositing window systems such as Aero, Compiz or Aqua, where the window
2286 * contents are saved off-screen, this callback may be called only very
2287 * infrequently or never at all.
2288 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002289 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002290 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002291 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002292 * @return The previously set callback, or `NULL` if no callback was set or the
2293 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002294 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002295 * @par Thread Safety
2296 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002297 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002298 * @sa @ref window_refresh
2299 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002300 * @since Added in GLFW 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002301 *
2302 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002303 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002304 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002305 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002306 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002307GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002308
2309/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002310 *
2311 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01002312 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002313 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002314 * After the focus callback is called for a window that lost input focus,
2315 * synthetic key and mouse button release events will be generated for all such
2316 * that had been pressed. For more information, see @ref glfwSetKeyCallback
2317 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02002318 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002319 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002320 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002321 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002322 * @return The previously set callback, or `NULL` if no callback was set or the
2323 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002324 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002325 * @par Thread Safety
2326 * This function may only be called from the main thread.
2327 *
2328 * @sa @ref window_focus
2329 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002330 * @since Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002331 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002332 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002333 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002334GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002335
2336/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002337 *
2338 * This function sets the iconification callback of the specified window, which
2339 * is called when the window is iconified or restored.
2340 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002341 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002342 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002343 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002344 * @return The previously set callback, or `NULL` if no callback was set or the
2345 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002346 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002347 * @par Thread Safety
2348 * This function may only be called from the main thread.
2349 *
2350 * @sa @ref window_iconify
2351 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002352 * @since Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002353 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002354 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002355 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002356GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02002357
Camilla Berglund34981632013-06-03 12:51:57 +02002358/*! @brief Sets the framebuffer resize callback for the specified window.
2359 *
2360 * This function sets the framebuffer resize callback of the specified window,
2361 * which is called when the framebuffer of the specified window is resized.
2362 *
2363 * @param[in] window The window whose callback to set.
2364 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2365 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002366 * @return The previously set callback, or `NULL` if no callback was set or the
2367 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02002368 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002369 * @par Thread Safety
2370 * This function may only be called from the main thread.
2371 *
2372 * @sa @ref window_fbsize
2373 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002374 * @since Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002375 *
Camilla Berglund34981632013-06-03 12:51:57 +02002376 * @ingroup window
2377 */
2378GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
2379
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002380/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002381 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002382 * This function processes only those events that are already in the event
2383 * queue and then returns immediately. Processing events will cause the window
2384 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002385 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002386 * On some platforms, a window move, resize or menu operation will cause event
2387 * processing to block. This is due to how event processing is designed on
2388 * those platforms. You can use the
2389 * [window refresh callback](@ref window_refresh) to redraw the contents of
2390 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002391 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002392 * On some platforms, certain events are sent directly to the application
2393 * without going through the event queue, causing callbacks to be called
2394 * outside of a call to one of the event processing functions.
Camilla Berglund401033c2013-03-12 19:17:07 +01002395 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002396 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002397 *
Camilla Berglund44372b82014-12-17 01:31:36 +01002398 * @par Reentrancy
2399 * This function may not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01002400 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002401 * @par Thread Safety
2402 * This function may only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02002403 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002404 * @sa @ref events
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002405 * @sa glfwWaitEvents
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002406 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002407 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002408 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002409 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002410 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002411GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002412
Camilla Berglund4591ad22014-09-18 15:03:29 +02002413/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002414 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002415 * This function puts the calling thread to sleep until at least one event is
2416 * available in the event queue. Once one or more events are available,
2417 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
2418 * are processed and the function then returns immediately. Processing events
2419 * will cause the window and input callbacks associated with those events to be
2420 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02002421 *
2422 * Since not all events are associated with callbacks, this function may return
2423 * without a callback having been called even if you are monitoring all
2424 * callbacks.
2425 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002426 * On some platforms, a window move, resize or menu operation will cause event
2427 * processing to block. This is due to how event processing is designed on
2428 * those platforms. You can use the
2429 * [window refresh callback](@ref window_refresh) to redraw the contents of
2430 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002431 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002432 * On some platforms, certain callbacks may be called outside of a call to one
2433 * of the event processing functions.
2434 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002435 * If no windows exist, this function returns immediately. For synchronization
2436 * of threads in applications that do not create windows, use your threading
2437 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01002438 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002439 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002440 *
Camilla Berglund44372b82014-12-17 01:31:36 +01002441 * @par Reentrancy
2442 * This function may not be called from a callback.
2443 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002444 * @par Thread Safety
2445 * This function may only be called from the main thread.
2446 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002447 * @sa @ref events
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002448 * @sa glfwPollEvents
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002449 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002450 * @since Added in GLFW 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002451 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002452 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002453 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002454GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02002455
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002456/*! @brief Posts an empty event to the event queue.
2457 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002458 * This function posts an empty event from the current thread to the event
2459 * queue, causing @ref glfwWaitEvents to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002460 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002461 * If no windows exist, this function returns immediately. For synchronization
2462 * of threads in applications that do not create windows, use your threading
2463 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002464 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002465 * @par Thread Safety
2466 * This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002467 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002468 * @sa @ref events
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002469 * @sa glfwWaitEvents
2470 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002471 * @since Added in GLFW 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002472 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002473 * @ingroup window
2474 */
2475GLFWAPI void glfwPostEmptyEvent(void);
2476
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002477/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002478 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002479 * This function returns the value of an input option for the specified window.
2480 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2481 * `GLFW_STICKY_MOUSE_BUTTONS`.
2482 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002483 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02002484 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002485 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002486 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002487 * @par Thread Safety
2488 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002489 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002490 * @sa glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002491 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002492 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002493 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002494 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002495 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002496GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002497
2498/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002499 *
2500 * This function sets an input mode option for the specified window. The mode
2501 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund71d2b572013-03-12 15:33:05 +01002502 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002503 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002504 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002505 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02002506 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
2507 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund4188c262015-01-18 01:55:25 +01002508 * area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01002509 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
2510 * and unlimited cursor movement. This is useful for implementing for
2511 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002512 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02002513 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
2514 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02002515 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
2516 * the next time it is called even if the key had been released before the
2517 * call. This is useful when you are only interested in whether keys have been
2518 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002519 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002520 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02002521 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
2522 * If sticky mouse buttons are enabled, a mouse button press will ensure that
2523 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
2524 * if the mouse button had been released before the call. This is useful when
2525 * you are only interested in whether mouse buttons have been pressed but not
2526 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002527 *
2528 * @param[in] window The window whose input mode to set.
2529 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2530 * `GLFW_STICKY_MOUSE_BUTTONS`.
2531 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +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 Berglundbce2cd62012-11-22 16:38:24 +01002536 * @sa glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01002537 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002538 * @since Added in GLFW 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002539 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002540 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002541 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002542GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002543
2544/*! @brief Returns the last reported state of a keyboard key for the specified
2545 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002546 *
2547 * This function returns the last state reported for the specified key to the
2548 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02002549 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002550 * the key callback.
2551 *
2552 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02002553 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
2554 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002555 *
2556 * The key functions deal with physical keys, with [key tokens](@ref keys)
2557 * named after their use on the standard US keyboard layout. If you want to
2558 * input text, use the Unicode character callback instead.
2559 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002560 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
2561 * used with this function.
2562 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002563 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002564 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
2565 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002566 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002567 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002568 * @par Thread Safety
2569 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002570 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002571 * @sa @ref input_key
2572 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002573 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002574 *
2575 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002576 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02002577 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002578 * @ingroup input
2579 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002580GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002581
2582/*! @brief Returns the last reported state of a mouse button for the specified
2583 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002584 *
2585 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02002586 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002587 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002588 *
2589 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02002590 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
2591 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002592 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002593 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002594 * @param[in] button The desired [mouse button](@ref buttons).
2595 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002596 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002597 * @par Thread Safety
2598 * This function may only be called from the main thread.
2599 *
2600 * @sa @ref input_mouse_button
2601 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002602 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002603 *
2604 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002605 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01002606 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002607 * @ingroup input
2608 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002609GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002610
Camilla Berglundd4591452014-02-11 18:24:01 +01002611/*! @brief Retrieves the position of the cursor relative to the client area of
2612 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002613 *
Camilla Berglundd4591452014-02-11 18:24:01 +01002614 * This function returns the position of the cursor, in screen coordinates,
2615 * relative to the upper-left corner of the client area of the specified
2616 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002617 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02002618 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
2619 * position is unbounded and limited only by the minimum and maximum values of
2620 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02002621 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02002622 * The coordinate can be converted to their integer equivalents with the
2623 * `floor` function. Casting directly to an integer type works for positive
2624 * coordinates, but fails for negative ones.
2625 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002626 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2627 * non-`NULL` position arguments will be set to zero.
2628 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002629 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002630 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
2631 * left edge of the client area, or `NULL`.
2632 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
2633 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002634 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002635 * @par Thread Safety
2636 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002637 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002638 * @sa @ref cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002639 * @sa glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002640 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002641 * @since Added in GLFW 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002642 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002643 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002644 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02002645GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002646
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002647/*! @brief Sets the position of the cursor, relative to the client area of the
2648 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002649 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002650 * This function sets the position, in screen coordinates, of the cursor
2651 * relative to the upper-left corner of the client area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01002652 * window. The window must have input focus. If the window does not have
2653 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002654 *
Camilla Berglund20858762015-01-01 18:41:22 +01002655 * __Do not use this function__ to implement things like camera controls. GLFW
2656 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
2657 * cursor, transparently re-centers it and provides unconstrained cursor
2658 * motion. See @ref glfwSetInputMode for more information.
2659 *
2660 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
2661 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02002662 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02002663 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002664 * @param[in] window The desired window.
2665 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02002666 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002667 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02002668 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002669 *
Camilla Berglund20ed0a12015-08-12 21:31:54 +02002670 * @remarks __X11:__ Due to the asynchronous nature of X11, it may take
2671 * a moment for the window focus event to arrive. This means you may not be
2672 * able to set the cursor position directly after window creation.
Camilla Berglund2eb5ed32014-08-31 13:10:06 +02002673 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002674 * @par Thread Safety
2675 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002676 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002677 * @sa @ref cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002678 * @sa glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002679 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002680 * @since Added in GLFW 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002681 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002682 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002683 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02002684GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002685
Camilla Berglund2a1375e2014-09-02 16:52:16 +02002686/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03002687 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002688 * Creates a new custom cursor image that can be set for a window with @ref
2689 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
2690 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002691 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02002692 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
2693 * bits per channel. They are arranged canonically as packed sequential rows,
2694 * starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01002695 *
2696 * The cursor hotspot is specified in pixels, relative to the upper-left corner
2697 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
2698 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002699 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01002700 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01002701 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
2702 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
urraka40c04a72013-12-04 10:19:22 -03002703 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002704 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02002705 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03002706 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002707 * @par Pointer Lifetime
2708 * The specified image data is copied before this function returns.
2709 *
Camilla Berglund44372b82014-12-17 01:31:36 +01002710 * @par Reentrancy
2711 * This function may not be called from a callback.
2712 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002713 * @par Thread Safety
2714 * This function may only be called from the main thread.
2715 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002716 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02002717 * @sa glfwDestroyCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02002718 * @sa glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02002719 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002720 * @since Added in GLFW 3.1.
urraka40c04a72013-12-04 10:19:22 -03002721 *
2722 * @ingroup input
2723 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01002724GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03002725
Camilla Berglund2a1375e2014-09-02 16:52:16 +02002726/*! @brief Creates a cursor with a standard shape.
2727 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002728 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
2729 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02002730 *
2731 * @param[in] shape One of the [standard shapes](@ref shapes).
2732 *
2733 * @return A new cursor ready to use or `NULL` if an
2734 * [error](@ref error_handling) occurred.
2735 *
Camilla Berglund44372b82014-12-17 01:31:36 +01002736 * @par Reentrancy
2737 * This function may not be called from a callback.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02002738 *
2739 * @par Thread Safety
2740 * This function may only be called from the main thread.
2741 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002742 * @sa @ref cursor_object
Camilla Berglund2a1375e2014-09-02 16:52:16 +02002743 * @sa glfwCreateCursor
2744 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002745 * @since Added in GLFW 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02002746 *
2747 * @ingroup input
2748 */
2749GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
2750
urraka40c04a72013-12-04 10:19:22 -03002751/*! @brief Destroys a cursor.
2752 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002753 * This function destroys a cursor previously created with @ref
2754 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
2755 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03002756 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002757 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03002758 *
Camilla Berglund44372b82014-12-17 01:31:36 +01002759 * @par Reentrancy
2760 * This function may not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002761 *
2762 * @par Thread Safety
2763 * This function may only be called from the main thread.
2764 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002765 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02002766 * @sa glfwCreateCursor
2767 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002768 * @since Added in GLFW 3.1.
urraka40c04a72013-12-04 10:19:22 -03002769 *
2770 * @ingroup input
2771 */
2772GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
2773
Camilla Berglund4188c262015-01-18 01:55:25 +01002774/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03002775 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002776 * This function sets the cursor image to be used when the cursor is over the
2777 * client area of the specified window. The set cursor will only be visible
2778 * when the [cursor mode](@ref cursor_mode) of the window is
2779 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002780 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002781 * On some platforms, the set cursor may not be visible unless the window also
2782 * has input focus.
2783 *
2784 * @param[in] window The window to set the cursor for.
2785 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
2786 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03002787 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002788 * @par Thread Safety
2789 * This function may only be called from the main thread.
2790 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002791 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02002792 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002793 * @since Added in GLFW 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01002794 *
urraka40c04a72013-12-04 10:19:22 -03002795 * @ingroup input
2796 */
2797GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
2798
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002799/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002800 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002801 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002802 * when a key is pressed, repeated or released.
2803 *
Camilla Berglund948cc042013-04-16 02:02:22 +02002804 * The key functions deal with physical keys, with layout independent
2805 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002806 * layout. If you want to input text, use the
2807 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002808 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002809 * When a window loses input focus, it will generate synthetic key release
2810 * events for all pressed keys. You can tell these events from user-generated
2811 * events by the fact that the synthetic ones are generated after the focus
2812 * loss event has been processed, i.e. after the
2813 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02002814 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02002815 * The scancode of a key is specific to that platform or sometimes even to that
2816 * machine. Scancodes are intended to allow users to bind keys that don't have
2817 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02002818 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02002819 *
2820 * Sometimes GLFW needs to generate synthetic key events, in which case the
2821 * scancode may be zero.
2822 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002823 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002824 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002825 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002826 * @return The previously set callback, or `NULL` if no callback was set or the
2827 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002828 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002829 * @par Thread Safety
2830 * This function may only be called from the main thread.
2831 *
2832 * @sa @ref input_key
2833 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002834 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002835 *
2836 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002837 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002838 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002839 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002840 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002841GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002842
2843/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002844 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002845 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002846 * called when a Unicode character is input.
2847 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02002848 * The character callback is intended for Unicode text input. As it deals with
2849 * characters, it is keyboard layout dependent, whereas the
2850 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
2851 * to physical keys, as a key may produce zero, one or more characters. If you
2852 * want to know whether a specific physical key was pressed or released, see
2853 * the key callback instead.
2854 *
2855 * The character callback behaves as system text input normally does and will
2856 * not be called if modifier keys are held down that would prevent normal text
2857 * input on that platform, for example a Super (Command) key on OS X or Alt key
2858 * on Windows. There is a
2859 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
2860 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002861 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002862 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002863 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002864 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002865 * @return The previously set callback, or `NULL` if no callback was set or the
2866 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002867 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002868 * @par Thread Safety
2869 * This function may only be called from the main thread.
2870 *
2871 * @sa @ref input_char
2872 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002873 * @since Added in GLFW 2.4.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002874 *
2875 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002876 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002877 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002878 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002879 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002880GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002881
Camilla Berglund96b12ee2014-06-12 23:04:20 +02002882/*! @brief Sets the Unicode character with modifiers callback.
2883 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002884 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02002885 * window, which is called when a Unicode character is input regardless of what
2886 * modifier keys are used.
2887 *
2888 * The character with modifiers callback is intended for implementing custom
2889 * Unicode character input. For regular Unicode text input, see the
2890 * [character callback](@ref glfwSetCharCallback). Like the character
2891 * callback, the character with modifiers callback deals with characters and is
2892 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
2893 * a key may produce zero, one or more characters. If you want to know whether
2894 * a specific physical key was pressed or released, see the
2895 * [key callback](@ref glfwSetKeyCallback) instead.
2896 *
2897 * @param[in] window The window whose callback to set.
2898 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2899 * callback.
2900 * @return The previously set callback, or `NULL` if no callback was set or an
2901 * error occurred.
2902 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002903 * @par Thread Safety
2904 * This function may only be called from the main thread.
2905 *
2906 * @sa @ref input_char
2907 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002908 * @since Added in GLFW 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02002909 *
2910 * @ingroup input
2911 */
2912GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
2913
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002914/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002915 *
2916 * This function sets the mouse button callback of the specified window, which
2917 * is called when a mouse button is pressed or released.
2918 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002919 * When a window loses input focus, it will generate synthetic mouse button
2920 * release events for all pressed mouse buttons. You can tell these events
2921 * from user-generated events by the fact that the synthetic ones are generated
2922 * after the focus loss event has been processed, i.e. after the
2923 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02002924 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002925 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002926 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002927 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002928 * @return The previously set callback, or `NULL` if no callback was set or the
2929 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002930 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002931 * @par Thread Safety
2932 * This function may only be called from the main thread.
2933 *
2934 * @sa @ref input_mouse_button
2935 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002936 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002937 *
2938 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02002939 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
Camilla Berglund0e205772014-03-24 11:58:35 +01002940 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002941 * @ingroup input
2942 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002943GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002944
2945/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002946 *
2947 * This function sets the cursor position callback of the specified window,
2948 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002949 * position, in screen coordinates, relative to the upper-left corner of the
2950 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002951 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002952 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002953 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002954 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002955 * @return The previously set callback, or `NULL` if no callback was set or the
2956 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002957 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002958 * @par Thread Safety
2959 * This function may only be called from the main thread.
2960 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002961 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02002962 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002963 * @since Added in GLFW 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002964 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002965 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002966 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002967GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002968
2969/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002970 *
2971 * This function sets the cursor boundary crossing callback of the specified
2972 * window, which is called when the cursor enters or leaves the client area of
2973 * the window.
2974 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01002975 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002976 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002977 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002978 * @return The previously set callback, or `NULL` if no callback was set or the
2979 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002980 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002981 * @par Thread Safety
2982 * This function may only be called from the main thread.
2983 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002984 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02002985 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002986 * @since Added in GLFW 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002987 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002988 * @ingroup input
2989 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002990GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002991
2992/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01002993 *
2994 * This function sets the scroll callback of the specified window, which is
2995 * called when a scrolling device is used, such as a mouse wheel or scrolling
2996 * area of a touchpad.
2997 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002998 * The scroll callback receives all scrolling input, like that from a mouse
2999 * wheel or a touchpad scrolling area.
3000 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003001 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003002 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003003 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003004 * @return The previously set callback, or `NULL` if no callback was set or the
3005 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003006 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003007 * @par Thread Safety
3008 * This function may only be called from the main thread.
3009 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003010 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02003011 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003012 * @since Added in GLFW 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003013 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003014 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003015 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003016GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02003017
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003018/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02003019 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003020 * This function sets the file drop callback of the specified window, which is
3021 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02003022 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003023 * Because the path array and its strings may have been generated specifically
3024 * for that event, they are not guaranteed to be valid after the callback has
3025 * returned. If you wish to use them after the callback returns, you need to
3026 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02003027 *
3028 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003029 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
3030 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003031 * @return The previously set callback, or `NULL` if no callback was set or the
3032 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02003033 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003034 * @par Thread Safety
3035 * This function may only be called from the main thread.
3036 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003037 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02003038 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003039 * @since Added in GLFW 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003040 *
arturo89d07232013-07-10 11:42:14 +02003041 * @ingroup input
3042 */
3043GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
3044
Camilla Berglundfdd45182013-05-27 15:13:09 +02003045/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003046 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02003047 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003048 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003049 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003050 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003051 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003052 * @par Thread Safety
3053 * This function may only be called from the main thread.
3054 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003055 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02003056 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003057 * @since Added in GLFW 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003058 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003059 * @ingroup input
3060 */
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003061GLFWAPI int glfwJoystickPresent(int joy);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003062
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003063/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003064 *
3065 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003066 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003067 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003068 * @param[in] joy The [joystick](@ref joysticks) to query.
3069 * @param[out] count Where to store the number of axis values in the returned
3070 * array. This is set to zero if an error occurred.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003071 * @return An array of axis values, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003072 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003073 * @par Pointer Lifetime
3074 * The returned array is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02003075 * yourself. It is valid until the specified joystick is disconnected, this
3076 * function is called again for that joystick or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003077 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003078 * @par Thread Safety
3079 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003080 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003081 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02003082 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003083 * @since Added in GLFW 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003084 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003085 * @ingroup input
3086 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003087GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003088
Camilla Berglunde93bade2013-06-16 02:33:33 +02003089/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003090 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02003091 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003092 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003093 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003094 * @param[in] joy The [joystick](@ref joysticks) to query.
3095 * @param[out] count Where to store the number of button states in the returned
3096 * array. This is set to zero if an error occurred.
Camilla Berglunde93bade2013-06-16 02:33:33 +02003097 * @return An array of button states, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003098 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003099 * @par Pointer Lifetime
3100 * The returned array is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02003101 * yourself. It is valid until the specified joystick is disconnected, this
3102 * function is called again for that joystick or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003103 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003104 * @par Thread Safety
3105 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003106 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003107 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003108 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003109 * @since Added in GLFW 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003110 *
3111 * @par
Camilla Berglund95654cf2014-10-02 17:35:10 +02003112 * __GLFW 3:__ Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003113 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003114 * @ingroup input
3115 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003116GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02003117
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003118/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003119 *
3120 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003121 * The returned string is allocated and freed by GLFW. You should not free it
3122 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003123 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003124 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003125 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003126 * is not present.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01003127 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003128 * @par Pointer Lifetime
3129 * The returned string is allocated and freed by GLFW. You should not free it
Camilla Berglund6be821c2014-10-06 23:18:33 +02003130 * yourself. It is valid until the specified joystick is disconnected, this
3131 * function is called again for that joystick or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003132 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003133 * @par Thread Safety
3134 * This function may only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003135 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003136 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02003137 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003138 * @since Added in GLFW 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003139 *
3140 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003141 */
Camilla Berglund93a1d1c2012-09-07 01:01:34 +02003142GLFWAPI const char* glfwGetJoystickName(int joy);
Camilla Berglund3249f812010-09-07 17:34:51 +02003143
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003144/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003145 *
3146 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02003147 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003148 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003149 * @param[in] window The window that will own the clipboard contents.
3150 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003151 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003152 * @par Pointer Lifetime
3153 * The specified string is copied before this function returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003154 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003155 * @par Thread Safety
3156 * This function may only be called from the main thread.
3157 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003158 * @sa @ref clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003159 * @sa glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003160 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003161 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003162 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003163 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003164 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003165GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003166
Camilla Berglund4591ad22014-09-18 15:03:29 +02003167/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003168 *
3169 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02003170 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02003171 * if its contents cannot be converted, `NULL` is returned and a @ref
3172 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003173 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003174 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003175 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02003176 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003177 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003178 * @par Pointer Lifetime
3179 * The returned string is allocated and freed by GLFW. You should not free it
3180 * yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02003181 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
3182 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003183 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003184 * @par Thread Safety
3185 * This function may only be called from the main thread.
3186 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003187 * @sa @ref clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003188 * @sa glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003189 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003190 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003191 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003192 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003193 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003194GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01003195
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003196/*! @brief Returns the value of the GLFW timer.
3197 *
3198 * This function returns the value of the GLFW timer. Unless the timer has
3199 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
3200 * was initialized.
3201 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003202 * The resolution of the timer is system dependent, but is usually on the order
3203 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
3204 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003205 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003206 * @return The current value, in seconds, or zero if an
3207 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003208 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003209 * @par Thread Safety
3210 * This function may be called from any thread. Access is not synchronized.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003211 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003212 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02003213 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003214 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003215 *
3216 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003217 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003218GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02003219
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003220/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003221 *
3222 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003223 * up from that value. The value must be a positive finite number less than
3224 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003225 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003226 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003227 *
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003228 * @remarks The upper limit of the timer is calculated as
3229 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
3230 * storing nanoseconds in 64 bits. The limit may be increased in the future.
3231 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003232 * @par Thread Safety
3233 * This function may only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003234 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003235 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01003236 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003237 * @since Added in GLFW 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003238 *
3239 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003240 */
3241GLFWAPI void glfwSetTime(double time);
3242
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003243/*! @brief Makes the context of the specified window current for the calling
3244 * thread.
3245 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003246 * This function makes the OpenGL or OpenGL ES context of the specified window
3247 * current on the calling thread. A context can only be made current on
3248 * a single thread at a time and each thread can have only a single current
3249 * context at a time.
3250 *
3251 * By default, making a context non-current implicitly forces a pipeline flush.
3252 * On machines that support `GL_KHR_context_flush_control`, you can control
3253 * whether a context performs this flush by setting the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003254 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003255 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003256 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003257 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003258 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003259 * @par Thread Safety
3260 * This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003261 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003262 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003263 * @sa glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01003264 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003265 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003266 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003267 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003268 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003269GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003270
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003271/*! @brief Returns the window whose context is current on the calling thread.
3272 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003273 * This function returns the window whose OpenGL or OpenGL ES context is
3274 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003275 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003276 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003277 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003278 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003279 * @par Thread Safety
3280 * This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003281 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003282 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003283 * @sa glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01003284 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003285 * @since Added in GLFW 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003286 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003287 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003288 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003289GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003290
3291/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003292 *
3293 * This function swaps the front and back buffers of the specified window. If
3294 * the swap interval is greater than zero, the GPU driver waits the specified
3295 * number of screen updates before swapping the buffers.
3296 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003297 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003298 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003299 * @par Thread Safety
3300 * This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01003301 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003302 * @sa @ref buffer_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003303 * @sa glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01003304 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003305 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003306 *
3307 * @par
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003308 * __GLFW 3:__ Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003309 *
3310 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003311 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003312GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003313
3314/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003315 *
3316 * This function sets the swap interval for the current context, i.e. the
Camilla Berglund4591ad22014-09-18 15:03:29 +02003317 * number of screen updates to wait from the time @ref glfwSwapBuffers was
3318 * called before swapping the buffers and returning. This is sometimes called
Camilla Berglundbb3dd312015-01-05 02:26:21 +01003319 * _vertical synchronization_, _vertical retrace synchronization_ or just
3320 * _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003321 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003322 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003323 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
3324 * which allow the driver to swap even if a frame arrives a little bit late.
3325 * You can check for the presence of these extensions using @ref
3326 * glfwExtensionSupported. For more information about swap tearing, see the
3327 * extension specifications.
3328 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003329 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003330 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003331 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003332 * @param[in] interval The minimum number of screen updates to wait for
3333 * until the buffers are swapped by @ref glfwSwapBuffers.
3334 *
Camilla Berglund11c22d62015-02-19 15:33:51 +01003335 * @remarks This function is not called during context creation, leaving the
3336 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02003337 * because some swap interval extensions used by GLFW do not allow the swap
3338 * interval to be reset to zero once it has been set to a non-zero value.
3339 *
Camilla Berglund11c22d62015-02-19 15:33:51 +01003340 * @remarks Some GPU drivers do not honor the requested swap interval, either
3341 * because of a user setting that overrides the application's request or due to
3342 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003343 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003344 * @par Thread Safety
3345 * This function may be called from any thread.
3346 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003347 * @sa @ref buffer_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003348 * @sa glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01003349 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003350 * @since Added in GLFW 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003351 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003352 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003353 */
3354GLFWAPI void glfwSwapInterval(int interval);
3355
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003356/*! @brief Returns whether the specified extension is available.
3357 *
Camilla Berglund608109c2013-04-11 20:18:46 +02003358 * This function returns whether the specified
Camilla Berglund11c22d62015-02-19 15:33:51 +01003359 * [client API extension](@ref context_glext) is supported by the current
3360 * OpenGL or OpenGL ES context. It searches both for OpenGL and OpenGL ES
3361 * extension and platform-specific context creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003362 *
3363 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003364 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003365 *
3366 * As this functions retrieves and searches one or more extension strings each
3367 * call, it is recommended that you cache its results if it is going to be used
3368 * frequently. The extension strings will not change during the lifetime of
3369 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003370 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003371 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003372 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
3373 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003374 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003375 * @par Thread Safety
3376 * This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003377 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003378 * @sa @ref context_glext
3379 * @sa glfwGetProcAddress
3380 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003381 * @since Added in GLFW 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003382 *
3383 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003384 */
3385GLFWAPI int glfwExtensionSupported(const char* extension);
3386
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003387/*! @brief Returns the address of the specified function for the current
3388 * context.
3389 *
Camilla Berglund608109c2013-04-11 20:18:46 +02003390 * This function returns the address of the specified
Camilla Berglund11c22d62015-02-19 15:33:51 +01003391 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02003392 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003393 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003394 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003395 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003396 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003397 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglundc8e06872015-08-27 21:40:22 +02003398 * @return The address of the function, or `NULL` if an [error](@ref
3399 * error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003400 *
Camilla Berglund40da56f2015-09-09 12:27:38 +02003401 * @remarks The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02003402 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003403 *
Camilla Berglund11c22d62015-02-19 15:33:51 +01003404 * @remarks This function may return a non-`NULL` address despite the
3405 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02003406 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01003407 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003408 * @par Pointer Lifetime
Camilla Berglund6be821c2014-10-06 23:18:33 +02003409 * The returned function pointer is valid until the context is destroyed or the
3410 * library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003411 *
3412 * @par Thread Safety
3413 * This function may be called from any thread.
3414 *
3415 * @sa @ref context_glext
3416 * @sa glfwExtensionSupported
3417 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003418 * @since Added in GLFW 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003419 *
3420 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003421 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02003422GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02003423
Camilla Berglund3249f812010-09-07 17:34:51 +02003424
Camilla Berglund4afc67c2011-07-27 17:09:17 +02003425/*************************************************************************
3426 * Global definition cleanup
3427 *************************************************************************/
3428
3429/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
3430
Camilla Berglund4afc67c2011-07-27 17:09:17 +02003431#ifdef GLFW_WINGDIAPI_DEFINED
3432 #undef WINGDIAPI
3433 #undef GLFW_WINGDIAPI_DEFINED
3434#endif
3435
3436#ifdef GLFW_CALLBACK_DEFINED
3437 #undef CALLBACK
3438 #undef GLFW_CALLBACK_DEFINED
3439#endif
3440
3441/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
3442
3443
Camilla Berglund3249f812010-09-07 17:34:51 +02003444#ifdef __cplusplus
3445}
3446#endif
3447
Camilla Berglundf8df91d2013-01-15 01:59:56 +01003448#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02003449