blob: 85510d6414cc5223ed96a035888962fbbc01b7ac [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund95a07f32015-06-01 22:55:06 +02002 * GLFW 3.2 - www.glfw.org
Camilla Berglund3cfc4002013-07-29 20:53:17 +02003 * A library for OpenGL, window and input
Camilla Berglund3249f812010-09-07 17:34:51 +02004 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
Camilla Berglundf8105ed2010-11-09 02:57:46 +01006 * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
Camilla Berglund3249f812010-09-07 17:34:51 +02007 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
Camilla Berglundf8df91d2013-01-15 01:59:56 +010029#ifndef _glfw3_h_
30#define _glfw3_h_
Camilla Berglund3249f812010-09-07 17:34:51 +020031
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
Camilla Berglundbce2cd62012-11-22 16:38:24 +010038 * Doxygen documentation
39 *************************************************************************/
40
Camilla Berglund318e8ac2015-10-24 20:48:46 +020041/*! @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 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010049/*! @defgroup context Context reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020050 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010051 * This is the reference documentation for OpenGL and OpenGL ES context related
52 * functions. For more task-oriented information, see the @ref context_guide.
Camilla Berglund3f5843f2012-12-13 02:22:39 +010053 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010054/*! @defgroup vulkan Vulkan reference
Camilla Berglund9b75bff2015-08-10 20:19:04 +020055 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010056 * This is the reference documentation for Vulkan related functions and types.
57 * For more task-oriented information, see the @ref vulkan_guide.
Camilla Berglund9b75bff2015-08-10 20:19:04 +020058 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010059/*! @defgroup init Initialization, version and error reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020060 *
61 * This is the reference documentation for initialization and termination of
Camilla Berglund80c203f2016-02-19 10:29:13 +010062 * the library, version management and error handling. For more task-oriented
63 * information, see the @ref intro_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010064 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010065/*! @defgroup input Input reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020066 *
67 * This is the reference documentation for input related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010068 * For more task-oriented information, see the @ref input_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010069 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010070/*! @defgroup monitor Monitor reference
Camilla Berglundf5f55e32013-06-17 12:56:36 +020071 *
72 * This is the reference documentation for monitor related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010073 * For more task-oriented information, see the @ref monitor_guide.
Camilla Berglund5f68e122012-11-27 17:07:28 +010074 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010075/*! @defgroup window Window reference
Camilla Berglundbce2cd62012-11-22 16:38:24 +010076 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +020077 * This is the reference documentation for window related functions and types,
Camilla Berglund80c203f2016-02-19 10:29:13 +010078 * including creation, deletion and event polling. For more task-oriented
79 * information, see the @ref window_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010080 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010081
82
83/*************************************************************************
Camilla Berglund8d910d72015-02-22 18:35:10 +010084 * Compiler- and platform-specific preprocessor work
Camilla Berglund3249f812010-09-07 17:34:51 +020085 *************************************************************************/
86
Camilla Berglund8d910d72015-02-22 18:35:10 +010087/* If we are we on Windows, we want a single define for it.
Camilla Berglund3249f812010-09-07 17:34:51 +020088 */
Camilla Berglunde8ce4ab2015-02-22 18:18:43 +010089#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
Camilla Berglund3249f812010-09-07 17:34:51 +020090 #define _WIN32
91#endif /* _WIN32 */
92
Camilla Berglund8d910d72015-02-22 18:35:10 +010093/* It is customary to use APIENTRY for OpenGL function pointer declarations on
94 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
Camilla Berglund3249f812010-09-07 17:34:51 +020095 */
96#ifndef APIENTRY
97 #ifdef _WIN32
98 #define APIENTRY __stdcall
99 #else
100 #define APIENTRY
101 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200102#endif /* APIENTRY */
103
Camilla Berglund8d910d72015-02-22 18:35:10 +0100104/* Some Windows OpenGL headers need this.
Camilla Berglund3249f812010-09-07 17:34:51 +0200105 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200106#if !defined(WINGDIAPI) && defined(_WIN32)
Camilla Berglundc5353642015-02-22 18:14:30 +0100107 #define WINGDIAPI __declspec(dllimport)
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200108 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200109#endif /* WINGDIAPI */
110
Camilla Berglund8d910d72015-02-22 18:35:10 +0100111/* Some Windows GLU headers need this.
112 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200113#if !defined(CALLBACK) && defined(_WIN32)
Camilla Berglundd586fe62015-02-22 18:17:34 +0100114 #define CALLBACK __stdcall
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200115 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200116#endif /* CALLBACK */
117
Camilla Berglund8d910d72015-02-22 18:35:10 +0100118/* Most Windows GLU headers need wchar_t.
119 * The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h.
Camilla Berglund8221aad2016-03-06 09:40:16 +0100120 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund8d910d72015-02-22 18:35:10 +0100121 */
Camilla Berglund8221aad2016-03-06 09:40:16 +0100122#include <stddef.h>
Camilla Berglund3249f812010-09-07 17:34:51 +0200123
Camilla Berglundc93b1202013-09-08 16:07:34 +0200124/* Include the chosen client API headers.
125 */
Camilla Berglunddb49aa62016-02-22 13:16:43 +0100126#if defined(__APPLE__)
Camilla Berglund1591caa2015-01-08 06:56:17 +0100127 #if defined(GLFW_INCLUDE_GLCOREARB)
128 #include <OpenGL/gl3.h>
129 #if defined(GLFW_INCLUDE_GLEXT)
130 #include <OpenGL/gl3ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200131 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100132 #elif !defined(GLFW_INCLUDE_NONE)
133 #if !defined(GLFW_INCLUDE_GLEXT)
134 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200135 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100136 #include <OpenGL/gl.h>
137 #endif
138 #if defined(GLFW_INCLUDE_GLU)
139 #include <OpenGL/glu.h>
140 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200141#else
Camilla Berglund1591caa2015-01-08 06:56:17 +0100142 #if defined(GLFW_INCLUDE_GLCOREARB)
143 #include <GL/glcorearb.h>
144 #elif defined(GLFW_INCLUDE_ES1)
145 #include <GLES/gl.h>
146 #if defined(GLFW_INCLUDE_GLEXT)
147 #include <GLES/glext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200148 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100149 #elif defined(GLFW_INCLUDE_ES2)
150 #include <GLES2/gl2.h>
151 #if defined(GLFW_INCLUDE_GLEXT)
152 #include <GLES2/gl2ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200153 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100154 #elif defined(GLFW_INCLUDE_ES3)
155 #include <GLES3/gl3.h>
156 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100157 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100158 #endif
159 #elif defined(GLFW_INCLUDE_ES31)
160 #include <GLES3/gl31.h>
161 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100162 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100163 #endif
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200164 #elif defined(GLFW_INCLUDE_VULKAN)
165 #include <vulkan/vulkan.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100166 #elif !defined(GLFW_INCLUDE_NONE)
167 #include <GL/gl.h>
168 #if defined(GLFW_INCLUDE_GLEXT)
169 #include <GL/glext.h>
170 #endif
171 #endif
172 #if defined(GLFW_INCLUDE_GLU)
173 #include <GL/glu.h>
174 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200175#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200176
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200177#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200178 /* GLFW_DLL must be defined by applications that are linking against the DLL
179 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
180 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200181 */
Camilla Berglund0df4e062015-12-13 14:07:27 +0100182 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200183#endif
184
Camilla Berglund1591caa2015-01-08 06:56:17 +0100185/* GLFWAPI is used to declare public API functions for export
186 * from the DLL / shared library / dynamic library.
187 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200188#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200189 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100190 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200191#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200192 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100193 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100194#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200195 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100196 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200197#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200198 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200199 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200200#endif
201
Camilla Berglund3249f812010-09-07 17:34:51 +0200202
203/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100204 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200205 *************************************************************************/
206
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100207/*! @name GLFW version macros
208 * @{ */
209/*! @brief The major version number of the GLFW library.
210 *
211 * This is incremented when the API is changed in non-compatible ways.
212 * @ingroup init
213 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100214#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100215/*! @brief The minor version number of the GLFW library.
216 *
217 * This is incremented when features are added to the API but it remains
218 * backward-compatible.
219 * @ingroup init
220 */
Camilla Berglund95a07f32015-06-01 22:55:06 +0200221#define GLFW_VERSION_MINOR 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100222/*! @brief The revision number of the GLFW library.
223 *
224 * This is incremented when a bug fix release is made that does not contain any
225 * API changes.
226 * @ingroup init
227 */
Camilla Berglund95a07f32015-06-01 22:55:06 +0200228#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100229/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200230
Camilla Berglund0eccf752015-08-23 19:30:04 +0200231/*! @name Boolean values
232 * @{ */
233/*! @brief One.
234 *
235 * One. Seriously. You don't _need_ to use this symbol in your code. It's
236 * just semantic sugar for the number 1. You can use `1` or `true` or `_True`
237 * or `GL_TRUE` or whatever you want.
238 */
239#define GLFW_TRUE 1
240/*! @brief Zero.
241 *
242 * Zero. Seriously. You don't _need_ to use this symbol in your code. It's
243 * just just semantic sugar for the number 0. You can use `0` or `false` or
244 * `_False` or `GL_FALSE` or whatever you want.
245 */
246#define GLFW_FALSE 0
247/*! @} */
248
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100249/*! @name Key and button actions
250 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200251/*! @brief The key or mouse button was released.
252 *
253 * The key or mouse button was released.
254 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100255 * @ingroup input
256 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100257#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200258/*! @brief The key or mouse button was pressed.
259 *
260 * The key or mouse button was pressed.
261 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100262 * @ingroup input
263 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100264#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100265/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200266 *
267 * The key was held down until it repeated.
268 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100269 * @ingroup input
270 */
271#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100272/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200273
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200274/*! @defgroup keys Keyboard keys
275 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100276 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200277 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100278 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
279 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
280 * put in the 256+ range).
281 *
282 * The naming of the key codes follow these rules:
283 * - The US keyboard layout is used
284 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
285 * "3", etc.)
286 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
287 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
288 * correspond to the Unicode standard (usually for brevity)
289 * - Keys that lack a clear US mapping are named "WORLD_x"
290 * - For non-printable keys, custom names are used (e.g. "F4",
291 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200292 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100293 * @ingroup input
294 * @{
295 */
296
Camilla Berglund11615fc2013-05-30 17:19:12 +0200297/* The unknown key */
298#define GLFW_KEY_UNKNOWN -1
299
Marcusc0cb4c22011-01-02 11:18:14 +0100300/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100301#define GLFW_KEY_SPACE 32
302#define GLFW_KEY_APOSTROPHE 39 /* ' */
303#define GLFW_KEY_COMMA 44 /* , */
304#define GLFW_KEY_MINUS 45 /* - */
305#define GLFW_KEY_PERIOD 46 /* . */
306#define GLFW_KEY_SLASH 47 /* / */
307#define GLFW_KEY_0 48
308#define GLFW_KEY_1 49
309#define GLFW_KEY_2 50
310#define GLFW_KEY_3 51
311#define GLFW_KEY_4 52
312#define GLFW_KEY_5 53
313#define GLFW_KEY_6 54
314#define GLFW_KEY_7 55
315#define GLFW_KEY_8 56
316#define GLFW_KEY_9 57
317#define GLFW_KEY_SEMICOLON 59 /* ; */
318#define GLFW_KEY_EQUAL 61 /* = */
319#define GLFW_KEY_A 65
320#define GLFW_KEY_B 66
321#define GLFW_KEY_C 67
322#define GLFW_KEY_D 68
323#define GLFW_KEY_E 69
324#define GLFW_KEY_F 70
325#define GLFW_KEY_G 71
326#define GLFW_KEY_H 72
327#define GLFW_KEY_I 73
328#define GLFW_KEY_J 74
329#define GLFW_KEY_K 75
330#define GLFW_KEY_L 76
331#define GLFW_KEY_M 77
332#define GLFW_KEY_N 78
333#define GLFW_KEY_O 79
334#define GLFW_KEY_P 80
335#define GLFW_KEY_Q 81
336#define GLFW_KEY_R 82
337#define GLFW_KEY_S 83
338#define GLFW_KEY_T 84
339#define GLFW_KEY_U 85
340#define GLFW_KEY_V 86
341#define GLFW_KEY_W 87
342#define GLFW_KEY_X 88
343#define GLFW_KEY_Y 89
344#define GLFW_KEY_Z 90
345#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
346#define GLFW_KEY_BACKSLASH 92 /* \ */
347#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
348#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
349#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
350#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100351
352/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100353#define GLFW_KEY_ESCAPE 256
354#define GLFW_KEY_ENTER 257
355#define GLFW_KEY_TAB 258
356#define GLFW_KEY_BACKSPACE 259
357#define GLFW_KEY_INSERT 260
358#define GLFW_KEY_DELETE 261
359#define GLFW_KEY_RIGHT 262
360#define GLFW_KEY_LEFT 263
361#define GLFW_KEY_DOWN 264
362#define GLFW_KEY_UP 265
363#define GLFW_KEY_PAGE_UP 266
364#define GLFW_KEY_PAGE_DOWN 267
365#define GLFW_KEY_HOME 268
366#define GLFW_KEY_END 269
367#define GLFW_KEY_CAPS_LOCK 280
368#define GLFW_KEY_SCROLL_LOCK 281
369#define GLFW_KEY_NUM_LOCK 282
370#define GLFW_KEY_PRINT_SCREEN 283
371#define GLFW_KEY_PAUSE 284
372#define GLFW_KEY_F1 290
373#define GLFW_KEY_F2 291
374#define GLFW_KEY_F3 292
375#define GLFW_KEY_F4 293
376#define GLFW_KEY_F5 294
377#define GLFW_KEY_F6 295
378#define GLFW_KEY_F7 296
379#define GLFW_KEY_F8 297
380#define GLFW_KEY_F9 298
381#define GLFW_KEY_F10 299
382#define GLFW_KEY_F11 300
383#define GLFW_KEY_F12 301
384#define GLFW_KEY_F13 302
385#define GLFW_KEY_F14 303
386#define GLFW_KEY_F15 304
387#define GLFW_KEY_F16 305
388#define GLFW_KEY_F17 306
389#define GLFW_KEY_F18 307
390#define GLFW_KEY_F19 308
391#define GLFW_KEY_F20 309
392#define GLFW_KEY_F21 310
393#define GLFW_KEY_F22 311
394#define GLFW_KEY_F23 312
395#define GLFW_KEY_F24 313
396#define GLFW_KEY_F25 314
397#define GLFW_KEY_KP_0 320
398#define GLFW_KEY_KP_1 321
399#define GLFW_KEY_KP_2 322
400#define GLFW_KEY_KP_3 323
401#define GLFW_KEY_KP_4 324
402#define GLFW_KEY_KP_5 325
403#define GLFW_KEY_KP_6 326
404#define GLFW_KEY_KP_7 327
405#define GLFW_KEY_KP_8 328
406#define GLFW_KEY_KP_9 329
407#define GLFW_KEY_KP_DECIMAL 330
408#define GLFW_KEY_KP_DIVIDE 331
409#define GLFW_KEY_KP_MULTIPLY 332
410#define GLFW_KEY_KP_SUBTRACT 333
411#define GLFW_KEY_KP_ADD 334
412#define GLFW_KEY_KP_ENTER 335
413#define GLFW_KEY_KP_EQUAL 336
414#define GLFW_KEY_LEFT_SHIFT 340
415#define GLFW_KEY_LEFT_CONTROL 341
416#define GLFW_KEY_LEFT_ALT 342
417#define GLFW_KEY_LEFT_SUPER 343
418#define GLFW_KEY_RIGHT_SHIFT 344
419#define GLFW_KEY_RIGHT_CONTROL 345
420#define GLFW_KEY_RIGHT_ALT 346
421#define GLFW_KEY_RIGHT_SUPER 347
422#define GLFW_KEY_MENU 348
Camilla Berglund9c315412015-07-02 14:24:50 +0200423
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100424#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100425
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100426/*! @} */
427
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200428/*! @defgroup mods Modifier key flags
Camilla Berglund4188c262015-01-18 01:55:25 +0100429 *
430 * See [key input](@ref input_key) for how these are used.
431 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200432 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100433 * @{ */
434
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200435/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100436 */
437#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200438/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100439 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200440#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200441/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100442 */
443#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200444/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200445 */
446#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100447
448/*! @} */
449
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100450/*! @defgroup buttons Mouse buttons
Camilla Berglund4188c262015-01-18 01:55:25 +0100451 *
452 * See [mouse button input](@ref input_mouse_button) for how these are used.
453 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100454 * @ingroup input
455 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100456#define GLFW_MOUSE_BUTTON_1 0
457#define GLFW_MOUSE_BUTTON_2 1
458#define GLFW_MOUSE_BUTTON_3 2
459#define GLFW_MOUSE_BUTTON_4 3
460#define GLFW_MOUSE_BUTTON_5 4
461#define GLFW_MOUSE_BUTTON_6 5
462#define GLFW_MOUSE_BUTTON_7 6
463#define GLFW_MOUSE_BUTTON_8 7
464#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
465#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
466#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
467#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100468/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200469
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100470/*! @defgroup joysticks Joysticks
Camilla Berglund4188c262015-01-18 01:55:25 +0100471 *
472 * See [joystick input](@ref joystick) for how these are used.
473 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100474 * @ingroup input
475 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100476#define GLFW_JOYSTICK_1 0
477#define GLFW_JOYSTICK_2 1
478#define GLFW_JOYSTICK_3 2
479#define GLFW_JOYSTICK_4 3
480#define GLFW_JOYSTICK_5 4
481#define GLFW_JOYSTICK_6 5
482#define GLFW_JOYSTICK_7 6
483#define GLFW_JOYSTICK_8 7
484#define GLFW_JOYSTICK_9 8
485#define GLFW_JOYSTICK_10 9
486#define GLFW_JOYSTICK_11 10
487#define GLFW_JOYSTICK_12 11
488#define GLFW_JOYSTICK_13 12
489#define GLFW_JOYSTICK_14 13
490#define GLFW_JOYSTICK_15 14
491#define GLFW_JOYSTICK_16 15
492#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100493/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200494
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100495/*! @defgroup errors Error codes
Camilla Berglund4188c262015-01-18 01:55:25 +0100496 *
497 * See [error handling](@ref error_handling) for how these are used.
498 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200499 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100500 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100501/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200502 *
Camilla Berglund0df4e062015-12-13 14:07:27 +0100503 * This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund4591ad22014-09-18 15:03:29 +0200504 * library is [initialized](@ref intro_init).
505 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100506 * @analysis Application programmer error. Initialize GLFW before calling any
507 * function that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100508 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200509#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100510/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200511 *
512 * This occurs if a GLFW function was called that needs and operates on the
513 * current OpenGL or OpenGL ES context but no context is current on the calling
514 * thread. One such function is @ref glfwSwapInterval.
515 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100516 * @analysis Application programmer error. Ensure a context is current before
517 * calling functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100518 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200519#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200520/*! @brief One of the arguments to the function was an invalid enum value.
521 *
522 * One of the arguments to the function was an invalid enum value, for example
Camilla Berglundce8f97c2015-01-11 23:33:14 +0100523 * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref
524 * glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200525 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100526 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100527 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200528#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200529/*! @brief One of the arguments to the function was an invalid value.
530 *
531 * One of the arguments to the function was an invalid value, for example
532 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
533 *
534 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
535 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
536 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100537 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100538 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200539#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100540/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200541 *
542 * A memory allocation failed.
543 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100544 * @analysis A bug in GLFW or the underlying operating system. Report the bug
545 * to our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100546 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200547#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200548/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200549 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200550 * GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200551 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100552 * @analysis The installed graphics driver does not support the requested
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200553 * API, or does not support it via the chosen context creation backend.
Camilla Berglund951a9582016-01-31 21:32:14 +0100554 * Below are a few examples.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200555 *
556 * @par
557 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200558 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200559 * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100560 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200561 * driver. Older graphics drivers do not support Vulkan.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100562 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200563#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200564/*! @brief The requested OpenGL or OpenGL ES version is not available.
565 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100566 * The requested OpenGL or OpenGL ES version (including any requested context
567 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200568 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100569 * @analysis The machine does not support your requirements. If your
570 * application is sufficiently flexible, downgrade your requirements and try
571 * again. Otherwise, inform the user that their machine does not match your
Camilla Berglund4591ad22014-09-18 15:03:29 +0200572 * requirements.
573 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200574 * @par
575 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
576 * comes out before the 4.x series gets that far, also fail with this error and
577 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
578 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100579 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200580#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100581/*! @brief A platform-specific error occurred that does not match any of the
582 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200583 *
584 * A platform-specific error occurred that does not match any of the more
585 * specific categories.
586 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100587 * @analysis A bug or configuration error in GLFW, the underlying operating
588 * system or its drivers, or a lack of required resources. Report the issue to
589 * our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100590 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200591#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200592/*! @brief The requested format is not supported or available.
593 *
594 * If emitted during window creation, the requested pixel format is not
595 * supported.
596 *
597 * If emitted when querying the clipboard, the contents of the clipboard could
598 * not be converted to the requested format.
599 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100600 * @analysis If emitted during window creation, one or more
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200601 * [hard constraints](@ref window_hints_hard) did not match any of the
602 * available pixel formats. If your application is sufficiently flexible,
603 * downgrade your requirements and try again. Otherwise, inform the user that
604 * their machine does not match your requirements.
605 *
606 * @par
607 * If emitted when querying the clipboard, ignore the error or report it to
608 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100609 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200610#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglund496f5592015-06-18 14:03:02 +0200611/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
612 *
613 * A window that does not have an OpenGL or OpenGL ES context was passed to
614 * a function that requires it to have one.
615 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100616 * @analysis Application programmer error. Fix the offending call.
Camilla Berglund496f5592015-06-18 14:03:02 +0200617 */
618#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100619/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200620
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100621#define GLFW_FOCUSED 0x00020001
622#define GLFW_ICONIFIED 0x00020002
Camilla Berglund393e4392013-05-27 22:16:59 +0200623#define GLFW_RESIZABLE 0x00020003
624#define GLFW_VISIBLE 0x00020004
625#define GLFW_DECORATED 0x00020005
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200626#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200627#define GLFW_FLOATING 0x00020007
Camilla Berglunda10caa42015-10-13 12:50:59 +0200628#define GLFW_MAXIMIZED 0x00020008
Camilla Berglund2c091572010-09-09 21:09:11 +0200629
Camilla Berglund53b39a62013-05-30 18:55:45 +0200630#define GLFW_RED_BITS 0x00021001
631#define GLFW_GREEN_BITS 0x00021002
632#define GLFW_BLUE_BITS 0x00021003
633#define GLFW_ALPHA_BITS 0x00021004
634#define GLFW_DEPTH_BITS 0x00021005
635#define GLFW_STENCIL_BITS 0x00021006
636#define GLFW_ACCUM_RED_BITS 0x00021007
637#define GLFW_ACCUM_GREEN_BITS 0x00021008
638#define GLFW_ACCUM_BLUE_BITS 0x00021009
639#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
640#define GLFW_AUX_BUFFERS 0x0002100B
641#define GLFW_STEREO 0x0002100C
642#define GLFW_SAMPLES 0x0002100D
643#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Berglund2cd34382013-05-30 20:42:50 +0200644#define GLFW_REFRESH_RATE 0x0002100F
Camilla Berglundc9808582014-04-24 19:21:10 +0200645#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Berglunddeb0b3d2012-12-02 21:00:15 +0100646
Camilla Berglund53b39a62013-05-30 18:55:45 +0200647#define GLFW_CLIENT_API 0x00022001
648#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
649#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
650#define GLFW_CONTEXT_REVISION 0x00022004
651#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
652#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
653#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
654#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Berglund44c899c2014-08-21 19:21:45 +0200655#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Berglund7be82092015-08-10 12:46:14 +0200656#define GLFW_CONTEXT_NO_ERROR 0x0002200A
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100657
Camilla Berglund496f5592015-06-18 14:03:02 +0200658#define GLFW_NO_API 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200659#define GLFW_OPENGL_API 0x00030001
660#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100661
Camilla Berglund393e4392013-05-27 22:16:59 +0200662#define GLFW_NO_ROBUSTNESS 0
663#define GLFW_NO_RESET_NOTIFICATION 0x00031001
664#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100665
Camilla Berglund44e84012013-06-05 16:13:30 +0200666#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200667#define GLFW_OPENGL_CORE_PROFILE 0x00032001
668#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100669
Camilla Berglund393e4392013-05-27 22:16:59 +0200670#define GLFW_CURSOR 0x00033001
671#define GLFW_STICKY_KEYS 0x00033002
672#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100673
Camilla Berglund393e4392013-05-27 22:16:59 +0200674#define GLFW_CURSOR_NORMAL 0x00034001
675#define GLFW_CURSOR_HIDDEN 0x00034002
676#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100677
Camilla Berglund44c899c2014-08-21 19:21:45 +0200678#define GLFW_ANY_RELEASE_BEHAVIOR 0
679#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
680#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
681
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200682/*! @defgroup shapes Standard cursor shapes
Camilla Berglund4188c262015-01-18 01:55:25 +0100683 *
684 * See [standard cursor creation](@ref cursor_standard) for how these are used.
685 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200686 * @ingroup input
687 * @{ */
688
689/*! @brief The regular arrow cursor shape.
690 *
691 * The regular arrow cursor.
692 */
693#define GLFW_ARROW_CURSOR 0x00036001
694/*! @brief The text input I-beam cursor shape.
695 *
696 * The text input I-beam cursor shape.
697 */
698#define GLFW_IBEAM_CURSOR 0x00036002
699/*! @brief The crosshair shape.
700 *
701 * The crosshair shape.
702 */
703#define GLFW_CROSSHAIR_CURSOR 0x00036003
704/*! @brief The hand shape.
705 *
706 * The hand shape.
707 */
708#define GLFW_HAND_CURSOR 0x00036004
709/*! @brief The horizontal resize arrow shape.
710 *
711 * The horizontal resize arrow shape.
712 */
713#define GLFW_HRESIZE_CURSOR 0x00036005
714/*! @brief The vertical resize arrow shape.
715 *
716 * The vertical resize arrow shape.
717 */
718#define GLFW_VRESIZE_CURSOR 0x00036006
719/*! @} */
720
Camilla Berglund393e4392013-05-27 22:16:59 +0200721#define GLFW_CONNECTED 0x00040001
722#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100723
Camilla Berglund28101302014-04-08 18:57:43 +0200724#define GLFW_DONT_CARE -1
725
Camilla Berglund97387282011-10-06 23:28:56 +0200726
Camilla Berglund3249f812010-09-07 17:34:51 +0200727/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100728 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200729 *************************************************************************/
730
Camilla Berglund31f67dd2016-03-06 11:38:55 +0100731/*! @brief 64-bit unsigned integer.
732 *
733 * 64-bit unsigned integer.
734 *
735 * @since Added in version 3.2.
736 */
737#if defined(_MSC_VER) && (_MSC_VER < 1600)
738typedef unsigned __int64 GLFWuint64;
739#else
740 #include <stdint.h>
741typedef uint64_t GLFWuint64;
742#endif
743
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100744/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200745 *
746 * Generic function pointer used for returning client API function pointers
747 * without forcing a cast from a regular pointer.
748 *
Camilla Berglundbce20c32015-11-05 13:58:52 +0100749 * @sa @ref context_glext
750 * @sa glfwGetProcAddress
751 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100752 * @since Added in version 3.0.
753
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100754 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100755 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200756typedef void (*GLFWglproc)(void);
757
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200758/*! @brief Vulkan API function pointer type.
759 *
760 * Generic function pointer used for returning Vulkan API function pointers
761 * without forcing a cast from a regular pointer.
762 *
763 * @sa @ref vulkan_proc
764 * @sa glfwGetInstanceProcAddress
765 *
766 * @since Added in version 3.2.
767 *
768 * @ingroup vulkan
769 */
770typedef void (*GLFWvkproc)(void);
771
Camilla Berglunddba2d802013-01-17 23:06:56 +0100772/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200773 *
774 * Opaque monitor object.
775 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100776 * @see @ref monitor_object
777 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100778 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100779 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100780 * @ingroup monitor
781 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100782typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200783
Camilla Berglunddba2d802013-01-17 23:06:56 +0100784/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200785 *
786 * Opaque window object.
787 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100788 * @see @ref window_object
789 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100790 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100791 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100792 * @ingroup window
793 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100794typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200795
urraka40c04a72013-12-04 10:19:22 -0300796/*! @brief Opaque cursor object.
797 *
798 * Opaque cursor object.
799 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100800 * @see @ref cursor_object
801 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100802 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +0100803 *
urraka40c04a72013-12-04 10:19:22 -0300804 * @ingroup cursor
805 */
806typedef struct GLFWcursor GLFWcursor;
807
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100808/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200809 *
810 * This is the function signature for error callback functions.
811 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100812 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100813 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100814 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100815 * @sa @ref error_handling
Camilla Berglunddba2d802013-01-17 23:06:56 +0100816 * @sa glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100817 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100818 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100819 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200820 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100821 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100822typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100823
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100824/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200825 *
826 * This is the function signature for window position callback functions.
827 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200828 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200829 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
830 * upper-left corner of the client area of the window.
831 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
832 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100833 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100834 * @sa @ref window_pos
Camilla Berglunddba2d802013-01-17 23:06:56 +0100835 * @sa glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100836 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100837 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100838 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100839 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100840 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100841typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100842
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100843/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200844 *
845 * This is the function signature for window size callback functions.
846 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200847 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200848 * @param[in] width The new width, in screen coordinates, of the window.
849 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100850 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100851 * @sa @ref window_size
Camilla Berglunddba2d802013-01-17 23:06:56 +0100852 * @sa glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100853 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100854 * @since Added in version 1.0.
855 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100856 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100857 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100858 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100859typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100860
861/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200862 *
863 * This is the function signature for window close callback functions.
864 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100865 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100866 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100867 * @sa @ref window_close
Camilla Berglunddba2d802013-01-17 23:06:56 +0100868 * @sa glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100869 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100870 * @since Added in version 2.5.
871 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100872 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100873 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100874 */
Camilla Berglund64afb192013-03-06 23:29:37 +0100875typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100876
877/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200878 *
879 * This is the function signature for window refresh callback functions.
880 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100881 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100882 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100883 * @sa @ref window_refresh
Camilla Berglunddba2d802013-01-17 23:06:56 +0100884 * @sa glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100885 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100886 * @since Added in version 2.5.
887 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100888 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100889 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100890 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100891typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100892
893/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200894 *
895 * This is the function signature for window focus callback functions.
896 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100897 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200898 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
899 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100900 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100901 * @sa @ref window_focus
Camilla Berglunddba2d802013-01-17 23:06:56 +0100902 * @sa glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100903 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100904 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100905 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100906 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100907 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100908typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100909
Camilla Berglund06e7a962012-11-22 19:14:27 +0100910/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200911 *
912 * This is the function signature for window iconify/restore callback
913 * functions.
914 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100915 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200916 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
917 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100918 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100919 * @sa @ref window_iconify
Camilla Berglunddba2d802013-01-17 23:06:56 +0100920 * @sa glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100921 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100922 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100923 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100924 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100925 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100926typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100927
Camilla Berglund34981632013-06-03 12:51:57 +0200928/*! @brief The function signature for framebuffer resize callbacks.
929 *
930 * This is the function signature for framebuffer resize callback
931 * functions.
932 *
933 * @param[in] window The window whose framebuffer was resized.
934 * @param[in] width The new width, in pixels, of the framebuffer.
935 * @param[in] height The new height, in pixels, of the framebuffer.
936 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100937 * @sa @ref window_fbsize
Camilla Berglund34981632013-06-03 12:51:57 +0200938 * @sa glfwSetFramebufferSizeCallback
939 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100940 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100941 *
Camilla Berglund34981632013-06-03 12:51:57 +0200942 * @ingroup window
943 */
944typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
945
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100946/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200947 *
948 * This is the function signature for mouse button callback functions.
949 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100950 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100951 * @param[in] button The [mouse button](@ref buttons) that was pressed or
952 * released.
953 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200954 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
955 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100956 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100957 * @sa @ref input_mouse_button
Camilla Berglunddba2d802013-01-17 23:06:56 +0100958 * @sa glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100959 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100960 * @since Added in version 1.0.
961 * @glfw3 Added window handle and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +0100962 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100963 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100964 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100965typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100966
967/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200968 *
969 * This is the function signature for cursor position callback functions.
970 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100971 * @param[in] window The window that received the event.
Camilla Berglund95c44ab2016-02-17 14:52:01 +0100972 * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
973 * the client area.
974 * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
975 * client area.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100976 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100977 * @sa @ref cursor_pos
Camilla Berglunddba2d802013-01-17 23:06:56 +0100978 * @sa glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100979 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100980 * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +0100981 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100982 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100983 */
Camilla Berglund129e94d2013-04-04 16:16:21 +0200984typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100985
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200986/*! @brief The function signature for cursor enter/leave callbacks.
987 *
988 * This is the function signature for cursor enter/leave callback functions.
989 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100990 * @param[in] window The window that received the event.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200991 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
992 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100993 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100994 * @sa @ref cursor_enter
Camilla Berglunddba2d802013-01-17 23:06:56 +0100995 * @sa glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100996 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100997 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100998 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100999 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001000 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001001typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001002
1003/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001004 *
1005 * This is the function signature for scroll callback functions.
1006 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001007 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +02001008 * @param[in] xoffset The scroll offset along the x-axis.
1009 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001010 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001011 * @sa @ref scrolling
Camilla Berglunddba2d802013-01-17 23:06:56 +01001012 * @sa glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001013 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001014 * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001015 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001016 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001017 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001018typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001019
1020/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001021 *
1022 * This is the function signature for keyboard key callback functions.
1023 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001024 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001025 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +02001026 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001027 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001028 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1029 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001030 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001031 * @sa @ref input_key
Camilla Berglunddba2d802013-01-17 23:06:56 +01001032 * @sa glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001033 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001034 * @since Added in version 1.0.
1035 * @glfw3 Added window handle, scancode and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001036 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001037 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001038 */
Camilla Berglund11615fc2013-05-30 17:19:12 +02001039typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001040
1041/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001042 *
1043 * This is the function signature for Unicode character callback functions.
1044 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001045 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +02001046 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001047 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001048 * @sa @ref input_char
Camilla Berglunddba2d802013-01-17 23:06:56 +01001049 * @sa glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001050 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001051 * @since Added in version 2.4.
1052 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001053 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001054 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001055 */
Camilla Berglund182e0af2013-02-25 17:02:28 +01001056typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +01001057
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001058/*! @brief The function signature for Unicode character with modifiers
1059 * callbacks.
1060 *
1061 * This is the function signature for Unicode character with modifiers callback
1062 * functions. It is called for each input character, regardless of what
1063 * modifier keys are held down.
1064 *
1065 * @param[in] window The window that received the event.
1066 * @param[in] codepoint The Unicode code point of the character.
1067 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1068 * held down.
1069 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001070 * @sa @ref input_char
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001071 * @sa glfwSetCharModsCallback
1072 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001073 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001074 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001075 * @ingroup input
1076 */
1077typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1078
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001079/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001080 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001081 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001082 *
1083 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001084 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +01001085 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +02001086 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001087 * @sa @ref path_drop
arturo89d07232013-07-10 11:42:14 +02001088 * @sa glfwSetDropCallback
1089 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001090 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001091 *
arturo89d07232013-07-10 11:42:14 +02001092 * @ingroup input
1093 */
Camilla Berglund8f349e82013-12-22 19:28:46 +01001094typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +02001095
Camilla Berglund5f68e122012-11-27 17:07:28 +01001096/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001097 *
1098 * This is the function signature for monitor configuration callback functions.
1099 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001100 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001101 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001102 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001103 * @sa @ref monitor_event
Camilla Berglunddba2d802013-01-17 23:06:56 +01001104 * @sa glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001105 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001106 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001107 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001108 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +01001109 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001110typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +01001111
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001112/*! @brief Video mode type.
1113 *
1114 * This describes a single video mode.
1115 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001116 * @sa @ref monitor_modes
1117 * @sa glfwGetVideoMode glfwGetVideoModes
1118 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001119 * @since Added in version 1.0.
1120 * @glfw3 Added refresh rate member.
Camilla Berglund810bab72015-12-13 17:38:14 +01001121 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001122 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001123 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001124typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001125{
Camilla Berglund95835af2013-05-30 13:53:25 +02001126 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001127 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001128 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001129 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001130 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001131 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001132 /*! The bit depth of the red channel of the video mode.
1133 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001134 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001135 /*! The bit depth of the green channel of the video mode.
1136 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001137 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001138 /*! The bit depth of the blue channel of the video mode.
1139 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001140 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001141 /*! The refresh rate, in Hz, of the video mode.
1142 */
1143 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001144} GLFWvidmode;
1145
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001146/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001147 *
1148 * This describes the gamma ramp for a monitor.
1149 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001150 * @sa @ref monitor_gamma
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001151 * @sa glfwGetGammaRamp glfwSetGammaRamp
1152 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001153 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001154 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001155 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001156 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001157typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001158{
Camilla Berglundc1594112013-05-27 22:29:06 +02001159 /*! An array of value describing the response of the red channel.
1160 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001161 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001162 /*! An array of value describing the response of the green channel.
1163 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001164 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001165 /*! An array of value describing the response of the blue channel.
1166 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001167 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001168 /*! The number of elements in each array.
1169 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001170 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001171} GLFWgammaramp;
1172
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001173/*! @brief Image data.
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001174 *
1175 * @sa @ref cursor_custom
Camilla Berglund810bab72015-12-13 17:38:14 +01001176 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001177 * @since Added in version 2.1.
1178 * @glfw3 Removed format and bytes-per-pixel members.
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001179 */
1180typedef struct GLFWimage
1181{
1182 /*! The width, in pixels, of this image.
1183 */
1184 int width;
1185 /*! The height, in pixels, of this image.
1186 */
1187 int height;
1188 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1189 */
1190 unsigned char* pixels;
1191} GLFWimage;
1192
Camilla Berglund3249f812010-09-07 17:34:51 +02001193
1194/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001195 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001196 *************************************************************************/
1197
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001198/*! @brief Initializes the GLFW library.
1199 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001200 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001201 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001202 * should be terminated in order to free any resources allocated during or
1203 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001204 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001205 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001206 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001207 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001208 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001209 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001210 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001211 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001212 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001213 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001214 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1215 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001216 * @remark @osx This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001217 * application to the `Contents/Resources` subdirectory of the application's
Camilla Berglund4591ad22014-09-18 15:03:29 +02001218 * bundle, if present. This can be disabled with a
1219 * [compile-time option](@ref compile_options_osx).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001220 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001221 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001222 *
1223 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001224 * @sa glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001225 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001226 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001227 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001228 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001229 */
1230GLFWAPI int glfwInit(void);
1231
1232/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001233 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001234 * This function destroys all remaining windows and cursors, restores any
1235 * modified gamma ramps and frees any other allocated resources. Once this
1236 * function is called, you must again call @ref glfwInit successfully before
1237 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001238 *
1239 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001240 * before the application exits. If initialization fails, there is no need to
1241 * call this function, as it is called by @ref glfwInit before it returns
1242 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001243 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001244 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1245 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001246 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001247 *
Camilla Berglund0df4e062015-12-13 14:07:27 +01001248 * @warning The contexts of any remaining windows must not be current on any
1249 * other thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001250 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001251 * @reentrancy This function must not be called from a callback.
Camilla Berglund20858762015-01-01 18:41:22 +01001252 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001253 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001254 *
1255 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001256 * @sa glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001257 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001258 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001259 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001260 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001261 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001262GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001263
1264/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001265 *
1266 * This function retrieves the major, minor and revision numbers of the GLFW
1267 * library. It is intended for when you are using GLFW as a shared library and
1268 * want to ensure that you are using the minimum required version.
1269 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001270 * Any or all of the version arguments may be `NULL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001271 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001272 * @param[out] major Where to store the major version number, or `NULL`.
1273 * @param[out] minor Where to store the minor version number, or `NULL`.
1274 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001275 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001276 * @errors None.
1277 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001278 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001279 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001280 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001281 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001282 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001283 * @sa glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001284 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001285 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001286 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001287 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001288 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001289GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001290
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001291/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001292 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001293 * This function returns the compile-time generated
1294 * [version string](@ref intro_version_string) of the GLFW library binary. It
1295 * describes the version, platform, compiler and any platform-specific
Camilla Berglund386b6032016-02-10 13:48:49 +01001296 * compile-time options. It should not be confused with the OpenGL or OpenGL
1297 * ES version string, queried with `glGetString`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001298 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001299 * __Do not use the version string__ to parse the GLFW library version. The
Camilla Berglund386b6032016-02-10 13:48:49 +01001300 * @ref glfwGetVersion function provides the version of the running library
1301 * binary in numerical format.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001302 *
Camilla Berglund386b6032016-02-10 13:48:49 +01001303 * @return The ASCII encoded GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001304 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001305 * @errors None.
1306 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001307 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001308 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001309 * @pointer_lifetime The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001310 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001311 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001312 *
1313 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001314 * @sa glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001315 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001316 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001317 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001318 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001319 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001320GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001321
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001322/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001323 *
1324 * This function sets the error callback, which is called with an error code
1325 * and a human-readable description each time a GLFW error occurs.
1326 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001327 * The error callback is called on the thread where the error occurred. If you
1328 * are using GLFW from multiple threads, your error callback needs to be
1329 * written accordingly.
1330 *
1331 * Because the description string may have been generated specifically for that
1332 * error, it is not guaranteed to be valid after the callback has returned. If
1333 * you wish to use it after the callback returns, you need to make a copy.
1334 *
Camilla Berglund20858762015-01-01 18:41:22 +01001335 * Once set, the error callback remains set even after the library has been
1336 * terminated.
1337 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001338 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001339 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001340 * @return The previously set callback, or `NULL` if no callback was set.
1341 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001342 * @errors None.
1343 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001344 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001345 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001346 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001347 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001348 * @sa @ref error_handling
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001349 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001350 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001351 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001352 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001353 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001354GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001355
Camilla Berglund5f68e122012-11-27 17:07:28 +01001356/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001357 *
1358 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001359 * monitors. The primary monitor is always first in the returned array. If no
1360 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001361 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001362 * @param[out] count Where to store the number of monitors in the returned
1363 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001364 * @return An array of monitor handles, or `NULL` if no monitors were found or
1365 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001366 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001367 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1368 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001369 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1370 * should not free it yourself. It is guaranteed to be valid only until the
1371 * monitor configuration changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001372 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001373 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001374 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001375 * @sa @ref monitor_monitors
1376 * @sa @ref monitor_event
Camilla Berglunddba2d802013-01-17 23:06:56 +01001377 * @sa glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001378 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001379 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001380 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001381 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001382 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001383GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001384
Camilla Berglund5f68e122012-11-27 17:07:28 +01001385/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001386 *
1387 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001388 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001389 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001390 * @return The primary monitor, or `NULL` if no monitors were found or if an
1391 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001392 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001393 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1394 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001395 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001396 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001397 * @remark The primary monitor is always first in the array returned by @ref
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001398 * glfwGetMonitors.
1399 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001400 * @sa @ref monitor_monitors
Camilla Berglunddba2d802013-01-17 23:06:56 +01001401 * @sa glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001402 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001403 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001404 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001405 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001406 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001407GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001408
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001409/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001410 *
1411 * This function returns the position, in screen coordinates, of the upper-left
1412 * corner of the specified monitor.
1413 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001414 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1415 * non-`NULL` position arguments will be set to zero.
1416 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001417 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001418 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1419 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001420 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001421 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1422 * GLFW_PLATFORM_ERROR.
1423 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001424 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001425 *
1426 * @sa @ref monitor_properties
1427 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001428 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001429 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001430 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001431 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001432GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1433
1434/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001435 *
1436 * This function returns the size, in millimetres, of the display area of the
1437 * specified monitor.
1438 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001439 * Some systems do not provide accurate monitor size information, either
1440 * because the monitor
1441 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1442 * data is incorrect or because the driver does not report it accurately.
1443 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001444 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1445 * non-`NULL` size arguments will be set to zero.
1446 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001447 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001448 * @param[out] widthMM Where to store the width, in millimetres, of the
1449 * monitor's display area, or `NULL`.
1450 * @param[out] heightMM Where to store the height, in millimetres, of the
1451 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001452 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001453 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1454 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001455 * @remark @win32 calculates the returned physical size from the
Camilla Berglund4188c262015-01-18 01:55:25 +01001456 * current resolution and system DPI instead of querying the monitor EDID data.
Camilla Berglund0e205772014-03-24 11:58:35 +01001457 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001458 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001459 *
1460 * @sa @ref monitor_properties
1461 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001462 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001463 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001464 * @ingroup monitor
1465 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001466GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001467
Camilla Berglund5f68e122012-11-27 17:07:28 +01001468/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001469 *
1470 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001471 * specified monitor. The name typically reflects the make and model of the
1472 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001473 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001474 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001475 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1476 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001477 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001478 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1479 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001480 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
1481 * should not free it yourself. It is valid until the specified monitor is
1482 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001483 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001484 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001485 *
1486 * @sa @ref monitor_properties
1487 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001488 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001489 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001490 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001491 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001492GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001493
Camilla Berglund5f68e122012-11-27 17:07:28 +01001494/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001495 *
1496 * This function sets the monitor configuration callback, or removes the
1497 * currently set callback. This is called when a monitor is connected to or
1498 * disconnected from the system.
1499 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001500 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001501 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001502 * @return The previously set callback, or `NULL` if no callback was set or the
1503 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001504 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001505 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1506 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001507 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001508 *
1509 * @sa @ref monitor_event
1510 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001511 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001512 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001513 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001514 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001515GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001516
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001517/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001518 *
1519 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001520 * monitor. The returned array is sorted in ascending order, first by color
1521 * bit depth (the sum of all channel depths) and then by resolution area (the
1522 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001523 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001524 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001525 * @param[out] count Where to store the number of video modes in the returned
1526 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001527 * @return An array of video modes, or `NULL` if an
1528 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001529 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001530 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1531 * GLFW_PLATFORM_ERROR.
1532 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001533 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1534 * should not free it yourself. It is valid until the specified monitor is
1535 * disconnected, this function is called again for that monitor or the library
1536 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001537 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001538 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001539 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001540 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001541 * @sa glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001542 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001543 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001544 * @glfw3 Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001545 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001546 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001547 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001548GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001549
Camilla Berglund5f68e122012-11-27 17:07:28 +01001550/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001551 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001552 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001553 * you have created a full screen window for that monitor, the return value
1554 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001555 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001556 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001557 * @return The current mode of the monitor, or `NULL` if an
1558 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001559 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001560 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1561 * GLFW_PLATFORM_ERROR.
1562 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001563 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1564 * should not free it yourself. It is valid until the specified monitor is
1565 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001566 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001567 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001568 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001569 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001570 * @sa glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001571 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001572 * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001573 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001574 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001575 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001576GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001577
Camilla Berglund92a71e02013-02-12 13:50:41 +01001578/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001579 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001580 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglund5bbc2b42015-03-15 15:40:43 +01001581 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1582 * number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001583 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001584 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001585 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001586 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001587 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1588 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
1589 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001590 * @thread_safety This function must only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001591 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001592 * @sa @ref monitor_gamma
1593 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001594 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001595 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001596 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001597 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001598GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001599
Camilla Berglund4591ad22014-09-18 15:03:29 +02001600/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001601 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001602 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001603 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001604 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001605 * @return The current gamma ramp, or `NULL` if an
1606 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001607 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001608 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1609 * GLFW_PLATFORM_ERROR.
1610 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001611 * @pointer_lifetime The returned structure and its arrays are allocated and
1612 * freed by GLFW. You should not free them yourself. They are valid until the
1613 * specified monitor is disconnected, this function is called again for that
1614 * monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001615 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001616 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001617 *
1618 * @sa @ref monitor_gamma
1619 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001620 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001621 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001622 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001623 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001624GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001625
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001626/*! @brief Sets the current gamma ramp for the specified monitor.
1627 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001628 * This function sets the current gamma ramp for the specified monitor. The
1629 * original gamma ramp for that monitor is saved by GLFW the first time this
1630 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001631 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001632 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001633 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001634 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001635 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1636 * GLFW_PLATFORM_ERROR.
1637 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001638 * @remark Gamma ramp sizes other than 256 are not supported by all platforms
Camilla Berglund76fff4d2015-03-10 19:02:28 +01001639 * or graphics hardware.
1640 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001641 * @remark @win32 The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001642 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001643 * @pointer_lifetime The specified gamma ramp is copied before this function
1644 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001645 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001646 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001647 *
1648 * @sa @ref monitor_gamma
1649 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001650 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001651 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001652 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001653 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001654GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001655
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001656/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001657 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001658 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001659 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001660 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001661 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1662 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001663 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001664 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001665 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001666 * @sa glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001667 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001668 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001669 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001670 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001671 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001672GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001673
1674/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001675 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001676 * This function sets hints for the next call to @ref glfwCreateWindow. The
1677 * hints, once set, retain their values until changed by a call to @ref
1678 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02001679 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01001680 *
Camilla Berglundd6e0a432016-02-09 07:41:48 +01001681 * This function does not check whether the specified hint values are valid.
1682 * If you set hints to invalid values this will instead be reported by the next
1683 * call to @ref glfwCreateWindow.
1684 *
Camilla Berglundd0649e62016-01-27 03:25:21 +01001685 * @param[in] hint The [window hint](@ref window_hints) to set.
1686 * @param[in] value The new value of the window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001687 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001688 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1689 * GLFW_INVALID_ENUM.
1690 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001691 * @thread_safety This function must only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01001692 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001693 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001694 * @sa glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001695 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001696 * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001697 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001698 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001699 */
Camilla Berglundd0649e62016-01-27 03:25:21 +01001700GLFWAPI void glfwWindowHint(int hint, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001701
1702/*! @brief Creates a window and its associated context.
1703 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001704 * This function creates a window and its associated OpenGL or OpenGL ES
1705 * context. Most of the options controlling how the window and its context
1706 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001707 *
1708 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02001709 * can use the newly created context, you need to
1710 * [make it current](@ref context_current). For information about the `share`
1711 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001712 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001713 * The created window, framebuffer and context may differ from what you
1714 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001715 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001716 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02001717 * of the created window, framebuffer and context, see @ref
1718 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001719 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001720 * To create a full screen window, you need to specify the monitor the window
1721 * will cover. If no monitor is specified, windowed mode will be used. Unless
1722 * you have a way for the user to choose a specific monitor, it is recommended
Camilla Berglund4591ad22014-09-18 15:03:29 +02001723 * that you pick the primary monitor. For more information on how to query
1724 * connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001725 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001726 * For full screen windows, the specified size becomes the resolution of the
1727 * window's _desired video mode_. As long as a full screen window has input
1728 * focus, the supported video mode most closely matching the desired video mode
1729 * is set for the specified monitor. For more information about full screen
1730 * windows, including the creation of so called _windowed full screen_ or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001731 * _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001732 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001733 * By default, newly created windows use the placement recommended by the
1734 * window system. To create the window at a specific position, make it
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001735 * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
1736 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
1737 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001738 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001739 * If a full screen window has input focus, the screensaver is prohibited from
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001740 * starting.
1741 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001742 * Window systems put limits on window sizes. Very large or very small window
1743 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02001744 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001745 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001746 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02001747 * the initial value may vary depending on driver settings and defaults.
1748 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001749 * @param[in] width The desired width, in screen coordinates, of the window.
1750 * This must be greater than zero.
1751 * @param[in] height The desired height, in screen coordinates, of the window.
1752 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001753 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001754 * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001755 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001756 * @param[in] share The window whose context to share resources with, or `NULL`
1757 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001758 * @return The handle of the created window, or `NULL` if an
1759 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001760 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001761 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1762 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
1763 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
1764 * GLFW_PLATFORM_ERROR.
1765 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001766 * @remark @win32 Window creation will fail if the Microsoft GDI software
1767 * OpenGL implementation is the only one available.
Camilla Berglund07db5da2013-09-26 19:15:36 +02001768 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001769 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,`
1770 * it will be set as the icon for the window. If no such icon is present, the
1771 * `IDI_WINLOGO` icon will be used instead.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001772 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001773 * @remark @win32 The context to share resources with must not be current on
1774 * any other thread.
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01001775 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001776 * @remark @osx The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01001777 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001778 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001779 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1780 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001781 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001782 * @remark @osx The first time a window is created the menu bar is populated
1783 * with common commands like Hide, Quit and About. The About entry opens
1784 * a minimal about dialog with information from the application's bundle. The
1785 * menu bar can be disabled with a
Camilla Berglund96d230b2014-10-07 02:15:36 +02001786 * [compile-time option](@ref compile_options_osx).
Camilla Berglund4591ad22014-09-18 15:03:29 +02001787 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001788 * @remark @osx On OS X 10.10 and later the window frame will not be rendered
1789 * at full resolution on Retina displays unless the `NSHighResolutionCapable`
1790 * key is enabled in the application bundle's `Info.plist`. For more
1791 * information, see
Camilla Berglund821f3e62015-03-16 22:39:14 +01001792 * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
Camilla Berglundd12b3432015-07-21 17:42:01 +02001793 * in the Mac Developer Library. The GLFW test and example programs use
1794 * a custom `Info.plist` template for this, which can be found as
1795 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01001796 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001797 * @remark @x11 There is no mechanism for setting the window icon yet.
Camilla Berglundb9fb45f2013-10-27 11:03:47 +01001798 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001799 * @remark @x11 Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001800 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02001801 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001802 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
1803 * a window to reach its requested state. This means you may not be able to
1804 * query the final size, position or other attributes directly after window
1805 * creation.
Camilla Berglund20ed0a12015-08-12 21:31:54 +02001806 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001807 * @reentrancy This function must not be called from a callback.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001808 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001809 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001810 *
1811 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001812 * @sa glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001813 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001814 * @since Added in version 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001815 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001816 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001817 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001818GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001819
1820/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001821 *
1822 * This function destroys the specified window and its context. On calling
1823 * this function, no further callbacks will be called for that window.
1824 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001825 * If the context of the specified window is current on the main thread, it is
1826 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001827 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001828 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001829 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001830 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1831 * GLFW_PLATFORM_ERROR.
1832 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001833 * @note The context of the specified window must not be current on any other
1834 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001835 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001836 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01001837 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001838 * @thread_safety This function must only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001839 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001840 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001841 * @sa glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001842 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001843 * @since Added in version 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001844 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001845 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001846 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001847GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001848
Camilla Berglund64afb192013-03-06 23:29:37 +01001849/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001850 *
1851 * This function returns the value of the close flag of the specified window.
1852 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001853 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01001854 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001855 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001856 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1857 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001858 * @thread_safety This function may be called from any thread. Access is not
1859 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001860 *
1861 * @sa @ref window_close
1862 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001863 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001864 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001865 * @ingroup window
1866 */
1867GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1868
Camilla Berglund64afb192013-03-06 23:29:37 +01001869/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001870 *
1871 * This function sets the value of the close flag of the specified window.
1872 * This can be used to override the user's attempt to close the window, or
1873 * to signal that it should be closed.
1874 *
Camilla Berglund64afb192013-03-06 23:29:37 +01001875 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01001876 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001877 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001878 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1879 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001880 * @thread_safety This function may be called from any thread. Access is not
1881 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001882 *
1883 * @sa @ref window_close
1884 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001885 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001886 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001887 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01001888 */
1889GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1890
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001891/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001892 *
1893 * This function sets the window title, encoded as UTF-8, of the specified
1894 * window.
1895 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001896 * @param[in] window The window whose title to change.
1897 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001898 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001899 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1900 * GLFW_PLATFORM_ERROR.
1901 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001902 * @remark @osx The window title will not be updated until the next time you
1903 * process events.
Camilla Berglund6412dcb2015-04-07 21:52:29 +02001904 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001905 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001906 *
1907 * @sa @ref window_title
1908 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001909 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001910 * @glfw3 Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001911 *
1912 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001913 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001914GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001915
Camilla Berglund7c193232013-01-24 19:30:31 +01001916/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001917 *
1918 * This function retrieves the position, in screen coordinates, of the
1919 * upper-left corner of the client area of the specified window.
1920 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001921 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1922 * non-`NULL` position arguments will be set to zero.
1923 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001924 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001925 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
1926 * the client area, or `NULL`.
1927 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
1928 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01001929 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001930 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1931 * GLFW_PLATFORM_ERROR.
1932 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001933 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001934 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001935 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01001936 * @sa glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001937 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001938 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001939 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001940 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001941 */
1942GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
1943
1944/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001945 *
1946 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02001947 * corner of the client area of the specified windowed mode window. If the
1948 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001949 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001950 * __Do not use this function__ to move an already visible window unless you
1951 * have very good reasons for doing so, as it will confuse and annoy the user.
1952 *
1953 * The window manager may put limits on what positions are allowed. GLFW
1954 * cannot and should not override these limits.
1955 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001956 * @param[in] window The window to query.
1957 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
1958 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01001959 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001960 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1961 * GLFW_PLATFORM_ERROR.
1962 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001963 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001964 *
1965 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01001966 * @sa glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001967 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001968 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001969 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001970 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001971 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001972 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01001973GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01001974
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001975/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001976 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001977 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02001978 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001979 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001980 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001981 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1982 * non-`NULL` size arguments will be set to zero.
1983 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001984 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001985 * @param[out] width Where to store the width, in screen coordinates, of the
1986 * client area, or `NULL`.
1987 * @param[out] height Where to store the height, in screen coordinates, of the
1988 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001989 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001990 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1991 * GLFW_PLATFORM_ERROR.
1992 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001993 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001994 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001995 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001996 * @sa glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001997 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001998 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001999 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002000 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002001 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002002 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002003GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002004
Camilla Berglundd84772d2014-02-13 02:57:59 +01002005/*! @brief Sets the size limits of the specified window.
2006 *
2007 * This function sets the size limits of the client area of the specified
2008 * window. If the window is full screen or not resizable, this function does
2009 * nothing.
2010 *
2011 * The size limits are applied immediately and may cause the window to be
2012 * resized.
2013 *
2014 * @param[in] window The window to set limits for.
2015 * @param[in] minwidth The minimum width, in screen coordinates, of the client
2016 * area, or `GLFW_DONT_CARE`.
2017 * @param[in] minheight The minimum height, in screen coordinates, of the
2018 * client area, or `GLFW_DONT_CARE`.
2019 * @param[in] maxwidth The maximum width, in screen coordinates, of the client
2020 * area, or `GLFW_DONT_CARE`.
2021 * @param[in] maxheight The maximum height, in screen coordinates, of the
2022 * client area, or `GLFW_DONT_CARE`.
2023 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002024 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2025 * GLFW_PLATFORM_ERROR.
2026 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002027 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002028 * results are undefined.
2029 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002030 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002031 *
2032 * @sa @ref window_sizelimits
2033 * @sa glfwSetWindowAspectRatio
2034 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002035 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002036 *
2037 * @ingroup window
2038 */
2039GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2040
2041/*! @brief Sets the aspect ratio of the specified window.
2042 *
2043 * This function sets the required aspect ratio of the client area of the
2044 * specified window. If the window is full screen or not resizable, this
2045 * function does nothing.
2046 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002047 * The aspect ratio is specified as a numerator and a denominator and both
2048 * values must be greater than zero. For example, the common 16:9 aspect ratio
2049 * is specified as 16 and 9, respectively.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002050 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002051 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
2052 * ratio limit is disabled.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002053 *
2054 * The aspect ratio is applied immediately and may cause the window to be
2055 * resized.
2056 *
2057 * @param[in] window The window to set limits for.
2058 * @param[in] numer The numerator of the desired aspect ratio, or
2059 * `GLFW_DONT_CARE`.
2060 * @param[in] denom The denominator of the desired aspect ratio, or
2061 * `GLFW_DONT_CARE`.
2062 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002063 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2064 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2065 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002066 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002067 * results are undefined.
2068 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002069 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002070 *
2071 * @sa @ref window_sizelimits
2072 * @sa glfwSetWindowSizeLimits
2073 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002074 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002075 *
2076 * @ingroup window
2077 */
2078GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2079
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002080/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002081 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002082 * This function sets the size, in screen coordinates, of the client area of
2083 * the specified window.
2084 *
2085 * For full screen windows, this function selects and switches to the resolution
2086 * closest to the specified size, without affecting the window's context. As
2087 * the context is unaffected, the bit depths of the framebuffer remain
2088 * unchanged.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002089 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002090 * The window manager may put limits on what sizes are allowed. GLFW cannot
2091 * and should not override these limits.
2092 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002093 * @param[in] window The window to resize.
2094 * @param[in] width The desired width of the specified window.
2095 * @param[in] height The desired height of the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002096 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002097 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2098 * GLFW_PLATFORM_ERROR.
2099 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002100 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002101 *
2102 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002103 * @sa glfwGetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002104 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002105 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002106 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002107 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002108 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002109 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002110GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002111
Camilla Berglund34981632013-06-03 12:51:57 +02002112/*! @brief Retrieves the size of the framebuffer of the specified window.
2113 *
2114 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002115 * specified window. If you wish to retrieve the size of the window in screen
2116 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02002117 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002118 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2119 * non-`NULL` size arguments will be set to zero.
2120 *
Camilla Berglund34981632013-06-03 12:51:57 +02002121 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002122 * @param[out] width Where to store the width, in pixels, of the framebuffer,
2123 * or `NULL`.
2124 * @param[out] height Where to store the height, in pixels, of the framebuffer,
2125 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02002126 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002127 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2128 * GLFW_PLATFORM_ERROR.
2129 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002130 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002131 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002132 * @sa @ref window_fbsize
Camilla Berglund34981632013-06-03 12:51:57 +02002133 * @sa glfwSetFramebufferSizeCallback
2134 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002135 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002136 *
Camilla Berglund34981632013-06-03 12:51:57 +02002137 * @ingroup window
2138 */
2139GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
2140
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002141/*! @brief Retrieves the size of the frame of the window.
2142 *
2143 * This function retrieves the size, in screen coordinates, of each edge of the
2144 * frame of the specified window. This size includes the title bar, if the
2145 * window has one. The size of the frame may vary depending on the
2146 * [window-related hints](@ref window_hints_wnd) used to create it.
2147 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002148 * Because this function retrieves the size of each window frame edge and not
2149 * the offset along a particular coordinate axis, the retrieved values will
2150 * always be zero or positive.
2151 *
2152 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2153 * non-`NULL` size arguments will be set to zero.
2154 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002155 * @param[in] window The window whose frame size to query.
2156 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002157 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002158 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02002159 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002160 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002161 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002162 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002163 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002164 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002165 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2166 * GLFW_PLATFORM_ERROR.
2167 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002168 * @thread_safety This function must only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002169 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002170 * @sa @ref window_size
2171 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002172 * @since Added in version 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002173 *
2174 * @ingroup window
2175 */
2176GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2177
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002178/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002179 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002180 * This function iconifies (minimizes) the specified window if it was
2181 * previously restored. If the window is already iconified, this function does
2182 * nothing.
2183 *
2184 * If the specified window is a full screen window, the original monitor
2185 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002186 *
2187 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002188 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002189 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2190 * GLFW_PLATFORM_ERROR.
2191 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002192 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002193 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002194 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002195 * @sa glfwRestoreWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002196 * @sa glfwMaximizeWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002197 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002198 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002199 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002200 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002201 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002202 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002203GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002204
2205/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002206 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002207 * This function restores the specified window if it was previously iconified
Camilla Berglunda10caa42015-10-13 12:50:59 +02002208 * (minimized) or maximized. If the window is already restored, this function
2209 * does nothing.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002210 *
2211 * If the specified window is a full screen window, the resolution chosen for
2212 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002213 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002214 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002215 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002216 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2217 * GLFW_PLATFORM_ERROR.
2218 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002219 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002220 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002221 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002222 * @sa glfwIconifyWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002223 * @sa glfwMaximizeWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01002224 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002225 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002226 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002227 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002228 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002229 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002230GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002231
Camilla Berglunda10caa42015-10-13 12:50:59 +02002232/*! @brief Maximizes the specified window.
2233 *
2234 * This function maximizes the specified window if it was previously not
2235 * maximized. If the window is already maximized, this function does nothing.
2236 *
2237 * If the specified window is a full screen window, this function does nothing.
2238 *
2239 * @param[in] window The window to maximize.
2240 *
2241 * @par Thread Safety
2242 * This function may only be called from the main thread.
2243 *
2244 * @sa @ref window_iconify
2245 * @sa glfwIconifyWindow
2246 * @sa glfwRestoreWindow
2247 *
2248 * @since Added in GLFW 3.2.
2249 *
2250 * @ingroup window
2251 */
2252GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
2253
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002254/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002255 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002256 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002257 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002258 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002259 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002260 * @param[in] window The window to make visible.
2261 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002262 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2263 * GLFW_PLATFORM_ERROR.
2264 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002265 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002266 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002267 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002268 * @sa glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002269 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002270 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002271 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002272 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002273 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002274GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002275
2276/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002277 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002278 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002279 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002280 * nothing.
2281 *
2282 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002283 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002284 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2285 * GLFW_PLATFORM_ERROR.
2286 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002287 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002288 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002289 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002290 * @sa glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002291 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002292 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002293 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002294 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002295 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002296GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002297
Camilla Berglundbaf57442016-02-21 15:42:49 +01002298/*! @brief Brings the specified window to front and sets input focus.
2299 *
2300 * This function brings the specified window to front and sets input focus.
2301 * The window should already be visible and not iconified.
2302 *
2303 * By default, both windowed and full screen mode windows are focused when
2304 * initially created. Set the [GLFW_FOCUSED](@ref window_hints_wnd) to disable
2305 * this behavior.
2306 *
2307 * __Do not use this function__ to steal focus from other applications unless
2308 * you are certain that is what the user wants. Focus stealing can be
2309 * extremely disruptive.
2310 *
2311 * @param[in] window The window to give input focus.
2312 *
2313 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2314 * GLFW_PLATFORM_ERROR.
2315 *
2316 * @thread_safety This function must only be called from the main thread.
2317 *
2318 * @sa @ref window_focus
2319 *
2320 * @since Added in version 3.2.
2321 *
2322 * @ingroup window
2323 */
2324GLFWAPI void glfwFocusWindow(GLFWwindow* window);
2325
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002326/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002327 *
2328 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002329 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002330 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002331 * @param[in] window The window to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002332 * @return The monitor, or `NULL` if the window is in windowed mode or an error
2333 * occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002334 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002335 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2336 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002337 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002338 *
2339 * @sa @ref window_monitor
2340 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002341 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002342 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002343 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002344 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002345GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002346
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002347/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002348 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002349 * This function returns the value of an attribute of the specified window or
2350 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002351 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002352 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002353 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2354 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002355 * @return The value of the attribute, or zero if an
2356 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002357 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002358 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2359 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2360 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002361 * @remark Framebuffer related hints are not window attributes. See @ref
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002362 * window_attribs_fb for more information.
2363 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002364 * @remark Zero is a valid value for many window and context related
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002365 * attributes so you cannot use a return value of zero as an indication of
2366 * errors. However, this function should not fail as long as it is passed
2367 * valid arguments and the library has been [initialized](@ref intro_init).
2368 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002369 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002370 *
2371 * @sa @ref window_attribs
2372 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002373 * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
Camilla Berglund4188c262015-01-18 01:55:25 +01002374 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002375 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002376 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002377 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002378GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002379
2380/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002381 *
2382 * This function sets the user-defined pointer of the specified window. The
2383 * current value is retained until the window is destroyed. The initial value
2384 * is `NULL`.
2385 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002386 * @param[in] window The window whose pointer to set.
2387 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002388 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002389 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2390 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002391 * @thread_safety This function may be called from any thread. Access is not
2392 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002393 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002394 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002395 * @sa glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002396 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002397 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002398 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002399 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002400 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002401GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002402
2403/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002404 *
2405 * This function returns the current value of the user-defined pointer of the
2406 * specified window. The initial value is `NULL`.
2407 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002408 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002409 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002410 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2411 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002412 * @thread_safety This function may be called from any thread. Access is not
2413 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002414 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002415 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002416 * @sa glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002417 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002418 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002419 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002420 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002421 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002422GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002423
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002424/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002425 *
2426 * This function sets the position callback of the specified window, which is
2427 * called when the window is moved. The callback is provided with the screen
2428 * position of the upper-left corner of the client area of the window.
2429 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002430 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002431 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002432 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002433 * @return The previously set callback, or `NULL` if no callback was set or the
2434 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002435 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002436 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2437 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002438 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002439 *
2440 * @sa @ref window_pos
2441 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002442 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002443 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002444 * @ingroup window
2445 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002446GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002447
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002448/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002449 *
2450 * This function sets the size callback of the specified window, which is
2451 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002452 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002453 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002454 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002455 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002456 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002457 * @return The previously set callback, or `NULL` if no callback was set or the
2458 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002459 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002460 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2461 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002462 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002463 *
2464 * @sa @ref window_size
2465 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002466 * @since Added in version 1.0.
2467 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002468 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002469 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002470 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002471GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002472
2473/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002474 *
2475 * This function sets the close callback of the specified window, which is
2476 * called when the user attempts to close the window, for example by clicking
2477 * the close widget in the title bar.
2478 *
2479 * The close flag is set before this callback is called, but you can modify it
2480 * at any time with @ref glfwSetWindowShouldClose.
2481 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002482 * The close callback is not triggered by @ref glfwDestroyWindow.
2483 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002484 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002485 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002486 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002487 * @return The previously set callback, or `NULL` if no callback was set or the
2488 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002489 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002490 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2491 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002492 * @remark @osx Selecting Quit from the application menu will trigger the close
2493 * callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002494 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002495 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002496 *
2497 * @sa @ref window_close
2498 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002499 * @since Added in version 2.5.
2500 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002501 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002502 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002503 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002504GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002505
2506/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002507 *
2508 * This function sets the refresh callback of the specified window, which is
2509 * called when the client area of the window needs to be redrawn, for example
2510 * if the window has been exposed after having been covered by another window.
2511 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002512 * On compositing window systems such as Aero, Compiz or Aqua, where the window
2513 * contents are saved off-screen, this callback may be called only very
2514 * infrequently or never at all.
2515 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002516 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002517 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002518 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002519 * @return The previously set callback, or `NULL` if no callback was set or the
2520 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002521 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002522 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2523 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002524 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002525 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002526 * @sa @ref window_refresh
2527 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002528 * @since Added in version 2.5.
2529 * @glfw3 Added window handle parameter and return value.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002530 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002531 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002532 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002533GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002534
2535/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002536 *
2537 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01002538 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002539 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002540 * After the focus callback is called for a window that lost input focus,
2541 * synthetic key and mouse button release events will be generated for all such
2542 * that had been pressed. For more information, see @ref glfwSetKeyCallback
2543 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02002544 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002545 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002546 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002547 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002548 * @return The previously set callback, or `NULL` if no callback was set or the
2549 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002550 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002551 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2552 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002553 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002554 *
2555 * @sa @ref window_focus
2556 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002557 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002558 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002559 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002560 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002561GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002562
2563/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002564 *
2565 * This function sets the iconification callback of the specified window, which
2566 * is called when the window is iconified or restored.
2567 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002568 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002569 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002570 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002571 * @return The previously set callback, or `NULL` if no callback was set or the
2572 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002573 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002574 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2575 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002576 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002577 *
2578 * @sa @ref window_iconify
2579 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002580 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002581 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002582 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002583 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002584GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02002585
Camilla Berglund34981632013-06-03 12:51:57 +02002586/*! @brief Sets the framebuffer resize callback for the specified window.
2587 *
2588 * This function sets the framebuffer resize callback of the specified window,
2589 * which is called when the framebuffer of the specified window is resized.
2590 *
2591 * @param[in] window The window whose callback to set.
2592 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2593 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002594 * @return The previously set callback, or `NULL` if no callback was set or the
2595 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02002596 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002597 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2598 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002599 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002600 *
2601 * @sa @ref window_fbsize
2602 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002603 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002604 *
Camilla Berglund34981632013-06-03 12:51:57 +02002605 * @ingroup window
2606 */
2607GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
2608
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002609/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002610 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002611 * This function processes only those events that are already in the event
2612 * queue and then returns immediately. Processing events will cause the window
2613 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002614 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002615 * On some platforms, a window move, resize or menu operation will cause event
2616 * processing to block. This is due to how event processing is designed on
2617 * those platforms. You can use the
2618 * [window refresh callback](@ref window_refresh) to redraw the contents of
2619 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002620 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002621 * On some platforms, certain events are sent directly to the application
2622 * without going through the event queue, causing callbacks to be called
2623 * outside of a call to one of the event processing functions.
Camilla Berglund401033c2013-03-12 19:17:07 +01002624 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002625 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002626 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002627 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2628 * GLFW_PLATFORM_ERROR.
2629 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002630 * @reentrancy This function must not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01002631 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002632 * @thread_safety This function must only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02002633 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002634 * @sa @ref events
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002635 * @sa glfwWaitEvents
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002636 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002637 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002638 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002639 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002640 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002641GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002642
Camilla Berglund4591ad22014-09-18 15:03:29 +02002643/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002644 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002645 * This function puts the calling thread to sleep until at least one event is
2646 * available in the event queue. Once one or more events are available,
2647 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
2648 * are processed and the function then returns immediately. Processing events
2649 * will cause the window and input callbacks associated with those events to be
2650 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02002651 *
2652 * Since not all events are associated with callbacks, this function may return
2653 * without a callback having been called even if you are monitoring all
2654 * callbacks.
2655 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002656 * On some platforms, a window move, resize or menu operation will cause event
2657 * processing to block. This is due to how event processing is designed on
2658 * those platforms. You can use the
2659 * [window refresh callback](@ref window_refresh) to redraw the contents of
2660 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002661 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002662 * On some platforms, certain callbacks may be called outside of a call to one
2663 * of the event processing functions.
2664 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002665 * If no windows exist, this function returns immediately. For synchronization
2666 * of threads in applications that do not create windows, use your threading
2667 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01002668 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002669 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002670 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002671 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2672 * GLFW_PLATFORM_ERROR.
2673 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002674 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01002675 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002676 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002677 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002678 * @sa @ref events
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002679 * @sa glfwPollEvents
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002680 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002681 * @since Added in version 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002682 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002683 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002684 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002685GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02002686
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002687/*! @brief Posts an empty event to the event queue.
2688 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002689 * This function posts an empty event from the current thread to the event
2690 * queue, causing @ref glfwWaitEvents to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002691 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002692 * If no windows exist, this function returns immediately. For synchronization
2693 * of threads in applications that do not create windows, use your threading
2694 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002695 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002696 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2697 * GLFW_PLATFORM_ERROR.
2698 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002699 * @thread_safety This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002700 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002701 * @sa @ref events
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002702 * @sa glfwWaitEvents
2703 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002704 * @since Added in version 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002705 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002706 * @ingroup window
2707 */
2708GLFWAPI void glfwPostEmptyEvent(void);
2709
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002710/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002711 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002712 * This function returns the value of an input option for the specified window.
2713 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2714 * `GLFW_STICKY_MOUSE_BUTTONS`.
2715 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002716 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02002717 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002718 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002719 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002720 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2721 * GLFW_INVALID_ENUM.
2722 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002723 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002724 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002725 * @sa glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002726 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002727 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002728 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002729 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002730 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002731GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002732
2733/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002734 *
2735 * This function sets an input mode option for the specified window. The mode
2736 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund71d2b572013-03-12 15:33:05 +01002737 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002738 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002739 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002740 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02002741 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
2742 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund4188c262015-01-18 01:55:25 +01002743 * area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01002744 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
2745 * and unlimited cursor movement. This is useful for implementing for
2746 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002747 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02002748 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
2749 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02002750 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
2751 * the next time it is called even if the key had been released before the
2752 * call. This is useful when you are only interested in whether keys have been
2753 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002754 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002755 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02002756 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
2757 * If sticky mouse buttons are enabled, a mouse button press will ensure that
2758 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
2759 * if the mouse button had been released before the call. This is useful when
2760 * you are only interested in whether mouse buttons have been pressed but not
2761 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002762 *
2763 * @param[in] window The window whose input mode to set.
2764 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2765 * `GLFW_STICKY_MOUSE_BUTTONS`.
2766 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002767 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002768 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2769 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2770 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002771 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002772 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002773 * @sa glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01002774 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002775 * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002776 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002777 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002778 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002779GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002780
Camilla Berglund9c315412015-07-02 14:24:50 +02002781/*! @brief Returns the localized name of the specified printable key.
2782 *
2783 * This function returns the localized name of the specified printable key.
Camilla Berglund70ffae72016-02-22 11:54:56 +01002784 * This is intended for displaying key bindings to the user.
Camilla Berglund9c315412015-07-02 14:24:50 +02002785 *
Camilla Berglund70ffae72016-02-22 11:54:56 +01002786 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used instead, otherwise
2787 * the scancode is ignored. If a non-printable key or (if the key is
2788 * `GLFW_KEY_UNKNOWN`) a scancode that maps to a non-printable key is
2789 * specified, this function returns `NULL`.
2790 *
2791 * This behavior allows you to pass in the arguments passed to the
2792 * [key callback](@ref input_key) without modification.
2793 *
2794 * The printable keys are:
2795 * - `GLFW_KEY_APOSTROPHE`
2796 * - `GLFW_KEY_COMMA`
2797 * - `GLFW_KEY_MINUS`
2798 * - `GLFW_KEY_PERIOD`
2799 * - `GLFW_KEY_SLASH`
2800 * - `GLFW_KEY_SEMICOLON`
2801 * - `GLFW_KEY_EQUAL`
2802 * - `GLFW_KEY_LEFT_BRACKET`
2803 * - `GLFW_KEY_RIGHT_BRACKET`
2804 * - `GLFW_KEY_BACKSLASH`
2805 * - `GLFW_KEY_WORLD_1`
2806 * - `GLFW_KEY_WORLD_2`
2807 * - `GLFW_KEY_0` to `GLFW_KEY_9`
2808 * - `GLFW_KEY_A` to `GLFW_KEY_Z`
2809 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
2810 * - `GLFW_KEY_KP_DECIMAL`
2811 * - `GLFW_KEY_KP_DIVIDE`
2812 * - `GLFW_KEY_KP_MULTIPLY`
2813 * - `GLFW_KEY_KP_SUBTRACT`
2814 * - `GLFW_KEY_KP_ADD`
2815 * - `GLFW_KEY_KP_EQUAL`
Camilla Berglund9c315412015-07-02 14:24:50 +02002816 *
2817 * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
2818 * @param[in] scancode The scancode of the key to query.
Camilla Berglund70ffae72016-02-22 11:54:56 +01002819 * @return The localized name of the key, or `NULL`.
Camilla Berglund9c315412015-07-02 14:24:50 +02002820 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002821 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2822 * GLFW_PLATFORM_ERROR.
2823 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002824 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
2825 * should not free it yourself. It is valid until the next call to @ref
2826 * glfwGetKeyName, or until the library is terminated.
Camilla Berglund9c315412015-07-02 14:24:50 +02002827 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002828 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9c315412015-07-02 14:24:50 +02002829 *
2830 * @sa @ref input_key_name
2831 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002832 * @since Added in version 3.2.
Camilla Berglund9c315412015-07-02 14:24:50 +02002833 *
2834 * @ingroup input
2835 */
2836GLFWAPI const char* glfwGetKeyName(int key, int scancode);
2837
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002838/*! @brief Returns the last reported state of a keyboard key for the specified
2839 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002840 *
2841 * This function returns the last state reported for the specified key to the
2842 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02002843 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002844 * the key callback.
2845 *
2846 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02002847 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
2848 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002849 *
2850 * The key functions deal with physical keys, with [key tokens](@ref keys)
2851 * named after their use on the standard US keyboard layout. If you want to
2852 * input text, use the Unicode character callback instead.
2853 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002854 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
2855 * used with this function.
2856 *
Camilla Berglund9c315412015-07-02 14:24:50 +02002857 * __Do not use this function__ to implement [text input](@ref input_char).
2858 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002859 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002860 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
2861 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002862 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002863 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002864 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2865 * GLFW_INVALID_ENUM.
2866 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002867 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002868 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002869 * @sa @ref input_key
2870 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002871 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002872 * @glfw3 Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02002873 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002874 * @ingroup input
2875 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002876GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002877
2878/*! @brief Returns the last reported state of a mouse button for the specified
2879 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002880 *
2881 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02002882 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002883 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002884 *
2885 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02002886 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
2887 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002888 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002889 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002890 * @param[in] button The desired [mouse button](@ref buttons).
2891 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002892 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002893 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2894 * GLFW_INVALID_ENUM.
2895 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002896 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002897 *
2898 * @sa @ref input_mouse_button
2899 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002900 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002901 * @glfw3 Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01002902 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002903 * @ingroup input
2904 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002905GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002906
Camilla Berglundd4591452014-02-11 18:24:01 +01002907/*! @brief Retrieves the position of the cursor relative to the client area of
2908 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002909 *
Camilla Berglundd4591452014-02-11 18:24:01 +01002910 * This function returns the position of the cursor, in screen coordinates,
2911 * relative to the upper-left corner of the client area of the specified
2912 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002913 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02002914 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
2915 * position is unbounded and limited only by the minimum and maximum values of
2916 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02002917 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02002918 * The coordinate can be converted to their integer equivalents with the
2919 * `floor` function. Casting directly to an integer type works for positive
2920 * coordinates, but fails for negative ones.
2921 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002922 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2923 * non-`NULL` position arguments will be set to zero.
2924 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002925 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002926 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
2927 * left edge of the client area, or `NULL`.
2928 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
2929 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002930 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002931 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2932 * GLFW_PLATFORM_ERROR.
2933 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002934 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002935 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002936 * @sa @ref cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002937 * @sa glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002938 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002939 * @since Added in version 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002940 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002941 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002942 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02002943GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002944
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002945/*! @brief Sets the position of the cursor, relative to the client area of the
2946 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002947 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02002948 * This function sets the position, in screen coordinates, of the cursor
2949 * relative to the upper-left corner of the client area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01002950 * window. The window must have input focus. If the window does not have
2951 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002952 *
Camilla Berglund20858762015-01-01 18:41:22 +01002953 * __Do not use this function__ to implement things like camera controls. GLFW
2954 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
2955 * cursor, transparently re-centers it and provides unconstrained cursor
2956 * motion. See @ref glfwSetInputMode for more information.
2957 *
2958 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
2959 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02002960 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02002961 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002962 * @param[in] window The desired window.
2963 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02002964 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002965 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02002966 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002967 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002968 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2969 * GLFW_PLATFORM_ERROR.
2970 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002971 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
2972 * the window focus event to arrive. This means you may not be able to set the
2973 * cursor position directly after window creation.
Camilla Berglund2eb5ed32014-08-31 13:10:06 +02002974 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002975 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002976 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002977 * @sa @ref cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002978 * @sa glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002979 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002980 * @since Added in version 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002981 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002982 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002983 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02002984GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002985
Camilla Berglund2a1375e2014-09-02 16:52:16 +02002986/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03002987 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002988 * Creates a new custom cursor image that can be set for a window with @ref
2989 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
2990 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002991 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02002992 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
2993 * bits per channel. They are arranged canonically as packed sequential rows,
2994 * starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01002995 *
2996 * The cursor hotspot is specified in pixels, relative to the upper-left corner
2997 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
2998 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002999 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003000 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01003001 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
3002 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
Camilla Berglund4188c262015-01-18 01:55:25 +01003003 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02003004 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03003005 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003006 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3007 * GLFW_PLATFORM_ERROR.
3008 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003009 * @pointer_lifetime The specified image data is copied before this function
3010 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003011 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003012 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003013 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003014 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003015 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003016 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003017 * @sa glfwDestroyCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003018 * @sa glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003019 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003020 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003021 *
3022 * @ingroup input
3023 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003024GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03003025
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003026/*! @brief Creates a cursor with a standard shape.
3027 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003028 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
3029 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003030 *
3031 * @param[in] shape One of the [standard shapes](@ref shapes).
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003032 * @return A new cursor ready to use or `NULL` if an
3033 * [error](@ref error_handling) occurred.
3034 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003035 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3036 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3037 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003038 * @reentrancy This function must not be called from a callback.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003039 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003040 * @thread_safety This function must only be called from the main thread.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003041 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003042 * @sa @ref cursor_object
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003043 * @sa glfwCreateCursor
3044 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003045 * @since Added in version 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003046 *
3047 * @ingroup input
3048 */
3049GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
3050
urraka40c04a72013-12-04 10:19:22 -03003051/*! @brief Destroys a cursor.
3052 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003053 * This function destroys a cursor previously created with @ref
3054 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
3055 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03003056 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003057 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03003058 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003059 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3060 * GLFW_PLATFORM_ERROR.
3061 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003062 * @reentrancy This function must not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003063 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003064 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003065 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003066 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003067 * @sa glfwCreateCursor
3068 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003069 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003070 *
3071 * @ingroup input
3072 */
3073GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
3074
Camilla Berglund4188c262015-01-18 01:55:25 +01003075/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03003076 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003077 * This function sets the cursor image to be used when the cursor is over the
3078 * client area of the specified window. The set cursor will only be visible
3079 * when the [cursor mode](@ref cursor_mode) of the window is
3080 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003081 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003082 * On some platforms, the set cursor may not be visible unless the window also
3083 * has input focus.
3084 *
3085 * @param[in] window The window to set the cursor for.
3086 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
3087 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03003088 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003089 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3090 * GLFW_PLATFORM_ERROR.
3091 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003092 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003093 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003094 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003095 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003096 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003097 *
urraka40c04a72013-12-04 10:19:22 -03003098 * @ingroup input
3099 */
3100GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
3101
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003102/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003103 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003104 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003105 * when a key is pressed, repeated or released.
3106 *
Camilla Berglund948cc042013-04-16 02:02:22 +02003107 * The key functions deal with physical keys, with layout independent
3108 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003109 * layout. If you want to input text, use the
3110 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003111 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003112 * When a window loses input focus, it will generate synthetic key release
3113 * events for all pressed keys. You can tell these events from user-generated
3114 * events by the fact that the synthetic ones are generated after the focus
3115 * loss event has been processed, i.e. after the
3116 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003117 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02003118 * The scancode of a key is specific to that platform or sometimes even to that
3119 * machine. Scancodes are intended to allow users to bind keys that don't have
3120 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02003121 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003122 *
3123 * Sometimes GLFW needs to generate synthetic key events, in which case the
3124 * scancode may be zero.
3125 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003126 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003127 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003128 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003129 * @return The previously set callback, or `NULL` if no callback was set or the
3130 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003131 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003132 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3133 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003134 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003135 *
3136 * @sa @ref input_key
3137 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003138 * @since Added in version 1.0.
3139 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003140 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003141 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003142 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003143GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003144
3145/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003146 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003147 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003148 * called when a Unicode character is input.
3149 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003150 * The character callback is intended for Unicode text input. As it deals with
3151 * characters, it is keyboard layout dependent, whereas the
3152 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
3153 * to physical keys, as a key may produce zero, one or more characters. If you
3154 * want to know whether a specific physical key was pressed or released, see
3155 * the key callback instead.
3156 *
3157 * The character callback behaves as system text input normally does and will
3158 * not be called if modifier keys are held down that would prevent normal text
3159 * input on that platform, for example a Super (Command) key on OS X or Alt key
3160 * on Windows. There is a
3161 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
3162 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003163 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003164 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003165 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003166 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003167 * @return The previously set callback, or `NULL` if no callback was set or the
3168 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003169 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003170 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3171 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003172 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003173 *
3174 * @sa @ref input_char
3175 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003176 * @since Added in version 2.4.
3177 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003178 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003179 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003180 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003181GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003182
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003183/*! @brief Sets the Unicode character with modifiers callback.
3184 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003185 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003186 * window, which is called when a Unicode character is input regardless of what
3187 * modifier keys are used.
3188 *
3189 * The character with modifiers callback is intended for implementing custom
3190 * Unicode character input. For regular Unicode text input, see the
3191 * [character callback](@ref glfwSetCharCallback). Like the character
3192 * callback, the character with modifiers callback deals with characters and is
3193 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
3194 * a key may produce zero, one or more characters. If you want to know whether
3195 * a specific physical key was pressed or released, see the
3196 * [key callback](@ref glfwSetKeyCallback) instead.
3197 *
3198 * @param[in] window The window whose callback to set.
3199 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3200 * callback.
3201 * @return The previously set callback, or `NULL` if no callback was set or an
3202 * error occurred.
3203 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003204 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3205 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003206 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003207 *
3208 * @sa @ref input_char
3209 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003210 * @since Added in version 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003211 *
3212 * @ingroup input
3213 */
3214GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
3215
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003216/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003217 *
3218 * This function sets the mouse button callback of the specified window, which
3219 * is called when a mouse button is pressed or released.
3220 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003221 * When a window loses input focus, it will generate synthetic mouse button
3222 * release events for all pressed mouse buttons. You can tell these events
3223 * from user-generated events by the fact that the synthetic ones are generated
3224 * after the focus loss event has been processed, i.e. after the
3225 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003226 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003227 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003228 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003229 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003230 * @return The previously set callback, or `NULL` if no callback was set or the
3231 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003232 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003233 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3234 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003235 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003236 *
3237 * @sa @ref input_mouse_button
3238 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003239 * @since Added in version 1.0.
3240 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003241 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003242 * @ingroup input
3243 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003244GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003245
3246/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003247 *
3248 * This function sets the cursor position callback of the specified window,
3249 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003250 * position, in screen coordinates, relative to the upper-left corner of the
3251 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003252 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003253 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003254 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003255 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003256 * @return The previously set callback, or `NULL` if no callback was set or the
3257 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003258 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003259 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3260 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003261 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003262 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003263 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02003264 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003265 * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003266 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003267 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003268 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003269GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003270
3271/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003272 *
3273 * This function sets the cursor boundary crossing callback of the specified
3274 * window, which is called when the cursor enters or leaves the client area of
3275 * the window.
3276 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003277 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003278 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003279 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003280 * @return The previously set callback, or `NULL` if no callback was set or the
3281 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003282 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003283 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3284 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003285 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003286 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003287 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02003288 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003289 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003290 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003291 * @ingroup input
3292 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003293GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003294
3295/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003296 *
3297 * This function sets the scroll callback of the specified window, which is
3298 * called when a scrolling device is used, such as a mouse wheel or scrolling
3299 * area of a touchpad.
3300 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003301 * The scroll callback receives all scrolling input, like that from a mouse
3302 * wheel or a touchpad scrolling area.
3303 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003304 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003305 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003306 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003307 * @return The previously set callback, or `NULL` if no callback was set or the
3308 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003309 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003310 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3311 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003312 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003313 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003314 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02003315 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003316 * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003317 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003318 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003319 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003320GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02003321
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003322/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02003323 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003324 * This function sets the file drop callback of the specified window, which is
3325 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02003326 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003327 * Because the path array and its strings may have been generated specifically
3328 * for that event, they are not guaranteed to be valid after the callback has
3329 * returned. If you wish to use them after the callback returns, you need to
3330 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02003331 *
3332 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003333 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
3334 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003335 * @return The previously set callback, or `NULL` if no callback was set or the
3336 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02003337 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003338 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3339 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003340 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003341 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003342 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02003343 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003344 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003345 *
arturo89d07232013-07-10 11:42:14 +02003346 * @ingroup input
3347 */
3348GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
3349
Camilla Berglundfdd45182013-05-27 15:13:09 +02003350/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003351 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02003352 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003353 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003354 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003355 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003356 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003357 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3358 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3359 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003360 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003361 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003362 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02003363 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003364 * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003365 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003366 * @ingroup input
3367 */
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003368GLFWAPI int glfwJoystickPresent(int joy);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003369
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003370/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003371 *
3372 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003373 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003374 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003375 * Querying a joystick slot with no device present is not an error, but will
3376 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3377 * check device presence.
3378 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003379 * @param[in] joy The [joystick](@ref joysticks) to query.
3380 * @param[out] count Where to store the number of axis values in the returned
3381 * array. This is set to zero if an error occurred.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003382 * @return An array of axis values, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003383 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003384 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3385 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3386 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003387 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3388 * should not free it yourself. It is valid until the specified joystick is
3389 * disconnected, this function is called again for that joystick or the library
3390 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003391 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003392 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003393 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003394 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02003395 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003396 * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003397 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003398 * @ingroup input
3399 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003400GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003401
Camilla Berglunde93bade2013-06-16 02:33:33 +02003402/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003403 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02003404 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003405 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003406 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003407 * Querying a joystick slot with no device present is not an error, but will
3408 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3409 * check device presence.
3410 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003411 * @param[in] joy The [joystick](@ref joysticks) to query.
3412 * @param[out] count Where to store the number of button states in the returned
3413 * array. This is set to zero if an error occurred.
Camilla Berglunde93bade2013-06-16 02:33:33 +02003414 * @return An array of button states, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003415 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003416 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3417 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3418 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003419 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3420 * should not free it yourself. It is valid until the specified joystick is
3421 * disconnected, this function is called again for that joystick or the library
3422 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003423 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003424 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003425 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003426 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003427 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003428 * @since Added in version 2.2.
Camilla Berglund951a9582016-01-31 21:32:14 +01003429 * @glfw3 Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003430 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003431 * @ingroup input
3432 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003433GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02003434
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003435/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003436 *
3437 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003438 * The returned string is allocated and freed by GLFW. You should not free it
3439 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003440 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003441 * Querying a joystick slot with no device present is not an error, but will
3442 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3443 * check device presence.
3444 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003445 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003446 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003447 * is not present.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01003448 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003449 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3450 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3451 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003452 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3453 * should not free it yourself. It is valid until the specified joystick is
3454 * disconnected, this function is called again for that joystick or the library
3455 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003456 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003457 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003458 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003459 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02003460 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003461 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003462 *
3463 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003464 */
Camilla Berglund93a1d1c2012-09-07 01:01:34 +02003465GLFWAPI const char* glfwGetJoystickName(int joy);
Camilla Berglund3249f812010-09-07 17:34:51 +02003466
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003467/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003468 *
3469 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02003470 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003471 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003472 * @param[in] window The window that will own the clipboard contents.
3473 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003474 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003475 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3476 * GLFW_PLATFORM_ERROR.
3477 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003478 * @pointer_lifetime The specified string is copied before this function
3479 * returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003480 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003481 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003482 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003483 * @sa @ref clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003484 * @sa glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003485 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003486 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003487 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003488 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003489 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003490GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003491
Camilla Berglund4591ad22014-09-18 15:03:29 +02003492/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003493 *
3494 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02003495 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02003496 * if its contents cannot be converted, `NULL` is returned and a @ref
3497 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003498 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003499 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003500 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02003501 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003502 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003503 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3504 * GLFW_PLATFORM_ERROR.
3505 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003506 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3507 * should not free it yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02003508 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
3509 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003510 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003511 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003512 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003513 * @sa @ref clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003514 * @sa glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003515 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003516 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003517 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003518 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003519 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003520GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01003521
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003522/*! @brief Returns the value of the GLFW timer.
3523 *
3524 * This function returns the value of the GLFW timer. Unless the timer has
3525 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
3526 * was initialized.
3527 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003528 * The resolution of the timer is system dependent, but is usually on the order
3529 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
3530 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003531 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003532 * @return The current value, in seconds, or zero if an
3533 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003534 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003535 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3536 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003537 * @thread_safety This function may be called from any thread. Access is not
3538 * synchronized.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003539 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003540 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02003541 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003542 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003543 *
3544 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003545 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003546GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02003547
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003548/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003549 *
3550 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003551 * up from that value. The value must be a positive finite number less than
3552 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003553 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003554 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003555 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003556 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3557 * GLFW_INVALID_VALUE.
3558 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003559 * @remark The upper limit of the timer is calculated as
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003560 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
3561 * storing nanoseconds in 64 bits. The limit may be increased in the future.
3562 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003563 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003564 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003565 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01003566 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003567 * @since Added in version 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003568 *
3569 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003570 */
3571GLFWAPI void glfwSetTime(double time);
3572
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003573/*! @brief Returns the current value of the raw timer.
3574 *
3575 * This function returns the current value of the raw timer. To get its
3576 * frequency, call @ref glfwGetTimerFrequency.
3577 *
3578 * @return The value of the timer, or zero if an
3579 * [error](@ref error_handling) occurred.
3580 *
3581 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3582 * GLFW_INVALID_VALUE.
3583 *
3584 * @thread_safety This function may be called from any thread.
3585 *
3586 * @sa @ref time
3587 * @sa glfwGetTimerFrequency
3588 *
3589 * @since Added in version 3.2.
3590 *
3591 * @ingroup input
3592 */
3593GLFWAPI GLFWuint64 glfwGetTimerValue(void);
3594
3595/*! @brief Returns the frequency, in Hz, of the raw timer.
3596 *
3597 * @return The frequency of the timer, in Hz, or zero if an
3598 * [error](@ref error_handling) occurred.
3599 *
3600 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3601 * GLFW_INVALID_VALUE.
3602 *
3603 * @thread_safety This function may be called from any thread.
3604 *
3605 * @sa @ref time
3606 * @sa glfwGetTimerValue
3607 *
3608 * @since Added in version 3.2.
3609 *
3610 * @ingroup input
3611 */
3612GLFWAPI GLFWuint64 glfwGetTimerFrequency(void);
3613
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003614/*! @brief Makes the context of the specified window current for the calling
3615 * thread.
3616 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003617 * This function makes the OpenGL or OpenGL ES context of the specified window
3618 * current on the calling thread. A context can only be made current on
3619 * a single thread at a time and each thread can have only a single current
3620 * context at a time.
3621 *
3622 * By default, making a context non-current implicitly forces a pipeline flush.
3623 * On machines that support `GL_KHR_context_flush_control`, you can control
3624 * whether a context performs this flush by setting the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003625 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003626 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01003627 * The specified window must have an OpenGL or OpenGL ES context. Specifying
3628 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
3629 * error.
3630 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003631 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003632 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003633 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003634 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3635 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3636 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003637 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003638 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003639 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003640 * @sa glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01003641 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003642 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003643 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003644 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003645 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003646GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003647
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003648/*! @brief Returns the window whose context is current on the calling thread.
3649 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003650 * This function returns the window whose OpenGL or OpenGL ES context is
3651 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003652 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003653 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003654 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003655 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003656 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3657 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003658 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003659 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003660 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003661 * @sa glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01003662 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003663 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003664 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003665 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003666 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003667GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003668
3669/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003670 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003671 * This function swaps the front and back buffers of the specified window when
3672 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
3673 * zero, the GPU driver waits the specified number of screen updates before
3674 * swapping the buffers.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003675 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01003676 * The specified window must have an OpenGL or OpenGL ES context. Specifying
3677 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
3678 * error.
3679 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003680 * This function does not apply to Vulkan. If you are rendering with Vulkan,
3681 * see `vkQueuePresentKHR` instead.
3682 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003683 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003684 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003685 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3686 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3687 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003688 * @remark __EGL:__ The context of the specified window must be current on the
Camilla Berglund276b1bc2016-01-31 19:17:18 +01003689 * calling thread.
3690 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003691 * @thread_safety This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01003692 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003693 * @sa @ref buffer_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003694 * @sa glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01003695 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003696 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003697 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003698 *
3699 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003700 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003701GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003702
3703/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003704 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003705 * This function sets the swap interval for the current OpenGL or OpenGL ES
3706 * context, i.e. the number of screen updates to wait from the time @ref
3707 * glfwSwapBuffers was called before swapping the buffers and returning. This
3708 * is sometimes called _vertical synchronization_, _vertical retrace
3709 * synchronization_ or just _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003710 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003711 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003712 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
3713 * which allow the driver to swap even if a frame arrives a little bit late.
3714 * You can check for the presence of these extensions using @ref
3715 * glfwExtensionSupported. For more information about swap tearing, see the
3716 * extension specifications.
3717 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003718 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003719 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003720 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003721 * This function does not apply to Vulkan. If you are rendering with Vulkan,
3722 * see the present mode of your swapchain instead.
3723 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003724 * @param[in] interval The minimum number of screen updates to wait for
3725 * until the buffers are swapped by @ref glfwSwapBuffers.
3726 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003727 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3728 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3729 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003730 * @remark This function is not called during context creation, leaving the
Camilla Berglund11c22d62015-02-19 15:33:51 +01003731 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02003732 * because some swap interval extensions used by GLFW do not allow the swap
3733 * interval to be reset to zero once it has been set to a non-zero value.
3734 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003735 * @remark Some GPU drivers do not honor the requested swap interval, either
Camilla Berglund11c22d62015-02-19 15:33:51 +01003736 * because of a user setting that overrides the application's request or due to
3737 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003738 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003739 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003740 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003741 * @sa @ref buffer_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003742 * @sa glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01003743 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003744 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003745 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003746 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003747 */
3748GLFWAPI void glfwSwapInterval(int interval);
3749
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003750/*! @brief Returns whether the specified extension is available.
3751 *
Camilla Berglund608109c2013-04-11 20:18:46 +02003752 * This function returns whether the specified
Camilla Berglund001c50c2016-02-19 09:13:56 +01003753 * [API extension](@ref context_glext) is supported by the current OpenGL or
3754 * OpenGL ES context. It searches both for client API extension and context
3755 * creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003756 *
3757 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003758 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003759 *
3760 * As this functions retrieves and searches one or more extension strings each
3761 * call, it is recommended that you cache its results if it is going to be used
3762 * frequently. The extension strings will not change during the lifetime of
3763 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003764 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003765 * This function does not apply to Vulkan. If you are using Vulkan, see @ref
3766 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
3767 * and `vkEnumerateDeviceExtensionProperties` instead.
3768 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003769 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003770 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
3771 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003772 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003773 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3774 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
3775 * GLFW_PLATFORM_ERROR.
3776 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003777 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003778 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003779 * @sa @ref context_glext
3780 * @sa glfwGetProcAddress
3781 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003782 * @since Added in version 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003783 *
3784 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003785 */
3786GLFWAPI int glfwExtensionSupported(const char* extension);
3787
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003788/*! @brief Returns the address of the specified function for the current
3789 * context.
3790 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003791 * This function returns the address of the specified OpenGL or OpenGL ES
Camilla Berglund11c22d62015-02-19 15:33:51 +01003792 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02003793 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003794 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003795 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003796 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003797 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003798 * This function does not apply to Vulkan. If you are rendering with Vulkan,
3799 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
3800 * `vkGetDeviceProcAddr` instead.
3801 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003802 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglunda36e3a22015-11-05 17:14:26 +01003803 * @return The address of the function, or `NULL` if an
3804 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003805 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003806 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3807 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3808 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003809 * @remark The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02003810 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003811 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003812 * @remark This function may return a non-`NULL` address despite the
Camilla Berglund11c22d62015-02-19 15:33:51 +01003813 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02003814 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01003815 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003816 * @pointer_lifetime The returned function pointer is valid until the context
3817 * is destroyed or the library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003818 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003819 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003820 *
3821 * @sa @ref context_glext
3822 * @sa glfwExtensionSupported
3823 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003824 * @since Added in version 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003825 *
3826 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003827 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02003828GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02003829
Camilla Berglund9b75bff2015-08-10 20:19:04 +02003830/*! @brief Returns whether the Vulkan loader has been found.
3831 *
3832 * This function returns whether the Vulkan loader has been found. This check
3833 * is performed by @ref glfwInit.
3834 *
3835 * The availability of a Vulkan loader does not by itself guarantee that window
3836 * surface creation or even device creation is possible. Call @ref
3837 * glfwGetRequiredInstanceExtensions to check whether the extensions necessary
3838 * for Vulkan surface creation are available and @ref
3839 * glfwGetPhysicalDevicePresentationSupport to check whether a queue family of
3840 * a physical device supports image presentation.
3841 *
3842 * @return `GLFW_TRUE` if Vulkan is available, or `GLFW_FALSE` otherwise.
3843 *
3844 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3845 *
3846 * @thread_safety This function may be called from any thread.
3847 *
3848 * @sa @ref vulkan_support
3849 *
3850 * @since Added in version 3.2.
3851 *
3852 * @ingroup vulkan
3853 */
3854GLFWAPI int glfwVulkanSupported(void);
3855
3856/*! @brief Returns the Vulkan instance extensions required by GLFW.
3857 *
3858 * This function returns an array of names of Vulkan instance extensions required
3859 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
3860 * list will always contains `VK_KHR_surface`, so if you don't require any
3861 * additional extensions you can pass this list directly to the
3862 * `VkInstanceCreateInfo` struct.
3863 *
3864 * If Vulkan is not available on the machine, this function returns `NULL` and
3865 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
3866 * to check whether Vulkan is available.
3867 *
3868 * If Vulkan is available but no set of extensions allowing window surface
3869 * creation was found, this function returns `NULL`. You may still use Vulkan
3870 * for off-screen rendering and compute work.
3871 *
3872 * @param[out] count Where to store the number of extensions in the returned
3873 * array. This is set to zero if an error occurred.
3874 * @return An array of ASCII encoded extension names, or `NULL` if an
3875 * [error](@ref error_handling) occurred.
3876 *
3877 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3878 * GLFW_API_UNAVAILABLE.
3879 *
3880 * @remarks Additional extensions may be required by future versions of GLFW.
3881 * You should check if any extensions you wish to enable are already in the
3882 * returned array, as it is an error to specify an extension more than once in
3883 * the `VkInstanceCreateInfo` struct.
3884 *
3885 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3886 * should not free it yourself. It is guaranteed to be valid only until the
3887 * library is terminated.
3888 *
3889 * @thread_safety This function may be called from any thread.
3890 *
3891 * @sa @ref vulkan_ext
3892 * @sa glfwCreateWindowSurface
3893 *
3894 * @since Added in version 3.2.
3895 *
3896 * @ingroup vulkan
3897 */
Camilla Berglund7669ade2016-02-22 10:44:37 +01003898GLFWAPI const char** glfwGetRequiredInstanceExtensions(unsigned int* count);
Camilla Berglund9b75bff2015-08-10 20:19:04 +02003899
3900#if defined(VK_VERSION_1_0)
3901
3902/*! @brief Returns the address of the specified Vulkan instance function.
3903 *
3904 * This function returns the address of the specified Vulkan core or extension
3905 * function for the specified instance. If instance is set to `NULL` it can
3906 * return any function exported from the Vulkan loader, including at least the
3907 * following functions:
3908 *
3909 * - `vkEnumerateInstanceExtensionProperties`
3910 * - `vkEnumerateInstanceLayerProperties`
3911 * - `vkCreateInstance`
3912 * - `vkGetInstanceProcAddr`
3913 *
3914 * If Vulkan is not available on the machine, this function returns `NULL` and
3915 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
3916 * to check whether Vulkan is available.
3917 *
3918 * This function is equivalent to calling `vkGetInstanceProcAddr` with
3919 * a platform-specific query of the Vulkan loader as a fallback.
3920 *
3921 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
3922 * functions related to instance creation.
3923 * @param[in] procname The ASCII encoded name of the function.
3924 * @return The address of the function, or `NULL` if an
3925 * [error](@ref error_handling) occurred.
3926 *
3927 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3928 * GLFW_API_UNAVAILABLE.
3929 *
3930 * @pointer_lifetime The returned function pointer is valid until the library
3931 * is terminated.
3932 *
3933 * @thread_safety This function may be called from any thread.
3934 *
3935 * @sa @ref vulkan_proc
3936 *
3937 * @since Added in version 3.2.
3938 *
3939 * @ingroup vulkan
3940 */
3941GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
3942
3943/*! @brief Returns whether the specified queue family can present images.
3944 *
3945 * This function returns whether the specified queue family of the specified
3946 * physical device supports presentation to the platform GLFW was built for.
3947 *
3948 * If Vulkan or the required window surface creation instance extensions are
3949 * not available on the machine, or if the specified instance was not created
3950 * with the required extensions, this function returns `GLFW_FALSE` and
3951 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
3952 * to check whether Vulkan is available and @ref
3953 * glfwGetRequiredInstanceExtensions to check what instance extensions are
3954 * required.
3955 *
3956 * @param[in] instance The instance that the physical device belongs to.
3957 * @param[in] device The physical device that the queue family belongs to.
3958 * @param[in] queuefamily The index of the queue family to query.
3959 * @return `GLFW_TRUE` if the queue family supports presentation, or
3960 * `GLFW_FALSE` otherwise.
3961 *
3962 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3963 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
3964 *
3965 * @thread_safety This function may be called from any thread. For
3966 * synchronization details of Vulkan objects, see the Vulkan specification.
3967 *
3968 * @sa @ref vulkan_present
3969 *
3970 * @since Added in version 3.2.
3971 *
3972 * @ingroup vulkan
3973 */
3974GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
3975
3976/*! @brief Creates a Vulkan surface for the specified window.
3977 *
3978 * This function creates a Vulkan surface for the specified window.
3979 *
3980 * If the Vulkan loader was not found at initialization, this function returns
3981 * `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref GLFW_API_UNAVAILABLE
3982 * error. Call @ref glfwVulkanSupported to check whether the Vulkan loader was
3983 * found.
3984 *
3985 * If the required window surface creation instance extensions are not
3986 * available or if the specified instance was not created with these extensions
3987 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
3988 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
3989 * glfwGetRequiredInstanceExtensions to check what instance extensions are
3990 * required.
3991 *
3992 * The window surface must be destroyed before the specified Vulkan instance.
3993 * It is the responsibility of the caller to destroy the window surface. GLFW
3994 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
3995 * surface.
3996 *
3997 * @param[in] instance The Vulkan instance to create the surface in.
3998 * @param[in] window The window to create the surface for.
3999 * @param[in] allocator The allocator to use, or `NULL` to use the default
4000 * allocator.
4001 * @param[out] surface Where to store the handle of the surface. This is set
4002 * to `VK_NULL_HANDLE` if an error occurred.
4003 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
4004 * [error](@ref error_handling) occurred.
4005 *
4006 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4007 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4008 *
4009 * @remarks If an error occurs before the creation call is made, GLFW returns
4010 * the Vulkan error code most appropriate for the error. Appropriate use of
4011 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
4012 * elminiate almost all occurences of these errors.
4013 *
4014 * @thread_safety This function may be called from any thread. For
4015 * synchronization details of Vulkan objects, see the Vulkan specification.
4016 *
4017 * @sa @ref vulkan_surface
4018 * @sa glfwGetRequiredInstanceExtensions
4019 *
4020 * @since Added in version 3.2.
4021 *
4022 * @ingroup vulkan
4023 */
4024GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
4025
4026#endif /*VK_VERSION_1_0*/
4027
Camilla Berglund3249f812010-09-07 17:34:51 +02004028
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004029/*************************************************************************
4030 * Global definition cleanup
4031 *************************************************************************/
4032
4033/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
4034
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004035#ifdef GLFW_WINGDIAPI_DEFINED
4036 #undef WINGDIAPI
4037 #undef GLFW_WINGDIAPI_DEFINED
4038#endif
4039
4040#ifdef GLFW_CALLBACK_DEFINED
4041 #undef CALLBACK
4042 #undef GLFW_CALLBACK_DEFINED
4043#endif
4044
4045/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
4046
4047
Camilla Berglund3249f812010-09-07 17:34:51 +02004048#ifdef __cplusplus
4049}
4050#endif
4051
Camilla Berglundf8df91d2013-01-15 01:59:56 +01004052#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02004053