blob: 7557f1cfe168ed58a78aac7151172a6e3f81201e [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund95a07f32015-06-01 22:55:06 +02002 * GLFW 3.2 - www.glfw.org
Camilla Berglund3cfc4002013-07-29 20:53:17 +02003 * A library for OpenGL, window and input
Camilla Berglund3249f812010-09-07 17:34:51 +02004 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
Camilla Berglundf8105ed2010-11-09 02:57:46 +01006 * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
Camilla Berglund3249f812010-09-07 17:34:51 +02007 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
Camilla Berglundf8df91d2013-01-15 01:59:56 +010029#ifndef _glfw3_h_
30#define _glfw3_h_
Camilla Berglund3249f812010-09-07 17:34:51 +020031
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
Camilla Berglundbce2cd62012-11-22 16:38:24 +010038 * Doxygen documentation
39 *************************************************************************/
40
Camilla Berglund318e8ac2015-10-24 20:48:46 +020041/*! @file glfw3.h
42 * @brief The header of the GLFW 3 API.
43 *
44 * This is the header file of the GLFW 3 API. It defines all its types and
45 * declares all its functions.
46 *
47 * For more information about how to use this file, see @ref build_include.
48 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010049/*! @defgroup context Context reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020050 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010051 * This is the reference documentation for OpenGL and OpenGL ES context related
52 * functions. For more task-oriented information, see the @ref context_guide.
Camilla Berglund3f5843f2012-12-13 02:22:39 +010053 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010054/*! @defgroup vulkan Vulkan reference
Camilla Berglund9b75bff2015-08-10 20:19:04 +020055 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010056 * This is the reference documentation for Vulkan related functions and types.
57 * For more task-oriented information, see the @ref vulkan_guide.
Camilla Berglund9b75bff2015-08-10 20:19:04 +020058 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010059/*! @defgroup init Initialization, version and error reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020060 *
61 * This is the reference documentation for initialization and termination of
Camilla Berglund80c203f2016-02-19 10:29:13 +010062 * the library, version management and error handling. For more task-oriented
63 * information, see the @ref intro_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010064 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010065/*! @defgroup input Input reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020066 *
67 * This is the reference documentation for input related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010068 * For more task-oriented information, see the @ref input_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010069 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010070/*! @defgroup monitor Monitor reference
Camilla Berglundf5f55e32013-06-17 12:56:36 +020071 *
72 * This is the reference documentation for monitor related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010073 * For more task-oriented information, see the @ref monitor_guide.
Camilla Berglund5f68e122012-11-27 17:07:28 +010074 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010075/*! @defgroup window Window reference
Camilla Berglundbce2cd62012-11-22 16:38:24 +010076 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +020077 * This is the reference documentation for window related functions and types,
Camilla Berglund80c203f2016-02-19 10:29:13 +010078 * including creation, deletion and event polling. For more task-oriented
79 * information, see the @ref window_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010080 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010081
82
83/*************************************************************************
Camilla Berglund8d910d72015-02-22 18:35:10 +010084 * Compiler- and platform-specific preprocessor work
Camilla Berglund3249f812010-09-07 17:34:51 +020085 *************************************************************************/
86
Camilla Berglund8d910d72015-02-22 18:35:10 +010087/* If we are we on Windows, we want a single define for it.
Camilla Berglund3249f812010-09-07 17:34:51 +020088 */
Camilla Berglunde8ce4ab2015-02-22 18:18:43 +010089#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
Camilla Berglund3249f812010-09-07 17:34:51 +020090 #define _WIN32
91#endif /* _WIN32 */
92
Camilla Berglund8d910d72015-02-22 18:35:10 +010093/* It is customary to use APIENTRY for OpenGL function pointer declarations on
94 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
Camilla Berglund3249f812010-09-07 17:34:51 +020095 */
96#ifndef APIENTRY
97 #ifdef _WIN32
98 #define APIENTRY __stdcall
99 #else
100 #define APIENTRY
101 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200102#endif /* APIENTRY */
103
Camilla Berglund8d910d72015-02-22 18:35:10 +0100104/* Some Windows OpenGL headers need this.
Camilla Berglund3249f812010-09-07 17:34:51 +0200105 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200106#if !defined(WINGDIAPI) && defined(_WIN32)
Camilla Berglundc5353642015-02-22 18:14:30 +0100107 #define WINGDIAPI __declspec(dllimport)
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200108 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200109#endif /* WINGDIAPI */
110
Camilla Berglund8d910d72015-02-22 18:35:10 +0100111/* Some Windows GLU headers need this.
112 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200113#if !defined(CALLBACK) && defined(_WIN32)
Camilla Berglundd586fe62015-02-22 18:17:34 +0100114 #define CALLBACK __stdcall
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200115 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200116#endif /* CALLBACK */
117
Camilla Berglund8d910d72015-02-22 18:35:10 +0100118/* Most Windows GLU headers need wchar_t.
119 * The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h.
Camilla Berglund8221aad2016-03-06 09:40:16 +0100120 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund8d910d72015-02-22 18:35:10 +0100121 */
Camilla Berglund8221aad2016-03-06 09:40:16 +0100122#include <stddef.h>
Camilla Berglund3249f812010-09-07 17:34:51 +0200123
Camilla Berglundc93b1202013-09-08 16:07:34 +0200124/* Include the chosen client API headers.
125 */
Camilla Berglunddb49aa62016-02-22 13:16:43 +0100126#if defined(__APPLE__)
Camilla Berglund1591caa2015-01-08 06:56:17 +0100127 #if defined(GLFW_INCLUDE_GLCOREARB)
128 #include <OpenGL/gl3.h>
129 #if defined(GLFW_INCLUDE_GLEXT)
130 #include <OpenGL/gl3ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200131 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100132 #elif !defined(GLFW_INCLUDE_NONE)
133 #if !defined(GLFW_INCLUDE_GLEXT)
134 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200135 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100136 #include <OpenGL/gl.h>
137 #endif
138 #if defined(GLFW_INCLUDE_GLU)
139 #include <OpenGL/glu.h>
140 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200141#else
Camilla Berglund1591caa2015-01-08 06:56:17 +0100142 #if defined(GLFW_INCLUDE_GLCOREARB)
143 #include <GL/glcorearb.h>
144 #elif defined(GLFW_INCLUDE_ES1)
145 #include <GLES/gl.h>
146 #if defined(GLFW_INCLUDE_GLEXT)
147 #include <GLES/glext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200148 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100149 #elif defined(GLFW_INCLUDE_ES2)
150 #include <GLES2/gl2.h>
151 #if defined(GLFW_INCLUDE_GLEXT)
152 #include <GLES2/gl2ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200153 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100154 #elif defined(GLFW_INCLUDE_ES3)
155 #include <GLES3/gl3.h>
156 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100157 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100158 #endif
159 #elif defined(GLFW_INCLUDE_ES31)
160 #include <GLES3/gl31.h>
161 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100162 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100163 #endif
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200164 #elif defined(GLFW_INCLUDE_VULKAN)
165 #include <vulkan/vulkan.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100166 #elif !defined(GLFW_INCLUDE_NONE)
167 #include <GL/gl.h>
168 #if defined(GLFW_INCLUDE_GLEXT)
169 #include <GL/glext.h>
170 #endif
171 #endif
172 #if defined(GLFW_INCLUDE_GLU)
173 #include <GL/glu.h>
174 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200175#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200176
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200177#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200178 /* GLFW_DLL must be defined by applications that are linking against the DLL
179 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
180 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200181 */
Camilla Berglund0df4e062015-12-13 14:07:27 +0100182 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200183#endif
184
Camilla Berglund1591caa2015-01-08 06:56:17 +0100185/* GLFWAPI is used to declare public API functions for export
186 * from the DLL / shared library / dynamic library.
187 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200188#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200189 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100190 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200191#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200192 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100193 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100194#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200195 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100196 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200197#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200198 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200199 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200200#endif
201
Camilla Berglund3249f812010-09-07 17:34:51 +0200202
203/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100204 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200205 *************************************************************************/
206
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100207/*! @name GLFW version macros
208 * @{ */
209/*! @brief The major version number of the GLFW library.
210 *
211 * This is incremented when the API is changed in non-compatible ways.
212 * @ingroup init
213 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100214#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100215/*! @brief The minor version number of the GLFW library.
216 *
217 * This is incremented when features are added to the API but it remains
218 * backward-compatible.
219 * @ingroup init
220 */
Camilla Berglund95a07f32015-06-01 22:55:06 +0200221#define GLFW_VERSION_MINOR 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100222/*! @brief The revision number of the GLFW library.
223 *
224 * This is incremented when a bug fix release is made that does not contain any
225 * API changes.
226 * @ingroup init
227 */
Camilla Berglund95a07f32015-06-01 22:55:06 +0200228#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100229/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200230
Camilla Berglund0eccf752015-08-23 19:30:04 +0200231/*! @name Boolean values
232 * @{ */
233/*! @brief One.
234 *
235 * One. Seriously. You don't _need_ to use this symbol in your code. It's
236 * just semantic sugar for the number 1. You can use `1` or `true` or `_True`
237 * or `GL_TRUE` or whatever you want.
238 */
239#define GLFW_TRUE 1
240/*! @brief Zero.
241 *
242 * Zero. Seriously. You don't _need_ to use this symbol in your code. It's
243 * just just semantic sugar for the number 0. You can use `0` or `false` or
244 * `_False` or `GL_FALSE` or whatever you want.
245 */
246#define GLFW_FALSE 0
247/*! @} */
248
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100249/*! @name Key and button actions
250 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200251/*! @brief The key or mouse button was released.
252 *
253 * The key or mouse button was released.
254 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100255 * @ingroup input
256 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100257#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200258/*! @brief The key or mouse button was pressed.
259 *
260 * The key or mouse button was pressed.
261 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100262 * @ingroup input
263 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100264#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100265/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200266 *
267 * The key was held down until it repeated.
268 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100269 * @ingroup input
270 */
271#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100272/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200273
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200274/*! @defgroup keys Keyboard keys
275 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100276 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200277 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100278 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
279 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
280 * put in the 256+ range).
281 *
282 * The naming of the key codes follow these rules:
283 * - The US keyboard layout is used
284 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
285 * "3", etc.)
286 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
287 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
288 * correspond to the Unicode standard (usually for brevity)
289 * - Keys that lack a clear US mapping are named "WORLD_x"
290 * - For non-printable keys, custom names are used (e.g. "F4",
291 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200292 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100293 * @ingroup input
294 * @{
295 */
296
Camilla Berglund11615fc2013-05-30 17:19:12 +0200297/* The unknown key */
298#define GLFW_KEY_UNKNOWN -1
299
Marcusc0cb4c22011-01-02 11:18:14 +0100300/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100301#define GLFW_KEY_SPACE 32
302#define GLFW_KEY_APOSTROPHE 39 /* ' */
303#define GLFW_KEY_COMMA 44 /* , */
304#define GLFW_KEY_MINUS 45 /* - */
305#define GLFW_KEY_PERIOD 46 /* . */
306#define GLFW_KEY_SLASH 47 /* / */
307#define GLFW_KEY_0 48
308#define GLFW_KEY_1 49
309#define GLFW_KEY_2 50
310#define GLFW_KEY_3 51
311#define GLFW_KEY_4 52
312#define GLFW_KEY_5 53
313#define GLFW_KEY_6 54
314#define GLFW_KEY_7 55
315#define GLFW_KEY_8 56
316#define GLFW_KEY_9 57
317#define GLFW_KEY_SEMICOLON 59 /* ; */
318#define GLFW_KEY_EQUAL 61 /* = */
319#define GLFW_KEY_A 65
320#define GLFW_KEY_B 66
321#define GLFW_KEY_C 67
322#define GLFW_KEY_D 68
323#define GLFW_KEY_E 69
324#define GLFW_KEY_F 70
325#define GLFW_KEY_G 71
326#define GLFW_KEY_H 72
327#define GLFW_KEY_I 73
328#define GLFW_KEY_J 74
329#define GLFW_KEY_K 75
330#define GLFW_KEY_L 76
331#define GLFW_KEY_M 77
332#define GLFW_KEY_N 78
333#define GLFW_KEY_O 79
334#define GLFW_KEY_P 80
335#define GLFW_KEY_Q 81
336#define GLFW_KEY_R 82
337#define GLFW_KEY_S 83
338#define GLFW_KEY_T 84
339#define GLFW_KEY_U 85
340#define GLFW_KEY_V 86
341#define GLFW_KEY_W 87
342#define GLFW_KEY_X 88
343#define GLFW_KEY_Y 89
344#define GLFW_KEY_Z 90
345#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
346#define GLFW_KEY_BACKSLASH 92 /* \ */
347#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
348#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
349#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
350#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100351
352/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100353#define GLFW_KEY_ESCAPE 256
354#define GLFW_KEY_ENTER 257
355#define GLFW_KEY_TAB 258
356#define GLFW_KEY_BACKSPACE 259
357#define GLFW_KEY_INSERT 260
358#define GLFW_KEY_DELETE 261
359#define GLFW_KEY_RIGHT 262
360#define GLFW_KEY_LEFT 263
361#define GLFW_KEY_DOWN 264
362#define GLFW_KEY_UP 265
363#define GLFW_KEY_PAGE_UP 266
364#define GLFW_KEY_PAGE_DOWN 267
365#define GLFW_KEY_HOME 268
366#define GLFW_KEY_END 269
367#define GLFW_KEY_CAPS_LOCK 280
368#define GLFW_KEY_SCROLL_LOCK 281
369#define GLFW_KEY_NUM_LOCK 282
370#define GLFW_KEY_PRINT_SCREEN 283
371#define GLFW_KEY_PAUSE 284
372#define GLFW_KEY_F1 290
373#define GLFW_KEY_F2 291
374#define GLFW_KEY_F3 292
375#define GLFW_KEY_F4 293
376#define GLFW_KEY_F5 294
377#define GLFW_KEY_F6 295
378#define GLFW_KEY_F7 296
379#define GLFW_KEY_F8 297
380#define GLFW_KEY_F9 298
381#define GLFW_KEY_F10 299
382#define GLFW_KEY_F11 300
383#define GLFW_KEY_F12 301
384#define GLFW_KEY_F13 302
385#define GLFW_KEY_F14 303
386#define GLFW_KEY_F15 304
387#define GLFW_KEY_F16 305
388#define GLFW_KEY_F17 306
389#define GLFW_KEY_F18 307
390#define GLFW_KEY_F19 308
391#define GLFW_KEY_F20 309
392#define GLFW_KEY_F21 310
393#define GLFW_KEY_F22 311
394#define GLFW_KEY_F23 312
395#define GLFW_KEY_F24 313
396#define GLFW_KEY_F25 314
397#define GLFW_KEY_KP_0 320
398#define GLFW_KEY_KP_1 321
399#define GLFW_KEY_KP_2 322
400#define GLFW_KEY_KP_3 323
401#define GLFW_KEY_KP_4 324
402#define GLFW_KEY_KP_5 325
403#define GLFW_KEY_KP_6 326
404#define GLFW_KEY_KP_7 327
405#define GLFW_KEY_KP_8 328
406#define GLFW_KEY_KP_9 329
407#define GLFW_KEY_KP_DECIMAL 330
408#define GLFW_KEY_KP_DIVIDE 331
409#define GLFW_KEY_KP_MULTIPLY 332
410#define GLFW_KEY_KP_SUBTRACT 333
411#define GLFW_KEY_KP_ADD 334
412#define GLFW_KEY_KP_ENTER 335
413#define GLFW_KEY_KP_EQUAL 336
414#define GLFW_KEY_LEFT_SHIFT 340
415#define GLFW_KEY_LEFT_CONTROL 341
416#define GLFW_KEY_LEFT_ALT 342
417#define GLFW_KEY_LEFT_SUPER 343
418#define GLFW_KEY_RIGHT_SHIFT 344
419#define GLFW_KEY_RIGHT_CONTROL 345
420#define GLFW_KEY_RIGHT_ALT 346
421#define GLFW_KEY_RIGHT_SUPER 347
422#define GLFW_KEY_MENU 348
Camilla Berglund9c315412015-07-02 14:24:50 +0200423
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100424#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100425
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100426/*! @} */
427
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200428/*! @defgroup mods Modifier key flags
Camilla Berglund4188c262015-01-18 01:55:25 +0100429 *
430 * See [key input](@ref input_key) for how these are used.
431 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200432 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100433 * @{ */
434
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200435/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100436 */
437#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200438/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100439 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200440#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200441/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100442 */
443#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200444/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200445 */
446#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100447
448/*! @} */
449
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100450/*! @defgroup buttons Mouse buttons
Camilla Berglund4188c262015-01-18 01:55:25 +0100451 *
452 * See [mouse button input](@ref input_mouse_button) for how these are used.
453 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100454 * @ingroup input
455 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100456#define GLFW_MOUSE_BUTTON_1 0
457#define GLFW_MOUSE_BUTTON_2 1
458#define GLFW_MOUSE_BUTTON_3 2
459#define GLFW_MOUSE_BUTTON_4 3
460#define GLFW_MOUSE_BUTTON_5 4
461#define GLFW_MOUSE_BUTTON_6 5
462#define GLFW_MOUSE_BUTTON_7 6
463#define GLFW_MOUSE_BUTTON_8 7
464#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
465#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
466#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
467#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100468/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200469
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100470/*! @defgroup joysticks Joysticks
Camilla Berglund4188c262015-01-18 01:55:25 +0100471 *
472 * See [joystick input](@ref joystick) for how these are used.
473 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100474 * @ingroup input
475 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100476#define GLFW_JOYSTICK_1 0
477#define GLFW_JOYSTICK_2 1
478#define GLFW_JOYSTICK_3 2
479#define GLFW_JOYSTICK_4 3
480#define GLFW_JOYSTICK_5 4
481#define GLFW_JOYSTICK_6 5
482#define GLFW_JOYSTICK_7 6
483#define GLFW_JOYSTICK_8 7
484#define GLFW_JOYSTICK_9 8
485#define GLFW_JOYSTICK_10 9
486#define GLFW_JOYSTICK_11 10
487#define GLFW_JOYSTICK_12 11
488#define GLFW_JOYSTICK_13 12
489#define GLFW_JOYSTICK_14 13
490#define GLFW_JOYSTICK_15 14
491#define GLFW_JOYSTICK_16 15
492#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100493/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200494
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100495/*! @defgroup errors Error codes
Camilla Berglund4188c262015-01-18 01:55:25 +0100496 *
497 * See [error handling](@ref error_handling) for how these are used.
498 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200499 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100500 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100501/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200502 *
Camilla Berglund0df4e062015-12-13 14:07:27 +0100503 * This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund4591ad22014-09-18 15:03:29 +0200504 * library is [initialized](@ref intro_init).
505 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100506 * @analysis Application programmer error. Initialize GLFW before calling any
507 * function that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100508 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200509#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100510/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200511 *
512 * This occurs if a GLFW function was called that needs and operates on the
513 * current OpenGL or OpenGL ES context but no context is current on the calling
514 * thread. One such function is @ref glfwSwapInterval.
515 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100516 * @analysis Application programmer error. Ensure a context is current before
517 * calling functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100518 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200519#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200520/*! @brief One of the arguments to the function was an invalid enum value.
521 *
522 * One of the arguments to the function was an invalid enum value, for example
Camilla Berglundce8f97c2015-01-11 23:33:14 +0100523 * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref
524 * glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200525 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100526 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100527 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200528#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200529/*! @brief One of the arguments to the function was an invalid value.
530 *
531 * One of the arguments to the function was an invalid value, for example
532 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
533 *
534 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
535 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
536 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100537 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100538 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200539#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100540/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200541 *
542 * A memory allocation failed.
543 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100544 * @analysis A bug in GLFW or the underlying operating system. Report the bug
545 * to our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100546 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200547#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200548/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200549 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200550 * GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200551 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100552 * @analysis The installed graphics driver does not support the requested
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200553 * API, or does not support it via the chosen context creation backend.
Camilla Berglund951a9582016-01-31 21:32:14 +0100554 * Below are a few examples.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200555 *
556 * @par
557 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200558 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200559 * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100560 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200561 * driver. Older graphics drivers do not support Vulkan.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100562 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200563#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200564/*! @brief The requested OpenGL or OpenGL ES version is not available.
565 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100566 * The requested OpenGL or OpenGL ES version (including any requested context
567 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200568 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100569 * @analysis The machine does not support your requirements. If your
570 * application is sufficiently flexible, downgrade your requirements and try
571 * again. Otherwise, inform the user that their machine does not match your
Camilla Berglund4591ad22014-09-18 15:03:29 +0200572 * requirements.
573 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200574 * @par
575 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
576 * comes out before the 4.x series gets that far, also fail with this error and
577 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
578 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100579 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200580#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100581/*! @brief A platform-specific error occurred that does not match any of the
582 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200583 *
584 * A platform-specific error occurred that does not match any of the more
585 * specific categories.
586 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100587 * @analysis A bug or configuration error in GLFW, the underlying operating
588 * system or its drivers, or a lack of required resources. Report the issue to
589 * our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100590 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200591#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200592/*! @brief The requested format is not supported or available.
593 *
594 * If emitted during window creation, the requested pixel format is not
595 * supported.
596 *
597 * If emitted when querying the clipboard, the contents of the clipboard could
598 * not be converted to the requested format.
599 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100600 * @analysis If emitted during window creation, one or more
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200601 * [hard constraints](@ref window_hints_hard) did not match any of the
602 * available pixel formats. If your application is sufficiently flexible,
603 * downgrade your requirements and try again. Otherwise, inform the user that
604 * their machine does not match your requirements.
605 *
606 * @par
607 * If emitted when querying the clipboard, ignore the error or report it to
608 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100609 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200610#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglund496f5592015-06-18 14:03:02 +0200611/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
612 *
613 * A window that does not have an OpenGL or OpenGL ES context was passed to
614 * a function that requires it to have one.
615 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100616 * @analysis Application programmer error. Fix the offending call.
Camilla Berglund496f5592015-06-18 14:03:02 +0200617 */
618#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100619/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200620
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100621#define GLFW_FOCUSED 0x00020001
622#define GLFW_ICONIFIED 0x00020002
Camilla Berglund393e4392013-05-27 22:16:59 +0200623#define GLFW_RESIZABLE 0x00020003
624#define GLFW_VISIBLE 0x00020004
625#define GLFW_DECORATED 0x00020005
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200626#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200627#define GLFW_FLOATING 0x00020007
Camilla Berglunda10caa42015-10-13 12:50:59 +0200628#define GLFW_MAXIMIZED 0x00020008
Camilla Berglund2c091572010-09-09 21:09:11 +0200629
Camilla Berglund53b39a62013-05-30 18:55:45 +0200630#define GLFW_RED_BITS 0x00021001
631#define GLFW_GREEN_BITS 0x00021002
632#define GLFW_BLUE_BITS 0x00021003
633#define GLFW_ALPHA_BITS 0x00021004
634#define GLFW_DEPTH_BITS 0x00021005
635#define GLFW_STENCIL_BITS 0x00021006
636#define GLFW_ACCUM_RED_BITS 0x00021007
637#define GLFW_ACCUM_GREEN_BITS 0x00021008
638#define GLFW_ACCUM_BLUE_BITS 0x00021009
639#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
640#define GLFW_AUX_BUFFERS 0x0002100B
641#define GLFW_STEREO 0x0002100C
642#define GLFW_SAMPLES 0x0002100D
643#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Berglund2cd34382013-05-30 20:42:50 +0200644#define GLFW_REFRESH_RATE 0x0002100F
Camilla Berglundc9808582014-04-24 19:21:10 +0200645#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Berglunddeb0b3d2012-12-02 21:00:15 +0100646
Camilla Berglund53b39a62013-05-30 18:55:45 +0200647#define GLFW_CLIENT_API 0x00022001
648#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
649#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
650#define GLFW_CONTEXT_REVISION 0x00022004
651#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
652#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
653#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
654#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Berglund44c899c2014-08-21 19:21:45 +0200655#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Berglund7be82092015-08-10 12:46:14 +0200656#define GLFW_CONTEXT_NO_ERROR 0x0002200A
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100657
Camilla Berglund496f5592015-06-18 14:03:02 +0200658#define GLFW_NO_API 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200659#define GLFW_OPENGL_API 0x00030001
660#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100661
Camilla Berglund393e4392013-05-27 22:16:59 +0200662#define GLFW_NO_ROBUSTNESS 0
663#define GLFW_NO_RESET_NOTIFICATION 0x00031001
664#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100665
Camilla Berglund44e84012013-06-05 16:13:30 +0200666#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200667#define GLFW_OPENGL_CORE_PROFILE 0x00032001
668#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100669
Camilla Berglund393e4392013-05-27 22:16:59 +0200670#define GLFW_CURSOR 0x00033001
671#define GLFW_STICKY_KEYS 0x00033002
672#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100673
Camilla Berglund393e4392013-05-27 22:16:59 +0200674#define GLFW_CURSOR_NORMAL 0x00034001
675#define GLFW_CURSOR_HIDDEN 0x00034002
676#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100677
Camilla Berglund44c899c2014-08-21 19:21:45 +0200678#define GLFW_ANY_RELEASE_BEHAVIOR 0
679#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
680#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
681
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200682/*! @defgroup shapes Standard cursor shapes
Camilla Berglund4188c262015-01-18 01:55:25 +0100683 *
684 * See [standard cursor creation](@ref cursor_standard) for how these are used.
685 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200686 * @ingroup input
687 * @{ */
688
689/*! @brief The regular arrow cursor shape.
690 *
691 * The regular arrow cursor.
692 */
693#define GLFW_ARROW_CURSOR 0x00036001
694/*! @brief The text input I-beam cursor shape.
695 *
696 * The text input I-beam cursor shape.
697 */
698#define GLFW_IBEAM_CURSOR 0x00036002
699/*! @brief The crosshair shape.
700 *
701 * The crosshair shape.
702 */
703#define GLFW_CROSSHAIR_CURSOR 0x00036003
704/*! @brief The hand shape.
705 *
706 * The hand shape.
707 */
708#define GLFW_HAND_CURSOR 0x00036004
709/*! @brief The horizontal resize arrow shape.
710 *
711 * The horizontal resize arrow shape.
712 */
713#define GLFW_HRESIZE_CURSOR 0x00036005
714/*! @brief The vertical resize arrow shape.
715 *
716 * The vertical resize arrow shape.
717 */
718#define GLFW_VRESIZE_CURSOR 0x00036006
719/*! @} */
720
Camilla Berglund393e4392013-05-27 22:16:59 +0200721#define GLFW_CONNECTED 0x00040001
722#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100723
Camilla Berglund28101302014-04-08 18:57:43 +0200724#define GLFW_DONT_CARE -1
725
Camilla Berglund97387282011-10-06 23:28:56 +0200726
Camilla Berglund3249f812010-09-07 17:34:51 +0200727/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100728 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200729 *************************************************************************/
730
Camilla Berglund31f67dd2016-03-06 11:38:55 +0100731/*! @brief 64-bit unsigned integer.
732 *
733 * 64-bit unsigned integer.
734 *
735 * @since Added in version 3.2.
736 */
737#if defined(_MSC_VER) && (_MSC_VER < 1600)
738typedef unsigned __int64 GLFWuint64;
739#else
740 #include <stdint.h>
741typedef uint64_t GLFWuint64;
742#endif
743
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100744/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200745 *
746 * Generic function pointer used for returning client API function pointers
747 * without forcing a cast from a regular pointer.
748 *
Camilla Berglundbce20c32015-11-05 13:58:52 +0100749 * @sa @ref context_glext
750 * @sa glfwGetProcAddress
751 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100752 * @since Added in version 3.0.
753
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100754 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100755 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200756typedef void (*GLFWglproc)(void);
757
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200758/*! @brief Vulkan API function pointer type.
759 *
760 * Generic function pointer used for returning Vulkan API function pointers
761 * without forcing a cast from a regular pointer.
762 *
763 * @sa @ref vulkan_proc
764 * @sa glfwGetInstanceProcAddress
765 *
766 * @since Added in version 3.2.
767 *
768 * @ingroup vulkan
769 */
770typedef void (*GLFWvkproc)(void);
771
Camilla Berglunddba2d802013-01-17 23:06:56 +0100772/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200773 *
774 * Opaque monitor object.
775 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100776 * @see @ref monitor_object
777 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100778 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100779 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100780 * @ingroup monitor
781 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100782typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200783
Camilla Berglunddba2d802013-01-17 23:06:56 +0100784/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200785 *
786 * Opaque window object.
787 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100788 * @see @ref window_object
789 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100790 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100791 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100792 * @ingroup window
793 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100794typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200795
urraka40c04a72013-12-04 10:19:22 -0300796/*! @brief Opaque cursor object.
797 *
798 * Opaque cursor object.
799 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100800 * @see @ref cursor_object
801 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100802 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +0100803 *
urraka40c04a72013-12-04 10:19:22 -0300804 * @ingroup cursor
805 */
806typedef struct GLFWcursor GLFWcursor;
807
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100808/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200809 *
810 * This is the function signature for error callback functions.
811 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100812 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100813 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100814 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100815 * @sa @ref error_handling
Camilla Berglunddba2d802013-01-17 23:06:56 +0100816 * @sa glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100817 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100818 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100819 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200820 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100821 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100822typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100823
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100824/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200825 *
826 * This is the function signature for window position callback functions.
827 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200828 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200829 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
830 * upper-left corner of the client area of the window.
831 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
832 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100833 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100834 * @sa @ref window_pos
Camilla Berglunddba2d802013-01-17 23:06:56 +0100835 * @sa glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100836 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100837 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100838 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100839 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100840 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100841typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100842
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100843/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200844 *
845 * This is the function signature for window size callback functions.
846 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200847 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200848 * @param[in] width The new width, in screen coordinates, of the window.
849 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100850 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100851 * @sa @ref window_size
Camilla Berglunddba2d802013-01-17 23:06:56 +0100852 * @sa glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100853 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100854 * @since Added in version 1.0.
855 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100856 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100857 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100858 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100859typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100860
861/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200862 *
863 * This is the function signature for window close callback functions.
864 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100865 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100866 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100867 * @sa @ref window_close
Camilla Berglunddba2d802013-01-17 23:06:56 +0100868 * @sa glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100869 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100870 * @since Added in version 2.5.
871 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100872 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100873 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100874 */
Camilla Berglund64afb192013-03-06 23:29:37 +0100875typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100876
877/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200878 *
879 * This is the function signature for window refresh callback functions.
880 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100881 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100882 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100883 * @sa @ref window_refresh
Camilla Berglunddba2d802013-01-17 23:06:56 +0100884 * @sa glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100885 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100886 * @since Added in version 2.5.
887 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100888 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100889 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100890 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100891typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100892
893/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200894 *
895 * This is the function signature for window focus callback functions.
896 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100897 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200898 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
899 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100900 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100901 * @sa @ref window_focus
Camilla Berglunddba2d802013-01-17 23:06:56 +0100902 * @sa glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100903 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100904 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100905 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100906 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100907 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100908typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100909
Camilla Berglund06e7a962012-11-22 19:14:27 +0100910/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200911 *
912 * This is the function signature for window iconify/restore callback
913 * functions.
914 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100915 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200916 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
917 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100918 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100919 * @sa @ref window_iconify
Camilla Berglunddba2d802013-01-17 23:06:56 +0100920 * @sa glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100921 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100922 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100923 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100924 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100925 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100926typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100927
Camilla Berglund34981632013-06-03 12:51:57 +0200928/*! @brief The function signature for framebuffer resize callbacks.
929 *
930 * This is the function signature for framebuffer resize callback
931 * functions.
932 *
933 * @param[in] window The window whose framebuffer was resized.
934 * @param[in] width The new width, in pixels, of the framebuffer.
935 * @param[in] height The new height, in pixels, of the framebuffer.
936 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100937 * @sa @ref window_fbsize
Camilla Berglund34981632013-06-03 12:51:57 +0200938 * @sa glfwSetFramebufferSizeCallback
939 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100940 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100941 *
Camilla Berglund34981632013-06-03 12:51:57 +0200942 * @ingroup window
943 */
944typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
945
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100946/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200947 *
948 * This is the function signature for mouse button callback functions.
949 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100950 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100951 * @param[in] button The [mouse button](@ref buttons) that was pressed or
952 * released.
953 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200954 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
955 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100956 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100957 * @sa @ref input_mouse_button
Camilla Berglunddba2d802013-01-17 23:06:56 +0100958 * @sa glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100959 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100960 * @since Added in version 1.0.
961 * @glfw3 Added window handle and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +0100962 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100963 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100964 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100965typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100966
967/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200968 *
969 * This is the function signature for cursor position callback functions.
970 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100971 * @param[in] window The window that received the event.
Camilla Berglund95c44ab2016-02-17 14:52:01 +0100972 * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
973 * the client area.
974 * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
975 * client area.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100976 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100977 * @sa @ref cursor_pos
Camilla Berglunddba2d802013-01-17 23:06:56 +0100978 * @sa glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100979 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100980 * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +0100981 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100982 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100983 */
Camilla Berglund129e94d2013-04-04 16:16:21 +0200984typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100985
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200986/*! @brief The function signature for cursor enter/leave callbacks.
987 *
988 * This is the function signature for cursor enter/leave callback functions.
989 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100990 * @param[in] window The window that received the event.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200991 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
992 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100993 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100994 * @sa @ref cursor_enter
Camilla Berglunddba2d802013-01-17 23:06:56 +0100995 * @sa glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100996 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100997 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100998 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100999 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001000 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001001typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001002
1003/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001004 *
1005 * This is the function signature for scroll callback functions.
1006 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001007 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +02001008 * @param[in] xoffset The scroll offset along the x-axis.
1009 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001010 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001011 * @sa @ref scrolling
Camilla Berglunddba2d802013-01-17 23:06:56 +01001012 * @sa glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001013 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001014 * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001015 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001016 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001017 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001018typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001019
1020/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001021 *
1022 * This is the function signature for keyboard key callback functions.
1023 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001024 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001025 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +02001026 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001027 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001028 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1029 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001030 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001031 * @sa @ref input_key
Camilla Berglunddba2d802013-01-17 23:06:56 +01001032 * @sa glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001033 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001034 * @since Added in version 1.0.
1035 * @glfw3 Added window handle, scancode and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001036 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001037 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001038 */
Camilla Berglund11615fc2013-05-30 17:19:12 +02001039typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001040
1041/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001042 *
1043 * This is the function signature for Unicode character callback functions.
1044 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001045 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +02001046 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001047 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001048 * @sa @ref input_char
Camilla Berglunddba2d802013-01-17 23:06:56 +01001049 * @sa glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001050 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001051 * @since Added in version 2.4.
1052 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001053 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001054 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001055 */
Camilla Berglund182e0af2013-02-25 17:02:28 +01001056typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +01001057
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001058/*! @brief The function signature for Unicode character with modifiers
1059 * callbacks.
1060 *
1061 * This is the function signature for Unicode character with modifiers callback
1062 * functions. It is called for each input character, regardless of what
1063 * modifier keys are held down.
1064 *
1065 * @param[in] window The window that received the event.
1066 * @param[in] codepoint The Unicode code point of the character.
1067 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1068 * held down.
1069 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001070 * @sa @ref input_char
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001071 * @sa glfwSetCharModsCallback
1072 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001073 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001074 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001075 * @ingroup input
1076 */
1077typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1078
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001079/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001080 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001081 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001082 *
1083 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001084 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +01001085 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +02001086 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001087 * @sa @ref path_drop
arturo89d07232013-07-10 11:42:14 +02001088 * @sa glfwSetDropCallback
1089 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001090 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001091 *
arturo89d07232013-07-10 11:42:14 +02001092 * @ingroup input
1093 */
Camilla Berglund8f349e82013-12-22 19:28:46 +01001094typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +02001095
Camilla Berglund5f68e122012-11-27 17:07:28 +01001096/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001097 *
1098 * This is the function signature for monitor configuration callback functions.
1099 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001100 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001101 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001102 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001103 * @sa @ref monitor_event
Camilla Berglunddba2d802013-01-17 23:06:56 +01001104 * @sa glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001105 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001106 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001107 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001108 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +01001109 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001110typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +01001111
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001112/*! @brief Video mode type.
1113 *
1114 * This describes a single video mode.
1115 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001116 * @sa @ref monitor_modes
1117 * @sa glfwGetVideoMode glfwGetVideoModes
1118 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001119 * @since Added in version 1.0.
1120 * @glfw3 Added refresh rate member.
Camilla Berglund810bab72015-12-13 17:38:14 +01001121 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001122 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001123 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001124typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001125{
Camilla Berglund95835af2013-05-30 13:53:25 +02001126 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001127 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001128 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001129 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001130 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001131 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001132 /*! The bit depth of the red channel of the video mode.
1133 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001134 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001135 /*! The bit depth of the green channel of the video mode.
1136 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001137 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001138 /*! The bit depth of the blue channel of the video mode.
1139 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001140 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001141 /*! The refresh rate, in Hz, of the video mode.
1142 */
1143 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001144} GLFWvidmode;
1145
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001146/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001147 *
1148 * This describes the gamma ramp for a monitor.
1149 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001150 * @sa @ref monitor_gamma
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001151 * @sa glfwGetGammaRamp glfwSetGammaRamp
1152 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001153 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001154 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001155 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001156 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001157typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001158{
Camilla Berglundc1594112013-05-27 22:29:06 +02001159 /*! An array of value describing the response of the red channel.
1160 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001161 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001162 /*! An array of value describing the response of the green channel.
1163 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001164 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001165 /*! An array of value describing the response of the blue channel.
1166 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001167 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001168 /*! The number of elements in each array.
1169 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001170 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001171} GLFWgammaramp;
1172
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001173/*! @brief Image data.
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001174 *
1175 * @sa @ref cursor_custom
Camilla Berglund810bab72015-12-13 17:38:14 +01001176 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001177 * @since Added in version 2.1.
1178 * @glfw3 Removed format and bytes-per-pixel members.
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001179 */
1180typedef struct GLFWimage
1181{
1182 /*! The width, in pixels, of this image.
1183 */
1184 int width;
1185 /*! The height, in pixels, of this image.
1186 */
1187 int height;
1188 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1189 */
1190 unsigned char* pixels;
1191} GLFWimage;
1192
Camilla Berglund3249f812010-09-07 17:34:51 +02001193
1194/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001195 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001196 *************************************************************************/
1197
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001198/*! @brief Initializes the GLFW library.
1199 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001200 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001201 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001202 * should be terminated in order to free any resources allocated during or
1203 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001204 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001205 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001206 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001207 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001208 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001209 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001210 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001211 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001212 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001213 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001214 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1215 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001216 * @remark @osx This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001217 * application to the `Contents/Resources` subdirectory of the application's
Camilla Berglund4591ad22014-09-18 15:03:29 +02001218 * bundle, if present. This can be disabled with a
1219 * [compile-time option](@ref compile_options_osx).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001220 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001221 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001222 *
1223 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001224 * @sa glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001225 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001226 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001227 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001228 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001229 */
1230GLFWAPI int glfwInit(void);
1231
1232/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001233 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001234 * This function destroys all remaining windows and cursors, restores any
1235 * modified gamma ramps and frees any other allocated resources. Once this
1236 * function is called, you must again call @ref glfwInit successfully before
1237 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001238 *
1239 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001240 * before the application exits. If initialization fails, there is no need to
1241 * call this function, as it is called by @ref glfwInit before it returns
1242 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001243 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001244 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1245 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001246 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001247 *
Camilla Berglund0df4e062015-12-13 14:07:27 +01001248 * @warning The contexts of any remaining windows must not be current on any
1249 * other thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001250 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001251 * @reentrancy This function must not be called from a callback.
Camilla Berglund20858762015-01-01 18:41:22 +01001252 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001253 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001254 *
1255 * @sa @ref intro_init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001256 * @sa glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001257 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001258 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001259 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001260 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001261 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001262GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001263
1264/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001265 *
1266 * This function retrieves the major, minor and revision numbers of the GLFW
1267 * library. It is intended for when you are using GLFW as a shared library and
1268 * want to ensure that you are using the minimum required version.
1269 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001270 * Any or all of the version arguments may be `NULL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001271 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001272 * @param[out] major Where to store the major version number, or `NULL`.
1273 * @param[out] minor Where to store the minor version number, or `NULL`.
1274 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001275 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001276 * @errors None.
1277 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001278 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001279 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001280 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001281 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001282 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001283 * @sa glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001284 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001285 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001286 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001287 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001288 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001289GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001290
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001291/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001292 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001293 * This function returns the compile-time generated
1294 * [version string](@ref intro_version_string) of the GLFW library binary. It
1295 * describes the version, platform, compiler and any platform-specific
Camilla Berglund386b6032016-02-10 13:48:49 +01001296 * compile-time options. It should not be confused with the OpenGL or OpenGL
1297 * ES version string, queried with `glGetString`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001298 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001299 * __Do not use the version string__ to parse the GLFW library version. The
Camilla Berglund386b6032016-02-10 13:48:49 +01001300 * @ref glfwGetVersion function provides the version of the running library
1301 * binary in numerical format.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001302 *
Camilla Berglund386b6032016-02-10 13:48:49 +01001303 * @return The ASCII encoded GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001304 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001305 * @errors None.
1306 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001307 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001308 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001309 * @pointer_lifetime The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001310 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001311 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001312 *
1313 * @sa @ref intro_version
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001314 * @sa glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001315 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001316 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001317 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001318 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001319 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001320GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001321
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001322/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001323 *
1324 * This function sets the error callback, which is called with an error code
1325 * and a human-readable description each time a GLFW error occurs.
1326 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001327 * The error callback is called on the thread where the error occurred. If you
1328 * are using GLFW from multiple threads, your error callback needs to be
1329 * written accordingly.
1330 *
1331 * Because the description string may have been generated specifically for that
1332 * error, it is not guaranteed to be valid after the callback has returned. If
1333 * you wish to use it after the callback returns, you need to make a copy.
1334 *
Camilla Berglund20858762015-01-01 18:41:22 +01001335 * Once set, the error callback remains set even after the library has been
1336 * terminated.
1337 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001338 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001339 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001340 * @return The previously set callback, or `NULL` if no callback was set.
1341 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001342 * @errors None.
1343 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001344 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001345 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001346 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001347 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001348 * @sa @ref error_handling
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001349 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001350 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001351 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001352 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001353 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001354GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001355
Camilla Berglund5f68e122012-11-27 17:07:28 +01001356/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001357 *
1358 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001359 * monitors. The primary monitor is always first in the returned array. If no
1360 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001361 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001362 * @param[out] count Where to store the number of monitors in the returned
1363 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001364 * @return An array of monitor handles, or `NULL` if no monitors were found or
1365 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001366 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001367 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1368 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001369 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1370 * should not free it yourself. It is guaranteed to be valid only until the
1371 * monitor configuration changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001372 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001373 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001374 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001375 * @sa @ref monitor_monitors
1376 * @sa @ref monitor_event
Camilla Berglunddba2d802013-01-17 23:06:56 +01001377 * @sa glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001378 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001379 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001380 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001381 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001382 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001383GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001384
Camilla Berglund5f68e122012-11-27 17:07:28 +01001385/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001386 *
1387 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001388 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001389 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001390 * @return The primary monitor, or `NULL` if no monitors were found or if an
1391 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001392 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001393 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1394 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001395 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001396 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001397 * @remark The primary monitor is always first in the array returned by @ref
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001398 * glfwGetMonitors.
1399 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001400 * @sa @ref monitor_monitors
Camilla Berglunddba2d802013-01-17 23:06:56 +01001401 * @sa glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001402 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001403 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001404 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001405 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001406 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001407GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001408
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001409/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001410 *
1411 * This function returns the position, in screen coordinates, of the upper-left
1412 * corner of the specified monitor.
1413 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001414 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1415 * non-`NULL` position arguments will be set to zero.
1416 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001417 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001418 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1419 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001420 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001421 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1422 * GLFW_PLATFORM_ERROR.
1423 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001424 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001425 *
1426 * @sa @ref monitor_properties
1427 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001428 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001429 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001430 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001431 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001432GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1433
1434/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001435 *
1436 * This function returns the size, in millimetres, of the display area of the
1437 * specified monitor.
1438 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001439 * Some systems do not provide accurate monitor size information, either
1440 * because the monitor
1441 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1442 * data is incorrect or because the driver does not report it accurately.
1443 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001444 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1445 * non-`NULL` size arguments will be set to zero.
1446 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001447 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001448 * @param[out] widthMM Where to store the width, in millimetres, of the
1449 * monitor's display area, or `NULL`.
1450 * @param[out] heightMM Where to store the height, in millimetres, of the
1451 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001452 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001453 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1454 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001455 * @remark @win32 calculates the returned physical size from the
Camilla Berglund4188c262015-01-18 01:55:25 +01001456 * current resolution and system DPI instead of querying the monitor EDID data.
Camilla Berglund0e205772014-03-24 11:58:35 +01001457 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001458 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001459 *
1460 * @sa @ref monitor_properties
1461 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001462 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001463 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001464 * @ingroup monitor
1465 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001466GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001467
Camilla Berglund5f68e122012-11-27 17:07:28 +01001468/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001469 *
1470 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001471 * specified monitor. The name typically reflects the make and model of the
1472 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001473 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001474 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001475 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1476 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001477 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001478 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1479 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001480 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
1481 * should not free it yourself. It is valid until the specified monitor is
1482 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001483 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001484 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001485 *
1486 * @sa @ref monitor_properties
1487 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001488 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001489 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001490 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001491 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001492GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001493
Camilla Berglund5f68e122012-11-27 17:07:28 +01001494/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001495 *
1496 * This function sets the monitor configuration callback, or removes the
1497 * currently set callback. This is called when a monitor is connected to or
1498 * disconnected from the system.
1499 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001500 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001501 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001502 * @return The previously set callback, or `NULL` if no callback was set or the
1503 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001504 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001505 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1506 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001507 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001508 *
1509 * @sa @ref monitor_event
1510 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001511 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001512 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001513 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001514 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001515GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001516
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001517/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001518 *
1519 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001520 * monitor. The returned array is sorted in ascending order, first by color
1521 * bit depth (the sum of all channel depths) and then by resolution area (the
1522 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001523 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001524 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001525 * @param[out] count Where to store the number of video modes in the returned
1526 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001527 * @return An array of video modes, or `NULL` if an
1528 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001529 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001530 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1531 * GLFW_PLATFORM_ERROR.
1532 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001533 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1534 * should not free it yourself. It is valid until the specified monitor is
1535 * disconnected, this function is called again for that monitor or the library
1536 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001537 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001538 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001539 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001540 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001541 * @sa glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001542 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001543 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001544 * @glfw3 Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001545 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001546 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001547 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001548GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001549
Camilla Berglund5f68e122012-11-27 17:07:28 +01001550/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001551 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001552 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001553 * you have created a full screen window for that monitor, the return value
1554 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001555 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001556 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001557 * @return The current mode of the monitor, or `NULL` if an
1558 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001559 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001560 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1561 * GLFW_PLATFORM_ERROR.
1562 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001563 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1564 * should not free it yourself. It is valid until the specified monitor is
1565 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001566 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001567 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001568 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001569 * @sa @ref monitor_modes
Camilla Berglunddba2d802013-01-17 23:06:56 +01001570 * @sa glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001571 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001572 * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001573 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001574 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001575 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001576GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001577
Camilla Berglund92a71e02013-02-12 13:50:41 +01001578/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001579 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001580 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglund5bbc2b42015-03-15 15:40:43 +01001581 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1582 * number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001583 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001584 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001585 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001586 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001587 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1588 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
1589 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001590 * @thread_safety This function must only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001591 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001592 * @sa @ref monitor_gamma
1593 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001594 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001595 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001596 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001597 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001598GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001599
Camilla Berglund4591ad22014-09-18 15:03:29 +02001600/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001601 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001602 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001603 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001604 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001605 * @return The current gamma ramp, or `NULL` if an
1606 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001607 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001608 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1609 * GLFW_PLATFORM_ERROR.
1610 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001611 * @pointer_lifetime The returned structure and its arrays are allocated and
1612 * freed by GLFW. You should not free them yourself. They are valid until the
1613 * specified monitor is disconnected, this function is called again for that
1614 * monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001615 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001616 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001617 *
1618 * @sa @ref monitor_gamma
1619 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001620 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001621 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001622 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001623 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001624GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001625
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001626/*! @brief Sets the current gamma ramp for the specified monitor.
1627 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001628 * This function sets the current gamma ramp for the specified monitor. The
1629 * original gamma ramp for that monitor is saved by GLFW the first time this
1630 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001631 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001632 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001633 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001634 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001635 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1636 * GLFW_PLATFORM_ERROR.
1637 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001638 * @remark Gamma ramp sizes other than 256 are not supported by all platforms
Camilla Berglund76fff4d2015-03-10 19:02:28 +01001639 * or graphics hardware.
1640 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001641 * @remark @win32 The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001642 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001643 * @pointer_lifetime The specified gamma ramp is copied before this function
1644 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001645 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001646 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001647 *
1648 * @sa @ref monitor_gamma
1649 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001650 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001651 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001652 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001653 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001654GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001655
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001656/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001657 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001658 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001659 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001660 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001661 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1662 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001663 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001664 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001665 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001666 * @sa glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001667 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001668 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001669 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001670 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001671 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001672GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001673
1674/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001675 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001676 * This function sets hints for the next call to @ref glfwCreateWindow. The
1677 * hints, once set, retain their values until changed by a call to @ref
1678 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02001679 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01001680 *
Camilla Berglundd6e0a432016-02-09 07:41:48 +01001681 * This function does not check whether the specified hint values are valid.
1682 * If you set hints to invalid values this will instead be reported by the next
1683 * call to @ref glfwCreateWindow.
1684 *
Camilla Berglundd0649e62016-01-27 03:25:21 +01001685 * @param[in] hint The [window hint](@ref window_hints) to set.
1686 * @param[in] value The new value of the window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001687 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001688 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1689 * GLFW_INVALID_ENUM.
1690 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001691 * @thread_safety This function must only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01001692 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001693 * @sa @ref window_hints
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001694 * @sa glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001695 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001696 * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001697 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001698 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001699 */
Camilla Berglundd0649e62016-01-27 03:25:21 +01001700GLFWAPI void glfwWindowHint(int hint, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001701
1702/*! @brief Creates a window and its associated context.
1703 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001704 * This function creates a window and its associated OpenGL or OpenGL ES
1705 * context. Most of the options controlling how the window and its context
1706 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001707 *
1708 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02001709 * can use the newly created context, you need to
1710 * [make it current](@ref context_current). For information about the `share`
1711 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001712 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001713 * The created window, framebuffer and context may differ from what you
1714 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001715 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001716 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02001717 * of the created window, framebuffer and context, see @ref
1718 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001719 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001720 * To create a full screen window, you need to specify the monitor the window
1721 * will cover. If no monitor is specified, windowed mode will be used. Unless
1722 * you have a way for the user to choose a specific monitor, it is recommended
Camilla Berglund4591ad22014-09-18 15:03:29 +02001723 * that you pick the primary monitor. For more information on how to query
1724 * connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001725 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001726 * For full screen windows, the specified size becomes the resolution of the
1727 * window's _desired video mode_. As long as a full screen window has input
1728 * focus, the supported video mode most closely matching the desired video mode
1729 * is set for the specified monitor. For more information about full screen
1730 * windows, including the creation of so called _windowed full screen_ or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001731 * _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001732 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001733 * By default, newly created windows use the placement recommended by the
1734 * window system. To create the window at a specific position, make it
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001735 * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
1736 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
1737 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001738 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001739 * If a full screen window has input focus, the screensaver is prohibited from
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001740 * starting.
1741 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001742 * Window systems put limits on window sizes. Very large or very small window
1743 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02001744 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001745 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001746 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02001747 * the initial value may vary depending on driver settings and defaults.
1748 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001749 * @param[in] width The desired width, in screen coordinates, of the window.
1750 * This must be greater than zero.
1751 * @param[in] height The desired height, in screen coordinates, of the window.
1752 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001753 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001754 * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001755 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001756 * @param[in] share The window whose context to share resources with, or `NULL`
1757 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001758 * @return The handle of the created window, or `NULL` if an
1759 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001760 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001761 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1762 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
1763 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
1764 * GLFW_PLATFORM_ERROR.
1765 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001766 * @remark @win32 Window creation will fail if the Microsoft GDI software
1767 * OpenGL implementation is the only one available.
Camilla Berglund07db5da2013-09-26 19:15:36 +02001768 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001769 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,`
1770 * it will be set as the icon for the window. If no such icon is present, the
1771 * `IDI_WINLOGO` icon will be used instead.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001772 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001773 * @remark @win32 The context to share resources with must not be current on
1774 * any other thread.
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01001775 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001776 * @remark @osx The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01001777 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001778 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001779 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1780 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001781 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001782 * @remark @osx The first time a window is created the menu bar is populated
1783 * with common commands like Hide, Quit and About. The About entry opens
1784 * a minimal about dialog with information from the application's bundle. The
1785 * menu bar can be disabled with a
Camilla Berglund96d230b2014-10-07 02:15:36 +02001786 * [compile-time option](@ref compile_options_osx).
Camilla Berglund4591ad22014-09-18 15:03:29 +02001787 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001788 * @remark @osx On OS X 10.10 and later the window frame will not be rendered
1789 * at full resolution on Retina displays unless the `NSHighResolutionCapable`
1790 * key is enabled in the application bundle's `Info.plist`. For more
1791 * information, see
Camilla Berglund821f3e62015-03-16 22:39:14 +01001792 * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
Camilla Berglundd12b3432015-07-21 17:42:01 +02001793 * in the Mac Developer Library. The GLFW test and example programs use
1794 * a custom `Info.plist` template for this, which can be found as
1795 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01001796 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001797 * @remark @x11 There is no mechanism for setting the window icon yet.
Camilla Berglundb9fb45f2013-10-27 11:03:47 +01001798 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001799 * @remark @x11 Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001800 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02001801 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001802 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
1803 * a window to reach its requested state. This means you may not be able to
1804 * query the final size, position or other attributes directly after window
1805 * creation.
Camilla Berglund20ed0a12015-08-12 21:31:54 +02001806 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001807 * @reentrancy This function must not be called from a callback.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001808 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001809 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001810 *
1811 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001812 * @sa glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001813 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001814 * @since Added in version 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001815 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001816 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001817 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001818GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001819
1820/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001821 *
1822 * This function destroys the specified window and its context. On calling
1823 * this function, no further callbacks will be called for that window.
1824 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001825 * If the context of the specified window is current on the main thread, it is
1826 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001827 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001828 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001829 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001830 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1831 * GLFW_PLATFORM_ERROR.
1832 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001833 * @note The context of the specified window must not be current on any other
1834 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001835 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001836 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01001837 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001838 * @thread_safety This function must only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001839 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001840 * @sa @ref window_creation
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001841 * @sa glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001842 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001843 * @since Added in version 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001844 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001845 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001846 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001847GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001848
Camilla Berglund64afb192013-03-06 23:29:37 +01001849/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001850 *
1851 * This function returns the value of the close flag of the specified window.
1852 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001853 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01001854 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001855 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001856 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1857 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001858 * @thread_safety This function may be called from any thread. Access is not
1859 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001860 *
1861 * @sa @ref window_close
1862 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001863 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001864 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001865 * @ingroup window
1866 */
1867GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1868
Camilla Berglund64afb192013-03-06 23:29:37 +01001869/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001870 *
1871 * This function sets the value of the close flag of the specified window.
1872 * This can be used to override the user's attempt to close the window, or
1873 * to signal that it should be closed.
1874 *
Camilla Berglund64afb192013-03-06 23:29:37 +01001875 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01001876 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001877 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001878 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1879 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001880 * @thread_safety This function may be called from any thread. Access is not
1881 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001882 *
1883 * @sa @ref window_close
1884 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001885 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001886 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001887 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01001888 */
1889GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1890
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001891/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001892 *
1893 * This function sets the window title, encoded as UTF-8, of the specified
1894 * window.
1895 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001896 * @param[in] window The window whose title to change.
1897 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001898 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001899 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1900 * GLFW_PLATFORM_ERROR.
1901 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001902 * @remark @osx The window title will not be updated until the next time you
1903 * process events.
Camilla Berglund6412dcb2015-04-07 21:52:29 +02001904 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001905 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001906 *
1907 * @sa @ref window_title
1908 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001909 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001910 * @glfw3 Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001911 *
1912 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001913 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001914GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001915
Camilla Berglundb823f712016-03-07 14:55:30 +01001916/*! @brief Sets the icon for the specified window.
1917 *
1918 * This function sets the icon of the specified window. If passed an array of
1919 * candidate images, those of or closest to the sizes desired by the system are
1920 * selected. If no images are specified, the window reverts to its default
1921 * icon.
1922 *
1923 * The desired image sizes varies depending on platform and system settings.
1924 * The selected images will be rescaled as needed. Good sizes include 16x16,
1925 * 32x32 and 48x48.
1926 *
1927 * @param[in] window The window whose icon to set.
1928 * @param[in] count The number of images in the specified array, or zero to
1929 * revert to the default window icon.
1930 * @param[in] images The images to create the icon from. This is ignored if
1931 * count is zero.
1932 *
1933 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1934 * GLFW_PLATFORM_ERROR.
1935 *
1936 * @pointer_lifetime The specified image data is copied before this function
1937 * returns.
1938 *
1939 * @remark @osx The GLFW window has no icon, as it is not a document
1940 * window, but the dock icon will be the same as the application bundle's icon.
1941 * For more information on bundles, see the
1942 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1943 * in the Mac Developer Library.
1944 *
1945 * @thread_safety This function must only be called from the main thread.
1946 *
1947 * @sa @ref window_icon
1948 *
1949 * @since Added in version 3.2.
1950 *
1951 * @ingroup window
1952 */
1953GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
1954
Camilla Berglund7c193232013-01-24 19:30:31 +01001955/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001956 *
1957 * This function retrieves the position, in screen coordinates, of the
1958 * upper-left corner of the client area of the specified window.
1959 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001960 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1961 * non-`NULL` position arguments will be set to zero.
1962 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001963 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001964 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
1965 * the client area, or `NULL`.
1966 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
1967 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01001968 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001969 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1970 * GLFW_PLATFORM_ERROR.
1971 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001972 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001973 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001974 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01001975 * @sa glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001976 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001977 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001978 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001979 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01001980 */
1981GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
1982
1983/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001984 *
1985 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02001986 * corner of the client area of the specified windowed mode window. If the
1987 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001988 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001989 * __Do not use this function__ to move an already visible window unless you
1990 * have very good reasons for doing so, as it will confuse and annoy the user.
1991 *
1992 * The window manager may put limits on what positions are allowed. GLFW
1993 * cannot and should not override these limits.
1994 *
Camilla Berglund7c193232013-01-24 19:30:31 +01001995 * @param[in] window The window to query.
1996 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
1997 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01001998 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001999 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2000 * GLFW_PLATFORM_ERROR.
2001 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002002 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002003 *
2004 * @sa @ref window_pos
Camilla Berglund7c193232013-01-24 19:30:31 +01002005 * @sa glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002006 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002007 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002008 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002009 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002010 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002011 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01002012GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01002013
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002014/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002015 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002016 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002017 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002018 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002019 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002020 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2021 * non-`NULL` size arguments will be set to zero.
2022 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002023 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002024 * @param[out] width Where to store the width, in screen coordinates, of the
2025 * client area, or `NULL`.
2026 * @param[out] height Where to store the height, in screen coordinates, of the
2027 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002028 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002029 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2030 * GLFW_PLATFORM_ERROR.
2031 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002032 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002033 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002034 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002035 * @sa glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002036 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002037 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002038 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002039 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002040 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002041 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002042GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002043
Camilla Berglundd84772d2014-02-13 02:57:59 +01002044/*! @brief Sets the size limits of the specified window.
2045 *
2046 * This function sets the size limits of the client area of the specified
2047 * window. If the window is full screen or not resizable, this function does
2048 * nothing.
2049 *
2050 * The size limits are applied immediately and may cause the window to be
2051 * resized.
2052 *
2053 * @param[in] window The window to set limits for.
2054 * @param[in] minwidth The minimum width, in screen coordinates, of the client
2055 * area, or `GLFW_DONT_CARE`.
2056 * @param[in] minheight The minimum height, in screen coordinates, of the
2057 * client area, or `GLFW_DONT_CARE`.
2058 * @param[in] maxwidth The maximum width, in screen coordinates, of the client
2059 * area, or `GLFW_DONT_CARE`.
2060 * @param[in] maxheight The maximum height, in screen coordinates, of the
2061 * client area, or `GLFW_DONT_CARE`.
2062 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002063 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2064 * GLFW_PLATFORM_ERROR.
2065 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002066 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002067 * results are undefined.
2068 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002069 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002070 *
2071 * @sa @ref window_sizelimits
2072 * @sa glfwSetWindowAspectRatio
2073 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002074 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002075 *
2076 * @ingroup window
2077 */
2078GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2079
2080/*! @brief Sets the aspect ratio of the specified window.
2081 *
2082 * This function sets the required aspect ratio of the client area of the
2083 * specified window. If the window is full screen or not resizable, this
2084 * function does nothing.
2085 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002086 * The aspect ratio is specified as a numerator and a denominator and both
2087 * values must be greater than zero. For example, the common 16:9 aspect ratio
2088 * is specified as 16 and 9, respectively.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002089 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002090 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
2091 * ratio limit is disabled.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002092 *
2093 * The aspect ratio is applied immediately and may cause the window to be
2094 * resized.
2095 *
2096 * @param[in] window The window to set limits for.
2097 * @param[in] numer The numerator of the desired aspect ratio, or
2098 * `GLFW_DONT_CARE`.
2099 * @param[in] denom The denominator of the desired aspect ratio, or
2100 * `GLFW_DONT_CARE`.
2101 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002102 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2103 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2104 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002105 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002106 * results are undefined.
2107 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002108 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002109 *
2110 * @sa @ref window_sizelimits
2111 * @sa glfwSetWindowSizeLimits
2112 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002113 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002114 *
2115 * @ingroup window
2116 */
2117GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2118
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002119/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002120 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002121 * This function sets the size, in screen coordinates, of the client area of
2122 * the specified window.
2123 *
2124 * For full screen windows, this function selects and switches to the resolution
2125 * closest to the specified size, without affecting the window's context. As
2126 * the context is unaffected, the bit depths of the framebuffer remain
2127 * unchanged.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002128 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002129 * The window manager may put limits on what sizes are allowed. GLFW cannot
2130 * and should not override these limits.
2131 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002132 * @param[in] window The window to resize.
2133 * @param[in] width The desired width of the specified window.
2134 * @param[in] height The desired height of the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002135 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002136 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2137 * GLFW_PLATFORM_ERROR.
2138 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002139 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002140 *
2141 * @sa @ref window_size
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002142 * @sa glfwGetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002143 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002144 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002145 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002146 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002147 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002148 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002149GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002150
Camilla Berglund34981632013-06-03 12:51:57 +02002151/*! @brief Retrieves the size of the framebuffer of the specified window.
2152 *
2153 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002154 * specified window. If you wish to retrieve the size of the window in screen
2155 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02002156 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002157 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2158 * non-`NULL` size arguments will be set to zero.
2159 *
Camilla Berglund34981632013-06-03 12:51:57 +02002160 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002161 * @param[out] width Where to store the width, in pixels, of the framebuffer,
2162 * or `NULL`.
2163 * @param[out] height Where to store the height, in pixels, of the framebuffer,
2164 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02002165 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002166 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2167 * GLFW_PLATFORM_ERROR.
2168 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002169 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002170 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002171 * @sa @ref window_fbsize
Camilla Berglund34981632013-06-03 12:51:57 +02002172 * @sa glfwSetFramebufferSizeCallback
2173 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002174 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002175 *
Camilla Berglund34981632013-06-03 12:51:57 +02002176 * @ingroup window
2177 */
2178GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
2179
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002180/*! @brief Retrieves the size of the frame of the window.
2181 *
2182 * This function retrieves the size, in screen coordinates, of each edge of the
2183 * frame of the specified window. This size includes the title bar, if the
2184 * window has one. The size of the frame may vary depending on the
2185 * [window-related hints](@ref window_hints_wnd) used to create it.
2186 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002187 * Because this function retrieves the size of each window frame edge and not
2188 * the offset along a particular coordinate axis, the retrieved values will
2189 * always be zero or positive.
2190 *
2191 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2192 * non-`NULL` size arguments will be set to zero.
2193 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002194 * @param[in] window The window whose frame size to query.
2195 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002196 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002197 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02002198 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002199 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002200 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002201 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002202 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002203 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002204 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2205 * GLFW_PLATFORM_ERROR.
2206 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002207 * @thread_safety This function must only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002208 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002209 * @sa @ref window_size
2210 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002211 * @since Added in version 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002212 *
2213 * @ingroup window
2214 */
2215GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2216
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002217/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002218 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002219 * This function iconifies (minimizes) the specified window if it was
2220 * previously restored. If the window is already iconified, this function does
2221 * nothing.
2222 *
2223 * If the specified window is a full screen window, the original monitor
2224 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002225 *
2226 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002227 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002228 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2229 * GLFW_PLATFORM_ERROR.
2230 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002231 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002232 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002233 * @sa @ref window_iconify
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002234 * @sa glfwRestoreWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002235 * @sa glfwMaximizeWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002236 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002237 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002238 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002239 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002240 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002241 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002242GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002243
2244/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002245 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002246 * This function restores the specified window if it was previously iconified
Camilla Berglunda10caa42015-10-13 12:50:59 +02002247 * (minimized) or maximized. If the window is already restored, this function
2248 * does nothing.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002249 *
2250 * If the specified window is a full screen window, the resolution chosen for
2251 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002252 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002253 * @param[in] window The window to restore.
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 glfwIconifyWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002262 * @sa glfwMaximizeWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +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 Berglunde248fb62013-03-29 14:06:23 +01002267 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002268 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002269GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002270
Camilla Berglunda10caa42015-10-13 12:50:59 +02002271/*! @brief Maximizes the specified window.
2272 *
2273 * This function maximizes the specified window if it was previously not
2274 * maximized. If the window is already maximized, this function does nothing.
2275 *
2276 * If the specified window is a full screen window, this function does nothing.
2277 *
2278 * @param[in] window The window to maximize.
2279 *
2280 * @par Thread Safety
2281 * This function may only be called from the main thread.
2282 *
2283 * @sa @ref window_iconify
2284 * @sa glfwIconifyWindow
2285 * @sa glfwRestoreWindow
2286 *
2287 * @since Added in GLFW 3.2.
2288 *
2289 * @ingroup window
2290 */
2291GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
2292
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002293/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002294 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002295 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002296 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002297 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002298 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002299 * @param[in] window The window to make visible.
2300 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002301 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2302 * GLFW_PLATFORM_ERROR.
2303 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002304 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002305 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002306 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002307 * @sa glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002308 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002309 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002310 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002311 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002312 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002313GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002314
2315/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002316 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002317 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002318 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002319 * nothing.
2320 *
2321 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002322 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002323 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2324 * GLFW_PLATFORM_ERROR.
2325 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002326 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002327 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002328 * @sa @ref window_hide
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002329 * @sa glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002330 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002331 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002332 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002333 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002334 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002335GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002336
Camilla Berglundbaf57442016-02-21 15:42:49 +01002337/*! @brief Brings the specified window to front and sets input focus.
2338 *
2339 * This function brings the specified window to front and sets input focus.
2340 * The window should already be visible and not iconified.
2341 *
2342 * By default, both windowed and full screen mode windows are focused when
2343 * initially created. Set the [GLFW_FOCUSED](@ref window_hints_wnd) to disable
2344 * this behavior.
2345 *
2346 * __Do not use this function__ to steal focus from other applications unless
2347 * you are certain that is what the user wants. Focus stealing can be
2348 * extremely disruptive.
2349 *
2350 * @param[in] window The window to give input focus.
2351 *
2352 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2353 * GLFW_PLATFORM_ERROR.
2354 *
2355 * @thread_safety This function must only be called from the main thread.
2356 *
2357 * @sa @ref window_focus
2358 *
2359 * @since Added in version 3.2.
2360 *
2361 * @ingroup window
2362 */
2363GLFWAPI void glfwFocusWindow(GLFWwindow* window);
2364
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002365/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002366 *
2367 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002368 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002369 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002370 * @param[in] window The window to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002371 * @return The monitor, or `NULL` if the window is in windowed mode or an error
2372 * occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002373 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002374 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2375 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002376 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002377 *
2378 * @sa @ref window_monitor
2379 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002380 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002381 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002382 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002383 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002384GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002385
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002386/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002387 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002388 * This function returns the value of an attribute of the specified window or
2389 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002390 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002391 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002392 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2393 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002394 * @return The value of the attribute, or zero if an
2395 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002396 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002397 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2398 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2399 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002400 * @remark Framebuffer related hints are not window attributes. See @ref
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002401 * window_attribs_fb for more information.
2402 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002403 * @remark Zero is a valid value for many window and context related
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002404 * attributes so you cannot use a return value of zero as an indication of
2405 * errors. However, this function should not fail as long as it is passed
2406 * valid arguments and the library has been [initialized](@ref intro_init).
2407 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002408 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002409 *
2410 * @sa @ref window_attribs
2411 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002412 * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
Camilla Berglund4188c262015-01-18 01:55:25 +01002413 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002414 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002415 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002416 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002417GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002418
2419/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002420 *
2421 * This function sets the user-defined pointer of the specified window. The
2422 * current value is retained until the window is destroyed. The initial value
2423 * is `NULL`.
2424 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002425 * @param[in] window The window whose pointer to set.
2426 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002427 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002428 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2429 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002430 * @thread_safety This function may be called from any thread. Access is not
2431 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002432 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002433 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002434 * @sa glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002435 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002436 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002437 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002438 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002439 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002440GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002441
2442/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002443 *
2444 * This function returns the current value of the user-defined pointer of the
2445 * specified window. The initial value is `NULL`.
2446 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002447 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002448 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002449 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2450 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002451 * @thread_safety This function may be called from any thread. Access is not
2452 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002453 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002454 * @sa @ref window_userptr
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002455 * @sa glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002456 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002457 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002458 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002459 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002460 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002461GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002462
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002463/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002464 *
2465 * This function sets the position callback of the specified window, which is
2466 * called when the window is moved. The callback is provided with the screen
2467 * position of the upper-left corner of the client area of the window.
2468 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002469 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002470 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002471 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002472 * @return The previously set callback, or `NULL` if no callback was set or the
2473 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002474 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002475 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2476 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002477 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002478 *
2479 * @sa @ref window_pos
2480 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002481 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002482 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002483 * @ingroup window
2484 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002485GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002486
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002487/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002488 *
2489 * This function sets the size callback of the specified window, which is
2490 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002491 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002492 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002493 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002494 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002495 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002496 * @return The previously set callback, or `NULL` if no callback was set or the
2497 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002498 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002499 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2500 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002501 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002502 *
2503 * @sa @ref window_size
2504 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002505 * @since Added in version 1.0.
2506 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002507 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002508 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002509 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002510GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002511
2512/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002513 *
2514 * This function sets the close callback of the specified window, which is
2515 * called when the user attempts to close the window, for example by clicking
2516 * the close widget in the title bar.
2517 *
2518 * The close flag is set before this callback is called, but you can modify it
2519 * at any time with @ref glfwSetWindowShouldClose.
2520 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002521 * The close callback is not triggered by @ref glfwDestroyWindow.
2522 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002523 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002524 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002525 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002526 * @return The previously set callback, or `NULL` if no callback was set or the
2527 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002528 *
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 * @remark @osx Selecting Quit from the application menu will trigger the close
2532 * callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002533 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002534 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002535 *
2536 * @sa @ref window_close
2537 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002538 * @since Added in version 2.5.
2539 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002540 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002541 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002542 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002543GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002544
2545/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002546 *
2547 * This function sets the refresh callback of the specified window, which is
2548 * called when the client area of the window needs to be redrawn, for example
2549 * if the window has been exposed after having been covered by another window.
2550 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002551 * On compositing window systems such as Aero, Compiz or Aqua, where the window
2552 * contents are saved off-screen, this callback may be called only very
2553 * infrequently or never at all.
2554 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002555 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002556 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002557 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002558 * @return The previously set callback, or `NULL` if no callback was set or the
2559 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002560 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002561 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2562 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002563 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002564 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002565 * @sa @ref window_refresh
2566 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002567 * @since Added in version 2.5.
2568 * @glfw3 Added window handle parameter and return value.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002569 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002570 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002571 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002572GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002573
2574/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002575 *
2576 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01002577 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002578 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002579 * After the focus callback is called for a window that lost input focus,
2580 * synthetic key and mouse button release events will be generated for all such
2581 * that had been pressed. For more information, see @ref glfwSetKeyCallback
2582 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02002583 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002584 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002585 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002586 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002587 * @return The previously set callback, or `NULL` if no callback was set or the
2588 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002589 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002590 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2591 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002592 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002593 *
2594 * @sa @ref window_focus
2595 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002596 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002597 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002598 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002599 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002600GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002601
2602/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002603 *
2604 * This function sets the iconification callback of the specified window, which
2605 * is called when the window is iconified or restored.
2606 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002607 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002608 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002609 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002610 * @return The previously set callback, or `NULL` if no callback was set or the
2611 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002612 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002613 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2614 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002615 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002616 *
2617 * @sa @ref window_iconify
2618 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002619 * @since Added in version 3.0.
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 GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02002624
Camilla Berglund34981632013-06-03 12:51:57 +02002625/*! @brief Sets the framebuffer resize callback for the specified window.
2626 *
2627 * This function sets the framebuffer resize callback of the specified window,
2628 * which is called when the framebuffer of the specified window is resized.
2629 *
2630 * @param[in] window The window whose callback to set.
2631 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2632 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002633 * @return The previously set callback, or `NULL` if no callback was set or the
2634 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02002635 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002636 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2637 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002638 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002639 *
2640 * @sa @ref window_fbsize
2641 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002642 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002643 *
Camilla Berglund34981632013-06-03 12:51:57 +02002644 * @ingroup window
2645 */
2646GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
2647
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002648/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002649 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002650 * This function processes only those events that are already in the event
2651 * queue and then returns immediately. Processing events will cause the window
2652 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002653 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002654 * On some platforms, a window move, resize or menu operation will cause event
2655 * processing to block. This is due to how event processing is designed on
2656 * those platforms. You can use the
2657 * [window refresh callback](@ref window_refresh) to redraw the contents of
2658 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002659 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002660 * On some platforms, certain events are sent directly to the application
2661 * without going through the event queue, causing callbacks to be called
2662 * outside of a call to one of the event processing functions.
Camilla Berglund401033c2013-03-12 19:17:07 +01002663 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002664 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002665 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002666 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2667 * GLFW_PLATFORM_ERROR.
2668 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002669 * @reentrancy This function must not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01002670 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002671 * @thread_safety This function must only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02002672 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002673 * @sa @ref events
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002674 * @sa glfwWaitEvents
Camilla Berglund56208952016-02-02 21:11:16 +01002675 * @sa glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002676 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002677 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002678 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002679 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002680 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002681GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002682
Camilla Berglund4591ad22014-09-18 15:03:29 +02002683/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002684 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002685 * This function puts the calling thread to sleep until at least one event is
2686 * available in the event queue. Once one or more events are available,
2687 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
2688 * are processed and the function then returns immediately. Processing events
2689 * will cause the window and input callbacks associated with those events to be
2690 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02002691 *
2692 * Since not all events are associated with callbacks, this function may return
2693 * without a callback having been called even if you are monitoring all
2694 * callbacks.
2695 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002696 * On some platforms, a window move, resize or menu operation will cause event
2697 * processing to block. This is due to how event processing is designed on
2698 * those platforms. You can use the
2699 * [window refresh callback](@ref window_refresh) to redraw the contents of
2700 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002701 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002702 * On some platforms, certain callbacks may be called outside of a call to one
2703 * of the event processing functions.
2704 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002705 * If no windows exist, this function returns immediately. For synchronization
2706 * of threads in applications that do not create windows, use your threading
2707 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01002708 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002709 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002710 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002711 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2712 * GLFW_PLATFORM_ERROR.
2713 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002714 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01002715 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002716 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002717 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002718 * @sa @ref events
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002719 * @sa glfwPollEvents
Camilla Berglund56208952016-02-02 21:11:16 +01002720 * @sa glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002721 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002722 * @since Added in version 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002723 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002724 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002725 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002726GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02002727
Camilla Berglund56208952016-02-02 21:11:16 +01002728/*! @brief Waits with timeout until events are queued and processes them.
2729 *
2730 * This function puts the calling thread to sleep until at least one event is
2731 * available in the event queue, or until the specified timeout is reached. If
2732 * one or more events are available, it behaves exactly like @ref
2733 * glfwPollEvents, i.e. the events in the queue are processed and the function
2734 * then returns immediately. Processing events will cause the window and input
2735 * callbacks associated with those events to be called.
2736 *
2737 * The timeout value must be a positive finite number.
2738 *
2739 * Since not all events are associated with callbacks, this function may return
2740 * without a callback having been called even if you are monitoring all
2741 * callbacks.
2742 *
2743 * On some platforms, a window move, resize or menu operation will cause event
2744 * processing to block. This is due to how event processing is designed on
2745 * those platforms. You can use the
2746 * [window refresh callback](@ref window_refresh) to redraw the contents of
2747 * your window when necessary during such operations.
2748 *
2749 * On some platforms, certain callbacks may be called outside of a call to one
2750 * of the event processing functions.
2751 *
2752 * If no windows exist, this function returns immediately. For synchronization
2753 * of threads in applications that do not create windows, use your threading
2754 * library of choice.
2755 *
2756 * Event processing is not required for joystick input to work.
2757 *
2758 * @param[in] timeout The maximum amount of time, in seconds, to wait.
2759 *
2760 * @reentrancy This function must not be called from a callback.
2761 *
2762 * @thread_safety This function must only be called from the main thread.
2763 *
2764 * @sa @ref events
2765 * @sa glfwPollEvents
2766 * @sa glfwWaitEvents
2767 *
2768 * @since Added in version 3.2.
2769 *
2770 * @ingroup window
2771 */
2772GLFWAPI void glfwWaitEventsTimeout(double timeout);
2773
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002774/*! @brief Posts an empty event to the event queue.
2775 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002776 * This function posts an empty event from the current thread to the event
2777 * queue, causing @ref glfwWaitEvents to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002778 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002779 * If no windows exist, this function returns immediately. For synchronization
2780 * of threads in applications that do not create windows, use your threading
2781 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002782 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002783 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2784 * GLFW_PLATFORM_ERROR.
2785 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002786 * @thread_safety This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002787 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002788 * @sa @ref events
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002789 * @sa glfwWaitEvents
2790 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002791 * @since Added in version 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002792 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002793 * @ingroup window
2794 */
2795GLFWAPI void glfwPostEmptyEvent(void);
2796
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002797/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002798 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002799 * This function returns the value of an input option for the specified window.
2800 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2801 * `GLFW_STICKY_MOUSE_BUTTONS`.
2802 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002803 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02002804 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002805 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002806 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002807 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2808 * GLFW_INVALID_ENUM.
2809 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002810 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002811 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002812 * @sa glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002813 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002814 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002815 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002816 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002817 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002818GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002819
2820/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002821 *
2822 * This function sets an input mode option for the specified window. The mode
2823 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund71d2b572013-03-12 15:33:05 +01002824 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002825 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002826 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002827 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02002828 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
2829 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund4188c262015-01-18 01:55:25 +01002830 * area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01002831 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
2832 * and unlimited cursor movement. This is useful for implementing for
2833 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002834 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02002835 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
2836 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02002837 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
2838 * the next time it is called even if the key had been released before the
2839 * call. This is useful when you are only interested in whether keys have been
2840 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002841 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002842 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02002843 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
2844 * If sticky mouse buttons are enabled, a mouse button press will ensure that
2845 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
2846 * if the mouse button had been released before the call. This is useful when
2847 * you are only interested in whether mouse buttons have been pressed but not
2848 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002849 *
2850 * @param[in] window The window whose input mode to set.
2851 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2852 * `GLFW_STICKY_MOUSE_BUTTONS`.
2853 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002854 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002855 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2856 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2857 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002858 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002859 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002860 * @sa glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01002861 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002862 * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002863 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002864 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002865 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002866GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002867
Camilla Berglund9c315412015-07-02 14:24:50 +02002868/*! @brief Returns the localized name of the specified printable key.
2869 *
2870 * This function returns the localized name of the specified printable key.
Camilla Berglund70ffae72016-02-22 11:54:56 +01002871 * This is intended for displaying key bindings to the user.
Camilla Berglund9c315412015-07-02 14:24:50 +02002872 *
Camilla Berglund70ffae72016-02-22 11:54:56 +01002873 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used instead, otherwise
2874 * the scancode is ignored. If a non-printable key or (if the key is
2875 * `GLFW_KEY_UNKNOWN`) a scancode that maps to a non-printable key is
2876 * specified, this function returns `NULL`.
2877 *
2878 * This behavior allows you to pass in the arguments passed to the
2879 * [key callback](@ref input_key) without modification.
2880 *
2881 * The printable keys are:
2882 * - `GLFW_KEY_APOSTROPHE`
2883 * - `GLFW_KEY_COMMA`
2884 * - `GLFW_KEY_MINUS`
2885 * - `GLFW_KEY_PERIOD`
2886 * - `GLFW_KEY_SLASH`
2887 * - `GLFW_KEY_SEMICOLON`
2888 * - `GLFW_KEY_EQUAL`
2889 * - `GLFW_KEY_LEFT_BRACKET`
2890 * - `GLFW_KEY_RIGHT_BRACKET`
2891 * - `GLFW_KEY_BACKSLASH`
2892 * - `GLFW_KEY_WORLD_1`
2893 * - `GLFW_KEY_WORLD_2`
2894 * - `GLFW_KEY_0` to `GLFW_KEY_9`
2895 * - `GLFW_KEY_A` to `GLFW_KEY_Z`
2896 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
2897 * - `GLFW_KEY_KP_DECIMAL`
2898 * - `GLFW_KEY_KP_DIVIDE`
2899 * - `GLFW_KEY_KP_MULTIPLY`
2900 * - `GLFW_KEY_KP_SUBTRACT`
2901 * - `GLFW_KEY_KP_ADD`
2902 * - `GLFW_KEY_KP_EQUAL`
Camilla Berglund9c315412015-07-02 14:24:50 +02002903 *
2904 * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
2905 * @param[in] scancode The scancode of the key to query.
Camilla Berglund70ffae72016-02-22 11:54:56 +01002906 * @return The localized name of the key, or `NULL`.
Camilla Berglund9c315412015-07-02 14:24:50 +02002907 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002908 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2909 * GLFW_PLATFORM_ERROR.
2910 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002911 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
2912 * should not free it yourself. It is valid until the next call to @ref
2913 * glfwGetKeyName, or until the library is terminated.
Camilla Berglund9c315412015-07-02 14:24:50 +02002914 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002915 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9c315412015-07-02 14:24:50 +02002916 *
2917 * @sa @ref input_key_name
2918 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002919 * @since Added in version 3.2.
Camilla Berglund9c315412015-07-02 14:24:50 +02002920 *
2921 * @ingroup input
2922 */
2923GLFWAPI const char* glfwGetKeyName(int key, int scancode);
2924
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002925/*! @brief Returns the last reported state of a keyboard key for the specified
2926 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002927 *
2928 * This function returns the last state reported for the specified key to the
2929 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02002930 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002931 * the key callback.
2932 *
2933 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02002934 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
2935 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002936 *
2937 * The key functions deal with physical keys, with [key tokens](@ref keys)
2938 * named after their use on the standard US keyboard layout. If you want to
2939 * input text, use the Unicode character callback instead.
2940 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002941 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
2942 * used with this function.
2943 *
Camilla Berglund9c315412015-07-02 14:24:50 +02002944 * __Do not use this function__ to implement [text input](@ref input_char).
2945 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002946 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002947 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
2948 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002949 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002950 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002951 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2952 * GLFW_INVALID_ENUM.
2953 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002954 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002955 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002956 * @sa @ref input_key
2957 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002958 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002959 * @glfw3 Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02002960 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002961 * @ingroup input
2962 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002963GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002964
2965/*! @brief Returns the last reported state of a mouse button for the specified
2966 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002967 *
2968 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02002969 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002970 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002971 *
2972 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02002973 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
2974 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002975 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002976 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002977 * @param[in] button The desired [mouse button](@ref buttons).
2978 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002979 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002980 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2981 * GLFW_INVALID_ENUM.
2982 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002983 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002984 *
2985 * @sa @ref input_mouse_button
2986 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002987 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002988 * @glfw3 Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01002989 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002990 * @ingroup input
2991 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002992GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002993
Camilla Berglundd4591452014-02-11 18:24:01 +01002994/*! @brief Retrieves the position of the cursor relative to the client area of
2995 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002996 *
Camilla Berglundd4591452014-02-11 18:24:01 +01002997 * This function returns the position of the cursor, in screen coordinates,
2998 * relative to the upper-left corner of the client area of the specified
2999 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003000 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02003001 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
3002 * position is unbounded and limited only by the minimum and maximum values of
3003 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003004 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02003005 * The coordinate can be converted to their integer equivalents with the
3006 * `floor` function. Casting directly to an integer type works for positive
3007 * coordinates, but fails for negative ones.
3008 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003009 * Any or all of the position arguments may be `NULL`. If an error occurs, all
3010 * non-`NULL` position arguments will be set to zero.
3011 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003012 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003013 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
3014 * left edge of the client area, or `NULL`.
3015 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
3016 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003017 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003018 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3019 * GLFW_PLATFORM_ERROR.
3020 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003021 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003022 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003023 * @sa @ref cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003024 * @sa glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003025 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003026 * @since Added in version 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003027 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003028 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003029 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003030GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003031
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003032/*! @brief Sets the position of the cursor, relative to the client area of the
3033 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003034 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003035 * This function sets the position, in screen coordinates, of the cursor
3036 * relative to the upper-left corner of the client area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01003037 * window. The window must have input focus. If the window does not have
3038 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003039 *
Camilla Berglund20858762015-01-01 18:41:22 +01003040 * __Do not use this function__ to implement things like camera controls. GLFW
3041 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
3042 * cursor, transparently re-centers it and provides unconstrained cursor
3043 * motion. See @ref glfwSetInputMode for more information.
3044 *
3045 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
3046 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02003047 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003048 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003049 * @param[in] window The desired window.
3050 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003051 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003052 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003053 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003054 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003055 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3056 * GLFW_PLATFORM_ERROR.
3057 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003058 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
3059 * the window focus event to arrive. This means you may not be able to set the
3060 * cursor position directly after window creation.
Camilla Berglund2eb5ed32014-08-31 13:10:06 +02003061 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003062 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003063 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003064 * @sa @ref cursor_pos
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003065 * @sa glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003066 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003067 * @since Added in version 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003068 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003069 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003070 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003071GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003072
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003073/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03003074 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003075 * Creates a new custom cursor image that can be set for a window with @ref
3076 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
3077 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003078 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02003079 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
3080 * bits per channel. They are arranged canonically as packed sequential rows,
3081 * starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01003082 *
3083 * The cursor hotspot is specified in pixels, relative to the upper-left corner
3084 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
3085 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003086 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003087 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01003088 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
3089 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
Camilla Berglund4188c262015-01-18 01:55:25 +01003090 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02003091 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03003092 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003093 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3094 * GLFW_PLATFORM_ERROR.
3095 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003096 * @pointer_lifetime The specified image data is copied before this function
3097 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003098 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003099 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003100 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003101 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003102 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003103 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003104 * @sa glfwDestroyCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003105 * @sa glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003106 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003107 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003108 *
3109 * @ingroup input
3110 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003111GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03003112
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003113/*! @brief Creates a cursor with a standard shape.
3114 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003115 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
3116 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003117 *
3118 * @param[in] shape One of the [standard shapes](@ref shapes).
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003119 * @return A new cursor ready to use or `NULL` if an
3120 * [error](@ref error_handling) occurred.
3121 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003122 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3123 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3124 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003125 * @reentrancy This function must not be called from a callback.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003126 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003127 * @thread_safety This function must only be called from the main thread.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003128 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003129 * @sa @ref cursor_object
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003130 * @sa glfwCreateCursor
3131 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003132 * @since Added in version 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003133 *
3134 * @ingroup input
3135 */
3136GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
3137
urraka40c04a72013-12-04 10:19:22 -03003138/*! @brief Destroys a cursor.
3139 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003140 * This function destroys a cursor previously created with @ref
3141 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
3142 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03003143 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003144 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03003145 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003146 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3147 * GLFW_PLATFORM_ERROR.
3148 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003149 * @reentrancy This function must not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003150 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003151 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003152 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003153 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003154 * @sa glfwCreateCursor
3155 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003156 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003157 *
3158 * @ingroup input
3159 */
3160GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
3161
Camilla Berglund4188c262015-01-18 01:55:25 +01003162/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03003163 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003164 * This function sets the cursor image to be used when the cursor is over the
3165 * client area of the specified window. The set cursor will only be visible
3166 * when the [cursor mode](@ref cursor_mode) of the window is
3167 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003168 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003169 * On some platforms, the set cursor may not be visible unless the window also
3170 * has input focus.
3171 *
3172 * @param[in] window The window to set the cursor for.
3173 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
3174 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03003175 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003176 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3177 * GLFW_PLATFORM_ERROR.
3178 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003179 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003180 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003181 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003182 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003183 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003184 *
urraka40c04a72013-12-04 10:19:22 -03003185 * @ingroup input
3186 */
3187GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
3188
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003189/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003190 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003191 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003192 * when a key is pressed, repeated or released.
3193 *
Camilla Berglund948cc042013-04-16 02:02:22 +02003194 * The key functions deal with physical keys, with layout independent
3195 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003196 * layout. If you want to input text, use the
3197 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003198 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003199 * When a window loses input focus, it will generate synthetic key release
3200 * events for all pressed keys. You can tell these events from user-generated
3201 * events by the fact that the synthetic ones are generated after the focus
3202 * loss event has been processed, i.e. after the
3203 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003204 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02003205 * The scancode of a key is specific to that platform or sometimes even to that
3206 * machine. Scancodes are intended to allow users to bind keys that don't have
3207 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02003208 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003209 *
3210 * Sometimes GLFW needs to generate synthetic key events, in which case the
3211 * scancode may be zero.
3212 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003213 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003214 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003215 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003216 * @return The previously set callback, or `NULL` if no callback was set or the
3217 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003218 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003219 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3220 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003221 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003222 *
3223 * @sa @ref input_key
3224 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003225 * @since Added in version 1.0.
3226 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003227 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003228 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003229 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003230GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003231
3232/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003233 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003234 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003235 * called when a Unicode character is input.
3236 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003237 * The character callback is intended for Unicode text input. As it deals with
3238 * characters, it is keyboard layout dependent, whereas the
3239 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
3240 * to physical keys, as a key may produce zero, one or more characters. If you
3241 * want to know whether a specific physical key was pressed or released, see
3242 * the key callback instead.
3243 *
3244 * The character callback behaves as system text input normally does and will
3245 * not be called if modifier keys are held down that would prevent normal text
3246 * input on that platform, for example a Super (Command) key on OS X or Alt key
3247 * on Windows. There is a
3248 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
3249 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003250 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003251 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003252 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003253 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003254 * @return The previously set callback, or `NULL` if no callback was set or the
3255 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003256 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003257 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3258 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003259 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003260 *
3261 * @sa @ref input_char
3262 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003263 * @since Added in version 2.4.
3264 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003265 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003266 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003267 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003268GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003269
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003270/*! @brief Sets the Unicode character with modifiers callback.
3271 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003272 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003273 * window, which is called when a Unicode character is input regardless of what
3274 * modifier keys are used.
3275 *
3276 * The character with modifiers callback is intended for implementing custom
3277 * Unicode character input. For regular Unicode text input, see the
3278 * [character callback](@ref glfwSetCharCallback). Like the character
3279 * callback, the character with modifiers callback deals with characters and is
3280 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
3281 * a key may produce zero, one or more characters. If you want to know whether
3282 * a specific physical key was pressed or released, see the
3283 * [key callback](@ref glfwSetKeyCallback) instead.
3284 *
3285 * @param[in] window The window whose callback to set.
3286 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3287 * callback.
3288 * @return The previously set callback, or `NULL` if no callback was set or an
3289 * error occurred.
3290 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003291 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3292 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003293 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003294 *
3295 * @sa @ref input_char
3296 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003297 * @since Added in version 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003298 *
3299 * @ingroup input
3300 */
3301GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
3302
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003303/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003304 *
3305 * This function sets the mouse button callback of the specified window, which
3306 * is called when a mouse button is pressed or released.
3307 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003308 * When a window loses input focus, it will generate synthetic mouse button
3309 * release events for all pressed mouse buttons. You can tell these events
3310 * from user-generated events by the fact that the synthetic ones are generated
3311 * after the focus loss event has been processed, i.e. after the
3312 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003313 *
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 callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003316 * 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_mouse_button
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 Berglundbce2cd62012-11-22 16:38:24 +01003329 * @ingroup input
3330 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003331GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003332
3333/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003334 *
3335 * This function sets the cursor position callback of the specified window,
3336 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003337 * position, in screen coordinates, relative to the upper-left corner of the
3338 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003339 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003340 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003341 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003342 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003343 * @return The previously set callback, or `NULL` if no callback was set or the
3344 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003345 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003346 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3347 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003348 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003349 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003350 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02003351 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003352 * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003353 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003354 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003355 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003356GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003357
3358/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003359 *
3360 * This function sets the cursor boundary crossing callback of the specified
3361 * window, which is called when the cursor enters or leaves the client area of
3362 * the window.
3363 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003364 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003365 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003366 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003367 * @return The previously set callback, or `NULL` if no callback was set or the
3368 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003369 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003370 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3371 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003372 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003373 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003374 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02003375 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003376 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003377 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003378 * @ingroup input
3379 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003380GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003381
3382/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003383 *
3384 * This function sets the scroll callback of the specified window, which is
3385 * called when a scrolling device is used, such as a mouse wheel or scrolling
3386 * area of a touchpad.
3387 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003388 * The scroll callback receives all scrolling input, like that from a mouse
3389 * wheel or a touchpad scrolling area.
3390 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003391 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003392 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003393 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003394 * @return The previously set callback, or `NULL` if no callback was set or the
3395 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003396 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003397 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3398 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003399 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003400 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003401 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02003402 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003403 * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003404 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003405 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003406 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003407GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02003408
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003409/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02003410 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003411 * This function sets the file drop callback of the specified window, which is
3412 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02003413 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003414 * Because the path array and its strings may have been generated specifically
3415 * for that event, they are not guaranteed to be valid after the callback has
3416 * returned. If you wish to use them after the callback returns, you need to
3417 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02003418 *
3419 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003420 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
3421 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003422 * @return The previously set callback, or `NULL` if no callback was set or the
3423 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02003424 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003425 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3426 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003427 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003428 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003429 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02003430 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003431 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003432 *
arturo89d07232013-07-10 11:42:14 +02003433 * @ingroup input
3434 */
3435GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
3436
Camilla Berglundfdd45182013-05-27 15:13:09 +02003437/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003438 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02003439 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003440 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003441 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003442 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003443 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003444 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3445 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3446 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003447 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003448 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003449 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02003450 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003451 * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003452 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003453 * @ingroup input
3454 */
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003455GLFWAPI int glfwJoystickPresent(int joy);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003456
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003457/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003458 *
3459 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003460 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003461 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003462 * Querying a joystick slot with no device present is not an error, but will
3463 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3464 * check device presence.
3465 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003466 * @param[in] joy The [joystick](@ref joysticks) to query.
3467 * @param[out] count Where to store the number of axis values in the returned
3468 * array. This is set to zero if an error occurred.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003469 * @return An array of axis values, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003470 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003471 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3472 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3473 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003474 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3475 * should not free it yourself. It is valid until the specified joystick is
3476 * disconnected, this function is called again for that joystick or the library
3477 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003478 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003479 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003480 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003481 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02003482 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003483 * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003484 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003485 * @ingroup input
3486 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003487GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003488
Camilla Berglunde93bade2013-06-16 02:33:33 +02003489/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003490 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02003491 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003492 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003493 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003494 * Querying a joystick slot with no device present is not an error, but will
3495 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3496 * check device presence.
3497 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003498 * @param[in] joy The [joystick](@ref joysticks) to query.
3499 * @param[out] count Where to store the number of button states in the returned
3500 * array. This is set to zero if an error occurred.
Camilla Berglunde93bade2013-06-16 02:33:33 +02003501 * @return An array of button states, or `NULL` if the joystick is not present.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003502 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003503 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3504 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3505 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003506 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3507 * should not free it yourself. It is valid until the specified joystick is
3508 * disconnected, this function is called again for that joystick or the library
3509 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003510 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003511 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003512 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003513 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003514 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003515 * @since Added in version 2.2.
Camilla Berglund951a9582016-01-31 21:32:14 +01003516 * @glfw3 Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003517 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003518 * @ingroup input
3519 */
Camilla Berglund180a4ee2013-06-04 18:20:38 +02003520GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02003521
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003522/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003523 *
3524 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003525 * The returned string is allocated and freed by GLFW. You should not free it
3526 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003527 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003528 * Querying a joystick slot with no device present is not an error, but will
3529 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3530 * check device presence.
3531 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003532 * @param[in] joy The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003533 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003534 * is not present.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01003535 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003536 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3537 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3538 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003539 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3540 * should not free it yourself. It is valid until the specified joystick is
3541 * disconnected, this function is called again for that joystick or the library
3542 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003543 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003544 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003545 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003546 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02003547 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003548 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003549 *
3550 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003551 */
Camilla Berglund93a1d1c2012-09-07 01:01:34 +02003552GLFWAPI const char* glfwGetJoystickName(int joy);
Camilla Berglund3249f812010-09-07 17:34:51 +02003553
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003554/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003555 *
3556 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02003557 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003558 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003559 * @param[in] window The window that will own the clipboard contents.
3560 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003561 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003562 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3563 * GLFW_PLATFORM_ERROR.
3564 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003565 * @pointer_lifetime The specified string is copied before this function
3566 * returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003567 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003568 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003569 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003570 * @sa @ref clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003571 * @sa glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003572 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003573 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003574 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003575 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003576 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003577GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003578
Camilla Berglund4591ad22014-09-18 15:03:29 +02003579/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003580 *
3581 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02003582 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02003583 * if its contents cannot be converted, `NULL` is returned and a @ref
3584 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003585 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003586 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003587 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02003588 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003589 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003590 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3591 * GLFW_PLATFORM_ERROR.
3592 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003593 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3594 * should not free it yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02003595 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
3596 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003597 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003598 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003599 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003600 * @sa @ref clipboard
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003601 * @sa glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003602 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003603 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003604 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003605 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003606 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003607GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01003608
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003609/*! @brief Returns the value of the GLFW timer.
3610 *
3611 * This function returns the value of the GLFW timer. Unless the timer has
3612 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
3613 * was initialized.
3614 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003615 * The resolution of the timer is system dependent, but is usually on the order
3616 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
3617 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003618 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003619 * @return The current value, in seconds, or zero if an
3620 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003621 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003622 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3623 *
Camilla Berglund487557b2016-03-06 11:43:02 +01003624 * @thread_safety This function may be called from any thread. Reading of the
3625 * internal timer offset is not atomic.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003626 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003627 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02003628 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003629 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003630 *
3631 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003632 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003633GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02003634
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003635/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003636 *
3637 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003638 * up from that value. The value must be a positive finite number less than
3639 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003640 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003641 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003642 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003643 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3644 * GLFW_INVALID_VALUE.
3645 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003646 * @remark The upper limit of the timer is calculated as
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003647 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
3648 * storing nanoseconds in 64 bits. The limit may be increased in the future.
3649 *
Camilla Berglund487557b2016-03-06 11:43:02 +01003650 * @thread_safety This function may be called from any thread. Writing of the
3651 * internal timer offset is not atomic.
Camilla Berglund0e205772014-03-24 11:58:35 +01003652 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003653 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01003654 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003655 * @since Added in version 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003656 *
3657 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003658 */
3659GLFWAPI void glfwSetTime(double time);
3660
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003661/*! @brief Returns the current value of the raw timer.
3662 *
Camilla Berglund337c77a2016-03-06 14:11:14 +01003663 * This function returns the current value of the raw timer, measured in
3664 * 1&nbsp;/&nbsp;frequency seconds. To get the frequency, call @ref
3665 * glfwGetTimerFrequency.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003666 *
3667 * @return The value of the timer, or zero if an
3668 * [error](@ref error_handling) occurred.
3669 *
Camilla Berglund46fce402016-03-07 13:35:37 +01003670 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003671 *
3672 * @thread_safety This function may be called from any thread.
3673 *
3674 * @sa @ref time
3675 * @sa glfwGetTimerFrequency
3676 *
3677 * @since Added in version 3.2.
3678 *
3679 * @ingroup input
3680 */
3681GLFWAPI GLFWuint64 glfwGetTimerValue(void);
3682
3683/*! @brief Returns the frequency, in Hz, of the raw timer.
3684 *
Camilla Berglunddefaea32016-03-07 13:36:54 +01003685 * This function returns the frequency, in Hz, of the raw timer.
3686 *
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003687 * @return The frequency of the timer, in Hz, or zero if an
3688 * [error](@ref error_handling) occurred.
3689 *
Camilla Berglund46fce402016-03-07 13:35:37 +01003690 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003691 *
3692 * @thread_safety This function may be called from any thread.
3693 *
3694 * @sa @ref time
3695 * @sa glfwGetTimerValue
3696 *
3697 * @since Added in version 3.2.
3698 *
3699 * @ingroup input
3700 */
3701GLFWAPI GLFWuint64 glfwGetTimerFrequency(void);
3702
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003703/*! @brief Makes the context of the specified window current for the calling
3704 * thread.
3705 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003706 * This function makes the OpenGL or OpenGL ES context of the specified window
3707 * current on the calling thread. A context can only be made current on
3708 * a single thread at a time and each thread can have only a single current
3709 * context at a time.
3710 *
3711 * By default, making a context non-current implicitly forces a pipeline flush.
3712 * On machines that support `GL_KHR_context_flush_control`, you can control
3713 * whether a context performs this flush by setting the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003714 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003715 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01003716 * The specified window must have an OpenGL or OpenGL ES context. Specifying
3717 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
3718 * error.
3719 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003720 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003721 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003722 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003723 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3724 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3725 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003726 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003727 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003728 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003729 * @sa glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01003730 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003731 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003732 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003733 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003734 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003735GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003736
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003737/*! @brief Returns the window whose context is current on the calling thread.
3738 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003739 * This function returns the window whose OpenGL or OpenGL ES context is
3740 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003741 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003742 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003743 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003744 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003745 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3746 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003747 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003748 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003749 * @sa @ref context_current
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003750 * @sa glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01003751 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003752 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003753 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003754 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003755 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003756GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003757
3758/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003759 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003760 * This function swaps the front and back buffers of the specified window when
3761 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
3762 * zero, the GPU driver waits the specified number of screen updates before
3763 * swapping the buffers.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003764 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01003765 * The specified window must have an OpenGL or OpenGL ES context. Specifying
3766 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
3767 * error.
3768 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003769 * This function does not apply to Vulkan. If you are rendering with Vulkan,
3770 * see `vkQueuePresentKHR` instead.
3771 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003772 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003773 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003774 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3775 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3776 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003777 * @remark __EGL:__ The context of the specified window must be current on the
Camilla Berglund276b1bc2016-01-31 19:17:18 +01003778 * calling thread.
3779 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003780 * @thread_safety This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01003781 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003782 * @sa @ref buffer_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003783 * @sa glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01003784 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003785 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003786 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003787 *
3788 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003789 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003790GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003791
3792/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003793 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003794 * This function sets the swap interval for the current OpenGL or OpenGL ES
3795 * context, i.e. the number of screen updates to wait from the time @ref
3796 * glfwSwapBuffers was called before swapping the buffers and returning. This
3797 * is sometimes called _vertical synchronization_, _vertical retrace
3798 * synchronization_ or just _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003799 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003800 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003801 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
3802 * which allow the driver to swap even if a frame arrives a little bit late.
3803 * You can check for the presence of these extensions using @ref
3804 * glfwExtensionSupported. For more information about swap tearing, see the
3805 * extension specifications.
3806 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003807 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003808 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003809 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003810 * This function does not apply to Vulkan. If you are rendering with Vulkan,
3811 * see the present mode of your swapchain instead.
3812 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003813 * @param[in] interval The minimum number of screen updates to wait for
3814 * until the buffers are swapped by @ref glfwSwapBuffers.
3815 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003816 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3817 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3818 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003819 * @remark This function is not called during context creation, leaving the
Camilla Berglund11c22d62015-02-19 15:33:51 +01003820 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02003821 * because some swap interval extensions used by GLFW do not allow the swap
3822 * interval to be reset to zero once it has been set to a non-zero value.
3823 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003824 * @remark Some GPU drivers do not honor the requested swap interval, either
Camilla Berglund11c22d62015-02-19 15:33:51 +01003825 * because of a user setting that overrides the application's request or due to
3826 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003827 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003828 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003829 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003830 * @sa @ref buffer_swap
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003831 * @sa glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01003832 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003833 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003834 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003835 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003836 */
3837GLFWAPI void glfwSwapInterval(int interval);
3838
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003839/*! @brief Returns whether the specified extension is available.
3840 *
Camilla Berglund608109c2013-04-11 20:18:46 +02003841 * This function returns whether the specified
Camilla Berglund001c50c2016-02-19 09:13:56 +01003842 * [API extension](@ref context_glext) is supported by the current OpenGL or
3843 * OpenGL ES context. It searches both for client API extension and context
3844 * creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003845 *
3846 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003847 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003848 *
3849 * As this functions retrieves and searches one or more extension strings each
3850 * call, it is recommended that you cache its results if it is going to be used
3851 * frequently. The extension strings will not change during the lifetime of
3852 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003853 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003854 * This function does not apply to Vulkan. If you are using Vulkan, see @ref
3855 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
3856 * and `vkEnumerateDeviceExtensionProperties` instead.
3857 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003858 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003859 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
3860 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003861 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003862 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3863 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
3864 * GLFW_PLATFORM_ERROR.
3865 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003866 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003867 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003868 * @sa @ref context_glext
3869 * @sa glfwGetProcAddress
3870 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003871 * @since Added in version 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003872 *
3873 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003874 */
3875GLFWAPI int glfwExtensionSupported(const char* extension);
3876
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003877/*! @brief Returns the address of the specified function for the current
3878 * context.
3879 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003880 * This function returns the address of the specified OpenGL or OpenGL ES
Camilla Berglund11c22d62015-02-19 15:33:51 +01003881 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02003882 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003883 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003884 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003885 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003886 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01003887 * This function does not apply to Vulkan. If you are rendering with Vulkan,
3888 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
3889 * `vkGetDeviceProcAddr` instead.
3890 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003891 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglunda36e3a22015-11-05 17:14:26 +01003892 * @return The address of the function, or `NULL` if an
3893 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003894 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003895 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3896 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3897 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003898 * @remark The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02003899 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003900 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003901 * @remark This function may return a non-`NULL` address despite the
Camilla Berglund11c22d62015-02-19 15:33:51 +01003902 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02003903 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01003904 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003905 * @pointer_lifetime The returned function pointer is valid until the context
3906 * is destroyed or the library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003907 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003908 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003909 *
3910 * @sa @ref context_glext
3911 * @sa glfwExtensionSupported
3912 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003913 * @since Added in version 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003914 *
3915 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003916 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02003917GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02003918
Camilla Berglund9b75bff2015-08-10 20:19:04 +02003919/*! @brief Returns whether the Vulkan loader has been found.
3920 *
3921 * This function returns whether the Vulkan loader has been found. This check
3922 * is performed by @ref glfwInit.
3923 *
3924 * The availability of a Vulkan loader does not by itself guarantee that window
3925 * surface creation or even device creation is possible. Call @ref
3926 * glfwGetRequiredInstanceExtensions to check whether the extensions necessary
3927 * for Vulkan surface creation are available and @ref
3928 * glfwGetPhysicalDevicePresentationSupport to check whether a queue family of
3929 * a physical device supports image presentation.
3930 *
3931 * @return `GLFW_TRUE` if Vulkan is available, or `GLFW_FALSE` otherwise.
3932 *
3933 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3934 *
3935 * @thread_safety This function may be called from any thread.
3936 *
3937 * @sa @ref vulkan_support
3938 *
3939 * @since Added in version 3.2.
3940 *
3941 * @ingroup vulkan
3942 */
3943GLFWAPI int glfwVulkanSupported(void);
3944
3945/*! @brief Returns the Vulkan instance extensions required by GLFW.
3946 *
3947 * This function returns an array of names of Vulkan instance extensions required
3948 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
3949 * list will always contains `VK_KHR_surface`, so if you don't require any
3950 * additional extensions you can pass this list directly to the
3951 * `VkInstanceCreateInfo` struct.
3952 *
3953 * If Vulkan is not available on the machine, this function returns `NULL` and
3954 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
3955 * to check whether Vulkan is available.
3956 *
3957 * If Vulkan is available but no set of extensions allowing window surface
3958 * creation was found, this function returns `NULL`. You may still use Vulkan
3959 * for off-screen rendering and compute work.
3960 *
3961 * @param[out] count Where to store the number of extensions in the returned
3962 * array. This is set to zero if an error occurred.
3963 * @return An array of ASCII encoded extension names, or `NULL` if an
3964 * [error](@ref error_handling) occurred.
3965 *
3966 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3967 * GLFW_API_UNAVAILABLE.
3968 *
3969 * @remarks Additional extensions may be required by future versions of GLFW.
3970 * You should check if any extensions you wish to enable are already in the
3971 * returned array, as it is an error to specify an extension more than once in
3972 * the `VkInstanceCreateInfo` struct.
3973 *
3974 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3975 * should not free it yourself. It is guaranteed to be valid only until the
3976 * library is terminated.
3977 *
3978 * @thread_safety This function may be called from any thread.
3979 *
3980 * @sa @ref vulkan_ext
3981 * @sa glfwCreateWindowSurface
3982 *
3983 * @since Added in version 3.2.
3984 *
3985 * @ingroup vulkan
3986 */
Camilla Berglund7669ade2016-02-22 10:44:37 +01003987GLFWAPI const char** glfwGetRequiredInstanceExtensions(unsigned int* count);
Camilla Berglund9b75bff2015-08-10 20:19:04 +02003988
3989#if defined(VK_VERSION_1_0)
3990
3991/*! @brief Returns the address of the specified Vulkan instance function.
3992 *
3993 * This function returns the address of the specified Vulkan core or extension
3994 * function for the specified instance. If instance is set to `NULL` it can
3995 * return any function exported from the Vulkan loader, including at least the
3996 * following functions:
3997 *
3998 * - `vkEnumerateInstanceExtensionProperties`
3999 * - `vkEnumerateInstanceLayerProperties`
4000 * - `vkCreateInstance`
4001 * - `vkGetInstanceProcAddr`
4002 *
4003 * If Vulkan is not available on the machine, this function returns `NULL` and
4004 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4005 * to check whether Vulkan is available.
4006 *
4007 * This function is equivalent to calling `vkGetInstanceProcAddr` with
4008 * a platform-specific query of the Vulkan loader as a fallback.
4009 *
4010 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
4011 * functions related to instance creation.
4012 * @param[in] procname The ASCII encoded name of the function.
4013 * @return The address of the function, or `NULL` if an
4014 * [error](@ref error_handling) occurred.
4015 *
4016 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4017 * GLFW_API_UNAVAILABLE.
4018 *
4019 * @pointer_lifetime The returned function pointer is valid until the library
4020 * is terminated.
4021 *
4022 * @thread_safety This function may be called from any thread.
4023 *
4024 * @sa @ref vulkan_proc
4025 *
4026 * @since Added in version 3.2.
4027 *
4028 * @ingroup vulkan
4029 */
4030GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
4031
4032/*! @brief Returns whether the specified queue family can present images.
4033 *
4034 * This function returns whether the specified queue family of the specified
4035 * physical device supports presentation to the platform GLFW was built for.
4036 *
4037 * If Vulkan or the required window surface creation instance extensions are
4038 * not available on the machine, or if the specified instance was not created
4039 * with the required extensions, this function returns `GLFW_FALSE` and
4040 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4041 * to check whether Vulkan is available and @ref
4042 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4043 * required.
4044 *
4045 * @param[in] instance The instance that the physical device belongs to.
4046 * @param[in] device The physical device that the queue family belongs to.
4047 * @param[in] queuefamily The index of the queue family to query.
4048 * @return `GLFW_TRUE` if the queue family supports presentation, or
4049 * `GLFW_FALSE` otherwise.
4050 *
4051 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4052 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4053 *
4054 * @thread_safety This function may be called from any thread. For
4055 * synchronization details of Vulkan objects, see the Vulkan specification.
4056 *
4057 * @sa @ref vulkan_present
4058 *
4059 * @since Added in version 3.2.
4060 *
4061 * @ingroup vulkan
4062 */
4063GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
4064
4065/*! @brief Creates a Vulkan surface for the specified window.
4066 *
4067 * This function creates a Vulkan surface for the specified window.
4068 *
4069 * If the Vulkan loader was not found at initialization, this function returns
4070 * `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref GLFW_API_UNAVAILABLE
4071 * error. Call @ref glfwVulkanSupported to check whether the Vulkan loader was
4072 * found.
4073 *
4074 * If the required window surface creation instance extensions are not
4075 * available or if the specified instance was not created with these extensions
4076 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
4077 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
4078 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4079 * required.
4080 *
4081 * The window surface must be destroyed before the specified Vulkan instance.
4082 * It is the responsibility of the caller to destroy the window surface. GLFW
4083 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
4084 * surface.
4085 *
4086 * @param[in] instance The Vulkan instance to create the surface in.
4087 * @param[in] window The window to create the surface for.
4088 * @param[in] allocator The allocator to use, or `NULL` to use the default
4089 * allocator.
4090 * @param[out] surface Where to store the handle of the surface. This is set
4091 * to `VK_NULL_HANDLE` if an error occurred.
4092 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
4093 * [error](@ref error_handling) occurred.
4094 *
4095 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4096 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4097 *
4098 * @remarks If an error occurs before the creation call is made, GLFW returns
4099 * the Vulkan error code most appropriate for the error. Appropriate use of
4100 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
Camilla Berglundee33dcd2016-03-07 14:42:51 +01004101 * eliminate almost all occurrences of these errors.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004102 *
4103 * @thread_safety This function may be called from any thread. For
4104 * synchronization details of Vulkan objects, see the Vulkan specification.
4105 *
4106 * @sa @ref vulkan_surface
4107 * @sa glfwGetRequiredInstanceExtensions
4108 *
4109 * @since Added in version 3.2.
4110 *
4111 * @ingroup vulkan
4112 */
4113GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
4114
4115#endif /*VK_VERSION_1_0*/
4116
Camilla Berglund3249f812010-09-07 17:34:51 +02004117
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004118/*************************************************************************
4119 * Global definition cleanup
4120 *************************************************************************/
4121
4122/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
4123
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004124#ifdef GLFW_WINGDIAPI_DEFINED
4125 #undef WINGDIAPI
4126 #undef GLFW_WINGDIAPI_DEFINED
4127#endif
4128
4129#ifdef GLFW_CALLBACK_DEFINED
4130 #undef CALLBACK
4131 #undef GLFW_CALLBACK_DEFINED
4132#endif
4133
4134/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
4135
4136
Camilla Berglund3249f812010-09-07 17:34:51 +02004137#ifdef __cplusplus
4138}
4139#endif
4140
Camilla Berglundf8df91d2013-01-15 01:59:56 +01004141#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02004142