Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 1 | /************************************************************************* |
Camilla Berglund | 6e553c7 | 2011-03-06 01:46:39 +0100 | [diff] [blame] | 2 | * GLFW - An OpenGL library |
Camilla Berglund | 38b0ccb | 2010-09-07 17:41:26 +0200 | [diff] [blame] | 3 | * API version: 3.0 |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4 | * WWW: http://www.glfw.org/ |
| 5 | *------------------------------------------------------------------------ |
| 6 | * Copyright (c) 2002-2006 Marcus Geelnard |
Camilla Berglund | f8105ed | 2010-11-09 02:57:46 +0100 | [diff] [blame] | 7 | * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org> |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 8 | * |
| 9 | * This software is provided 'as-is', without any express or implied |
| 10 | * warranty. In no event will the authors be held liable for any damages |
| 11 | * arising from the use of this software. |
| 12 | * |
| 13 | * Permission is granted to anyone to use this software for any purpose, |
| 14 | * including commercial applications, and to alter it and redistribute it |
| 15 | * freely, subject to the following restrictions: |
| 16 | * |
| 17 | * 1. The origin of this software must not be misrepresented; you must not |
| 18 | * claim that you wrote the original software. If you use this software |
| 19 | * in a product, an acknowledgment in the product documentation would |
| 20 | * be appreciated but is not required. |
| 21 | * |
| 22 | * 2. Altered source versions must be plainly marked as such, and must not |
| 23 | * be misrepresented as being the original software. |
| 24 | * |
| 25 | * 3. This notice may not be removed or altered from any source |
| 26 | * distribution. |
| 27 | * |
| 28 | *************************************************************************/ |
| 29 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 30 | #ifndef _glfw3_h_ |
| 31 | #define _glfw3_h_ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 32 | |
| 33 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
| 37 | |
| 38 | /************************************************************************* |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 39 | * Doxygen documentation |
| 40 | *************************************************************************/ |
| 41 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 42 | /*! @defgroup clipboard Clipboard support |
| 43 | */ |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 44 | /*! @defgroup context Context handling |
| 45 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 46 | /*! @defgroup error Error handling |
| 47 | */ |
| 48 | /*! @defgroup gamma Gamma ramp support |
| 49 | */ |
| 50 | /*! @defgroup init Initialization and version information |
| 51 | */ |
| 52 | /*! @defgroup input Input handling |
| 53 | */ |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 54 | /*! @defgroup monitor Monitor handling |
| 55 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 56 | /*! @defgroup time Time input |
| 57 | */ |
| 58 | /*! @defgroup window Window handling |
| 59 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 60 | * The primary purpose of GLFW is to provide a simple interface to window |
| 61 | * management and OpenGL and OpenGL ES context creation. GLFW supports |
| 62 | * multiple windows, which can be either a normal desktop window or |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 63 | * a full screen window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 64 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 65 | |
| 66 | |
| 67 | /************************************************************************* |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 68 | * Global definitions |
| 69 | *************************************************************************/ |
| 70 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 71 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 72 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 73 | /* Please report any problems that you find with your compiler, which may |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 74 | * be solved in this section! There are several compilers that I have not |
| 75 | * been able to test this file with yet. |
| 76 | * |
| 77 | * First: If we are we on Windows, we want a single define for it (_WIN32) |
| 78 | * (Note: For Cygwin the compiler flag -mwin32 should be used, but to |
| 79 | * make sure that things run smoothly for Cygwin users, we add __CYGWIN__ |
| 80 | * to the list of "valid Win32 identifiers", which removes the need for |
| 81 | * -mwin32) |
| 82 | */ |
| 83 | #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)) |
| 84 | #define _WIN32 |
| 85 | #endif /* _WIN32 */ |
| 86 | |
| 87 | /* In order for extension support to be portable, we need to define an |
| 88 | * OpenGL function call method. We use the keyword APIENTRY, which is |
| 89 | * defined for Win32. (Note: Windows also needs this for <GL/gl.h>) |
| 90 | */ |
| 91 | #ifndef APIENTRY |
| 92 | #ifdef _WIN32 |
| 93 | #define APIENTRY __stdcall |
| 94 | #else |
| 95 | #define APIENTRY |
| 96 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 97 | #endif /* APIENTRY */ |
| 98 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 99 | /* The following three defines are here solely to make some Windows-based |
| 100 | * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but |
| 101 | * it has the major drawback of severely polluting our namespace. |
| 102 | */ |
| 103 | |
| 104 | /* Under Windows, we need WINGDIAPI defined */ |
| 105 | #if !defined(WINGDIAPI) && defined(_WIN32) |
| 106 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__) |
| 107 | /* Microsoft Visual C++, Borland C++ Builder and Pelles C */ |
| 108 | #define WINGDIAPI __declspec(dllimport) |
| 109 | #elif defined(__LCC__) |
| 110 | /* LCC-Win32 */ |
| 111 | #define WINGDIAPI __stdcall |
| 112 | #else |
| 113 | /* Others (e.g. MinGW, Cygwin) */ |
| 114 | #define WINGDIAPI extern |
| 115 | #endif |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 116 | #define GLFW_WINGDIAPI_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 117 | #endif /* WINGDIAPI */ |
| 118 | |
| 119 | /* Some <GL/glu.h> files also need CALLBACK defined */ |
| 120 | #if !defined(CALLBACK) && defined(_WIN32) |
| 121 | #if defined(_MSC_VER) |
| 122 | /* Microsoft Visual C++ */ |
| 123 | #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) |
| 124 | #define CALLBACK __stdcall |
| 125 | #else |
| 126 | #define CALLBACK |
| 127 | #endif |
| 128 | #else |
| 129 | /* Other Windows compilers */ |
| 130 | #define CALLBACK __stdcall |
| 131 | #endif |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 132 | #define GLFW_CALLBACK_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 133 | #endif /* CALLBACK */ |
| 134 | |
Camilla Berglund | 3c912cb | 2012-08-02 21:25:00 +0200 | [diff] [blame] | 135 | /* Most <GL/glu.h> variants on Windows need wchar_t */ |
| 136 | #if defined(_WIN32) |
| 137 | #include <stddef.h> |
| 138 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 139 | |
| 140 | |
| 141 | /* ---------------- GLFW related system specific defines ----------------- */ |
| 142 | |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 143 | #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) |
| 144 | #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" |
| 145 | #endif |
| 146 | |
Camilla Berglund | 2588c9b | 2012-03-25 17:40:30 +0200 | [diff] [blame] | 147 | #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 148 | |
| 149 | /* We are building a Win32 DLL */ |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 150 | #define GLFWAPI __declspec(dllexport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 151 | |
| 152 | #elif defined(_WIN32) && defined(GLFW_DLL) |
| 153 | |
| 154 | /* We are calling a Win32 DLL */ |
| 155 | #if defined(__LCC__) |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 156 | #define GLFWAPI extern |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 157 | #else |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 158 | #define GLFWAPI __declspec(dllimport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 159 | #endif |
| 160 | |
| 161 | #else |
| 162 | |
| 163 | /* We are either building/calling a static lib or we are non-win32 */ |
| 164 | #define GLFWAPI |
| 165 | |
| 166 | #endif |
| 167 | |
| 168 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 169 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 170 | /* Include the chosen client API headers. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 171 | */ |
| 172 | #if defined(__APPLE_CC__) |
Camilla Berglund | 410a4e2 | 2012-09-27 22:28:04 +0200 | [diff] [blame] | 173 | #if defined(GLFW_INCLUDE_GLCOREARB) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 174 | #include <OpenGL/gl3.h> |
Camilla Berglund | 378c75d | 2013-03-13 20:44:00 +0100 | [diff] [blame] | 175 | #elif !defined(GLFW_INCLUDE_NONE) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 176 | #define GL_GLEXT_LEGACY |
| 177 | #include <OpenGL/gl.h> |
| 178 | #endif |
Camilla Berglund | 2213450 | 2012-06-05 23:55:10 +0200 | [diff] [blame] | 179 | #if defined(GLFW_INCLUDE_GLU) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 180 | #include <OpenGL/glu.h> |
| 181 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 182 | #else |
Camilla Berglund | 410a4e2 | 2012-09-27 22:28:04 +0200 | [diff] [blame] | 183 | #if defined(GLFW_INCLUDE_GLCOREARB) |
| 184 | #include <GL/glcorearb.h> |
Jari Vetoniemi | 38c4a8e | 2012-11-10 00:08:44 +0200 | [diff] [blame] | 185 | #elif defined(GLFW_INCLUDE_ES1) |
| 186 | #include <GLES/gl.h> |
Camilla Berglund | 3fd1774 | 2012-07-19 23:20:47 +0200 | [diff] [blame] | 187 | #elif defined(GLFW_INCLUDE_ES2) |
| 188 | #include <GLES2/gl2.h> |
Camilla Berglund | a933d8c | 2013-02-14 19:28:59 +0100 | [diff] [blame] | 189 | #elif defined(GLFW_INCLUDE_ES3) |
| 190 | #include <GLES3/gl3.h> |
Camilla Berglund | 378c75d | 2013-03-13 20:44:00 +0100 | [diff] [blame] | 191 | #elif !defined(GLFW_INCLUDE_NONE) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 192 | #include <GL/gl.h> |
| 193 | #endif |
Camilla Berglund | 2213450 | 2012-06-05 23:55:10 +0200 | [diff] [blame] | 194 | #if defined(GLFW_INCLUDE_GLU) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 195 | #include <GL/glu.h> |
| 196 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 197 | #endif |
| 198 | |
| 199 | |
| 200 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 201 | * GLFW API tokens |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 202 | *************************************************************************/ |
| 203 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 204 | /*! @name GLFW version macros |
| 205 | * @{ */ |
| 206 | /*! @brief The major version number of the GLFW library. |
| 207 | * |
| 208 | * This is incremented when the API is changed in non-compatible ways. |
| 209 | * @ingroup init |
| 210 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 211 | #define GLFW_VERSION_MAJOR 3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 212 | /*! @brief The minor version number of the GLFW library. |
| 213 | * |
| 214 | * This is incremented when features are added to the API but it remains |
| 215 | * backward-compatible. |
| 216 | * @ingroup init |
| 217 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 218 | #define GLFW_VERSION_MINOR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 219 | /*! @brief The revision number of the GLFW library. |
| 220 | * |
| 221 | * This is incremented when a bug fix release is made that does not contain any |
| 222 | * API changes. |
| 223 | * @ingroup init |
| 224 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 225 | #define GLFW_VERSION_REVISION 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 226 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 227 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 228 | /*! @name Key and button actions |
| 229 | * @{ */ |
| 230 | /*! @brief The key or button was released. |
| 231 | * @ingroup input |
| 232 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 233 | #define GLFW_RELEASE 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 234 | /*! @brief The key or button was pressed. |
| 235 | * @ingroup input |
| 236 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 237 | #define GLFW_PRESS 1 |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 238 | /*! @brief The key was held down until it repeated. |
| 239 | * @ingroup input |
| 240 | */ |
| 241 | #define GLFW_REPEAT 2 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 242 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 243 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 244 | /*! @defgroup keys Keyboard keys |
| 245 | * |
| 246 | * These key codes are inspired by the *USB HID Usage Tables v1.12* (p. 53-60), |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 247 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
| 248 | * put in the 256+ range). |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 249 | * |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 250 | * The naming of the key codes follow these rules: |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 251 | * - The US keyboard layout is used |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 252 | * - Names of printable alpha-numeric characters are used (e.g. "A", "R", |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 253 | * "3", etc.) |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 254 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 255 | * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not |
| 256 | * correspond to the Unicode standard (usually for brevity) |
| 257 | * - Keys that lack a clear US mapping are named "WORLD_x" |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 258 | * - For non-printable keys, custom names are used (e.g. "F4", |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 259 | * "BACKSPACE", etc.) |
| 260 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 261 | * @ingroup input |
| 262 | * @{ |
| 263 | */ |
| 264 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 265 | /* Printable keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 266 | #define GLFW_KEY_SPACE 32 |
| 267 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
| 268 | #define GLFW_KEY_COMMA 44 /* , */ |
| 269 | #define GLFW_KEY_MINUS 45 /* - */ |
| 270 | #define GLFW_KEY_PERIOD 46 /* . */ |
| 271 | #define GLFW_KEY_SLASH 47 /* / */ |
| 272 | #define GLFW_KEY_0 48 |
| 273 | #define GLFW_KEY_1 49 |
| 274 | #define GLFW_KEY_2 50 |
| 275 | #define GLFW_KEY_3 51 |
| 276 | #define GLFW_KEY_4 52 |
| 277 | #define GLFW_KEY_5 53 |
| 278 | #define GLFW_KEY_6 54 |
| 279 | #define GLFW_KEY_7 55 |
| 280 | #define GLFW_KEY_8 56 |
| 281 | #define GLFW_KEY_9 57 |
| 282 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
| 283 | #define GLFW_KEY_EQUAL 61 /* = */ |
| 284 | #define GLFW_KEY_A 65 |
| 285 | #define GLFW_KEY_B 66 |
| 286 | #define GLFW_KEY_C 67 |
| 287 | #define GLFW_KEY_D 68 |
| 288 | #define GLFW_KEY_E 69 |
| 289 | #define GLFW_KEY_F 70 |
| 290 | #define GLFW_KEY_G 71 |
| 291 | #define GLFW_KEY_H 72 |
| 292 | #define GLFW_KEY_I 73 |
| 293 | #define GLFW_KEY_J 74 |
| 294 | #define GLFW_KEY_K 75 |
| 295 | #define GLFW_KEY_L 76 |
| 296 | #define GLFW_KEY_M 77 |
| 297 | #define GLFW_KEY_N 78 |
| 298 | #define GLFW_KEY_O 79 |
| 299 | #define GLFW_KEY_P 80 |
| 300 | #define GLFW_KEY_Q 81 |
| 301 | #define GLFW_KEY_R 82 |
| 302 | #define GLFW_KEY_S 83 |
| 303 | #define GLFW_KEY_T 84 |
| 304 | #define GLFW_KEY_U 85 |
| 305 | #define GLFW_KEY_V 86 |
| 306 | #define GLFW_KEY_W 87 |
| 307 | #define GLFW_KEY_X 88 |
| 308 | #define GLFW_KEY_Y 89 |
| 309 | #define GLFW_KEY_Z 90 |
| 310 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
| 311 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
| 312 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
| 313 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
| 314 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
| 315 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 316 | |
| 317 | /* Function keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 318 | #define GLFW_KEY_ESCAPE 256 |
| 319 | #define GLFW_KEY_ENTER 257 |
| 320 | #define GLFW_KEY_TAB 258 |
| 321 | #define GLFW_KEY_BACKSPACE 259 |
| 322 | #define GLFW_KEY_INSERT 260 |
| 323 | #define GLFW_KEY_DELETE 261 |
| 324 | #define GLFW_KEY_RIGHT 262 |
| 325 | #define GLFW_KEY_LEFT 263 |
| 326 | #define GLFW_KEY_DOWN 264 |
| 327 | #define GLFW_KEY_UP 265 |
| 328 | #define GLFW_KEY_PAGE_UP 266 |
| 329 | #define GLFW_KEY_PAGE_DOWN 267 |
| 330 | #define GLFW_KEY_HOME 268 |
| 331 | #define GLFW_KEY_END 269 |
| 332 | #define GLFW_KEY_CAPS_LOCK 280 |
| 333 | #define GLFW_KEY_SCROLL_LOCK 281 |
| 334 | #define GLFW_KEY_NUM_LOCK 282 |
| 335 | #define GLFW_KEY_PRINT_SCREEN 283 |
| 336 | #define GLFW_KEY_PAUSE 284 |
| 337 | #define GLFW_KEY_F1 290 |
| 338 | #define GLFW_KEY_F2 291 |
| 339 | #define GLFW_KEY_F3 292 |
| 340 | #define GLFW_KEY_F4 293 |
| 341 | #define GLFW_KEY_F5 294 |
| 342 | #define GLFW_KEY_F6 295 |
| 343 | #define GLFW_KEY_F7 296 |
| 344 | #define GLFW_KEY_F8 297 |
| 345 | #define GLFW_KEY_F9 298 |
| 346 | #define GLFW_KEY_F10 299 |
| 347 | #define GLFW_KEY_F11 300 |
| 348 | #define GLFW_KEY_F12 301 |
| 349 | #define GLFW_KEY_F13 302 |
| 350 | #define GLFW_KEY_F14 303 |
| 351 | #define GLFW_KEY_F15 304 |
| 352 | #define GLFW_KEY_F16 305 |
| 353 | #define GLFW_KEY_F17 306 |
| 354 | #define GLFW_KEY_F18 307 |
| 355 | #define GLFW_KEY_F19 308 |
| 356 | #define GLFW_KEY_F20 309 |
| 357 | #define GLFW_KEY_F21 310 |
| 358 | #define GLFW_KEY_F22 311 |
| 359 | #define GLFW_KEY_F23 312 |
| 360 | #define GLFW_KEY_F24 313 |
| 361 | #define GLFW_KEY_F25 314 |
| 362 | #define GLFW_KEY_KP_0 320 |
| 363 | #define GLFW_KEY_KP_1 321 |
| 364 | #define GLFW_KEY_KP_2 322 |
| 365 | #define GLFW_KEY_KP_3 323 |
| 366 | #define GLFW_KEY_KP_4 324 |
| 367 | #define GLFW_KEY_KP_5 325 |
| 368 | #define GLFW_KEY_KP_6 326 |
| 369 | #define GLFW_KEY_KP_7 327 |
| 370 | #define GLFW_KEY_KP_8 328 |
| 371 | #define GLFW_KEY_KP_9 329 |
| 372 | #define GLFW_KEY_KP_DECIMAL 330 |
| 373 | #define GLFW_KEY_KP_DIVIDE 331 |
| 374 | #define GLFW_KEY_KP_MULTIPLY 332 |
| 375 | #define GLFW_KEY_KP_SUBTRACT 333 |
| 376 | #define GLFW_KEY_KP_ADD 334 |
| 377 | #define GLFW_KEY_KP_ENTER 335 |
| 378 | #define GLFW_KEY_KP_EQUAL 336 |
| 379 | #define GLFW_KEY_LEFT_SHIFT 340 |
| 380 | #define GLFW_KEY_LEFT_CONTROL 341 |
| 381 | #define GLFW_KEY_LEFT_ALT 342 |
| 382 | #define GLFW_KEY_LEFT_SUPER 343 |
| 383 | #define GLFW_KEY_RIGHT_SHIFT 344 |
| 384 | #define GLFW_KEY_RIGHT_CONTROL 345 |
| 385 | #define GLFW_KEY_RIGHT_ALT 346 |
| 386 | #define GLFW_KEY_RIGHT_SUPER 347 |
| 387 | #define GLFW_KEY_MENU 348 |
| 388 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 389 | |
| 390 | /* GLFW 2.x key name aliases (deprecated) */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 391 | #define GLFW_KEY_ESC GLFW_KEY_ESCAPE |
| 392 | #define GLFW_KEY_DEL GLFW_KEY_DELETE |
| 393 | #define GLFW_KEY_PAGEUP GLFW_KEY_PAGE_UP |
| 394 | #define GLFW_KEY_PAGEDOWN GLFW_KEY_PAGE_DOWN |
| 395 | #define GLFW_KEY_KP_NUM_LOCK GLFW_KEY_NUM_LOCK |
| 396 | #define GLFW_KEY_LCTRL GLFW_KEY_LEFT_CONTROL |
| 397 | #define GLFW_KEY_LSHIFT GLFW_KEY_LEFT_SHIFT |
| 398 | #define GLFW_KEY_LALT GLFW_KEY_LEFT_ALT |
| 399 | #define GLFW_KEY_LSUPER GLFW_KEY_LEFT_SUPER |
| 400 | #define GLFW_KEY_RCTRL GLFW_KEY_RIGHT_CONTROL |
| 401 | #define GLFW_KEY_RSHIFT GLFW_KEY_RIGHT_SHIFT |
| 402 | #define GLFW_KEY_RALT GLFW_KEY_RIGHT_ALT |
| 403 | #define GLFW_KEY_RSUPER GLFW_KEY_RIGHT_SUPER |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 404 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 405 | /*! @} */ |
| 406 | |
| 407 | /*! @defgroup buttons Mouse buttons |
| 408 | * @ingroup input |
| 409 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 410 | #define GLFW_MOUSE_BUTTON_1 0 |
| 411 | #define GLFW_MOUSE_BUTTON_2 1 |
| 412 | #define GLFW_MOUSE_BUTTON_3 2 |
| 413 | #define GLFW_MOUSE_BUTTON_4 3 |
| 414 | #define GLFW_MOUSE_BUTTON_5 4 |
| 415 | #define GLFW_MOUSE_BUTTON_6 5 |
| 416 | #define GLFW_MOUSE_BUTTON_7 6 |
| 417 | #define GLFW_MOUSE_BUTTON_8 7 |
| 418 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
| 419 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
| 420 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
| 421 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 422 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 423 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 424 | /*! @defgroup joysticks Joysticks |
| 425 | * @ingroup input |
| 426 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 427 | #define GLFW_JOYSTICK_1 0 |
| 428 | #define GLFW_JOYSTICK_2 1 |
| 429 | #define GLFW_JOYSTICK_3 2 |
| 430 | #define GLFW_JOYSTICK_4 3 |
| 431 | #define GLFW_JOYSTICK_5 4 |
| 432 | #define GLFW_JOYSTICK_6 5 |
| 433 | #define GLFW_JOYSTICK_7 6 |
| 434 | #define GLFW_JOYSTICK_8 7 |
| 435 | #define GLFW_JOYSTICK_9 8 |
| 436 | #define GLFW_JOYSTICK_10 9 |
| 437 | #define GLFW_JOYSTICK_11 10 |
| 438 | #define GLFW_JOYSTICK_12 11 |
| 439 | #define GLFW_JOYSTICK_13 12 |
| 440 | #define GLFW_JOYSTICK_14 13 |
| 441 | #define GLFW_JOYSTICK_15 14 |
| 442 | #define GLFW_JOYSTICK_16 15 |
| 443 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 444 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 445 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 446 | /*! @defgroup errors Error codes |
| 447 | * @ingroup error |
| 448 | * @{ */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 449 | /*! @brief GLFW has not been initialized. |
| 450 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 451 | #define GLFW_NOT_INITIALIZED 0x00070001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 452 | /*! @brief No context is current for this thread. |
| 453 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 454 | #define GLFW_NO_CURRENT_CONTEXT 0x00070002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 455 | /*! @brief One of the enum parameters for the function was given an invalid |
| 456 | * enum. |
| 457 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 458 | #define GLFW_INVALID_ENUM 0x00070003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 459 | /*! @brief One of the parameters for the function was given an invalid value. |
| 460 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 461 | #define GLFW_INVALID_VALUE 0x00070004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 462 | /*! @brief A memory allocation failed. |
| 463 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 464 | #define GLFW_OUT_OF_MEMORY 0x00070005 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 465 | /*! @brief GLFW could not find support for the requested client API on the |
| 466 | * system. |
| 467 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 468 | #define GLFW_API_UNAVAILABLE 0x00070006 |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 469 | /*! @brief The requested client API version is not available. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 470 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 471 | #define GLFW_VERSION_UNAVAILABLE 0x00070007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 472 | /*! @brief A platform-specific error occurred that does not match any of the |
| 473 | * more specific categories. |
| 474 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 475 | #define GLFW_PLATFORM_ERROR 0x00070008 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 476 | /*! @brief The clipboard did not contain data in the requested format. |
| 477 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 478 | #define GLFW_FORMAT_UNAVAILABLE 0x00070009 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 479 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 480 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 481 | #define GLFW_FOCUSED 0x00020001 |
| 482 | #define GLFW_ICONIFIED 0x00020002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 483 | #define GLFW_RESIZABLE 0x00022007 |
| 484 | #define GLFW_VISIBLE 0x00022008 |
Camilla Berglund | 49db3b2 | 2013-04-08 15:16:32 +0200 | [diff] [blame] | 485 | #define GLFW_DECORATED 0x00022009 |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 486 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 487 | #define GLFW_CONTEXT_REVISION 0x00020004 |
| 488 | #define GLFW_RED_BITS 0x00021000 |
| 489 | #define GLFW_GREEN_BITS 0x00021001 |
| 490 | #define GLFW_BLUE_BITS 0x00021002 |
| 491 | #define GLFW_ALPHA_BITS 0x00021003 |
| 492 | #define GLFW_DEPTH_BITS 0x00021004 |
| 493 | #define GLFW_STENCIL_BITS 0x00021005 |
| 494 | #define GLFW_ACCUM_RED_BITS 0x00021006 |
| 495 | #define GLFW_ACCUM_GREEN_BITS 0x00021007 |
| 496 | #define GLFW_ACCUM_BLUE_BITS 0x00021008 |
| 497 | #define GLFW_ACCUM_ALPHA_BITS 0x00021009 |
| 498 | #define GLFW_AUX_BUFFERS 0x0002100A |
| 499 | #define GLFW_STEREO 0x0002100B |
| 500 | #define GLFW_SAMPLES 0x0002100C |
| 501 | #define GLFW_SRGB_CAPABLE 0x0002100D |
Camilla Berglund | deb0b3d | 2012-12-02 21:00:15 +0100 | [diff] [blame] | 502 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 503 | #define GLFW_CLIENT_API 0x00022000 |
| 504 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022001 |
| 505 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022002 |
| 506 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022003 |
| 507 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022004 |
| 508 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022005 |
| 509 | #define GLFW_OPENGL_PROFILE 0x00022006 |
| 510 | |
| 511 | #define GLFW_OPENGL_API 0x00000001 |
| 512 | #define GLFW_OPENGL_ES_API 0x00000002 |
| 513 | |
| 514 | #define GLFW_NO_ROBUSTNESS 0x00000000 |
| 515 | #define GLFW_NO_RESET_NOTIFICATION 0x00000001 |
| 516 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00000002 |
| 517 | |
| 518 | #define GLFW_OPENGL_NO_PROFILE 0x00000000 |
| 519 | #define GLFW_OPENGL_CORE_PROFILE 0x00000001 |
| 520 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00000002 |
| 521 | |
| 522 | #define GLFW_CURSOR_MODE 0x00030001 |
| 523 | #define GLFW_STICKY_KEYS 0x00030002 |
| 524 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00030003 |
| 525 | |
| 526 | #define GLFW_CURSOR_NORMAL 0x00040001 |
| 527 | #define GLFW_CURSOR_HIDDEN 0x00040002 |
| 528 | #define GLFW_CURSOR_CAPTURED 0x00040003 |
| 529 | |
| 530 | #define GLFW_PRESENT 0x00050001 |
| 531 | #define GLFW_AXES 0x00050002 |
| 532 | #define GLFW_BUTTONS 0x00050003 |
| 533 | |
| 534 | #define GLFW_GAMMA_RAMP_SIZE 256 |
| 535 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 536 | #define GLFW_CONNECTED 0x00061000 |
| 537 | #define GLFW_DISCONNECTED 0x00061001 |
| 538 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 539 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 540 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 541 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 542 | *************************************************************************/ |
| 543 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 544 | /*! @brief Client API function pointer type. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 545 | * |
| 546 | * Generic function pointer used for returning client API function pointers |
| 547 | * without forcing a cast from a regular pointer. |
| 548 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 549 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 550 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 551 | typedef void (*GLFWglproc)(void); |
| 552 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 553 | /*! @brief Opaque monitor object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 554 | * |
| 555 | * Opaque monitor object. |
| 556 | * |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 557 | * @ingroup monitor |
| 558 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 559 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 560 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 561 | /*! @brief Opaque window object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 562 | * |
| 563 | * Opaque window object. |
| 564 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 565 | * @ingroup window |
| 566 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 567 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 568 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 569 | /*! @brief The function signature for error callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 570 | * |
| 571 | * This is the function signature for error callback functions. |
| 572 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 573 | * @param[in] error An [error code](@ref errors). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 574 | * @param[in] description A UTF-8 encoded string describing the error. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 575 | * |
| 576 | * @sa glfwSetErrorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 577 | * |
| 578 | * @ingroup error |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 579 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 580 | typedef void (* GLFWerrorfun)(int,const char*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 581 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 582 | /*! @brief The function signature for window position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 583 | * |
| 584 | * This is the function signature for window position callback functions. |
| 585 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 586 | * @param[in] window The window that the user moved. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 587 | * @param[in] xpos The new x-coordinate, in screen coordinates, of the |
| 588 | * upper-left corner of the client area of the window. |
| 589 | * @param[in] ypos The new y-coordinate, in screen coordinates, of the |
| 590 | * upper-left corner of the client area of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 591 | * |
| 592 | * @sa glfwSetWindowPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 593 | * |
| 594 | * @ingroup window |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 595 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 596 | typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 597 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 598 | /*! @brief The function signature for window resize callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 599 | * |
| 600 | * This is the function signature for window size callback functions. |
| 601 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 602 | * @param[in] window The window that the user resized. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 603 | * @param[in] width The new width, in screen coordinates, of the window. |
| 604 | * @param[in] height The new height, in screen coordinates, of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 605 | * |
| 606 | * @sa glfwSetWindowSizeCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 607 | * |
| 608 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 609 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 610 | typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 611 | |
| 612 | /*! @brief The function signature for window close callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 613 | * |
| 614 | * This is the function signature for window close callback functions. |
| 615 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 616 | * @param[in] window The window that the user attempted to close. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 617 | * |
| 618 | * @sa glfwSetWindowCloseCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 619 | * |
| 620 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 621 | */ |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 622 | typedef void (* GLFWwindowclosefun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 623 | |
| 624 | /*! @brief The function signature for window content refresh callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 625 | * |
| 626 | * This is the function signature for window refresh callback functions. |
| 627 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 628 | * @param[in] window The window whose content needs to be refreshed. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 629 | * |
| 630 | * @sa glfwSetWindowRefreshCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 631 | * |
| 632 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 633 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 634 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 635 | |
| 636 | /*! @brief The function signature for window focus/defocus callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 637 | * |
| 638 | * This is the function signature for window focus callback functions. |
| 639 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 640 | * @param[in] window The window that was focused or defocused. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 641 | * @param[in] focused `GL_TRUE` if the window was focused, or `GL_FALSE` if |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 642 | * it was defocused. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 643 | * |
| 644 | * @sa glfwSetWindowFocusCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 645 | * |
| 646 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 647 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 648 | typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 649 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 650 | /*! @brief The function signature for window iconify/restore callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 651 | * |
| 652 | * This is the function signature for window iconify/restore callback |
| 653 | * functions. |
| 654 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 655 | * @param[in] window The window that was iconified or restored. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 656 | * @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE` |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 657 | * if it was restored. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 658 | * |
| 659 | * @sa glfwSetWindowIconifyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 660 | * |
| 661 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 662 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 663 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 664 | |
| 665 | /*! @brief The function signature for mouse button callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 666 | * |
| 667 | * This is the function signature for mouse button callback functions. |
| 668 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 669 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 670 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
| 671 | * released. |
| 672 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 673 | * |
| 674 | * @sa glfwSetMouseButtonCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 675 | * |
| 676 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 677 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 678 | typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 679 | |
| 680 | /*! @brief The function signature for cursor position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 681 | * |
| 682 | * This is the function signature for cursor position callback functions. |
| 683 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 684 | * @param[in] window The window that received the event. |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 685 | * @param[in] xpos The new x-coordinate of the cursor. |
| 686 | * @param[in] ypos The new y-coordinate of the cursor. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 687 | * |
| 688 | * @sa glfwSetCursorPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 689 | * |
| 690 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 691 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 692 | typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 693 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 694 | /*! @brief The function signature for cursor enter/leave callbacks. |
| 695 | * |
| 696 | * This is the function signature for cursor enter/leave callback functions. |
| 697 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 698 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 699 | * @param[in] entered `GL_TRUE` if the cursor entered the window's client |
| 700 | * area, or `GL_FALSE` if it left it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 701 | * |
| 702 | * @sa glfwSetCursorEnterCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 703 | * |
| 704 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 705 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 706 | typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 707 | |
| 708 | /*! @brief The function signature for scroll callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 709 | * |
| 710 | * This is the function signature for scroll callback functions. |
| 711 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 712 | * @param[in] window The window that received the event. |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 713 | * @param[in] xpos The scroll offset along the x-axis. |
| 714 | * @param[in] ypos The scroll offset along the y-axis. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 715 | * |
| 716 | * @sa glfwSetScrollCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 717 | * |
| 718 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 719 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 720 | typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 721 | |
| 722 | /*! @brief The function signature for keyboard key callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 723 | * |
| 724 | * This is the function signature for keyboard key callback functions. |
| 725 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 726 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 727 | * @param[in] key The [keyboard key](@ref keys) that was pressed or released. |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 728 | * @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 729 | * |
| 730 | * @sa glfwSetKeyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 731 | * |
| 732 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 733 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 734 | typedef void (* GLFWkeyfun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 735 | |
| 736 | /*! @brief The function signature for Unicode character callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 737 | * |
| 738 | * This is the function signature for Unicode character callback functions. |
| 739 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 740 | * @param[in] window The window that received the event. |
| 741 | * @param[in] character The Unicode code point of the character. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 742 | * |
| 743 | * @sa glfwSetCharCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 744 | * |
| 745 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 746 | */ |
Camilla Berglund | 182e0af | 2013-02-25 17:02:28 +0100 | [diff] [blame] | 747 | typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 748 | |
| 749 | /*! @brief The function signature for monitor configuration callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 750 | * |
| 751 | * This is the function signature for monitor configuration callback functions. |
| 752 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 753 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 754 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 755 | * |
| 756 | * @sa glfwSetMonitorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 757 | * |
| 758 | * @ingroup monitor |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 759 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 760 | typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 761 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 762 | /*! @brief Video mode type. |
| 763 | * |
| 764 | * This describes a single video mode. |
| 765 | * |
| 766 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 767 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 768 | typedef struct |
| 769 | { |
| 770 | int width; |
| 771 | int height; |
| 772 | int redBits; |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 773 | int greenBits; |
Camilla Berglund | 2e8446f | 2013-04-11 01:31:00 +0200 | [diff] [blame^] | 774 | int blueBits; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 775 | } GLFWvidmode; |
| 776 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 777 | /*! @brief Gamma ramp. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 778 | * |
| 779 | * This describes the gamma ramp for a monitor. |
| 780 | * |
| 781 | * @sa glfwGetGammaRamp glfwSetGammaRamp |
| 782 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 783 | * @ingroup gamma |
| 784 | */ |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 785 | typedef struct |
| 786 | { |
| 787 | unsigned short red[GLFW_GAMMA_RAMP_SIZE]; |
| 788 | unsigned short green[GLFW_GAMMA_RAMP_SIZE]; |
| 789 | unsigned short blue[GLFW_GAMMA_RAMP_SIZE]; |
| 790 | } GLFWgammaramp; |
| 791 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 792 | |
| 793 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 794 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 795 | *************************************************************************/ |
| 796 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 797 | /*! @brief Initializes the GLFW library. |
| 798 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 799 | * This function initializes the GLFW library. Before most GLFW functions can |
| 800 | * be used, GLFW must be initialized, and before a program terminates GLFW |
| 801 | * should be terminated in order to free any resources allocated during or |
| 802 | * after initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 803 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 804 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
| 805 | * succeeds, you should call @ref glfwTerminate before the program exits. |
| 806 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 807 | * Additional calls to this function after successful initialization but before |
| 808 | * termination will succeed but will do nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 809 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 810 | * @return `GL_TRUE` if successful, or `GL_FALSE` if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 811 | * |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 812 | * @par New in GLFW 3 |
| 813 | * This function no longer registers @ref glfwTerminate with `atexit`. |
| 814 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 815 | * @note This function may only be called from the main thread. |
| 816 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 817 | * @note This function may take several seconds to complete on some systems, |
| 818 | * while on other systems it may take only a fraction of a second to complete. |
| 819 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 820 | * @note **Mac OS X:** This function will change the current directory of the |
| 821 | * application to the `Contents/Resources` subdirectory of the application's |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 822 | * bundle, if present. |
| 823 | * |
| 824 | * @sa glfwTerminate |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 825 | * |
| 826 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 827 | */ |
| 828 | GLFWAPI int glfwInit(void); |
| 829 | |
| 830 | /*! @brief Terminates the GLFW library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 831 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 832 | * This function destroys all remaining windows, frees any allocated resources |
| 833 | * and sets the library to an uninitialized state. Once this is called, you |
| 834 | * must again call @ref glfwInit successfully before you will be able to use |
| 835 | * most GLFW functions. |
| 836 | * |
| 837 | * If GLFW has been successfully initialized, this function should be called |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 838 | * before the program exits. If initialization fails, there is no need to call |
| 839 | * this function, as it is called by @ref glfwInit before it returns failure. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 840 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 841 | * @remarks This function may be called before @ref glfwInit. |
| 842 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 843 | * @note This function may only be called from the main thread. |
| 844 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 845 | * @warning No window's context may be current on another thread when this |
| 846 | * function is called. |
| 847 | * |
| 848 | * @sa glfwInit |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 849 | * |
| 850 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 851 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 852 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 853 | |
| 854 | /*! @brief Retrieves the version of the GLFW library. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 855 | * |
| 856 | * This function retrieves the major, minor and revision numbers of the GLFW |
| 857 | * library. It is intended for when you are using GLFW as a shared library and |
| 858 | * want to ensure that you are using the minimum required version. |
| 859 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 860 | * @param[out] major Where to store the major version number, or `NULL`. |
| 861 | * @param[out] minor Where to store the minor version number, or `NULL`. |
| 862 | * @param[out] rev Where to store the revision number, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 863 | * |
| 864 | * @remarks This function may be called before @ref glfwInit. |
| 865 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 866 | * @remarks This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 867 | * |
| 868 | * @sa glfwGetVersionString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 869 | * |
| 870 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 871 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 872 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 873 | |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 874 | /*! @brief Returns a string describing the compile-time configuration. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 875 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 876 | * This function returns a static string generated at compile-time according to |
| 877 | * which configuration macros were defined. This is intended for use when |
| 878 | * submitting bug reports, to allow developers to see which code paths are |
| 879 | * enabled in a binary. |
| 880 | * |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 881 | * The format of the string is as follows: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 882 | * - The version of GLFW |
| 883 | * - The name of the window system API |
| 884 | * - The name of the context creation API |
| 885 | * - Any additional options or APIs |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 886 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 887 | * For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 888 | * back ends, the version string may look something like this: |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 889 | * |
| 890 | * 3.0.0 Win32 WGL MinGW |
| 891 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 892 | * @return The GLFW version string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 893 | * |
| 894 | * @remarks This function may be called before @ref glfwInit. |
| 895 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 896 | * @remarks This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 897 | * |
| 898 | * @sa glfwGetVersion |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 899 | * |
| 900 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 901 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 902 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 903 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 904 | /*! @brief Sets the error callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 905 | * |
| 906 | * This function sets the error callback, which is called with an error code |
| 907 | * and a human-readable description each time a GLFW error occurs. |
| 908 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 909 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 910 | * callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 911 | * |
| 912 | * @remarks This function may be called before @ref glfwInit. |
| 913 | * |
Camilla Berglund | 9bfb925 | 2013-01-07 17:22:02 +0100 | [diff] [blame] | 914 | * @note The error callback is called by the thread where the error was |
| 915 | * generated. If you are using GLFW from multiple threads, your error callback |
| 916 | * needs to be written accordingly. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 917 | * |
| 918 | * @note Because the description string provided to the callback may have been |
| 919 | * generated specifically for that error, it is not guaranteed to be valid |
| 920 | * after the callback has returned. If you wish to use it after that, you need |
| 921 | * to make your own copy of it before returning. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 922 | * |
| 923 | * @ingroup error |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 924 | */ |
Camilla Berglund | f1e7d7c | 2010-11-23 17:45:23 +0100 | [diff] [blame] | 925 | GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 926 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 927 | /*! @brief Returns the currently connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 928 | * |
| 929 | * This function returns an array of handles for all currently connected |
| 930 | * monitors. |
| 931 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 932 | * @param[out] count The size of the returned array. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 933 | * @return An array of monitor handles, or `NULL` if an error occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 934 | * |
| 935 | * @note The returned array is valid only until the monitor configuration |
| 936 | * changes. See @ref glfwSetMonitorCallback to receive notifications of |
| 937 | * configuration changes. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 938 | * |
| 939 | * @sa glfwGetPrimaryMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 940 | * |
| 941 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 942 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 943 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 944 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 945 | /*! @brief Returns the primary monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 946 | * |
| 947 | * This function returns the primary monitor. This is usually the monitor |
| 948 | * where elements like the Windows task bar or the OS X menu bar is located. |
| 949 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 950 | * @return The primary monitor, or `NULL` if an error occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 951 | * |
| 952 | * @sa glfwGetMonitors |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 953 | * |
| 954 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 955 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 956 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 957 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 958 | /*! @brief Returns the position of the monitor's viewport on the virtual screen. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 959 | * |
| 960 | * This function returns the position, in screen coordinates, of the upper-left |
| 961 | * corner of the specified monitor. |
| 962 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 963 | * @param[in] monitor The monitor to query. |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 964 | * @param[out] xpos The monitor x-coordinate. |
| 965 | * @param[out] ypos The monitor y-coordinate. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 966 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 967 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 968 | */ |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 969 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
| 970 | |
| 971 | /*! @brief Returns the physical size of the monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 972 | * |
| 973 | * This function returns the size, in millimetres, of the display area of the |
| 974 | * specified monitor. |
| 975 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 976 | * @param[in] monitor The monitor to query. |
| 977 | * @param[out] width The width, in mm, of the monitor's display |
| 978 | * @param[out] height The height, in mm, of the monitor's display. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 979 | * |
| 980 | * @note Some operating systems do not provide accurate information, either |
| 981 | * because the monitor's EDID data is incorrect, or because the driver does not |
| 982 | * report it accurately. |
| 983 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 984 | * @ingroup monitor |
| 985 | */ |
| 986 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 987 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 988 | /*! @brief Returns the name of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 989 | * |
| 990 | * This function returns a human-readable name, encoded as UTF-8, of the |
| 991 | * specified monitor. |
| 992 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 993 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 994 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an error |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 995 | * occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 996 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 997 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 998 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 999 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1000 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1001 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1002 | * |
| 1003 | * This function sets the monitor configuration callback, or removes the |
| 1004 | * currently set callback. This is called when a monitor is connected to or |
| 1005 | * disconnected from the system. |
| 1006 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1007 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1008 | * callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1009 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1010 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1011 | */ |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 1012 | GLFWAPI void glfwSetMonitorCallback(GLFWmonitorfun cbfun); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 1013 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1014 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1015 | * |
| 1016 | * This function returns an array of all video modes supported by the specified |
| 1017 | * monitor. |
| 1018 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1019 | * @param[in] monitor The monitor to query. |
| 1020 | * @param[out] count The number of video modes in the returned array. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1021 | * @return An array of video modes, or `NULL` if an error occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1022 | * |
| 1023 | * @note The returned array is valid only until this function is called again |
| 1024 | * for this monitor. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1025 | * |
| 1026 | * @sa glfwGetVideoMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1027 | * |
| 1028 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1029 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1030 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1031 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1032 | /*! @brief Returns the current mode of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1033 | * |
| 1034 | * This function returns the current video mode of the specified monitor. |
| 1035 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1036 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 1037 | * @return The current mode of the monitor, or all zeroes if an error occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1038 | * |
| 1039 | * @sa glfwGetVideoModes |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1040 | * |
| 1041 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1042 | */ |
Camilla Berglund | 316ee1d | 2013-01-05 22:07:06 +0100 | [diff] [blame] | 1043 | GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1044 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1045 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1046 | * |
| 1047 | * This function generates a gamma ramp from the specified exponent and then |
| 1048 | * calls @ref glfwSetGamma with it. |
| 1049 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1050 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1051 | * @param[in] gamma The desired exponent. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1052 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1053 | * @ingroup gamma |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1054 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1055 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1056 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1057 | /*! @brief Retrieves the current gamma ramp for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1058 | * |
| 1059 | * This function retrieves the current gamma ramp of the specified monitor. |
| 1060 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1061 | * @param[in] monitor The monitor to query. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1062 | * @param[out] ramp Where to store the gamma ramp. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 1063 | * |
| 1064 | * @bug This function does not yet support monitors whose original gamma ramp |
| 1065 | * has more or less than 256 entries. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1066 | * |
| 1067 | * @ingroup gamma |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1068 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1069 | GLFWAPI void glfwGetGammaRamp(GLFWmonitor* monitor, GLFWgammaramp* ramp); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1070 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1071 | /*! @brief Sets the current gamma ramp for the specified monitor. |
| 1072 | * |
| 1073 | * This function sets the current gamma ramp for the specified monitor. |
| 1074 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1075 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1076 | * @param[in] ramp The gamma ramp to use. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 1077 | * |
| 1078 | * @bug This function does not yet support monitors whose original gamma ramp |
| 1079 | * has more or less than 256 entries. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1080 | * |
| 1081 | * @ingroup gamma |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1082 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1083 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1084 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1085 | /*! @brief Resets all window hints to their default values. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1086 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1087 | * This function resets all window hints to their |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1088 | * [default values](@ref window_hints_values). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1089 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1090 | * @note This function may only be called from the main thread. |
| 1091 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1092 | * @sa glfwWindowHint |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1093 | * |
| 1094 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1095 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 1096 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1097 | |
| 1098 | /*! @brief Sets the specified window hint to the desired value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1099 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 1100 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 1101 | * hints, once set, retain their values until changed by a call to @ref |
| 1102 | * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is |
| 1103 | * terminated with @ref glfwTerminate. |
| 1104 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1105 | * @param[in] target The [window hint](@ref window_hints) to set. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1106 | * @param[in] hint The new value of the window hint. |
| 1107 | * |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 1108 | * @par New in GLFW 3 |
| 1109 | * Hints are no longer reset to their default values on window creation. To |
| 1110 | * set default hint values, use @ref glfwDefaultWindowHints. |
| 1111 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1112 | * @note This function may only be called from the main thread. |
| 1113 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1114 | * @sa glfwDefaultWindowHints |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1115 | * |
| 1116 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1117 | */ |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 1118 | GLFWAPI void glfwWindowHint(int target, int hint); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1119 | |
| 1120 | /*! @brief Creates a window and its associated context. |
| 1121 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1122 | * This function creates a window and its associated context. Most of the |
| 1123 | * options controlling how the window and its context should be created are |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 1124 | * specified through @ref glfwWindowHint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1125 | * |
| 1126 | * Successful creation does not change which context is current. Before you |
| 1127 | * can use the newly created context, you need to make it current using @ref |
| 1128 | * glfwMakeContextCurrent. |
| 1129 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1130 | * Note that the created window and context may differ from what you requested, |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 1131 | * as not all parameters and hints are |
| 1132 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
| 1133 | * window, especially for full screen windows. To retrieve the actual |
| 1134 | * properties of the window and context, use queries like @ref |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1135 | * glfwGetWindowParam and @ref glfwGetWindowSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1136 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1137 | * @param[in] width The desired width, in screen coordinates, of the window. |
| 1138 | * This must be greater than zero. |
| 1139 | * @param[in] height The desired height, in screen coordinates, of the window. |
| 1140 | * This must be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1141 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1142 | * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1143 | * windowed mode. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1144 | * @param[in] share The window whose context to share resources with, or `NULL` |
| 1145 | * to not share resources. |
| 1146 | * @return The handle of the created window, or `NULL` if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1147 | * |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 1148 | * @remarks To create the window at a specific position, make it initially |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1149 | * invisible using the `GLFW_VISIBLE` window hint, set its position and then |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 1150 | * show it. |
| 1151 | * |
Camilla Berglund | 159f9b9 | 2013-04-10 01:57:43 +0200 | [diff] [blame] | 1152 | * @remarks If a fullscreen window is active, the screensaver is prohibited |
| 1153 | * from starting. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1154 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1155 | * @remarks **Windows:** If the executable has an icon resource named |
| 1156 | * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is |
| 1157 | * present, the `IDI_WINLOGO` icon will be used instead. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1158 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1159 | * @remarks **Mac OS X:** The GLFW window has no icon, as it is not a document |
| 1160 | * window, but the dock icon will be the same as the application bundle's icon. |
| 1161 | * Also, the first time a window is opened the menu bar is populated with |
| 1162 | * common commands like Hide, Quit and About. The (minimal) about dialog uses |
| 1163 | * information from the application's bundle. For more information on bundles, |
| 1164 | * see the Bundle Programming Guide provided by Apple. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1165 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1166 | * @note This function may only be called from the main thread. |
| 1167 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1168 | * @bug **Mac OS X:** The primary monitor is always used for full screen |
Camilla Berglund | bb10cae | 2013-03-12 19:39:25 +0100 | [diff] [blame] | 1169 | * windows, regardless of which monitor was specified. |
| 1170 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1171 | * @sa glfwDestroyWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1172 | * |
| 1173 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1174 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1175 | GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1176 | |
| 1177 | /*! @brief Destroys the specified window and its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1178 | * |
| 1179 | * This function destroys the specified window and its context. On calling |
| 1180 | * this function, no further callbacks will be called for that window. |
| 1181 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1182 | * @param[in] window The window to destroy. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1183 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1184 | * @note This function may only be called from the main thread. |
| 1185 | * |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 1186 | * @note This function may not be called from a callback. |
| 1187 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1188 | * @note If the window's context is current on the main thread, it is |
| 1189 | * detached before being destroyed. |
| 1190 | * |
| 1191 | * @warning The window's context must not be current on any other thread. |
| 1192 | * |
| 1193 | * @sa glfwCreateWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1194 | * |
| 1195 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1196 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1197 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1198 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1199 | /*! @brief Checks the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1200 | * |
| 1201 | * This function returns the value of the close flag of the specified window. |
| 1202 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1203 | * @param[in] window The window to query. |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1204 | * @return The value of the close flag. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1205 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1206 | * @ingroup window |
| 1207 | */ |
| 1208 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
| 1209 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1210 | /*! @brief Sets the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1211 | * |
| 1212 | * This function sets the value of the close flag of the specified window. |
| 1213 | * This can be used to override the user's attempt to close the window, or |
| 1214 | * to signal that it should be closed. |
| 1215 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1216 | * @param[in] window The window whose flag to change. |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1217 | * @param[in] value The new value. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1218 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1219 | * @ingroup window |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1220 | */ |
| 1221 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
| 1222 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1223 | /*! @brief Sets the title of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1224 | * |
| 1225 | * This function sets the window title, encoded as UTF-8, of the specified |
| 1226 | * window. |
| 1227 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1228 | * @param[in] window The window whose title to change. |
| 1229 | * @param[in] title The UTF-8 encoded window title. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1230 | * |
| 1231 | * @note This function may only be called from the main thread. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1232 | * |
| 1233 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1234 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1235 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1236 | |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1237 | /*! @brief Retrieves the position of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1238 | * |
| 1239 | * This function retrieves the position, in screen coordinates, of the |
| 1240 | * upper-left corner of the client area of the specified window. |
| 1241 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1242 | * @param[in] window The window to query. |
| 1243 | * @param[out] xpos The x-coordinate of the upper-left corner of the client area. |
| 1244 | * @param[out] ypos The y-coordinate of the upper-left corner of the client area. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1245 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1246 | * @remarks Either or both coordinate parameters may be `NULL`. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1247 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1248 | * @bug **Mac OS X:** The screen coordinate system is inverted. |
| 1249 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1250 | * @sa glfwSetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1251 | * |
| 1252 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1253 | */ |
| 1254 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
| 1255 | |
| 1256 | /*! @brief Sets the position of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1257 | * |
| 1258 | * This function sets the position, in screen coordinates, of the upper-left |
| 1259 | * corner of the client area of the window. |
| 1260 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1261 | * If it is a full screen window, this function does nothing. |
| 1262 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1263 | * @param[in] window The window to query. |
| 1264 | * @param[in] xpos The x-coordinate of the upper-left corner of the client area. |
| 1265 | * @param[in] ypos The y-coordinate of the upper-left corner of the client area. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1266 | * |
| 1267 | * @remarks If you wish to set an initial window position you should create |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1268 | * a hidden window (using @ref glfwWindowHint and `GLFW_VISIBLE`), set its |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1269 | * position and then show it. |
| 1270 | * |
| 1271 | * @note It is very rarely a good idea to move an already visible window, as it |
| 1272 | * will confuse and annoy the user. |
| 1273 | * |
| 1274 | * @note This function may only be called from the main thread. |
| 1275 | * |
| 1276 | * @note The window manager may put limits on what positions are allowed. |
| 1277 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1278 | * @bug **X11:** Some window managers ignore the set position of hidden (i.e. |
| 1279 | * unmapped) windows, instead placing them where it thinks is appropriate once |
| 1280 | * they are shown. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1281 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1282 | * @bug **Mac OS X:** The screen coordinate system is inverted. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1283 | * |
| 1284 | * @sa glfwGetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1285 | * |
| 1286 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1287 | */ |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 1288 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1289 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1290 | /*! @brief Retrieves the size of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1291 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1292 | * This function retrieves the size, in screen coordinates, of the client area |
| 1293 | * of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1294 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1295 | * @param[in] window The window whose size to retrieve. |
| 1296 | * @param[out] width The width of the client area. |
| 1297 | * @param[out] height The height of the client area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1298 | * |
| 1299 | * @sa glfwSetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1300 | * |
| 1301 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1302 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1303 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1304 | |
| 1305 | /*! @brief Sets the size of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1306 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1307 | * This function sets the size, in screen coordinates, of the client area of |
| 1308 | * the specified window. |
| 1309 | * |
| 1310 | * For full screen windows, this function selects and switches to the resolution |
| 1311 | * closest to the specified size, without affecting the window's context. As |
| 1312 | * the context is unaffected, the bit depths of the framebuffer remain |
| 1313 | * unchanged. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1314 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1315 | * @param[in] window The window to resize. |
| 1316 | * @param[in] width The desired width of the specified window. |
| 1317 | * @param[in] height The desired height of the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1318 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1319 | * @note This function may only be called from the main thread. |
| 1320 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1321 | * @note The window manager may put limits on what window sizes are allowed. |
| 1322 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1323 | * @sa glfwGetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1324 | * |
| 1325 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1326 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1327 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1328 | |
| 1329 | /*! @brief Iconifies the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1330 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1331 | * This function iconifies/minimizes the specified window, if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1332 | * restored. If it is a full screen window, the original monitor resolution is |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1333 | * restored until the window is restored. If the window is already iconified, |
| 1334 | * this function does nothing. |
| 1335 | * |
| 1336 | * @param[in] window The window to iconify. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1337 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1338 | * @note This function may only be called from the main thread. |
| 1339 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1340 | * @bug **Mac OS X:** This function is not yet implemented for |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1341 | * full screen windows. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 1342 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1343 | * @sa glfwRestoreWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1344 | * |
| 1345 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1346 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1347 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1348 | |
| 1349 | /*! @brief Restores the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1350 | * |
| 1351 | * This function restores the specified window, if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1352 | * iconified/minimized. If it is a full screen window, the resolution chosen |
| 1353 | * for the window is restored on the selected monitor. If the window is |
| 1354 | * already restored, this function does nothing. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1355 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1356 | * @param[in] window The window to restore. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1357 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1358 | * @note This function may only be called from the main thread. |
| 1359 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1360 | * @bug **Mac OS X:** This function is not yet implemented for full screen |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1361 | * windows. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 1362 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1363 | * @sa glfwIconifyWindow |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1364 | * |
| 1365 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1366 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1367 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1368 | |
| 1369 | /*! @brief Makes the specified window visible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1370 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1371 | * This function makes the specified window visible, if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1372 | * hidden. If the window is already visible or is in full screen mode, this |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1373 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1374 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1375 | * @param[in] window The window to make visible. |
| 1376 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1377 | * @note This function may only be called from the main thread. |
| 1378 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1379 | * @sa glfwHideWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1380 | * |
| 1381 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1382 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1383 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1384 | |
| 1385 | /*! @brief Hides the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1386 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1387 | * This function hides the specified window, if it was previously visible. If |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1388 | * the window is already hidden or is in full screen mode, this function does |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1389 | * nothing. |
| 1390 | * |
| 1391 | * @param[in] window The window to hide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1392 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1393 | * @note This function may only be called from the main thread. |
| 1394 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1395 | * @sa glfwShowWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1396 | * |
| 1397 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1398 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1399 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1400 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1401 | /*! @brief Returns the monitor that the window uses for full screen mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1402 | * |
| 1403 | * This function returns the handle of the monitor that the specified window is |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1404 | * in full screen on. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1405 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1406 | * @param[in] window The window to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1407 | * @return The monitor, or `NULL` if the window is in windowed mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1408 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1409 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1410 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1411 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1412 | |
Camilla Berglund | f8f81e5 | 2013-02-28 21:15:04 +0100 | [diff] [blame] | 1413 | /*! @brief Returns a parameter of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1414 | * |
| 1415 | * This function returns a property of the specified window. There are many |
| 1416 | * different properties, some related to the window and others to its context. |
| 1417 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1418 | * @param[in] window The window to query. |
Camilla Berglund | f8f81e5 | 2013-02-28 21:15:04 +0100 | [diff] [blame] | 1419 | * @param[in] param The parameter whose value to return. |
| 1420 | * @return The value of the parameter, or zero if an error occurred. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1421 | * |
Camilla Berglund | f8f81e5 | 2013-02-28 21:15:04 +0100 | [diff] [blame] | 1422 | * @par Window parameters |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1423 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1424 | * The `GLFW_FOCUSED` parameter indicates whether the window is focused. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1425 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1426 | * The `GLFW_ICONIFIED` parameter indicates whether the window is iconified. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1427 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1428 | * The `GLFW_VISIBLE` parameter indicates whether the window is visible. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1429 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1430 | * The `GLFW_RESIZABLE` parameter indicates whether the window is resizable |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1431 | * by the user. |
| 1432 | * |
Camilla Berglund | 7b5b33e | 2013-04-08 15:28:38 +0200 | [diff] [blame] | 1433 | * The `GLFW_DECORATED` parameter indicates whether the window is decorated. |
| 1434 | * |
Camilla Berglund | f8f81e5 | 2013-02-28 21:15:04 +0100 | [diff] [blame] | 1435 | * @par Context parameters |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1436 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1437 | * The `GLFW_CLIENT_API` parameter indicates the client API provided by the |
| 1438 | * window's context; either `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1439 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1440 | * The `GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and |
| 1441 | * `GLFW_CONTEXT_REVISION` parameters indicate the client API version of the |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1442 | * window's context. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1443 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1444 | * The `GLFW_OPENGL_FORWARD_COMPAT` parameter is `GL_TRUE` if the window's |
| 1445 | * context is an OpenGL forward-compatible one, or `GL_FALSE` otherwise. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1446 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1447 | * The `GLFW_OPENGL_DEBUG_CONTEXT` parameter is `GL_TRUE` if the window's |
| 1448 | * context is an OpenGL debug context, or `GL_FALSE` otherwise. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1449 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1450 | * The `GLFW_OPENGL_PROFILE` parameter indicates the OpenGL profile used by the |
| 1451 | * context. This is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` |
| 1452 | * if the context uses a known profile, or `GLFW_OPENGL_NO_PROFILE` if the |
| 1453 | * OpenGL profile is unknown or the context is for another client API. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1454 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1455 | * The `GLFW_CONTEXT_ROBUSTNESS` parameter indicates the robustness strategy |
| 1456 | * used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or |
| 1457 | * `GLFW_NO_RESET_NOTIFICATION` if the window's context supports robustness, or |
| 1458 | * `GLFW_NO_ROBUSTNESS` otherwise. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1459 | * |
| 1460 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1461 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1462 | GLFWAPI int glfwGetWindowParam(GLFWwindow* window, int param); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1463 | |
| 1464 | /*! @brief Sets the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1465 | * |
| 1466 | * This function sets the user-defined pointer of the specified window. The |
| 1467 | * current value is retained until the window is destroyed. The initial value |
| 1468 | * is `NULL`. |
| 1469 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1470 | * @param[in] window The window whose pointer to set. |
| 1471 | * @param[in] pointer The new value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1472 | * |
| 1473 | * @sa glfwGetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1474 | * |
| 1475 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1476 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1477 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1478 | |
| 1479 | /*! @brief Returns the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1480 | * |
| 1481 | * This function returns the current value of the user-defined pointer of the |
| 1482 | * specified window. The initial value is `NULL`. |
| 1483 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1484 | * @param[in] window The window whose pointer to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1485 | * |
| 1486 | * @sa glfwSetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1487 | * |
| 1488 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1489 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1490 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1491 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1492 | /*! @brief Sets the position callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1493 | * |
| 1494 | * This function sets the position callback of the specified window, which is |
| 1495 | * called when the window is moved. The callback is provided with the screen |
| 1496 | * position of the upper-left corner of the client area of the window. |
| 1497 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1498 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1499 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1500 | * callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1501 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1502 | * @ingroup window |
| 1503 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1504 | GLFWAPI void glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1505 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1506 | /*! @brief Sets the size callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1507 | * |
| 1508 | * This function sets the size callback of the specified window, which is |
| 1509 | * called when the window is resized. The callback is provided with the size, |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1510 | * in screen coordinates, of the client area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1511 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1512 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1513 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1514 | * callback. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1515 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1516 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1517 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1518 | GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1519 | |
| 1520 | /*! @brief Sets the close callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1521 | * |
| 1522 | * This function sets the close callback of the specified window, which is |
| 1523 | * called when the user attempts to close the window, for example by clicking |
| 1524 | * the close widget in the title bar. |
| 1525 | * |
| 1526 | * The close flag is set before this callback is called, but you can modify it |
| 1527 | * at any time with @ref glfwSetWindowShouldClose. |
| 1528 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1529 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1530 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1531 | * callback. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1532 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1533 | * @remarks Calling @ref glfwDestroyWindow does not cause this callback to be |
| 1534 | * called. |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1535 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1536 | * @remarks **Mac OS X:** Selecting Quit from the application menu will |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1537 | * trigger the close callback for all windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1538 | * |
| 1539 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1540 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1541 | GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1542 | |
| 1543 | /*! @brief Sets the refresh callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1544 | * |
| 1545 | * This function sets the refresh callback of the specified window, which is |
| 1546 | * called when the client area of the window needs to be redrawn, for example |
| 1547 | * if the window has been exposed after having been covered by another window. |
| 1548 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1549 | * On compositing window systems such as Aero, Compiz or Aqua, where the window |
| 1550 | * contents are saved off-screen, this callback may be called only very |
| 1551 | * infrequently or never at all. |
| 1552 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1553 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1554 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1555 | * callback. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1556 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1557 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1558 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1559 | GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1560 | |
| 1561 | /*! @brief Sets the focus callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1562 | * |
| 1563 | * This function sets the focus callback of the specified window, which is |
| 1564 | * called when the window gains or loses focus. |
| 1565 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1566 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1567 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1568 | * callback. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1569 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1570 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1571 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1572 | GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1573 | |
| 1574 | /*! @brief Sets the iconify callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1575 | * |
| 1576 | * This function sets the iconification callback of the specified window, which |
| 1577 | * is called when the window is iconified or restored. |
| 1578 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1579 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1580 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1581 | * callback. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1582 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1583 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1584 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1585 | GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1586 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1587 | /*! @brief Processes all pending events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1588 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1589 | * This function processes only those events that have already been received |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1590 | * and then returns immediately. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1591 | * |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 1592 | * @par New in GLFW 3 |
| 1593 | * This function is no longer called by @ref glfwSwapBuffers. You need to call |
| 1594 | * it or @ref glfwWaitEvents yourself. |
| 1595 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1596 | * @note This function may only be called from the main thread. |
| 1597 | * |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 1598 | * @note This function may not be called from a callback. |
| 1599 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1600 | * @sa glfwWaitEvents |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1601 | * |
| 1602 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1603 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1604 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1605 | |
| 1606 | /*! @brief Waits until events are pending and processes them. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1607 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1608 | * This function blocks until at least one event has been received and then |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1609 | * processes all received events before returning. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1610 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1611 | * @note This function may only be called from the main thread. |
| 1612 | * |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 1613 | * @note This function may not be called from a callback. |
| 1614 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1615 | * @sa glfwPollEvents |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1616 | * |
| 1617 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1618 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1619 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1620 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1621 | /*! @brief Returns the value of an input option for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1622 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1623 | * @param[in] window The window to query. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1624 | * @param[in] mode One of `GLFW_CURSOR_MODE`, `GLFW_STICKY_KEYS` or |
| 1625 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1626 | * |
| 1627 | * @sa glfwSetInputMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1628 | * |
| 1629 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1630 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1631 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1632 | |
| 1633 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1634 | * @param[in] window The window whose input mode to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1635 | * @param[in] mode One of `GLFW_CURSOR_MODE`, `GLFW_STICKY_KEYS` or |
| 1636 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1637 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1638 | * |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1639 | * If `mode` is `GLFW_CURSOR_MODE`, the value must be one of the supported input |
| 1640 | * modes: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 1641 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
| 1642 | * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1643 | * area of the window. |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 1644 | * - `GLFW_CURSOR_CAPTURED` makes the cursor invisible and unable to leave the |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1645 | * window but unconstrained in terms of position. |
| 1646 | * |
| 1647 | * If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to |
| 1648 | * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are |
| 1649 | * enabled, a key press will ensure that @ref glfwGetKey returns @ref |
| 1650 | * GLFW_PRESS the next time it is called even if the key had been released |
| 1651 | * before the call. |
| 1652 | * |
| 1653 | * If `mode` is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either `GL_TRUE` |
| 1654 | * to enable sticky mouse buttons, or `GL_FALSE` to disable it. If sticky |
| 1655 | * mouse buttons are enabled, a mouse button press will ensure that @ref |
| 1656 | * glfwGetMouseButton returns @ref GLFW_PRESS the next time it is called even |
| 1657 | * if the mouse button had been released before the call. |
| 1658 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1659 | * @bug **Mac OS X:** The @ref GLFW_CURSOR_HIDDEN value of @ref |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 1660 | * GLFW_CURSOR_MODE is not yet implemented. |
| 1661 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1662 | * @sa glfwGetInputMode |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1663 | * |
| 1664 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1665 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1666 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1667 | |
| 1668 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 1669 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1670 | * |
| 1671 | * This function returns the last state reported for the specified key to the |
| 1672 | * specified window. The returned state is one of `GLFW_PRESS` or |
| 1673 | * `GLFW_RELEASE`. The higher-level state `GLFW_REPEAT` is only reported to |
| 1674 | * the key callback. |
| 1675 | * |
| 1676 | * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns |
| 1677 | * `GLFW_PRESS` the first time you call this function after a key has been |
| 1678 | * pressed, even if the key has already been released. |
| 1679 | * |
| 1680 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 1681 | * named after their use on the standard US keyboard layout. If you want to |
| 1682 | * input text, use the Unicode character callback instead. |
| 1683 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1684 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1685 | * @param[in] key The desired [keyboard key](@ref keys). |
| 1686 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1687 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1688 | * @ingroup input |
| 1689 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1690 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1691 | |
| 1692 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 1693 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1694 | * |
| 1695 | * This function returns the last state reported for the specified mouse button |
| 1696 | * to the specified window. |
| 1697 | * |
| 1698 | * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function |
| 1699 | * returns `GLFW_PRESS` the first time you call this function after a mouse |
| 1700 | * button has been pressed, even if the mouse button has already been released. |
| 1701 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1702 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1703 | * @param[in] button The desired [mouse button](@ref buttons). |
| 1704 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1705 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1706 | * @ingroup input |
| 1707 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1708 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1709 | |
| 1710 | /*! @brief Retrieves the last reported cursor position, relative to the client |
| 1711 | * area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1712 | * |
| 1713 | * This function returns the last reported position of the cursor to the |
| 1714 | * specified window. |
| 1715 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1716 | * @param[in] window The desired window. |
| 1717 | * @param[out] xpos The cursor x-coordinate, relative to the left edge of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1718 | * client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1719 | * @param[out] ypos The cursor y-coordinate, relative to the to top edge of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1720 | * client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1721 | * |
| 1722 | * @sa glfwSetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1723 | * |
| 1724 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1725 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 1726 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1727 | |
| 1728 | /*! @brief Sets the position of the cursor, relative to the client area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1729 | * |
| 1730 | * This function sets the position of the cursor. The specified window must be |
| 1731 | * focused. If the window does not have focus when this function is called, it |
| 1732 | * fails silently. |
| 1733 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1734 | * @param[in] window The desired window. |
| 1735 | * @param[in] xpos The desired x-coordinate, relative to the left edge of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1736 | * client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1737 | * @param[in] ypos The desired y-coordinate, relative to the top edge of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1738 | * client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1739 | * |
| 1740 | * @sa glfwGetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1741 | * |
| 1742 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1743 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 1744 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1745 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1746 | /*! @brief Sets the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1747 | * |
| 1748 | * This function sets the key callback of the specific window, which is called |
| 1749 | * when a key is pressed, repeated or released. |
| 1750 | * |
| 1751 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 1752 | * named after their use on the standard US keyboard layout. If you want to |
| 1753 | * input text, use the [character callback](@ref glfwSetCharCallback) instead. |
| 1754 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1755 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1756 | * @param[in] cbfun The new key callback, or `NULL` to remove the currently |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1757 | * set callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1758 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1759 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1760 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1761 | GLFWAPI void glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1762 | |
| 1763 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1764 | * |
| 1765 | * This function sets the character callback of the specific window, which is |
| 1766 | * called when a Unicode character is input. |
| 1767 | * |
| 1768 | * The character callback is intended for text input. If you want to know |
| 1769 | * whether a specific key was pressed or released, use the |
| 1770 | * [key callback](@ref glfwSetKeyCallback) instead. |
| 1771 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1772 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1773 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1774 | * callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1775 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1776 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1777 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1778 | GLFWAPI void glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1779 | |
| 1780 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1781 | * |
| 1782 | * This function sets the mouse button callback of the specified window, which |
| 1783 | * is called when a mouse button is pressed or released. |
| 1784 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1785 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1786 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1787 | * callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1788 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1789 | * @ingroup input |
| 1790 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1791 | GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1792 | |
| 1793 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1794 | * |
| 1795 | * This function sets the cursor position callback of the specified window, |
| 1796 | * which is called when the cursor is moved. The callback is provided with the |
| 1797 | * position relative to the upper-left corner of the client area of the window. |
| 1798 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1799 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1800 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1801 | * callback. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1802 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1803 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1804 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1805 | GLFWAPI void glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1806 | |
| 1807 | /*! @brief Sets the cursor enter/exit callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1808 | * |
| 1809 | * This function sets the cursor boundary crossing callback of the specified |
| 1810 | * window, which is called when the cursor enters or leaves the client area of |
| 1811 | * the window. |
| 1812 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1813 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1814 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1815 | * callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1816 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1817 | * @ingroup input |
| 1818 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1819 | GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1820 | |
| 1821 | /*! @brief Sets the scroll callback. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1822 | * |
| 1823 | * This function sets the scroll callback of the specified window, which is |
| 1824 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
| 1825 | * area of a touchpad. |
| 1826 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1827 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1828 | * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1829 | * set callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1830 | * |
Camilla Berglund | a59c82c | 2013-03-01 15:20:29 +0100 | [diff] [blame] | 1831 | * @remarks This receives all scrolling input, like that from a mouse wheel or |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1832 | * a touchpad scrolling area. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1833 | * |
| 1834 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1835 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1836 | GLFWAPI void glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1837 | |
Camilla Berglund | f8f81e5 | 2013-02-28 21:15:04 +0100 | [diff] [blame] | 1838 | /*! @brief Returns a parameter of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1839 | * |
| 1840 | * This function returns a parameter of the specified joystick. |
| 1841 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1842 | * @param[in] joy The joystick to query. |
Camilla Berglund | f8f81e5 | 2013-02-28 21:15:04 +0100 | [diff] [blame] | 1843 | * @param[in] param The parameter whose value to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1844 | * @return The specified joystick's current value, or zero if the joystick is |
| 1845 | * not present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1846 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1847 | * @ingroup input |
| 1848 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1849 | GLFWAPI int glfwGetJoystickParam(int joy, int param); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1850 | |
| 1851 | /*! @brief Returns the values of axes of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1852 | * |
| 1853 | * This function returns the current positions of axes of the specified |
| 1854 | * joystick. |
| 1855 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1856 | * @param[in] joy The joystick to query. |
| 1857 | * @param[out] axes The array to hold the values. |
| 1858 | * @param[in] numaxes The size of the provided array. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1859 | * @return The number of values written to `axes`, or zero if an error |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 1860 | * occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1861 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1862 | * @ingroup input |
| 1863 | */ |
Camilla Berglund | 2502e4d | 2012-08-29 18:31:12 +0200 | [diff] [blame] | 1864 | GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1865 | |
| 1866 | /*! @brief Returns the values of buttons of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1867 | * |
| 1868 | * This function returns the current state of buttons of the specified |
| 1869 | * joystick. |
| 1870 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1871 | * @param[in] joy The joystick to query. |
| 1872 | * @param[out] buttons The array to hold the values. |
| 1873 | * @param[in] numbuttons The size of the provided array. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1874 | * @return The number of values written to `buttons`, or zero if an error |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 1875 | * occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1876 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1877 | * @ingroup input |
| 1878 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1879 | GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1880 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 1881 | /*! @brief Returns the name of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1882 | * |
| 1883 | * This function returns the name, encoded as UTF-8, of the specified joystick. |
| 1884 | * |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 1885 | * @param[in] joy The joystick to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1886 | * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 1887 | * is not present. |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 1888 | * |
| 1889 | * @note The returned string is valid only until the next call to @ref |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1890 | * glfwGetJoystickName for that joystick. |
| 1891 | * |
| 1892 | * @ingroup input |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 1893 | */ |
Camilla Berglund | 93a1d1c | 2012-09-07 01:01:34 +0200 | [diff] [blame] | 1894 | GLFWAPI const char* glfwGetJoystickName(int joy); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1895 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1896 | /*! @brief Sets the clipboard to the specified string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1897 | * |
| 1898 | * This function sets the system clipboard to the specified, UTF-8 encoded |
| 1899 | * string. The string is copied before returning, so you don't have to retain |
| 1900 | * it afterwards. |
| 1901 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1902 | * @param[in] window The window that will own the clipboard contents. |
| 1903 | * @param[in] string A UTF-8 encoded string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1904 | * |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1905 | * @note This function may only be called from the main thread. |
| 1906 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1907 | * @sa glfwGetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1908 | * |
| 1909 | * @ingroup clipboard |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1910 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1911 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1912 | |
| 1913 | /*! @brief Retrieves the contents of the clipboard as a string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1914 | * |
| 1915 | * This function returns the contents of the system clipboard, if it contains |
| 1916 | * or is convertible to a UTF-8 encoded string. |
| 1917 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1918 | * @param[in] window The window that will request the clipboard contents. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1919 | * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL` |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 1920 | * if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1921 | * |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1922 | * @note This function may only be called from the main thread. |
| 1923 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1924 | * @note The returned string is valid only until the next call to @ref |
| 1925 | * glfwGetClipboardString or @ref glfwSetClipboardString. |
| 1926 | * |
| 1927 | * @sa glfwSetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1928 | * |
| 1929 | * @ingroup clipboard |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1930 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1931 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 1932 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1933 | /*! @brief Returns the value of the GLFW timer. |
| 1934 | * |
| 1935 | * This function returns the value of the GLFW timer. Unless the timer has |
| 1936 | * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW |
| 1937 | * was initialized. |
| 1938 | * |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 1939 | * @return The current value, in seconds, or zero if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1940 | * |
| 1941 | * @remarks This function may be called from secondary threads. |
| 1942 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1943 | * @note The resolution of the timer is system dependent, but is usually on the |
| 1944 | * order of a few micro- or nanoseconds. It uses the highest-resolution |
| 1945 | * monotonic time source on each supported platform. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1946 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1947 | * @ingroup time |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1948 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1949 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1950 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1951 | /*! @brief Sets the GLFW timer. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1952 | * |
| 1953 | * This function sets the value of the GLFW timer. It then continues to count |
| 1954 | * up from that value. |
| 1955 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1956 | * @param[in] time The new value, in seconds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1957 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1958 | * @note The resolution of the timer is system dependent, but is usually on the |
| 1959 | * order of a few micro- or nanoseconds. It uses the highest-resolution |
| 1960 | * monotonic time source on each supported platform. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1961 | * |
| 1962 | * @ingroup time |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1963 | */ |
| 1964 | GLFWAPI void glfwSetTime(double time); |
| 1965 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1966 | /*! @brief Makes the context of the specified window current for the calling |
| 1967 | * thread. |
| 1968 | * |
| 1969 | * This function makes the context of the specified window current on the |
| 1970 | * calling thread. A context can only be made current on a single thread at |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1971 | * a time and each thread can have only a single current context at a time. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1972 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1973 | * @param[in] window The window whose context to make current, or `NULL` to |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1974 | * detach the current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1975 | * |
| 1976 | * @remarks This function may be called from secondary threads. |
| 1977 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1978 | * @sa glfwGetCurrentContext |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1979 | * |
| 1980 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1981 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1982 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1983 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1984 | /*! @brief Returns the window whose context is current on the calling thread. |
| 1985 | * |
| 1986 | * This function returns the window whose context is current on the calling |
| 1987 | * thread. |
| 1988 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1989 | * @return The window whose context is current, or `NULL` if no window's |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1990 | * context is current. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1991 | * |
| 1992 | * @remarks This function may be called from secondary threads. |
| 1993 | * |
| 1994 | * @sa glfwMakeContextCurrent |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1995 | * |
| 1996 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1997 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1998 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1999 | |
| 2000 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2001 | * |
| 2002 | * This function swaps the front and back buffers of the specified window. If |
| 2003 | * the swap interval is greater than zero, the GPU driver waits the specified |
| 2004 | * number of screen updates before swapping the buffers. |
| 2005 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 2006 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2007 | * |
| 2008 | * @remarks This function may be called from secondary threads. |
| 2009 | * |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 2010 | * @par New in GLFW 3 |
| 2011 | * This function no longer calls @ref glfwPollEvents. You need to call it or |
| 2012 | * @ref glfwWaitEvents yourself. |
| 2013 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2014 | * @sa glfwSwapInterval |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2015 | * |
| 2016 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2017 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2018 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2019 | |
| 2020 | /*! @brief Sets the swap interval for the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2021 | * |
| 2022 | * This function sets the swap interval for the current context, i.e. the |
| 2023 | * number of screen updates to wait before swapping the buffers of a window and |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2024 | * returning from @ref glfwSwapBuffers. This is sometimes called 'vertical |
| 2025 | * synchronization', 'vertical retrace synchronization' or 'vsync'. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2026 | * |
| 2027 | * @param[in] interval The minimum number of screen updates to wait for |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2028 | * until the buffers are swapped by @ref glfwSwapBuffers. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2029 | * |
| 2030 | * @remarks This function may be called from secondary threads. |
| 2031 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2032 | * @remarks Contexts that support either of the `WGL_EXT_swap_control_tear` and |
| 2033 | * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals, |
| 2034 | * which allow the driver to swap even if a frame arrives a little bit late. |
| 2035 | * You can check for the presence of these extensions using @ref |
| 2036 | * glfwExtensionSupported. For more information about swap tearing, see the |
| 2037 | * extension specifications. |
| 2038 | * |
| 2039 | * @note Some GPU drivers do not honor the requested swap interval, either |
| 2040 | * because of user settings that override the request or due to bugs in the |
| 2041 | * driver. |
| 2042 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2043 | * @sa glfwSwapBuffers |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2044 | * |
| 2045 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2046 | */ |
| 2047 | GLFWAPI void glfwSwapInterval(int interval); |
| 2048 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2049 | /*! @brief Returns whether the specified extension is available. |
| 2050 | * |
| 2051 | * This function returns whether the specified OpenGL or platform-specific |
| 2052 | * context creation API extension is supported by the current context. For |
| 2053 | * example, on Windows both the OpenGL and WGL extension strings are checked. |
| 2054 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2055 | * @param[in] extension The ASCII encoded name of the extension. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2056 | * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2057 | * |
| 2058 | * @remarks This function may be called from secondary threads. |
| 2059 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2060 | * @note As this functions searches one or more extension strings on each call, |
| 2061 | * it is recommended that you cache its results if it's going to be used |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2062 | * frequently. The extension strings will not change during the lifetime of |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2063 | * a context, so there is no danger in doing this. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2064 | * |
| 2065 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2066 | */ |
| 2067 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 2068 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2069 | /*! @brief Returns the address of the specified function for the current |
| 2070 | * context. |
| 2071 | * |
| 2072 | * This function returns the address of the specified client API function, if |
| 2073 | * it is supported by the current context. |
| 2074 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2075 | * @param[in] procname The ASCII encoded name of the function. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2076 | * @return The address of the function, or `NULL` if the function is |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2077 | * unavailable. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2078 | * |
| 2079 | * @remarks This function may be called from secondary threads. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2080 | * |
| 2081 | * @note The addresses of these functions are not guaranteed to be the same for |
| 2082 | * all contexts, especially if they use different client APIs or even different |
| 2083 | * context creation hints. |
| 2084 | * |
| 2085 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2086 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 2087 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2088 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2089 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 2090 | /************************************************************************* |
| 2091 | * Global definition cleanup |
| 2092 | *************************************************************************/ |
| 2093 | |
| 2094 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 2095 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 2096 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 2097 | #undef WINGDIAPI |
| 2098 | #undef GLFW_WINGDIAPI_DEFINED |
| 2099 | #endif |
| 2100 | |
| 2101 | #ifdef GLFW_CALLBACK_DEFINED |
| 2102 | #undef CALLBACK |
| 2103 | #undef GLFW_CALLBACK_DEFINED |
| 2104 | #endif |
| 2105 | |
| 2106 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 2107 | |
| 2108 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2109 | #ifdef __cplusplus |
| 2110 | } |
| 2111 | #endif |
| 2112 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 2113 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2114 | |