1 | /************************************************************************* |
2 | * GLFW 3.2 - www.glfw.org |
3 | * A library for OpenGL, window and input |
4 | *------------------------------------------------------------------------ |
5 | * Copyright (c) 2002-2006 Marcus Geelnard |
6 | * Copyright (c) 2006-2016 Camilla Berglund <elmindreda@glfw.org> |
7 | * |
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 | |
29 | #ifndef _glfw3_h_ |
30 | #define _glfw3_h_ |
31 | |
32 | #ifdef __cplusplus |
33 | extern "C" { |
34 | #endif |
35 | |
36 | |
37 | /************************************************************************* |
38 | * Doxygen documentation |
39 | *************************************************************************/ |
40 | |
41 | /*! @file glfw3.h |
42 | * @brief The header of the GLFW 3 API. |
43 | * |
44 | * This is the header file of the GLFW 3 API. It defines all its types and |
45 | * declares all its functions. |
46 | * |
47 | * For more information about how to use this file, see @ref build_include. |
48 | */ |
49 | /*! @defgroup context Context reference |
50 | * |
51 | * This is the reference documentation for OpenGL and OpenGL ES context related |
52 | * functions. For more task-oriented information, see the @ref context_guide. |
53 | */ |
54 | /*! @defgroup vulkan Vulkan reference |
55 | * |
56 | * This is the reference documentation for Vulkan related functions and types. |
57 | * For more task-oriented information, see the @ref vulkan_guide. |
58 | */ |
59 | /*! @defgroup init Initialization, version and error reference |
60 | * |
61 | * This is the reference documentation for initialization and termination of |
62 | * the library, version management and error handling. For more task-oriented |
63 | * information, see the @ref intro_guide. |
64 | */ |
65 | /*! @defgroup input Input reference |
66 | * |
67 | * This is the reference documentation for input related functions and types. |
68 | * For more task-oriented information, see the @ref input_guide. |
69 | */ |
70 | /*! @defgroup monitor Monitor reference |
71 | * |
72 | * This is the reference documentation for monitor related functions and types. |
73 | * For more task-oriented information, see the @ref monitor_guide. |
74 | */ |
75 | /*! @defgroup window Window reference |
76 | * |
77 | * This is the reference documentation for window related functions and types, |
78 | * including creation, deletion and event polling. For more task-oriented |
79 | * information, see the @ref window_guide. |
80 | */ |
81 | |
82 | |
83 | /************************************************************************* |
84 | * Compiler- and platform-specific preprocessor work |
85 | *************************************************************************/ |
86 | |
87 | /* If we are we on Windows, we want a single define for it. |
88 | */ |
89 | #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)) |
90 | #define _WIN32 |
91 | #endif /* _WIN32 */ |
92 | |
93 | /* It is customary to use APIENTRY for OpenGL function pointer declarations on |
94 | * all platforms. Additionally, the Windows OpenGL header needs APIENTRY. |
95 | */ |
96 | #ifndef APIENTRY |
97 | #ifdef _WIN32 |
98 | #define APIENTRY __stdcall |
99 | #else |
100 | #define APIENTRY |
101 | #endif |
102 | #endif /* APIENTRY */ |
103 | |
104 | /* Some Windows OpenGL headers need this. |
105 | */ |
106 | #if !defined(WINGDIAPI) && defined(_WIN32) |
107 | #define WINGDIAPI __declspec(dllimport) |
108 | #define GLFW_WINGDIAPI_DEFINED |
109 | #endif /* WINGDIAPI */ |
110 | |
111 | /* Some Windows GLU headers need this. |
112 | */ |
113 | #if !defined(CALLBACK) && defined(_WIN32) |
114 | #define CALLBACK __stdcall |
115 | #define GLFW_CALLBACK_DEFINED |
116 | #endif /* CALLBACK */ |
117 | |
118 | /* Most Windows GLU headers need wchar_t. |
119 | * The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h. |
120 | * Include it unconditionally to avoid surprising side-effects. |
121 | */ |
122 | #include <stddef.h> |
123 | #include <stdint.h> |
124 | |
125 | /* Include the chosen client API headers. |
126 | */ |
127 | #if defined(__APPLE__) |
128 | #if defined(GLFW_INCLUDE_GLCOREARB) |
129 | #include <OpenGL/gl3.h> |
130 | #if defined(GLFW_INCLUDE_GLEXT) |
131 | #include <OpenGL/gl3ext.h> |
132 | #endif |
133 | #elif !defined(GLFW_INCLUDE_NONE) |
134 | #if !defined(GLFW_INCLUDE_GLEXT) |
135 | #define GL_GLEXT_LEGACY |
136 | #endif |
137 | #include <OpenGL/gl.h> |
138 | #endif |
139 | #if defined(GLFW_INCLUDE_GLU) |
140 | #include <OpenGL/glu.h> |
141 | #endif |
142 | #else |
143 | #if defined(GLFW_INCLUDE_GLCOREARB) |
144 | #include <GL/glcorearb.h> |
145 | #elif defined(GLFW_INCLUDE_ES1) |
146 | #include <GLES/gl.h> |
147 | #if defined(GLFW_INCLUDE_GLEXT) |
148 | #include <GLES/glext.h> |
149 | #endif |
150 | #elif defined(GLFW_INCLUDE_ES2) |
151 | #include <GLES2/gl2.h> |
152 | #if defined(GLFW_INCLUDE_GLEXT) |
153 | #include <GLES2/gl2ext.h> |
154 | #endif |
155 | #elif defined(GLFW_INCLUDE_ES3) |
156 | #include <GLES3/gl3.h> |
157 | #if defined(GLFW_INCLUDE_GLEXT) |
158 | #include <GLES2/gl2ext.h> |
159 | #endif |
160 | #elif defined(GLFW_INCLUDE_ES31) |
161 | #include <GLES3/gl31.h> |
162 | #if defined(GLFW_INCLUDE_GLEXT) |
163 | #include <GLES2/gl2ext.h> |
164 | #endif |
165 | #elif defined(GLFW_INCLUDE_VULKAN) |
166 | #include <vulkan/vulkan.h> |
167 | #elif !defined(GLFW_INCLUDE_NONE) |
168 | #include <GL/gl.h> |
169 | #if defined(GLFW_INCLUDE_GLEXT) |
170 | #include <GL/glext.h> |
171 | #endif |
172 | #endif |
173 | #if defined(GLFW_INCLUDE_GLU) |
174 | #include <GL/glu.h> |
175 | #endif |
176 | #endif |
177 | |
178 | #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) |
179 | /* GLFW_DLL must be defined by applications that are linking against the DLL |
180 | * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW |
181 | * configuration header when compiling the DLL version of the library. |
182 | */ |
183 | #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" |
184 | #endif |
185 | |
186 | /* GLFWAPI is used to declare public API functions for export |
187 | * from the DLL / shared library / dynamic library. |
188 | */ |
189 | #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) |
190 | /* We are building GLFW as a Win32 DLL */ |
191 | #define GLFWAPI __declspec(dllexport) |
192 | #elif defined(_WIN32) && defined(GLFW_DLL) |
193 | /* We are calling GLFW as a Win32 DLL */ |
194 | #define GLFWAPI __declspec(dllimport) |
195 | #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) |
196 | /* We are building GLFW as a shared / dynamic library */ |
197 | #define GLFWAPI __attribute__((visibility("default"))) |
198 | #else |
199 | /* We are building or calling GLFW as a static library */ |
200 | #define GLFWAPI |
201 | #endif |
202 | |
203 | |
204 | /************************************************************************* |
205 | * GLFW API tokens |
206 | *************************************************************************/ |
207 | |
208 | /*! @name GLFW version macros |
209 | * @{ */ |
210 | /*! @brief The major version number of the GLFW library. |
211 | * |
212 | * This is incremented when the API is changed in non-compatible ways. |
213 | * @ingroup init |
214 | */ |
215 | #define GLFW_VERSION_MAJOR 3 |
216 | /*! @brief The minor version number of the GLFW library. |
217 | * |
218 | * This is incremented when features are added to the API but it remains |
219 | * backward-compatible. |
220 | * @ingroup init |
221 | */ |
222 | #define GLFW_VERSION_MINOR 2 |
223 | /*! @brief The revision number of the GLFW library. |
224 | * |
225 | * This is incremented when a bug fix release is made that does not contain any |
226 | * API changes. |
227 | * @ingroup init |
228 | */ |
229 | #define GLFW_VERSION_REVISION 0 |
230 | /*! @} */ |
231 | |
232 | /*! @name Boolean values |
233 | * @{ */ |
234 | /*! @brief One. |
235 | * |
236 | * One. Seriously. You don't _need_ to use this symbol in your code. It's |
237 | * just semantic sugar for the number 1. You can use `1` or `true` or `_True` |
238 | * or `GL_TRUE` or whatever you want. |
239 | */ |
240 | #define GLFW_TRUE 1 |
241 | /*! @brief Zero. |
242 | * |
243 | * Zero. Seriously. You don't _need_ to use this symbol in your code. It's |
244 | * just just semantic sugar for the number 0. You can use `0` or `false` or |
245 | * `_False` or `GL_FALSE` or whatever you want. |
246 | */ |
247 | #define GLFW_FALSE 0 |
248 | /*! @} */ |
249 | |
250 | /*! @name Key and button actions |
251 | * @{ */ |
252 | /*! @brief The key or mouse button was released. |
253 | * |
254 | * The key or mouse button was released. |
255 | * |
256 | * @ingroup input |
257 | */ |
258 | #define GLFW_RELEASE 0 |
259 | /*! @brief The key or mouse button was pressed. |
260 | * |
261 | * The key or mouse button was pressed. |
262 | * |
263 | * @ingroup input |
264 | */ |
265 | #define GLFW_PRESS 1 |
266 | /*! @brief The key was held down until it repeated. |
267 | * |
268 | * The key was held down until it repeated. |
269 | * |
270 | * @ingroup input |
271 | */ |
272 | #define GLFW_REPEAT 2 |
273 | /*! @} */ |
274 | |
275 | /*! @defgroup keys Keyboard keys |
276 | * |
277 | * See [key input](@ref input_key) for how these are used. |
278 | * |
279 | * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), |
280 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
281 | * put in the 256+ range). |
282 | * |
283 | * The naming of the key codes follow these rules: |
284 | * - The US keyboard layout is used |
285 | * - Names of printable alpha-numeric characters are used (e.g. "A", "R", |
286 | * "3", etc.) |
287 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
288 | * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not |
289 | * correspond to the Unicode standard (usually for brevity) |
290 | * - Keys that lack a clear US mapping are named "WORLD_x" |
291 | * - For non-printable keys, custom names are used (e.g. "F4", |
292 | * "BACKSPACE", etc.) |
293 | * |
294 | * @ingroup input |
295 | * @{ |
296 | */ |
297 | |
298 | /* The unknown key */ |
299 | #define GLFW_KEY_UNKNOWN -1 |
300 | |
301 | /* Printable keys */ |
302 | #define GLFW_KEY_SPACE 32 |
303 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
304 | #define GLFW_KEY_COMMA 44 /* , */ |
305 | #define GLFW_KEY_MINUS 45 /* - */ |
306 | #define GLFW_KEY_PERIOD 46 /* . */ |
307 | #define GLFW_KEY_SLASH 47 /* / */ |
308 | #define GLFW_KEY_0 48 |
309 | #define GLFW_KEY_1 49 |
310 | #define GLFW_KEY_2 50 |
311 | #define GLFW_KEY_3 51 |
312 | #define GLFW_KEY_4 52 |
313 | #define GLFW_KEY_5 53 |
314 | #define GLFW_KEY_6 54 |
315 | #define GLFW_KEY_7 55 |
316 | #define GLFW_KEY_8 56 |
317 | #define GLFW_KEY_9 57 |
318 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
319 | #define GLFW_KEY_EQUAL 61 /* = */ |
320 | #define GLFW_KEY_A 65 |
321 | #define GLFW_KEY_B 66 |
322 | #define GLFW_KEY_C 67 |
323 | #define GLFW_KEY_D 68 |
324 | #define GLFW_KEY_E 69 |
325 | #define GLFW_KEY_F 70 |
326 | #define GLFW_KEY_G 71 |
327 | #define GLFW_KEY_H 72 |
328 | #define GLFW_KEY_I 73 |
329 | #define GLFW_KEY_J 74 |
330 | #define GLFW_KEY_K 75 |
331 | #define GLFW_KEY_L 76 |
332 | #define GLFW_KEY_M 77 |
333 | #define GLFW_KEY_N 78 |
334 | #define GLFW_KEY_O 79 |
335 | #define GLFW_KEY_P 80 |
336 | #define GLFW_KEY_Q 81 |
337 | #define GLFW_KEY_R 82 |
338 | #define GLFW_KEY_S 83 |
339 | #define GLFW_KEY_T 84 |
340 | #define GLFW_KEY_U 85 |
341 | #define GLFW_KEY_V 86 |
342 | #define GLFW_KEY_W 87 |
343 | #define GLFW_KEY_X 88 |
344 | #define GLFW_KEY_Y 89 |
345 | #define GLFW_KEY_Z 90 |
346 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
347 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
348 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
349 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
350 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
351 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
352 | |
353 | /* Function keys */ |
354 | #define GLFW_KEY_ESCAPE 256 |
355 | #define GLFW_KEY_ENTER 257 |
356 | #define GLFW_KEY_TAB 258 |
357 | #define GLFW_KEY_BACKSPACE 259 |
358 | #define GLFW_KEY_INSERT 260 |
359 | #define GLFW_KEY_DELETE 261 |
360 | #define GLFW_KEY_RIGHT 262 |
361 | #define GLFW_KEY_LEFT 263 |
362 | #define GLFW_KEY_DOWN 264 |
363 | #define GLFW_KEY_UP 265 |
364 | #define GLFW_KEY_PAGE_UP 266 |
365 | #define GLFW_KEY_PAGE_DOWN 267 |
366 | #define GLFW_KEY_HOME 268 |
367 | #define GLFW_KEY_END 269 |
368 | #define GLFW_KEY_CAPS_LOCK 280 |
369 | #define GLFW_KEY_SCROLL_LOCK 281 |
370 | #define GLFW_KEY_NUM_LOCK 282 |
371 | #define GLFW_KEY_PRINT_SCREEN 283 |
372 | #define GLFW_KEY_PAUSE 284 |
373 | #define GLFW_KEY_F1 290 |
374 | #define GLFW_KEY_F2 291 |
375 | #define GLFW_KEY_F3 292 |
376 | #define GLFW_KEY_F4 293 |
377 | #define GLFW_KEY_F5 294 |
378 | #define GLFW_KEY_F6 295 |
379 | #define GLFW_KEY_F7 296 |
380 | #define GLFW_KEY_F8 297 |
381 | #define GLFW_KEY_F9 298 |
382 | #define GLFW_KEY_F10 299 |
383 | #define GLFW_KEY_F11 300 |
384 | #define GLFW_KEY_F12 301 |
385 | #define GLFW_KEY_F13 302 |
386 | #define GLFW_KEY_F14 303 |
387 | #define GLFW_KEY_F15 304 |
388 | #define GLFW_KEY_F16 305 |
389 | #define GLFW_KEY_F17 306 |
390 | #define GLFW_KEY_F18 307 |
391 | #define GLFW_KEY_F19 308 |
392 | #define GLFW_KEY_F20 309 |
393 | #define GLFW_KEY_F21 310 |
394 | #define GLFW_KEY_F22 311 |
395 | #define GLFW_KEY_F23 312 |
396 | #define GLFW_KEY_F24 313 |
397 | #define GLFW_KEY_F25 314 |
398 | #define GLFW_KEY_KP_0 320 |
399 | #define GLFW_KEY_KP_1 321 |
400 | #define GLFW_KEY_KP_2 322 |
401 | #define GLFW_KEY_KP_3 323 |
402 | #define GLFW_KEY_KP_4 324 |
403 | #define GLFW_KEY_KP_5 325 |
404 | #define GLFW_KEY_KP_6 326 |
405 | #define GLFW_KEY_KP_7 327 |
406 | #define GLFW_KEY_KP_8 328 |
407 | #define GLFW_KEY_KP_9 329 |
408 | #define GLFW_KEY_KP_DECIMAL 330 |
409 | #define GLFW_KEY_KP_DIVIDE 331 |
410 | #define GLFW_KEY_KP_MULTIPLY 332 |
411 | #define GLFW_KEY_KP_SUBTRACT 333 |
412 | #define GLFW_KEY_KP_ADD 334 |
413 | #define GLFW_KEY_KP_ENTER 335 |
414 | #define GLFW_KEY_KP_EQUAL 336 |
415 | #define GLFW_KEY_LEFT_SHIFT 340 |
416 | #define GLFW_KEY_LEFT_CONTROL 341 |
417 | #define GLFW_KEY_LEFT_ALT 342 |
418 | #define GLFW_KEY_LEFT_SUPER 343 |
419 | #define GLFW_KEY_RIGHT_SHIFT 344 |
420 | #define GLFW_KEY_RIGHT_CONTROL 345 |
421 | #define GLFW_KEY_RIGHT_ALT 346 |
422 | #define GLFW_KEY_RIGHT_SUPER 347 |
423 | #define 348 |
424 | |
425 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
426 | |
427 | /*! @} */ |
428 | |
429 | /*! @defgroup mods Modifier key flags |
430 | * |
431 | * See [key input](@ref input_key) for how these are used. |
432 | * |
433 | * @ingroup input |
434 | * @{ */ |
435 | |
436 | /*! @brief If this bit is set one or more Shift keys were held down. |
437 | */ |
438 | #define GLFW_MOD_SHIFT 0x0001 |
439 | /*! @brief If this bit is set one or more Control keys were held down. |
440 | */ |
441 | #define GLFW_MOD_CONTROL 0x0002 |
442 | /*! @brief If this bit is set one or more Alt keys were held down. |
443 | */ |
444 | #define GLFW_MOD_ALT 0x0004 |
445 | /*! @brief If this bit is set one or more Super keys were held down. |
446 | */ |
447 | #define GLFW_MOD_SUPER 0x0008 |
448 | |
449 | /*! @} */ |
450 | |
451 | /*! @defgroup buttons Mouse buttons |
452 | * |
453 | * See [mouse button input](@ref input_mouse_button) for how these are used. |
454 | * |
455 | * @ingroup input |
456 | * @{ */ |
457 | #define GLFW_MOUSE_BUTTON_1 0 |
458 | #define GLFW_MOUSE_BUTTON_2 1 |
459 | #define GLFW_MOUSE_BUTTON_3 2 |
460 | #define GLFW_MOUSE_BUTTON_4 3 |
461 | #define GLFW_MOUSE_BUTTON_5 4 |
462 | #define GLFW_MOUSE_BUTTON_6 5 |
463 | #define GLFW_MOUSE_BUTTON_7 6 |
464 | #define GLFW_MOUSE_BUTTON_8 7 |
465 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
466 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
467 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
468 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
469 | /*! @} */ |
470 | |
471 | /*! @defgroup joysticks Joysticks |
472 | * |
473 | * See [joystick input](@ref joystick) for how these are used. |
474 | * |
475 | * @ingroup input |
476 | * @{ */ |
477 | #define GLFW_JOYSTICK_1 0 |
478 | #define GLFW_JOYSTICK_2 1 |
479 | #define GLFW_JOYSTICK_3 2 |
480 | #define GLFW_JOYSTICK_4 3 |
481 | #define GLFW_JOYSTICK_5 4 |
482 | #define GLFW_JOYSTICK_6 5 |
483 | #define GLFW_JOYSTICK_7 6 |
484 | #define GLFW_JOYSTICK_8 7 |
485 | #define GLFW_JOYSTICK_9 8 |
486 | #define GLFW_JOYSTICK_10 9 |
487 | #define GLFW_JOYSTICK_11 10 |
488 | #define GLFW_JOYSTICK_12 11 |
489 | #define GLFW_JOYSTICK_13 12 |
490 | #define GLFW_JOYSTICK_14 13 |
491 | #define GLFW_JOYSTICK_15 14 |
492 | #define GLFW_JOYSTICK_16 15 |
493 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
494 | /*! @} */ |
495 | |
496 | /*! @defgroup errors Error codes |
497 | * |
498 | * See [error handling](@ref error_handling) for how these are used. |
499 | * |
500 | * @ingroup init |
501 | * @{ */ |
502 | /*! @brief GLFW has not been initialized. |
503 | * |
504 | * This occurs if a GLFW function was called that must not be called unless the |
505 | * library is [initialized](@ref intro_init). |
506 | * |
507 | * @analysis Application programmer error. Initialize GLFW before calling any |
508 | * function that requires initialization. |
509 | */ |
510 | #define GLFW_NOT_INITIALIZED 0x00010001 |
511 | /*! @brief No context is current for this thread. |
512 | * |
513 | * This occurs if a GLFW function was called that needs and operates on the |
514 | * current OpenGL or OpenGL ES context but no context is current on the calling |
515 | * thread. One such function is @ref glfwSwapInterval. |
516 | * |
517 | * @analysis Application programmer error. Ensure a context is current before |
518 | * calling functions that require a current context. |
519 | */ |
520 | #define GLFW_NO_CURRENT_CONTEXT 0x00010002 |
521 | /*! @brief One of the arguments to the function was an invalid enum value. |
522 | * |
523 | * One of the arguments to the function was an invalid enum value, for example |
524 | * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref |
525 | * glfwGetWindowAttrib. |
526 | * |
527 | * @analysis Application programmer error. Fix the offending call. |
528 | */ |
529 | #define GLFW_INVALID_ENUM 0x00010003 |
530 | /*! @brief One of the arguments to the function was an invalid value. |
531 | * |
532 | * One of the arguments to the function was an invalid value, for example |
533 | * requesting a non-existent OpenGL or OpenGL ES version like 2.7. |
534 | * |
535 | * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead |
536 | * result in a @ref GLFW_VERSION_UNAVAILABLE error. |
537 | * |
538 | * @analysis Application programmer error. Fix the offending call. |
539 | */ |
540 | #define GLFW_INVALID_VALUE 0x00010004 |
541 | /*! @brief A memory allocation failed. |
542 | * |
543 | * A memory allocation failed. |
544 | * |
545 | * @analysis A bug in GLFW or the underlying operating system. Report the bug |
546 | * to our [issue tracker](https://github.com/glfw/glfw/issues). |
547 | */ |
548 | #define GLFW_OUT_OF_MEMORY 0x00010005 |
549 | /*! @brief GLFW could not find support for the requested API on the system. |
550 | * |
551 | * GLFW could not find support for the requested API on the system. |
552 | * |
553 | * @analysis The installed graphics driver does not support the requested |
554 | * API, or does not support it via the chosen context creation backend. |
555 | * Below are a few examples. |
556 | * |
557 | * @par |
558 | * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only |
559 | * supports OpenGL ES via EGL, while Nvidia and Intel only support it via |
560 | * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa |
561 | * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary |
562 | * driver. Older graphics drivers do not support Vulkan. |
563 | */ |
564 | #define GLFW_API_UNAVAILABLE 0x00010006 |
565 | /*! @brief The requested OpenGL or OpenGL ES version is not available. |
566 | * |
567 | * The requested OpenGL or OpenGL ES version (including any requested context |
568 | * or framebuffer hints) is not available on this machine. |
569 | * |
570 | * @analysis The machine does not support your requirements. If your |
571 | * application is sufficiently flexible, downgrade your requirements and try |
572 | * again. Otherwise, inform the user that their machine does not match your |
573 | * requirements. |
574 | * |
575 | * @par |
576 | * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 |
577 | * comes out before the 4.x series gets that far, also fail with this error and |
578 | * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions |
579 | * will exist. |
580 | */ |
581 | #define GLFW_VERSION_UNAVAILABLE 0x00010007 |
582 | /*! @brief A platform-specific error occurred that does not match any of the |
583 | * more specific categories. |
584 | * |
585 | * A platform-specific error occurred that does not match any of the more |
586 | * specific categories. |
587 | * |
588 | * @analysis A bug or configuration error in GLFW, the underlying operating |
589 | * system or its drivers, or a lack of required resources. Report the issue to |
590 | * our [issue tracker](https://github.com/glfw/glfw/issues). |
591 | */ |
592 | #define GLFW_PLATFORM_ERROR 0x00010008 |
593 | /*! @brief The requested format is not supported or available. |
594 | * |
595 | * If emitted during window creation, the requested pixel format is not |
596 | * supported. |
597 | * |
598 | * If emitted when querying the clipboard, the contents of the clipboard could |
599 | * not be converted to the requested format. |
600 | * |
601 | * @analysis If emitted during window creation, one or more |
602 | * [hard constraints](@ref window_hints_hard) did not match any of the |
603 | * available pixel formats. If your application is sufficiently flexible, |
604 | * downgrade your requirements and try again. Otherwise, inform the user that |
605 | * their machine does not match your requirements. |
606 | * |
607 | * @par |
608 | * If emitted when querying the clipboard, ignore the error or report it to |
609 | * the user, as appropriate. |
610 | */ |
611 | #define GLFW_FORMAT_UNAVAILABLE 0x00010009 |
612 | /*! @brief The specified window does not have an OpenGL or OpenGL ES context. |
613 | * |
614 | * A window that does not have an OpenGL or OpenGL ES context was passed to |
615 | * a function that requires it to have one. |
616 | * |
617 | * @analysis Application programmer error. Fix the offending call. |
618 | */ |
619 | #define GLFW_NO_WINDOW_CONTEXT 0x0001000A |
620 | /*! @} */ |
621 | |
622 | #define GLFW_FOCUSED 0x00020001 |
623 | #define GLFW_ICONIFIED 0x00020002 |
624 | #define GLFW_RESIZABLE 0x00020003 |
625 | #define GLFW_VISIBLE 0x00020004 |
626 | #define GLFW_DECORATED 0x00020005 |
627 | #define GLFW_AUTO_ICONIFY 0x00020006 |
628 | #define GLFW_FLOATING 0x00020007 |
629 | #define GLFW_MAXIMIZED 0x00020008 |
630 | |
631 | #define GLFW_RED_BITS 0x00021001 |
632 | #define GLFW_GREEN_BITS 0x00021002 |
633 | #define GLFW_BLUE_BITS 0x00021003 |
634 | #define GLFW_ALPHA_BITS 0x00021004 |
635 | #define GLFW_DEPTH_BITS 0x00021005 |
636 | #define GLFW_STENCIL_BITS 0x00021006 |
637 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
638 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
639 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
640 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
641 | #define GLFW_AUX_BUFFERS 0x0002100B |
642 | #define GLFW_STEREO 0x0002100C |
643 | #define GLFW_SAMPLES 0x0002100D |
644 | #define GLFW_SRGB_CAPABLE 0x0002100E |
645 | #define GLFW_REFRESH_RATE 0x0002100F |
646 | #define GLFW_DOUBLEBUFFER 0x00021010 |
647 | |
648 | #define GLFW_CLIENT_API 0x00022001 |
649 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
650 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
651 | #define GLFW_CONTEXT_REVISION 0x00022004 |
652 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
653 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
654 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 |
655 | #define GLFW_OPENGL_PROFILE 0x00022008 |
656 | #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 |
657 | #define GLFW_CONTEXT_NO_ERROR 0x0002200A |
658 | #define GLFW_CONTEXT_CREATION_API 0x0002200B |
659 | |
660 | #define GLFW_NO_API 0 |
661 | #define GLFW_OPENGL_API 0x00030001 |
662 | #define GLFW_OPENGL_ES_API 0x00030002 |
663 | |
664 | #define GLFW_NO_ROBUSTNESS 0 |
665 | #define GLFW_NO_RESET_NOTIFICATION 0x00031001 |
666 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
667 | |
668 | #define GLFW_OPENGL_ANY_PROFILE 0 |
669 | #define GLFW_OPENGL_CORE_PROFILE 0x00032001 |
670 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
671 | |
672 | #define GLFW_CURSOR 0x00033001 |
673 | #define GLFW_STICKY_KEYS 0x00033002 |
674 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
675 | |
676 | #define GLFW_CURSOR_NORMAL 0x00034001 |
677 | #define GLFW_CURSOR_HIDDEN 0x00034002 |
678 | #define GLFW_CURSOR_DISABLED 0x00034003 |
679 | |
680 | #define GLFW_ANY_RELEASE_BEHAVIOR 0 |
681 | #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 |
682 | #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 |
683 | |
684 | #define GLFW_NATIVE_CONTEXT_API 0x00036001 |
685 | #define GLFW_EGL_CONTEXT_API 0x00036002 |
686 | |
687 | /*! @defgroup shapes Standard cursor shapes |
688 | * |
689 | * See [standard cursor creation](@ref cursor_standard) for how these are used. |
690 | * |
691 | * @ingroup input |
692 | * @{ */ |
693 | |
694 | /*! @brief The regular arrow cursor shape. |
695 | * |
696 | * The regular arrow cursor. |
697 | */ |
698 | #define GLFW_ARROW_CURSOR 0x00036001 |
699 | /*! @brief The text input I-beam cursor shape. |
700 | * |
701 | * The text input I-beam cursor shape. |
702 | */ |
703 | #define GLFW_IBEAM_CURSOR 0x00036002 |
704 | /*! @brief The crosshair shape. |
705 | * |
706 | * The crosshair shape. |
707 | */ |
708 | #define GLFW_CROSSHAIR_CURSOR 0x00036003 |
709 | /*! @brief The hand shape. |
710 | * |
711 | * The hand shape. |
712 | */ |
713 | #define GLFW_HAND_CURSOR 0x00036004 |
714 | /*! @brief The horizontal resize arrow shape. |
715 | * |
716 | * The horizontal resize arrow shape. |
717 | */ |
718 | #define GLFW_HRESIZE_CURSOR 0x00036005 |
719 | /*! @brief The vertical resize arrow shape. |
720 | * |
721 | * The vertical resize arrow shape. |
722 | */ |
723 | #define GLFW_VRESIZE_CURSOR 0x00036006 |
724 | /*! @} */ |
725 | |
726 | #define GLFW_CONNECTED 0x00040001 |
727 | #define GLFW_DISCONNECTED 0x00040002 |
728 | |
729 | #define GLFW_DONT_CARE -1 |
730 | |
731 | |
732 | /************************************************************************* |
733 | * GLFW API types |
734 | *************************************************************************/ |
735 | |
736 | /*! @brief Client API function pointer type. |
737 | * |
738 | * Generic function pointer used for returning client API function pointers |
739 | * without forcing a cast from a regular pointer. |
740 | * |
741 | * @sa @ref context_glext |
742 | * @sa glfwGetProcAddress |
743 | * |
744 | * @since Added in version 3.0. |
745 | |
746 | * @ingroup context |
747 | */ |
748 | typedef void (*GLFWglproc)(void); |
749 | |
750 | /*! @brief Vulkan API function pointer type. |
751 | * |
752 | * Generic function pointer used for returning Vulkan API function pointers |
753 | * without forcing a cast from a regular pointer. |
754 | * |
755 | * @sa @ref vulkan_proc |
756 | * @sa glfwGetInstanceProcAddress |
757 | * |
758 | * @since Added in version 3.2. |
759 | * |
760 | * @ingroup vulkan |
761 | */ |
762 | typedef void (*GLFWvkproc)(void); |
763 | |
764 | /*! @brief Opaque monitor object. |
765 | * |
766 | * Opaque monitor object. |
767 | * |
768 | * @see @ref monitor_object |
769 | * |
770 | * @since Added in version 3.0. |
771 | * |
772 | * @ingroup monitor |
773 | */ |
774 | typedef struct GLFWmonitor GLFWmonitor; |
775 | |
776 | /*! @brief Opaque window object. |
777 | * |
778 | * Opaque window object. |
779 | * |
780 | * @see @ref window_object |
781 | * |
782 | * @since Added in version 3.0. |
783 | * |
784 | * @ingroup window |
785 | */ |
786 | typedef struct GLFWwindow GLFWwindow; |
787 | |
788 | /*! @brief Opaque cursor object. |
789 | * |
790 | * Opaque cursor object. |
791 | * |
792 | * @see @ref cursor_object |
793 | * |
794 | * @since Added in version 3.1. |
795 | * |
796 | * @ingroup cursor |
797 | */ |
798 | typedef struct GLFWcursor GLFWcursor; |
799 | |
800 | /*! @brief The function signature for error callbacks. |
801 | * |
802 | * This is the function signature for error callback functions. |
803 | * |
804 | * @param[in] error An [error code](@ref errors). |
805 | * @param[in] description A UTF-8 encoded string describing the error. |
806 | * |
807 | * @sa @ref error_handling |
808 | * @sa glfwSetErrorCallback |
809 | * |
810 | * @since Added in version 3.0. |
811 | * |
812 | * @ingroup init |
813 | */ |
814 | typedef void (* GLFWerrorfun)(int,const char*); |
815 | |
816 | /*! @brief The function signature for window position callbacks. |
817 | * |
818 | * This is the function signature for window position callback functions. |
819 | * |
820 | * @param[in] window The window that was moved. |
821 | * @param[in] xpos The new x-coordinate, in screen coordinates, of the |
822 | * upper-left corner of the client area of the window. |
823 | * @param[in] ypos The new y-coordinate, in screen coordinates, of the |
824 | * upper-left corner of the client area of the window. |
825 | * |
826 | * @sa @ref window_pos |
827 | * @sa glfwSetWindowPosCallback |
828 | * |
829 | * @since Added in version 3.0. |
830 | * |
831 | * @ingroup window |
832 | */ |
833 | typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); |
834 | |
835 | /*! @brief The function signature for window resize callbacks. |
836 | * |
837 | * This is the function signature for window size callback functions. |
838 | * |
839 | * @param[in] window The window that was resized. |
840 | * @param[in] width The new width, in screen coordinates, of the window. |
841 | * @param[in] height The new height, in screen coordinates, of the window. |
842 | * |
843 | * @sa @ref window_size |
844 | * @sa glfwSetWindowSizeCallback |
845 | * |
846 | * @since Added in version 1.0. |
847 | * @glfw3 Added window handle parameter. |
848 | * |
849 | * @ingroup window |
850 | */ |
851 | typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); |
852 | |
853 | /*! @brief The function signature for window close callbacks. |
854 | * |
855 | * This is the function signature for window close callback functions. |
856 | * |
857 | * @param[in] window The window that the user attempted to close. |
858 | * |
859 | * @sa @ref window_close |
860 | * @sa glfwSetWindowCloseCallback |
861 | * |
862 | * @since Added in version 2.5. |
863 | * @glfw3 Added window handle parameter. |
864 | * |
865 | * @ingroup window |
866 | */ |
867 | typedef void (* GLFWwindowclosefun)(GLFWwindow*); |
868 | |
869 | /*! @brief The function signature for window content refresh callbacks. |
870 | * |
871 | * This is the function signature for window refresh callback functions. |
872 | * |
873 | * @param[in] window The window whose content needs to be refreshed. |
874 | * |
875 | * @sa @ref window_refresh |
876 | * @sa glfwSetWindowRefreshCallback |
877 | * |
878 | * @since Added in version 2.5. |
879 | * @glfw3 Added window handle parameter. |
880 | * |
881 | * @ingroup window |
882 | */ |
883 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); |
884 | |
885 | /*! @brief The function signature for window focus/defocus callbacks. |
886 | * |
887 | * This is the function signature for window focus callback functions. |
888 | * |
889 | * @param[in] window The window that gained or lost input focus. |
890 | * @param[in] focused `GLFW_TRUE` if the window was given input focus, or |
891 | * `GLFW_FALSE` if it lost it. |
892 | * |
893 | * @sa @ref window_focus |
894 | * @sa glfwSetWindowFocusCallback |
895 | * |
896 | * @since Added in version 3.0. |
897 | * |
898 | * @ingroup window |
899 | */ |
900 | typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); |
901 | |
902 | /*! @brief The function signature for window iconify/restore callbacks. |
903 | * |
904 | * This is the function signature for window iconify/restore callback |
905 | * functions. |
906 | * |
907 | * @param[in] window The window that was iconified or restored. |
908 | * @param[in] iconified `GLFW_TRUE` if the window was iconified, or |
909 | * `GLFW_FALSE` if it was restored. |
910 | * |
911 | * @sa @ref window_iconify |
912 | * @sa glfwSetWindowIconifyCallback |
913 | * |
914 | * @since Added in version 3.0. |
915 | * |
916 | * @ingroup window |
917 | */ |
918 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); |
919 | |
920 | /*! @brief The function signature for framebuffer resize callbacks. |
921 | * |
922 | * This is the function signature for framebuffer resize callback |
923 | * functions. |
924 | * |
925 | * @param[in] window The window whose framebuffer was resized. |
926 | * @param[in] width The new width, in pixels, of the framebuffer. |
927 | * @param[in] height The new height, in pixels, of the framebuffer. |
928 | * |
929 | * @sa @ref window_fbsize |
930 | * @sa glfwSetFramebufferSizeCallback |
931 | * |
932 | * @since Added in version 3.0. |
933 | * |
934 | * @ingroup window |
935 | */ |
936 | typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); |
937 | |
938 | /*! @brief The function signature for mouse button callbacks. |
939 | * |
940 | * This is the function signature for mouse button callback functions. |
941 | * |
942 | * @param[in] window The window that received the event. |
943 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
944 | * released. |
945 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. |
946 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
947 | * held down. |
948 | * |
949 | * @sa @ref input_mouse_button |
950 | * @sa glfwSetMouseButtonCallback |
951 | * |
952 | * @since Added in version 1.0. |
953 | * @glfw3 Added window handle and modifier mask parameters. |
954 | * |
955 | * @ingroup input |
956 | */ |
957 | typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); |
958 | |
959 | /*! @brief The function signature for cursor position callbacks. |
960 | * |
961 | * This is the function signature for cursor position callback functions. |
962 | * |
963 | * @param[in] window The window that received the event. |
964 | * @param[in] xpos The new cursor x-coordinate, relative to the left edge of |
965 | * the client area. |
966 | * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the |
967 | * client area. |
968 | * |
969 | * @sa @ref cursor_pos |
970 | * @sa glfwSetCursorPosCallback |
971 | * |
972 | * @since Added in version 3.0. Replaces `GLFWmouseposfun`. |
973 | * |
974 | * @ingroup input |
975 | */ |
976 | typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); |
977 | |
978 | /*! @brief The function signature for cursor enter/leave callbacks. |
979 | * |
980 | * This is the function signature for cursor enter/leave callback functions. |
981 | * |
982 | * @param[in] window The window that received the event. |
983 | * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client |
984 | * area, or `GLFW_FALSE` if it left it. |
985 | * |
986 | * @sa @ref cursor_enter |
987 | * @sa glfwSetCursorEnterCallback |
988 | * |
989 | * @since Added in version 3.0. |
990 | * |
991 | * @ingroup input |
992 | */ |
993 | typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); |
994 | |
995 | /*! @brief The function signature for scroll callbacks. |
996 | * |
997 | * This is the function signature for scroll callback functions. |
998 | * |
999 | * @param[in] window The window that received the event. |
1000 | * @param[in] xoffset The scroll offset along the x-axis. |
1001 | * @param[in] yoffset The scroll offset along the y-axis. |
1002 | * |
1003 | * @sa @ref scrolling |
1004 | * @sa glfwSetScrollCallback |
1005 | * |
1006 | * @since Added in version 3.0. Replaces `GLFWmousewheelfun`. |
1007 | * |
1008 | * @ingroup input |
1009 | */ |
1010 | typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); |
1011 | |
1012 | /*! @brief The function signature for keyboard key callbacks. |
1013 | * |
1014 | * This is the function signature for keyboard key callback functions. |
1015 | * |
1016 | * @param[in] window The window that received the event. |
1017 | * @param[in] key The [keyboard key](@ref keys) that was pressed or released. |
1018 | * @param[in] scancode The system-specific scancode of the key. |
1019 | * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. |
1020 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
1021 | * held down. |
1022 | * |
1023 | * @sa @ref input_key |
1024 | * @sa glfwSetKeyCallback |
1025 | * |
1026 | * @since Added in version 1.0. |
1027 | * @glfw3 Added window handle, scancode and modifier mask parameters. |
1028 | * |
1029 | * @ingroup input |
1030 | */ |
1031 | typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); |
1032 | |
1033 | /*! @brief The function signature for Unicode character callbacks. |
1034 | * |
1035 | * This is the function signature for Unicode character callback functions. |
1036 | * |
1037 | * @param[in] window The window that received the event. |
1038 | * @param[in] codepoint The Unicode code point of the character. |
1039 | * |
1040 | * @sa @ref input_char |
1041 | * @sa glfwSetCharCallback |
1042 | * |
1043 | * @since Added in version 2.4. |
1044 | * @glfw3 Added window handle parameter. |
1045 | * |
1046 | * @ingroup input |
1047 | */ |
1048 | typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); |
1049 | |
1050 | /*! @brief The function signature for Unicode character with modifiers |
1051 | * callbacks. |
1052 | * |
1053 | * This is the function signature for Unicode character with modifiers callback |
1054 | * functions. It is called for each input character, regardless of what |
1055 | * modifier keys are held down. |
1056 | * |
1057 | * @param[in] window The window that received the event. |
1058 | * @param[in] codepoint The Unicode code point of the character. |
1059 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
1060 | * held down. |
1061 | * |
1062 | * @sa @ref input_char |
1063 | * @sa glfwSetCharModsCallback |
1064 | * |
1065 | * @since Added in version 3.1. |
1066 | * |
1067 | * @ingroup input |
1068 | */ |
1069 | typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); |
1070 | |
1071 | /*! @brief The function signature for file drop callbacks. |
1072 | * |
1073 | * This is the function signature for file drop callbacks. |
1074 | * |
1075 | * @param[in] window The window that received the event. |
1076 | * @param[in] count The number of dropped files. |
1077 | * @param[in] paths The UTF-8 encoded file and/or directory path names. |
1078 | * |
1079 | * @sa @ref path_drop |
1080 | * @sa glfwSetDropCallback |
1081 | * |
1082 | * @since Added in version 3.1. |
1083 | * |
1084 | * @ingroup input |
1085 | */ |
1086 | typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**); |
1087 | |
1088 | /*! @brief The function signature for monitor configuration callbacks. |
1089 | * |
1090 | * This is the function signature for monitor configuration callback functions. |
1091 | * |
1092 | * @param[in] monitor The monitor that was connected or disconnected. |
1093 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. |
1094 | * |
1095 | * @sa @ref monitor_event |
1096 | * @sa glfwSetMonitorCallback |
1097 | * |
1098 | * @since Added in version 3.0. |
1099 | * |
1100 | * @ingroup monitor |
1101 | */ |
1102 | typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); |
1103 | |
1104 | /*! @brief The function signature for joystick configuration callbacks. |
1105 | * |
1106 | * This is the function signature for joystick configuration callback |
1107 | * functions. |
1108 | * |
1109 | * @param[in] joy The joystick that was connected or disconnected. |
1110 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. |
1111 | * |
1112 | * @sa @ref joystick_event |
1113 | * @sa glfwSetJoystickCallback |
1114 | * |
1115 | * @since Added in version 3.2. |
1116 | * |
1117 | * @ingroup input |
1118 | */ |
1119 | typedef void (* GLFWjoystickfun)(int,int); |
1120 | |
1121 | /*! @brief Video mode type. |
1122 | * |
1123 | * This describes a single video mode. |
1124 | * |
1125 | * @sa @ref monitor_modes |
1126 | * @sa glfwGetVideoMode glfwGetVideoModes |
1127 | * |
1128 | * @since Added in version 1.0. |
1129 | * @glfw3 Added refresh rate member. |
1130 | * |
1131 | * @ingroup monitor |
1132 | */ |
1133 | typedef struct GLFWvidmode |
1134 | { |
1135 | /*! The width, in screen coordinates, of the video mode. |
1136 | */ |
1137 | int width; |
1138 | /*! The height, in screen coordinates, of the video mode. |
1139 | */ |
1140 | int height; |
1141 | /*! The bit depth of the red channel of the video mode. |
1142 | */ |
1143 | int redBits; |
1144 | /*! The bit depth of the green channel of the video mode. |
1145 | */ |
1146 | int greenBits; |
1147 | /*! The bit depth of the blue channel of the video mode. |
1148 | */ |
1149 | int blueBits; |
1150 | /*! The refresh rate, in Hz, of the video mode. |
1151 | */ |
1152 | int refreshRate; |
1153 | } GLFWvidmode; |
1154 | |
1155 | /*! @brief Gamma ramp. |
1156 | * |
1157 | * This describes the gamma ramp for a monitor. |
1158 | * |
1159 | * @sa @ref monitor_gamma |
1160 | * @sa glfwGetGammaRamp glfwSetGammaRamp |
1161 | * |
1162 | * @since Added in version 3.0. |
1163 | * |
1164 | * @ingroup monitor |
1165 | */ |
1166 | typedef struct GLFWgammaramp |
1167 | { |
1168 | /*! An array of value describing the response of the red channel. |
1169 | */ |
1170 | unsigned short* red; |
1171 | /*! An array of value describing the response of the green channel. |
1172 | */ |
1173 | unsigned short* green; |
1174 | /*! An array of value describing the response of the blue channel. |
1175 | */ |
1176 | unsigned short* blue; |
1177 | /*! The number of elements in each array. |
1178 | */ |
1179 | unsigned int size; |
1180 | } GLFWgammaramp; |
1181 | |
1182 | /*! @brief Image data. |
1183 | * |
1184 | * @sa @ref cursor_custom |
1185 | * |
1186 | * @since Added in version 2.1. |
1187 | * @glfw3 Removed format and bytes-per-pixel members. |
1188 | */ |
1189 | typedef struct GLFWimage |
1190 | { |
1191 | /*! The width, in pixels, of this image. |
1192 | */ |
1193 | int width; |
1194 | /*! The height, in pixels, of this image. |
1195 | */ |
1196 | int height; |
1197 | /*! The pixel data of this image, arranged left-to-right, top-to-bottom. |
1198 | */ |
1199 | unsigned char* pixels; |
1200 | } GLFWimage; |
1201 | |
1202 | |
1203 | /************************************************************************* |
1204 | * GLFW API functions |
1205 | *************************************************************************/ |
1206 | |
1207 | /*! @brief Initializes the GLFW library. |
1208 | * |
1209 | * This function initializes the GLFW library. Before most GLFW functions can |
1210 | * be used, GLFW must be initialized, and before an application terminates GLFW |
1211 | * should be terminated in order to free any resources allocated during or |
1212 | * after initialization. |
1213 | * |
1214 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
1215 | * succeeds, you should call @ref glfwTerminate before the application exits. |
1216 | * |
1217 | * Additional calls to this function after successful initialization but before |
1218 | * termination will return `GLFW_TRUE` immediately. |
1219 | * |
1220 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
1221 | * [error](@ref error_handling) occurred. |
1222 | * |
1223 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
1224 | * |
1225 | * @remark @osx This function will change the current directory of the |
1226 | * application to the `Contents/Resources` subdirectory of the application's |
1227 | * bundle, if present. This can be disabled with a |
1228 | * [compile-time option](@ref compile_options_osx). |
1229 | * |
1230 | * @thread_safety This function must only be called from the main thread. |
1231 | * |
1232 | * @sa @ref intro_init |
1233 | * @sa glfwTerminate |
1234 | * |
1235 | * @since Added in version 1.0. |
1236 | * |
1237 | * @ingroup init |
1238 | */ |
1239 | GLFWAPI int glfwInit(void); |
1240 | |
1241 | /*! @brief Terminates the GLFW library. |
1242 | * |
1243 | * This function destroys all remaining windows and cursors, restores any |
1244 | * modified gamma ramps and frees any other allocated resources. Once this |
1245 | * function is called, you must again call @ref glfwInit successfully before |
1246 | * you will be able to use most GLFW functions. |
1247 | * |
1248 | * If GLFW has been successfully initialized, this function should be called |
1249 | * before the application exits. If initialization fails, there is no need to |
1250 | * call this function, as it is called by @ref glfwInit before it returns |
1251 | * failure. |
1252 | * |
1253 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
1254 | * |
1255 | * @remark This function may be called before @ref glfwInit. |
1256 | * |
1257 | * @warning The contexts of any remaining windows must not be current on any |
1258 | * other thread when this function is called. |
1259 | * |
1260 | * @reentrancy This function must not be called from a callback. |
1261 | * |
1262 | * @thread_safety This function must only be called from the main thread. |
1263 | * |
1264 | * @sa @ref intro_init |
1265 | * @sa glfwInit |
1266 | * |
1267 | * @since Added in version 1.0. |
1268 | * |
1269 | * @ingroup init |
1270 | */ |
1271 | GLFWAPI void glfwTerminate(void); |
1272 | |
1273 | /*! @brief Retrieves the version of the GLFW library. |
1274 | * |
1275 | * This function retrieves the major, minor and revision numbers of the GLFW |
1276 | * library. It is intended for when you are using GLFW as a shared library and |
1277 | * want to ensure that you are using the minimum required version. |
1278 | * |
1279 | * Any or all of the version arguments may be `NULL`. |
1280 | * |
1281 | * @param[out] major Where to store the major version number, or `NULL`. |
1282 | * @param[out] minor Where to store the minor version number, or `NULL`. |
1283 | * @param[out] rev Where to store the revision number, or `NULL`. |
1284 | * |
1285 | * @errors None. |
1286 | * |
1287 | * @remark This function may be called before @ref glfwInit. |
1288 | * |
1289 | * @thread_safety This function may be called from any thread. |
1290 | * |
1291 | * @sa @ref intro_version |
1292 | * @sa glfwGetVersionString |
1293 | * |
1294 | * @since Added in version 1.0. |
1295 | * |
1296 | * @ingroup init |
1297 | */ |
1298 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
1299 | |
1300 | /*! @brief Returns a string describing the compile-time configuration. |
1301 | * |
1302 | * This function returns the compile-time generated |
1303 | * [version string](@ref intro_version_string) of the GLFW library binary. It |
1304 | * describes the version, platform, compiler and any platform-specific |
1305 | * compile-time options. It should not be confused with the OpenGL or OpenGL |
1306 | * ES version string, queried with `glGetString`. |
1307 | * |
1308 | * __Do not use the version string__ to parse the GLFW library version. The |
1309 | * @ref glfwGetVersion function provides the version of the running library |
1310 | * binary in numerical format. |
1311 | * |
1312 | * @return The ASCII encoded GLFW version string. |
1313 | * |
1314 | * @errors None. |
1315 | * |
1316 | * @remark This function may be called before @ref glfwInit. |
1317 | * |
1318 | * @pointer_lifetime The returned string is static and compile-time generated. |
1319 | * |
1320 | * @thread_safety This function may be called from any thread. |
1321 | * |
1322 | * @sa @ref intro_version |
1323 | * @sa glfwGetVersion |
1324 | * |
1325 | * @since Added in version 3.0. |
1326 | * |
1327 | * @ingroup init |
1328 | */ |
1329 | GLFWAPI const char* glfwGetVersionString(void); |
1330 | |
1331 | /*! @brief Sets the error callback. |
1332 | * |
1333 | * This function sets the error callback, which is called with an error code |
1334 | * and a human-readable description each time a GLFW error occurs. |
1335 | * |
1336 | * The error callback is called on the thread where the error occurred. If you |
1337 | * are using GLFW from multiple threads, your error callback needs to be |
1338 | * written accordingly. |
1339 | * |
1340 | * Because the description string may have been generated specifically for that |
1341 | * error, it is not guaranteed to be valid after the callback has returned. If |
1342 | * you wish to use it after the callback returns, you need to make a copy. |
1343 | * |
1344 | * Once set, the error callback remains set even after the library has been |
1345 | * terminated. |
1346 | * |
1347 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
1348 | * callback. |
1349 | * @return The previously set callback, or `NULL` if no callback was set. |
1350 | * |
1351 | * @errors None. |
1352 | * |
1353 | * @remark This function may be called before @ref glfwInit. |
1354 | * |
1355 | * @thread_safety This function must only be called from the main thread. |
1356 | * |
1357 | * @sa @ref error_handling |
1358 | * |
1359 | * @since Added in version 3.0. |
1360 | * |
1361 | * @ingroup init |
1362 | */ |
1363 | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); |
1364 | |
1365 | /*! @brief Returns the currently connected monitors. |
1366 | * |
1367 | * This function returns an array of handles for all currently connected |
1368 | * monitors. The primary monitor is always first in the returned array. If no |
1369 | * monitors were found, this function returns `NULL`. |
1370 | * |
1371 | * @param[out] count Where to store the number of monitors in the returned |
1372 | * array. This is set to zero if an error occurred. |
1373 | * @return An array of monitor handles, or `NULL` if no monitors were found or |
1374 | * if an [error](@ref error_handling) occurred. |
1375 | * |
1376 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
1377 | * |
1378 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
1379 | * should not free it yourself. It is guaranteed to be valid only until the |
1380 | * monitor configuration changes or the library is terminated. |
1381 | * |
1382 | * @thread_safety This function must only be called from the main thread. |
1383 | * |
1384 | * @sa @ref monitor_monitors |
1385 | * @sa @ref monitor_event |
1386 | * @sa glfwGetPrimaryMonitor |
1387 | * |
1388 | * @since Added in version 3.0. |
1389 | * |
1390 | * @ingroup monitor |
1391 | */ |
1392 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
1393 | |
1394 | /*! @brief Returns the primary monitor. |
1395 | * |
1396 | * This function returns the primary monitor. This is usually the monitor |
1397 | * where elements like the task bar or global menu bar are located. |
1398 | * |
1399 | * @return The primary monitor, or `NULL` if no monitors were found or if an |
1400 | * [error](@ref error_handling) occurred. |
1401 | * |
1402 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
1403 | * |
1404 | * @thread_safety This function must only be called from the main thread. |
1405 | * |
1406 | * @remark The primary monitor is always first in the array returned by @ref |
1407 | * glfwGetMonitors. |
1408 | * |
1409 | * @sa @ref monitor_monitors |
1410 | * @sa glfwGetMonitors |
1411 | * |
1412 | * @since Added in version 3.0. |
1413 | * |
1414 | * @ingroup monitor |
1415 | */ |
1416 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
1417 | |
1418 | /*! @brief Returns the position of the monitor's viewport on the virtual screen. |
1419 | * |
1420 | * This function returns the position, in screen coordinates, of the upper-left |
1421 | * corner of the specified monitor. |
1422 | * |
1423 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
1424 | * non-`NULL` position arguments will be set to zero. |
1425 | * |
1426 | * @param[in] monitor The monitor to query. |
1427 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
1428 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
1429 | * |
1430 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1431 | * GLFW_PLATFORM_ERROR. |
1432 | * |
1433 | * @thread_safety This function must only be called from the main thread. |
1434 | * |
1435 | * @sa @ref monitor_properties |
1436 | * |
1437 | * @since Added in version 3.0. |
1438 | * |
1439 | * @ingroup monitor |
1440 | */ |
1441 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
1442 | |
1443 | /*! @brief Returns the physical size of the monitor. |
1444 | * |
1445 | * This function returns the size, in millimetres, of the display area of the |
1446 | * specified monitor. |
1447 | * |
1448 | * Some systems do not provide accurate monitor size information, either |
1449 | * because the monitor |
1450 | * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) |
1451 | * data is incorrect or because the driver does not report it accurately. |
1452 | * |
1453 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
1454 | * non-`NULL` size arguments will be set to zero. |
1455 | * |
1456 | * @param[in] monitor The monitor to query. |
1457 | * @param[out] widthMM Where to store the width, in millimetres, of the |
1458 | * monitor's display area, or `NULL`. |
1459 | * @param[out] heightMM Where to store the height, in millimetres, of the |
1460 | * monitor's display area, or `NULL`. |
1461 | * |
1462 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
1463 | * |
1464 | * @remark @win32 calculates the returned physical size from the |
1465 | * current resolution and system DPI instead of querying the monitor EDID data. |
1466 | * |
1467 | * @thread_safety This function must only be called from the main thread. |
1468 | * |
1469 | * @sa @ref monitor_properties |
1470 | * |
1471 | * @since Added in version 3.0. |
1472 | * |
1473 | * @ingroup monitor |
1474 | */ |
1475 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); |
1476 | |
1477 | /*! @brief Returns the name of the specified monitor. |
1478 | * |
1479 | * This function returns a human-readable name, encoded as UTF-8, of the |
1480 | * specified monitor. The name typically reflects the make and model of the |
1481 | * monitor and is not guaranteed to be unique among the connected monitors. |
1482 | * |
1483 | * @param[in] monitor The monitor to query. |
1484 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an |
1485 | * [error](@ref error_handling) occurred. |
1486 | * |
1487 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
1488 | * |
1489 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
1490 | * should not free it yourself. It is valid until the specified monitor is |
1491 | * disconnected or the library is terminated. |
1492 | * |
1493 | * @thread_safety This function must only be called from the main thread. |
1494 | * |
1495 | * @sa @ref monitor_properties |
1496 | * |
1497 | * @since Added in version 3.0. |
1498 | * |
1499 | * @ingroup monitor |
1500 | */ |
1501 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
1502 | |
1503 | /*! @brief Sets the monitor configuration callback. |
1504 | * |
1505 | * This function sets the monitor configuration callback, or removes the |
1506 | * currently set callback. This is called when a monitor is connected to or |
1507 | * disconnected from the system. |
1508 | * |
1509 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
1510 | * callback. |
1511 | * @return The previously set callback, or `NULL` if no callback was set or the |
1512 | * library had not been [initialized](@ref intro_init). |
1513 | * |
1514 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
1515 | * |
1516 | * @thread_safety This function must only be called from the main thread. |
1517 | * |
1518 | * @sa @ref monitor_event |
1519 | * |
1520 | * @since Added in version 3.0. |
1521 | * |
1522 | * @ingroup monitor |
1523 | */ |
1524 | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); |
1525 | |
1526 | /*! @brief Returns the available video modes for the specified monitor. |
1527 | * |
1528 | * This function returns an array of all video modes supported by the specified |
1529 | * monitor. The returned array is sorted in ascending order, first by color |
1530 | * bit depth (the sum of all channel depths) and then by resolution area (the |
1531 | * product of width and height). |
1532 | * |
1533 | * @param[in] monitor The monitor to query. |
1534 | * @param[out] count Where to store the number of video modes in the returned |
1535 | * array. This is set to zero if an error occurred. |
1536 | * @return An array of video modes, or `NULL` if an |
1537 | * [error](@ref error_handling) occurred. |
1538 | * |
1539 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1540 | * GLFW_PLATFORM_ERROR. |
1541 | * |
1542 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
1543 | * should not free it yourself. It is valid until the specified monitor is |
1544 | * disconnected, this function is called again for that monitor or the library |
1545 | * is terminated. |
1546 | * |
1547 | * @thread_safety This function must only be called from the main thread. |
1548 | * |
1549 | * @sa @ref monitor_modes |
1550 | * @sa glfwGetVideoMode |
1551 | * |
1552 | * @since Added in version 1.0. |
1553 | * @glfw3 Changed to return an array of modes for a specific monitor. |
1554 | * |
1555 | * @ingroup monitor |
1556 | */ |
1557 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
1558 | |
1559 | /*! @brief Returns the current mode of the specified monitor. |
1560 | * |
1561 | * This function returns the current video mode of the specified monitor. If |
1562 | * you have created a full screen window for that monitor, the return value |
1563 | * will depend on whether that window is iconified. |
1564 | * |
1565 | * @param[in] monitor The monitor to query. |
1566 | * @return The current mode of the monitor, or `NULL` if an |
1567 | * [error](@ref error_handling) occurred. |
1568 | * |
1569 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1570 | * GLFW_PLATFORM_ERROR. |
1571 | * |
1572 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
1573 | * should not free it yourself. It is valid until the specified monitor is |
1574 | * disconnected or the library is terminated. |
1575 | * |
1576 | * @thread_safety This function must only be called from the main thread. |
1577 | * |
1578 | * @sa @ref monitor_modes |
1579 | * @sa glfwGetVideoModes |
1580 | * |
1581 | * @since Added in version 3.0. Replaces `glfwGetDesktopMode`. |
1582 | * |
1583 | * @ingroup monitor |
1584 | */ |
1585 | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); |
1586 | |
1587 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
1588 | * |
1589 | * This function generates a 256-element gamma ramp from the specified exponent |
1590 | * and then calls @ref glfwSetGammaRamp with it. The value must be a finite |
1591 | * number greater than zero. |
1592 | * |
1593 | * @param[in] monitor The monitor whose gamma ramp to set. |
1594 | * @param[in] gamma The desired exponent. |
1595 | * |
1596 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
1597 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
1598 | * |
1599 | * @thread_safety This function must only be called from the main thread. |
1600 | * |
1601 | * @sa @ref monitor_gamma |
1602 | * |
1603 | * @since Added in version 3.0. |
1604 | * |
1605 | * @ingroup monitor |
1606 | */ |
1607 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
1608 | |
1609 | /*! @brief Returns the current gamma ramp for the specified monitor. |
1610 | * |
1611 | * This function returns the current gamma ramp of the specified monitor. |
1612 | * |
1613 | * @param[in] monitor The monitor to query. |
1614 | * @return The current gamma ramp, or `NULL` if an |
1615 | * [error](@ref error_handling) occurred. |
1616 | * |
1617 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1618 | * GLFW_PLATFORM_ERROR. |
1619 | * |
1620 | * @pointer_lifetime The returned structure and its arrays are allocated and |
1621 | * freed by GLFW. You should not free them yourself. They are valid until the |
1622 | * specified monitor is disconnected, this function is called again for that |
1623 | * monitor or the library is terminated. |
1624 | * |
1625 | * @thread_safety This function must only be called from the main thread. |
1626 | * |
1627 | * @sa @ref monitor_gamma |
1628 | * |
1629 | * @since Added in version 3.0. |
1630 | * |
1631 | * @ingroup monitor |
1632 | */ |
1633 | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); |
1634 | |
1635 | /*! @brief Sets the current gamma ramp for the specified monitor. |
1636 | * |
1637 | * This function sets the current gamma ramp for the specified monitor. The |
1638 | * original gamma ramp for that monitor is saved by GLFW the first time this |
1639 | * function is called and is restored by @ref glfwTerminate. |
1640 | * |
1641 | * @param[in] monitor The monitor whose gamma ramp to set. |
1642 | * @param[in] ramp The gamma ramp to use. |
1643 | * |
1644 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1645 | * GLFW_PLATFORM_ERROR. |
1646 | * |
1647 | * @remark Gamma ramp sizes other than 256 are not supported by all platforms |
1648 | * or graphics hardware. |
1649 | * |
1650 | * @remark @win32 The gamma ramp size must be 256. |
1651 | * |
1652 | * @pointer_lifetime The specified gamma ramp is copied before this function |
1653 | * returns. |
1654 | * |
1655 | * @thread_safety This function must only be called from the main thread. |
1656 | * |
1657 | * @sa @ref monitor_gamma |
1658 | * |
1659 | * @since Added in version 3.0. |
1660 | * |
1661 | * @ingroup monitor |
1662 | */ |
1663 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
1664 | |
1665 | /*! @brief Resets all window hints to their default values. |
1666 | * |
1667 | * This function resets all window hints to their |
1668 | * [default values](@ref window_hints_values). |
1669 | * |
1670 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
1671 | * |
1672 | * @thread_safety This function must only be called from the main thread. |
1673 | * |
1674 | * @sa @ref window_hints |
1675 | * @sa glfwWindowHint |
1676 | * |
1677 | * @since Added in version 3.0. |
1678 | * |
1679 | * @ingroup window |
1680 | */ |
1681 | GLFWAPI void glfwDefaultWindowHints(void); |
1682 | |
1683 | /*! @brief Sets the specified window hint to the desired value. |
1684 | * |
1685 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
1686 | * hints, once set, retain their values until changed by a call to @ref |
1687 | * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is |
1688 | * terminated. |
1689 | * |
1690 | * This function does not check whether the specified hint values are valid. |
1691 | * If you set hints to invalid values this will instead be reported by the next |
1692 | * call to @ref glfwCreateWindow. |
1693 | * |
1694 | * @param[in] hint The [window hint](@ref window_hints) to set. |
1695 | * @param[in] value The new value of the window hint. |
1696 | * |
1697 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1698 | * GLFW_INVALID_ENUM. |
1699 | * |
1700 | * @thread_safety This function must only be called from the main thread. |
1701 | * |
1702 | * @sa @ref window_hints |
1703 | * @sa glfwDefaultWindowHints |
1704 | * |
1705 | * @since Added in version 3.0. Replaces `glfwOpenWindowHint`. |
1706 | * |
1707 | * @ingroup window |
1708 | */ |
1709 | GLFWAPI void glfwWindowHint(int hint, int value); |
1710 | |
1711 | /*! @brief Creates a window and its associated context. |
1712 | * |
1713 | * This function creates a window and its associated OpenGL or OpenGL ES |
1714 | * context. Most of the options controlling how the window and its context |
1715 | * should be created are specified with [window hints](@ref window_hints). |
1716 | * |
1717 | * Successful creation does not change which context is current. Before you |
1718 | * can use the newly created context, you need to |
1719 | * [make it current](@ref context_current). For information about the `share` |
1720 | * parameter, see @ref context_sharing. |
1721 | * |
1722 | * The created window, framebuffer and context may differ from what you |
1723 | * requested, as not all parameters and hints are |
1724 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
1725 | * window, especially for full screen windows. To query the actual attributes |
1726 | * of the created window, framebuffer and context, see @ref |
1727 | * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. |
1728 | * |
1729 | * To create a full screen window, you need to specify the monitor the window |
1730 | * will cover. If no monitor is specified, the window will be windowed mode. |
1731 | * Unless you have a way for the user to choose a specific monitor, it is |
1732 | * recommended that you pick the primary monitor. For more information on how |
1733 | * to query connected monitors, see @ref monitor_monitors. |
1734 | * |
1735 | * For full screen windows, the specified size becomes the resolution of the |
1736 | * window's _desired video mode_. As long as a full screen window is not |
1737 | * iconified, the supported video mode most closely matching the desired video |
1738 | * mode is set for the specified monitor. For more information about full |
1739 | * screen windows, including the creation of so called _windowed full screen_ |
1740 | * or _borderless full screen_ windows, see @ref window_windowed_full_screen. |
1741 | * |
1742 | * By default, newly created windows use the placement recommended by the |
1743 | * window system. To create the window at a specific position, make it |
1744 | * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window |
1745 | * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) |
1746 | * it. |
1747 | * |
1748 | * As long as at least one full screen window is not iconified, the screensaver |
1749 | * is prohibited from starting. |
1750 | * |
1751 | * Window systems put limits on window sizes. Very large or very small window |
1752 | * dimensions may be overridden by the window system on creation. Check the |
1753 | * actual [size](@ref window_size) after creation. |
1754 | * |
1755 | * The [swap interval](@ref buffer_swap) is not set during window creation and |
1756 | * the initial value may vary depending on driver settings and defaults. |
1757 | * |
1758 | * @param[in] width The desired width, in screen coordinates, of the window. |
1759 | * This must be greater than zero. |
1760 | * @param[in] height The desired height, in screen coordinates, of the window. |
1761 | * This must be greater than zero. |
1762 | * @param[in] title The initial, UTF-8 encoded window title. |
1763 | * @param[in] monitor The monitor to use for full screen mode, or `NULL` for |
1764 | * windowed mode. |
1765 | * @param[in] share The window whose context to share resources with, or `NULL` |
1766 | * to not share resources. |
1767 | * @return The handle of the created window, or `NULL` if an |
1768 | * [error](@ref error_handling) occurred. |
1769 | * |
1770 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
1771 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref |
1772 | * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref |
1773 | * GLFW_PLATFORM_ERROR. |
1774 | * |
1775 | * @remark @win32 Window creation will fail if the Microsoft GDI software |
1776 | * OpenGL implementation is the only one available. |
1777 | * |
1778 | * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it |
1779 | * will be set as the initial icon for the window. If no such icon is present, |
1780 | * the `IDI_WINLOGO` icon will be used instead. To set a different icon, see |
1781 | * @ref glfwSetWindowIcon. |
1782 | * |
1783 | * @remark @win32 The context to share resources with must not be current on |
1784 | * any other thread. |
1785 | * |
1786 | * @remark @osx The GLFW window has no icon, as it is not a document |
1787 | * window, but the dock icon will be the same as the application bundle's icon. |
1788 | * For more information on bundles, see the |
1789 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
1790 | * in the Mac Developer Library. |
1791 | * |
1792 | * @remark @osx The first time a window is created the menu bar is populated |
1793 | * with common commands like Hide, Quit and About. The About entry opens |
1794 | * a minimal about dialog with information from the application's bundle. The |
1795 | * menu bar can be disabled with a |
1796 | * [compile-time option](@ref compile_options_osx). |
1797 | * |
1798 | * @remark @osx On OS X 10.10 and later the window frame will not be rendered |
1799 | * at full resolution on Retina displays unless the `NSHighResolutionCapable` |
1800 | * key is enabled in the application bundle's `Info.plist`. For more |
1801 | * information, see |
1802 | * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html) |
1803 | * in the Mac Developer Library. The GLFW test and example programs use |
1804 | * a custom `Info.plist` template for this, which can be found as |
1805 | * `CMake/MacOSXBundleInfo.plist.in` in the source tree. |
1806 | * |
1807 | * @remark @x11 Some window managers will not respect the placement of |
1808 | * initially hidden windows. |
1809 | * |
1810 | * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for |
1811 | * a window to reach its requested state. This means you may not be able to |
1812 | * query the final size, position or other attributes directly after window |
1813 | * creation. |
1814 | * |
1815 | * @reentrancy This function must not be called from a callback. |
1816 | * |
1817 | * @thread_safety This function must only be called from the main thread. |
1818 | * |
1819 | * @sa @ref window_creation |
1820 | * @sa glfwDestroyWindow |
1821 | * |
1822 | * @since Added in version 3.0. Replaces `glfwOpenWindow`. |
1823 | * |
1824 | * @ingroup window |
1825 | */ |
1826 | GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); |
1827 | |
1828 | /*! @brief Destroys the specified window and its context. |
1829 | * |
1830 | * This function destroys the specified window and its context. On calling |
1831 | * this function, no further callbacks will be called for that window. |
1832 | * |
1833 | * If the context of the specified window is current on the main thread, it is |
1834 | * detached before being destroyed. |
1835 | * |
1836 | * @param[in] window The window to destroy. |
1837 | * |
1838 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1839 | * GLFW_PLATFORM_ERROR. |
1840 | * |
1841 | * @note The context of the specified window must not be current on any other |
1842 | * thread when this function is called. |
1843 | * |
1844 | * @reentrancy This function must not be called from a callback. |
1845 | * |
1846 | * @thread_safety This function must only be called from the main thread. |
1847 | * |
1848 | * @sa @ref window_creation |
1849 | * @sa glfwCreateWindow |
1850 | * |
1851 | * @since Added in version 3.0. Replaces `glfwCloseWindow`. |
1852 | * |
1853 | * @ingroup window |
1854 | */ |
1855 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
1856 | |
1857 | /*! @brief Checks the close flag of the specified window. |
1858 | * |
1859 | * This function returns the value of the close flag of the specified window. |
1860 | * |
1861 | * @param[in] window The window to query. |
1862 | * @return The value of the close flag. |
1863 | * |
1864 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
1865 | * |
1866 | * @thread_safety This function may be called from any thread. Access is not |
1867 | * synchronized. |
1868 | * |
1869 | * @sa @ref window_close |
1870 | * |
1871 | * @since Added in version 3.0. |
1872 | * |
1873 | * @ingroup window |
1874 | */ |
1875 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
1876 | |
1877 | /*! @brief Sets the close flag of the specified window. |
1878 | * |
1879 | * This function sets the value of the close flag of the specified window. |
1880 | * This can be used to override the user's attempt to close the window, or |
1881 | * to signal that it should be closed. |
1882 | * |
1883 | * @param[in] window The window whose flag to change. |
1884 | * @param[in] value The new value. |
1885 | * |
1886 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
1887 | * |
1888 | * @thread_safety This function may be called from any thread. Access is not |
1889 | * synchronized. |
1890 | * |
1891 | * @sa @ref window_close |
1892 | * |
1893 | * @since Added in version 3.0. |
1894 | * |
1895 | * @ingroup window |
1896 | */ |
1897 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
1898 | |
1899 | /*! @brief Sets the title of the specified window. |
1900 | * |
1901 | * This function sets the window title, encoded as UTF-8, of the specified |
1902 | * window. |
1903 | * |
1904 | * @param[in] window The window whose title to change. |
1905 | * @param[in] title The UTF-8 encoded window title. |
1906 | * |
1907 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1908 | * GLFW_PLATFORM_ERROR. |
1909 | * |
1910 | * @remark @osx The window title will not be updated until the next time you |
1911 | * process events. |
1912 | * |
1913 | * @thread_safety This function must only be called from the main thread. |
1914 | * |
1915 | * @sa @ref window_title |
1916 | * |
1917 | * @since Added in version 1.0. |
1918 | * @glfw3 Added window handle parameter. |
1919 | * |
1920 | * @ingroup window |
1921 | */ |
1922 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
1923 | |
1924 | /*! @brief Sets the icon for the specified window. |
1925 | * |
1926 | * This function sets the icon of the specified window. If passed an array of |
1927 | * candidate images, those of or closest to the sizes desired by the system are |
1928 | * selected. If no images are specified, the window reverts to its default |
1929 | * icon. |
1930 | * |
1931 | * The desired image sizes varies depending on platform and system settings. |
1932 | * The selected images will be rescaled as needed. Good sizes include 16x16, |
1933 | * 32x32 and 48x48. |
1934 | * |
1935 | * @param[in] window The window whose icon to set. |
1936 | * @param[in] count The number of images in the specified array, or zero to |
1937 | * revert to the default window icon. |
1938 | * @param[in] images The images to create the icon from. This is ignored if |
1939 | * count is zero. |
1940 | * |
1941 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1942 | * GLFW_PLATFORM_ERROR. |
1943 | * |
1944 | * @pointer_lifetime The specified image data is copied before this function |
1945 | * returns. |
1946 | * |
1947 | * @remark @osx The GLFW window has no icon, as it is not a document |
1948 | * window, so this function does nothing. The dock icon will be the same as |
1949 | * the application bundle's icon. For more information on bundles, see the |
1950 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
1951 | * in the Mac Developer Library. |
1952 | * |
1953 | * @thread_safety This function must only be called from the main thread. |
1954 | * |
1955 | * @sa @ref window_icon |
1956 | * |
1957 | * @since Added in version 3.2. |
1958 | * |
1959 | * @ingroup window |
1960 | */ |
1961 | GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images); |
1962 | |
1963 | /*! @brief Retrieves the position of the client area of the specified window. |
1964 | * |
1965 | * This function retrieves the position, in screen coordinates, of the |
1966 | * upper-left corner of the client area of the specified window. |
1967 | * |
1968 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
1969 | * non-`NULL` position arguments will be set to zero. |
1970 | * |
1971 | * @param[in] window The window to query. |
1972 | * @param[out] xpos Where to store the x-coordinate of the upper-left corner of |
1973 | * the client area, or `NULL`. |
1974 | * @param[out] ypos Where to store the y-coordinate of the upper-left corner of |
1975 | * the client area, or `NULL`. |
1976 | * |
1977 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
1978 | * GLFW_PLATFORM_ERROR. |
1979 | * |
1980 | * @thread_safety This function must only be called from the main thread. |
1981 | * |
1982 | * @sa @ref window_pos |
1983 | * @sa glfwSetWindowPos |
1984 | * |
1985 | * @since Added in version 3.0. |
1986 | * |
1987 | * @ingroup window |
1988 | */ |
1989 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
1990 | |
1991 | /*! @brief Sets the position of the client area of the specified window. |
1992 | * |
1993 | * This function sets the position, in screen coordinates, of the upper-left |
1994 | * corner of the client area of the specified windowed mode window. If the |
1995 | * window is a full screen window, this function does nothing. |
1996 | * |
1997 | * __Do not use this function__ to move an already visible window unless you |
1998 | * have very good reasons for doing so, as it will confuse and annoy the user. |
1999 | * |
2000 | * The window manager may put limits on what positions are allowed. GLFW |
2001 | * cannot and should not override these limits. |
2002 | * |
2003 | * @param[in] window The window to query. |
2004 | * @param[in] xpos The x-coordinate of the upper-left corner of the client area. |
2005 | * @param[in] ypos The y-coordinate of the upper-left corner of the client area. |
2006 | * |
2007 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2008 | * GLFW_PLATFORM_ERROR. |
2009 | * |
2010 | * @thread_safety This function must only be called from the main thread. |
2011 | * |
2012 | * @sa @ref window_pos |
2013 | * @sa glfwGetWindowPos |
2014 | * |
2015 | * @since Added in version 1.0. |
2016 | * @glfw3 Added window handle parameter. |
2017 | * |
2018 | * @ingroup window |
2019 | */ |
2020 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
2021 | |
2022 | /*! @brief Retrieves the size of the client area of the specified window. |
2023 | * |
2024 | * This function retrieves the size, in screen coordinates, of the client area |
2025 | * of the specified window. If you wish to retrieve the size of the |
2026 | * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. |
2027 | * |
2028 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
2029 | * non-`NULL` size arguments will be set to zero. |
2030 | * |
2031 | * @param[in] window The window whose size to retrieve. |
2032 | * @param[out] width Where to store the width, in screen coordinates, of the |
2033 | * client area, or `NULL`. |
2034 | * @param[out] height Where to store the height, in screen coordinates, of the |
2035 | * client area, or `NULL`. |
2036 | * |
2037 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2038 | * GLFW_PLATFORM_ERROR. |
2039 | * |
2040 | * @thread_safety This function must only be called from the main thread. |
2041 | * |
2042 | * @sa @ref window_size |
2043 | * @sa glfwSetWindowSize |
2044 | * |
2045 | * @since Added in version 1.0. |
2046 | * @glfw3 Added window handle parameter. |
2047 | * |
2048 | * @ingroup window |
2049 | */ |
2050 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
2051 | |
2052 | /*! @brief Sets the size limits of the specified window. |
2053 | * |
2054 | * This function sets the size limits of the client area of the specified |
2055 | * window. If the window is full screen, the size limits only take effect |
2056 | * once it is made windowed. If the window is not resizable, this function |
2057 | * does nothing. |
2058 | * |
2059 | * The size limits are applied immediately to a windowed mode window and may |
2060 | * cause it to be resized. |
2061 | * |
2062 | * The maximum dimensions must be greater than or equal to the minimum |
2063 | * dimensions and all must be greater than or equal to zero. |
2064 | * |
2065 | * @param[in] window The window to set limits for. |
2066 | * @param[in] minwidth The minimum width, in screen coordinates, of the client |
2067 | * area, or `GLFW_DONT_CARE`. |
2068 | * @param[in] minheight The minimum height, in screen coordinates, of the |
2069 | * client area, or `GLFW_DONT_CARE`. |
2070 | * @param[in] maxwidth The maximum width, in screen coordinates, of the client |
2071 | * area, or `GLFW_DONT_CARE`. |
2072 | * @param[in] maxheight The maximum height, in screen coordinates, of the |
2073 | * client area, or `GLFW_DONT_CARE`. |
2074 | * |
2075 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
2076 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
2077 | * |
2078 | * @remark If you set size limits and an aspect ratio that conflict, the |
2079 | * results are undefined. |
2080 | * |
2081 | * @thread_safety This function must only be called from the main thread. |
2082 | * |
2083 | * @sa @ref window_sizelimits |
2084 | * @sa glfwSetWindowAspectRatio |
2085 | * |
2086 | * @since Added in version 3.2. |
2087 | * |
2088 | * @ingroup window |
2089 | */ |
2090 | GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); |
2091 | |
2092 | /*! @brief Sets the aspect ratio of the specified window. |
2093 | * |
2094 | * This function sets the required aspect ratio of the client area of the |
2095 | * specified window. If the window is full screen, the aspect ratio only takes |
2096 | * effect once it is made windowed. If the window is not resizable, this |
2097 | * function does nothing. |
2098 | * |
2099 | * The aspect ratio is specified as a numerator and a denominator and both |
2100 | * values must be greater than zero. For example, the common 16:9 aspect ratio |
2101 | * is specified as 16 and 9, respectively. |
2102 | * |
2103 | * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect |
2104 | * ratio limit is disabled. |
2105 | * |
2106 | * The aspect ratio is applied immediately to a windowed mode window and may |
2107 | * cause it to be resized. |
2108 | * |
2109 | * @param[in] window The window to set limits for. |
2110 | * @param[in] numer The numerator of the desired aspect ratio, or |
2111 | * `GLFW_DONT_CARE`. |
2112 | * @param[in] denom The denominator of the desired aspect ratio, or |
2113 | * `GLFW_DONT_CARE`. |
2114 | * |
2115 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
2116 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
2117 | * |
2118 | * @remark If you set size limits and an aspect ratio that conflict, the |
2119 | * results are undefined. |
2120 | * |
2121 | * @thread_safety This function must only be called from the main thread. |
2122 | * |
2123 | * @sa @ref window_sizelimits |
2124 | * @sa glfwSetWindowSizeLimits |
2125 | * |
2126 | * @since Added in version 3.2. |
2127 | * |
2128 | * @ingroup window |
2129 | */ |
2130 | GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); |
2131 | |
2132 | /*! @brief Sets the size of the client area of the specified window. |
2133 | * |
2134 | * This function sets the size, in screen coordinates, of the client area of |
2135 | * the specified window. |
2136 | * |
2137 | * For full screen windows, this function updates the resolution of its desired |
2138 | * video mode and switches to the video mode closest to it, without affecting |
2139 | * the window's context. As the context is unaffected, the bit depths of the |
2140 | * framebuffer remain unchanged. |
2141 | * |
2142 | * If you wish to update the refresh rate of the desired video mode in addition |
2143 | * to its resolution, see @ref glfwSetWindowMonitor. |
2144 | * |
2145 | * The window manager may put limits on what sizes are allowed. GLFW cannot |
2146 | * and should not override these limits. |
2147 | * |
2148 | * @param[in] window The window to resize. |
2149 | * @param[in] width The desired width, in screen coordinates, of the window |
2150 | * client area. |
2151 | * @param[in] height The desired height, in screen coordinates, of the window |
2152 | * client area. |
2153 | * |
2154 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2155 | * GLFW_PLATFORM_ERROR. |
2156 | * |
2157 | * @thread_safety This function must only be called from the main thread. |
2158 | * |
2159 | * @sa @ref window_size |
2160 | * @sa glfwGetWindowSize |
2161 | * @sa glfwSetWindowMonitor |
2162 | * |
2163 | * @since Added in version 1.0. |
2164 | * @glfw3 Added window handle parameter. |
2165 | * |
2166 | * @ingroup window |
2167 | */ |
2168 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
2169 | |
2170 | /*! @brief Retrieves the size of the framebuffer of the specified window. |
2171 | * |
2172 | * This function retrieves the size, in pixels, of the framebuffer of the |
2173 | * specified window. If you wish to retrieve the size of the window in screen |
2174 | * coordinates, see @ref glfwGetWindowSize. |
2175 | * |
2176 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
2177 | * non-`NULL` size arguments will be set to zero. |
2178 | * |
2179 | * @param[in] window The window whose framebuffer to query. |
2180 | * @param[out] width Where to store the width, in pixels, of the framebuffer, |
2181 | * or `NULL`. |
2182 | * @param[out] height Where to store the height, in pixels, of the framebuffer, |
2183 | * or `NULL`. |
2184 | * |
2185 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2186 | * GLFW_PLATFORM_ERROR. |
2187 | * |
2188 | * @thread_safety This function must only be called from the main thread. |
2189 | * |
2190 | * @sa @ref window_fbsize |
2191 | * @sa glfwSetFramebufferSizeCallback |
2192 | * |
2193 | * @since Added in version 3.0. |
2194 | * |
2195 | * @ingroup window |
2196 | */ |
2197 | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); |
2198 | |
2199 | /*! @brief Retrieves the size of the frame of the window. |
2200 | * |
2201 | * This function retrieves the size, in screen coordinates, of each edge of the |
2202 | * frame of the specified window. This size includes the title bar, if the |
2203 | * window has one. The size of the frame may vary depending on the |
2204 | * [window-related hints](@ref window_hints_wnd) used to create it. |
2205 | * |
2206 | * Because this function retrieves the size of each window frame edge and not |
2207 | * the offset along a particular coordinate axis, the retrieved values will |
2208 | * always be zero or positive. |
2209 | * |
2210 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
2211 | * non-`NULL` size arguments will be set to zero. |
2212 | * |
2213 | * @param[in] window The window whose frame size to query. |
2214 | * @param[out] left Where to store the size, in screen coordinates, of the left |
2215 | * edge of the window frame, or `NULL`. |
2216 | * @param[out] top Where to store the size, in screen coordinates, of the top |
2217 | * edge of the window frame, or `NULL`. |
2218 | * @param[out] right Where to store the size, in screen coordinates, of the |
2219 | * right edge of the window frame, or `NULL`. |
2220 | * @param[out] bottom Where to store the size, in screen coordinates, of the |
2221 | * bottom edge of the window frame, or `NULL`. |
2222 | * |
2223 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2224 | * GLFW_PLATFORM_ERROR. |
2225 | * |
2226 | * @thread_safety This function must only be called from the main thread. |
2227 | * |
2228 | * @sa @ref window_size |
2229 | * |
2230 | * @since Added in version 3.1. |
2231 | * |
2232 | * @ingroup window |
2233 | */ |
2234 | GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); |
2235 | |
2236 | /*! @brief Iconifies the specified window. |
2237 | * |
2238 | * This function iconifies (minimizes) the specified window if it was |
2239 | * previously restored. If the window is already iconified, this function does |
2240 | * nothing. |
2241 | * |
2242 | * If the specified window is a full screen window, the original monitor |
2243 | * resolution is restored until the window is restored. |
2244 | * |
2245 | * @param[in] window The window to iconify. |
2246 | * |
2247 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2248 | * GLFW_PLATFORM_ERROR. |
2249 | * |
2250 | * @thread_safety This function must only be called from the main thread. |
2251 | * |
2252 | * @sa @ref window_iconify |
2253 | * @sa glfwRestoreWindow |
2254 | * @sa glfwMaximizeWindow |
2255 | * |
2256 | * @since Added in version 2.1. |
2257 | * @glfw3 Added window handle parameter. |
2258 | * |
2259 | * @ingroup window |
2260 | */ |
2261 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
2262 | |
2263 | /*! @brief Restores the specified window. |
2264 | * |
2265 | * This function restores the specified window if it was previously iconified |
2266 | * (minimized) or maximized. If the window is already restored, this function |
2267 | * does nothing. |
2268 | * |
2269 | * If the specified window is a full screen window, the resolution chosen for |
2270 | * the window is restored on the selected monitor. |
2271 | * |
2272 | * @param[in] window The window to restore. |
2273 | * |
2274 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2275 | * GLFW_PLATFORM_ERROR. |
2276 | * |
2277 | * @thread_safety This function must only be called from the main thread. |
2278 | * |
2279 | * @sa @ref window_iconify |
2280 | * @sa glfwIconifyWindow |
2281 | * @sa glfwMaximizeWindow |
2282 | * |
2283 | * @since Added in version 2.1. |
2284 | * @glfw3 Added window handle parameter. |
2285 | * |
2286 | * @ingroup window |
2287 | */ |
2288 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
2289 | |
2290 | /*! @brief Maximizes the specified window. |
2291 | * |
2292 | * This function maximizes the specified window if it was previously not |
2293 | * maximized. If the window is already maximized, this function does nothing. |
2294 | * |
2295 | * If the specified window is a full screen window, this function does nothing. |
2296 | * |
2297 | * @param[in] window The window to maximize. |
2298 | * |
2299 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2300 | * GLFW_PLATFORM_ERROR. |
2301 | * |
2302 | * @par Thread Safety |
2303 | * This function may only be called from the main thread. |
2304 | * |
2305 | * @sa @ref window_iconify |
2306 | * @sa glfwIconifyWindow |
2307 | * @sa glfwRestoreWindow |
2308 | * |
2309 | * @since Added in GLFW 3.2. |
2310 | * |
2311 | * @ingroup window |
2312 | */ |
2313 | GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); |
2314 | |
2315 | /*! @brief Makes the specified window visible. |
2316 | * |
2317 | * This function makes the specified window visible if it was previously |
2318 | * hidden. If the window is already visible or is in full screen mode, this |
2319 | * function does nothing. |
2320 | * |
2321 | * @param[in] window The window to make visible. |
2322 | * |
2323 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2324 | * GLFW_PLATFORM_ERROR. |
2325 | * |
2326 | * @thread_safety This function must only be called from the main thread. |
2327 | * |
2328 | * @sa @ref window_hide |
2329 | * @sa glfwHideWindow |
2330 | * |
2331 | * @since Added in version 3.0. |
2332 | * |
2333 | * @ingroup window |
2334 | */ |
2335 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
2336 | |
2337 | /*! @brief Hides the specified window. |
2338 | * |
2339 | * This function hides the specified window if it was previously visible. If |
2340 | * the window is already hidden or is in full screen mode, this function does |
2341 | * nothing. |
2342 | * |
2343 | * @param[in] window The window to hide. |
2344 | * |
2345 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2346 | * GLFW_PLATFORM_ERROR. |
2347 | * |
2348 | * @thread_safety This function must only be called from the main thread. |
2349 | * |
2350 | * @sa @ref window_hide |
2351 | * @sa glfwShowWindow |
2352 | * |
2353 | * @since Added in version 3.0. |
2354 | * |
2355 | * @ingroup window |
2356 | */ |
2357 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
2358 | |
2359 | /*! @brief Brings the specified window to front and sets input focus. |
2360 | * |
2361 | * This function brings the specified window to front and sets input focus. |
2362 | * The window should already be visible and not iconified. |
2363 | * |
2364 | * By default, both windowed and full screen mode windows are focused when |
2365 | * initially created. Set the [GLFW_FOCUSED](@ref window_hints_wnd) to disable |
2366 | * this behavior. |
2367 | * |
2368 | * __Do not use this function__ to steal focus from other applications unless |
2369 | * you are certain that is what the user wants. Focus stealing can be |
2370 | * extremely disruptive. |
2371 | * |
2372 | * @param[in] window The window to give input focus. |
2373 | * |
2374 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2375 | * GLFW_PLATFORM_ERROR. |
2376 | * |
2377 | * @thread_safety This function must only be called from the main thread. |
2378 | * |
2379 | * @sa @ref window_focus |
2380 | * |
2381 | * @since Added in version 3.2. |
2382 | * |
2383 | * @ingroup window |
2384 | */ |
2385 | GLFWAPI void glfwFocusWindow(GLFWwindow* window); |
2386 | |
2387 | /*! @brief Returns the monitor that the window uses for full screen mode. |
2388 | * |
2389 | * This function returns the handle of the monitor that the specified window is |
2390 | * in full screen on. |
2391 | * |
2392 | * @param[in] window The window to query. |
2393 | * @return The monitor, or `NULL` if the window is in windowed mode or an error |
2394 | * occurred. |
2395 | * |
2396 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2397 | * |
2398 | * @thread_safety This function must only be called from the main thread. |
2399 | * |
2400 | * @sa @ref window_monitor |
2401 | * @sa glfwSetWindowMonitor |
2402 | * |
2403 | * @since Added in version 3.0. |
2404 | * |
2405 | * @ingroup window |
2406 | */ |
2407 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
2408 | |
2409 | /*! @brief Sets the mode, monitor, video mode and placement of a window. |
2410 | * |
2411 | * This function sets the monitor that the window uses for full screen mode or, |
2412 | * if the monitor is `NULL`, makes it windowed mode. |
2413 | * |
2414 | * When setting a monitor, this function updates the width, height and refresh |
2415 | * rate of the desired video mode and switches to the video mode closest to it. |
2416 | * The window position is ignored when setting a monitor. |
2417 | * |
2418 | * When the monitor is `NULL`, the position, width and height are used to |
2419 | * place the window client area. The refresh rate is ignored when no monitor |
2420 | * is specified. |
2421 | * |
2422 | * If you only wish to update the resolution of a full screen window or the |
2423 | * size of a windowed mode window, see @ref glfwSetWindowSize. |
2424 | * |
2425 | * When a window transitions from full screen to windowed mode, this function |
2426 | * restores any previous window settings such as whether it is decorated, |
2427 | * floating, resizable, has size or aspect ratio limits, etc.. |
2428 | * |
2429 | * @param[in] window The window whose monitor, size or video mode to set. |
2430 | * @param[in] monitor The desired monitor, or `NULL` to set windowed mode. |
2431 | * @param[in] xpos The desired x-coordinate of the upper-left corner of the |
2432 | * client area. |
2433 | * @param[in] ypos The desired y-coordinate of the upper-left corner of the |
2434 | * client area. |
2435 | * @param[in] width The desired with, in screen coordinates, of the client area |
2436 | * or video mode. |
2437 | * @param[in] height The desired height, in screen coordinates, of the client |
2438 | * area or video mode. |
2439 | * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode, |
2440 | * or `GLFW_DONT_CARE`. |
2441 | * |
2442 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2443 | * GLFW_PLATFORM_ERROR. |
2444 | * |
2445 | * @thread_safety This function must only be called from the main thread. |
2446 | * |
2447 | * @sa @ref window_monitor |
2448 | * @sa @ref window_full_screen |
2449 | * @sa glfwGetWindowMonitor |
2450 | * @sa glfwSetWindowSize |
2451 | * |
2452 | * @since Added in version 3.2. |
2453 | * |
2454 | * @ingroup window |
2455 | */ |
2456 | GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); |
2457 | |
2458 | /*! @brief Returns an attribute of the specified window. |
2459 | * |
2460 | * This function returns the value of an attribute of the specified window or |
2461 | * its OpenGL or OpenGL ES context. |
2462 | * |
2463 | * @param[in] window The window to query. |
2464 | * @param[in] attrib The [window attribute](@ref window_attribs) whose value to |
2465 | * return. |
2466 | * @return The value of the attribute, or zero if an |
2467 | * [error](@ref error_handling) occurred. |
2468 | * |
2469 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
2470 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
2471 | * |
2472 | * @remark Framebuffer related hints are not window attributes. See @ref |
2473 | * window_attribs_fb for more information. |
2474 | * |
2475 | * @remark Zero is a valid value for many window and context related |
2476 | * attributes so you cannot use a return value of zero as an indication of |
2477 | * errors. However, this function should not fail as long as it is passed |
2478 | * valid arguments and the library has been [initialized](@ref intro_init). |
2479 | * |
2480 | * @thread_safety This function must only be called from the main thread. |
2481 | * |
2482 | * @sa @ref window_attribs |
2483 | * |
2484 | * @since Added in version 3.0. Replaces `glfwGetWindowParam` and |
2485 | * `glfwGetGLVersion`. |
2486 | * |
2487 | * @ingroup window |
2488 | */ |
2489 | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); |
2490 | |
2491 | /*! @brief Sets the user pointer of the specified window. |
2492 | * |
2493 | * This function sets the user-defined pointer of the specified window. The |
2494 | * current value is retained until the window is destroyed. The initial value |
2495 | * is `NULL`. |
2496 | * |
2497 | * @param[in] window The window whose pointer to set. |
2498 | * @param[in] pointer The new value. |
2499 | * |
2500 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2501 | * |
2502 | * @thread_safety This function may be called from any thread. Access is not |
2503 | * synchronized. |
2504 | * |
2505 | * @sa @ref window_userptr |
2506 | * @sa glfwGetWindowUserPointer |
2507 | * |
2508 | * @since Added in version 3.0. |
2509 | * |
2510 | * @ingroup window |
2511 | */ |
2512 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
2513 | |
2514 | /*! @brief Returns the user pointer of the specified window. |
2515 | * |
2516 | * This function returns the current value of the user-defined pointer of the |
2517 | * specified window. The initial value is `NULL`. |
2518 | * |
2519 | * @param[in] window The window whose pointer to return. |
2520 | * |
2521 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2522 | * |
2523 | * @thread_safety This function may be called from any thread. Access is not |
2524 | * synchronized. |
2525 | * |
2526 | * @sa @ref window_userptr |
2527 | * @sa glfwSetWindowUserPointer |
2528 | * |
2529 | * @since Added in version 3.0. |
2530 | * |
2531 | * @ingroup window |
2532 | */ |
2533 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
2534 | |
2535 | /*! @brief Sets the position callback for the specified window. |
2536 | * |
2537 | * This function sets the position callback of the specified window, which is |
2538 | * called when the window is moved. The callback is provided with the screen |
2539 | * position of the upper-left corner of the client area of the window. |
2540 | * |
2541 | * @param[in] window The window whose callback to set. |
2542 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
2543 | * callback. |
2544 | * @return The previously set callback, or `NULL` if no callback was set or the |
2545 | * library had not been [initialized](@ref intro_init). |
2546 | * |
2547 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2548 | * |
2549 | * @thread_safety This function must only be called from the main thread. |
2550 | * |
2551 | * @sa @ref window_pos |
2552 | * |
2553 | * @since Added in version 3.0. |
2554 | * |
2555 | * @ingroup window |
2556 | */ |
2557 | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); |
2558 | |
2559 | /*! @brief Sets the size callback for the specified window. |
2560 | * |
2561 | * This function sets the size callback of the specified window, which is |
2562 | * called when the window is resized. The callback is provided with the size, |
2563 | * in screen coordinates, of the client area of the window. |
2564 | * |
2565 | * @param[in] window The window whose callback to set. |
2566 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
2567 | * callback. |
2568 | * @return The previously set callback, or `NULL` if no callback was set or the |
2569 | * library had not been [initialized](@ref intro_init). |
2570 | * |
2571 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2572 | * |
2573 | * @thread_safety This function must only be called from the main thread. |
2574 | * |
2575 | * @sa @ref window_size |
2576 | * |
2577 | * @since Added in version 1.0. |
2578 | * @glfw3 Added window handle parameter and return value. |
2579 | * |
2580 | * @ingroup window |
2581 | */ |
2582 | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); |
2583 | |
2584 | /*! @brief Sets the close callback for the specified window. |
2585 | * |
2586 | * This function sets the close callback of the specified window, which is |
2587 | * called when the user attempts to close the window, for example by clicking |
2588 | * the close widget in the title bar. |
2589 | * |
2590 | * The close flag is set before this callback is called, but you can modify it |
2591 | * at any time with @ref glfwSetWindowShouldClose. |
2592 | * |
2593 | * The close callback is not triggered by @ref glfwDestroyWindow. |
2594 | * |
2595 | * @param[in] window The window whose callback to set. |
2596 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
2597 | * callback. |
2598 | * @return The previously set callback, or `NULL` if no callback was set or the |
2599 | * library had not been [initialized](@ref intro_init). |
2600 | * |
2601 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2602 | * |
2603 | * @remark @osx Selecting Quit from the application menu will trigger the close |
2604 | * callback for all windows. |
2605 | * |
2606 | * @thread_safety This function must only be called from the main thread. |
2607 | * |
2608 | * @sa @ref window_close |
2609 | * |
2610 | * @since Added in version 2.5. |
2611 | * @glfw3 Added window handle parameter and return value. |
2612 | * |
2613 | * @ingroup window |
2614 | */ |
2615 | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); |
2616 | |
2617 | /*! @brief Sets the refresh callback for the specified window. |
2618 | * |
2619 | * This function sets the refresh callback of the specified window, which is |
2620 | * called when the client area of the window needs to be redrawn, for example |
2621 | * if the window has been exposed after having been covered by another window. |
2622 | * |
2623 | * On compositing window systems such as Aero, Compiz or Aqua, where the window |
2624 | * contents are saved off-screen, this callback may be called only very |
2625 | * infrequently or never at all. |
2626 | * |
2627 | * @param[in] window The window whose callback to set. |
2628 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
2629 | * callback. |
2630 | * @return The previously set callback, or `NULL` if no callback was set or the |
2631 | * library had not been [initialized](@ref intro_init). |
2632 | * |
2633 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2634 | * |
2635 | * @thread_safety This function must only be called from the main thread. |
2636 | * |
2637 | * @sa @ref window_refresh |
2638 | * |
2639 | * @since Added in version 2.5. |
2640 | * @glfw3 Added window handle parameter and return value. |
2641 | * |
2642 | * @ingroup window |
2643 | */ |
2644 | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); |
2645 | |
2646 | /*! @brief Sets the focus callback for the specified window. |
2647 | * |
2648 | * This function sets the focus callback of the specified window, which is |
2649 | * called when the window gains or loses input focus. |
2650 | * |
2651 | * After the focus callback is called for a window that lost input focus, |
2652 | * synthetic key and mouse button release events will be generated for all such |
2653 | * that had been pressed. For more information, see @ref glfwSetKeyCallback |
2654 | * and @ref glfwSetMouseButtonCallback. |
2655 | * |
2656 | * @param[in] window The window whose callback to set. |
2657 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
2658 | * callback. |
2659 | * @return The previously set callback, or `NULL` if no callback was set or the |
2660 | * library had not been [initialized](@ref intro_init). |
2661 | * |
2662 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2663 | * |
2664 | * @thread_safety This function must only be called from the main thread. |
2665 | * |
2666 | * @sa @ref window_focus |
2667 | * |
2668 | * @since Added in version 3.0. |
2669 | * |
2670 | * @ingroup window |
2671 | */ |
2672 | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); |
2673 | |
2674 | /*! @brief Sets the iconify callback for the specified window. |
2675 | * |
2676 | * This function sets the iconification callback of the specified window, which |
2677 | * is called when the window is iconified or restored. |
2678 | * |
2679 | * @param[in] window The window whose callback to set. |
2680 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
2681 | * callback. |
2682 | * @return The previously set callback, or `NULL` if no callback was set or the |
2683 | * library had not been [initialized](@ref intro_init). |
2684 | * |
2685 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2686 | * |
2687 | * @thread_safety This function must only be called from the main thread. |
2688 | * |
2689 | * @sa @ref window_iconify |
2690 | * |
2691 | * @since Added in version 3.0. |
2692 | * |
2693 | * @ingroup window |
2694 | */ |
2695 | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); |
2696 | |
2697 | /*! @brief Sets the framebuffer resize callback for the specified window. |
2698 | * |
2699 | * This function sets the framebuffer resize callback of the specified window, |
2700 | * which is called when the framebuffer of the specified window is resized. |
2701 | * |
2702 | * @param[in] window The window whose callback to set. |
2703 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
2704 | * callback. |
2705 | * @return The previously set callback, or `NULL` if no callback was set or the |
2706 | * library had not been [initialized](@ref intro_init). |
2707 | * |
2708 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
2709 | * |
2710 | * @thread_safety This function must only be called from the main thread. |
2711 | * |
2712 | * @sa @ref window_fbsize |
2713 | * |
2714 | * @since Added in version 3.0. |
2715 | * |
2716 | * @ingroup window |
2717 | */ |
2718 | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun); |
2719 | |
2720 | /*! @brief Processes all pending events. |
2721 | * |
2722 | * This function processes only those events that are already in the event |
2723 | * queue and then returns immediately. Processing events will cause the window |
2724 | * and input callbacks associated with those events to be called. |
2725 | * |
2726 | * On some platforms, a window move, resize or menu operation will cause event |
2727 | * processing to block. This is due to how event processing is designed on |
2728 | * those platforms. You can use the |
2729 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
2730 | * your window when necessary during such operations. |
2731 | * |
2732 | * On some platforms, certain events are sent directly to the application |
2733 | * without going through the event queue, causing callbacks to be called |
2734 | * outside of a call to one of the event processing functions. |
2735 | * |
2736 | * Event processing is not required for joystick input to work. |
2737 | * |
2738 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2739 | * GLFW_PLATFORM_ERROR. |
2740 | * |
2741 | * @reentrancy This function must not be called from a callback. |
2742 | * |
2743 | * @thread_safety This function must only be called from the main thread. |
2744 | * |
2745 | * @sa @ref events |
2746 | * @sa glfwWaitEvents |
2747 | * @sa glfwWaitEventsTimeout |
2748 | * |
2749 | * @since Added in version 1.0. |
2750 | * |
2751 | * @ingroup window |
2752 | */ |
2753 | GLFWAPI void glfwPollEvents(void); |
2754 | |
2755 | /*! @brief Waits until events are queued and processes them. |
2756 | * |
2757 | * This function puts the calling thread to sleep until at least one event is |
2758 | * available in the event queue. Once one or more events are available, |
2759 | * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue |
2760 | * are processed and the function then returns immediately. Processing events |
2761 | * will cause the window and input callbacks associated with those events to be |
2762 | * called. |
2763 | * |
2764 | * Since not all events are associated with callbacks, this function may return |
2765 | * without a callback having been called even if you are monitoring all |
2766 | * callbacks. |
2767 | * |
2768 | * On some platforms, a window move, resize or menu operation will cause event |
2769 | * processing to block. This is due to how event processing is designed on |
2770 | * those platforms. You can use the |
2771 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
2772 | * your window when necessary during such operations. |
2773 | * |
2774 | * On some platforms, certain callbacks may be called outside of a call to one |
2775 | * of the event processing functions. |
2776 | * |
2777 | * If no windows exist, this function returns immediately. For synchronization |
2778 | * of threads in applications that do not create windows, use your threading |
2779 | * library of choice. |
2780 | * |
2781 | * Event processing is not required for joystick input to work. |
2782 | * |
2783 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2784 | * GLFW_PLATFORM_ERROR. |
2785 | * |
2786 | * @reentrancy This function must not be called from a callback. |
2787 | * |
2788 | * @thread_safety This function must only be called from the main thread. |
2789 | * |
2790 | * @sa @ref events |
2791 | * @sa glfwPollEvents |
2792 | * @sa glfwWaitEventsTimeout |
2793 | * |
2794 | * @since Added in version 2.5. |
2795 | * |
2796 | * @ingroup window |
2797 | */ |
2798 | GLFWAPI void glfwWaitEvents(void); |
2799 | |
2800 | /*! @brief Waits with timeout until events are queued and processes them. |
2801 | * |
2802 | * This function puts the calling thread to sleep until at least one event is |
2803 | * available in the event queue, or until the specified timeout is reached. If |
2804 | * one or more events are available, it behaves exactly like @ref |
2805 | * glfwPollEvents, i.e. the events in the queue are processed and the function |
2806 | * then returns immediately. Processing events will cause the window and input |
2807 | * callbacks associated with those events to be called. |
2808 | * |
2809 | * The timeout value must be a positive finite number. |
2810 | * |
2811 | * Since not all events are associated with callbacks, this function may return |
2812 | * without a callback having been called even if you are monitoring all |
2813 | * callbacks. |
2814 | * |
2815 | * On some platforms, a window move, resize or menu operation will cause event |
2816 | * processing to block. This is due to how event processing is designed on |
2817 | * those platforms. You can use the |
2818 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
2819 | * your window when necessary during such operations. |
2820 | * |
2821 | * On some platforms, certain callbacks may be called outside of a call to one |
2822 | * of the event processing functions. |
2823 | * |
2824 | * If no windows exist, this function returns immediately. For synchronization |
2825 | * of threads in applications that do not create windows, use your threading |
2826 | * library of choice. |
2827 | * |
2828 | * Event processing is not required for joystick input to work. |
2829 | * |
2830 | * @param[in] timeout The maximum amount of time, in seconds, to wait. |
2831 | * |
2832 | * @reentrancy This function must not be called from a callback. |
2833 | * |
2834 | * @thread_safety This function must only be called from the main thread. |
2835 | * |
2836 | * @sa @ref events |
2837 | * @sa glfwPollEvents |
2838 | * @sa glfwWaitEvents |
2839 | * |
2840 | * @since Added in version 3.2. |
2841 | * |
2842 | * @ingroup window |
2843 | */ |
2844 | GLFWAPI void glfwWaitEventsTimeout(double timeout); |
2845 | |
2846 | /*! @brief Posts an empty event to the event queue. |
2847 | * |
2848 | * This function posts an empty event from the current thread to the event |
2849 | * queue, causing @ref glfwWaitEvents to return. |
2850 | * |
2851 | * If no windows exist, this function returns immediately. For synchronization |
2852 | * of threads in applications that do not create windows, use your threading |
2853 | * library of choice. |
2854 | * |
2855 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2856 | * GLFW_PLATFORM_ERROR. |
2857 | * |
2858 | * @thread_safety This function may be called from any thread. |
2859 | * |
2860 | * @sa @ref events |
2861 | * @sa glfwWaitEvents |
2862 | * |
2863 | * @since Added in version 3.1. |
2864 | * |
2865 | * @ingroup window |
2866 | */ |
2867 | GLFWAPI void glfwPostEmptyEvent(void); |
2868 | |
2869 | /*! @brief Returns the value of an input option for the specified window. |
2870 | * |
2871 | * This function returns the value of an input option for the specified window. |
2872 | * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
2873 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
2874 | * |
2875 | * @param[in] window The window to query. |
2876 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
2877 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
2878 | * |
2879 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2880 | * GLFW_INVALID_ENUM. |
2881 | * |
2882 | * @thread_safety This function must only be called from the main thread. |
2883 | * |
2884 | * @sa glfwSetInputMode |
2885 | * |
2886 | * @since Added in version 3.0. |
2887 | * |
2888 | * @ingroup input |
2889 | */ |
2890 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
2891 | |
2892 | /*! @brief Sets an input option for the specified window. |
2893 | * |
2894 | * This function sets an input mode option for the specified window. The mode |
2895 | * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
2896 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
2897 | * |
2898 | * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor |
2899 | * modes: |
2900 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
2901 | * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client |
2902 | * area of the window but does not restrict the cursor from leaving. |
2903 | * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual |
2904 | * and unlimited cursor movement. This is useful for implementing for |
2905 | * example 3D camera controls. |
2906 | * |
2907 | * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to |
2908 | * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are |
2909 | * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` |
2910 | * the next time it is called even if the key had been released before the |
2911 | * call. This is useful when you are only interested in whether keys have been |
2912 | * pressed but not when or in which order. |
2913 | * |
2914 | * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either |
2915 | * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. |
2916 | * If sticky mouse buttons are enabled, a mouse button press will ensure that |
2917 | * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even |
2918 | * if the mouse button had been released before the call. This is useful when |
2919 | * you are only interested in whether mouse buttons have been pressed but not |
2920 | * when or in which order. |
2921 | * |
2922 | * @param[in] window The window whose input mode to set. |
2923 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
2924 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
2925 | * @param[in] value The new value of the specified input mode. |
2926 | * |
2927 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
2928 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
2929 | * |
2930 | * @thread_safety This function must only be called from the main thread. |
2931 | * |
2932 | * @sa glfwGetInputMode |
2933 | * |
2934 | * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`. |
2935 | * |
2936 | * @ingroup input |
2937 | */ |
2938 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
2939 | |
2940 | /*! @brief Returns the localized name of the specified printable key. |
2941 | * |
2942 | * This function returns the localized name of the specified printable key. |
2943 | * This is intended for displaying key bindings to the user. |
2944 | * |
2945 | * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used instead, otherwise |
2946 | * the scancode is ignored. If a non-printable key or (if the key is |
2947 | * `GLFW_KEY_UNKNOWN`) a scancode that maps to a non-printable key is |
2948 | * specified, this function returns `NULL`. |
2949 | * |
2950 | * This behavior allows you to pass in the arguments passed to the |
2951 | * [key callback](@ref input_key) without modification. |
2952 | * |
2953 | * The printable keys are: |
2954 | * - `GLFW_KEY_APOSTROPHE` |
2955 | * - `GLFW_KEY_COMMA` |
2956 | * - `GLFW_KEY_MINUS` |
2957 | * - `GLFW_KEY_PERIOD` |
2958 | * - `GLFW_KEY_SLASH` |
2959 | * - `GLFW_KEY_SEMICOLON` |
2960 | * - `GLFW_KEY_EQUAL` |
2961 | * - `GLFW_KEY_LEFT_BRACKET` |
2962 | * - `GLFW_KEY_RIGHT_BRACKET` |
2963 | * - `GLFW_KEY_BACKSLASH` |
2964 | * - `GLFW_KEY_WORLD_1` |
2965 | * - `GLFW_KEY_WORLD_2` |
2966 | * - `GLFW_KEY_0` to `GLFW_KEY_9` |
2967 | * - `GLFW_KEY_A` to `GLFW_KEY_Z` |
2968 | * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9` |
2969 | * - `GLFW_KEY_KP_DECIMAL` |
2970 | * - `GLFW_KEY_KP_DIVIDE` |
2971 | * - `GLFW_KEY_KP_MULTIPLY` |
2972 | * - `GLFW_KEY_KP_SUBTRACT` |
2973 | * - `GLFW_KEY_KP_ADD` |
2974 | * - `GLFW_KEY_KP_EQUAL` |
2975 | * |
2976 | * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`. |
2977 | * @param[in] scancode The scancode of the key to query. |
2978 | * @return The localized name of the key, or `NULL`. |
2979 | * |
2980 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
2981 | * GLFW_PLATFORM_ERROR. |
2982 | * |
2983 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
2984 | * should not free it yourself. It is valid until the next call to @ref |
2985 | * glfwGetKeyName, or until the library is terminated. |
2986 | * |
2987 | * @thread_safety This function must only be called from the main thread. |
2988 | * |
2989 | * @sa @ref input_key_name |
2990 | * |
2991 | * @since Added in version 3.2. |
2992 | * |
2993 | * @ingroup input |
2994 | */ |
2995 | GLFWAPI const char* glfwGetKeyName(int key, int scancode); |
2996 | |
2997 | /*! @brief Returns the last reported state of a keyboard key for the specified |
2998 | * window. |
2999 | * |
3000 | * This function returns the last state reported for the specified key to the |
3001 | * specified window. The returned state is one of `GLFW_PRESS` or |
3002 | * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to |
3003 | * the key callback. |
3004 | * |
3005 | * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns |
3006 | * `GLFW_PRESS` the first time you call it for a key that was pressed, even if |
3007 | * that key has already been released. |
3008 | * |
3009 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
3010 | * named after their use on the standard US keyboard layout. If you want to |
3011 | * input text, use the Unicode character callback instead. |
3012 | * |
3013 | * The [modifier key bit masks](@ref mods) are not key tokens and cannot be |
3014 | * used with this function. |
3015 | * |
3016 | * __Do not use this function__ to implement [text input](@ref input_char). |
3017 | * |
3018 | * @param[in] window The desired window. |
3019 | * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is |
3020 | * not a valid key for this function. |
3021 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
3022 | * |
3023 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3024 | * GLFW_INVALID_ENUM. |
3025 | * |
3026 | * @thread_safety This function must only be called from the main thread. |
3027 | * |
3028 | * @sa @ref input_key |
3029 | * |
3030 | * @since Added in version 1.0. |
3031 | * @glfw3 Added window handle parameter. |
3032 | * |
3033 | * @ingroup input |
3034 | */ |
3035 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
3036 | |
3037 | /*! @brief Returns the last reported state of a mouse button for the specified |
3038 | * window. |
3039 | * |
3040 | * This function returns the last state reported for the specified mouse button |
3041 | * to the specified window. The returned state is one of `GLFW_PRESS` or |
3042 | * `GLFW_RELEASE`. |
3043 | * |
3044 | * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function |
3045 | * `GLFW_PRESS` the first time you call it for a mouse button that was pressed, |
3046 | * even if that mouse button has already been released. |
3047 | * |
3048 | * @param[in] window The desired window. |
3049 | * @param[in] button The desired [mouse button](@ref buttons). |
3050 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
3051 | * |
3052 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3053 | * GLFW_INVALID_ENUM. |
3054 | * |
3055 | * @thread_safety This function must only be called from the main thread. |
3056 | * |
3057 | * @sa @ref input_mouse_button |
3058 | * |
3059 | * @since Added in version 1.0. |
3060 | * @glfw3 Added window handle parameter. |
3061 | * |
3062 | * @ingroup input |
3063 | */ |
3064 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
3065 | |
3066 | /*! @brief Retrieves the position of the cursor relative to the client area of |
3067 | * the window. |
3068 | * |
3069 | * This function returns the position of the cursor, in screen coordinates, |
3070 | * relative to the upper-left corner of the client area of the specified |
3071 | * window. |
3072 | * |
3073 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
3074 | * position is unbounded and limited only by the minimum and maximum values of |
3075 | * a `double`. |
3076 | * |
3077 | * The coordinate can be converted to their integer equivalents with the |
3078 | * `floor` function. Casting directly to an integer type works for positive |
3079 | * coordinates, but fails for negative ones. |
3080 | * |
3081 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
3082 | * non-`NULL` position arguments will be set to zero. |
3083 | * |
3084 | * @param[in] window The desired window. |
3085 | * @param[out] xpos Where to store the cursor x-coordinate, relative to the |
3086 | * left edge of the client area, or `NULL`. |
3087 | * @param[out] ypos Where to store the cursor y-coordinate, relative to the to |
3088 | * top edge of the client area, or `NULL`. |
3089 | * |
3090 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3091 | * GLFW_PLATFORM_ERROR. |
3092 | * |
3093 | * @thread_safety This function must only be called from the main thread. |
3094 | * |
3095 | * @sa @ref cursor_pos |
3096 | * @sa glfwSetCursorPos |
3097 | * |
3098 | * @since Added in version 3.0. Replaces `glfwGetMousePos`. |
3099 | * |
3100 | * @ingroup input |
3101 | */ |
3102 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
3103 | |
3104 | /*! @brief Sets the position of the cursor, relative to the client area of the |
3105 | * window. |
3106 | * |
3107 | * This function sets the position, in screen coordinates, of the cursor |
3108 | * relative to the upper-left corner of the client area of the specified |
3109 | * window. The window must have input focus. If the window does not have |
3110 | * input focus when this function is called, it fails silently. |
3111 | * |
3112 | * __Do not use this function__ to implement things like camera controls. GLFW |
3113 | * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the |
3114 | * cursor, transparently re-centers it and provides unconstrained cursor |
3115 | * motion. See @ref glfwSetInputMode for more information. |
3116 | * |
3117 | * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is |
3118 | * unconstrained and limited only by the minimum and maximum values of |
3119 | * a `double`. |
3120 | * |
3121 | * @param[in] window The desired window. |
3122 | * @param[in] xpos The desired x-coordinate, relative to the left edge of the |
3123 | * client area. |
3124 | * @param[in] ypos The desired y-coordinate, relative to the top edge of the |
3125 | * client area. |
3126 | * |
3127 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3128 | * GLFW_PLATFORM_ERROR. |
3129 | * |
3130 | * @thread_safety This function must only be called from the main thread. |
3131 | * |
3132 | * @sa @ref cursor_pos |
3133 | * @sa glfwGetCursorPos |
3134 | * |
3135 | * @since Added in version 3.0. Replaces `glfwSetMousePos`. |
3136 | * |
3137 | * @ingroup input |
3138 | */ |
3139 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
3140 | |
3141 | /*! @brief Creates a custom cursor. |
3142 | * |
3143 | * Creates a new custom cursor image that can be set for a window with @ref |
3144 | * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. |
3145 | * Any remaining cursors are destroyed by @ref glfwTerminate. |
3146 | * |
3147 | * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight |
3148 | * bits per channel. They are arranged canonically as packed sequential rows, |
3149 | * starting from the top-left corner. |
3150 | * |
3151 | * The cursor hotspot is specified in pixels, relative to the upper-left corner |
3152 | * of the cursor image. Like all other coordinate systems in GLFW, the X-axis |
3153 | * points to the right and the Y-axis points down. |
3154 | * |
3155 | * @param[in] image The desired cursor image. |
3156 | * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. |
3157 | * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot. |
3158 | * @return The handle of the created cursor, or `NULL` if an |
3159 | * [error](@ref error_handling) occurred. |
3160 | * |
3161 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3162 | * GLFW_PLATFORM_ERROR. |
3163 | * |
3164 | * @pointer_lifetime The specified image data is copied before this function |
3165 | * returns. |
3166 | * |
3167 | * @reentrancy This function must not be called from a callback. |
3168 | * |
3169 | * @thread_safety This function must only be called from the main thread. |
3170 | * |
3171 | * @sa @ref cursor_object |
3172 | * @sa glfwDestroyCursor |
3173 | * @sa glfwCreateStandardCursor |
3174 | * |
3175 | * @since Added in version 3.1. |
3176 | * |
3177 | * @ingroup input |
3178 | */ |
3179 | GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); |
3180 | |
3181 | /*! @brief Creates a cursor with a standard shape. |
3182 | * |
3183 | * Returns a cursor with a [standard shape](@ref shapes), that can be set for |
3184 | * a window with @ref glfwSetCursor. |
3185 | * |
3186 | * @param[in] shape One of the [standard shapes](@ref shapes). |
3187 | * @return A new cursor ready to use or `NULL` if an |
3188 | * [error](@ref error_handling) occurred. |
3189 | * |
3190 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3191 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
3192 | * |
3193 | * @reentrancy This function must not be called from a callback. |
3194 | * |
3195 | * @thread_safety This function must only be called from the main thread. |
3196 | * |
3197 | * @sa @ref cursor_object |
3198 | * @sa glfwCreateCursor |
3199 | * |
3200 | * @since Added in version 3.1. |
3201 | * |
3202 | * @ingroup input |
3203 | */ |
3204 | GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); |
3205 | |
3206 | /*! @brief Destroys a cursor. |
3207 | * |
3208 | * This function destroys a cursor previously created with @ref |
3209 | * glfwCreateCursor. Any remaining cursors will be destroyed by @ref |
3210 | * glfwTerminate. |
3211 | * |
3212 | * @param[in] cursor The cursor object to destroy. |
3213 | * |
3214 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3215 | * GLFW_PLATFORM_ERROR. |
3216 | * |
3217 | * @reentrancy This function must not be called from a callback. |
3218 | * |
3219 | * @thread_safety This function must only be called from the main thread. |
3220 | * |
3221 | * @sa @ref cursor_object |
3222 | * @sa glfwCreateCursor |
3223 | * |
3224 | * @since Added in version 3.1. |
3225 | * |
3226 | * @ingroup input |
3227 | */ |
3228 | GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); |
3229 | |
3230 | /*! @brief Sets the cursor for the window. |
3231 | * |
3232 | * This function sets the cursor image to be used when the cursor is over the |
3233 | * client area of the specified window. The set cursor will only be visible |
3234 | * when the [cursor mode](@ref cursor_mode) of the window is |
3235 | * `GLFW_CURSOR_NORMAL`. |
3236 | * |
3237 | * On some platforms, the set cursor may not be visible unless the window also |
3238 | * has input focus. |
3239 | * |
3240 | * @param[in] window The window to set the cursor for. |
3241 | * @param[in] cursor The cursor to set, or `NULL` to switch back to the default |
3242 | * arrow cursor. |
3243 | * |
3244 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3245 | * GLFW_PLATFORM_ERROR. |
3246 | * |
3247 | * @thread_safety This function must only be called from the main thread. |
3248 | * |
3249 | * @sa @ref cursor_object |
3250 | * |
3251 | * @since Added in version 3.1. |
3252 | * |
3253 | * @ingroup input |
3254 | */ |
3255 | GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); |
3256 | |
3257 | /*! @brief Sets the key callback. |
3258 | * |
3259 | * This function sets the key callback of the specified window, which is called |
3260 | * when a key is pressed, repeated or released. |
3261 | * |
3262 | * The key functions deal with physical keys, with layout independent |
3263 | * [key tokens](@ref keys) named after their values in the standard US keyboard |
3264 | * layout. If you want to input text, use the |
3265 | * [character callback](@ref glfwSetCharCallback) instead. |
3266 | * |
3267 | * When a window loses input focus, it will generate synthetic key release |
3268 | * events for all pressed keys. You can tell these events from user-generated |
3269 | * events by the fact that the synthetic ones are generated after the focus |
3270 | * loss event has been processed, i.e. after the |
3271 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
3272 | * |
3273 | * The scancode of a key is specific to that platform or sometimes even to that |
3274 | * machine. Scancodes are intended to allow users to bind keys that don't have |
3275 | * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their |
3276 | * state is not saved and so it cannot be queried with @ref glfwGetKey. |
3277 | * |
3278 | * Sometimes GLFW needs to generate synthetic key events, in which case the |
3279 | * scancode may be zero. |
3280 | * |
3281 | * @param[in] window The window whose callback to set. |
3282 | * @param[in] cbfun The new key callback, or `NULL` to remove the currently |
3283 | * set callback. |
3284 | * @return The previously set callback, or `NULL` if no callback was set or the |
3285 | * library had not been [initialized](@ref intro_init). |
3286 | * |
3287 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3288 | * |
3289 | * @thread_safety This function must only be called from the main thread. |
3290 | * |
3291 | * @sa @ref input_key |
3292 | * |
3293 | * @since Added in version 1.0. |
3294 | * @glfw3 Added window handle parameter and return value. |
3295 | * |
3296 | * @ingroup input |
3297 | */ |
3298 | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); |
3299 | |
3300 | /*! @brief Sets the Unicode character callback. |
3301 | * |
3302 | * This function sets the character callback of the specified window, which is |
3303 | * called when a Unicode character is input. |
3304 | * |
3305 | * The character callback is intended for Unicode text input. As it deals with |
3306 | * characters, it is keyboard layout dependent, whereas the |
3307 | * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 |
3308 | * to physical keys, as a key may produce zero, one or more characters. If you |
3309 | * want to know whether a specific physical key was pressed or released, see |
3310 | * the key callback instead. |
3311 | * |
3312 | * The character callback behaves as system text input normally does and will |
3313 | * not be called if modifier keys are held down that would prevent normal text |
3314 | * input on that platform, for example a Super (Command) key on OS X or Alt key |
3315 | * on Windows. There is a |
3316 | * [character with modifiers callback](@ref glfwSetCharModsCallback) that |
3317 | * receives these events. |
3318 | * |
3319 | * @param[in] window The window whose callback to set. |
3320 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
3321 | * callback. |
3322 | * @return The previously set callback, or `NULL` if no callback was set or the |
3323 | * library had not been [initialized](@ref intro_init). |
3324 | * |
3325 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3326 | * |
3327 | * @thread_safety This function must only be called from the main thread. |
3328 | * |
3329 | * @sa @ref input_char |
3330 | * |
3331 | * @since Added in version 2.4. |
3332 | * @glfw3 Added window handle parameter and return value. |
3333 | * |
3334 | * @ingroup input |
3335 | */ |
3336 | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); |
3337 | |
3338 | /*! @brief Sets the Unicode character with modifiers callback. |
3339 | * |
3340 | * This function sets the character with modifiers callback of the specified |
3341 | * window, which is called when a Unicode character is input regardless of what |
3342 | * modifier keys are used. |
3343 | * |
3344 | * The character with modifiers callback is intended for implementing custom |
3345 | * Unicode character input. For regular Unicode text input, see the |
3346 | * [character callback](@ref glfwSetCharCallback). Like the character |
3347 | * callback, the character with modifiers callback deals with characters and is |
3348 | * keyboard layout dependent. Characters do not map 1:1 to physical keys, as |
3349 | * a key may produce zero, one or more characters. If you want to know whether |
3350 | * a specific physical key was pressed or released, see the |
3351 | * [key callback](@ref glfwSetKeyCallback) instead. |
3352 | * |
3353 | * @param[in] window The window whose callback to set. |
3354 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
3355 | * callback. |
3356 | * @return The previously set callback, or `NULL` if no callback was set or an |
3357 | * error occurred. |
3358 | * |
3359 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3360 | * |
3361 | * @thread_safety This function must only be called from the main thread. |
3362 | * |
3363 | * @sa @ref input_char |
3364 | * |
3365 | * @since Added in version 3.1. |
3366 | * |
3367 | * @ingroup input |
3368 | */ |
3369 | GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun); |
3370 | |
3371 | /*! @brief Sets the mouse button callback. |
3372 | * |
3373 | * This function sets the mouse button callback of the specified window, which |
3374 | * is called when a mouse button is pressed or released. |
3375 | * |
3376 | * When a window loses input focus, it will generate synthetic mouse button |
3377 | * release events for all pressed mouse buttons. You can tell these events |
3378 | * from user-generated events by the fact that the synthetic ones are generated |
3379 | * after the focus loss event has been processed, i.e. after the |
3380 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
3381 | * |
3382 | * @param[in] window The window whose callback to set. |
3383 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
3384 | * callback. |
3385 | * @return The previously set callback, or `NULL` if no callback was set or the |
3386 | * library had not been [initialized](@ref intro_init). |
3387 | * |
3388 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3389 | * |
3390 | * @thread_safety This function must only be called from the main thread. |
3391 | * |
3392 | * @sa @ref input_mouse_button |
3393 | * |
3394 | * @since Added in version 1.0. |
3395 | * @glfw3 Added window handle parameter and return value. |
3396 | * |
3397 | * @ingroup input |
3398 | */ |
3399 | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); |
3400 | |
3401 | /*! @brief Sets the cursor position callback. |
3402 | * |
3403 | * This function sets the cursor position callback of the specified window, |
3404 | * which is called when the cursor is moved. The callback is provided with the |
3405 | * position, in screen coordinates, relative to the upper-left corner of the |
3406 | * client area of the window. |
3407 | * |
3408 | * @param[in] window The window whose callback to set. |
3409 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
3410 | * callback. |
3411 | * @return The previously set callback, or `NULL` if no callback was set or the |
3412 | * library had not been [initialized](@ref intro_init). |
3413 | * |
3414 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3415 | * |
3416 | * @thread_safety This function must only be called from the main thread. |
3417 | * |
3418 | * @sa @ref cursor_pos |
3419 | * |
3420 | * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`. |
3421 | * |
3422 | * @ingroup input |
3423 | */ |
3424 | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); |
3425 | |
3426 | /*! @brief Sets the cursor enter/exit callback. |
3427 | * |
3428 | * This function sets the cursor boundary crossing callback of the specified |
3429 | * window, which is called when the cursor enters or leaves the client area of |
3430 | * the window. |
3431 | * |
3432 | * @param[in] window The window whose callback to set. |
3433 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
3434 | * callback. |
3435 | * @return The previously set callback, or `NULL` if no callback was set or the |
3436 | * library had not been [initialized](@ref intro_init). |
3437 | * |
3438 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3439 | * |
3440 | * @thread_safety This function must only be called from the main thread. |
3441 | * |
3442 | * @sa @ref cursor_enter |
3443 | * |
3444 | * @since Added in version 3.0. |
3445 | * |
3446 | * @ingroup input |
3447 | */ |
3448 | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun); |
3449 | |
3450 | /*! @brief Sets the scroll callback. |
3451 | * |
3452 | * This function sets the scroll callback of the specified window, which is |
3453 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
3454 | * area of a touchpad. |
3455 | * |
3456 | * The scroll callback receives all scrolling input, like that from a mouse |
3457 | * wheel or a touchpad scrolling area. |
3458 | * |
3459 | * @param[in] window The window whose callback to set. |
3460 | * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently |
3461 | * set callback. |
3462 | * @return The previously set callback, or `NULL` if no callback was set or the |
3463 | * library had not been [initialized](@ref intro_init). |
3464 | * |
3465 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3466 | * |
3467 | * @thread_safety This function must only be called from the main thread. |
3468 | * |
3469 | * @sa @ref scrolling |
3470 | * |
3471 | * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`. |
3472 | * |
3473 | * @ingroup input |
3474 | */ |
3475 | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); |
3476 | |
3477 | /*! @brief Sets the file drop callback. |
3478 | * |
3479 | * This function sets the file drop callback of the specified window, which is |
3480 | * called when one or more dragged files are dropped on the window. |
3481 | * |
3482 | * Because the path array and its strings may have been generated specifically |
3483 | * for that event, they are not guaranteed to be valid after the callback has |
3484 | * returned. If you wish to use them after the callback returns, you need to |
3485 | * make a deep copy. |
3486 | * |
3487 | * @param[in] window The window whose callback to set. |
3488 | * @param[in] cbfun The new file drop callback, or `NULL` to remove the |
3489 | * currently set callback. |
3490 | * @return The previously set callback, or `NULL` if no callback was set or the |
3491 | * library had not been [initialized](@ref intro_init). |
3492 | * |
3493 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3494 | * |
3495 | * @thread_safety This function must only be called from the main thread. |
3496 | * |
3497 | * @sa @ref path_drop |
3498 | * |
3499 | * @since Added in version 3.1. |
3500 | * |
3501 | * @ingroup input |
3502 | */ |
3503 | GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun); |
3504 | |
3505 | /*! @brief Returns whether the specified joystick is present. |
3506 | * |
3507 | * This function returns whether the specified joystick is present. |
3508 | * |
3509 | * @param[in] joy The [joystick](@ref joysticks) to query. |
3510 | * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. |
3511 | * |
3512 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3513 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
3514 | * |
3515 | * @thread_safety This function must only be called from the main thread. |
3516 | * |
3517 | * @sa @ref joystick |
3518 | * |
3519 | * @since Added in version 3.0. Replaces `glfwGetJoystickParam`. |
3520 | * |
3521 | * @ingroup input |
3522 | */ |
3523 | GLFWAPI int glfwJoystickPresent(int joy); |
3524 | |
3525 | /*! @brief Returns the values of all axes of the specified joystick. |
3526 | * |
3527 | * This function returns the values of all axes of the specified joystick. |
3528 | * Each element in the array is a value between -1.0 and 1.0. |
3529 | * |
3530 | * Querying a joystick slot with no device present is not an error, but will |
3531 | * cause this function to return `NULL`. Call @ref glfwJoystickPresent to |
3532 | * check device presence. |
3533 | * |
3534 | * @param[in] joy The [joystick](@ref joysticks) to query. |
3535 | * @param[out] count Where to store the number of axis values in the returned |
3536 | * array. This is set to zero if an error occurred. |
3537 | * @return An array of axis values, or `NULL` if the joystick is not present. |
3538 | * |
3539 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3540 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
3541 | * |
3542 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
3543 | * should not free it yourself. It is valid until the specified joystick is |
3544 | * disconnected, this function is called again for that joystick or the library |
3545 | * is terminated. |
3546 | * |
3547 | * @thread_safety This function must only be called from the main thread. |
3548 | * |
3549 | * @sa @ref joystick_axis |
3550 | * |
3551 | * @since Added in version 3.0. Replaces `glfwGetJoystickPos`. |
3552 | * |
3553 | * @ingroup input |
3554 | */ |
3555 | GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count); |
3556 | |
3557 | /*! @brief Returns the state of all buttons of the specified joystick. |
3558 | * |
3559 | * This function returns the state of all buttons of the specified joystick. |
3560 | * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. |
3561 | * |
3562 | * Querying a joystick slot with no device present is not an error, but will |
3563 | * cause this function to return `NULL`. Call @ref glfwJoystickPresent to |
3564 | * check device presence. |
3565 | * |
3566 | * @param[in] joy The [joystick](@ref joysticks) to query. |
3567 | * @param[out] count Where to store the number of button states in the returned |
3568 | * array. This is set to zero if an error occurred. |
3569 | * @return An array of button states, or `NULL` if the joystick is not present. |
3570 | * |
3571 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3572 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
3573 | * |
3574 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
3575 | * should not free it yourself. It is valid until the specified joystick is |
3576 | * disconnected, this function is called again for that joystick or the library |
3577 | * is terminated. |
3578 | * |
3579 | * @thread_safety This function must only be called from the main thread. |
3580 | * |
3581 | * @sa @ref joystick_button |
3582 | * |
3583 | * @since Added in version 2.2. |
3584 | * @glfw3 Changed to return a dynamic array. |
3585 | * |
3586 | * @ingroup input |
3587 | */ |
3588 | GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count); |
3589 | |
3590 | /*! @brief Returns the name of the specified joystick. |
3591 | * |
3592 | * This function returns the name, encoded as UTF-8, of the specified joystick. |
3593 | * The returned string is allocated and freed by GLFW. You should not free it |
3594 | * yourself. |
3595 | * |
3596 | * Querying a joystick slot with no device present is not an error, but will |
3597 | * cause this function to return `NULL`. Call @ref glfwJoystickPresent to |
3598 | * check device presence. |
3599 | * |
3600 | * @param[in] joy The [joystick](@ref joysticks) to query. |
3601 | * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick |
3602 | * is not present. |
3603 | * |
3604 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3605 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
3606 | * |
3607 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
3608 | * should not free it yourself. It is valid until the specified joystick is |
3609 | * disconnected, this function is called again for that joystick or the library |
3610 | * is terminated. |
3611 | * |
3612 | * @thread_safety This function must only be called from the main thread. |
3613 | * |
3614 | * @sa @ref joystick_name |
3615 | * |
3616 | * @since Added in version 3.0. |
3617 | * |
3618 | * @ingroup input |
3619 | */ |
3620 | GLFWAPI const char* glfwGetJoystickName(int joy); |
3621 | |
3622 | /*! @brief Sets the joystick configuration callback. |
3623 | * |
3624 | * This function sets the joystick configuration callback, or removes the |
3625 | * currently set callback. This is called when a joystick is connected to or |
3626 | * disconnected from the system. |
3627 | * |
3628 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
3629 | * callback. |
3630 | * @return The previously set callback, or `NULL` if no callback was set or the |
3631 | * library had not been [initialized](@ref intro_init). |
3632 | * |
3633 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3634 | * |
3635 | * @thread_safety This function must only be called from the main thread. |
3636 | * |
3637 | * @sa @ref joystick_event |
3638 | * |
3639 | * @since Added in version 3.2. |
3640 | * |
3641 | * @ingroup input |
3642 | */ |
3643 | GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun); |
3644 | |
3645 | /*! @brief Sets the clipboard to the specified string. |
3646 | * |
3647 | * This function sets the system clipboard to the specified, UTF-8 encoded |
3648 | * string. |
3649 | * |
3650 | * @param[in] window The window that will own the clipboard contents. |
3651 | * @param[in] string A UTF-8 encoded string. |
3652 | * |
3653 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3654 | * GLFW_PLATFORM_ERROR. |
3655 | * |
3656 | * @pointer_lifetime The specified string is copied before this function |
3657 | * returns. |
3658 | * |
3659 | * @thread_safety This function must only be called from the main thread. |
3660 | * |
3661 | * @sa @ref clipboard |
3662 | * @sa glfwGetClipboardString |
3663 | * |
3664 | * @since Added in version 3.0. |
3665 | * |
3666 | * @ingroup input |
3667 | */ |
3668 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
3669 | |
3670 | /*! @brief Returns the contents of the clipboard as a string. |
3671 | * |
3672 | * This function returns the contents of the system clipboard, if it contains |
3673 | * or is convertible to a UTF-8 encoded string. If the clipboard is empty or |
3674 | * if its contents cannot be converted, `NULL` is returned and a @ref |
3675 | * GLFW_FORMAT_UNAVAILABLE error is generated. |
3676 | * |
3677 | * @param[in] window The window that will request the clipboard contents. |
3678 | * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL` |
3679 | * if an [error](@ref error_handling) occurred. |
3680 | * |
3681 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3682 | * GLFW_PLATFORM_ERROR. |
3683 | * |
3684 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
3685 | * should not free it yourself. It is valid until the next call to @ref |
3686 | * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library |
3687 | * is terminated. |
3688 | * |
3689 | * @thread_safety This function must only be called from the main thread. |
3690 | * |
3691 | * @sa @ref clipboard |
3692 | * @sa glfwSetClipboardString |
3693 | * |
3694 | * @since Added in version 3.0. |
3695 | * |
3696 | * @ingroup input |
3697 | */ |
3698 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
3699 | |
3700 | /*! @brief Returns the value of the GLFW timer. |
3701 | * |
3702 | * This function returns the value of the GLFW timer. Unless the timer has |
3703 | * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW |
3704 | * was initialized. |
3705 | * |
3706 | * The resolution of the timer is system dependent, but is usually on the order |
3707 | * of a few micro- or nanoseconds. It uses the highest-resolution monotonic |
3708 | * time source on each supported platform. |
3709 | * |
3710 | * @return The current value, in seconds, or zero if an |
3711 | * [error](@ref error_handling) occurred. |
3712 | * |
3713 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3714 | * |
3715 | * @thread_safety This function may be called from any thread. Reading and |
3716 | * writing of the internal timer offset is not atomic, so it needs to be |
3717 | * externally synchronized with calls to @ref glfwSetTime. |
3718 | * |
3719 | * @sa @ref time |
3720 | * |
3721 | * @since Added in version 1.0. |
3722 | * |
3723 | * @ingroup input |
3724 | */ |
3725 | GLFWAPI double glfwGetTime(void); |
3726 | |
3727 | /*! @brief Sets the GLFW timer. |
3728 | * |
3729 | * This function sets the value of the GLFW timer. It then continues to count |
3730 | * up from that value. The value must be a positive finite number less than |
3731 | * or equal to 18446744073.0, which is approximately 584.5 years. |
3732 | * |
3733 | * @param[in] time The new value, in seconds. |
3734 | * |
3735 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
3736 | * GLFW_INVALID_VALUE. |
3737 | * |
3738 | * @remark The upper limit of the timer is calculated as |
3739 | * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations |
3740 | * storing nanoseconds in 64 bits. The limit may be increased in the future. |
3741 | * |
3742 | * @thread_safety This function may be called from any thread. Reading and |
3743 | * writing of the internal timer offset is not atomic, so it needs to be |
3744 | * externally synchronized with calls to @ref glfwGetTime. |
3745 | * |
3746 | * @sa @ref time |
3747 | * |
3748 | * @since Added in version 2.2. |
3749 | * |
3750 | * @ingroup input |
3751 | */ |
3752 | GLFWAPI void glfwSetTime(double time); |
3753 | |
3754 | /*! @brief Returns the current value of the raw timer. |
3755 | * |
3756 | * This function returns the current value of the raw timer, measured in |
3757 | * 1 / frequency seconds. To get the frequency, call @ref |
3758 | * glfwGetTimerFrequency. |
3759 | * |
3760 | * @return The value of the timer, or zero if an |
3761 | * [error](@ref error_handling) occurred. |
3762 | * |
3763 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3764 | * |
3765 | * @thread_safety This function may be called from any thread. |
3766 | * |
3767 | * @sa @ref time |
3768 | * @sa glfwGetTimerFrequency |
3769 | * |
3770 | * @since Added in version 3.2. |
3771 | * |
3772 | * @ingroup input |
3773 | */ |
3774 | GLFWAPI uint64_t glfwGetTimerValue(void); |
3775 | |
3776 | /*! @brief Returns the frequency, in Hz, of the raw timer. |
3777 | * |
3778 | * This function returns the frequency, in Hz, of the raw timer. |
3779 | * |
3780 | * @return The frequency of the timer, in Hz, or zero if an |
3781 | * [error](@ref error_handling) occurred. |
3782 | * |
3783 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3784 | * |
3785 | * @thread_safety This function may be called from any thread. |
3786 | * |
3787 | * @sa @ref time |
3788 | * @sa glfwGetTimerValue |
3789 | * |
3790 | * @since Added in version 3.2. |
3791 | * |
3792 | * @ingroup input |
3793 | */ |
3794 | GLFWAPI uint64_t glfwGetTimerFrequency(void); |
3795 | |
3796 | /*! @brief Makes the context of the specified window current for the calling |
3797 | * thread. |
3798 | * |
3799 | * This function makes the OpenGL or OpenGL ES context of the specified window |
3800 | * current on the calling thread. A context can only be made current on |
3801 | * a single thread at a time and each thread can have only a single current |
3802 | * context at a time. |
3803 | * |
3804 | * By default, making a context non-current implicitly forces a pipeline flush. |
3805 | * On machines that support `GL_KHR_context_flush_control`, you can control |
3806 | * whether a context performs this flush by setting the |
3807 | * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint. |
3808 | * |
3809 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
3810 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
3811 | * error. |
3812 | * |
3813 | * @param[in] window The window whose context to make current, or `NULL` to |
3814 | * detach the current context. |
3815 | * |
3816 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3817 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
3818 | * |
3819 | * @thread_safety This function may be called from any thread. |
3820 | * |
3821 | * @sa @ref context_current |
3822 | * @sa glfwGetCurrentContext |
3823 | * |
3824 | * @since Added in version 3.0. |
3825 | * |
3826 | * @ingroup context |
3827 | */ |
3828 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
3829 | |
3830 | /*! @brief Returns the window whose context is current on the calling thread. |
3831 | * |
3832 | * This function returns the window whose OpenGL or OpenGL ES context is |
3833 | * current on the calling thread. |
3834 | * |
3835 | * @return The window whose context is current, or `NULL` if no window's |
3836 | * context is current. |
3837 | * |
3838 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
3839 | * |
3840 | * @thread_safety This function may be called from any thread. |
3841 | * |
3842 | * @sa @ref context_current |
3843 | * @sa glfwMakeContextCurrent |
3844 | * |
3845 | * @since Added in version 3.0. |
3846 | * |
3847 | * @ingroup context |
3848 | */ |
3849 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
3850 | |
3851 | /*! @brief Swaps the front and back buffers of the specified window. |
3852 | * |
3853 | * This function swaps the front and back buffers of the specified window when |
3854 | * rendering with OpenGL or OpenGL ES. If the swap interval is greater than |
3855 | * zero, the GPU driver waits the specified number of screen updates before |
3856 | * swapping the buffers. |
3857 | * |
3858 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
3859 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
3860 | * error. |
3861 | * |
3862 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
3863 | * see `vkQueuePresentKHR` instead. |
3864 | * |
3865 | * @param[in] window The window whose buffers to swap. |
3866 | * |
3867 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3868 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
3869 | * |
3870 | * @remark __EGL:__ The context of the specified window must be current on the |
3871 | * calling thread. |
3872 | * |
3873 | * @thread_safety This function may be called from any thread. |
3874 | * |
3875 | * @sa @ref buffer_swap |
3876 | * @sa glfwSwapInterval |
3877 | * |
3878 | * @since Added in version 1.0. |
3879 | * @glfw3 Added window handle parameter. |
3880 | * |
3881 | * @ingroup window |
3882 | */ |
3883 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
3884 | |
3885 | /*! @brief Sets the swap interval for the current context. |
3886 | * |
3887 | * This function sets the swap interval for the current OpenGL or OpenGL ES |
3888 | * context, i.e. the number of screen updates to wait from the time @ref |
3889 | * glfwSwapBuffers was called before swapping the buffers and returning. This |
3890 | * is sometimes called _vertical synchronization_, _vertical retrace |
3891 | * synchronization_ or just _vsync_. |
3892 | * |
3893 | * Contexts that support either of the `WGL_EXT_swap_control_tear` and |
3894 | * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals, |
3895 | * which allow the driver to swap even if a frame arrives a little bit late. |
3896 | * You can check for the presence of these extensions using @ref |
3897 | * glfwExtensionSupported. For more information about swap tearing, see the |
3898 | * extension specifications. |
3899 | * |
3900 | * A context must be current on the calling thread. Calling this function |
3901 | * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. |
3902 | * |
3903 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
3904 | * see the present mode of your swapchain instead. |
3905 | * |
3906 | * @param[in] interval The minimum number of screen updates to wait for |
3907 | * until the buffers are swapped by @ref glfwSwapBuffers. |
3908 | * |
3909 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3910 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
3911 | * |
3912 | * @remark This function is not called during context creation, leaving the |
3913 | * swap interval set to whatever is the default on that platform. This is done |
3914 | * because some swap interval extensions used by GLFW do not allow the swap |
3915 | * interval to be reset to zero once it has been set to a non-zero value. |
3916 | * |
3917 | * @remark Some GPU drivers do not honor the requested swap interval, either |
3918 | * because of a user setting that overrides the application's request or due to |
3919 | * bugs in the driver. |
3920 | * |
3921 | * @thread_safety This function may be called from any thread. |
3922 | * |
3923 | * @sa @ref buffer_swap |
3924 | * @sa glfwSwapBuffers |
3925 | * |
3926 | * @since Added in version 1.0. |
3927 | * |
3928 | * @ingroup context |
3929 | */ |
3930 | GLFWAPI void glfwSwapInterval(int interval); |
3931 | |
3932 | /*! @brief Returns whether the specified extension is available. |
3933 | * |
3934 | * This function returns whether the specified |
3935 | * [API extension](@ref context_glext) is supported by the current OpenGL or |
3936 | * OpenGL ES context. It searches both for client API extension and context |
3937 | * creation API extensions. |
3938 | * |
3939 | * A context must be current on the calling thread. Calling this function |
3940 | * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. |
3941 | * |
3942 | * As this functions retrieves and searches one or more extension strings each |
3943 | * call, it is recommended that you cache its results if it is going to be used |
3944 | * frequently. The extension strings will not change during the lifetime of |
3945 | * a context, so there is no danger in doing this. |
3946 | * |
3947 | * This function does not apply to Vulkan. If you are using Vulkan, see @ref |
3948 | * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties` |
3949 | * and `vkEnumerateDeviceExtensionProperties` instead. |
3950 | * |
3951 | * @param[in] extension The ASCII encoded name of the extension. |
3952 | * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` |
3953 | * otherwise. |
3954 | * |
3955 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3956 | * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref |
3957 | * GLFW_PLATFORM_ERROR. |
3958 | * |
3959 | * @thread_safety This function may be called from any thread. |
3960 | * |
3961 | * @sa @ref context_glext |
3962 | * @sa glfwGetProcAddress |
3963 | * |
3964 | * @since Added in version 1.0. |
3965 | * |
3966 | * @ingroup context |
3967 | */ |
3968 | GLFWAPI int glfwExtensionSupported(const char* extension); |
3969 | |
3970 | /*! @brief Returns the address of the specified function for the current |
3971 | * context. |
3972 | * |
3973 | * This function returns the address of the specified OpenGL or OpenGL ES |
3974 | * [core or extension function](@ref context_glext), if it is supported |
3975 | * by the current context. |
3976 | * |
3977 | * A context must be current on the calling thread. Calling this function |
3978 | * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. |
3979 | * |
3980 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
3981 | * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and |
3982 | * `vkGetDeviceProcAddr` instead. |
3983 | * |
3984 | * @param[in] procname The ASCII encoded name of the function. |
3985 | * @return The address of the function, or `NULL` if an |
3986 | * [error](@ref error_handling) occurred. |
3987 | * |
3988 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
3989 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
3990 | * |
3991 | * @remark The address of a given function is not guaranteed to be the same |
3992 | * between contexts. |
3993 | * |
3994 | * @remark This function may return a non-`NULL` address despite the |
3995 | * associated version or extension not being available. Always check the |
3996 | * context version or extension string first. |
3997 | * |
3998 | * @pointer_lifetime The returned function pointer is valid until the context |
3999 | * is destroyed or the library is terminated. |
4000 | * |
4001 | * @thread_safety This function may be called from any thread. |
4002 | * |
4003 | * @sa @ref context_glext |
4004 | * @sa glfwExtensionSupported |
4005 | * |
4006 | * @since Added in version 1.0. |
4007 | * |
4008 | * @ingroup context |
4009 | */ |
4010 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
4011 | |
4012 | /*! @brief Returns whether the Vulkan loader has been found. |
4013 | * |
4014 | * This function returns whether the Vulkan loader has been found. This check |
4015 | * is performed by @ref glfwInit. |
4016 | * |
4017 | * The availability of a Vulkan loader does not by itself guarantee that window |
4018 | * surface creation or even device creation is possible. Call @ref |
4019 | * glfwGetRequiredInstanceExtensions to check whether the extensions necessary |
4020 | * for Vulkan surface creation are available and @ref |
4021 | * glfwGetPhysicalDevicePresentationSupport to check whether a queue family of |
4022 | * a physical device supports image presentation. |
4023 | * |
4024 | * @return `GLFW_TRUE` if Vulkan is available, or `GLFW_FALSE` otherwise. |
4025 | * |
4026 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
4027 | * |
4028 | * @thread_safety This function may be called from any thread. |
4029 | * |
4030 | * @sa @ref vulkan_support |
4031 | * |
4032 | * @since Added in version 3.2. |
4033 | * |
4034 | * @ingroup vulkan |
4035 | */ |
4036 | GLFWAPI int glfwVulkanSupported(void); |
4037 | |
4038 | /*! @brief Returns the Vulkan instance extensions required by GLFW. |
4039 | * |
4040 | * This function returns an array of names of Vulkan instance extensions required |
4041 | * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the |
4042 | * list will always contains `VK_KHR_surface`, so if you don't require any |
4043 | * additional extensions you can pass this list directly to the |
4044 | * `VkInstanceCreateInfo` struct. |
4045 | * |
4046 | * If Vulkan is not available on the machine, this function returns `NULL` and |
4047 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
4048 | * to check whether Vulkan is available. |
4049 | * |
4050 | * If Vulkan is available but no set of extensions allowing window surface |
4051 | * creation was found, this function returns `NULL`. You may still use Vulkan |
4052 | * for off-screen rendering and compute work. |
4053 | * |
4054 | * @param[out] count Where to store the number of extensions in the returned |
4055 | * array. This is set to zero if an error occurred. |
4056 | * @return An array of ASCII encoded extension names, or `NULL` if an |
4057 | * [error](@ref error_handling) occurred. |
4058 | * |
4059 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
4060 | * GLFW_API_UNAVAILABLE. |
4061 | * |
4062 | * @remarks Additional extensions may be required by future versions of GLFW. |
4063 | * You should check if any extensions you wish to enable are already in the |
4064 | * returned array, as it is an error to specify an extension more than once in |
4065 | * the `VkInstanceCreateInfo` struct. |
4066 | * |
4067 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
4068 | * should not free it yourself. It is guaranteed to be valid only until the |
4069 | * library is terminated. |
4070 | * |
4071 | * @thread_safety This function may be called from any thread. |
4072 | * |
4073 | * @sa @ref vulkan_ext |
4074 | * @sa glfwCreateWindowSurface |
4075 | * |
4076 | * @since Added in version 3.2. |
4077 | * |
4078 | * @ingroup vulkan |
4079 | */ |
4080 | GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count); |
4081 | |
4082 | #if defined(VK_VERSION_1_0) |
4083 | |
4084 | /*! @brief Returns the address of the specified Vulkan instance function. |
4085 | * |
4086 | * This function returns the address of the specified Vulkan core or extension |
4087 | * function for the specified instance. If instance is set to `NULL` it can |
4088 | * return any function exported from the Vulkan loader, including at least the |
4089 | * following functions: |
4090 | * |
4091 | * - `vkEnumerateInstanceExtensionProperties` |
4092 | * - `vkEnumerateInstanceLayerProperties` |
4093 | * - `vkCreateInstance` |
4094 | * - `vkGetInstanceProcAddr` |
4095 | * |
4096 | * If Vulkan is not available on the machine, this function returns `NULL` and |
4097 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
4098 | * to check whether Vulkan is available. |
4099 | * |
4100 | * This function is equivalent to calling `vkGetInstanceProcAddr` with |
4101 | * a platform-specific query of the Vulkan loader as a fallback. |
4102 | * |
4103 | * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve |
4104 | * functions related to instance creation. |
4105 | * @param[in] procname The ASCII encoded name of the function. |
4106 | * @return The address of the function, or `NULL` if an |
4107 | * [error](@ref error_handling) occurred. |
4108 | * |
4109 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
4110 | * GLFW_API_UNAVAILABLE. |
4111 | * |
4112 | * @pointer_lifetime The returned function pointer is valid until the library |
4113 | * is terminated. |
4114 | * |
4115 | * @thread_safety This function may be called from any thread. |
4116 | * |
4117 | * @sa @ref vulkan_proc |
4118 | * |
4119 | * @since Added in version 3.2. |
4120 | * |
4121 | * @ingroup vulkan |
4122 | */ |
4123 | GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); |
4124 | |
4125 | /*! @brief Returns whether the specified queue family can present images. |
4126 | * |
4127 | * This function returns whether the specified queue family of the specified |
4128 | * physical device supports presentation to the platform GLFW was built for. |
4129 | * |
4130 | * If Vulkan or the required window surface creation instance extensions are |
4131 | * not available on the machine, or if the specified instance was not created |
4132 | * with the required extensions, this function returns `GLFW_FALSE` and |
4133 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
4134 | * to check whether Vulkan is available and @ref |
4135 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
4136 | * required. |
4137 | * |
4138 | * @param[in] instance The instance that the physical device belongs to. |
4139 | * @param[in] device The physical device that the queue family belongs to. |
4140 | * @param[in] queuefamily The index of the queue family to query. |
4141 | * @return `GLFW_TRUE` if the queue family supports presentation, or |
4142 | * `GLFW_FALSE` otherwise. |
4143 | * |
4144 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
4145 | * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
4146 | * |
4147 | * @thread_safety This function may be called from any thread. For |
4148 | * synchronization details of Vulkan objects, see the Vulkan specification. |
4149 | * |
4150 | * @sa @ref vulkan_present |
4151 | * |
4152 | * @since Added in version 3.2. |
4153 | * |
4154 | * @ingroup vulkan |
4155 | */ |
4156 | GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); |
4157 | |
4158 | /*! @brief Creates a Vulkan surface for the specified window. |
4159 | * |
4160 | * This function creates a Vulkan surface for the specified window. |
4161 | * |
4162 | * If the Vulkan loader was not found at initialization, this function returns |
4163 | * `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref GLFW_API_UNAVAILABLE |
4164 | * error. Call @ref glfwVulkanSupported to check whether the Vulkan loader was |
4165 | * found. |
4166 | * |
4167 | * If the required window surface creation instance extensions are not |
4168 | * available or if the specified instance was not created with these extensions |
4169 | * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and |
4170 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref |
4171 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
4172 | * required. |
4173 | * |
4174 | * The window surface must be destroyed before the specified Vulkan instance. |
4175 | * It is the responsibility of the caller to destroy the window surface. GLFW |
4176 | * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the |
4177 | * surface. |
4178 | * |
4179 | * @param[in] instance The Vulkan instance to create the surface in. |
4180 | * @param[in] window The window to create the surface for. |
4181 | * @param[in] allocator The allocator to use, or `NULL` to use the default |
4182 | * allocator. |
4183 | * @param[out] surface Where to store the handle of the surface. This is set |
4184 | * to `VK_NULL_HANDLE` if an error occurred. |
4185 | * @return `VK_SUCCESS` if successful, or a Vulkan error code if an |
4186 | * [error](@ref error_handling) occurred. |
4187 | * |
4188 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
4189 | * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
4190 | * |
4191 | * @remarks If an error occurs before the creation call is made, GLFW returns |
4192 | * the Vulkan error code most appropriate for the error. Appropriate use of |
4193 | * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should |
4194 | * eliminate almost all occurrences of these errors. |
4195 | * |
4196 | * @thread_safety This function may be called from any thread. For |
4197 | * synchronization details of Vulkan objects, see the Vulkan specification. |
4198 | * |
4199 | * @sa @ref vulkan_surface |
4200 | * @sa glfwGetRequiredInstanceExtensions |
4201 | * |
4202 | * @since Added in version 3.2. |
4203 | * |
4204 | * @ingroup vulkan |
4205 | */ |
4206 | GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); |
4207 | |
4208 | #endif /*VK_VERSION_1_0*/ |
4209 | |
4210 | |
4211 | /************************************************************************* |
4212 | * Global definition cleanup |
4213 | *************************************************************************/ |
4214 | |
4215 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
4216 | |
4217 | #ifdef GLFW_WINGDIAPI_DEFINED |
4218 | #undef WINGDIAPI |
4219 | #undef GLFW_WINGDIAPI_DEFINED |
4220 | #endif |
4221 | |
4222 | #ifdef GLFW_CALLBACK_DEFINED |
4223 | #undef CALLBACK |
4224 | #undef GLFW_CALLBACK_DEFINED |
4225 | #endif |
4226 | |
4227 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
4228 | |
4229 | |
4230 | #ifdef __cplusplus |
4231 | } |
4232 | #endif |
4233 | |
4234 | #endif /* _glfw3_h_ */ |
4235 | |
4236 | |