blob: be62e991ffc1002e9d9b691e4e76d9ba9f6cee64 [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund53fafad2016-08-18 23:42:15 +02002 * GLFW 3.3 - 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 Berglund757eea22016-06-01 16:17:06 +02006 * Copyright (c) 2006-2016 Camilla Berglund <elmindreda@glfw.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 Berglund70423af2016-07-21 00:15:07 +0200118/* Include because most Windows GLU headers need wchar_t and
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 Berglund70423af2016-07-21 00:15:07 +0200123
124/* Include because it is needed by Vulkan and related functions.
125 */
Camilla Berglund5661d032016-03-23 10:09:07 +0100126#include <stdint.h>
Camilla Berglund3249f812010-09-07 17:34:51 +0200127
Camilla Berglundc93b1202013-09-08 16:07:34 +0200128/* Include the chosen client API headers.
129 */
Camilla Berglunddb49aa62016-02-22 13:16:43 +0100130#if defined(__APPLE__)
Camilla Berglund1591caa2015-01-08 06:56:17 +0100131 #if defined(GLFW_INCLUDE_GLCOREARB)
132 #include <OpenGL/gl3.h>
133 #if defined(GLFW_INCLUDE_GLEXT)
134 #include <OpenGL/gl3ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200135 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100136 #elif !defined(GLFW_INCLUDE_NONE)
137 #if !defined(GLFW_INCLUDE_GLEXT)
138 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200139 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100140 #include <OpenGL/gl.h>
141 #endif
142 #if defined(GLFW_INCLUDE_GLU)
143 #include <OpenGL/glu.h>
144 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200145#else
Camilla Berglund1591caa2015-01-08 06:56:17 +0100146 #if defined(GLFW_INCLUDE_GLCOREARB)
147 #include <GL/glcorearb.h>
148 #elif defined(GLFW_INCLUDE_ES1)
149 #include <GLES/gl.h>
150 #if defined(GLFW_INCLUDE_GLEXT)
151 #include <GLES/glext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200152 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100153 #elif defined(GLFW_INCLUDE_ES2)
154 #include <GLES2/gl2.h>
155 #if defined(GLFW_INCLUDE_GLEXT)
156 #include <GLES2/gl2ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200157 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100158 #elif defined(GLFW_INCLUDE_ES3)
159 #include <GLES3/gl3.h>
160 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100161 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100162 #endif
163 #elif defined(GLFW_INCLUDE_ES31)
164 #include <GLES3/gl31.h>
165 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100166 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100167 #endif
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200168 #elif defined(GLFW_INCLUDE_VULKAN)
169 #include <vulkan/vulkan.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100170 #elif !defined(GLFW_INCLUDE_NONE)
171 #include <GL/gl.h>
172 #if defined(GLFW_INCLUDE_GLEXT)
173 #include <GL/glext.h>
174 #endif
175 #endif
176 #if defined(GLFW_INCLUDE_GLU)
177 #include <GL/glu.h>
178 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200179#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200180
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200181#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200182 /* GLFW_DLL must be defined by applications that are linking against the DLL
183 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
184 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200185 */
Camilla Berglund0df4e062015-12-13 14:07:27 +0100186 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200187#endif
188
Camilla Berglund1591caa2015-01-08 06:56:17 +0100189/* GLFWAPI is used to declare public API functions for export
190 * from the DLL / shared library / dynamic library.
191 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200192#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200193 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100194 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200195#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200196 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100197 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100198#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200199 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100200 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200201#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200202 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200203 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200204#endif
205
Camilla Berglund3249f812010-09-07 17:34:51 +0200206
207/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100208 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200209 *************************************************************************/
210
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100211/*! @name GLFW version macros
212 * @{ */
213/*! @brief The major version number of the GLFW library.
214 *
215 * This is incremented when the API is changed in non-compatible ways.
216 * @ingroup init
217 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100218#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100219/*! @brief The minor version number of the GLFW library.
220 *
221 * This is incremented when features are added to the API but it remains
222 * backward-compatible.
223 * @ingroup init
224 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200225#define GLFW_VERSION_MINOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100226/*! @brief The revision number of the GLFW library.
227 *
228 * This is incremented when a bug fix release is made that does not contain any
229 * API changes.
230 * @ingroup init
231 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200232#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100233/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200234
Camilla Berglund0eccf752015-08-23 19:30:04 +0200235/*! @name Boolean values
236 * @{ */
237/*! @brief One.
238 *
239 * One. Seriously. You don't _need_ to use this symbol in your code. It's
240 * just semantic sugar for the number 1. You can use `1` or `true` or `_True`
241 * or `GL_TRUE` or whatever you want.
242 */
243#define GLFW_TRUE 1
244/*! @brief Zero.
245 *
246 * Zero. Seriously. You don't _need_ to use this symbol in your code. It's
247 * just just semantic sugar for the number 0. You can use `0` or `false` or
248 * `_False` or `GL_FALSE` or whatever you want.
249 */
250#define GLFW_FALSE 0
251/*! @} */
252
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100253/*! @name Key and button actions
254 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200255/*! @brief The key or mouse button was released.
256 *
257 * The key or mouse button was released.
258 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100259 * @ingroup input
260 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100261#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200262/*! @brief The key or mouse button was pressed.
263 *
264 * The key or mouse button was pressed.
265 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100266 * @ingroup input
267 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100268#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100269/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200270 *
271 * The key was held down until it repeated.
272 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100273 * @ingroup input
274 */
275#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100276/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200277
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200278/*! @defgroup keys Keyboard keys
279 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100280 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200281 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100282 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
283 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
284 * put in the 256+ range).
285 *
286 * The naming of the key codes follow these rules:
287 * - The US keyboard layout is used
288 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
289 * "3", etc.)
290 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
291 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
292 * correspond to the Unicode standard (usually for brevity)
293 * - Keys that lack a clear US mapping are named "WORLD_x"
294 * - For non-printable keys, custom names are used (e.g. "F4",
295 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200296 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100297 * @ingroup input
298 * @{
299 */
300
Camilla Berglund11615fc2013-05-30 17:19:12 +0200301/* The unknown key */
302#define GLFW_KEY_UNKNOWN -1
303
Marcusc0cb4c22011-01-02 11:18:14 +0100304/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100305#define GLFW_KEY_SPACE 32
306#define GLFW_KEY_APOSTROPHE 39 /* ' */
307#define GLFW_KEY_COMMA 44 /* , */
308#define GLFW_KEY_MINUS 45 /* - */
309#define GLFW_KEY_PERIOD 46 /* . */
310#define GLFW_KEY_SLASH 47 /* / */
311#define GLFW_KEY_0 48
312#define GLFW_KEY_1 49
313#define GLFW_KEY_2 50
314#define GLFW_KEY_3 51
315#define GLFW_KEY_4 52
316#define GLFW_KEY_5 53
317#define GLFW_KEY_6 54
318#define GLFW_KEY_7 55
319#define GLFW_KEY_8 56
320#define GLFW_KEY_9 57
321#define GLFW_KEY_SEMICOLON 59 /* ; */
322#define GLFW_KEY_EQUAL 61 /* = */
323#define GLFW_KEY_A 65
324#define GLFW_KEY_B 66
325#define GLFW_KEY_C 67
326#define GLFW_KEY_D 68
327#define GLFW_KEY_E 69
328#define GLFW_KEY_F 70
329#define GLFW_KEY_G 71
330#define GLFW_KEY_H 72
331#define GLFW_KEY_I 73
332#define GLFW_KEY_J 74
333#define GLFW_KEY_K 75
334#define GLFW_KEY_L 76
335#define GLFW_KEY_M 77
336#define GLFW_KEY_N 78
337#define GLFW_KEY_O 79
338#define GLFW_KEY_P 80
339#define GLFW_KEY_Q 81
340#define GLFW_KEY_R 82
341#define GLFW_KEY_S 83
342#define GLFW_KEY_T 84
343#define GLFW_KEY_U 85
344#define GLFW_KEY_V 86
345#define GLFW_KEY_W 87
346#define GLFW_KEY_X 88
347#define GLFW_KEY_Y 89
348#define GLFW_KEY_Z 90
349#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
350#define GLFW_KEY_BACKSLASH 92 /* \ */
351#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
352#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
353#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
354#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100355
356/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100357#define GLFW_KEY_ESCAPE 256
358#define GLFW_KEY_ENTER 257
359#define GLFW_KEY_TAB 258
360#define GLFW_KEY_BACKSPACE 259
361#define GLFW_KEY_INSERT 260
362#define GLFW_KEY_DELETE 261
363#define GLFW_KEY_RIGHT 262
364#define GLFW_KEY_LEFT 263
365#define GLFW_KEY_DOWN 264
366#define GLFW_KEY_UP 265
367#define GLFW_KEY_PAGE_UP 266
368#define GLFW_KEY_PAGE_DOWN 267
369#define GLFW_KEY_HOME 268
370#define GLFW_KEY_END 269
371#define GLFW_KEY_CAPS_LOCK 280
372#define GLFW_KEY_SCROLL_LOCK 281
373#define GLFW_KEY_NUM_LOCK 282
374#define GLFW_KEY_PRINT_SCREEN 283
375#define GLFW_KEY_PAUSE 284
376#define GLFW_KEY_F1 290
377#define GLFW_KEY_F2 291
378#define GLFW_KEY_F3 292
379#define GLFW_KEY_F4 293
380#define GLFW_KEY_F5 294
381#define GLFW_KEY_F6 295
382#define GLFW_KEY_F7 296
383#define GLFW_KEY_F8 297
384#define GLFW_KEY_F9 298
385#define GLFW_KEY_F10 299
386#define GLFW_KEY_F11 300
387#define GLFW_KEY_F12 301
388#define GLFW_KEY_F13 302
389#define GLFW_KEY_F14 303
390#define GLFW_KEY_F15 304
391#define GLFW_KEY_F16 305
392#define GLFW_KEY_F17 306
393#define GLFW_KEY_F18 307
394#define GLFW_KEY_F19 308
395#define GLFW_KEY_F20 309
396#define GLFW_KEY_F21 310
397#define GLFW_KEY_F22 311
398#define GLFW_KEY_F23 312
399#define GLFW_KEY_F24 313
400#define GLFW_KEY_F25 314
401#define GLFW_KEY_KP_0 320
402#define GLFW_KEY_KP_1 321
403#define GLFW_KEY_KP_2 322
404#define GLFW_KEY_KP_3 323
405#define GLFW_KEY_KP_4 324
406#define GLFW_KEY_KP_5 325
407#define GLFW_KEY_KP_6 326
408#define GLFW_KEY_KP_7 327
409#define GLFW_KEY_KP_8 328
410#define GLFW_KEY_KP_9 329
411#define GLFW_KEY_KP_DECIMAL 330
412#define GLFW_KEY_KP_DIVIDE 331
413#define GLFW_KEY_KP_MULTIPLY 332
414#define GLFW_KEY_KP_SUBTRACT 333
415#define GLFW_KEY_KP_ADD 334
416#define GLFW_KEY_KP_ENTER 335
417#define GLFW_KEY_KP_EQUAL 336
418#define GLFW_KEY_LEFT_SHIFT 340
419#define GLFW_KEY_LEFT_CONTROL 341
420#define GLFW_KEY_LEFT_ALT 342
421#define GLFW_KEY_LEFT_SUPER 343
422#define GLFW_KEY_RIGHT_SHIFT 344
423#define GLFW_KEY_RIGHT_CONTROL 345
424#define GLFW_KEY_RIGHT_ALT 346
425#define GLFW_KEY_RIGHT_SUPER 347
426#define GLFW_KEY_MENU 348
Camilla Berglund9c315412015-07-02 14:24:50 +0200427
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100428#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100429
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100430/*! @} */
431
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200432/*! @defgroup mods Modifier key flags
Camilla Berglund4188c262015-01-18 01:55:25 +0100433 *
434 * See [key input](@ref input_key) for how these are used.
435 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200436 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100437 * @{ */
438
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200439/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100440 */
441#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200442/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100443 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200444#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200445/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100446 */
447#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200448/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200449 */
450#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100451
452/*! @} */
453
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100454/*! @defgroup buttons Mouse buttons
Camilla Berglund4188c262015-01-18 01:55:25 +0100455 *
456 * See [mouse button input](@ref input_mouse_button) for how these are used.
457 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100458 * @ingroup input
459 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100460#define GLFW_MOUSE_BUTTON_1 0
461#define GLFW_MOUSE_BUTTON_2 1
462#define GLFW_MOUSE_BUTTON_3 2
463#define GLFW_MOUSE_BUTTON_4 3
464#define GLFW_MOUSE_BUTTON_5 4
465#define GLFW_MOUSE_BUTTON_6 5
466#define GLFW_MOUSE_BUTTON_7 6
467#define GLFW_MOUSE_BUTTON_8 7
468#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
469#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
470#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
471#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100472/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200473
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100474/*! @defgroup joysticks Joysticks
Camilla Berglund4188c262015-01-18 01:55:25 +0100475 *
476 * See [joystick input](@ref joystick) for how these are used.
477 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100478 * @ingroup input
479 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100480#define GLFW_JOYSTICK_1 0
481#define GLFW_JOYSTICK_2 1
482#define GLFW_JOYSTICK_3 2
483#define GLFW_JOYSTICK_4 3
484#define GLFW_JOYSTICK_5 4
485#define GLFW_JOYSTICK_6 5
486#define GLFW_JOYSTICK_7 6
487#define GLFW_JOYSTICK_8 7
488#define GLFW_JOYSTICK_9 8
489#define GLFW_JOYSTICK_10 9
490#define GLFW_JOYSTICK_11 10
491#define GLFW_JOYSTICK_12 11
492#define GLFW_JOYSTICK_13 12
493#define GLFW_JOYSTICK_14 13
494#define GLFW_JOYSTICK_15 14
495#define GLFW_JOYSTICK_16 15
496#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100497/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200498
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100499/*! @defgroup errors Error codes
Camilla Berglund4188c262015-01-18 01:55:25 +0100500 *
501 * See [error handling](@ref error_handling) for how these are used.
502 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200503 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100504 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100505/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200506 *
Camilla Berglund0df4e062015-12-13 14:07:27 +0100507 * This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund4591ad22014-09-18 15:03:29 +0200508 * library is [initialized](@ref intro_init).
509 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100510 * @analysis Application programmer error. Initialize GLFW before calling any
511 * function that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100512 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200513#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100514/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200515 *
516 * This occurs if a GLFW function was called that needs and operates on the
517 * current OpenGL or OpenGL ES context but no context is current on the calling
518 * thread. One such function is @ref glfwSwapInterval.
519 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100520 * @analysis Application programmer error. Ensure a context is current before
521 * calling functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100522 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200523#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200524/*! @brief One of the arguments to the function was an invalid enum value.
525 *
526 * One of the arguments to the function was an invalid enum value, for example
Camilla Berglundce8f97c2015-01-11 23:33:14 +0100527 * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref
528 * glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200529 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100530 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100531 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200532#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200533/*! @brief One of the arguments to the function was an invalid value.
534 *
535 * One of the arguments to the function was an invalid value, for example
536 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
537 *
538 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
539 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
540 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100541 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100542 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200543#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100544/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200545 *
546 * A memory allocation failed.
547 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100548 * @analysis A bug in GLFW or the underlying operating system. Report the bug
549 * to our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100550 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200551#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200552/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200553 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200554 * GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200555 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100556 * @analysis The installed graphics driver does not support the requested
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200557 * API, or does not support it via the chosen context creation backend.
Camilla Berglund951a9582016-01-31 21:32:14 +0100558 * Below are a few examples.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200559 *
560 * @par
561 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200562 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200563 * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100564 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200565 * driver. Older graphics drivers do not support Vulkan.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100566 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200567#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200568/*! @brief The requested OpenGL or OpenGL ES version is not available.
569 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100570 * The requested OpenGL or OpenGL ES version (including any requested context
571 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200572 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100573 * @analysis The machine does not support your requirements. If your
574 * application is sufficiently flexible, downgrade your requirements and try
575 * again. Otherwise, inform the user that their machine does not match your
Camilla Berglund4591ad22014-09-18 15:03:29 +0200576 * requirements.
577 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200578 * @par
579 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
580 * comes out before the 4.x series gets that far, also fail with this error and
581 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
582 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100583 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200584#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100585/*! @brief A platform-specific error occurred that does not match any of the
586 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200587 *
588 * A platform-specific error occurred that does not match any of the more
589 * specific categories.
590 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100591 * @analysis A bug or configuration error in GLFW, the underlying operating
592 * system or its drivers, or a lack of required resources. Report the issue to
593 * our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100594 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200595#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200596/*! @brief The requested format is not supported or available.
597 *
598 * If emitted during window creation, the requested pixel format is not
599 * supported.
600 *
601 * If emitted when querying the clipboard, the contents of the clipboard could
602 * not be converted to the requested format.
603 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100604 * @analysis If emitted during window creation, one or more
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200605 * [hard constraints](@ref window_hints_hard) did not match any of the
606 * available pixel formats. If your application is sufficiently flexible,
607 * downgrade your requirements and try again. Otherwise, inform the user that
608 * their machine does not match your requirements.
609 *
610 * @par
611 * If emitted when querying the clipboard, ignore the error or report it to
612 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100613 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200614#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglund496f5592015-06-18 14:03:02 +0200615/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
616 *
617 * A window that does not have an OpenGL or OpenGL ES context was passed to
618 * a function that requires it to have one.
619 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100620 * @analysis Application programmer error. Fix the offending call.
Camilla Berglund496f5592015-06-18 14:03:02 +0200621 */
622#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100623/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200624
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100625#define GLFW_FOCUSED 0x00020001
626#define GLFW_ICONIFIED 0x00020002
Camilla Berglund393e4392013-05-27 22:16:59 +0200627#define GLFW_RESIZABLE 0x00020003
628#define GLFW_VISIBLE 0x00020004
629#define GLFW_DECORATED 0x00020005
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200630#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200631#define GLFW_FLOATING 0x00020007
Camilla Berglunda10caa42015-10-13 12:50:59 +0200632#define GLFW_MAXIMIZED 0x00020008
Camilla Berglund2c091572010-09-09 21:09:11 +0200633
Camilla Berglund53b39a62013-05-30 18:55:45 +0200634#define GLFW_RED_BITS 0x00021001
635#define GLFW_GREEN_BITS 0x00021002
636#define GLFW_BLUE_BITS 0x00021003
637#define GLFW_ALPHA_BITS 0x00021004
638#define GLFW_DEPTH_BITS 0x00021005
639#define GLFW_STENCIL_BITS 0x00021006
640#define GLFW_ACCUM_RED_BITS 0x00021007
641#define GLFW_ACCUM_GREEN_BITS 0x00021008
642#define GLFW_ACCUM_BLUE_BITS 0x00021009
643#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
644#define GLFW_AUX_BUFFERS 0x0002100B
645#define GLFW_STEREO 0x0002100C
646#define GLFW_SAMPLES 0x0002100D
647#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Berglund2cd34382013-05-30 20:42:50 +0200648#define GLFW_REFRESH_RATE 0x0002100F
Camilla Berglundc9808582014-04-24 19:21:10 +0200649#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Berglunddeb0b3d2012-12-02 21:00:15 +0100650
Camilla Berglund53b39a62013-05-30 18:55:45 +0200651#define GLFW_CLIENT_API 0x00022001
652#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
653#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
654#define GLFW_CONTEXT_REVISION 0x00022004
655#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
656#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
657#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
658#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Berglund44c899c2014-08-21 19:21:45 +0200659#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Berglund7be82092015-08-10 12:46:14 +0200660#define GLFW_CONTEXT_NO_ERROR 0x0002200A
Camilla Berglundef80bea2016-03-28 13:19:31 +0200661#define GLFW_CONTEXT_CREATION_API 0x0002200B
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100662
Camilla Berglund496f5592015-06-18 14:03:02 +0200663#define GLFW_NO_API 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200664#define GLFW_OPENGL_API 0x00030001
665#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100666
Camilla Berglund393e4392013-05-27 22:16:59 +0200667#define GLFW_NO_ROBUSTNESS 0
668#define GLFW_NO_RESET_NOTIFICATION 0x00031001
669#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100670
Camilla Berglund44e84012013-06-05 16:13:30 +0200671#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200672#define GLFW_OPENGL_CORE_PROFILE 0x00032001
673#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100674
Camilla Berglund393e4392013-05-27 22:16:59 +0200675#define GLFW_CURSOR 0x00033001
676#define GLFW_STICKY_KEYS 0x00033002
677#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100678
Camilla Berglund393e4392013-05-27 22:16:59 +0200679#define GLFW_CURSOR_NORMAL 0x00034001
680#define GLFW_CURSOR_HIDDEN 0x00034002
681#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100682
Camilla Berglund44c899c2014-08-21 19:21:45 +0200683#define GLFW_ANY_RELEASE_BEHAVIOR 0
684#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
685#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
686
Camilla Berglundef80bea2016-03-28 13:19:31 +0200687#define GLFW_NATIVE_CONTEXT_API 0x00036001
688#define GLFW_EGL_CONTEXT_API 0x00036002
689
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200690/*! @defgroup shapes Standard cursor shapes
Camilla Berglund4188c262015-01-18 01:55:25 +0100691 *
692 * See [standard cursor creation](@ref cursor_standard) for how these are used.
693 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200694 * @ingroup input
695 * @{ */
696
697/*! @brief The regular arrow cursor shape.
698 *
699 * The regular arrow cursor.
700 */
701#define GLFW_ARROW_CURSOR 0x00036001
702/*! @brief The text input I-beam cursor shape.
703 *
704 * The text input I-beam cursor shape.
705 */
706#define GLFW_IBEAM_CURSOR 0x00036002
707/*! @brief The crosshair shape.
708 *
709 * The crosshair shape.
710 */
711#define GLFW_CROSSHAIR_CURSOR 0x00036003
712/*! @brief The hand shape.
713 *
714 * The hand shape.
715 */
716#define GLFW_HAND_CURSOR 0x00036004
717/*! @brief The horizontal resize arrow shape.
718 *
719 * The horizontal resize arrow shape.
720 */
721#define GLFW_HRESIZE_CURSOR 0x00036005
722/*! @brief The vertical resize arrow shape.
723 *
724 * The vertical resize arrow shape.
725 */
726#define GLFW_VRESIZE_CURSOR 0x00036006
727/*! @} */
728
Camilla Berglund393e4392013-05-27 22:16:59 +0200729#define GLFW_CONNECTED 0x00040001
730#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100731
Camilla Berglund28101302014-04-08 18:57:43 +0200732#define GLFW_DONT_CARE -1
733
Camilla Berglund97387282011-10-06 23:28:56 +0200734
Camilla Berglund3249f812010-09-07 17:34:51 +0200735/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100736 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200737 *************************************************************************/
738
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100739/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200740 *
741 * Generic function pointer used for returning client API function pointers
742 * without forcing a cast from a regular pointer.
743 *
Camilla Berglundbce20c32015-11-05 13:58:52 +0100744 * @sa @ref context_glext
745 * @sa glfwGetProcAddress
746 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100747 * @since Added in version 3.0.
748
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100749 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100750 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200751typedef void (*GLFWglproc)(void);
752
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200753/*! @brief Vulkan API function pointer type.
754 *
755 * Generic function pointer used for returning Vulkan API function pointers
756 * without forcing a cast from a regular pointer.
757 *
758 * @sa @ref vulkan_proc
759 * @sa glfwGetInstanceProcAddress
760 *
761 * @since Added in version 3.2.
762 *
763 * @ingroup vulkan
764 */
765typedef void (*GLFWvkproc)(void);
766
Camilla Berglunddba2d802013-01-17 23:06:56 +0100767/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200768 *
769 * Opaque monitor object.
770 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100771 * @see @ref monitor_object
772 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100773 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100774 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100775 * @ingroup monitor
776 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100777typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200778
Camilla Berglunddba2d802013-01-17 23:06:56 +0100779/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200780 *
781 * Opaque window object.
782 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100783 * @see @ref window_object
784 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100785 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100786 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100787 * @ingroup window
788 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100789typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200790
urraka40c04a72013-12-04 10:19:22 -0300791/*! @brief Opaque cursor object.
792 *
793 * Opaque cursor object.
794 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100795 * @see @ref cursor_object
796 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100797 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +0100798 *
urraka40c04a72013-12-04 10:19:22 -0300799 * @ingroup cursor
800 */
801typedef struct GLFWcursor GLFWcursor;
802
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100803/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200804 *
805 * This is the function signature for error callback functions.
806 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100807 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100808 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100809 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100810 * @sa @ref error_handling
Camilla Berglunddba2d802013-01-17 23:06:56 +0100811 * @sa glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100812 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100813 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100814 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200815 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100816 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100817typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100818
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100819/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200820 *
821 * This is the function signature for window position callback functions.
822 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200823 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200824 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
825 * upper-left corner of the client area of the window.
826 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
827 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100828 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100829 * @sa @ref window_pos
Camilla Berglunddba2d802013-01-17 23:06:56 +0100830 * @sa glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100831 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100832 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100833 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100834 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100835 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100836typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100837
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100838/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200839 *
840 * This is the function signature for window size callback functions.
841 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200842 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200843 * @param[in] width The new width, in screen coordinates, of the window.
844 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100845 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100846 * @sa @ref window_size
Camilla Berglunddba2d802013-01-17 23:06:56 +0100847 * @sa glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100848 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100849 * @since Added in version 1.0.
850 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100851 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100852 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100853 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100854typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100855
856/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200857 *
858 * This is the function signature for window close callback functions.
859 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100860 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100861 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100862 * @sa @ref window_close
Camilla Berglunddba2d802013-01-17 23:06:56 +0100863 * @sa glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100864 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100865 * @since Added in version 2.5.
866 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100867 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100868 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100869 */
Camilla Berglund64afb192013-03-06 23:29:37 +0100870typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100871
872/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200873 *
874 * This is the function signature for window refresh callback functions.
875 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100876 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100877 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100878 * @sa @ref window_refresh
Camilla Berglunddba2d802013-01-17 23:06:56 +0100879 * @sa glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100880 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100881 * @since Added in version 2.5.
882 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100883 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100884 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100885 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100886typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100887
888/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200889 *
890 * This is the function signature for window focus callback functions.
891 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100892 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200893 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
894 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100895 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100896 * @sa @ref window_focus
Camilla Berglunddba2d802013-01-17 23:06:56 +0100897 * @sa glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100898 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100899 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100900 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100901 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100902 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100903typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100904
Camilla Berglund06e7a962012-11-22 19:14:27 +0100905/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200906 *
907 * This is the function signature for window iconify/restore callback
908 * functions.
909 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100910 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200911 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
912 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100913 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100914 * @sa @ref window_iconify
Camilla Berglunddba2d802013-01-17 23:06:56 +0100915 * @sa glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100916 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100917 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100918 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100919 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100920 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100921typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100922
Camilla Berglund34981632013-06-03 12:51:57 +0200923/*! @brief The function signature for framebuffer resize callbacks.
924 *
925 * This is the function signature for framebuffer resize callback
926 * functions.
927 *
928 * @param[in] window The window whose framebuffer was resized.
929 * @param[in] width The new width, in pixels, of the framebuffer.
930 * @param[in] height The new height, in pixels, of the framebuffer.
931 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100932 * @sa @ref window_fbsize
Camilla Berglund34981632013-06-03 12:51:57 +0200933 * @sa glfwSetFramebufferSizeCallback
934 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100935 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100936 *
Camilla Berglund34981632013-06-03 12:51:57 +0200937 * @ingroup window
938 */
939typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
940
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100941/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200942 *
943 * This is the function signature for mouse button callback functions.
944 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100945 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100946 * @param[in] button The [mouse button](@ref buttons) that was pressed or
947 * released.
948 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200949 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
950 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100951 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100952 * @sa @ref input_mouse_button
Camilla Berglunddba2d802013-01-17 23:06:56 +0100953 * @sa glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100954 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100955 * @since Added in version 1.0.
956 * @glfw3 Added window handle and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +0100957 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100958 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100959 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100960typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100961
962/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200963 *
964 * This is the function signature for cursor position callback functions.
965 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100966 * @param[in] window The window that received the event.
Camilla Berglund95c44ab2016-02-17 14:52:01 +0100967 * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
968 * the client area.
969 * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
970 * client area.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100971 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100972 * @sa @ref cursor_pos
Camilla Berglunddba2d802013-01-17 23:06:56 +0100973 * @sa glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100974 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100975 * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +0100976 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100977 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100978 */
Camilla Berglund129e94d2013-04-04 16:16:21 +0200979typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100980
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200981/*! @brief The function signature for cursor enter/leave callbacks.
982 *
983 * This is the function signature for cursor enter/leave callback functions.
984 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100985 * @param[in] window The window that received the event.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200986 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
987 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100988 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100989 * @sa @ref cursor_enter
Camilla Berglunddba2d802013-01-17 23:06:56 +0100990 * @sa glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100991 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100992 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100993 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100994 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100995 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100996typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100997
998/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200999 *
1000 * This is the function signature for scroll callback functions.
1001 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001002 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +02001003 * @param[in] xoffset The scroll offset along the x-axis.
1004 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001005 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001006 * @sa @ref scrolling
Camilla Berglunddba2d802013-01-17 23:06:56 +01001007 * @sa glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001008 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001009 * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001010 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001011 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001012 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001013typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001014
1015/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001016 *
1017 * This is the function signature for keyboard key callback functions.
1018 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001019 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001020 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +02001021 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001022 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001023 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1024 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001025 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001026 * @sa @ref input_key
Camilla Berglunddba2d802013-01-17 23:06:56 +01001027 * @sa glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001028 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001029 * @since Added in version 1.0.
1030 * @glfw3 Added window handle, scancode and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001031 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001032 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001033 */
Camilla Berglund11615fc2013-05-30 17:19:12 +02001034typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001035
1036/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001037 *
1038 * This is the function signature for Unicode character callback functions.
1039 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001040 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +02001041 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001042 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001043 * @sa @ref input_char
Camilla Berglunddba2d802013-01-17 23:06:56 +01001044 * @sa glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001045 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001046 * @since Added in version 2.4.
1047 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001048 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001049 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001050 */
Camilla Berglund182e0af2013-02-25 17:02:28 +01001051typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +01001052
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001053/*! @brief The function signature for Unicode character with modifiers
1054 * callbacks.
1055 *
1056 * This is the function signature for Unicode character with modifiers callback
1057 * functions. It is called for each input character, regardless of what
1058 * modifier keys are held down.
1059 *
1060 * @param[in] window The window that received the event.
1061 * @param[in] codepoint The Unicode code point of the character.
1062 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1063 * held down.
1064 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001065 * @sa @ref input_char
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001066 * @sa glfwSetCharModsCallback
1067 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001068 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001069 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001070 * @ingroup input
1071 */
1072typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1073
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001074/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001075 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001076 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001077 *
1078 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001079 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +01001080 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +02001081 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001082 * @sa @ref path_drop
arturo89d07232013-07-10 11:42:14 +02001083 * @sa glfwSetDropCallback
1084 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001085 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001086 *
arturo89d07232013-07-10 11:42:14 +02001087 * @ingroup input
1088 */
Camilla Berglund8f349e82013-12-22 19:28:46 +01001089typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +02001090
Camilla Berglund5f68e122012-11-27 17:07:28 +01001091/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001092 *
1093 * This is the function signature for monitor configuration callback functions.
1094 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001095 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001096 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001097 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001098 * @sa @ref monitor_event
Camilla Berglunddba2d802013-01-17 23:06:56 +01001099 * @sa glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001100 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001101 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001102 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001103 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +01001104 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001105typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +01001106
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001107/*! @brief The function signature for joystick configuration callbacks.
1108 *
1109 * This is the function signature for joystick configuration callback
1110 * functions.
1111 *
1112 * @param[in] joy The joystick that was connected or disconnected.
1113 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
1114 *
1115 * @sa @ref joystick_event
1116 * @sa glfwSetJoystickCallback
1117 *
1118 * @since Added in version 3.2.
1119 *
1120 * @ingroup input
1121 */
1122typedef void (* GLFWjoystickfun)(int,int);
1123
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001124/*! @brief Video mode type.
1125 *
1126 * This describes a single video mode.
1127 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001128 * @sa @ref monitor_modes
1129 * @sa glfwGetVideoMode glfwGetVideoModes
1130 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001131 * @since Added in version 1.0.
1132 * @glfw3 Added refresh rate member.
Camilla Berglund810bab72015-12-13 17:38:14 +01001133 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001134 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001135 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001136typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001137{
Camilla Berglund95835af2013-05-30 13:53:25 +02001138 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001139 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001140 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001141 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001142 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001143 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001144 /*! The bit depth of the red channel of the video mode.
1145 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001146 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001147 /*! The bit depth of the green channel of the video mode.
1148 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001149 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001150 /*! The bit depth of the blue channel of the video mode.
1151 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001152 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001153 /*! The refresh rate, in Hz, of the video mode.
1154 */
1155 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001156} GLFWvidmode;
1157
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001158/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001159 *
1160 * This describes the gamma ramp for a monitor.
1161 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001162 * @sa @ref monitor_gamma
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001163 * @sa glfwGetGammaRamp glfwSetGammaRamp
1164 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001165 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001166 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001167 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001168 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001169typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001170{
Camilla Berglundc1594112013-05-27 22:29:06 +02001171 /*! An array of value describing the response of the red channel.
1172 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001173 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001174 /*! An array of value describing the response of the green channel.
1175 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001176 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001177 /*! An array of value describing the response of the blue channel.
1178 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001179 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001180 /*! The number of elements in each array.
1181 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001182 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001183} GLFWgammaramp;
1184
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001185/*! @brief Image data.
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001186 *
1187 * @sa @ref cursor_custom
Camilla Berglundfe0317a2016-08-01 11:51:30 +02001188 * @sa @ref window_icon
Camilla Berglund810bab72015-12-13 17:38:14 +01001189 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001190 * @since Added in version 2.1.
1191 * @glfw3 Removed format and bytes-per-pixel members.
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001192 */
1193typedef struct GLFWimage
1194{
1195 /*! The width, in pixels, of this image.
1196 */
1197 int width;
1198 /*! The height, in pixels, of this image.
1199 */
1200 int height;
1201 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1202 */
1203 unsigned char* pixels;
1204} GLFWimage;
1205
Camilla Berglund3249f812010-09-07 17:34:51 +02001206
1207/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001208 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001209 *************************************************************************/
1210
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001211/*! @brief Initializes the GLFW library.
1212 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001213 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001214 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001215 * should be terminated in order to free any resources allocated during or
1216 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001217 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001218 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001219 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001220 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001221 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001222 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001223 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001224 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001225 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001226 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001227 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1228 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001229 * @remark @osx This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001230 * application to the `Contents/Resources` subdirectory of the application's
Camilla Berglund4591ad22014-09-18 15:03:29 +02001231 * bundle, if present. This can be disabled with a
1232 * [compile-time option](@ref compile_options_osx).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001233 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001234 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001235 *
1236 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001237 * @sa glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001238 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001239 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001240 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001241 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001242 */
1243GLFWAPI int glfwInit(void);
1244
1245/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001246 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001247 * This function destroys all remaining windows and cursors, restores any
1248 * modified gamma ramps and frees any other allocated resources. Once this
1249 * function is called, you must again call @ref glfwInit successfully before
1250 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001251 *
1252 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001253 * before the application exits. If initialization fails, there is no need to
1254 * call this function, as it is called by @ref glfwInit before it returns
1255 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001256 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001257 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1258 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001259 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001260 *
Camilla Berglund0df4e062015-12-13 14:07:27 +01001261 * @warning The contexts of any remaining windows must not be current on any
1262 * other thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001263 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001264 * @reentrancy This function must not be called from a callback.
Camilla Berglund20858762015-01-01 18:41:22 +01001265 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001266 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001267 *
1268 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001269 * @sa glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001270 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001271 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001272 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001273 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001274 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001275GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001276
1277/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001278 *
1279 * This function retrieves the major, minor and revision numbers of the GLFW
1280 * library. It is intended for when you are using GLFW as a shared library and
1281 * want to ensure that you are using the minimum required version.
1282 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001283 * Any or all of the version arguments may be `NULL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001284 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001285 * @param[out] major Where to store the major version number, or `NULL`.
1286 * @param[out] minor Where to store the minor version number, or `NULL`.
1287 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001288 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001289 * @errors None.
1290 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001291 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001292 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001293 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001294 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001295 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001296 * @sa glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001297 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001298 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001299 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001300 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001301 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001302GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001303
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001304/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001305 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001306 * This function returns the compile-time generated
1307 * [version string](@ref intro_version_string) of the GLFW library binary. It
1308 * describes the version, platform, compiler and any platform-specific
Camilla Berglund386b6032016-02-10 13:48:49 +01001309 * compile-time options. It should not be confused with the OpenGL or OpenGL
1310 * ES version string, queried with `glGetString`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001311 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001312 * __Do not use the version string__ to parse the GLFW library version. The
Camilla Berglund386b6032016-02-10 13:48:49 +01001313 * @ref glfwGetVersion function provides the version of the running library
1314 * binary in numerical format.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001315 *
Camilla Berglund386b6032016-02-10 13:48:49 +01001316 * @return The ASCII encoded GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001317 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001318 * @errors None.
1319 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001320 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001321 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001322 * @pointer_lifetime The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001323 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001324 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001325 *
1326 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001327 * @sa glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001328 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001329 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001330 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001331 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001332 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001333GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001334
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001335/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001336 *
1337 * This function sets the error callback, which is called with an error code
1338 * and a human-readable description each time a GLFW error occurs.
1339 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001340 * The error callback is called on the thread where the error occurred. If you
1341 * are using GLFW from multiple threads, your error callback needs to be
1342 * written accordingly.
1343 *
1344 * Because the description string may have been generated specifically for that
1345 * error, it is not guaranteed to be valid after the callback has returned. If
1346 * you wish to use it after the callback returns, you need to make a copy.
1347 *
Camilla Berglund20858762015-01-01 18:41:22 +01001348 * Once set, the error callback remains set even after the library has been
1349 * terminated.
1350 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001351 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001352 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001353 * @return The previously set callback, or `NULL` if no callback was set.
1354 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001355 * @errors None.
1356 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001357 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001358 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001359 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001360 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001361 * @sa @ref error_handling
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001362 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001363 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001364 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001365 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001366 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001367GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001368
Camilla Berglund5f68e122012-11-27 17:07:28 +01001369/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001370 *
1371 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001372 * monitors. The primary monitor is always first in the returned array. If no
1373 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001374 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001375 * @param[out] count Where to store the number of monitors in the returned
1376 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001377 * @return An array of monitor handles, or `NULL` if no monitors were found or
1378 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001379 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001380 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1381 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001382 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1383 * should not free it yourself. It is guaranteed to be valid only until the
1384 * monitor configuration changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001385 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001386 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001387 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001388 * @sa @ref monitor_monitors
1389 * @sa @ref monitor_event
Camilla Berglunddba2d802013-01-17 23:06:56 +01001390 * @sa glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001391 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001392 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001393 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001394 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001395 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001396GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001397
Camilla Berglund5f68e122012-11-27 17:07:28 +01001398/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001399 *
1400 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001401 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001402 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001403 * @return The primary monitor, or `NULL` if no monitors were found or if an
1404 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001405 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001406 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1407 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001408 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001409 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001410 * @remark The primary monitor is always first in the array returned by @ref
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001411 * glfwGetMonitors.
1412 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001413 * @sa @ref monitor_monitors
Camilla Berglunddba2d802013-01-17 23:06:56 +01001414 * @sa glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001415 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001416 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001417 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001418 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001419 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001420GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001421
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001422/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001423 *
1424 * This function returns the position, in screen coordinates, of the upper-left
1425 * corner of the specified monitor.
1426 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001427 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1428 * non-`NULL` position arguments will be set to zero.
1429 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001430 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001431 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1432 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001433 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001434 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1435 * GLFW_PLATFORM_ERROR.
1436 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001437 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001438 *
1439 * @sa @ref monitor_properties
1440 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001441 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001442 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001443 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001444 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001445GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1446
1447/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001448 *
1449 * This function returns the size, in millimetres, of the display area of the
1450 * specified monitor.
1451 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001452 * Some systems do not provide accurate monitor size information, either
1453 * because the monitor
1454 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1455 * data is incorrect or because the driver does not report it accurately.
1456 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001457 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1458 * non-`NULL` size arguments will be set to zero.
1459 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001460 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001461 * @param[out] widthMM Where to store the width, in millimetres, of the
1462 * monitor's display area, or `NULL`.
1463 * @param[out] heightMM Where to store the height, in millimetres, of the
1464 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001465 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001466 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1467 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001468 * @remark @win32 calculates the returned physical size from the
Camilla Berglund4188c262015-01-18 01:55:25 +01001469 * current resolution and system DPI instead of querying the monitor EDID data.
Camilla Berglund0e205772014-03-24 11:58:35 +01001470 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001471 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001472 *
1473 * @sa @ref monitor_properties
1474 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001475 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001476 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001477 * @ingroup monitor
1478 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001479GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001480
Camilla Berglund5f68e122012-11-27 17:07:28 +01001481/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001482 *
1483 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001484 * specified monitor. The name typically reflects the make and model of the
1485 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001486 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001487 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001488 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1489 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001490 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001491 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1492 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001493 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
1494 * should not free it yourself. It is valid until the specified monitor is
1495 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001496 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001497 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001498 *
1499 * @sa @ref monitor_properties
1500 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001501 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001502 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001503 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001504 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001505GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001506
Camilla Berglund5f68e122012-11-27 17:07:28 +01001507/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001508 *
1509 * This function sets the monitor configuration callback, or removes the
1510 * currently set callback. This is called when a monitor is connected to or
1511 * disconnected from the system.
1512 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001513 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001514 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001515 * @return The previously set callback, or `NULL` if no callback was set or the
1516 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001517 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001518 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1519 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001520 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001521 *
1522 * @sa @ref monitor_event
1523 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001524 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001525 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001526 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001527 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001528GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001529
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001530/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001531 *
1532 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001533 * monitor. The returned array is sorted in ascending order, first by color
1534 * bit depth (the sum of all channel depths) and then by resolution area (the
1535 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001536 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001537 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001538 * @param[out] count Where to store the number of video modes in the returned
1539 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001540 * @return An array of video modes, or `NULL` if an
1541 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001542 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001543 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1544 * GLFW_PLATFORM_ERROR.
1545 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001546 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1547 * should not free it yourself. It is valid until the specified monitor is
1548 * disconnected, this function is called again for that monitor or the library
1549 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001550 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001551 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001552 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001553 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001554 * @sa glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001555 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001556 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001557 * @glfw3 Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001558 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001559 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001560 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001561GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001562
Camilla Berglund5f68e122012-11-27 17:07:28 +01001563/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001564 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001565 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001566 * you have created a full screen window for that monitor, the return value
1567 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001568 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001569 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001570 * @return The current mode of the monitor, or `NULL` if an
1571 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001572 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001573 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1574 * GLFW_PLATFORM_ERROR.
1575 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001576 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1577 * should not free it yourself. It is valid until the specified monitor is
1578 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001579 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001580 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001581 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001582 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001583 * @sa glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001584 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001585 * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001586 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001587 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001588 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001589GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001590
Camilla Berglund92a71e02013-02-12 13:50:41 +01001591/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001592 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001593 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglund5bbc2b42015-03-15 15:40:43 +01001594 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1595 * number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001596 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001597 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001598 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001599 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001600 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1601 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
1602 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001603 * @thread_safety This function must only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001604 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001605 * @sa @ref monitor_gamma
1606 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001607 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001608 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001609 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001610 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001611GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001612
Camilla Berglund4591ad22014-09-18 15:03:29 +02001613/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001614 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001615 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001616 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001617 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001618 * @return The current gamma ramp, or `NULL` if an
1619 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001620 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001621 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1622 * GLFW_PLATFORM_ERROR.
1623 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001624 * @pointer_lifetime The returned structure and its arrays are allocated and
1625 * freed by GLFW. You should not free them yourself. They are valid until the
1626 * specified monitor is disconnected, this function is called again for that
1627 * monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001628 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001629 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001630 *
1631 * @sa @ref monitor_gamma
1632 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001633 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001634 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001635 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001636 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001637GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001638
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001639/*! @brief Sets the current gamma ramp for the specified monitor.
1640 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001641 * This function sets the current gamma ramp for the specified monitor. The
1642 * original gamma ramp for that monitor is saved by GLFW the first time this
1643 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001644 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001645 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001646 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001647 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001648 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1649 * GLFW_PLATFORM_ERROR.
1650 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001651 * @remark Gamma ramp sizes other than 256 are not supported by all platforms
Camilla Berglund76fff4d2015-03-10 19:02:28 +01001652 * or graphics hardware.
1653 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001654 * @remark @win32 The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001655 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001656 * @pointer_lifetime The specified gamma ramp is copied before this function
1657 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001658 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001659 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001660 *
1661 * @sa @ref monitor_gamma
1662 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001663 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001664 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001665 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001666 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001667GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001668
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001669/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001670 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001671 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001672 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001673 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001674 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1675 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001676 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001677 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001678 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001679 * @sa glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001680 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001681 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001682 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001683 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001684 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001685GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001686
1687/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001688 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001689 * This function sets hints for the next call to @ref glfwCreateWindow. The
1690 * hints, once set, retain their values until changed by a call to @ref
1691 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02001692 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01001693 *
Camilla Berglundd6e0a432016-02-09 07:41:48 +01001694 * This function does not check whether the specified hint values are valid.
1695 * If you set hints to invalid values this will instead be reported by the next
1696 * call to @ref glfwCreateWindow.
1697 *
Camilla Berglundd0649e62016-01-27 03:25:21 +01001698 * @param[in] hint The [window hint](@ref window_hints) to set.
1699 * @param[in] value The new value of the window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001700 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001701 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1702 * GLFW_INVALID_ENUM.
1703 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001704 * @thread_safety This function must only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01001705 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001706 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001707 * @sa glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001708 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001709 * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001710 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001711 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001712 */
Camilla Berglundd0649e62016-01-27 03:25:21 +01001713GLFWAPI void glfwWindowHint(int hint, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001714
1715/*! @brief Creates a window and its associated context.
1716 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001717 * This function creates a window and its associated OpenGL or OpenGL ES
1718 * context. Most of the options controlling how the window and its context
1719 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001720 *
1721 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02001722 * can use the newly created context, you need to
1723 * [make it current](@ref context_current). For information about the `share`
1724 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001725 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001726 * The created window, framebuffer and context may differ from what you
1727 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001728 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001729 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02001730 * of the created window, framebuffer and context, see @ref
1731 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001732 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001733 * To create a full screen window, you need to specify the monitor the window
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001734 * will cover. If no monitor is specified, the window will be windowed mode.
1735 * Unless you have a way for the user to choose a specific monitor, it is
1736 * recommended that you pick the primary monitor. For more information on how
1737 * to query connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001738 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001739 * For full screen windows, the specified size becomes the resolution of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001740 * window's _desired video mode_. As long as a full screen window is not
1741 * iconified, the supported video mode most closely matching the desired video
1742 * mode is set for the specified monitor. For more information about full
1743 * screen windows, including the creation of so called _windowed full screen_
1744 * or _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001745 *
Camilla Berglund999f3552016-08-17 16:48:22 +02001746 * Once you have created the window, you can switch it between windowed and
1747 * full screen mode with @ref glfwSetWindowMonitor. If the window has an
1748 * OpenGL or OpenGL ES context, it will be unaffected.
1749 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001750 * By default, newly created windows use the placement recommended by the
1751 * window system. To create the window at a specific position, make it
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001752 * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
1753 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
1754 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001755 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001756 * As long as at least one full screen window is not iconified, the screensaver
1757 * is prohibited from starting.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001758 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001759 * Window systems put limits on window sizes. Very large or very small window
1760 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02001761 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001762 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001763 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02001764 * the initial value may vary depending on driver settings and defaults.
1765 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001766 * @param[in] width The desired width, in screen coordinates, of the window.
1767 * This must be greater than zero.
1768 * @param[in] height The desired height, in screen coordinates, of the window.
1769 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001770 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001771 * @param[in] monitor The monitor to use for full screen mode, or `NULL` for
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001772 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001773 * @param[in] share The window whose context to share resources with, or `NULL`
1774 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001775 * @return The handle of the created window, or `NULL` if an
1776 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001777 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001778 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1779 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
1780 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
1781 * GLFW_PLATFORM_ERROR.
1782 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001783 * @remark @win32 Window creation will fail if the Microsoft GDI software
1784 * OpenGL implementation is the only one available.
Camilla Berglund07db5da2013-09-26 19:15:36 +02001785 *
Camilla Berglund20bce152016-05-30 16:04:37 +02001786 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
1787 * will be set as the initial icon for the window. If no such icon is present,
1788 * the `IDI_WINLOGO` icon will be used instead. To set a different icon, see
1789 * @ref glfwSetWindowIcon.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001790 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001791 * @remark @win32 The context to share resources with must not be current on
1792 * any other thread.
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01001793 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001794 * @remark @osx The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01001795 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001796 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001797 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1798 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001799 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001800 * @remark @osx The first time a window is created the menu bar is populated
1801 * with common commands like Hide, Quit and About. The About entry opens
1802 * a minimal about dialog with information from the application's bundle. The
1803 * menu bar can be disabled with a
Camilla Berglund96d230b2014-10-07 02:15:36 +02001804 * [compile-time option](@ref compile_options_osx).
Camilla Berglund4591ad22014-09-18 15:03:29 +02001805 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001806 * @remark @osx On OS X 10.10 and later the window frame will not be rendered
1807 * at full resolution on Retina displays unless the `NSHighResolutionCapable`
1808 * key is enabled in the application bundle's `Info.plist`. For more
1809 * information, see
Camilla Berglund821f3e62015-03-16 22:39:14 +01001810 * [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 +02001811 * in the Mac Developer Library. The GLFW test and example programs use
1812 * a custom `Info.plist` template for this, which can be found as
1813 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01001814 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001815 * @remark @x11 Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001816 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02001817 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001818 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
1819 * a window to reach its requested state. This means you may not be able to
1820 * query the final size, position or other attributes directly after window
1821 * creation.
Camilla Berglund20ed0a12015-08-12 21:31:54 +02001822 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001823 * @reentrancy This function must not be called from a callback.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001824 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001825 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001826 *
1827 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001828 * @sa glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001829 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001830 * @since Added in version 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001831 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001832 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001833 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001834GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001835
1836/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001837 *
1838 * This function destroys the specified window and its context. On calling
1839 * this function, no further callbacks will be called for that window.
1840 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001841 * If the context of the specified window is current on the main thread, it is
1842 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001843 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001844 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001845 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001846 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1847 * GLFW_PLATFORM_ERROR.
1848 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001849 * @note The context of the specified window must not be current on any other
1850 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001851 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001852 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01001853 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001854 * @thread_safety This function must only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001855 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001856 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001857 * @sa glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001858 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001859 * @since Added in version 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001860 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001861 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001862 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001863GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001864
Camilla Berglund64afb192013-03-06 23:29:37 +01001865/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001866 *
1867 * This function returns the value of the close flag of the specified window.
1868 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001869 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01001870 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001871 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001872 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1873 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001874 * @thread_safety This function may be called from any thread. Access is not
1875 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001876 *
1877 * @sa @ref window_close
1878 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001879 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001880 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001881 * @ingroup window
1882 */
1883GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1884
Camilla Berglund64afb192013-03-06 23:29:37 +01001885/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001886 *
1887 * This function sets the value of the close flag of the specified window.
1888 * This can be used to override the user's attempt to close the window, or
1889 * to signal that it should be closed.
1890 *
Camilla Berglund64afb192013-03-06 23:29:37 +01001891 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01001892 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001893 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001894 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1895 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001896 * @thread_safety This function may be called from any thread. Access is not
1897 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001898 *
1899 * @sa @ref window_close
1900 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001901 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001902 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001903 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01001904 */
1905GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1906
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001907/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001908 *
1909 * This function sets the window title, encoded as UTF-8, of the specified
1910 * window.
1911 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001912 * @param[in] window The window whose title to change.
1913 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001914 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001915 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1916 * GLFW_PLATFORM_ERROR.
1917 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001918 * @remark @osx The window title will not be updated until the next time you
1919 * process events.
Camilla Berglund6412dcb2015-04-07 21:52:29 +02001920 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001921 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001922 *
1923 * @sa @ref window_title
1924 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001925 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001926 * @glfw3 Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001927 *
1928 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001929 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001930GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001931
Camilla Berglundb823f712016-03-07 14:55:30 +01001932/*! @brief Sets the icon for the specified window.
1933 *
1934 * This function sets the icon of the specified window. If passed an array of
1935 * candidate images, those of or closest to the sizes desired by the system are
1936 * selected. If no images are specified, the window reverts to its default
1937 * icon.
1938 *
1939 * The desired image sizes varies depending on platform and system settings.
1940 * The selected images will be rescaled as needed. Good sizes include 16x16,
1941 * 32x32 and 48x48.
1942 *
1943 * @param[in] window The window whose icon to set.
1944 * @param[in] count The number of images in the specified array, or zero to
1945 * revert to the default window icon.
1946 * @param[in] images The images to create the icon from. This is ignored if
1947 * count is zero.
1948 *
1949 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1950 * GLFW_PLATFORM_ERROR.
1951 *
1952 * @pointer_lifetime The specified image data is copied before this function
1953 * returns.
1954 *
1955 * @remark @osx The GLFW window has no icon, as it is not a document
Camilla Berglund20bce152016-05-30 16:04:37 +02001956 * window, so this function does nothing. The dock icon will be the same as
1957 * the application bundle's icon. For more information on bundles, see the
Camilla Berglundb823f712016-03-07 14:55:30 +01001958 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1959 * in the Mac Developer Library.
1960 *
1961 * @thread_safety This function must only be called from the main thread.
1962 *
1963 * @sa @ref window_icon
1964 *
1965 * @since Added in version 3.2.
1966 *
1967 * @ingroup window
1968 */
1969GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
1970
Camilla Berglund7c193232013-01-24 19:30:31 +01001971/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001972 *
1973 * This function retrieves the position, in screen coordinates, of the
1974 * upper-left corner of the client area of the specified window.
1975 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001976 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1977 * non-`NULL` position arguments will be set to zero.
1978 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001979 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001980 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
1981 * the client area, or `NULL`.
1982 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
1983 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01001984 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001985 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1986 * GLFW_PLATFORM_ERROR.
1987 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001988 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001989 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001990 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01001991 * @sa glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001992 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001993 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001994 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001995 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001996 */
1997GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
1998
1999/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002000 *
2001 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002002 * corner of the client area of the specified windowed mode window. If the
2003 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002004 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002005 * __Do not use this function__ to move an already visible window unless you
2006 * have very good reasons for doing so, as it will confuse and annoy the user.
2007 *
2008 * The window manager may put limits on what positions are allowed. GLFW
2009 * cannot and should not override these limits.
2010 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002011 * @param[in] window The window to query.
2012 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
2013 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01002014 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002015 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2016 * GLFW_PLATFORM_ERROR.
2017 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002018 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002019 *
2020 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01002021 * @sa glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002022 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002023 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002024 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002025 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002026 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002027 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01002028GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01002029
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002030/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002031 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002032 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002033 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002034 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002035 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002036 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2037 * non-`NULL` size arguments will be set to zero.
2038 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002039 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002040 * @param[out] width Where to store the width, in screen coordinates, of the
2041 * client area, or `NULL`.
2042 * @param[out] height Where to store the height, in screen coordinates, of the
2043 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002044 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002045 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2046 * GLFW_PLATFORM_ERROR.
2047 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002048 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002049 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002050 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002051 * @sa glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002052 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002053 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002054 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002055 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002056 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002057 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002058GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002059
Camilla Berglundd84772d2014-02-13 02:57:59 +01002060/*! @brief Sets the size limits of the specified window.
2061 *
2062 * This function sets the size limits of the client area of the specified
Emmanuel Gil Peyrotf0f5d9f2016-04-09 00:42:58 +01002063 * window. If the window is full screen, the size limits only take effect
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002064 * once it is made windowed. If the window is not resizable, this function
2065 * does nothing.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002066 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002067 * The size limits are applied immediately to a windowed mode window and may
2068 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002069 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002070 * The maximum dimensions must be greater than or equal to the minimum
2071 * dimensions and all must be greater than or equal to zero.
2072 *
Camilla Berglundd84772d2014-02-13 02:57:59 +01002073 * @param[in] window The window to set limits for.
2074 * @param[in] minwidth The minimum width, in screen coordinates, of the client
2075 * area, or `GLFW_DONT_CARE`.
2076 * @param[in] minheight The minimum height, in screen coordinates, of the
2077 * client area, or `GLFW_DONT_CARE`.
2078 * @param[in] maxwidth The maximum width, in screen coordinates, of the client
2079 * area, or `GLFW_DONT_CARE`.
2080 * @param[in] maxheight The maximum height, in screen coordinates, of the
2081 * client area, or `GLFW_DONT_CARE`.
2082 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002083 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2084 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
Camilla Berglundf51cf812016-02-05 00:51:40 +01002085 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002086 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002087 * results are undefined.
2088 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002089 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002090 *
2091 * @sa @ref window_sizelimits
2092 * @sa glfwSetWindowAspectRatio
2093 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002094 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002095 *
2096 * @ingroup window
2097 */
2098GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2099
2100/*! @brief Sets the aspect ratio of the specified window.
2101 *
2102 * This function sets the required aspect ratio of the client area of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002103 * specified window. If the window is full screen, the aspect ratio only takes
2104 * effect once it is made windowed. If the window is not resizable, this
Camilla Berglundd84772d2014-02-13 02:57:59 +01002105 * function does nothing.
2106 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002107 * The aspect ratio is specified as a numerator and a denominator and both
2108 * values must be greater than zero. For example, the common 16:9 aspect ratio
2109 * is specified as 16 and 9, respectively.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002110 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002111 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
2112 * ratio limit is disabled.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002113 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002114 * The aspect ratio is applied immediately to a windowed mode window and may
2115 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002116 *
2117 * @param[in] window The window to set limits for.
2118 * @param[in] numer The numerator of the desired aspect ratio, or
2119 * `GLFW_DONT_CARE`.
2120 * @param[in] denom The denominator of the desired aspect ratio, or
2121 * `GLFW_DONT_CARE`.
2122 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002123 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2124 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2125 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002126 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002127 * results are undefined.
2128 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002129 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002130 *
2131 * @sa @ref window_sizelimits
2132 * @sa glfwSetWindowSizeLimits
2133 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002134 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002135 *
2136 * @ingroup window
2137 */
2138GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2139
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002140/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002141 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002142 * This function sets the size, in screen coordinates, of the client area of
2143 * the specified window.
2144 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002145 * For full screen windows, this function updates the resolution of its desired
2146 * video mode and switches to the video mode closest to it, without affecting
2147 * the window's context. As the context is unaffected, the bit depths of the
2148 * framebuffer remain unchanged.
2149 *
2150 * If you wish to update the refresh rate of the desired video mode in addition
2151 * to its resolution, see @ref glfwSetWindowMonitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002152 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002153 * The window manager may put limits on what sizes are allowed. GLFW cannot
2154 * and should not override these limits.
2155 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002156 * @param[in] window The window to resize.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002157 * @param[in] width The desired width, in screen coordinates, of the window
2158 * client area.
2159 * @param[in] height The desired height, in screen coordinates, of the window
2160 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002161 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002162 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2163 * GLFW_PLATFORM_ERROR.
2164 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002165 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002166 *
2167 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002168 * @sa glfwGetWindowSize
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002169 * @sa glfwSetWindowMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002170 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002171 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002172 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002173 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002174 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002175 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002176GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002177
Camilla Berglund34981632013-06-03 12:51:57 +02002178/*! @brief Retrieves the size of the framebuffer of the specified window.
2179 *
2180 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002181 * specified window. If you wish to retrieve the size of the window in screen
2182 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02002183 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002184 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2185 * non-`NULL` size arguments will be set to zero.
2186 *
Camilla Berglund34981632013-06-03 12:51:57 +02002187 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002188 * @param[out] width Where to store the width, in pixels, of the framebuffer,
2189 * or `NULL`.
2190 * @param[out] height Where to store the height, in pixels, of the framebuffer,
2191 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02002192 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002193 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2194 * GLFW_PLATFORM_ERROR.
2195 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002196 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002197 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002198 * @sa @ref window_fbsize
Camilla Berglund34981632013-06-03 12:51:57 +02002199 * @sa glfwSetFramebufferSizeCallback
2200 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002201 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002202 *
Camilla Berglund34981632013-06-03 12:51:57 +02002203 * @ingroup window
2204 */
2205GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
2206
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002207/*! @brief Retrieves the size of the frame of the window.
2208 *
2209 * This function retrieves the size, in screen coordinates, of each edge of the
2210 * frame of the specified window. This size includes the title bar, if the
2211 * window has one. The size of the frame may vary depending on the
2212 * [window-related hints](@ref window_hints_wnd) used to create it.
2213 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002214 * Because this function retrieves the size of each window frame edge and not
2215 * the offset along a particular coordinate axis, the retrieved values will
2216 * always be zero or positive.
2217 *
2218 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2219 * non-`NULL` size arguments will be set to zero.
2220 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002221 * @param[in] window The window whose frame size to query.
2222 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002223 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002224 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02002225 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002226 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002227 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002228 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002229 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002230 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002231 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2232 * GLFW_PLATFORM_ERROR.
2233 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002234 * @thread_safety This function must only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002235 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002236 * @sa @ref window_size
2237 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002238 * @since Added in version 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002239 *
2240 * @ingroup window
2241 */
2242GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2243
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002244/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002245 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002246 * This function iconifies (minimizes) the specified window if it was
2247 * previously restored. If the window is already iconified, this function does
2248 * nothing.
2249 *
2250 * If the specified window is a full screen window, the original monitor
2251 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002252 *
2253 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002254 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002255 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2256 * GLFW_PLATFORM_ERROR.
2257 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002258 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002259 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002260 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002261 * @sa glfwRestoreWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002262 * @sa glfwMaximizeWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002263 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002264 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002265 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002266 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002267 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002268 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002269GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002270
2271/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002272 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002273 * This function restores the specified window if it was previously iconified
Camilla Berglunda10caa42015-10-13 12:50:59 +02002274 * (minimized) or maximized. If the window is already restored, this function
2275 * does nothing.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002276 *
2277 * If the specified window is a full screen window, the resolution chosen for
2278 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002279 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002280 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002281 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002282 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2283 * GLFW_PLATFORM_ERROR.
2284 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002285 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002286 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002287 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002288 * @sa glfwIconifyWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002289 * @sa glfwMaximizeWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01002290 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002291 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002292 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002293 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002294 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002295 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002296GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002297
Camilla Berglunda10caa42015-10-13 12:50:59 +02002298/*! @brief Maximizes the specified window.
2299 *
2300 * This function maximizes the specified window if it was previously not
2301 * maximized. If the window is already maximized, this function does nothing.
2302 *
2303 * If the specified window is a full screen window, this function does nothing.
2304 *
2305 * @param[in] window The window to maximize.
2306 *
Camilla Berglundf5b71f52016-05-27 14:20:39 +02002307 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2308 * GLFW_PLATFORM_ERROR.
2309 *
Camilla Berglunda10caa42015-10-13 12:50:59 +02002310 * @par Thread Safety
2311 * This function may only be called from the main thread.
2312 *
2313 * @sa @ref window_iconify
2314 * @sa glfwIconifyWindow
2315 * @sa glfwRestoreWindow
2316 *
2317 * @since Added in GLFW 3.2.
2318 *
2319 * @ingroup window
2320 */
2321GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
2322
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002323/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002324 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002325 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002326 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002327 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002328 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002329 * @param[in] window The window to make visible.
2330 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002331 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2332 * GLFW_PLATFORM_ERROR.
2333 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002334 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002335 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002336 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002337 * @sa glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002338 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002339 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002340 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002341 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002342 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002343GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002344
2345/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002346 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002347 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002348 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002349 * nothing.
2350 *
2351 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002352 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002353 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2354 * GLFW_PLATFORM_ERROR.
2355 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002356 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002357 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002358 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002359 * @sa glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002360 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002361 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002362 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002363 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002364 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002365GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002366
Camilla Berglundbaf57442016-02-21 15:42:49 +01002367/*! @brief Brings the specified window to front and sets input focus.
2368 *
2369 * This function brings the specified window to front and sets input focus.
2370 * The window should already be visible and not iconified.
2371 *
2372 * By default, both windowed and full screen mode windows are focused when
2373 * initially created. Set the [GLFW_FOCUSED](@ref window_hints_wnd) to disable
2374 * this behavior.
2375 *
2376 * __Do not use this function__ to steal focus from other applications unless
2377 * you are certain that is what the user wants. Focus stealing can be
2378 * extremely disruptive.
2379 *
2380 * @param[in] window The window to give input focus.
2381 *
2382 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2383 * GLFW_PLATFORM_ERROR.
2384 *
2385 * @thread_safety This function must only be called from the main thread.
2386 *
2387 * @sa @ref window_focus
2388 *
2389 * @since Added in version 3.2.
2390 *
2391 * @ingroup window
2392 */
2393GLFWAPI void glfwFocusWindow(GLFWwindow* window);
2394
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002395/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002396 *
2397 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002398 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002399 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002400 * @param[in] window The window to query.
Camilla Berglund999f3552016-08-17 16:48:22 +02002401 * @return The monitor, or `NULL` if the window is in windowed mode or an
2402 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002403 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002404 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2405 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002406 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002407 *
2408 * @sa @ref window_monitor
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002409 * @sa glfwSetWindowMonitor
Camilla Berglund4591ad22014-09-18 15:03:29 +02002410 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002411 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002412 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002413 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002414 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002415GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002416
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002417/*! @brief Sets the mode, monitor, video mode and placement of a window.
2418 *
2419 * This function sets the monitor that the window uses for full screen mode or,
2420 * if the monitor is `NULL`, makes it windowed mode.
2421 *
2422 * When setting a monitor, this function updates the width, height and refresh
2423 * rate of the desired video mode and switches to the video mode closest to it.
2424 * The window position is ignored when setting a monitor.
2425 *
2426 * When the monitor is `NULL`, the position, width and height are used to
2427 * place the window client area. The refresh rate is ignored when no monitor
2428 * is specified.
2429 *
2430 * If you only wish to update the resolution of a full screen window or the
2431 * size of a windowed mode window, see @ref glfwSetWindowSize.
2432 *
2433 * When a window transitions from full screen to windowed mode, this function
2434 * restores any previous window settings such as whether it is decorated,
2435 * floating, resizable, has size or aspect ratio limits, etc..
2436 *
2437 * @param[in] window The window whose monitor, size or video mode to set.
2438 * @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
2439 * @param[in] xpos The desired x-coordinate of the upper-left corner of the
2440 * client area.
2441 * @param[in] ypos The desired y-coordinate of the upper-left corner of the
2442 * client area.
2443 * @param[in] width The desired with, in screen coordinates, of the client area
2444 * or video mode.
2445 * @param[in] height The desired height, in screen coordinates, of the client
2446 * area or video mode.
Camilla Berglund325729d2016-05-22 14:25:04 +02002447 * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
2448 * or `GLFW_DONT_CARE`.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002449 *
2450 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2451 * GLFW_PLATFORM_ERROR.
2452 *
2453 * @thread_safety This function must only be called from the main thread.
2454 *
2455 * @sa @ref window_monitor
2456 * @sa @ref window_full_screen
2457 * @sa glfwGetWindowMonitor
2458 * @sa glfwSetWindowSize
2459 *
2460 * @since Added in version 3.2.
2461 *
2462 * @ingroup window
2463 */
2464GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
2465
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002466/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002467 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002468 * This function returns the value of an attribute of the specified window or
2469 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002470 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002471 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002472 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2473 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002474 * @return The value of the attribute, or zero if an
2475 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002476 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002477 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2478 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2479 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002480 * @remark Framebuffer related hints are not window attributes. See @ref
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002481 * window_attribs_fb for more information.
2482 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002483 * @remark Zero is a valid value for many window and context related
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002484 * attributes so you cannot use a return value of zero as an indication of
2485 * errors. However, this function should not fail as long as it is passed
2486 * valid arguments and the library has been [initialized](@ref intro_init).
2487 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002488 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002489 *
2490 * @sa @ref window_attribs
2491 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002492 * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
Camilla Berglund4188c262015-01-18 01:55:25 +01002493 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002494 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002495 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002496 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002497GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002498
2499/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002500 *
2501 * This function sets the user-defined pointer of the specified window. The
2502 * current value is retained until the window is destroyed. The initial value
2503 * is `NULL`.
2504 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002505 * @param[in] window The window whose pointer to set.
2506 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002507 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002508 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2509 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002510 * @thread_safety This function may be called from any thread. Access is not
2511 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002512 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002513 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002514 * @sa glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002515 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002516 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002517 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002518 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002519 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002520GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002521
2522/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002523 *
2524 * This function returns the current value of the user-defined pointer of the
2525 * specified window. The initial value is `NULL`.
2526 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002527 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002528 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002529 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2530 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002531 * @thread_safety This function may be called from any thread. Access is not
2532 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002533 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002534 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002535 * @sa glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002536 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002537 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002538 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002539 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002540 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002541GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002542
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002543/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002544 *
2545 * This function sets the position callback of the specified window, which is
2546 * called when the window is moved. The callback is provided with the screen
2547 * position of the upper-left corner of the client area of the window.
2548 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002549 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002550 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002551 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002552 * @return The previously set callback, or `NULL` if no callback was set or the
2553 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002554 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002555 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2556 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002557 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002558 *
2559 * @sa @ref window_pos
2560 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002561 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002562 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002563 * @ingroup window
2564 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002565GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002566
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002567/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002568 *
2569 * This function sets the size callback of the specified window, which is
2570 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002571 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002572 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002573 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002574 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002575 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002576 * @return The previously set callback, or `NULL` if no callback was set or the
2577 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002578 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002579 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2580 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002581 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002582 *
2583 * @sa @ref window_size
2584 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002585 * @since Added in version 1.0.
2586 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002587 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002588 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002589 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002590GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002591
2592/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002593 *
2594 * This function sets the close callback of the specified window, which is
2595 * called when the user attempts to close the window, for example by clicking
2596 * the close widget in the title bar.
2597 *
2598 * The close flag is set before this callback is called, but you can modify it
2599 * at any time with @ref glfwSetWindowShouldClose.
2600 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002601 * The close callback is not triggered by @ref glfwDestroyWindow.
2602 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002603 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002604 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002605 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002606 * @return The previously set callback, or `NULL` if no callback was set or the
2607 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002608 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002609 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2610 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002611 * @remark @osx Selecting Quit from the application menu will trigger the close
2612 * callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002613 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002614 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002615 *
2616 * @sa @ref window_close
2617 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002618 * @since Added in version 2.5.
2619 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002620 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002621 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002622 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002623GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002624
2625/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002626 *
2627 * This function sets the refresh callback of the specified window, which is
2628 * called when the client area of the window needs to be redrawn, for example
2629 * if the window has been exposed after having been covered by another window.
2630 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002631 * On compositing window systems such as Aero, Compiz or Aqua, where the window
2632 * contents are saved off-screen, this callback may be called only very
2633 * infrequently or never at all.
2634 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002635 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002636 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002637 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002638 * @return The previously set callback, or `NULL` if no callback was set or the
2639 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002640 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002641 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2642 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002643 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002644 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002645 * @sa @ref window_refresh
2646 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002647 * @since Added in version 2.5.
2648 * @glfw3 Added window handle parameter and return value.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002649 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002650 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002651 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002652GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002653
2654/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002655 *
2656 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01002657 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002658 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002659 * After the focus callback is called for a window that lost input focus,
2660 * synthetic key and mouse button release events will be generated for all such
2661 * that had been pressed. For more information, see @ref glfwSetKeyCallback
2662 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02002663 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002664 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002665 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002666 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002667 * @return The previously set callback, or `NULL` if no callback was set or the
2668 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002669 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002670 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2671 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002672 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002673 *
2674 * @sa @ref window_focus
2675 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002676 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002677 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002678 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002679 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002680GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002681
2682/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002683 *
2684 * This function sets the iconification callback of the specified window, which
2685 * is called when the window is iconified or restored.
2686 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002687 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002688 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002689 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002690 * @return The previously set callback, or `NULL` if no callback was set or the
2691 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002692 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002693 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2694 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002695 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002696 *
2697 * @sa @ref window_iconify
2698 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002699 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002700 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002701 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002702 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002703GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02002704
Camilla Berglund34981632013-06-03 12:51:57 +02002705/*! @brief Sets the framebuffer resize callback for the specified window.
2706 *
2707 * This function sets the framebuffer resize callback of the specified window,
2708 * which is called when the framebuffer of the specified window is resized.
2709 *
2710 * @param[in] window The window whose callback to set.
2711 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2712 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002713 * @return The previously set callback, or `NULL` if no callback was set or the
2714 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02002715 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002716 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2717 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002718 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002719 *
2720 * @sa @ref window_fbsize
2721 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002722 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002723 *
Camilla Berglund34981632013-06-03 12:51:57 +02002724 * @ingroup window
2725 */
2726GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
2727
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002728/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002729 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002730 * This function processes only those events that are already in the event
2731 * queue and then returns immediately. Processing events will cause the window
2732 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002733 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002734 * On some platforms, a window move, resize or menu operation will cause event
2735 * processing to block. This is due to how event processing is designed on
2736 * those platforms. You can use the
2737 * [window refresh callback](@ref window_refresh) to redraw the contents of
2738 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002739 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002740 * On some platforms, certain events are sent directly to the application
2741 * without going through the event queue, causing callbacks to be called
2742 * outside of a call to one of the event processing functions.
Camilla Berglund401033c2013-03-12 19:17:07 +01002743 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002744 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002745 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002746 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2747 * GLFW_PLATFORM_ERROR.
2748 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002749 * @reentrancy This function must not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01002750 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002751 * @thread_safety This function must only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02002752 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002753 * @sa @ref events
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002754 * @sa glfwWaitEvents
Camilla Berglund56208952016-02-02 21:11:16 +01002755 * @sa glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002756 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002757 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002758 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002759 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002760 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002761GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002762
Camilla Berglund4591ad22014-09-18 15:03:29 +02002763/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002764 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002765 * This function puts the calling thread to sleep until at least one event is
2766 * available in the event queue. Once one or more events are available,
2767 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
2768 * are processed and the function then returns immediately. Processing events
2769 * will cause the window and input callbacks associated with those events to be
2770 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02002771 *
2772 * Since not all events are associated with callbacks, this function may return
2773 * without a callback having been called even if you are monitoring all
2774 * callbacks.
2775 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002776 * On some platforms, a window move, resize or menu operation will cause event
2777 * processing to block. This is due to how event processing is designed on
2778 * those platforms. You can use the
2779 * [window refresh callback](@ref window_refresh) to redraw the contents of
2780 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002781 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002782 * On some platforms, certain callbacks may be called outside of a call to one
2783 * of the event processing functions.
2784 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002785 * If no windows exist, this function returns immediately. For synchronization
2786 * of threads in applications that do not create windows, use your threading
2787 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01002788 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002789 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002790 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002791 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2792 * GLFW_PLATFORM_ERROR.
2793 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002794 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01002795 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002796 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002797 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002798 * @sa @ref events
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002799 * @sa glfwPollEvents
Camilla Berglund56208952016-02-02 21:11:16 +01002800 * @sa glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002801 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002802 * @since Added in version 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002803 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002804 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002805 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002806GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02002807
Camilla Berglund56208952016-02-02 21:11:16 +01002808/*! @brief Waits with timeout until events are queued and processes them.
2809 *
2810 * This function puts the calling thread to sleep until at least one event is
2811 * available in the event queue, or until the specified timeout is reached. If
2812 * one or more events are available, it behaves exactly like @ref
2813 * glfwPollEvents, i.e. the events in the queue are processed and the function
2814 * then returns immediately. Processing events will cause the window and input
2815 * callbacks associated with those events to be called.
2816 *
2817 * The timeout value must be a positive finite number.
2818 *
2819 * Since not all events are associated with callbacks, this function may return
2820 * without a callback having been called even if you are monitoring all
2821 * callbacks.
2822 *
2823 * On some platforms, a window move, resize or menu operation will cause event
2824 * processing to block. This is due to how event processing is designed on
2825 * those platforms. You can use the
2826 * [window refresh callback](@ref window_refresh) to redraw the contents of
2827 * your window when necessary during such operations.
2828 *
2829 * On some platforms, certain callbacks may be called outside of a call to one
2830 * of the event processing functions.
2831 *
2832 * If no windows exist, this function returns immediately. For synchronization
2833 * of threads in applications that do not create windows, use your threading
2834 * library of choice.
2835 *
2836 * Event processing is not required for joystick input to work.
2837 *
2838 * @param[in] timeout The maximum amount of time, in seconds, to wait.
2839 *
2840 * @reentrancy This function must not be called from a callback.
2841 *
2842 * @thread_safety This function must only be called from the main thread.
2843 *
2844 * @sa @ref events
2845 * @sa glfwPollEvents
2846 * @sa glfwWaitEvents
2847 *
2848 * @since Added in version 3.2.
2849 *
2850 * @ingroup window
2851 */
2852GLFWAPI void glfwWaitEventsTimeout(double timeout);
2853
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002854/*! @brief Posts an empty event to the event queue.
2855 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002856 * This function posts an empty event from the current thread to the event
Camilla Berglund73abf8a2016-07-06 13:06:59 +02002857 * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002858 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002859 * If no windows exist, this function returns immediately. For synchronization
2860 * of threads in applications that do not create windows, use your threading
2861 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002862 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002863 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2864 * GLFW_PLATFORM_ERROR.
2865 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002866 * @thread_safety This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002867 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002868 * @sa @ref events
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002869 * @sa glfwWaitEvents
Camilla Berglund73abf8a2016-07-06 13:06:59 +02002870 * @sa glfwWaitEventsTimeout
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002871 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002872 * @since Added in version 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002873 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002874 * @ingroup window
2875 */
2876GLFWAPI void glfwPostEmptyEvent(void);
2877
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002878/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002879 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002880 * This function returns the value of an input option for the specified window.
2881 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2882 * `GLFW_STICKY_MOUSE_BUTTONS`.
2883 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002884 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02002885 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002886 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002887 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002888 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2889 * GLFW_INVALID_ENUM.
2890 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002891 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002892 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002893 * @sa glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002894 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002895 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002896 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002897 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002898 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002899GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002900
2901/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002902 *
2903 * This function sets an input mode option for the specified window. The mode
2904 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund71d2b572013-03-12 15:33:05 +01002905 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002906 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002907 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002908 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02002909 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
2910 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund4188c262015-01-18 01:55:25 +01002911 * area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01002912 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
2913 * and unlimited cursor movement. This is useful for implementing for
2914 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002915 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02002916 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
2917 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02002918 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
2919 * the next time it is called even if the key had been released before the
2920 * call. This is useful when you are only interested in whether keys have been
2921 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002922 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002923 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02002924 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
2925 * If sticky mouse buttons are enabled, a mouse button press will ensure that
2926 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
2927 * if the mouse button had been released before the call. This is useful when
2928 * you are only interested in whether mouse buttons have been pressed but not
2929 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002930 *
2931 * @param[in] window The window whose input mode to set.
2932 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2933 * `GLFW_STICKY_MOUSE_BUTTONS`.
2934 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002935 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002936 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2937 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2938 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002939 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002940 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002941 * @sa glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01002942 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002943 * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002944 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002945 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002946 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002947GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002948
Camilla Berglund9c315412015-07-02 14:24:50 +02002949/*! @brief Returns the localized name of the specified printable key.
2950 *
2951 * This function returns the localized name of the specified printable key.
Camilla Berglund70ffae72016-02-22 11:54:56 +01002952 * This is intended for displaying key bindings to the user.
Camilla Berglund9c315412015-07-02 14:24:50 +02002953 *
Camilla Berglund70ffae72016-02-22 11:54:56 +01002954 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used instead, otherwise
2955 * the scancode is ignored. If a non-printable key or (if the key is
2956 * `GLFW_KEY_UNKNOWN`) a scancode that maps to a non-printable key is
2957 * specified, this function returns `NULL`.
2958 *
2959 * This behavior allows you to pass in the arguments passed to the
2960 * [key callback](@ref input_key) without modification.
2961 *
2962 * The printable keys are:
2963 * - `GLFW_KEY_APOSTROPHE`
2964 * - `GLFW_KEY_COMMA`
2965 * - `GLFW_KEY_MINUS`
2966 * - `GLFW_KEY_PERIOD`
2967 * - `GLFW_KEY_SLASH`
2968 * - `GLFW_KEY_SEMICOLON`
2969 * - `GLFW_KEY_EQUAL`
2970 * - `GLFW_KEY_LEFT_BRACKET`
2971 * - `GLFW_KEY_RIGHT_BRACKET`
2972 * - `GLFW_KEY_BACKSLASH`
2973 * - `GLFW_KEY_WORLD_1`
2974 * - `GLFW_KEY_WORLD_2`
2975 * - `GLFW_KEY_0` to `GLFW_KEY_9`
2976 * - `GLFW_KEY_A` to `GLFW_KEY_Z`
2977 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
2978 * - `GLFW_KEY_KP_DECIMAL`
2979 * - `GLFW_KEY_KP_DIVIDE`
2980 * - `GLFW_KEY_KP_MULTIPLY`
2981 * - `GLFW_KEY_KP_SUBTRACT`
2982 * - `GLFW_KEY_KP_ADD`
2983 * - `GLFW_KEY_KP_EQUAL`
Camilla Berglund9c315412015-07-02 14:24:50 +02002984 *
2985 * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
2986 * @param[in] scancode The scancode of the key to query.
Camilla Berglund70ffae72016-02-22 11:54:56 +01002987 * @return The localized name of the key, or `NULL`.
Camilla Berglund9c315412015-07-02 14:24:50 +02002988 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002989 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2990 * GLFW_PLATFORM_ERROR.
2991 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002992 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
2993 * should not free it yourself. It is valid until the next call to @ref
2994 * glfwGetKeyName, or until the library is terminated.
Camilla Berglund9c315412015-07-02 14:24:50 +02002995 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002996 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9c315412015-07-02 14:24:50 +02002997 *
2998 * @sa @ref input_key_name
2999 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003000 * @since Added in version 3.2.
Camilla Berglund9c315412015-07-02 14:24:50 +02003001 *
3002 * @ingroup input
3003 */
3004GLFWAPI const char* glfwGetKeyName(int key, int scancode);
3005
Michael Stockere745b0d2016-08-11 19:11:40 +02003006/*! @brief Returns the platform dependent scancode of the specified key.
3007 *
3008 * This function returns the platform dependent scancode of the specified key.
3009 * This is intended for platform specific default keybindings.
3010 *
3011 * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
3012 * method will return `-1`.
3013 *
3014 * @param[in] key The key to query.
3015 * @return The platform dependent scancode for the key, or `-1`.
3016 *
3017 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3018 * GLFW_PLATFORM_ERROR.
3019 *
3020 * @thread_safety This function may be called from any thread.
3021 *
3022 * @sa @ref input_key_scancode
3023 *
3024 * @since Added in version 3.3.
3025 *
3026 * @ingroup input
3027 */
3028GLFWAPI const short int glfwGetKeyScancode(int key);
3029
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003030/*! @brief Returns the last reported state of a keyboard key for the specified
3031 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003032 *
3033 * This function returns the last state reported for the specified key to the
3034 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02003035 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003036 * the key callback.
3037 *
3038 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02003039 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
3040 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003041 *
3042 * The key functions deal with physical keys, with [key tokens](@ref keys)
3043 * named after their use on the standard US keyboard layout. If you want to
3044 * input text, use the Unicode character callback instead.
3045 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003046 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
3047 * used with this function.
3048 *
Camilla Berglund9c315412015-07-02 14:24:50 +02003049 * __Do not use this function__ to implement [text input](@ref input_char).
3050 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003051 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003052 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
3053 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003054 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003055 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003056 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3057 * GLFW_INVALID_ENUM.
3058 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003059 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003060 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003061 * @sa @ref input_key
3062 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003063 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003064 * @glfw3 Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003065 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003066 * @ingroup input
3067 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003068GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003069
3070/*! @brief Returns the last reported state of a mouse button for the specified
3071 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003072 *
3073 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003074 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003075 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003076 *
3077 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02003078 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
3079 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003080 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003081 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003082 * @param[in] button The desired [mouse button](@ref buttons).
3083 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003084 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003085 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3086 * GLFW_INVALID_ENUM.
3087 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003088 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003089 *
3090 * @sa @ref input_mouse_button
3091 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003092 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003093 * @glfw3 Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01003094 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003095 * @ingroup input
3096 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003097GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003098
Camilla Berglundd4591452014-02-11 18:24:01 +01003099/*! @brief Retrieves the position of the cursor relative to the client area of
3100 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003101 *
Camilla Berglundd4591452014-02-11 18:24:01 +01003102 * This function returns the position of the cursor, in screen coordinates,
3103 * relative to the upper-left corner of the client area of the specified
3104 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003105 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02003106 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
3107 * position is unbounded and limited only by the minimum and maximum values of
3108 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003109 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02003110 * The coordinate can be converted to their integer equivalents with the
3111 * `floor` function. Casting directly to an integer type works for positive
3112 * coordinates, but fails for negative ones.
3113 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003114 * Any or all of the position arguments may be `NULL`. If an error occurs, all
3115 * non-`NULL` position arguments will be set to zero.
3116 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003117 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003118 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
3119 * left edge of the client area, or `NULL`.
3120 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
3121 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003122 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003123 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3124 * GLFW_PLATFORM_ERROR.
3125 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003126 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003127 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003128 * @sa @ref cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003129 * @sa glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003130 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003131 * @since Added in version 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003132 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003133 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003134 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003135GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003136
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003137/*! @brief Sets the position of the cursor, relative to the client area of the
3138 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003139 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003140 * This function sets the position, in screen coordinates, of the cursor
3141 * relative to the upper-left corner of the client area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01003142 * window. The window must have input focus. If the window does not have
3143 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003144 *
Camilla Berglund20858762015-01-01 18:41:22 +01003145 * __Do not use this function__ to implement things like camera controls. GLFW
3146 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
3147 * cursor, transparently re-centers it and provides unconstrained cursor
3148 * motion. See @ref glfwSetInputMode for more information.
3149 *
3150 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
3151 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02003152 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003153 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003154 * @param[in] window The desired window.
3155 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003156 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003157 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003158 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003159 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003160 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3161 * GLFW_PLATFORM_ERROR.
3162 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003163 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003164 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003165 * @sa @ref cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003166 * @sa glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003167 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003168 * @since Added in version 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003169 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003170 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003171 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003172GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003173
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003174/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03003175 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003176 * Creates a new custom cursor image that can be set for a window with @ref
3177 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
3178 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003179 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02003180 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
3181 * bits per channel. They are arranged canonically as packed sequential rows,
3182 * starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01003183 *
3184 * The cursor hotspot is specified in pixels, relative to the upper-left corner
3185 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
3186 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003187 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003188 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01003189 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
3190 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
Camilla Berglund4188c262015-01-18 01:55:25 +01003191 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02003192 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03003193 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003194 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3195 * GLFW_PLATFORM_ERROR.
3196 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003197 * @pointer_lifetime The specified image data is copied before this function
3198 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003199 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003200 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003201 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003202 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003203 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003204 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003205 * @sa glfwDestroyCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003206 * @sa glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003207 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003208 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003209 *
3210 * @ingroup input
3211 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003212GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03003213
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003214/*! @brief Creates a cursor with a standard shape.
3215 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003216 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
3217 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003218 *
3219 * @param[in] shape One of the [standard shapes](@ref shapes).
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003220 * @return A new cursor ready to use or `NULL` if an
3221 * [error](@ref error_handling) occurred.
3222 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003223 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3224 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3225 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003226 * @reentrancy This function must not be called from a callback.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003227 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003228 * @thread_safety This function must only be called from the main thread.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003229 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003230 * @sa @ref cursor_object
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003231 * @sa glfwCreateCursor
3232 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003233 * @since Added in version 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003234 *
3235 * @ingroup input
3236 */
3237GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
3238
urraka40c04a72013-12-04 10:19:22 -03003239/*! @brief Destroys a cursor.
3240 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003241 * This function destroys a cursor previously created with @ref
3242 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
3243 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03003244 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003245 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03003246 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003247 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3248 * GLFW_PLATFORM_ERROR.
3249 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003250 * @reentrancy This function must not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003251 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003252 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003253 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003254 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003255 * @sa glfwCreateCursor
3256 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003257 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003258 *
3259 * @ingroup input
3260 */
3261GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
3262
Camilla Berglund4188c262015-01-18 01:55:25 +01003263/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03003264 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003265 * This function sets the cursor image to be used when the cursor is over the
3266 * client area of the specified window. The set cursor will only be visible
3267 * when the [cursor mode](@ref cursor_mode) of the window is
3268 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003269 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003270 * On some platforms, the set cursor may not be visible unless the window also
3271 * has input focus.
3272 *
3273 * @param[in] window The window to set the cursor for.
3274 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
3275 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03003276 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003277 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3278 * GLFW_PLATFORM_ERROR.
3279 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003280 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003281 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003282 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003283 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003284 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003285 *
urraka40c04a72013-12-04 10:19:22 -03003286 * @ingroup input
3287 */
3288GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
3289
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003290/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003291 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003292 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003293 * when a key is pressed, repeated or released.
3294 *
Camilla Berglund948cc042013-04-16 02:02:22 +02003295 * The key functions deal with physical keys, with layout independent
3296 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003297 * layout. If you want to input text, use the
3298 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003299 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003300 * When a window loses input focus, it will generate synthetic key release
3301 * events for all pressed keys. You can tell these events from user-generated
3302 * events by the fact that the synthetic ones are generated after the focus
3303 * loss event has been processed, i.e. after the
3304 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003305 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02003306 * The scancode of a key is specific to that platform or sometimes even to that
3307 * machine. Scancodes are intended to allow users to bind keys that don't have
3308 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02003309 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003310 *
3311 * Sometimes GLFW needs to generate synthetic key events, in which case the
3312 * scancode may be zero.
3313 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003314 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003315 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003316 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003317 * @return The previously set callback, or `NULL` if no callback was set or the
3318 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003319 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003320 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3321 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003322 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003323 *
3324 * @sa @ref input_key
3325 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003326 * @since Added in version 1.0.
3327 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003328 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003329 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003330 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003331GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003332
3333/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003334 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003335 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003336 * called when a Unicode character is input.
3337 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003338 * The character callback is intended for Unicode text input. As it deals with
3339 * characters, it is keyboard layout dependent, whereas the
3340 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
3341 * to physical keys, as a key may produce zero, one or more characters. If you
3342 * want to know whether a specific physical key was pressed or released, see
3343 * the key callback instead.
3344 *
3345 * The character callback behaves as system text input normally does and will
3346 * not be called if modifier keys are held down that would prevent normal text
3347 * input on that platform, for example a Super (Command) key on OS X or Alt key
3348 * on Windows. There is a
3349 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
3350 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003351 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003352 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003353 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003354 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003355 * @return The previously set callback, or `NULL` if no callback was set or the
3356 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003357 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003358 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
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 *
3362 * @sa @ref input_char
3363 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003364 * @since Added in version 2.4.
3365 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003366 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003367 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003368 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003369GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003370
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003371/*! @brief Sets the Unicode character with modifiers callback.
3372 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003373 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003374 * window, which is called when a Unicode character is input regardless of what
3375 * modifier keys are used.
3376 *
3377 * The character with modifiers callback is intended for implementing custom
3378 * Unicode character input. For regular Unicode text input, see the
3379 * [character callback](@ref glfwSetCharCallback). Like the character
3380 * callback, the character with modifiers callback deals with characters and is
3381 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
3382 * a key may produce zero, one or more characters. If you want to know whether
3383 * a specific physical key was pressed or released, see the
3384 * [key callback](@ref glfwSetKeyCallback) instead.
3385 *
3386 * @param[in] window The window whose callback to set.
3387 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3388 * callback.
3389 * @return The previously set callback, or `NULL` if no callback was set or an
Camilla Berglund999f3552016-08-17 16:48:22 +02003390 * [error](@ref error_handling) occurred.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003391 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003392 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3393 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003394 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003395 *
3396 * @sa @ref input_char
3397 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003398 * @since Added in version 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003399 *
3400 * @ingroup input
3401 */
3402GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
3403
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003404/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003405 *
3406 * This function sets the mouse button callback of the specified window, which
3407 * is called when a mouse button is pressed or released.
3408 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003409 * When a window loses input focus, it will generate synthetic mouse button
3410 * release events for all pressed mouse buttons. You can tell these events
3411 * from user-generated events by the fact that the synthetic ones are generated
3412 * after the focus loss event has been processed, i.e. after the
3413 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003414 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003415 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003416 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003417 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003418 * @return The previously set callback, or `NULL` if no callback was set or the
3419 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003420 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003421 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3422 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003423 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003424 *
3425 * @sa @ref input_mouse_button
3426 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003427 * @since Added in version 1.0.
3428 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003429 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003430 * @ingroup input
3431 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003432GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003433
3434/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003435 *
3436 * This function sets the cursor position callback of the specified window,
3437 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003438 * position, in screen coordinates, relative to the upper-left corner of the
3439 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003440 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003441 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003442 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003443 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003444 * @return The previously set callback, or `NULL` if no callback was set or the
3445 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003446 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003447 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3448 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003449 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003450 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003451 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02003452 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003453 * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003454 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003455 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003456 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003457GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003458
3459/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003460 *
3461 * This function sets the cursor boundary crossing callback of the specified
3462 * window, which is called when the cursor enters or leaves the client area of
3463 * the window.
3464 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003465 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003466 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003467 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003468 * @return The previously set callback, or `NULL` if no callback was set or the
3469 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003470 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003471 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3472 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003473 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003474 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003475 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02003476 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003477 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003478 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003479 * @ingroup input
3480 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003481GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003482
3483/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003484 *
3485 * This function sets the scroll callback of the specified window, which is
3486 * called when a scrolling device is used, such as a mouse wheel or scrolling
3487 * area of a touchpad.
3488 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003489 * The scroll callback receives all scrolling input, like that from a mouse
3490 * wheel or a touchpad scrolling area.
3491 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003492 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003493 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003494 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003495 * @return The previously set callback, or `NULL` if no callback was set or the
3496 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003497 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003498 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3499 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003500 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003501 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003502 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02003503 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003504 * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003505 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003506 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003507 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003508GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02003509
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003510/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02003511 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003512 * This function sets the file drop callback of the specified window, which is
3513 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02003514 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003515 * Because the path array and its strings may have been generated specifically
3516 * for that event, they are not guaranteed to be valid after the callback has
3517 * returned. If you wish to use them after the callback returns, you need to
3518 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02003519 *
3520 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003521 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
3522 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003523 * @return The previously set callback, or `NULL` if no callback was set or the
3524 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02003525 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003526 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3527 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003528 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003529 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003530 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02003531 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003532 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003533 *
arturo89d07232013-07-10 11:42:14 +02003534 * @ingroup input
3535 */
3536GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
3537
Camilla Berglundfdd45182013-05-27 15:13:09 +02003538/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003539 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02003540 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003541 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003542 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003543 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003544 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003545 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3546 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3547 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003548 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003549 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003550 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02003551 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003552 * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003553 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003554 * @ingroup input
3555 */
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003556GLFWAPI int glfwJoystickPresent(int joy);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003557
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003558/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003559 *
3560 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003561 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003562 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003563 * Querying a joystick slot with no device present is not an error, but will
3564 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3565 * check device presence.
3566 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003567 * @param[in] joy The [joystick](@ref joysticks) to query.
3568 * @param[out] count Where to store the number of axis values in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02003569 * array. This is set to zero if the joystick is not present or an error
3570 * occurred.
3571 * @return An array of axis values, or `NULL` if the joystick is not present or
3572 * an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003573 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003574 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3575 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3576 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003577 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3578 * should not free it yourself. It is valid until the specified joystick is
3579 * disconnected, this function is called again for that joystick or the library
3580 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003581 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003582 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003583 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003584 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02003585 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003586 * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003587 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003588 * @ingroup input
3589 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003590GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003591
Camilla Berglunde93bade2013-06-16 02:33:33 +02003592/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003593 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02003594 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003595 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003596 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003597 * Querying a joystick slot with no device present is not an error, but will
3598 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3599 * check device presence.
3600 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003601 * @param[in] joy The [joystick](@ref joysticks) to query.
3602 * @param[out] count Where to store the number of button states in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02003603 * array. This is set to zero if the joystick is not present or an error
3604 * occurred.
3605 * @return An array of button states, or `NULL` if the joystick is not present
3606 * or an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003607 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003608 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3609 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3610 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003611 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3612 * should not free it yourself. It is valid until the specified joystick is
3613 * disconnected, this function is called again for that joystick or the library
3614 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003615 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003616 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003617 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003618 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003619 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003620 * @since Added in version 2.2.
Camilla Berglund951a9582016-01-31 21:32:14 +01003621 * @glfw3 Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003622 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003623 * @ingroup input
3624 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003625GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02003626
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003627/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003628 *
3629 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003630 * The returned string is allocated and freed by GLFW. You should not free it
3631 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003632 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003633 * Querying a joystick slot with no device present is not an error, but will
3634 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3635 * check device presence.
3636 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003637 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003638 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund999f3552016-08-17 16:48:22 +02003639 * is not present or an [error](@ref error_handling) occurred.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01003640 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003641 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3642 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3643 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003644 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3645 * should not free it yourself. It is valid until the specified joystick is
3646 * disconnected, this function is called again for that joystick or the library
3647 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003648 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003649 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003650 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003651 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02003652 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003653 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003654 *
3655 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003656 */
Camilla Berglund93a1d1c2012-09-07 01:01:34 +02003657GLFWAPI const char* glfwGetJoystickName(int joy);
Camilla Berglund3249f812010-09-07 17:34:51 +02003658
Camilla Berglund8a7fa302015-12-13 17:38:50 +01003659/*! @brief Sets the joystick configuration callback.
3660 *
3661 * This function sets the joystick configuration callback, or removes the
3662 * currently set callback. This is called when a joystick is connected to or
3663 * disconnected from the system.
3664 *
3665 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3666 * callback.
3667 * @return The previously set callback, or `NULL` if no callback was set or the
3668 * library had not been [initialized](@ref intro_init).
3669 *
3670 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3671 *
3672 * @thread_safety This function must only be called from the main thread.
3673 *
3674 * @sa @ref joystick_event
3675 *
3676 * @since Added in version 3.2.
3677 *
3678 * @ingroup input
3679 */
3680GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
3681
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003682/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003683 *
3684 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02003685 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003686 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003687 * @param[in] window The window that will own the clipboard contents.
3688 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003689 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003690 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3691 * GLFW_PLATFORM_ERROR.
3692 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003693 * @pointer_lifetime The specified string is copied before this function
3694 * returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003695 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003696 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003697 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003698 * @sa @ref clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003699 * @sa glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003700 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003701 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003702 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003703 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003704 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003705GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003706
Camilla Berglund4591ad22014-09-18 15:03:29 +02003707/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003708 *
3709 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02003710 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02003711 * if its contents cannot be converted, `NULL` is returned and a @ref
3712 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003713 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003714 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003715 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02003716 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003717 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003718 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3719 * GLFW_PLATFORM_ERROR.
3720 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003721 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3722 * should not free it yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02003723 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
3724 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003725 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003726 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003727 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003728 * @sa @ref clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003729 * @sa glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003730 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003731 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003732 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003733 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003734 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003735GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01003736
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003737/*! @brief Returns the value of the GLFW timer.
3738 *
3739 * This function returns the value of the GLFW timer. Unless the timer has
3740 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
3741 * was initialized.
3742 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003743 * The resolution of the timer is system dependent, but is usually on the order
3744 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
3745 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003746 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003747 * @return The current value, in seconds, or zero if an
3748 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003749 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003750 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3751 *
Camilla Berglund20bce152016-05-30 16:04:37 +02003752 * @thread_safety This function may be called from any thread. Reading and
3753 * writing of the internal timer offset is not atomic, so it needs to be
3754 * externally synchronized with calls to @ref glfwSetTime.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003755 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003756 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02003757 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003758 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003759 *
3760 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003761 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003762GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02003763
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003764/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003765 *
3766 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003767 * up from that value. The value must be a positive finite number less than
3768 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003769 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003770 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003771 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003772 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3773 * GLFW_INVALID_VALUE.
3774 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003775 * @remark The upper limit of the timer is calculated as
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003776 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
3777 * storing nanoseconds in 64 bits. The limit may be increased in the future.
3778 *
Camilla Berglund20bce152016-05-30 16:04:37 +02003779 * @thread_safety This function may be called from any thread. Reading and
3780 * writing of the internal timer offset is not atomic, so it needs to be
3781 * externally synchronized with calls to @ref glfwGetTime.
Camilla Berglund0e205772014-03-24 11:58:35 +01003782 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003783 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01003784 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003785 * @since Added in version 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003786 *
3787 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003788 */
3789GLFWAPI void glfwSetTime(double time);
3790
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003791/*! @brief Returns the current value of the raw timer.
3792 *
Camilla Berglund337c77a2016-03-06 14:11:14 +01003793 * This function returns the current value of the raw timer, measured in
3794 * 1&nbsp;/&nbsp;frequency seconds. To get the frequency, call @ref
3795 * glfwGetTimerFrequency.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003796 *
3797 * @return The value of the timer, or zero if an
3798 * [error](@ref error_handling) occurred.
3799 *
Camilla Berglund46fce402016-03-07 13:35:37 +01003800 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003801 *
3802 * @thread_safety This function may be called from any thread.
3803 *
3804 * @sa @ref time
3805 * @sa glfwGetTimerFrequency
3806 *
3807 * @since Added in version 3.2.
3808 *
3809 * @ingroup input
3810 */
Camilla Berglund5661d032016-03-23 10:09:07 +01003811GLFWAPI uint64_t glfwGetTimerValue(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003812
3813/*! @brief Returns the frequency, in Hz, of the raw timer.
3814 *
Camilla Berglunddefaea32016-03-07 13:36:54 +01003815 * This function returns the frequency, in Hz, of the raw timer.
3816 *
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003817 * @return The frequency of the timer, in Hz, or zero if an
3818 * [error](@ref error_handling) occurred.
3819 *
Camilla Berglund46fce402016-03-07 13:35:37 +01003820 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003821 *
3822 * @thread_safety This function may be called from any thread.
3823 *
3824 * @sa @ref time
3825 * @sa glfwGetTimerValue
3826 *
3827 * @since Added in version 3.2.
3828 *
3829 * @ingroup input
3830 */
Camilla Berglund5661d032016-03-23 10:09:07 +01003831GLFWAPI uint64_t glfwGetTimerFrequency(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003832
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003833/*! @brief Makes the context of the specified window current for the calling
3834 * thread.
3835 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003836 * This function makes the OpenGL or OpenGL ES context of the specified window
3837 * current on the calling thread. A context can only be made current on
3838 * a single thread at a time and each thread can have only a single current
3839 * context at a time.
3840 *
3841 * By default, making a context non-current implicitly forces a pipeline flush.
3842 * On machines that support `GL_KHR_context_flush_control`, you can control
3843 * whether a context performs this flush by setting the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003844 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003845 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01003846 * The specified window must have an OpenGL or OpenGL ES context. Specifying
3847 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
3848 * error.
3849 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003850 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003851 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003852 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003853 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3854 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3855 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003856 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003857 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003858 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003859 * @sa glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01003860 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003861 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003862 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003863 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003864 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003865GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003866
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003867/*! @brief Returns the window whose context is current on the calling thread.
3868 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003869 * This function returns the window whose OpenGL or OpenGL ES context is
3870 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003871 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003872 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003873 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003874 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003875 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3876 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003877 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003878 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003879 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003880 * @sa glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01003881 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003882 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003883 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003884 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003885 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003886GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003887
3888/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003889 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003890 * This function swaps the front and back buffers of the specified window when
3891 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
3892 * zero, the GPU driver waits the specified number of screen updates before
3893 * swapping the buffers.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003894 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01003895 * The specified window must have an OpenGL or OpenGL ES context. Specifying
3896 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
3897 * error.
3898 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003899 * This function does not apply to Vulkan. If you are rendering with Vulkan,
3900 * see `vkQueuePresentKHR` instead.
3901 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003902 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003903 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003904 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3905 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3906 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003907 * @remark __EGL:__ The context of the specified window must be current on the
Camilla Berglund276b1bc2016-01-31 19:17:18 +01003908 * calling thread.
3909 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003910 * @thread_safety This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01003911 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003912 * @sa @ref buffer_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003913 * @sa glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01003914 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003915 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003916 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003917 *
3918 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003919 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003920GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003921
3922/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003923 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003924 * This function sets the swap interval for the current OpenGL or OpenGL ES
3925 * context, i.e. the number of screen updates to wait from the time @ref
3926 * glfwSwapBuffers was called before swapping the buffers and returning. This
3927 * is sometimes called _vertical synchronization_, _vertical retrace
3928 * synchronization_ or just _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003929 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003930 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003931 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
3932 * which allow the driver to swap even if a frame arrives a little bit late.
3933 * You can check for the presence of these extensions using @ref
3934 * glfwExtensionSupported. For more information about swap tearing, see the
3935 * extension specifications.
3936 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003937 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003938 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003939 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003940 * This function does not apply to Vulkan. If you are rendering with Vulkan,
3941 * see the present mode of your swapchain instead.
3942 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003943 * @param[in] interval The minimum number of screen updates to wait for
3944 * until the buffers are swapped by @ref glfwSwapBuffers.
3945 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003946 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3947 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3948 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003949 * @remark This function is not called during context creation, leaving the
Camilla Berglund11c22d62015-02-19 15:33:51 +01003950 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02003951 * because some swap interval extensions used by GLFW do not allow the swap
3952 * interval to be reset to zero once it has been set to a non-zero value.
3953 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003954 * @remark Some GPU drivers do not honor the requested swap interval, either
Camilla Berglund11c22d62015-02-19 15:33:51 +01003955 * because of a user setting that overrides the application's request or due to
3956 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003957 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003958 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003959 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003960 * @sa @ref buffer_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003961 * @sa glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01003962 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003963 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003964 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003965 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003966 */
3967GLFWAPI void glfwSwapInterval(int interval);
3968
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003969/*! @brief Returns whether the specified extension is available.
3970 *
Camilla Berglund608109c2013-04-11 20:18:46 +02003971 * This function returns whether the specified
Camilla Berglund001c50c2016-02-19 09:13:56 +01003972 * [API extension](@ref context_glext) is supported by the current OpenGL or
3973 * OpenGL ES context. It searches both for client API extension and context
3974 * creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003975 *
3976 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003977 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003978 *
3979 * As this functions retrieves and searches one or more extension strings each
3980 * call, it is recommended that you cache its results if it is going to be used
3981 * frequently. The extension strings will not change during the lifetime of
3982 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003983 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003984 * This function does not apply to Vulkan. If you are using Vulkan, see @ref
3985 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
3986 * and `vkEnumerateDeviceExtensionProperties` instead.
3987 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003988 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003989 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
3990 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003991 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003992 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3993 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
3994 * GLFW_PLATFORM_ERROR.
3995 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003996 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003997 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003998 * @sa @ref context_glext
3999 * @sa glfwGetProcAddress
4000 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004001 * @since Added in version 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01004002 *
4003 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004004 */
4005GLFWAPI int glfwExtensionSupported(const char* extension);
4006
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004007/*! @brief Returns the address of the specified function for the current
4008 * context.
4009 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004010 * This function returns the address of the specified OpenGL or OpenGL ES
Camilla Berglund11c22d62015-02-19 15:33:51 +01004011 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02004012 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004013 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004014 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004015 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004016 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004017 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4018 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
4019 * `vkGetDeviceProcAddr` instead.
4020 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004021 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglunda36e3a22015-11-05 17:14:26 +01004022 * @return The address of the function, or `NULL` if an
4023 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004024 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004025 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4026 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4027 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004028 * @remark The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02004029 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004030 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004031 * @remark This function may return a non-`NULL` address despite the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004032 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02004033 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01004034 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004035 * @pointer_lifetime The returned function pointer is valid until the context
4036 * is destroyed or the library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004037 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004038 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004039 *
4040 * @sa @ref context_glext
4041 * @sa glfwExtensionSupported
4042 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004043 * @since Added in version 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004044 *
4045 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004046 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02004047GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02004048
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004049/*! @brief Returns whether the Vulkan loader has been found.
4050 *
4051 * This function returns whether the Vulkan loader has been found. This check
4052 * is performed by @ref glfwInit.
4053 *
4054 * The availability of a Vulkan loader does not by itself guarantee that window
4055 * surface creation or even device creation is possible. Call @ref
4056 * glfwGetRequiredInstanceExtensions to check whether the extensions necessary
4057 * for Vulkan surface creation are available and @ref
4058 * glfwGetPhysicalDevicePresentationSupport to check whether a queue family of
4059 * a physical device supports image presentation.
4060 *
4061 * @return `GLFW_TRUE` if Vulkan is available, or `GLFW_FALSE` otherwise.
4062 *
4063 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4064 *
4065 * @thread_safety This function may be called from any thread.
4066 *
4067 * @sa @ref vulkan_support
4068 *
4069 * @since Added in version 3.2.
4070 *
4071 * @ingroup vulkan
4072 */
4073GLFWAPI int glfwVulkanSupported(void);
4074
4075/*! @brief Returns the Vulkan instance extensions required by GLFW.
4076 *
4077 * This function returns an array of names of Vulkan instance extensions required
4078 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
4079 * list will always contains `VK_KHR_surface`, so if you don't require any
4080 * additional extensions you can pass this list directly to the
4081 * `VkInstanceCreateInfo` struct.
4082 *
4083 * If Vulkan is not available on the machine, this function returns `NULL` and
4084 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4085 * to check whether Vulkan is available.
4086 *
4087 * If Vulkan is available but no set of extensions allowing window surface
4088 * creation was found, this function returns `NULL`. You may still use Vulkan
4089 * for off-screen rendering and compute work.
4090 *
4091 * @param[out] count Where to store the number of extensions in the returned
4092 * array. This is set to zero if an error occurred.
4093 * @return An array of ASCII encoded extension names, or `NULL` if an
4094 * [error](@ref error_handling) occurred.
4095 *
4096 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4097 * GLFW_API_UNAVAILABLE.
4098 *
4099 * @remarks Additional extensions may be required by future versions of GLFW.
4100 * You should check if any extensions you wish to enable are already in the
4101 * returned array, as it is an error to specify an extension more than once in
4102 * the `VkInstanceCreateInfo` struct.
4103 *
4104 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4105 * should not free it yourself. It is guaranteed to be valid only until the
4106 * library is terminated.
4107 *
4108 * @thread_safety This function may be called from any thread.
4109 *
4110 * @sa @ref vulkan_ext
4111 * @sa glfwCreateWindowSurface
4112 *
4113 * @since Added in version 3.2.
4114 *
4115 * @ingroup vulkan
4116 */
Camilla Berglund7ab7d8b2016-03-23 10:24:01 +01004117GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004118
4119#if defined(VK_VERSION_1_0)
4120
4121/*! @brief Returns the address of the specified Vulkan instance function.
4122 *
4123 * This function returns the address of the specified Vulkan core or extension
4124 * function for the specified instance. If instance is set to `NULL` it can
4125 * return any function exported from the Vulkan loader, including at least the
4126 * following functions:
4127 *
4128 * - `vkEnumerateInstanceExtensionProperties`
4129 * - `vkEnumerateInstanceLayerProperties`
4130 * - `vkCreateInstance`
4131 * - `vkGetInstanceProcAddr`
4132 *
4133 * If Vulkan is not available on the machine, this function returns `NULL` and
4134 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4135 * to check whether Vulkan is available.
4136 *
4137 * This function is equivalent to calling `vkGetInstanceProcAddr` with
4138 * a platform-specific query of the Vulkan loader as a fallback.
4139 *
4140 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
4141 * functions related to instance creation.
4142 * @param[in] procname The ASCII encoded name of the function.
4143 * @return The address of the function, or `NULL` if an
4144 * [error](@ref error_handling) occurred.
4145 *
4146 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4147 * GLFW_API_UNAVAILABLE.
4148 *
4149 * @pointer_lifetime The returned function pointer is valid until the library
4150 * is terminated.
4151 *
4152 * @thread_safety This function may be called from any thread.
4153 *
4154 * @sa @ref vulkan_proc
4155 *
4156 * @since Added in version 3.2.
4157 *
4158 * @ingroup vulkan
4159 */
4160GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
4161
4162/*! @brief Returns whether the specified queue family can present images.
4163 *
4164 * This function returns whether the specified queue family of the specified
4165 * physical device supports presentation to the platform GLFW was built for.
4166 *
4167 * If Vulkan or the required window surface creation instance extensions are
4168 * not available on the machine, or if the specified instance was not created
4169 * with the required extensions, this function returns `GLFW_FALSE` and
4170 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4171 * to check whether Vulkan is available and @ref
4172 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4173 * required.
4174 *
4175 * @param[in] instance The instance that the physical device belongs to.
4176 * @param[in] device The physical device that the queue family belongs to.
4177 * @param[in] queuefamily The index of the queue family to query.
4178 * @return `GLFW_TRUE` if the queue family supports presentation, or
4179 * `GLFW_FALSE` otherwise.
4180 *
4181 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4182 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4183 *
4184 * @thread_safety This function may be called from any thread. For
4185 * synchronization details of Vulkan objects, see the Vulkan specification.
4186 *
4187 * @sa @ref vulkan_present
4188 *
4189 * @since Added in version 3.2.
4190 *
4191 * @ingroup vulkan
4192 */
4193GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
4194
4195/*! @brief Creates a Vulkan surface for the specified window.
4196 *
4197 * This function creates a Vulkan surface for the specified window.
4198 *
4199 * If the Vulkan loader was not found at initialization, this function returns
4200 * `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref GLFW_API_UNAVAILABLE
4201 * error. Call @ref glfwVulkanSupported to check whether the Vulkan loader was
4202 * found.
4203 *
4204 * If the required window surface creation instance extensions are not
4205 * available or if the specified instance was not created with these extensions
4206 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
4207 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
4208 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4209 * required.
4210 *
4211 * The window surface must be destroyed before the specified Vulkan instance.
4212 * It is the responsibility of the caller to destroy the window surface. GLFW
4213 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
4214 * surface.
4215 *
4216 * @param[in] instance The Vulkan instance to create the surface in.
4217 * @param[in] window The window to create the surface for.
4218 * @param[in] allocator The allocator to use, or `NULL` to use the default
4219 * allocator.
4220 * @param[out] surface Where to store the handle of the surface. This is set
4221 * to `VK_NULL_HANDLE` if an error occurred.
4222 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
4223 * [error](@ref error_handling) occurred.
4224 *
4225 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4226 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4227 *
4228 * @remarks If an error occurs before the creation call is made, GLFW returns
4229 * the Vulkan error code most appropriate for the error. Appropriate use of
4230 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
Camilla Berglundee33dcd2016-03-07 14:42:51 +01004231 * eliminate almost all occurrences of these errors.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004232 *
4233 * @thread_safety This function may be called from any thread. For
4234 * synchronization details of Vulkan objects, see the Vulkan specification.
4235 *
4236 * @sa @ref vulkan_surface
4237 * @sa glfwGetRequiredInstanceExtensions
4238 *
4239 * @since Added in version 3.2.
4240 *
4241 * @ingroup vulkan
4242 */
4243GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
4244
4245#endif /*VK_VERSION_1_0*/
4246
Camilla Berglund3249f812010-09-07 17:34:51 +02004247
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004248/*************************************************************************
4249 * Global definition cleanup
4250 *************************************************************************/
4251
4252/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
4253
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004254#ifdef GLFW_WINGDIAPI_DEFINED
4255 #undef WINGDIAPI
4256 #undef GLFW_WINGDIAPI_DEFINED
4257#endif
4258
4259#ifdef GLFW_CALLBACK_DEFINED
4260 #undef CALLBACK
4261 #undef GLFW_CALLBACK_DEFINED
4262#endif
4263
4264/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
4265
4266
Camilla Berglund3249f812010-09-07 17:34:51 +02004267#ifdef __cplusplus
4268}
4269#endif
4270
Camilla Berglundf8df91d2013-01-15 01:59:56 +01004271#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02004272