blob: ca5fa37e079d9550caaf85bfdf7fd94160f42e35 [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund53fafad2016-08-18 23:42:15 +02002 * GLFW 3.3 - www.glfw.org
Camilla Berglund3cfc4002013-07-29 20:53:17 +02003 * A library for OpenGL, window and input
Camilla Berglund3249f812010-09-07 17:34:51 +02004 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
Camilla Löwyf4d0c832016-11-21 16:23:59 +01006 * Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
Camilla Berglund3249f812010-09-07 17:34:51 +02007 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
Camilla Berglundf8df91d2013-01-15 01:59:56 +010029#ifndef _glfw3_h_
30#define _glfw3_h_
Camilla Berglund3249f812010-09-07 17:34:51 +020031
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
Camilla Berglundbce2cd62012-11-22 16:38:24 +010038 * Doxygen documentation
39 *************************************************************************/
40
Camilla Berglund318e8ac2015-10-24 20:48:46 +020041/*! @file glfw3.h
42 * @brief The header of the GLFW 3 API.
43 *
44 * This is the header file of the GLFW 3 API. It defines all its types and
45 * declares all its functions.
46 *
47 * For more information about how to use this file, see @ref build_include.
48 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010049/*! @defgroup context Context reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020050 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010051 * This is the reference documentation for OpenGL and OpenGL ES context related
52 * functions. For more task-oriented information, see the @ref context_guide.
Camilla Berglund3f5843f2012-12-13 02:22:39 +010053 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010054/*! @defgroup vulkan Vulkan reference
Camilla Berglund9b75bff2015-08-10 20:19:04 +020055 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010056 * This is the reference documentation for Vulkan related functions and types.
57 * For more task-oriented information, see the @ref vulkan_guide.
Camilla Berglund9b75bff2015-08-10 20:19:04 +020058 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010059/*! @defgroup init Initialization, version and error reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020060 *
61 * This is the reference documentation for initialization and termination of
Camilla Berglund80c203f2016-02-19 10:29:13 +010062 * the library, version management and error handling. For more task-oriented
63 * information, see the @ref intro_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010064 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010065/*! @defgroup input Input reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020066 *
67 * This is the reference documentation for input related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010068 * For more task-oriented information, see the @ref input_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010069 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010070/*! @defgroup monitor Monitor reference
Camilla Berglundf5f55e32013-06-17 12:56:36 +020071 *
72 * This is the reference documentation for monitor related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010073 * For more task-oriented information, see the @ref monitor_guide.
Camilla Berglund5f68e122012-11-27 17:07:28 +010074 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010075/*! @defgroup window Window reference
Camilla Berglundbce2cd62012-11-22 16:38:24 +010076 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +020077 * This is the reference documentation for window related functions and types,
Camilla Berglund80c203f2016-02-19 10:29:13 +010078 * including creation, deletion and event polling. For more task-oriented
79 * information, see the @ref window_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010080 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010081
82
83/*************************************************************************
Camilla Berglund8d910d72015-02-22 18:35:10 +010084 * Compiler- and platform-specific preprocessor work
Camilla Berglund3249f812010-09-07 17:34:51 +020085 *************************************************************************/
86
Camilla Berglund8d910d72015-02-22 18:35:10 +010087/* If we are we on Windows, we want a single define for it.
Camilla Berglund3249f812010-09-07 17:34:51 +020088 */
Camilla Berglunde8ce4ab2015-02-22 18:18:43 +010089#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
Camilla Berglund3249f812010-09-07 17:34:51 +020090 #define _WIN32
91#endif /* _WIN32 */
92
Camilla Berglund8d910d72015-02-22 18:35:10 +010093/* It is customary to use APIENTRY for OpenGL function pointer declarations on
94 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
Camilla Berglund3249f812010-09-07 17:34:51 +020095 */
96#ifndef APIENTRY
97 #ifdef _WIN32
98 #define APIENTRY __stdcall
99 #else
100 #define APIENTRY
101 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200102#endif /* APIENTRY */
103
Camilla Berglunda90ee652016-11-08 12:39:18 +0100104/* Some OpenGL related headers use GLAPIENTRY instead.
105 */
106#ifndef GLAPIENTRY
107 #define GLAPIENTRY APIENTRY
108#endif /* GLAPIENTRY */
109
Camilla Berglund8d910d72015-02-22 18:35:10 +0100110/* Some Windows OpenGL headers need this.
Camilla Berglund3249f812010-09-07 17:34:51 +0200111 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200112#if !defined(WINGDIAPI) && defined(_WIN32)
Camilla Berglundc5353642015-02-22 18:14:30 +0100113 #define WINGDIAPI __declspec(dllimport)
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200114 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200115#endif /* WINGDIAPI */
116
Camilla Berglund8d910d72015-02-22 18:35:10 +0100117/* Some Windows GLU headers need this.
118 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200119#if !defined(CALLBACK) && defined(_WIN32)
Camilla Berglundd586fe62015-02-22 18:17:34 +0100120 #define CALLBACK __stdcall
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200121 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200122#endif /* CALLBACK */
123
Camilla Berglund70423af2016-07-21 00:15:07 +0200124/* Include because most Windows GLU headers need wchar_t and
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200125 * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
Camilla Berglund8221aad2016-03-06 09:40:16 +0100126 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund8d910d72015-02-22 18:35:10 +0100127 */
Camilla Berglund8221aad2016-03-06 09:40:16 +0100128#include <stddef.h>
Camilla Berglund70423af2016-07-21 00:15:07 +0200129
130/* Include because it is needed by Vulkan and related functions.
131 */
Camilla Berglund5661d032016-03-23 10:09:07 +0100132#include <stdint.h>
Camilla Berglund3249f812010-09-07 17:34:51 +0200133
Camilla Berglundc93b1202013-09-08 16:07:34 +0200134/* Include the chosen client API headers.
135 */
Camilla Berglunddb49aa62016-02-22 13:16:43 +0100136#if defined(__APPLE__)
Camilla Berglund1591caa2015-01-08 06:56:17 +0100137 #if defined(GLFW_INCLUDE_GLCOREARB)
138 #include <OpenGL/gl3.h>
139 #if defined(GLFW_INCLUDE_GLEXT)
140 #include <OpenGL/gl3ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200141 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100142 #elif !defined(GLFW_INCLUDE_NONE)
143 #if !defined(GLFW_INCLUDE_GLEXT)
144 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200145 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100146 #include <OpenGL/gl.h>
147 #endif
148 #if defined(GLFW_INCLUDE_GLU)
149 #include <OpenGL/glu.h>
150 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200151#else
Camilla Berglund1591caa2015-01-08 06:56:17 +0100152 #if defined(GLFW_INCLUDE_GLCOREARB)
153 #include <GL/glcorearb.h>
154 #elif defined(GLFW_INCLUDE_ES1)
155 #include <GLES/gl.h>
156 #if defined(GLFW_INCLUDE_GLEXT)
157 #include <GLES/glext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200158 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100159 #elif defined(GLFW_INCLUDE_ES2)
160 #include <GLES2/gl2.h>
161 #if defined(GLFW_INCLUDE_GLEXT)
162 #include <GLES2/gl2ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200163 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100164 #elif defined(GLFW_INCLUDE_ES3)
165 #include <GLES3/gl3.h>
166 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100167 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100168 #endif
169 #elif defined(GLFW_INCLUDE_ES31)
170 #include <GLES3/gl31.h>
171 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100172 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100173 #endif
Camilla Löwy3edaa522017-01-02 05:58:41 +0100174 #elif defined(GLFW_INCLUDE_ES32)
175 #include <GLES3/gl32.h>
176 #if defined(GLFW_INCLUDE_GLEXT)
177 #include <GLES2/gl2ext.h>
178 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100179 #elif !defined(GLFW_INCLUDE_NONE)
180 #include <GL/gl.h>
181 #if defined(GLFW_INCLUDE_GLEXT)
182 #include <GL/glext.h>
183 #endif
184 #endif
185 #if defined(GLFW_INCLUDE_GLU)
186 #include <GL/glu.h>
187 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200188#endif
Camilla Berglund433db8f2016-09-14 21:13:33 +0200189#if defined(GLFW_INCLUDE_VULKAN)
Camilla Berglunde94d1662016-10-14 01:46:56 +0200190 #if defined(__APPLE__)
191 #include <MoltenVK/vulkan/vulkan.h>
192 #else
193 #include <vulkan/vulkan.h>
194 #endif
Camilla Berglund433db8f2016-09-14 21:13:33 +0200195#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200196
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200197#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200198 /* GLFW_DLL must be defined by applications that are linking against the DLL
199 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
200 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200201 */
Camilla Berglund0df4e062015-12-13 14:07:27 +0100202 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200203#endif
204
Camilla Berglund1591caa2015-01-08 06:56:17 +0100205/* GLFWAPI is used to declare public API functions for export
206 * from the DLL / shared library / dynamic library.
207 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200208#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200209 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100210 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200211#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200212 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100213 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100214#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200215 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100216 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200217#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200218 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200219 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200220#endif
221
Camilla Berglund3249f812010-09-07 17:34:51 +0200222
223/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100224 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200225 *************************************************************************/
226
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100227/*! @name GLFW version macros
228 * @{ */
229/*! @brief The major version number of the GLFW library.
230 *
231 * This is incremented when the API is changed in non-compatible ways.
232 * @ingroup init
233 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100234#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100235/*! @brief The minor version number of the GLFW library.
236 *
237 * This is incremented when features are added to the API but it remains
238 * backward-compatible.
239 * @ingroup init
240 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200241#define GLFW_VERSION_MINOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100242/*! @brief The revision number of the GLFW library.
243 *
244 * This is incremented when a bug fix release is made that does not contain any
245 * API changes.
246 * @ingroup init
247 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200248#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100249/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200250
Camilla Berglund0eccf752015-08-23 19:30:04 +0200251/*! @name Boolean values
252 * @{ */
253/*! @brief One.
254 *
255 * One. Seriously. You don't _need_ to use this symbol in your code. It's
256 * just semantic sugar for the number 1. You can use `1` or `true` or `_True`
257 * or `GL_TRUE` or whatever you want.
258 */
259#define GLFW_TRUE 1
260/*! @brief Zero.
261 *
262 * Zero. Seriously. You don't _need_ to use this symbol in your code. It's
263 * just just semantic sugar for the number 0. You can use `0` or `false` or
264 * `_False` or `GL_FALSE` or whatever you want.
265 */
266#define GLFW_FALSE 0
267/*! @} */
268
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100269/*! @name Key and button actions
270 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200271/*! @brief The key or mouse button was released.
272 *
273 * The key or mouse button was released.
274 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100275 * @ingroup input
276 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100277#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200278/*! @brief The key or mouse button was pressed.
279 *
280 * The key or mouse button was pressed.
281 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100282 * @ingroup input
283 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100284#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100285/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200286 *
287 * The key was held down until it repeated.
288 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100289 * @ingroup input
290 */
291#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100292/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200293
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200294/*! @defgroup keys Keyboard keys
295 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100296 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200297 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100298 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
299 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
300 * put in the 256+ range).
301 *
302 * The naming of the key codes follow these rules:
303 * - The US keyboard layout is used
304 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
305 * "3", etc.)
306 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
307 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
308 * correspond to the Unicode standard (usually for brevity)
309 * - Keys that lack a clear US mapping are named "WORLD_x"
310 * - For non-printable keys, custom names are used (e.g. "F4",
311 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200312 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100313 * @ingroup input
314 * @{
315 */
316
Camilla Berglund11615fc2013-05-30 17:19:12 +0200317/* The unknown key */
318#define GLFW_KEY_UNKNOWN -1
319
Marcusc0cb4c22011-01-02 11:18:14 +0100320/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100321#define GLFW_KEY_SPACE 32
322#define GLFW_KEY_APOSTROPHE 39 /* ' */
323#define GLFW_KEY_COMMA 44 /* , */
324#define GLFW_KEY_MINUS 45 /* - */
325#define GLFW_KEY_PERIOD 46 /* . */
326#define GLFW_KEY_SLASH 47 /* / */
327#define GLFW_KEY_0 48
328#define GLFW_KEY_1 49
329#define GLFW_KEY_2 50
330#define GLFW_KEY_3 51
331#define GLFW_KEY_4 52
332#define GLFW_KEY_5 53
333#define GLFW_KEY_6 54
334#define GLFW_KEY_7 55
335#define GLFW_KEY_8 56
336#define GLFW_KEY_9 57
337#define GLFW_KEY_SEMICOLON 59 /* ; */
338#define GLFW_KEY_EQUAL 61 /* = */
339#define GLFW_KEY_A 65
340#define GLFW_KEY_B 66
341#define GLFW_KEY_C 67
342#define GLFW_KEY_D 68
343#define GLFW_KEY_E 69
344#define GLFW_KEY_F 70
345#define GLFW_KEY_G 71
346#define GLFW_KEY_H 72
347#define GLFW_KEY_I 73
348#define GLFW_KEY_J 74
349#define GLFW_KEY_K 75
350#define GLFW_KEY_L 76
351#define GLFW_KEY_M 77
352#define GLFW_KEY_N 78
353#define GLFW_KEY_O 79
354#define GLFW_KEY_P 80
355#define GLFW_KEY_Q 81
356#define GLFW_KEY_R 82
357#define GLFW_KEY_S 83
358#define GLFW_KEY_T 84
359#define GLFW_KEY_U 85
360#define GLFW_KEY_V 86
361#define GLFW_KEY_W 87
362#define GLFW_KEY_X 88
363#define GLFW_KEY_Y 89
364#define GLFW_KEY_Z 90
365#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
366#define GLFW_KEY_BACKSLASH 92 /* \ */
367#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
368#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
369#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
370#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100371
372/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100373#define GLFW_KEY_ESCAPE 256
374#define GLFW_KEY_ENTER 257
375#define GLFW_KEY_TAB 258
376#define GLFW_KEY_BACKSPACE 259
377#define GLFW_KEY_INSERT 260
378#define GLFW_KEY_DELETE 261
379#define GLFW_KEY_RIGHT 262
380#define GLFW_KEY_LEFT 263
381#define GLFW_KEY_DOWN 264
382#define GLFW_KEY_UP 265
383#define GLFW_KEY_PAGE_UP 266
384#define GLFW_KEY_PAGE_DOWN 267
385#define GLFW_KEY_HOME 268
386#define GLFW_KEY_END 269
387#define GLFW_KEY_CAPS_LOCK 280
388#define GLFW_KEY_SCROLL_LOCK 281
389#define GLFW_KEY_NUM_LOCK 282
390#define GLFW_KEY_PRINT_SCREEN 283
391#define GLFW_KEY_PAUSE 284
392#define GLFW_KEY_F1 290
393#define GLFW_KEY_F2 291
394#define GLFW_KEY_F3 292
395#define GLFW_KEY_F4 293
396#define GLFW_KEY_F5 294
397#define GLFW_KEY_F6 295
398#define GLFW_KEY_F7 296
399#define GLFW_KEY_F8 297
400#define GLFW_KEY_F9 298
401#define GLFW_KEY_F10 299
402#define GLFW_KEY_F11 300
403#define GLFW_KEY_F12 301
404#define GLFW_KEY_F13 302
405#define GLFW_KEY_F14 303
406#define GLFW_KEY_F15 304
407#define GLFW_KEY_F16 305
408#define GLFW_KEY_F17 306
409#define GLFW_KEY_F18 307
410#define GLFW_KEY_F19 308
411#define GLFW_KEY_F20 309
412#define GLFW_KEY_F21 310
413#define GLFW_KEY_F22 311
414#define GLFW_KEY_F23 312
415#define GLFW_KEY_F24 313
416#define GLFW_KEY_F25 314
417#define GLFW_KEY_KP_0 320
418#define GLFW_KEY_KP_1 321
419#define GLFW_KEY_KP_2 322
420#define GLFW_KEY_KP_3 323
421#define GLFW_KEY_KP_4 324
422#define GLFW_KEY_KP_5 325
423#define GLFW_KEY_KP_6 326
424#define GLFW_KEY_KP_7 327
425#define GLFW_KEY_KP_8 328
426#define GLFW_KEY_KP_9 329
427#define GLFW_KEY_KP_DECIMAL 330
428#define GLFW_KEY_KP_DIVIDE 331
429#define GLFW_KEY_KP_MULTIPLY 332
430#define GLFW_KEY_KP_SUBTRACT 333
431#define GLFW_KEY_KP_ADD 334
432#define GLFW_KEY_KP_ENTER 335
433#define GLFW_KEY_KP_EQUAL 336
434#define GLFW_KEY_LEFT_SHIFT 340
435#define GLFW_KEY_LEFT_CONTROL 341
436#define GLFW_KEY_LEFT_ALT 342
437#define GLFW_KEY_LEFT_SUPER 343
438#define GLFW_KEY_RIGHT_SHIFT 344
439#define GLFW_KEY_RIGHT_CONTROL 345
440#define GLFW_KEY_RIGHT_ALT 346
441#define GLFW_KEY_RIGHT_SUPER 347
442#define GLFW_KEY_MENU 348
Camilla Berglund9c315412015-07-02 14:24:50 +0200443
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100444#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100445
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100446/*! @} */
447
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200448/*! @defgroup mods Modifier key flags
Camilla Berglund4188c262015-01-18 01:55:25 +0100449 *
450 * See [key input](@ref input_key) for how these are used.
451 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200452 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100453 * @{ */
454
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200455/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100456 */
457#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200458/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100459 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200460#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200461/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100462 */
463#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200464/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200465 */
466#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100467
468/*! @} */
469
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100470/*! @defgroup buttons Mouse buttons
Camilla Berglund4188c262015-01-18 01:55:25 +0100471 *
472 * See [mouse button input](@ref input_mouse_button) 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_MOUSE_BUTTON_1 0
477#define GLFW_MOUSE_BUTTON_2 1
478#define GLFW_MOUSE_BUTTON_3 2
479#define GLFW_MOUSE_BUTTON_4 3
480#define GLFW_MOUSE_BUTTON_5 4
481#define GLFW_MOUSE_BUTTON_6 5
482#define GLFW_MOUSE_BUTTON_7 6
483#define GLFW_MOUSE_BUTTON_8 7
484#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
485#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
486#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
487#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100488/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200489
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100490/*! @defgroup joysticks Joysticks
Camilla Berglund4188c262015-01-18 01:55:25 +0100491 *
492 * See [joystick input](@ref joystick) for how these are used.
493 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100494 * @ingroup input
495 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100496#define GLFW_JOYSTICK_1 0
497#define GLFW_JOYSTICK_2 1
498#define GLFW_JOYSTICK_3 2
499#define GLFW_JOYSTICK_4 3
500#define GLFW_JOYSTICK_5 4
501#define GLFW_JOYSTICK_6 5
502#define GLFW_JOYSTICK_7 6
503#define GLFW_JOYSTICK_8 7
504#define GLFW_JOYSTICK_9 8
505#define GLFW_JOYSTICK_10 9
506#define GLFW_JOYSTICK_11 10
507#define GLFW_JOYSTICK_12 11
508#define GLFW_JOYSTICK_13 12
509#define GLFW_JOYSTICK_14 13
510#define GLFW_JOYSTICK_15 14
511#define GLFW_JOYSTICK_16 15
512#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100513/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200514
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100515/*! @defgroup errors Error codes
Camilla Berglund4188c262015-01-18 01:55:25 +0100516 *
517 * See [error handling](@ref error_handling) for how these are used.
518 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200519 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100520 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100521/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200522 *
Camilla Berglund0df4e062015-12-13 14:07:27 +0100523 * This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund4591ad22014-09-18 15:03:29 +0200524 * library is [initialized](@ref intro_init).
525 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100526 * @analysis Application programmer error. Initialize GLFW before calling any
527 * function that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100528 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200529#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100530/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200531 *
532 * This occurs if a GLFW function was called that needs and operates on the
533 * current OpenGL or OpenGL ES context but no context is current on the calling
534 * thread. One such function is @ref glfwSwapInterval.
535 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100536 * @analysis Application programmer error. Ensure a context is current before
537 * calling functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100538 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200539#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200540/*! @brief One of the arguments to the function was an invalid enum value.
541 *
542 * One of the arguments to the function was an invalid enum value, for example
Camilla Löwyce161c22016-12-06 01:14:23 +0100543 * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200544 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100545 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100546 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200547#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200548/*! @brief One of the arguments to the function was an invalid value.
549 *
550 * One of the arguments to the function was an invalid value, for example
551 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
552 *
553 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
554 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
555 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100556 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100557 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200558#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100559/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200560 *
561 * A memory allocation failed.
562 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100563 * @analysis A bug in GLFW or the underlying operating system. Report the bug
564 * to our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100565 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200566#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200567/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200568 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200569 * GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200570 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100571 * @analysis The installed graphics driver does not support the requested
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200572 * API, or does not support it via the chosen context creation backend.
Camilla Berglund951a9582016-01-31 21:32:14 +0100573 * Below are a few examples.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200574 *
575 * @par
576 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200577 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200578 * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100579 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200580 * driver. Older graphics drivers do not support Vulkan.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100581 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200582#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200583/*! @brief The requested OpenGL or OpenGL ES version is not available.
584 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100585 * The requested OpenGL or OpenGL ES version (including any requested context
586 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200587 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100588 * @analysis The machine does not support your requirements. If your
589 * application is sufficiently flexible, downgrade your requirements and try
590 * again. Otherwise, inform the user that their machine does not match your
Camilla Berglund4591ad22014-09-18 15:03:29 +0200591 * requirements.
592 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200593 * @par
594 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
595 * comes out before the 4.x series gets that far, also fail with this error and
596 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
597 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100598 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200599#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100600/*! @brief A platform-specific error occurred that does not match any of the
601 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200602 *
603 * A platform-specific error occurred that does not match any of the more
604 * specific categories.
605 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100606 * @analysis A bug or configuration error in GLFW, the underlying operating
607 * system or its drivers, or a lack of required resources. Report the issue to
608 * our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100609 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200610#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200611/*! @brief The requested format is not supported or available.
612 *
613 * If emitted during window creation, the requested pixel format is not
614 * supported.
615 *
616 * If emitted when querying the clipboard, the contents of the clipboard could
617 * not be converted to the requested format.
618 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100619 * @analysis If emitted during window creation, one or more
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200620 * [hard constraints](@ref window_hints_hard) did not match any of the
621 * available pixel formats. If your application is sufficiently flexible,
622 * downgrade your requirements and try again. Otherwise, inform the user that
623 * their machine does not match your requirements.
624 *
625 * @par
626 * If emitted when querying the clipboard, ignore the error or report it to
627 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100628 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200629#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglund496f5592015-06-18 14:03:02 +0200630/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
631 *
632 * A window that does not have an OpenGL or OpenGL ES context was passed to
633 * a function that requires it to have one.
634 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100635 * @analysis Application programmer error. Fix the offending call.
Camilla Berglund496f5592015-06-18 14:03:02 +0200636 */
637#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100638/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200639
Camilla Löwyce161c22016-12-06 01:14:23 +0100640/*! @addtogroup window
641 * @{ */
642/*! @brief Input focus window hint and attribute
643 *
644 * Input focus [window hint](@ref GLFW_FOCUSED_hint) or
645 * [window attribute](@ref GLFW_FOCUSED_attrib).
646 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100647#define GLFW_FOCUSED 0x00020001
Camilla Löwyce161c22016-12-06 01:14:23 +0100648/*! @brief Window iconification window attribute
649 *
650 * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
651 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100652#define GLFW_ICONIFIED 0x00020002
Camilla Löwyce161c22016-12-06 01:14:23 +0100653/*! @brief Window resize-ability window hint and attribute
654 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100655 * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100656 * [window attribute](@ref GLFW_RESIZABLE_attrib).
657 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200658#define GLFW_RESIZABLE 0x00020003
Camilla Löwyce161c22016-12-06 01:14:23 +0100659/*! @brief Window visibility window hint and attribute
660 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100661 * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100662 * [window attribute](@ref GLFW_VISIBLE_attrib).
663 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200664#define GLFW_VISIBLE 0x00020004
Camilla Löwyce161c22016-12-06 01:14:23 +0100665/*! @brief Window decoration window hint and attribute
666 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100667 * Window decoration [window hint](@ref GLFW_DECORATED_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100668 * [window attribute](@ref GLFW_DECORATED_attrib).
669 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200670#define GLFW_DECORATED 0x00020005
Camilla Löwy9e560992016-09-30 01:52:22 +0200671/*! @brief Window auto-iconification window hint and attribute
Camilla Löwyce161c22016-12-06 01:14:23 +0100672 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100673 * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
Camilla Löwy9e560992016-09-30 01:52:22 +0200674 * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
Camilla Löwyce161c22016-12-06 01:14:23 +0100675 */
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200676#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Löwyce161c22016-12-06 01:14:23 +0100677/*! @brief Window decoration window hint and attribute
678 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100679 * Window decoration [window hint](@ref GLFW_FLOATING_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100680 * [window attribute](@ref GLFW_FLOATING_attrib).
681 */
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200682#define GLFW_FLOATING 0x00020007
Camilla Löwyce161c22016-12-06 01:14:23 +0100683/*! @brief Window maximization window hint and attribute
684 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100685 * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100686 * [window attribute](@ref GLFW_MAXIMIZED_attrib).
687 */
Camilla Berglunda10caa42015-10-13 12:50:59 +0200688#define GLFW_MAXIMIZED 0x00020008
Camilla Berglund2c091572010-09-09 21:09:11 +0200689
Camilla Löwyce161c22016-12-06 01:14:23 +0100690/*! @brief Framebuffer bit depth hint.
691 *
692 * Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
693 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200694#define GLFW_RED_BITS 0x00021001
Camilla Löwyce161c22016-12-06 01:14:23 +0100695/*! @brief Framebuffer bit depth hint.
696 *
697 * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
698 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200699#define GLFW_GREEN_BITS 0x00021002
Camilla Löwyce161c22016-12-06 01:14:23 +0100700/*! @brief Framebuffer bit depth hint.
701 *
702 * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
703 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200704#define GLFW_BLUE_BITS 0x00021003
Camilla Löwyce161c22016-12-06 01:14:23 +0100705/*! @brief Framebuffer bit depth hint.
706 *
707 * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
708 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200709#define GLFW_ALPHA_BITS 0x00021004
Camilla Löwyce161c22016-12-06 01:14:23 +0100710/*! @brief Framebuffer bit depth hint.
711 *
712 * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
713 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200714#define GLFW_DEPTH_BITS 0x00021005
Camilla Löwyce161c22016-12-06 01:14:23 +0100715/*! @brief Framebuffer bit depth hint.
716 *
717 * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
718 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200719#define GLFW_STENCIL_BITS 0x00021006
Camilla Löwyce161c22016-12-06 01:14:23 +0100720/*! @brief Framebuffer bit depth hint.
721 *
722 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
723 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200724#define GLFW_ACCUM_RED_BITS 0x00021007
Camilla Löwyce161c22016-12-06 01:14:23 +0100725/*! @brief Framebuffer bit depth hint.
726 *
727 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
728 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200729#define GLFW_ACCUM_GREEN_BITS 0x00021008
Camilla Löwyce161c22016-12-06 01:14:23 +0100730/*! @brief Framebuffer bit depth hint.
731 *
732 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
733 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200734#define GLFW_ACCUM_BLUE_BITS 0x00021009
Camilla Löwyce161c22016-12-06 01:14:23 +0100735/*! @brief Framebuffer bit depth hint.
736 *
737 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
738 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200739#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
Camilla Löwyce161c22016-12-06 01:14:23 +0100740/*! @brief Framebuffer auxiliary buffer hint.
741 *
742 * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
743 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200744#define GLFW_AUX_BUFFERS 0x0002100B
Camilla Löwyce161c22016-12-06 01:14:23 +0100745/*! @brief OpenGL stereoscopic rendering hint.
746 *
747 * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
748 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200749#define GLFW_STEREO 0x0002100C
Camilla Löwyce161c22016-12-06 01:14:23 +0100750/*! @brief Framebuffer MSAA samples hint.
751 *
752 * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
753 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200754#define GLFW_SAMPLES 0x0002100D
Camilla Löwyce161c22016-12-06 01:14:23 +0100755/*! @brief Framebuffer sRGB hint.
756 *
757 * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
758 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200759#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Löwyce161c22016-12-06 01:14:23 +0100760/*! @brief Monitor refresh rate hint.
761 *
762 * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
763 */
Camilla Berglund2cd34382013-05-30 20:42:50 +0200764#define GLFW_REFRESH_RATE 0x0002100F
Camilla Löwyce161c22016-12-06 01:14:23 +0100765/*! @brief Framebuffer double buffering hint.
766 *
767 * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
768 */
Camilla Berglundc9808582014-04-24 19:21:10 +0200769#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Löwy831426c2016-12-08 17:08:36 +0100770/*! @brief Context client API hint and attribute.
771 *
772 * Context client API [hint](@ref GLFW_CLIENT_API_hint) and
773 * [attribute](@ref GLFW_CLIENT_API_attrib).
774 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200775#define GLFW_CLIENT_API 0x00022001
Camilla Löwy831426c2016-12-08 17:08:36 +0100776/*! @brief Context client API major version hint and attribute.
777 *
778 * Context client API major version [hint](@ref GLFW_CLIENT_API_hint) and
779 * [attribute](@ref GLFW_CLIENT_API_attrib).
780 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200781#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
Camilla Löwy831426c2016-12-08 17:08:36 +0100782/*! @brief Context client API minor version hint and attribute.
783 *
784 * Context client API minor version [hint](@ref GLFW_CLIENT_API_hint) and
785 * [attribute](@ref GLFW_CLIENT_API_attrib).
786 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200787#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
Camilla Löwy831426c2016-12-08 17:08:36 +0100788/*! @brief Context client API revision number hint and attribute.
789 *
790 * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
791 * [attribute](@ref GLFW_CLIENT_API_attrib).
792 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200793#define GLFW_CONTEXT_REVISION 0x00022004
Camilla Löwy831426c2016-12-08 17:08:36 +0100794/*! @brief Context robustness hint and attribute.
795 *
796 * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
797 * [attribute](@ref GLFW_CLIENT_API_attrib).
798 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200799#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
Camilla Löwy831426c2016-12-08 17:08:36 +0100800/*! @brief OpenGL forward-compatibility hint and attribute.
801 *
802 * OpenGL forward-compatibility [hint](@ref GLFW_CLIENT_API_hint) and
803 * [attribute](@ref GLFW_CLIENT_API_attrib).
804 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200805#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
Camilla Löwy831426c2016-12-08 17:08:36 +0100806/*! @brief OpenGL debug context hint and attribute.
807 *
808 * OpenGL debug context [hint](@ref GLFW_CLIENT_API_hint) and
809 * [attribute](@ref GLFW_CLIENT_API_attrib).
810 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200811#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
Camilla Löwy831426c2016-12-08 17:08:36 +0100812/*! @brief OpenGL profile hint and attribute.
813 *
814 * OpenGL profile [hint](@ref GLFW_CLIENT_API_hint) and
815 * [attribute](@ref GLFW_CLIENT_API_attrib).
816 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200817#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Löwy831426c2016-12-08 17:08:36 +0100818/*! @brief Context flush-on-release hint and attribute.
819 *
820 * Context flush-on-release [hint](@ref GLFW_CLIENT_API_hint) and
821 * [attribute](@ref GLFW_CLIENT_API_attrib).
822 */
Camilla Berglund44c899c2014-08-21 19:21:45 +0200823#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Löwy831426c2016-12-08 17:08:36 +0100824/*! @brief Context error suppression hint and attribute.
825 *
826 * Context error suppression [hint](@ref GLFW_CLIENT_API_hint) and
827 * [attribute](@ref GLFW_CLIENT_API_attrib).
828 */
Camilla Berglund7be82092015-08-10 12:46:14 +0200829#define GLFW_CONTEXT_NO_ERROR 0x0002200A
Camilla Löwy831426c2016-12-08 17:08:36 +0100830/*! @brief Context creation API hint and attribute.
831 *
832 * Context creation API [hint](@ref GLFW_CLIENT_API_hint) and
833 * [attribute](@ref GLFW_CLIENT_API_attrib).
834 */
Camilla Berglundef80bea2016-03-28 13:19:31 +0200835#define GLFW_CONTEXT_CREATION_API 0x0002200B
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100836
Camilla Löwy58ceab52016-12-07 00:41:54 +0100837#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
Camilla Löwy46613152017-01-01 19:41:50 +0100838#define GLFW_COCOA_FRAME_AUTOSAVE 0x00023002
Camilla Löwy831426c2016-12-08 17:08:36 +0100839/*! @} */
Camilla Löwy58ceab52016-12-07 00:41:54 +0100840
Camilla Berglund496f5592015-06-18 14:03:02 +0200841#define GLFW_NO_API 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200842#define GLFW_OPENGL_API 0x00030001
843#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100844
Camilla Berglund393e4392013-05-27 22:16:59 +0200845#define GLFW_NO_ROBUSTNESS 0
846#define GLFW_NO_RESET_NOTIFICATION 0x00031001
847#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100848
Camilla Berglund44e84012013-06-05 16:13:30 +0200849#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200850#define GLFW_OPENGL_CORE_PROFILE 0x00032001
851#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100852
Camilla Berglund393e4392013-05-27 22:16:59 +0200853#define GLFW_CURSOR 0x00033001
854#define GLFW_STICKY_KEYS 0x00033002
855#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100856
Camilla Berglund393e4392013-05-27 22:16:59 +0200857#define GLFW_CURSOR_NORMAL 0x00034001
858#define GLFW_CURSOR_HIDDEN 0x00034002
859#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100860
Camilla Berglund44c899c2014-08-21 19:21:45 +0200861#define GLFW_ANY_RELEASE_BEHAVIOR 0
862#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
863#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
864
Camilla Berglundef80bea2016-03-28 13:19:31 +0200865#define GLFW_NATIVE_CONTEXT_API 0x00036001
866#define GLFW_EGL_CONTEXT_API 0x00036002
867
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200868/*! @defgroup shapes Standard cursor shapes
Camilla Berglund4188c262015-01-18 01:55:25 +0100869 *
870 * See [standard cursor creation](@ref cursor_standard) for how these are used.
871 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200872 * @ingroup input
873 * @{ */
874
875/*! @brief The regular arrow cursor shape.
876 *
877 * The regular arrow cursor.
878 */
879#define GLFW_ARROW_CURSOR 0x00036001
880/*! @brief The text input I-beam cursor shape.
881 *
882 * The text input I-beam cursor shape.
883 */
884#define GLFW_IBEAM_CURSOR 0x00036002
885/*! @brief The crosshair shape.
886 *
887 * The crosshair shape.
888 */
889#define GLFW_CROSSHAIR_CURSOR 0x00036003
890/*! @brief The hand shape.
891 *
892 * The hand shape.
893 */
894#define GLFW_HAND_CURSOR 0x00036004
895/*! @brief The horizontal resize arrow shape.
896 *
897 * The horizontal resize arrow shape.
898 */
899#define GLFW_HRESIZE_CURSOR 0x00036005
900/*! @brief The vertical resize arrow shape.
901 *
902 * The vertical resize arrow shape.
903 */
904#define GLFW_VRESIZE_CURSOR 0x00036006
905/*! @} */
906
Camilla Berglund393e4392013-05-27 22:16:59 +0200907#define GLFW_CONNECTED 0x00040001
908#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100909
Camilla Berglund28101302014-04-08 18:57:43 +0200910#define GLFW_DONT_CARE -1
911
Camilla Berglund97387282011-10-06 23:28:56 +0200912
Camilla Berglund3249f812010-09-07 17:34:51 +0200913/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100914 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200915 *************************************************************************/
916
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100917/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200918 *
919 * Generic function pointer used for returning client API function pointers
920 * without forcing a cast from a regular pointer.
921 *
Camilla Berglundbce20c32015-11-05 13:58:52 +0100922 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200923 * @sa @ref glfwGetProcAddress
Camilla Berglundbce20c32015-11-05 13:58:52 +0100924 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100925 * @since Added in version 3.0.
926
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100927 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100928 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200929typedef void (*GLFWglproc)(void);
930
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200931/*! @brief Vulkan API function pointer type.
932 *
933 * Generic function pointer used for returning Vulkan API function pointers
934 * without forcing a cast from a regular pointer.
935 *
936 * @sa @ref vulkan_proc
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200937 * @sa @ref glfwGetInstanceProcAddress
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200938 *
939 * @since Added in version 3.2.
940 *
941 * @ingroup vulkan
942 */
943typedef void (*GLFWvkproc)(void);
944
Camilla Berglunddba2d802013-01-17 23:06:56 +0100945/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200946 *
947 * Opaque monitor object.
948 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100949 * @see @ref monitor_object
950 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100951 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100952 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100953 * @ingroup monitor
954 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100955typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200956
Camilla Berglunddba2d802013-01-17 23:06:56 +0100957/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200958 *
959 * Opaque window object.
960 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100961 * @see @ref window_object
962 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100963 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100964 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100965 * @ingroup window
966 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100967typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200968
urraka40c04a72013-12-04 10:19:22 -0300969/*! @brief Opaque cursor object.
970 *
971 * Opaque cursor object.
972 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100973 * @see @ref cursor_object
974 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100975 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +0100976 *
urraka40c04a72013-12-04 10:19:22 -0300977 * @ingroup cursor
978 */
979typedef struct GLFWcursor GLFWcursor;
980
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100981/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200982 *
983 * This is the function signature for error callback functions.
984 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100985 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100986 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100987 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100988 * @sa @ref error_handling
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200989 * @sa @ref glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100990 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100991 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100992 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200993 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100994 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100995typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100996
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100997/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200998 *
999 * This is the function signature for window position callback functions.
1000 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001001 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001002 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
1003 * upper-left corner of the client area of the window.
1004 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
1005 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001006 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001007 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001008 * @sa @ref glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001009 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001010 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001011 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001012 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001013 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001014typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001015
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001016/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001017 *
1018 * This is the function signature for window size callback functions.
1019 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001020 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001021 * @param[in] width The new width, in screen coordinates, of the window.
1022 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001023 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001024 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001025 * @sa @ref glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001026 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001027 * @since Added in version 1.0.
1028 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001029 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001030 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001031 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001032typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001033
1034/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001035 *
1036 * This is the function signature for window close callback functions.
1037 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001038 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001039 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001040 * @sa @ref window_close
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001041 * @sa @ref glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001042 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001043 * @since Added in version 2.5.
1044 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001045 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001046 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001047 */
Camilla Berglund64afb192013-03-06 23:29:37 +01001048typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001049
1050/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001051 *
1052 * This is the function signature for window refresh callback functions.
1053 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001054 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001055 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001056 * @sa @ref window_refresh
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001057 * @sa @ref glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001058 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001059 * @since Added in version 2.5.
1060 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001061 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001062 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001063 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001064typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001065
1066/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001067 *
1068 * This is the function signature for window focus callback functions.
1069 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001070 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001071 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
1072 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001073 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001074 * @sa @ref window_focus
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001075 * @sa @ref glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001076 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001077 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001078 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001079 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001080 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001081typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001082
Camilla Berglund06e7a962012-11-22 19:14:27 +01001083/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001084 *
1085 * This is the function signature for window iconify/restore callback
1086 * functions.
1087 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001088 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001089 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
1090 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001091 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001092 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001093 * @sa @ref glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001094 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001095 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001096 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001097 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001098 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001099typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001100
Camilla Berglundc156b502016-06-16 13:09:28 +02001101/*! @brief The function signature for window maximize/restore callbacks.
1102 *
1103 * This is the function signature for window maximize/restore callback
1104 * functions.
1105 *
1106 * @param[in] window The window that was maximized or restored.
1107 * @param[in] iconified `GLFW_TRUE` if the window was maximized, or
1108 * `GLFW_FALSE` if it was restored.
1109 *
1110 * @sa @ref window_maximize
1111 * @sa glfwSetWindowMaximizeCallback
1112 *
1113 * @since Added in version 3.3.
1114 *
1115 * @ingroup window
1116 */
1117typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
1118
Camilla Berglund34981632013-06-03 12:51:57 +02001119/*! @brief The function signature for framebuffer resize callbacks.
1120 *
1121 * This is the function signature for framebuffer resize callback
1122 * functions.
1123 *
1124 * @param[in] window The window whose framebuffer was resized.
1125 * @param[in] width The new width, in pixels, of the framebuffer.
1126 * @param[in] height The new height, in pixels, of the framebuffer.
1127 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001128 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001129 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02001130 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001131 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001132 *
Camilla Berglund34981632013-06-03 12:51:57 +02001133 * @ingroup window
1134 */
1135typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
1136
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001137/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001138 *
1139 * This is the function signature for mouse button callback functions.
1140 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001141 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001142 * @param[in] button The [mouse button](@ref buttons) that was pressed or
1143 * released.
1144 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001145 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1146 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001147 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001148 * @sa @ref input_mouse_button
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001149 * @sa @ref glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001150 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001151 * @since Added in version 1.0.
1152 * @glfw3 Added window handle and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001153 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001154 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001155 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +01001156typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001157
1158/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001159 *
1160 * This is the function signature for cursor position callback functions.
1161 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001162 * @param[in] window The window that received the event.
Camilla Berglund95c44ab2016-02-17 14:52:01 +01001163 * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
1164 * the client area.
1165 * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
1166 * client area.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001167 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001168 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001169 * @sa @ref glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001170 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001171 * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001172 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001173 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001174 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02001175typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001176
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001177/*! @brief The function signature for cursor enter/leave callbacks.
1178 *
1179 * This is the function signature for cursor enter/leave callback functions.
1180 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001181 * @param[in] window The window that received the event.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001182 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
1183 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001184 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001185 * @sa @ref cursor_enter
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001186 * @sa @ref glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001187 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001188 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001189 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001190 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001191 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001192typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001193
1194/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001195 *
1196 * This is the function signature for scroll callback functions.
1197 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001198 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +02001199 * @param[in] xoffset The scroll offset along the x-axis.
1200 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001201 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001202 * @sa @ref scrolling
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001203 * @sa @ref glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001204 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001205 * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001206 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001207 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001208 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001209typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001210
1211/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001212 *
1213 * This is the function signature for keyboard key callback functions.
1214 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001215 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001216 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +02001217 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001218 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001219 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1220 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001221 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001222 * @sa @ref input_key
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001223 * @sa @ref glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001224 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001225 * @since Added in version 1.0.
1226 * @glfw3 Added window handle, scancode and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001227 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001228 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001229 */
Camilla Berglund11615fc2013-05-30 17:19:12 +02001230typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001231
1232/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001233 *
1234 * This is the function signature for Unicode character callback functions.
1235 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001236 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +02001237 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001238 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001239 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001240 * @sa @ref glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001241 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001242 * @since Added in version 2.4.
1243 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001244 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001245 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001246 */
Camilla Berglund182e0af2013-02-25 17:02:28 +01001247typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +01001248
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001249/*! @brief The function signature for Unicode character with modifiers
1250 * callbacks.
1251 *
1252 * This is the function signature for Unicode character with modifiers callback
1253 * functions. It is called for each input character, regardless of what
1254 * modifier keys are held down.
1255 *
1256 * @param[in] window The window that received the event.
1257 * @param[in] codepoint The Unicode code point of the character.
1258 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1259 * held down.
1260 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001261 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001262 * @sa @ref glfwSetCharModsCallback
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001263 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001264 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001265 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001266 * @ingroup input
1267 */
1268typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1269
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001270/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001271 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001272 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001273 *
1274 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001275 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +01001276 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +02001277 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001278 * @sa @ref path_drop
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001279 * @sa @ref glfwSetDropCallback
arturo89d07232013-07-10 11:42:14 +02001280 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001281 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001282 *
arturo89d07232013-07-10 11:42:14 +02001283 * @ingroup input
1284 */
Camilla Berglund8f349e82013-12-22 19:28:46 +01001285typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +02001286
Camilla Berglund5f68e122012-11-27 17:07:28 +01001287/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001288 *
1289 * This is the function signature for monitor configuration callback functions.
1290 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001291 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001292 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001293 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001294 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001295 * @sa @ref glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001296 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001297 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001298 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001299 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +01001300 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001301typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +01001302
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001303/*! @brief The function signature for joystick configuration callbacks.
1304 *
1305 * This is the function signature for joystick configuration callback
1306 * functions.
1307 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02001308 * @param[in] jid The joystick that was connected or disconnected.
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001309 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
1310 *
1311 * @sa @ref joystick_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001312 * @sa @ref glfwSetJoystickCallback
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001313 *
1314 * @since Added in version 3.2.
1315 *
1316 * @ingroup input
1317 */
1318typedef void (* GLFWjoystickfun)(int,int);
1319
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001320/*! @brief Video mode type.
1321 *
1322 * This describes a single video mode.
1323 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001324 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001325 * @sa @ref glfwGetVideoMode
1326 * @sa @ref glfwGetVideoModes
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001327 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001328 * @since Added in version 1.0.
1329 * @glfw3 Added refresh rate member.
Camilla Berglund810bab72015-12-13 17:38:14 +01001330 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001331 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001332 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001333typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001334{
Camilla Berglund95835af2013-05-30 13:53:25 +02001335 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001336 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001337 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001338 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001339 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001340 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001341 /*! The bit depth of the red channel of the video mode.
1342 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001343 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001344 /*! The bit depth of the green channel of the video mode.
1345 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001346 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001347 /*! The bit depth of the blue channel of the video mode.
1348 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001349 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001350 /*! The refresh rate, in Hz, of the video mode.
1351 */
1352 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001353} GLFWvidmode;
1354
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001355/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001356 *
1357 * This describes the gamma ramp for a monitor.
1358 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001359 * @sa @ref monitor_gamma
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001360 * @sa @ref glfwGetGammaRamp
1361 * @sa @ref glfwSetGammaRamp
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001362 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001363 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001364 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001365 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001366 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001367typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001368{
Camilla Berglundc1594112013-05-27 22:29:06 +02001369 /*! An array of value describing the response of the red channel.
1370 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001371 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001372 /*! An array of value describing the response of the green channel.
1373 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001374 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001375 /*! An array of value describing the response of the blue channel.
1376 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001377 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001378 /*! The number of elements in each array.
1379 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001380 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001381} GLFWgammaramp;
1382
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001383/*! @brief Image data.
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001384 *
1385 * @sa @ref cursor_custom
Camilla Berglundfe0317a2016-08-01 11:51:30 +02001386 * @sa @ref window_icon
Camilla Berglund810bab72015-12-13 17:38:14 +01001387 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001388 * @since Added in version 2.1.
1389 * @glfw3 Removed format and bytes-per-pixel members.
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001390 */
1391typedef struct GLFWimage
1392{
1393 /*! The width, in pixels, of this image.
1394 */
1395 int width;
1396 /*! The height, in pixels, of this image.
1397 */
1398 int height;
1399 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1400 */
1401 unsigned char* pixels;
1402} GLFWimage;
1403
Camilla Berglund3249f812010-09-07 17:34:51 +02001404
1405/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001406 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001407 *************************************************************************/
1408
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001409/*! @brief Initializes the GLFW library.
1410 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001411 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001412 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001413 * should be terminated in order to free any resources allocated during or
1414 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001415 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001416 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001417 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001418 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001419 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001420 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001421 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001422 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001423 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001424 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001425 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1426 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001427 * @remark @macos This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001428 * application to the `Contents/Resources` subdirectory of the application's
Camilla Berglund4591ad22014-09-18 15:03:29 +02001429 * bundle, if present. This can be disabled with a
1430 * [compile-time option](@ref compile_options_osx).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001431 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001432 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001433 *
1434 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001435 * @sa @ref glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001436 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001437 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001438 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001439 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001440 */
1441GLFWAPI int glfwInit(void);
1442
1443/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001444 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001445 * This function destroys all remaining windows and cursors, restores any
1446 * modified gamma ramps and frees any other allocated resources. Once this
1447 * function is called, you must again call @ref glfwInit successfully before
1448 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001449 *
1450 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001451 * before the application exits. If initialization fails, there is no need to
1452 * call this function, as it is called by @ref glfwInit before it returns
1453 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001454 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001455 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1456 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001457 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001458 *
Camilla Berglund0df4e062015-12-13 14:07:27 +01001459 * @warning The contexts of any remaining windows must not be current on any
1460 * other thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001461 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001462 * @reentrancy This function must not be called from a callback.
Camilla Berglund20858762015-01-01 18:41:22 +01001463 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001464 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001465 *
1466 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001467 * @sa @ref glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001468 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001469 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001470 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001471 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001472 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001473GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001474
1475/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001476 *
1477 * This function retrieves the major, minor and revision numbers of the GLFW
1478 * library. It is intended for when you are using GLFW as a shared library and
1479 * want to ensure that you are using the minimum required version.
1480 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001481 * Any or all of the version arguments may be `NULL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001482 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001483 * @param[out] major Where to store the major version number, or `NULL`.
1484 * @param[out] minor Where to store the minor version number, or `NULL`.
1485 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001486 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001487 * @errors None.
1488 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001489 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001490 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001491 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001492 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001493 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001494 * @sa @ref glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001495 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001496 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001497 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001498 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001499 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001500GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001501
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001502/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001503 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001504 * This function returns the compile-time generated
1505 * [version string](@ref intro_version_string) of the GLFW library binary. It
1506 * describes the version, platform, compiler and any platform-specific
Camilla Berglund386b6032016-02-10 13:48:49 +01001507 * compile-time options. It should not be confused with the OpenGL or OpenGL
1508 * ES version string, queried with `glGetString`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001509 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001510 * __Do not use the version string__ to parse the GLFW library version. The
Camilla Berglund386b6032016-02-10 13:48:49 +01001511 * @ref glfwGetVersion function provides the version of the running library
1512 * binary in numerical format.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001513 *
Camilla Berglund386b6032016-02-10 13:48:49 +01001514 * @return The ASCII encoded GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001515 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001516 * @errors None.
1517 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001518 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001519 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001520 * @pointer_lifetime The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001521 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001522 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001523 *
1524 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001525 * @sa @ref glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001526 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001527 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001528 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001529 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001530 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001531GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001532
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001533/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001534 *
1535 * This function sets the error callback, which is called with an error code
1536 * and a human-readable description each time a GLFW error occurs.
1537 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001538 * The error callback is called on the thread where the error occurred. If you
1539 * are using GLFW from multiple threads, your error callback needs to be
1540 * written accordingly.
1541 *
1542 * Because the description string may have been generated specifically for that
1543 * error, it is not guaranteed to be valid after the callback has returned. If
1544 * you wish to use it after the callback returns, you need to make a copy.
1545 *
Camilla Berglund20858762015-01-01 18:41:22 +01001546 * Once set, the error callback remains set even after the library has been
1547 * terminated.
1548 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001549 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001550 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001551 * @return The previously set callback, or `NULL` if no callback was set.
1552 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001553 * @errors None.
1554 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001555 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001556 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001557 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001558 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001559 * @sa @ref error_handling
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001560 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001561 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001562 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001563 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001564 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001565GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001566
Camilla Berglund5f68e122012-11-27 17:07:28 +01001567/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001568 *
1569 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001570 * monitors. The primary monitor is always first in the returned array. If no
1571 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001572 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001573 * @param[out] count Where to store the number of monitors in the returned
1574 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001575 * @return An array of monitor handles, or `NULL` if no monitors were found or
1576 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001577 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001578 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1579 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001580 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1581 * should not free it yourself. It is guaranteed to be valid only until the
1582 * monitor configuration changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001583 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001584 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001585 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001586 * @sa @ref monitor_monitors
1587 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001588 * @sa @ref glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001589 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001590 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001591 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001592 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001593 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001594GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001595
Camilla Berglund5f68e122012-11-27 17:07:28 +01001596/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001597 *
1598 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001599 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001600 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001601 * @return The primary monitor, or `NULL` if no monitors were found or if an
1602 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001603 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001604 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1605 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001606 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001607 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001608 * @remark The primary monitor is always first in the array returned by @ref
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001609 * glfwGetMonitors.
1610 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001611 * @sa @ref monitor_monitors
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001612 * @sa @ref glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001613 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001614 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001615 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001616 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001617 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001618GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001619
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001620/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001621 *
1622 * This function returns the position, in screen coordinates, of the upper-left
1623 * corner of the specified monitor.
1624 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001625 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1626 * non-`NULL` position arguments will be set to zero.
1627 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001628 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001629 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1630 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001631 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001632 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1633 * GLFW_PLATFORM_ERROR.
1634 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001635 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001636 *
1637 * @sa @ref monitor_properties
1638 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001639 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001640 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001641 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001642 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001643GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1644
1645/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001646 *
1647 * This function returns the size, in millimetres, of the display area of the
1648 * specified monitor.
1649 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001650 * Some systems do not provide accurate monitor size information, either
1651 * because the monitor
1652 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1653 * data is incorrect or because the driver does not report it accurately.
1654 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001655 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1656 * non-`NULL` size arguments will be set to zero.
1657 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001658 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001659 * @param[out] widthMM Where to store the width, in millimetres, of the
1660 * monitor's display area, or `NULL`.
1661 * @param[out] heightMM Where to store the height, in millimetres, of the
1662 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001663 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001664 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1665 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001666 * @remark @win32 calculates the returned physical size from the
Camilla Berglund4188c262015-01-18 01:55:25 +01001667 * current resolution and system DPI instead of querying the monitor EDID data.
Camilla Berglund0e205772014-03-24 11:58:35 +01001668 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001669 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001670 *
1671 * @sa @ref monitor_properties
1672 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001673 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001674 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001675 * @ingroup monitor
1676 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001677GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001678
Camilla Berglund5f68e122012-11-27 17:07:28 +01001679/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001680 *
1681 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001682 * specified monitor. The name typically reflects the make and model of the
1683 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001684 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001685 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001686 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1687 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001688 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001689 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1690 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001691 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
1692 * should not free it yourself. It is valid until the specified monitor is
1693 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001694 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001695 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001696 *
1697 * @sa @ref monitor_properties
1698 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001699 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001700 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001701 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001702 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001703GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001704
Camilla Berglund5f68e122012-11-27 17:07:28 +01001705/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001706 *
1707 * This function sets the monitor configuration callback, or removes the
1708 * currently set callback. This is called when a monitor is connected to or
1709 * disconnected from the system.
1710 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001711 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001712 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001713 * @return The previously set callback, or `NULL` if no callback was set or the
1714 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001715 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001716 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1717 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001718 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001719 *
1720 * @sa @ref monitor_event
1721 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001722 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001723 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001724 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001725 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001726GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001727
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001728/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001729 *
1730 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001731 * monitor. The returned array is sorted in ascending order, first by color
1732 * bit depth (the sum of all channel depths) and then by resolution area (the
1733 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001734 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001735 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001736 * @param[out] count Where to store the number of video modes in the returned
1737 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001738 * @return An array of video modes, or `NULL` if an
1739 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001740 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001741 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1742 * GLFW_PLATFORM_ERROR.
1743 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001744 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1745 * should not free it yourself. It is valid until the specified monitor is
1746 * disconnected, this function is called again for that monitor or the library
1747 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001748 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001749 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001750 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001751 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001752 * @sa @ref glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001753 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001754 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001755 * @glfw3 Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001756 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001757 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001758 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001759GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001760
Camilla Berglund5f68e122012-11-27 17:07:28 +01001761/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001762 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001763 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001764 * you have created a full screen window for that monitor, the return value
1765 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001766 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001767 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001768 * @return The current mode of the monitor, or `NULL` if an
1769 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001770 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001771 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1772 * GLFW_PLATFORM_ERROR.
1773 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001774 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1775 * should not free it yourself. It is valid until the specified monitor is
1776 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001777 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001778 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001779 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001780 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001781 * @sa @ref glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001782 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001783 * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001784 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001785 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001786 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001787GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001788
Camilla Berglund92a71e02013-02-12 13:50:41 +01001789/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001790 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001791 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglund5bbc2b42015-03-15 15:40:43 +01001792 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1793 * number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001794 *
Camilla Löwyce161c22016-12-06 01:14:23 +01001795 * The software controlled gamma ramp is applied _in addition_ to the hardware
1796 * gamma correction, which today is usually an approximation of sRGB gamma.
1797 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
1798 * the default (usually sRGB-like) behavior.
1799 *
1800 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
1801 * GLFW_SRGB_CAPABLE hint.
1802 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001803 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001804 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001805 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001806 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1807 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
1808 *
linkmauvebc8b0482016-10-16 15:52:39 +01001809 * @remark @wayland Gamma handling is currently unavailable, this function will
1810 * always emit @ref GLFW_PLATFORM_ERROR.
1811 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001812 * @thread_safety This function must only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001813 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001814 * @sa @ref monitor_gamma
1815 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001816 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001817 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001818 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001819 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001820GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001821
Camilla Berglund4591ad22014-09-18 15:03:29 +02001822/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001823 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001824 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001825 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001826 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001827 * @return The current gamma ramp, or `NULL` if an
1828 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001829 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001830 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1831 * GLFW_PLATFORM_ERROR.
1832 *
linkmauvebc8b0482016-10-16 15:52:39 +01001833 * @remark @wayland Gamma handling is currently unavailable, this function will
1834 * always return `NULL` and emit @ref GLFW_PLATFORM_ERROR.
1835 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001836 * @pointer_lifetime The returned structure and its arrays are allocated and
1837 * freed by GLFW. You should not free them yourself. They are valid until the
1838 * specified monitor is disconnected, this function is called again for that
1839 * monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001840 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001841 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001842 *
1843 * @sa @ref monitor_gamma
1844 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001845 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001846 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001847 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001848 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001849GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001850
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001851/*! @brief Sets the current gamma ramp for the specified monitor.
1852 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001853 * This function sets the current gamma ramp for the specified monitor. The
1854 * original gamma ramp for that monitor is saved by GLFW the first time this
1855 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001856 *
Camilla Löwyce161c22016-12-06 01:14:23 +01001857 * The software controlled gamma ramp is applied _in addition_ to the hardware
1858 * gamma correction, which today is usually an approximation of sRGB gamma.
1859 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
1860 * the default (usually sRGB-like) behavior.
1861 *
1862 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
1863 * GLFW_SRGB_CAPABLE hint.
1864 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001865 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001866 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001867 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001868 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1869 * GLFW_PLATFORM_ERROR.
1870 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001871 * @remark Gamma ramp sizes other than 256 are not supported by all platforms
Camilla Berglund76fff4d2015-03-10 19:02:28 +01001872 * or graphics hardware.
1873 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001874 * @remark @win32 The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001875 *
linkmauvebc8b0482016-10-16 15:52:39 +01001876 * @remark @wayland Gamma handling is currently unavailable, this function will
1877 * always emit @ref GLFW_PLATFORM_ERROR.
1878 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001879 * @pointer_lifetime The specified gamma ramp is copied before this function
1880 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001881 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001882 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001883 *
1884 * @sa @ref monitor_gamma
1885 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001886 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001887 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001888 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001889 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001890GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001891
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001892/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001893 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001894 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001895 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001896 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001897 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1898 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001899 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001900 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001901 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001902 * @sa @ref glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001903 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001904 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001905 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001906 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001907 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001908GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001909
1910/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001911 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001912 * This function sets hints for the next call to @ref glfwCreateWindow. The
1913 * hints, once set, retain their values until changed by a call to @ref
1914 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02001915 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01001916 *
Camilla Berglundd6e0a432016-02-09 07:41:48 +01001917 * This function does not check whether the specified hint values are valid.
1918 * If you set hints to invalid values this will instead be reported by the next
1919 * call to @ref glfwCreateWindow.
1920 *
Camilla Berglundd0649e62016-01-27 03:25:21 +01001921 * @param[in] hint The [window hint](@ref window_hints) to set.
1922 * @param[in] value The new value of the window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001923 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001924 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1925 * GLFW_INVALID_ENUM.
1926 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001927 * @thread_safety This function must only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01001928 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001929 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001930 * @sa @ref glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001931 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001932 * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001933 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001934 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001935 */
Camilla Berglundd0649e62016-01-27 03:25:21 +01001936GLFWAPI void glfwWindowHint(int hint, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001937
1938/*! @brief Creates a window and its associated context.
1939 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001940 * This function creates a window and its associated OpenGL or OpenGL ES
1941 * context. Most of the options controlling how the window and its context
1942 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001943 *
1944 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02001945 * can use the newly created context, you need to
1946 * [make it current](@ref context_current). For information about the `share`
1947 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001948 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001949 * The created window, framebuffer and context may differ from what you
1950 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001951 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001952 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02001953 * of the created window, framebuffer and context, see @ref
1954 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001955 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001956 * To create a full screen window, you need to specify the monitor the window
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001957 * will cover. If no monitor is specified, the window will be windowed mode.
1958 * Unless you have a way for the user to choose a specific monitor, it is
1959 * recommended that you pick the primary monitor. For more information on how
1960 * to query connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001961 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001962 * For full screen windows, the specified size becomes the resolution of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001963 * window's _desired video mode_. As long as a full screen window is not
1964 * iconified, the supported video mode most closely matching the desired video
1965 * mode is set for the specified monitor. For more information about full
1966 * screen windows, including the creation of so called _windowed full screen_
1967 * or _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001968 *
Camilla Berglund999f3552016-08-17 16:48:22 +02001969 * Once you have created the window, you can switch it between windowed and
Camilla Berglunde83be1d2016-11-08 12:19:06 +01001970 * full screen mode with @ref glfwSetWindowMonitor. This will not affect its
1971 * OpenGL or OpenGL ES context.
Camilla Berglund999f3552016-08-17 16:48:22 +02001972 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001973 * By default, newly created windows use the placement recommended by the
1974 * window system. To create the window at a specific position, make it
Camilla Löwyce161c22016-12-06 01:14:23 +01001975 * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001976 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
1977 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001978 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001979 * As long as at least one full screen window is not iconified, the screensaver
1980 * is prohibited from starting.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001981 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001982 * Window systems put limits on window sizes. Very large or very small window
1983 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02001984 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001985 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001986 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02001987 * the initial value may vary depending on driver settings and defaults.
1988 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001989 * @param[in] width The desired width, in screen coordinates, of the window.
1990 * This must be greater than zero.
1991 * @param[in] height The desired height, in screen coordinates, of the window.
1992 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001993 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001994 * @param[in] monitor The monitor to use for full screen mode, or `NULL` for
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001995 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001996 * @param[in] share The window whose context to share resources with, or `NULL`
1997 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001998 * @return The handle of the created window, or `NULL` if an
1999 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002000 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002001 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2002 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
2003 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
2004 * GLFW_PLATFORM_ERROR.
2005 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002006 * @remark @win32 Window creation will fail if the Microsoft GDI software
2007 * OpenGL implementation is the only one available.
Camilla Berglund07db5da2013-09-26 19:15:36 +02002008 *
Camilla Berglund20bce152016-05-30 16:04:37 +02002009 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
2010 * will be set as the initial icon for the window. If no such icon is present,
2011 * the `IDI_WINLOGO` icon will be used instead. To set a different icon, see
2012 * @ref glfwSetWindowIcon.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002013 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002014 * @remark @win32 The context to share resources with must not be current on
2015 * any other thread.
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01002016 *
Camilla Löwyfd127d52016-12-03 19:32:00 +01002017 * @remark @macos The OS only supports forward-compatible core profile contexts
2018 * for OpenGL versions 3.2 and later. Before creating an OpenGL context of
2019 * version 3.2 or later you must set the
Camilla Löwyce161c22016-12-06 01:14:23 +01002020 * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
2021 * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
2022 * OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
Camilla Löwyfd127d52016-12-03 19:32:00 +01002023 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002024 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01002025 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002026 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002027 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2028 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002029 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002030 * @remark @macos The first time a window is created the menu bar is populated
Camilla Berglund951a9582016-01-31 21:32:14 +01002031 * with common commands like Hide, Quit and About. The About entry opens
2032 * a minimal about dialog with information from the application's bundle. The
2033 * menu bar can be disabled with a
Camilla Berglund96d230b2014-10-07 02:15:36 +02002034 * [compile-time option](@ref compile_options_osx).
Camilla Berglund4591ad22014-09-18 15:03:29 +02002035 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002036 * @remark @macos On OS X 10.10 and later the window frame will not be rendered
Camilla Löwy58ceab52016-12-07 00:41:54 +01002037 * at full resolution on Retina displays unless the
2038 * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
2039 * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
2040 * application bundle's `Info.plist`. For more information, see
Camilla Berglund821f3e62015-03-16 22:39:14 +01002041 * [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 +02002042 * in the Mac Developer Library. The GLFW test and example programs use
2043 * a custom `Info.plist` template for this, which can be found as
2044 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01002045 *
Camilla Löwy46613152017-01-01 19:41:50 +01002046 * @remark @macos When activating frame autosaving with
2047 * [GLFW_COCOA_FRAME_AUTOSAVE](@ref GLFW_COCOA_FRAME_AUTOSAVE_hint), the
2048 * specified window size may be overriden by a previously saved size and
2049 * position.
2050 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002051 * @remark @x11 Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002052 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02002053 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002054 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
2055 * a window to reach its requested state. This means you may not be able to
2056 * query the final size, position or other attributes directly after window
2057 * creation.
Camilla Berglund20ed0a12015-08-12 21:31:54 +02002058 *
linkmauvebc8b0482016-10-16 15:52:39 +01002059 * @remark @wayland The window frame is currently unimplemented, as if
Camilla Löwyce161c22016-12-06 01:14:23 +01002060 * [GLFW_DECORATED](@ref GLFW_DECORATED_hint) was always set to `GLFW_FALSE`.
2061 * A compositor can still emit close, resize or maximize events, using for
2062 * example a keybind mechanism.
linkmauvebc8b0482016-10-16 15:52:39 +01002063 *
2064 * @remark @wayland A full screen window will not attempt to change the mode,
2065 * no matter what the requested size or refresh rate.
2066 *
2067 * @remark @wayland The wl_shell protocol does not support window
2068 * icons, the window will inherit the one defined in the application's
2069 * desktop file, so this function emits @ref GLFW_PLATFORM_ERROR.
2070 *
2071 * @remark @wayland Screensaver inhibition is currently unimplemented.
2072 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002073 * @reentrancy This function must not be called from a callback.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002074 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002075 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002076 *
2077 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002078 * @sa @ref glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002079 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002080 * @since Added in version 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002081 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002082 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002083 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002084GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002085
2086/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002087 *
2088 * This function destroys the specified window and its context. On calling
2089 * this function, no further callbacks will be called for that window.
2090 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002091 * If the context of the specified window is current on the main thread, it is
2092 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002093 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002094 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002095 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002096 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2097 * GLFW_PLATFORM_ERROR.
2098 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002099 * @note The context of the specified window must not be current on any other
2100 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002101 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002102 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01002103 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002104 * @thread_safety This function must only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002105 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002106 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002107 * @sa @ref glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002108 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002109 * @since Added in version 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002110 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002111 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002112 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002113GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002114
Camilla Berglund64afb192013-03-06 23:29:37 +01002115/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002116 *
2117 * This function returns the value of the close flag of the specified window.
2118 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002119 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01002120 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002121 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002122 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2123 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002124 * @thread_safety This function may be called from any thread. Access is not
2125 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002126 *
2127 * @sa @ref window_close
2128 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002129 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02002130 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002131 * @ingroup window
2132 */
2133GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
2134
Camilla Berglund64afb192013-03-06 23:29:37 +01002135/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002136 *
2137 * This function sets the value of the close flag of the specified window.
2138 * This can be used to override the user's attempt to close the window, or
2139 * to signal that it should be closed.
2140 *
Camilla Berglund64afb192013-03-06 23:29:37 +01002141 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01002142 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002143 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002144 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2145 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002146 * @thread_safety This function may be called from any thread. Access is not
2147 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002148 *
2149 * @sa @ref window_close
2150 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002151 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02002152 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002153 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01002154 */
2155GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
2156
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002157/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002158 *
2159 * This function sets the window title, encoded as UTF-8, of the specified
2160 * window.
2161 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002162 * @param[in] window The window whose title to change.
2163 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002164 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002165 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2166 * GLFW_PLATFORM_ERROR.
2167 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002168 * @remark @macos The window title will not be updated until the next time you
Camilla Berglund951a9582016-01-31 21:32:14 +01002169 * process events.
Camilla Berglund6412dcb2015-04-07 21:52:29 +02002170 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002171 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002172 *
2173 * @sa @ref window_title
2174 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002175 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002176 * @glfw3 Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002177 *
2178 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002179 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002180GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002181
Camilla Berglundb823f712016-03-07 14:55:30 +01002182/*! @brief Sets the icon for the specified window.
2183 *
2184 * This function sets the icon of the specified window. If passed an array of
2185 * candidate images, those of or closest to the sizes desired by the system are
2186 * selected. If no images are specified, the window reverts to its default
2187 * icon.
2188 *
2189 * The desired image sizes varies depending on platform and system settings.
2190 * The selected images will be rescaled as needed. Good sizes include 16x16,
2191 * 32x32 and 48x48.
2192 *
2193 * @param[in] window The window whose icon to set.
2194 * @param[in] count The number of images in the specified array, or zero to
2195 * revert to the default window icon.
2196 * @param[in] images The images to create the icon from. This is ignored if
2197 * count is zero.
2198 *
2199 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2200 * GLFW_PLATFORM_ERROR.
2201 *
2202 * @pointer_lifetime The specified image data is copied before this function
2203 * returns.
2204 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002205 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund20bce152016-05-30 16:04:37 +02002206 * window, so this function does nothing. The dock icon will be the same as
2207 * the application bundle's icon. For more information on bundles, see the
Camilla Berglundb823f712016-03-07 14:55:30 +01002208 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2209 * in the Mac Developer Library.
2210 *
linkmauvebc8b0482016-10-16 15:52:39 +01002211 * @remark @wayland The wl_shell protocol does not support icons, the window
2212 * will inherit the one defined in the application's desktop file, so this
2213 * function emits @ref GLFW_PLATFORM_ERROR.
2214 *
Camilla Berglundb823f712016-03-07 14:55:30 +01002215 * @thread_safety This function must only be called from the main thread.
2216 *
2217 * @sa @ref window_icon
2218 *
2219 * @since Added in version 3.2.
2220 *
2221 * @ingroup window
2222 */
2223GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
2224
Camilla Berglund7c193232013-01-24 19:30:31 +01002225/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002226 *
2227 * This function retrieves the position, in screen coordinates, of the
2228 * upper-left corner of the client area of the specified window.
2229 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002230 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2231 * non-`NULL` position arguments will be set to zero.
2232 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002233 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002234 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
2235 * the client area, or `NULL`.
2236 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
2237 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01002238 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002239 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2240 * GLFW_PLATFORM_ERROR.
2241 *
linkmauvebc8b0482016-10-16 15:52:39 +01002242 * @remark @wayland There is no way for an application to retrieve the global
2243 * position of its windows, this function will always emit @ref
2244 * GLFW_PLATFORM_ERROR.
2245 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002246 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002247 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002248 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002249 * @sa @ref glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002250 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002251 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002252 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002253 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002254 */
2255GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
2256
2257/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002258 *
2259 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002260 * corner of the client area of the specified windowed mode window. If the
2261 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002262 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002263 * __Do not use this function__ to move an already visible window unless you
2264 * have very good reasons for doing so, as it will confuse and annoy the user.
2265 *
2266 * The window manager may put limits on what positions are allowed. GLFW
2267 * cannot and should not override these limits.
2268 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002269 * @param[in] window The window to query.
2270 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
2271 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01002272 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002273 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2274 * GLFW_PLATFORM_ERROR.
2275 *
linkmauvebc8b0482016-10-16 15:52:39 +01002276 * @remark @wayland There is no way for an application to set the global
2277 * position of its windows, this function will always emit @ref
2278 * GLFW_PLATFORM_ERROR.
2279 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002280 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002281 *
2282 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002283 * @sa @ref glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002284 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002285 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002286 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002287 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002288 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002289 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01002290GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01002291
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002292/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002293 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002294 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002295 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002296 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002297 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002298 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2299 * non-`NULL` size arguments will be set to zero.
2300 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002301 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002302 * @param[out] width Where to store the width, in screen coordinates, of the
2303 * client area, or `NULL`.
2304 * @param[out] height Where to store the height, in screen coordinates, of the
2305 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002306 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002307 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2308 * GLFW_PLATFORM_ERROR.
2309 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002310 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002311 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002312 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002313 * @sa @ref glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002314 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002315 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002316 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002317 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002318 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002319 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002320GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002321
Camilla Berglundd84772d2014-02-13 02:57:59 +01002322/*! @brief Sets the size limits of the specified window.
2323 *
2324 * This function sets the size limits of the client area of the specified
Emmanuel Gil Peyrotf0f5d9f2016-04-09 00:42:58 +01002325 * window. If the window is full screen, the size limits only take effect
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002326 * once it is made windowed. If the window is not resizable, this function
2327 * does nothing.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002328 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002329 * The size limits are applied immediately to a windowed mode window and may
2330 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002331 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002332 * The maximum dimensions must be greater than or equal to the minimum
2333 * dimensions and all must be greater than or equal to zero.
2334 *
Camilla Berglundd84772d2014-02-13 02:57:59 +01002335 * @param[in] window The window to set limits for.
2336 * @param[in] minwidth The minimum width, in screen coordinates, of the client
2337 * area, or `GLFW_DONT_CARE`.
2338 * @param[in] minheight The minimum height, in screen coordinates, of the
2339 * client area, or `GLFW_DONT_CARE`.
2340 * @param[in] maxwidth The maximum width, in screen coordinates, of the client
2341 * area, or `GLFW_DONT_CARE`.
2342 * @param[in] maxheight The maximum height, in screen coordinates, of the
2343 * client area, or `GLFW_DONT_CARE`.
2344 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002345 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2346 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
Camilla Berglundf51cf812016-02-05 00:51:40 +01002347 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002348 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002349 * results are undefined.
2350 *
linkmauvebc8b0482016-10-16 15:52:39 +01002351 * @remark @wayland The size limits will not be applied until the window is
2352 * actually resized, either by the user or by the compositor.
2353 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002354 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002355 *
2356 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002357 * @sa @ref glfwSetWindowAspectRatio
Camilla Berglundd84772d2014-02-13 02:57:59 +01002358 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002359 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002360 *
2361 * @ingroup window
2362 */
2363GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2364
2365/*! @brief Sets the aspect ratio of the specified window.
2366 *
2367 * This function sets the required aspect ratio of the client area of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002368 * specified window. If the window is full screen, the aspect ratio only takes
2369 * effect once it is made windowed. If the window is not resizable, this
Camilla Berglundd84772d2014-02-13 02:57:59 +01002370 * function does nothing.
2371 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002372 * The aspect ratio is specified as a numerator and a denominator and both
2373 * values must be greater than zero. For example, the common 16:9 aspect ratio
2374 * is specified as 16 and 9, respectively.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002375 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002376 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
2377 * ratio limit is disabled.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002378 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002379 * The aspect ratio is applied immediately to a windowed mode window and may
2380 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002381 *
2382 * @param[in] window The window to set limits for.
2383 * @param[in] numer The numerator of the desired aspect ratio, or
2384 * `GLFW_DONT_CARE`.
2385 * @param[in] denom The denominator of the desired aspect ratio, or
2386 * `GLFW_DONT_CARE`.
2387 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002388 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2389 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2390 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002391 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002392 * results are undefined.
2393 *
linkmauvebc8b0482016-10-16 15:52:39 +01002394 * @remark @wayland The aspect ratio will not be applied until the window is
2395 * actually resized, either by the user or by the compositor.
2396 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002397 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002398 *
2399 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002400 * @sa @ref glfwSetWindowSizeLimits
Camilla Berglundd84772d2014-02-13 02:57:59 +01002401 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002402 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002403 *
2404 * @ingroup window
2405 */
2406GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2407
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002408/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002409 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002410 * This function sets the size, in screen coordinates, of the client area of
2411 * the specified window.
2412 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002413 * For full screen windows, this function updates the resolution of its desired
2414 * video mode and switches to the video mode closest to it, without affecting
2415 * the window's context. As the context is unaffected, the bit depths of the
2416 * framebuffer remain unchanged.
2417 *
2418 * If you wish to update the refresh rate of the desired video mode in addition
2419 * to its resolution, see @ref glfwSetWindowMonitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002420 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002421 * The window manager may put limits on what sizes are allowed. GLFW cannot
2422 * and should not override these limits.
2423 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002424 * @param[in] window The window to resize.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002425 * @param[in] width The desired width, in screen coordinates, of the window
2426 * client area.
2427 * @param[in] height The desired height, in screen coordinates, of the window
2428 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002429 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002430 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2431 * GLFW_PLATFORM_ERROR.
2432 *
linkmauvebc8b0482016-10-16 15:52:39 +01002433 * @remark @wayland A full screen window will not attempt to change the mode,
2434 * no matter what the requested size.
2435 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002436 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002437 *
2438 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002439 * @sa @ref glfwGetWindowSize
2440 * @sa @ref glfwSetWindowMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002441 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002442 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002443 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002444 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002445 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002446 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002447GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002448
Camilla Berglund34981632013-06-03 12:51:57 +02002449/*! @brief Retrieves the size of the framebuffer of the specified window.
2450 *
2451 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002452 * specified window. If you wish to retrieve the size of the window in screen
2453 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02002454 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002455 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2456 * non-`NULL` size arguments will be set to zero.
2457 *
Camilla Berglund34981632013-06-03 12:51:57 +02002458 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002459 * @param[out] width Where to store the width, in pixels, of the framebuffer,
2460 * or `NULL`.
2461 * @param[out] height Where to store the height, in pixels, of the framebuffer,
2462 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02002463 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002464 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2465 * GLFW_PLATFORM_ERROR.
2466 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002467 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002468 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002469 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002470 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02002471 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002472 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002473 *
Camilla Berglund34981632013-06-03 12:51:57 +02002474 * @ingroup window
2475 */
2476GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
2477
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002478/*! @brief Retrieves the size of the frame of the window.
2479 *
2480 * This function retrieves the size, in screen coordinates, of each edge of the
2481 * frame of the specified window. This size includes the title bar, if the
2482 * window has one. The size of the frame may vary depending on the
2483 * [window-related hints](@ref window_hints_wnd) used to create it.
2484 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002485 * Because this function retrieves the size of each window frame edge and not
2486 * the offset along a particular coordinate axis, the retrieved values will
2487 * always be zero or positive.
2488 *
2489 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2490 * non-`NULL` size arguments will be set to zero.
2491 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002492 * @param[in] window The window whose frame size to query.
2493 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002494 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002495 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02002496 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002497 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002498 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002499 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002500 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002501 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002502 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2503 * GLFW_PLATFORM_ERROR.
2504 *
linkmauvebc8b0482016-10-16 15:52:39 +01002505 * @remark @wayland The window frame is currently unimplemented, as if
Camilla Löwyce161c22016-12-06 01:14:23 +01002506 * [GLFW_DECORATED](@ref GLFW_DECORATED_hint) was always set to `GLFW_FALSE`,
2507 * so the returned values will always be zero.
linkmauvebc8b0482016-10-16 15:52:39 +01002508 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002509 * @thread_safety This function must only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002510 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002511 * @sa @ref window_size
2512 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002513 * @since Added in version 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002514 *
2515 * @ingroup window
2516 */
2517GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2518
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002519/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002520 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002521 * This function iconifies (minimizes) the specified window if it was
2522 * previously restored. If the window is already iconified, this function does
2523 * nothing.
2524 *
2525 * If the specified window is a full screen window, the original monitor
2526 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002527 *
2528 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002529 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002530 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2531 * GLFW_PLATFORM_ERROR.
2532 *
linkmauvebc8b0482016-10-16 15:52:39 +01002533 * @remark @wayland There is no concept of iconification in wl_shell, this
2534 * function will always emit @ref GLFW_PLATFORM_ERROR.
2535 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002536 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002537 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002538 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002539 * @sa @ref glfwRestoreWindow
2540 * @sa @ref glfwMaximizeWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002541 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002542 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002543 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002544 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002545 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002546 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002547GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002548
2549/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002550 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002551 * This function restores the specified window if it was previously iconified
Camilla Berglunda10caa42015-10-13 12:50:59 +02002552 * (minimized) or maximized. If the window is already restored, this function
2553 * does nothing.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002554 *
2555 * If the specified window is a full screen window, the resolution chosen for
2556 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002557 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002558 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002559 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002560 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2561 * GLFW_PLATFORM_ERROR.
2562 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002563 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002564 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002565 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002566 * @sa @ref glfwIconifyWindow
2567 * @sa @ref glfwMaximizeWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01002568 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002569 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002570 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002571 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002572 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002573 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002574GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002575
Camilla Berglunda10caa42015-10-13 12:50:59 +02002576/*! @brief Maximizes the specified window.
2577 *
2578 * This function maximizes the specified window if it was previously not
2579 * maximized. If the window is already maximized, this function does nothing.
2580 *
2581 * If the specified window is a full screen window, this function does nothing.
2582 *
2583 * @param[in] window The window to maximize.
2584 *
Camilla Berglundf5b71f52016-05-27 14:20:39 +02002585 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2586 * GLFW_PLATFORM_ERROR.
2587 *
Camilla Berglunda10caa42015-10-13 12:50:59 +02002588 * @par Thread Safety
2589 * This function may only be called from the main thread.
2590 *
2591 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002592 * @sa @ref glfwIconifyWindow
2593 * @sa @ref glfwRestoreWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002594 *
2595 * @since Added in GLFW 3.2.
2596 *
2597 * @ingroup window
2598 */
2599GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
2600
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002601/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002602 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002603 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002604 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002605 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002606 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002607 * @param[in] window The window to make visible.
2608 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002609 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2610 * GLFW_PLATFORM_ERROR.
2611 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002612 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002613 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002614 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002615 * @sa @ref glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002616 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002617 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002618 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002619 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002620 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002621GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002622
2623/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002624 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002625 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002626 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002627 * nothing.
2628 *
2629 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002630 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002631 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2632 * GLFW_PLATFORM_ERROR.
2633 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002634 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002635 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002636 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002637 * @sa @ref glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002638 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002639 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002640 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002641 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002642 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002643GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002644
Camilla Berglundbaf57442016-02-21 15:42:49 +01002645/*! @brief Brings the specified window to front and sets input focus.
2646 *
2647 * This function brings the specified window to front and sets input focus.
2648 * The window should already be visible and not iconified.
2649 *
2650 * By default, both windowed and full screen mode windows are focused when
Camilla Löwyce161c22016-12-06 01:14:23 +01002651 * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to
2652 * disable this behavior.
Camilla Berglundbaf57442016-02-21 15:42:49 +01002653 *
2654 * __Do not use this function__ to steal focus from other applications unless
2655 * you are certain that is what the user wants. Focus stealing can be
2656 * extremely disruptive.
2657 *
2658 * @param[in] window The window to give input focus.
2659 *
2660 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2661 * GLFW_PLATFORM_ERROR.
2662 *
linkmauvebc8b0482016-10-16 15:52:39 +01002663 * @remark @wayland It is not possible for an application to bring its windows
2664 * to front, this function will always emit @ref GLFW_PLATFORM_ERROR.
2665 *
Camilla Berglundbaf57442016-02-21 15:42:49 +01002666 * @thread_safety This function must only be called from the main thread.
2667 *
2668 * @sa @ref window_focus
2669 *
2670 * @since Added in version 3.2.
2671 *
2672 * @ingroup window
2673 */
2674GLFWAPI void glfwFocusWindow(GLFWwindow* window);
2675
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002676/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002677 *
2678 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002679 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002680 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002681 * @param[in] window The window to query.
Camilla Berglund999f3552016-08-17 16:48:22 +02002682 * @return The monitor, or `NULL` if the window is in windowed mode or an
2683 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002684 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002685 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2686 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002687 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002688 *
2689 * @sa @ref window_monitor
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002690 * @sa @ref glfwSetWindowMonitor
Camilla Berglund4591ad22014-09-18 15:03:29 +02002691 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002692 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002693 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002694 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002695 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002696GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002697
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002698/*! @brief Sets the mode, monitor, video mode and placement of a window.
2699 *
2700 * This function sets the monitor that the window uses for full screen mode or,
2701 * if the monitor is `NULL`, makes it windowed mode.
2702 *
2703 * When setting a monitor, this function updates the width, height and refresh
2704 * rate of the desired video mode and switches to the video mode closest to it.
2705 * The window position is ignored when setting a monitor.
2706 *
2707 * When the monitor is `NULL`, the position, width and height are used to
2708 * place the window client area. The refresh rate is ignored when no monitor
2709 * is specified.
2710 *
2711 * If you only wish to update the resolution of a full screen window or the
2712 * size of a windowed mode window, see @ref glfwSetWindowSize.
2713 *
2714 * When a window transitions from full screen to windowed mode, this function
2715 * restores any previous window settings such as whether it is decorated,
linkmauvebc8b0482016-10-16 15:52:39 +01002716 * floating, resizable, has size or aspect ratio limits, etc.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002717 *
2718 * @param[in] window The window whose monitor, size or video mode to set.
2719 * @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
2720 * @param[in] xpos The desired x-coordinate of the upper-left corner of the
2721 * client area.
2722 * @param[in] ypos The desired y-coordinate of the upper-left corner of the
2723 * client area.
2724 * @param[in] width The desired with, in screen coordinates, of the client area
2725 * or video mode.
2726 * @param[in] height The desired height, in screen coordinates, of the client
2727 * area or video mode.
Camilla Berglund325729d2016-05-22 14:25:04 +02002728 * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
2729 * or `GLFW_DONT_CARE`.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002730 *
2731 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2732 * GLFW_PLATFORM_ERROR.
2733 *
Camilla Berglundec171612016-10-28 06:20:20 +02002734 * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise
2735 * affected by any resizing or mode switching, although you may need to update
2736 * your viewport if the framebuffer size has changed.
2737 *
linkmauvebc8b0482016-10-16 15:52:39 +01002738 * @remark @wayland The desired window position is ignored, as there is no way
2739 * for an application to set this property.
2740 *
2741 * @remark @wayland Setting the window to full screen will not attempt to
2742 * change the mode, no matter what the requested size or refresh rate.
2743 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002744 * @thread_safety This function must only be called from the main thread.
2745 *
2746 * @sa @ref window_monitor
2747 * @sa @ref window_full_screen
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002748 * @sa @ref glfwGetWindowMonitor
2749 * @sa @ref glfwSetWindowSize
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002750 *
2751 * @since Added in version 3.2.
2752 *
2753 * @ingroup window
2754 */
2755GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
2756
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002757/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002758 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002759 * This function returns the value of an attribute of the specified window or
2760 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002761 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002762 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002763 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2764 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002765 * @return The value of the attribute, or zero if an
2766 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002767 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002768 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2769 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2770 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002771 * @remark Framebuffer related hints are not window attributes. See @ref
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002772 * window_attribs_fb for more information.
2773 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002774 * @remark Zero is a valid value for many window and context related
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002775 * attributes so you cannot use a return value of zero as an indication of
2776 * errors. However, this function should not fail as long as it is passed
2777 * valid arguments and the library has been [initialized](@ref intro_init).
2778 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002779 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002780 *
2781 * @sa @ref window_attribs
Camilla Löwy9e560992016-09-30 01:52:22 +02002782 * @sa @ref glfwSetWindowAttrib
Camilla Berglund4591ad22014-09-18 15:03:29 +02002783 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002784 * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
Camilla Berglund4188c262015-01-18 01:55:25 +01002785 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002786 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002787 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002788 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002789GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002790
Camilla Löwy9e560992016-09-30 01:52:22 +02002791/*! @brief Sets an attribute of the specified window.
2792 *
2793 * This function sets the value of an attribute of the specified window.
2794 *
2795 * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
2796 * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
2797 * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) and
2798 * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib).
2799 *
2800 * Some of these attributes are ignored for full screen windows. The new
2801 * value will take effect if the window is later made windowed.
2802 *
2803 * Some of these attributes are ignored for windowed mode windows. The new
2804 * value will take effect if the window is later made full screen.
2805 *
2806 * @param[in] window The window to set the attribute for.
2807 * @param[in] attrib A supported window attribute.
2808 * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
2809 *
2810 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2811 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2812 *
2813 * @remark Calling @ref glfwGetWindowAttrib will always return the latest
2814 * value, even if that value is ignored by the current mode of the window.
2815 *
2816 * @thread_safety This function must only be called from the main thread.
2817 *
2818 * @sa @ref window_attribs
2819 * @sa @ref glfwGetWindowAttrib
2820 *
2821 * @since Added in version 3.3.
2822 *
2823 * @ingroup window
2824 */
2825GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
2826
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002827/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002828 *
2829 * This function sets the user-defined pointer of the specified window. The
2830 * current value is retained until the window is destroyed. The initial value
2831 * is `NULL`.
2832 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002833 * @param[in] window The window whose pointer to set.
2834 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002835 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002836 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2837 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002838 * @thread_safety This function may be called from any thread. Access is not
2839 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002840 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002841 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002842 * @sa @ref glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002843 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002844 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002845 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002846 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002847 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002848GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002849
2850/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002851 *
2852 * This function returns the current value of the user-defined pointer of the
2853 * specified window. The initial value is `NULL`.
2854 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002855 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002856 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002857 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2858 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002859 * @thread_safety This function may be called from any thread. Access is not
2860 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002861 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002862 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002863 * @sa @ref glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002864 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002865 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002866 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002867 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002868 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002869GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002870
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002871/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002872 *
2873 * This function sets the position callback of the specified window, which is
2874 * called when the window is moved. The callback is provided with the screen
2875 * position of the upper-left corner of the client area of the window.
2876 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002877 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002878 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002879 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002880 * @return The previously set callback, or `NULL` if no callback was set or the
2881 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002882 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002883 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2884 *
linkmauvebc8b0482016-10-16 15:52:39 +01002885 * @remark @wayland This callback will never be called, as there is no way for
2886 * an application to know its global position.
2887 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002888 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002889 *
2890 * @sa @ref window_pos
2891 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002892 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002893 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002894 * @ingroup window
2895 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002896GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002897
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002898/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002899 *
2900 * This function sets the size callback of the specified window, which is
2901 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002902 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002903 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002904 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002905 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002906 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002907 * @return The previously set callback, or `NULL` if no callback was set or the
2908 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002909 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002910 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2911 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002912 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002913 *
2914 * @sa @ref window_size
2915 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002916 * @since Added in version 1.0.
2917 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002918 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002919 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002920 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002921GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002922
2923/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002924 *
2925 * This function sets the close callback of the specified window, which is
2926 * called when the user attempts to close the window, for example by clicking
2927 * the close widget in the title bar.
2928 *
2929 * The close flag is set before this callback is called, but you can modify it
2930 * at any time with @ref glfwSetWindowShouldClose.
2931 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002932 * The close callback is not triggered by @ref glfwDestroyWindow.
2933 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002934 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002935 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002936 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002937 * @return The previously set callback, or `NULL` if no callback was set or the
2938 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002939 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002940 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2941 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002942 * @remark @macos Selecting Quit from the application menu will trigger the
2943 * close callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002944 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002945 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002946 *
2947 * @sa @ref window_close
2948 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002949 * @since Added in version 2.5.
2950 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002951 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002952 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002953 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002954GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002955
2956/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002957 *
2958 * This function sets the refresh callback of the specified window, which is
2959 * called when the client area of the window needs to be redrawn, for example
2960 * if the window has been exposed after having been covered by another window.
2961 *
linkmauvebc8b0482016-10-16 15:52:39 +01002962 * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
2963 * the window contents are saved off-screen, this callback may be called only
2964 * very infrequently or never at all.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002965 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002966 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002967 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002968 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002969 * @return The previously set callback, or `NULL` if no callback was set or the
2970 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002971 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002972 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2973 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002974 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002975 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002976 * @sa @ref window_refresh
2977 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002978 * @since Added in version 2.5.
2979 * @glfw3 Added window handle parameter and return value.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002980 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002981 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002982 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002983GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002984
2985/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002986 *
2987 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01002988 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002989 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002990 * After the focus callback is called for a window that lost input focus,
2991 * synthetic key and mouse button release events will be generated for all such
2992 * that had been pressed. For more information, see @ref glfwSetKeyCallback
2993 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02002994 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002995 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002996 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002997 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002998 * @return The previously set callback, or `NULL` if no callback was set or the
2999 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003000 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003001 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3002 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003003 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003004 *
3005 * @sa @ref window_focus
3006 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003007 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003008 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003009 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003010 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003011GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003012
3013/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003014 *
3015 * This function sets the iconification callback of the specified window, which
3016 * is called when the window is iconified or restored.
3017 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003018 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003019 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003020 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003021 * @return The previously set callback, or `NULL` if no callback was set or the
3022 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003023 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003024 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3025 *
linkmauvebc8b0482016-10-16 15:52:39 +01003026 * @remark @wayland The wl_shell protocol has no concept of iconification,
3027 * this callback will never be called.
3028 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003029 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003030 *
3031 * @sa @ref window_iconify
3032 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003033 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003034 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003035 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003036 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003037GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02003038
Camilla Berglundc156b502016-06-16 13:09:28 +02003039/*! @brief Sets the maximize callback for the specified window.
3040 *
3041 * This function sets the maximization callback of the specified window, which
3042 * is called when the window is maximized or restored.
3043 *
3044 * @param[in] window The window whose callback to set.
3045 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3046 * callback.
3047 * @return The previously set callback, or `NULL` if no callback was set or the
3048 * library had not been [initialized](@ref intro_init).
3049 *
3050 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3051 *
3052 * @thread_safety This function must only be called from the main thread.
3053 *
3054 * @sa @ref window_maximize
3055 *
3056 * @since Added in version 3.3.
3057 *
3058 * @ingroup window
3059 */
3060GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun);
3061
Camilla Berglund34981632013-06-03 12:51:57 +02003062/*! @brief Sets the framebuffer resize callback for the specified window.
3063 *
3064 * This function sets the framebuffer resize callback of the specified window,
3065 * which is called when the framebuffer of the specified window is resized.
3066 *
3067 * @param[in] window The window whose callback to set.
3068 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3069 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003070 * @return The previously set callback, or `NULL` if no callback was set or the
3071 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02003072 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003073 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3074 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003075 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003076 *
3077 * @sa @ref window_fbsize
3078 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003079 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003080 *
Camilla Berglund34981632013-06-03 12:51:57 +02003081 * @ingroup window
3082 */
3083GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
3084
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003085/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003086 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003087 * This function processes only those events that are already in the event
3088 * queue and then returns immediately. Processing events will cause the window
3089 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003090 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003091 * On some platforms, a window move, resize or menu operation will cause event
3092 * processing to block. This is due to how event processing is designed on
3093 * those platforms. You can use the
3094 * [window refresh callback](@ref window_refresh) to redraw the contents of
3095 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003096 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003097 * Do not assume that callbacks you set will _only_ be called in response to
3098 * event processing functions like this one. While it is necessary to poll for
3099 * events, window systems that require GLFW to register callbacks of its own
3100 * can pass events to GLFW in response to many window system function calls.
3101 * GLFW will pass those events on to the application callbacks before
3102 * returning.
Camilla Berglund401033c2013-03-12 19:17:07 +01003103 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003104 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003105 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003106 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3107 * GLFW_PLATFORM_ERROR.
3108 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003109 * @reentrancy This function must not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01003110 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003111 * @thread_safety This function must only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02003112 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003113 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003114 * @sa @ref glfwWaitEvents
3115 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003116 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003117 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003118 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003119 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003120 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003121GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003122
Camilla Berglund4591ad22014-09-18 15:03:29 +02003123/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003124 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003125 * This function puts the calling thread to sleep until at least one event is
3126 * available in the event queue. Once one or more events are available,
3127 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
3128 * are processed and the function then returns immediately. Processing events
3129 * will cause the window and input callbacks associated with those events to be
3130 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02003131 *
3132 * Since not all events are associated with callbacks, this function may return
3133 * without a callback having been called even if you are monitoring all
3134 * callbacks.
3135 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003136 * On some platforms, a window move, resize or menu operation will cause event
3137 * processing to block. This is due to how event processing is designed on
3138 * those platforms. You can use the
3139 * [window refresh callback](@ref window_refresh) to redraw the contents of
3140 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003141 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003142 * Do not assume that callbacks you set will _only_ be called in response to
3143 * event processing functions like this one. While it is necessary to poll for
3144 * events, window systems that require GLFW to register callbacks of its own
3145 * can pass events to GLFW in response to many window system function calls.
3146 * GLFW will pass those events on to the application callbacks before
3147 * returning.
Camilla Berglund4188c262015-01-18 01:55:25 +01003148 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003149 * If no windows exist, this function returns immediately. For synchronization
3150 * of threads in applications that do not create windows, use your threading
3151 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01003152 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003153 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003154 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003155 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3156 * GLFW_PLATFORM_ERROR.
3157 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003158 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003159 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003160 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003161 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003162 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003163 * @sa @ref glfwPollEvents
3164 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003165 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003166 * @since Added in version 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003167 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003168 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003169 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003170GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02003171
Camilla Berglund56208952016-02-02 21:11:16 +01003172/*! @brief Waits with timeout until events are queued and processes them.
3173 *
3174 * This function puts the calling thread to sleep until at least one event is
3175 * available in the event queue, or until the specified timeout is reached. If
3176 * one or more events are available, it behaves exactly like @ref
3177 * glfwPollEvents, i.e. the events in the queue are processed and the function
3178 * then returns immediately. Processing events will cause the window and input
3179 * callbacks associated with those events to be called.
3180 *
3181 * The timeout value must be a positive finite number.
3182 *
3183 * Since not all events are associated with callbacks, this function may return
3184 * without a callback having been called even if you are monitoring all
3185 * callbacks.
3186 *
3187 * On some platforms, a window move, resize or menu operation will cause event
3188 * processing to block. This is due to how event processing is designed on
3189 * those platforms. You can use the
3190 * [window refresh callback](@ref window_refresh) to redraw the contents of
3191 * your window when necessary during such operations.
3192 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003193 * Do not assume that callbacks you set will _only_ be called in response to
3194 * event processing functions like this one. While it is necessary to poll for
3195 * events, window systems that require GLFW to register callbacks of its own
3196 * can pass events to GLFW in response to many window system function calls.
3197 * GLFW will pass those events on to the application callbacks before
3198 * returning.
Camilla Berglund56208952016-02-02 21:11:16 +01003199 *
3200 * If no windows exist, this function returns immediately. For synchronization
3201 * of threads in applications that do not create windows, use your threading
3202 * library of choice.
3203 *
3204 * Event processing is not required for joystick input to work.
3205 *
3206 * @param[in] timeout The maximum amount of time, in seconds, to wait.
3207 *
3208 * @reentrancy This function must not be called from a callback.
3209 *
3210 * @thread_safety This function must only be called from the main thread.
3211 *
3212 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003213 * @sa @ref glfwPollEvents
3214 * @sa @ref glfwWaitEvents
Camilla Berglund56208952016-02-02 21:11:16 +01003215 *
3216 * @since Added in version 3.2.
3217 *
3218 * @ingroup window
3219 */
3220GLFWAPI void glfwWaitEventsTimeout(double timeout);
3221
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003222/*! @brief Posts an empty event to the event queue.
3223 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003224 * This function posts an empty event from the current thread to the event
Camilla Berglund73abf8a2016-07-06 13:06:59 +02003225 * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003226 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003227 * If no windows exist, this function returns immediately. For synchronization
3228 * of threads in applications that do not create windows, use your threading
3229 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003230 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003231 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3232 * GLFW_PLATFORM_ERROR.
3233 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003234 * @thread_safety This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003235 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003236 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003237 * @sa @ref glfwWaitEvents
3238 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003239 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003240 * @since Added in version 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003241 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003242 * @ingroup window
3243 */
3244GLFWAPI void glfwPostEmptyEvent(void);
3245
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003246/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003247 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02003248 * This function returns the value of an input option for the specified window.
3249 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
3250 * `GLFW_STICKY_MOUSE_BUTTONS`.
3251 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003252 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02003253 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003254 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003255 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003256 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3257 * GLFW_INVALID_ENUM.
3258 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003259 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003260 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003261 * @sa @ref glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003262 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003263 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003264 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003265 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003266 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003267GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003268
3269/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003270 *
3271 * This function sets an input mode option for the specified window. The mode
3272 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund71d2b572013-03-12 15:33:05 +01003273 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003274 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003275 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003276 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02003277 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
3278 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund4188c262015-01-18 01:55:25 +01003279 * area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01003280 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
3281 * and unlimited cursor movement. This is useful for implementing for
3282 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003283 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02003284 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
3285 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02003286 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
3287 * the next time it is called even if the key had been released before the
3288 * call. This is useful when you are only interested in whether keys have been
3289 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003290 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003291 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02003292 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
3293 * If sticky mouse buttons are enabled, a mouse button press will ensure that
3294 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
3295 * if the mouse button had been released before the call. This is useful when
3296 * you are only interested in whether mouse buttons have been pressed but not
3297 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003298 *
3299 * @param[in] window The window whose input mode to set.
3300 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
3301 * `GLFW_STICKY_MOUSE_BUTTONS`.
3302 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003303 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003304 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3305 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3306 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003307 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003308 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003309 * @sa @ref glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01003310 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003311 * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003312 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003313 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003314 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003315GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003316
Camilla Berglund9c315412015-07-02 14:24:50 +02003317/*! @brief Returns the localized name of the specified printable key.
3318 *
3319 * This function returns the localized name of the specified printable key.
Camilla Berglund70ffae72016-02-22 11:54:56 +01003320 * This is intended for displaying key bindings to the user.
Camilla Berglund9c315412015-07-02 14:24:50 +02003321 *
Camilla Berglund70ffae72016-02-22 11:54:56 +01003322 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used instead, otherwise
3323 * the scancode is ignored. If a non-printable key or (if the key is
3324 * `GLFW_KEY_UNKNOWN`) a scancode that maps to a non-printable key is
3325 * specified, this function returns `NULL`.
3326 *
3327 * This behavior allows you to pass in the arguments passed to the
3328 * [key callback](@ref input_key) without modification.
3329 *
3330 * The printable keys are:
3331 * - `GLFW_KEY_APOSTROPHE`
3332 * - `GLFW_KEY_COMMA`
3333 * - `GLFW_KEY_MINUS`
3334 * - `GLFW_KEY_PERIOD`
3335 * - `GLFW_KEY_SLASH`
3336 * - `GLFW_KEY_SEMICOLON`
3337 * - `GLFW_KEY_EQUAL`
3338 * - `GLFW_KEY_LEFT_BRACKET`
3339 * - `GLFW_KEY_RIGHT_BRACKET`
3340 * - `GLFW_KEY_BACKSLASH`
3341 * - `GLFW_KEY_WORLD_1`
3342 * - `GLFW_KEY_WORLD_2`
3343 * - `GLFW_KEY_0` to `GLFW_KEY_9`
3344 * - `GLFW_KEY_A` to `GLFW_KEY_Z`
3345 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
3346 * - `GLFW_KEY_KP_DECIMAL`
3347 * - `GLFW_KEY_KP_DIVIDE`
3348 * - `GLFW_KEY_KP_MULTIPLY`
3349 * - `GLFW_KEY_KP_SUBTRACT`
3350 * - `GLFW_KEY_KP_ADD`
3351 * - `GLFW_KEY_KP_EQUAL`
Camilla Berglund9c315412015-07-02 14:24:50 +02003352 *
3353 * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
3354 * @param[in] scancode The scancode of the key to query.
Camilla Berglund70ffae72016-02-22 11:54:56 +01003355 * @return The localized name of the key, or `NULL`.
Camilla Berglund9c315412015-07-02 14:24:50 +02003356 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003357 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3358 * GLFW_PLATFORM_ERROR.
3359 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003360 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3361 * should not free it yourself. It is valid until the next call to @ref
3362 * glfwGetKeyName, or until the library is terminated.
Camilla Berglund9c315412015-07-02 14:24:50 +02003363 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003364 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9c315412015-07-02 14:24:50 +02003365 *
3366 * @sa @ref input_key_name
3367 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003368 * @since Added in version 3.2.
Camilla Berglund9c315412015-07-02 14:24:50 +02003369 *
3370 * @ingroup input
3371 */
3372GLFWAPI const char* glfwGetKeyName(int key, int scancode);
3373
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003374/*! @brief Returns the platform-specific scancode of the specified key.
Michael Stockere745b0d2016-08-11 19:11:40 +02003375 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003376 * This function returns the platform-specific scancode of the specified key.
Michael Stockere745b0d2016-08-11 19:11:40 +02003377 *
3378 * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
3379 * method will return `-1`.
3380 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003381 * @param[in] key Any [named key](@ref keys).
3382 * @return The platform-specific scancode for the key, or `-1` if an
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003383 * [error](@ref error_handling) occurred.
Michael Stockere745b0d2016-08-11 19:11:40 +02003384 *
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003385 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3386 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
Michael Stockere745b0d2016-08-11 19:11:40 +02003387 *
3388 * @thread_safety This function may be called from any thread.
3389 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003390 * @sa @ref input_key
Michael Stockere745b0d2016-08-11 19:11:40 +02003391 *
3392 * @since Added in version 3.3.
3393 *
3394 * @ingroup input
3395 */
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003396GLFWAPI int glfwGetKeyScancode(int key);
Michael Stockere745b0d2016-08-11 19:11:40 +02003397
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003398/*! @brief Returns the last reported state of a keyboard key for the specified
3399 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003400 *
3401 * This function returns the last state reported for the specified key to the
3402 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02003403 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003404 * the key callback.
3405 *
3406 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02003407 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
3408 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003409 *
3410 * The key functions deal with physical keys, with [key tokens](@ref keys)
3411 * named after their use on the standard US keyboard layout. If you want to
3412 * input text, use the Unicode character callback instead.
3413 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003414 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
3415 * used with this function.
3416 *
Camilla Berglund9c315412015-07-02 14:24:50 +02003417 * __Do not use this function__ to implement [text input](@ref input_char).
3418 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003419 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003420 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
3421 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003422 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003423 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003424 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3425 * GLFW_INVALID_ENUM.
3426 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003427 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003428 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003429 * @sa @ref input_key
3430 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003431 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003432 * @glfw3 Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003433 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003434 * @ingroup input
3435 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003436GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003437
3438/*! @brief Returns the last reported state of a mouse button for the specified
3439 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003440 *
3441 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003442 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003443 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003444 *
3445 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02003446 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
3447 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003448 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003449 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003450 * @param[in] button The desired [mouse button](@ref buttons).
3451 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003452 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003453 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3454 * GLFW_INVALID_ENUM.
3455 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003456 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003457 *
3458 * @sa @ref input_mouse_button
3459 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003460 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003461 * @glfw3 Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01003462 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003463 * @ingroup input
3464 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003465GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003466
Camilla Berglundd4591452014-02-11 18:24:01 +01003467/*! @brief Retrieves the position of the cursor relative to the client area of
3468 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003469 *
Camilla Berglundd4591452014-02-11 18:24:01 +01003470 * This function returns the position of the cursor, in screen coordinates,
3471 * relative to the upper-left corner of the client area of the specified
3472 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003473 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02003474 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
3475 * position is unbounded and limited only by the minimum and maximum values of
3476 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003477 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02003478 * The coordinate can be converted to their integer equivalents with the
3479 * `floor` function. Casting directly to an integer type works for positive
3480 * coordinates, but fails for negative ones.
3481 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003482 * Any or all of the position arguments may be `NULL`. If an error occurs, all
3483 * non-`NULL` position arguments will be set to zero.
3484 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003485 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003486 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
3487 * left edge of the client area, or `NULL`.
3488 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
3489 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003490 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003491 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3492 * GLFW_PLATFORM_ERROR.
3493 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003494 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003495 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003496 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003497 * @sa @ref glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003498 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003499 * @since Added in version 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003500 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003501 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003502 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003503GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003504
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003505/*! @brief Sets the position of the cursor, relative to the client area of the
3506 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003507 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003508 * This function sets the position, in screen coordinates, of the cursor
3509 * relative to the upper-left corner of the client area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01003510 * window. The window must have input focus. If the window does not have
3511 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003512 *
Camilla Berglund20858762015-01-01 18:41:22 +01003513 * __Do not use this function__ to implement things like camera controls. GLFW
3514 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
3515 * cursor, transparently re-centers it and provides unconstrained cursor
3516 * motion. See @ref glfwSetInputMode for more information.
3517 *
3518 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
3519 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02003520 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003521 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003522 * @param[in] window The desired window.
3523 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003524 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003525 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003526 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003527 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003528 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3529 * GLFW_PLATFORM_ERROR.
3530 *
linkmauvebc8b0482016-10-16 15:52:39 +01003531 * @remark @wayland This function will only work when the cursor mode is
3532 * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
3533 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003534 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003535 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003536 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003537 * @sa @ref glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003538 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003539 * @since Added in version 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003540 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003541 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003542 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003543GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003544
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003545/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03003546 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003547 * Creates a new custom cursor image that can be set for a window with @ref
3548 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
3549 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003550 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02003551 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
3552 * bits per channel. They are arranged canonically as packed sequential rows,
3553 * starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01003554 *
3555 * The cursor hotspot is specified in pixels, relative to the upper-left corner
3556 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
3557 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003558 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003559 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01003560 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
3561 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
Camilla Berglund4188c262015-01-18 01:55:25 +01003562 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02003563 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03003564 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003565 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3566 * GLFW_PLATFORM_ERROR.
3567 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003568 * @pointer_lifetime The specified image data is copied before this function
3569 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003570 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003571 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003572 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003573 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003574 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003575 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003576 * @sa @ref glfwDestroyCursor
3577 * @sa @ref glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003578 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003579 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003580 *
3581 * @ingroup input
3582 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003583GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03003584
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003585/*! @brief Creates a cursor with a standard shape.
3586 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003587 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
3588 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003589 *
3590 * @param[in] shape One of the [standard shapes](@ref shapes).
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003591 * @return A new cursor ready to use or `NULL` if an
3592 * [error](@ref error_handling) occurred.
3593 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003594 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3595 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3596 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003597 * @reentrancy This function must not be called from a callback.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003598 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003599 * @thread_safety This function must only be called from the main thread.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003600 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003601 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003602 * @sa @ref glfwCreateCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003603 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003604 * @since Added in version 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003605 *
3606 * @ingroup input
3607 */
3608GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
3609
urraka40c04a72013-12-04 10:19:22 -03003610/*! @brief Destroys a cursor.
3611 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003612 * This function destroys a cursor previously created with @ref
3613 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
3614 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03003615 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003616 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03003617 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003618 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3619 * GLFW_PLATFORM_ERROR.
3620 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003621 * @reentrancy This function must not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003622 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003623 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003624 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003625 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003626 * @sa @ref glfwCreateCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003627 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003628 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003629 *
3630 * @ingroup input
3631 */
3632GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
3633
Camilla Berglund4188c262015-01-18 01:55:25 +01003634/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03003635 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003636 * This function sets the cursor image to be used when the cursor is over the
3637 * client area of the specified window. The set cursor will only be visible
3638 * when the [cursor mode](@ref cursor_mode) of the window is
3639 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003640 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003641 * On some platforms, the set cursor may not be visible unless the window also
3642 * has input focus.
3643 *
3644 * @param[in] window The window to set the cursor for.
3645 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
3646 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03003647 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003648 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3649 * GLFW_PLATFORM_ERROR.
3650 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003651 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003652 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003653 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003654 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003655 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003656 *
urraka40c04a72013-12-04 10:19:22 -03003657 * @ingroup input
3658 */
3659GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
3660
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003661/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003662 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003663 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003664 * when a key is pressed, repeated or released.
3665 *
Camilla Berglund948cc042013-04-16 02:02:22 +02003666 * The key functions deal with physical keys, with layout independent
3667 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003668 * layout. If you want to input text, use the
3669 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003670 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003671 * When a window loses input focus, it will generate synthetic key release
3672 * events for all pressed keys. You can tell these events from user-generated
3673 * events by the fact that the synthetic ones are generated after the focus
3674 * loss event has been processed, i.e. after the
3675 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003676 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02003677 * The scancode of a key is specific to that platform or sometimes even to that
3678 * machine. Scancodes are intended to allow users to bind keys that don't have
3679 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02003680 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003681 *
3682 * Sometimes GLFW needs to generate synthetic key events, in which case the
3683 * scancode may be zero.
3684 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003685 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003686 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003687 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003688 * @return The previously set callback, or `NULL` if no callback was set or the
3689 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003690 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003691 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3692 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003693 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003694 *
3695 * @sa @ref input_key
3696 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003697 * @since Added in version 1.0.
3698 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003699 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003700 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003701 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003702GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003703
3704/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003705 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003706 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003707 * called when a Unicode character is input.
3708 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003709 * The character callback is intended for Unicode text input. As it deals with
3710 * characters, it is keyboard layout dependent, whereas the
3711 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
3712 * to physical keys, as a key may produce zero, one or more characters. If you
3713 * want to know whether a specific physical key was pressed or released, see
3714 * the key callback instead.
3715 *
3716 * The character callback behaves as system text input normally does and will
3717 * not be called if modifier keys are held down that would prevent normal text
Camilla Berglund8d6f2652016-10-20 00:50:54 +02003718 * input on that platform, for example a Super (Command) key on macOS or Alt key
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003719 * on Windows. There is a
3720 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
3721 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003722 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003723 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003724 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003725 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003726 * @return The previously set callback, or `NULL` if no callback was set or the
3727 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003728 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003729 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3730 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003731 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003732 *
3733 * @sa @ref input_char
3734 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003735 * @since Added in version 2.4.
3736 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003737 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003738 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003739 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003740GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003741
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003742/*! @brief Sets the Unicode character with modifiers callback.
3743 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003744 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003745 * window, which is called when a Unicode character is input regardless of what
3746 * modifier keys are used.
3747 *
3748 * The character with modifiers callback is intended for implementing custom
3749 * Unicode character input. For regular Unicode text input, see the
3750 * [character callback](@ref glfwSetCharCallback). Like the character
3751 * callback, the character with modifiers callback deals with characters and is
3752 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
3753 * a key may produce zero, one or more characters. If you want to know whether
3754 * a specific physical key was pressed or released, see the
3755 * [key callback](@ref glfwSetKeyCallback) instead.
3756 *
3757 * @param[in] window The window whose callback to set.
3758 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3759 * callback.
3760 * @return The previously set callback, or `NULL` if no callback was set or an
Camilla Berglund999f3552016-08-17 16:48:22 +02003761 * [error](@ref error_handling) occurred.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003762 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003763 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3764 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003765 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003766 *
3767 * @sa @ref input_char
3768 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003769 * @since Added in version 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003770 *
3771 * @ingroup input
3772 */
3773GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
3774
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003775/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003776 *
3777 * This function sets the mouse button callback of the specified window, which
3778 * is called when a mouse button is pressed or released.
3779 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003780 * When a window loses input focus, it will generate synthetic mouse button
3781 * release events for all pressed mouse buttons. You can tell these events
3782 * from user-generated events by the fact that the synthetic ones are generated
3783 * after the focus loss event has been processed, i.e. after the
3784 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003785 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003786 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003787 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003788 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003789 * @return The previously set callback, or `NULL` if no callback was set or the
3790 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003791 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003792 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3793 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003794 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003795 *
3796 * @sa @ref input_mouse_button
3797 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003798 * @since Added in version 1.0.
3799 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003800 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003801 * @ingroup input
3802 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003803GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003804
3805/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003806 *
3807 * This function sets the cursor position callback of the specified window,
3808 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003809 * position, in screen coordinates, relative to the upper-left corner of the
3810 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003811 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003812 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003813 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003814 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003815 * @return The previously set callback, or `NULL` if no callback was set or the
3816 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003817 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003818 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3819 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003820 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003821 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003822 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02003823 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003824 * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003825 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003826 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003827 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003828GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003829
3830/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003831 *
3832 * This function sets the cursor boundary crossing callback of the specified
3833 * window, which is called when the cursor enters or leaves the client area of
3834 * the window.
3835 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003836 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003837 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003838 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003839 * @return The previously set callback, or `NULL` if no callback was set or the
3840 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003841 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003842 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3843 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003844 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003845 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003846 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02003847 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003848 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003849 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003850 * @ingroup input
3851 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003852GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003853
3854/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003855 *
3856 * This function sets the scroll callback of the specified window, which is
3857 * called when a scrolling device is used, such as a mouse wheel or scrolling
3858 * area of a touchpad.
3859 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003860 * The scroll callback receives all scrolling input, like that from a mouse
3861 * wheel or a touchpad scrolling area.
3862 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003863 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003864 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003865 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003866 * @return The previously set callback, or `NULL` if no callback was set or the
3867 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003868 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003869 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3870 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003871 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003872 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003873 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02003874 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003875 * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003876 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003877 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003878 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003879GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02003880
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003881/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02003882 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003883 * This function sets the file drop callback of the specified window, which is
3884 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02003885 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003886 * Because the path array and its strings may have been generated specifically
3887 * for that event, they are not guaranteed to be valid after the callback has
3888 * returned. If you wish to use them after the callback returns, you need to
3889 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02003890 *
3891 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003892 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
3893 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003894 * @return The previously set callback, or `NULL` if no callback was set or the
3895 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02003896 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003897 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3898 *
linkmauvebc8b0482016-10-16 15:52:39 +01003899 * @remark @wayland File drop is currently unimplemented.
3900 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003901 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003902 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003903 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02003904 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003905 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003906 *
arturo89d07232013-07-10 11:42:14 +02003907 * @ingroup input
3908 */
3909GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
3910
Camilla Berglundfdd45182013-05-27 15:13:09 +02003911/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003912 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02003913 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003914 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02003915 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003916 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003917 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003918 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3919 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3920 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003921 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003922 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003923 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02003924 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003925 * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003926 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003927 * @ingroup input
3928 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02003929GLFWAPI int glfwJoystickPresent(int jid);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003930
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003931/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003932 *
3933 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003934 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003935 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003936 * Querying a joystick slot with no device present is not an error, but will
3937 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3938 * check device presence.
3939 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02003940 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003941 * @param[out] count Where to store the number of axis values in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02003942 * array. This is set to zero if the joystick is not present or an error
3943 * occurred.
3944 * @return An array of axis values, or `NULL` if the joystick is not present or
3945 * an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003946 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003947 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3948 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3949 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003950 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3951 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01003952 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003953 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003954 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003955 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003956 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02003957 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003958 * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003959 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003960 * @ingroup input
3961 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02003962GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003963
Camilla Berglunde93bade2013-06-16 02:33:33 +02003964/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003965 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02003966 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003967 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003968 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003969 * Querying a joystick slot with no device present is not an error, but will
3970 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3971 * check device presence.
3972 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02003973 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003974 * @param[out] count Where to store the number of button states in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02003975 * array. This is set to zero if the joystick is not present or an error
3976 * occurred.
3977 * @return An array of button states, or `NULL` if the joystick is not present
3978 * or an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003979 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003980 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3981 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3982 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003983 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3984 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01003985 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003986 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003987 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003988 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003989 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003990 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003991 * @since Added in version 2.2.
Camilla Berglund951a9582016-01-31 21:32:14 +01003992 * @glfw3 Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003993 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003994 * @ingroup input
3995 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02003996GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02003997
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003998/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003999 *
4000 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004001 * The returned string is allocated and freed by GLFW. You should not free it
4002 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004003 *
Camilla Berglund386b6032016-02-10 13:48:49 +01004004 * Querying a joystick slot with no device present is not an error, but will
4005 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
4006 * check device presence.
4007 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004008 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004009 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund999f3552016-08-17 16:48:22 +02004010 * is not present or an [error](@ref error_handling) occurred.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01004011 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004012 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4013 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4014 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004015 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4016 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004017 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004018 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004019 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004020 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004021 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02004022 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004023 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004024 *
4025 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01004026 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004027GLFWAPI const char* glfwGetJoystickName(int jid);
Camilla Berglund3249f812010-09-07 17:34:51 +02004028
Camilla Berglund8a7fa302015-12-13 17:38:50 +01004029/*! @brief Sets the joystick configuration callback.
4030 *
4031 * This function sets the joystick configuration callback, or removes the
4032 * currently set callback. This is called when a joystick is connected to or
4033 * disconnected from the system.
4034 *
Camilla Löwya46c95c2017-02-01 04:55:46 +01004035 * For joystick connection and disconnection events to be delivered on all
4036 * platforms, you need to call one of the [event processing](@ref events)
4037 * functions. Joystick disconnection may also be detected and the callback
4038 * called by joystick functions. The function will then return whatever it
4039 * returns for a disconnected joystick.
4040 *
Camilla Berglund8a7fa302015-12-13 17:38:50 +01004041 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
4042 * callback.
4043 * @return The previously set callback, or `NULL` if no callback was set or the
4044 * library had not been [initialized](@ref intro_init).
4045 *
4046 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4047 *
4048 * @thread_safety This function must only be called from the main thread.
4049 *
4050 * @sa @ref joystick_event
4051 *
4052 * @since Added in version 3.2.
4053 *
4054 * @ingroup input
4055 */
4056GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
4057
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004058/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004059 *
4060 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02004061 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004062 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004063 * @param[in] window The window that will own the clipboard contents.
4064 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004065 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004066 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4067 * GLFW_PLATFORM_ERROR.
4068 *
linkmauvebc8b0482016-10-16 15:52:39 +01004069 * @remark @wayland Clipboard is currently unimplemented.
4070 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004071 * @pointer_lifetime The specified string is copied before this function
4072 * returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01004073 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004074 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004075 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004076 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004077 * @sa @ref glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004078 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004079 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004080 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02004081 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004082 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004083GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004084
Camilla Berglund4591ad22014-09-18 15:03:29 +02004085/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004086 *
4087 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02004088 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02004089 * if its contents cannot be converted, `NULL` is returned and a @ref
4090 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004091 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004092 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004093 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02004094 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004095 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004096 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4097 * GLFW_PLATFORM_ERROR.
4098 *
linkmauvebc8b0482016-10-16 15:52:39 +01004099 * @remark @wayland Clipboard is currently unimplemented.
4100 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004101 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4102 * should not free it yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02004103 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
4104 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004105 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004106 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004107 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004108 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004109 * @sa @ref glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004110 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004111 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004112 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02004113 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004114 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004115GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01004116
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004117/*! @brief Returns the value of the GLFW timer.
4118 *
4119 * This function returns the value of the GLFW timer. Unless the timer has
4120 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
4121 * was initialized.
4122 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004123 * The resolution of the timer is system dependent, but is usually on the order
4124 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
4125 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004126 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004127 * @return The current value, in seconds, or zero if an
4128 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004129 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004130 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4131 *
Camilla Berglund20bce152016-05-30 16:04:37 +02004132 * @thread_safety This function may be called from any thread. Reading and
4133 * writing of the internal timer offset is not atomic, so it needs to be
4134 * externally synchronized with calls to @ref glfwSetTime.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004135 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004136 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02004137 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004138 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004139 *
4140 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004141 */
Camilla Berglund9a716692010-09-08 16:40:43 +02004142GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02004143
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004144/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004145 *
4146 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01004147 * up from that value. The value must be a positive finite number less than
4148 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004149 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004150 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004151 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004152 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4153 * GLFW_INVALID_VALUE.
4154 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004155 * @remark The upper limit of the timer is calculated as
Camilla Berglund6e20cda2015-03-10 12:01:38 +01004156 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
4157 * storing nanoseconds in 64 bits. The limit may be increased in the future.
4158 *
Camilla Berglund20bce152016-05-30 16:04:37 +02004159 * @thread_safety This function may be called from any thread. Reading and
4160 * writing of the internal timer offset is not atomic, so it needs to be
4161 * externally synchronized with calls to @ref glfwGetTime.
Camilla Berglund0e205772014-03-24 11:58:35 +01004162 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004163 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01004164 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004165 * @since Added in version 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004166 *
4167 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004168 */
4169GLFWAPI void glfwSetTime(double time);
4170
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004171/*! @brief Returns the current value of the raw timer.
4172 *
Camilla Berglund337c77a2016-03-06 14:11:14 +01004173 * This function returns the current value of the raw timer, measured in
4174 * 1&nbsp;/&nbsp;frequency seconds. To get the frequency, call @ref
4175 * glfwGetTimerFrequency.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004176 *
4177 * @return The value of the timer, or zero if an
4178 * [error](@ref error_handling) occurred.
4179 *
Camilla Berglund46fce402016-03-07 13:35:37 +01004180 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004181 *
4182 * @thread_safety This function may be called from any thread.
4183 *
4184 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004185 * @sa @ref glfwGetTimerFrequency
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004186 *
4187 * @since Added in version 3.2.
4188 *
4189 * @ingroup input
4190 */
Camilla Berglund5661d032016-03-23 10:09:07 +01004191GLFWAPI uint64_t glfwGetTimerValue(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004192
4193/*! @brief Returns the frequency, in Hz, of the raw timer.
4194 *
Camilla Berglunddefaea32016-03-07 13:36:54 +01004195 * This function returns the frequency, in Hz, of the raw timer.
4196 *
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004197 * @return The frequency of the timer, in Hz, or zero if an
4198 * [error](@ref error_handling) occurred.
4199 *
Camilla Berglund46fce402016-03-07 13:35:37 +01004200 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004201 *
4202 * @thread_safety This function may be called from any thread.
4203 *
4204 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004205 * @sa @ref glfwGetTimerValue
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004206 *
4207 * @since Added in version 3.2.
4208 *
4209 * @ingroup input
4210 */
Camilla Berglund5661d032016-03-23 10:09:07 +01004211GLFWAPI uint64_t glfwGetTimerFrequency(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004212
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004213/*! @brief Makes the context of the specified window current for the calling
4214 * thread.
4215 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004216 * This function makes the OpenGL or OpenGL ES context of the specified window
4217 * current on the calling thread. A context can only be made current on
4218 * a single thread at a time and each thread can have only a single current
4219 * context at a time.
4220 *
4221 * By default, making a context non-current implicitly forces a pipeline flush.
4222 * On machines that support `GL_KHR_context_flush_control`, you can control
4223 * whether a context performs this flush by setting the
Camilla Löwyce161c22016-12-06 01:14:23 +01004224 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)
4225 * hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004226 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01004227 * The specified window must have an OpenGL or OpenGL ES context. Specifying
4228 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
4229 * error.
4230 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01004231 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004232 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004233 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004234 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4235 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4236 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004237 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004238 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004239 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004240 * @sa @ref glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01004241 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004242 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004243 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004244 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004245 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004246GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004247
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004248/*! @brief Returns the window whose context is current on the calling thread.
4249 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004250 * This function returns the window whose OpenGL or OpenGL ES context is
4251 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004252 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01004253 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004254 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004255 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004256 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4257 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004258 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004259 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004260 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004261 * @sa @ref glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01004262 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004263 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004264 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004265 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004266 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004267GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004268
4269/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004270 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004271 * This function swaps the front and back buffers of the specified window when
4272 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
4273 * zero, the GPU driver waits the specified number of screen updates before
4274 * swapping the buffers.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004275 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01004276 * The specified window must have an OpenGL or OpenGL ES context. Specifying
4277 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
4278 * error.
4279 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004280 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4281 * see `vkQueuePresentKHR` instead.
4282 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004283 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004284 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004285 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4286 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4287 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004288 * @remark __EGL:__ The context of the specified window must be current on the
Camilla Berglund276b1bc2016-01-31 19:17:18 +01004289 * calling thread.
4290 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004291 * @thread_safety This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01004292 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004293 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004294 * @sa @ref glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01004295 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004296 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01004297 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004298 *
4299 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004300 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004301GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004302
4303/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004304 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004305 * This function sets the swap interval for the current OpenGL or OpenGL ES
4306 * context, i.e. the number of screen updates to wait from the time @ref
4307 * glfwSwapBuffers was called before swapping the buffers and returning. This
4308 * is sometimes called _vertical synchronization_, _vertical retrace
4309 * synchronization_ or just _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004310 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004311 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02004312 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
4313 * which allow the driver to swap even if a frame arrives a little bit late.
4314 * You can check for the presence of these extensions using @ref
4315 * glfwExtensionSupported. For more information about swap tearing, see the
4316 * extension specifications.
4317 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004318 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004319 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004320 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004321 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4322 * see the present mode of your swapchain instead.
4323 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004324 * @param[in] interval The minimum number of screen updates to wait for
4325 * until the buffers are swapped by @ref glfwSwapBuffers.
4326 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004327 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4328 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4329 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004330 * @remark This function is not called during context creation, leaving the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004331 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02004332 * because some swap interval extensions used by GLFW do not allow the swap
4333 * interval to be reset to zero once it has been set to a non-zero value.
4334 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004335 * @remark Some GPU drivers do not honor the requested swap interval, either
Camilla Berglund11c22d62015-02-19 15:33:51 +01004336 * because of a user setting that overrides the application's request or due to
4337 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02004338 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004339 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004340 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004341 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004342 * @sa @ref glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01004343 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004344 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004345 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004346 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004347 */
4348GLFWAPI void glfwSwapInterval(int interval);
4349
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004350/*! @brief Returns whether the specified extension is available.
4351 *
Camilla Berglund608109c2013-04-11 20:18:46 +02004352 * This function returns whether the specified
Camilla Berglund001c50c2016-02-19 09:13:56 +01004353 * [API extension](@ref context_glext) is supported by the current OpenGL or
4354 * OpenGL ES context. It searches both for client API extension and context
4355 * creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004356 *
4357 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004358 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004359 *
4360 * As this functions retrieves and searches one or more extension strings each
4361 * call, it is recommended that you cache its results if it is going to be used
4362 * frequently. The extension strings will not change during the lifetime of
4363 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004364 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004365 * This function does not apply to Vulkan. If you are using Vulkan, see @ref
4366 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
4367 * and `vkEnumerateDeviceExtensionProperties` instead.
4368 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004369 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02004370 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
4371 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004372 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004373 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4374 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
4375 * GLFW_PLATFORM_ERROR.
4376 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004377 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004378 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004379 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004380 * @sa @ref glfwGetProcAddress
Camilla Berglund4591ad22014-09-18 15:03:29 +02004381 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004382 * @since Added in version 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01004383 *
4384 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004385 */
4386GLFWAPI int glfwExtensionSupported(const char* extension);
4387
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004388/*! @brief Returns the address of the specified function for the current
4389 * context.
4390 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004391 * This function returns the address of the specified OpenGL or OpenGL ES
Camilla Berglund11c22d62015-02-19 15:33:51 +01004392 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02004393 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004394 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004395 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004396 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004397 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004398 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4399 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
4400 * `vkGetDeviceProcAddr` instead.
4401 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004402 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglunda36e3a22015-11-05 17:14:26 +01004403 * @return The address of the function, or `NULL` if an
4404 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004405 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004406 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4407 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4408 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004409 * @remark The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02004410 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004411 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004412 * @remark This function may return a non-`NULL` address despite the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004413 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02004414 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01004415 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004416 * @pointer_lifetime The returned function pointer is valid until the context
4417 * is destroyed or the library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004418 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004419 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004420 *
4421 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004422 * @sa @ref glfwExtensionSupported
Camilla Berglund4591ad22014-09-18 15:03:29 +02004423 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004424 * @since Added in version 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004425 *
4426 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004427 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02004428GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02004429
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004430/*! @brief Returns whether the Vulkan loader has been found.
4431 *
4432 * This function returns whether the Vulkan loader has been found. This check
4433 * is performed by @ref glfwInit.
4434 *
4435 * The availability of a Vulkan loader does not by itself guarantee that window
4436 * surface creation or even device creation is possible. Call @ref
4437 * glfwGetRequiredInstanceExtensions to check whether the extensions necessary
4438 * for Vulkan surface creation are available and @ref
4439 * glfwGetPhysicalDevicePresentationSupport to check whether a queue family of
4440 * a physical device supports image presentation.
4441 *
4442 * @return `GLFW_TRUE` if Vulkan is available, or `GLFW_FALSE` otherwise.
4443 *
4444 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4445 *
4446 * @thread_safety This function may be called from any thread.
4447 *
4448 * @sa @ref vulkan_support
4449 *
4450 * @since Added in version 3.2.
4451 *
4452 * @ingroup vulkan
4453 */
4454GLFWAPI int glfwVulkanSupported(void);
4455
4456/*! @brief Returns the Vulkan instance extensions required by GLFW.
4457 *
4458 * This function returns an array of names of Vulkan instance extensions required
4459 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
4460 * list will always contains `VK_KHR_surface`, so if you don't require any
4461 * additional extensions you can pass this list directly to the
4462 * `VkInstanceCreateInfo` struct.
4463 *
4464 * If Vulkan is not available on the machine, this function returns `NULL` and
4465 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4466 * to check whether Vulkan is available.
4467 *
4468 * If Vulkan is available but no set of extensions allowing window surface
4469 * creation was found, this function returns `NULL`. You may still use Vulkan
4470 * for off-screen rendering and compute work.
4471 *
4472 * @param[out] count Where to store the number of extensions in the returned
4473 * array. This is set to zero if an error occurred.
4474 * @return An array of ASCII encoded extension names, or `NULL` if an
4475 * [error](@ref error_handling) occurred.
4476 *
4477 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4478 * GLFW_API_UNAVAILABLE.
4479 *
Camilla Berglund67931bd2016-10-26 16:58:56 +02004480 * @remark Additional extensions may be required by future versions of GLFW.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004481 * You should check if any extensions you wish to enable are already in the
4482 * returned array, as it is an error to specify an extension more than once in
4483 * the `VkInstanceCreateInfo` struct.
4484 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004485 * @remark @macos This function currently only supports the
4486 * `VK_MVK_macos_surface` extension from MoltenVK.
4487 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004488 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4489 * should not free it yourself. It is guaranteed to be valid only until the
4490 * library is terminated.
4491 *
4492 * @thread_safety This function may be called from any thread.
4493 *
4494 * @sa @ref vulkan_ext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004495 * @sa @ref glfwCreateWindowSurface
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004496 *
4497 * @since Added in version 3.2.
4498 *
4499 * @ingroup vulkan
4500 */
Camilla Berglund7ab7d8b2016-03-23 10:24:01 +01004501GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004502
4503#if defined(VK_VERSION_1_0)
4504
4505/*! @brief Returns the address of the specified Vulkan instance function.
4506 *
4507 * This function returns the address of the specified Vulkan core or extension
4508 * function for the specified instance. If instance is set to `NULL` it can
4509 * return any function exported from the Vulkan loader, including at least the
4510 * following functions:
4511 *
4512 * - `vkEnumerateInstanceExtensionProperties`
4513 * - `vkEnumerateInstanceLayerProperties`
4514 * - `vkCreateInstance`
4515 * - `vkGetInstanceProcAddr`
4516 *
4517 * If Vulkan is not available on the machine, this function returns `NULL` and
4518 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4519 * to check whether Vulkan is available.
4520 *
4521 * This function is equivalent to calling `vkGetInstanceProcAddr` with
4522 * a platform-specific query of the Vulkan loader as a fallback.
4523 *
4524 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
4525 * functions related to instance creation.
4526 * @param[in] procname The ASCII encoded name of the function.
4527 * @return The address of the function, or `NULL` if an
4528 * [error](@ref error_handling) occurred.
4529 *
4530 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4531 * GLFW_API_UNAVAILABLE.
4532 *
4533 * @pointer_lifetime The returned function pointer is valid until the library
4534 * is terminated.
4535 *
4536 * @thread_safety This function may be called from any thread.
4537 *
4538 * @sa @ref vulkan_proc
4539 *
4540 * @since Added in version 3.2.
4541 *
4542 * @ingroup vulkan
4543 */
4544GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
4545
4546/*! @brief Returns whether the specified queue family can present images.
4547 *
4548 * This function returns whether the specified queue family of the specified
4549 * physical device supports presentation to the platform GLFW was built for.
4550 *
4551 * If Vulkan or the required window surface creation instance extensions are
4552 * not available on the machine, or if the specified instance was not created
4553 * with the required extensions, this function returns `GLFW_FALSE` and
4554 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4555 * to check whether Vulkan is available and @ref
4556 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4557 * required.
4558 *
4559 * @param[in] instance The instance that the physical device belongs to.
4560 * @param[in] device The physical device that the queue family belongs to.
4561 * @param[in] queuefamily The index of the queue family to query.
4562 * @return `GLFW_TRUE` if the queue family supports presentation, or
4563 * `GLFW_FALSE` otherwise.
4564 *
4565 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4566 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4567 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004568 * @remark @macos This function currently always returns `GLFW_TRUE`, as the
4569 * `VK_MVK_macos_surface` extension does not provide
4570 * a `vkGetPhysicalDevice*PresentationSupport` type function.
4571 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004572 * @thread_safety This function may be called from any thread. For
4573 * synchronization details of Vulkan objects, see the Vulkan specification.
4574 *
4575 * @sa @ref vulkan_present
4576 *
4577 * @since Added in version 3.2.
4578 *
4579 * @ingroup vulkan
4580 */
4581GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
4582
4583/*! @brief Creates a Vulkan surface for the specified window.
4584 *
4585 * This function creates a Vulkan surface for the specified window.
4586 *
4587 * If the Vulkan loader was not found at initialization, this function returns
4588 * `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref GLFW_API_UNAVAILABLE
4589 * error. Call @ref glfwVulkanSupported to check whether the Vulkan loader was
4590 * found.
4591 *
4592 * If the required window surface creation instance extensions are not
4593 * available or if the specified instance was not created with these extensions
4594 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
4595 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
4596 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4597 * required.
4598 *
4599 * The window surface must be destroyed before the specified Vulkan instance.
4600 * It is the responsibility of the caller to destroy the window surface. GLFW
4601 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
4602 * surface.
4603 *
4604 * @param[in] instance The Vulkan instance to create the surface in.
4605 * @param[in] window The window to create the surface for.
4606 * @param[in] allocator The allocator to use, or `NULL` to use the default
4607 * allocator.
4608 * @param[out] surface Where to store the handle of the surface. This is set
4609 * to `VK_NULL_HANDLE` if an error occurred.
4610 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
4611 * [error](@ref error_handling) occurred.
4612 *
4613 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4614 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4615 *
Camilla Berglund67931bd2016-10-26 16:58:56 +02004616 * @remark If an error occurs before the creation call is made, GLFW returns
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004617 * the Vulkan error code most appropriate for the error. Appropriate use of
4618 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
Camilla Berglundee33dcd2016-03-07 14:42:51 +01004619 * eliminate almost all occurrences of these errors.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004620 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004621 * @remark @macos This function currently only supports the
4622 * `VK_MVK_macos_surface` extension from MoltenVK.
4623 *
4624 * @remark @macos This function creates and sets a `CAMetalLayer` instance for
4625 * the window content view, which is required for MoltenVK to function.
4626 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004627 * @thread_safety This function may be called from any thread. For
4628 * synchronization details of Vulkan objects, see the Vulkan specification.
4629 *
4630 * @sa @ref vulkan_surface
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004631 * @sa @ref glfwGetRequiredInstanceExtensions
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004632 *
4633 * @since Added in version 3.2.
4634 *
4635 * @ingroup vulkan
4636 */
4637GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
4638
4639#endif /*VK_VERSION_1_0*/
4640
Camilla Berglund3249f812010-09-07 17:34:51 +02004641
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004642/*************************************************************************
4643 * Global definition cleanup
4644 *************************************************************************/
4645
4646/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
4647
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004648#ifdef GLFW_WINGDIAPI_DEFINED
4649 #undef WINGDIAPI
4650 #undef GLFW_WINGDIAPI_DEFINED
4651#endif
4652
4653#ifdef GLFW_CALLBACK_DEFINED
4654 #undef CALLBACK
4655 #undef GLFW_CALLBACK_DEFINED
4656#endif
4657
4658/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
4659
4660
Camilla Berglund3249f812010-09-07 17:34:51 +02004661#ifdef __cplusplus
4662}
4663#endif
4664
Camilla Berglundf8df91d2013-01-15 01:59:56 +01004665#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02004666