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 | |
| 42 | /*! @mainpage notitle |
| 43 | * |
| 44 | * @section intro Introduction |
| 45 | * |
| 46 | * This is the reference documentation for the GLFW library. |
| 47 | */ |
| 48 | |
| 49 | /*! @defgroup clipboard Clipboard support |
| 50 | */ |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 51 | /*! @defgroup context Context handling |
| 52 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 53 | /*! @defgroup error Error handling |
| 54 | */ |
| 55 | /*! @defgroup gamma Gamma ramp support |
| 56 | */ |
| 57 | /*! @defgroup init Initialization and version information |
| 58 | */ |
| 59 | /*! @defgroup input Input handling |
| 60 | */ |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 61 | /*! @defgroup monitor Monitor handling |
| 62 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 63 | /*! @defgroup time Time input |
| 64 | */ |
| 65 | /*! @defgroup window Window handling |
| 66 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 67 | * The primary purpose of GLFW is to provide a simple interface to window |
| 68 | * management and OpenGL and OpenGL ES context creation. GLFW supports |
| 69 | * multiple windows, which can be either a normal desktop window or |
| 70 | * a fullscreen window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 71 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 72 | |
| 73 | |
| 74 | /************************************************************************* |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 75 | * Global definitions |
| 76 | *************************************************************************/ |
| 77 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 78 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 79 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 80 | /* Please report any problems that you find with your compiler, which may |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 81 | * be solved in this section! There are several compilers that I have not |
| 82 | * been able to test this file with yet. |
| 83 | * |
| 84 | * First: If we are we on Windows, we want a single define for it (_WIN32) |
| 85 | * (Note: For Cygwin the compiler flag -mwin32 should be used, but to |
| 86 | * make sure that things run smoothly for Cygwin users, we add __CYGWIN__ |
| 87 | * to the list of "valid Win32 identifiers", which removes the need for |
| 88 | * -mwin32) |
| 89 | */ |
| 90 | #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)) |
| 91 | #define _WIN32 |
| 92 | #endif /* _WIN32 */ |
| 93 | |
| 94 | /* In order for extension support to be portable, we need to define an |
| 95 | * OpenGL function call method. We use the keyword APIENTRY, which is |
| 96 | * defined for Win32. (Note: Windows also needs this for <GL/gl.h>) |
| 97 | */ |
| 98 | #ifndef APIENTRY |
| 99 | #ifdef _WIN32 |
| 100 | #define APIENTRY __stdcall |
| 101 | #else |
| 102 | #define APIENTRY |
| 103 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 104 | #endif /* APIENTRY */ |
| 105 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 106 | /* The following three defines are here solely to make some Windows-based |
| 107 | * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but |
| 108 | * it has the major drawback of severely polluting our namespace. |
| 109 | */ |
| 110 | |
| 111 | /* Under Windows, we need WINGDIAPI defined */ |
| 112 | #if !defined(WINGDIAPI) && defined(_WIN32) |
| 113 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__) |
| 114 | /* Microsoft Visual C++, Borland C++ Builder and Pelles C */ |
| 115 | #define WINGDIAPI __declspec(dllimport) |
| 116 | #elif defined(__LCC__) |
| 117 | /* LCC-Win32 */ |
| 118 | #define WINGDIAPI __stdcall |
| 119 | #else |
| 120 | /* Others (e.g. MinGW, Cygwin) */ |
| 121 | #define WINGDIAPI extern |
| 122 | #endif |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 123 | #define GLFW_WINGDIAPI_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 124 | #endif /* WINGDIAPI */ |
| 125 | |
| 126 | /* Some <GL/glu.h> files also need CALLBACK defined */ |
| 127 | #if !defined(CALLBACK) && defined(_WIN32) |
| 128 | #if defined(_MSC_VER) |
| 129 | /* Microsoft Visual C++ */ |
| 130 | #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) |
| 131 | #define CALLBACK __stdcall |
| 132 | #else |
| 133 | #define CALLBACK |
| 134 | #endif |
| 135 | #else |
| 136 | /* Other Windows compilers */ |
| 137 | #define CALLBACK __stdcall |
| 138 | #endif |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 139 | #define GLFW_CALLBACK_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 140 | #endif /* CALLBACK */ |
| 141 | |
Camilla Berglund | 3c912cb | 2012-08-02 21:25:00 +0200 | [diff] [blame] | 142 | /* Most <GL/glu.h> variants on Windows need wchar_t */ |
| 143 | #if defined(_WIN32) |
| 144 | #include <stddef.h> |
| 145 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 146 | |
| 147 | |
| 148 | /* ---------------- GLFW related system specific defines ----------------- */ |
| 149 | |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 150 | #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) |
| 151 | #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" |
| 152 | #endif |
| 153 | |
Camilla Berglund | 2588c9b | 2012-03-25 17:40:30 +0200 | [diff] [blame] | 154 | #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 155 | |
| 156 | /* We are building a Win32 DLL */ |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 157 | #define GLFWAPI __declspec(dllexport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 158 | |
| 159 | #elif defined(_WIN32) && defined(GLFW_DLL) |
| 160 | |
| 161 | /* We are calling a Win32 DLL */ |
| 162 | #if defined(__LCC__) |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 163 | #define GLFWAPI extern |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 164 | #else |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 165 | #define GLFWAPI __declspec(dllimport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 166 | #endif |
| 167 | |
| 168 | #else |
| 169 | |
| 170 | /* We are either building/calling a static lib or we are non-win32 */ |
| 171 | #define GLFWAPI |
| 172 | |
| 173 | #endif |
| 174 | |
| 175 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 176 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 177 | /* Include the chosen client API headers. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 178 | */ |
| 179 | #if defined(__APPLE_CC__) |
Camilla Berglund | 410a4e2 | 2012-09-27 22:28:04 +0200 | [diff] [blame] | 180 | #if defined(GLFW_INCLUDE_GLCOREARB) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 181 | #include <OpenGL/gl3.h> |
| 182 | #else |
| 183 | #define GL_GLEXT_LEGACY |
| 184 | #include <OpenGL/gl.h> |
| 185 | #endif |
Camilla Berglund | 2213450 | 2012-06-05 23:55:10 +0200 | [diff] [blame] | 186 | #if defined(GLFW_INCLUDE_GLU) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 187 | #include <OpenGL/glu.h> |
| 188 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 189 | #else |
Camilla Berglund | 410a4e2 | 2012-09-27 22:28:04 +0200 | [diff] [blame] | 190 | #if defined(GLFW_INCLUDE_GLCOREARB) |
| 191 | #include <GL/glcorearb.h> |
Jari Vetoniemi | 38c4a8e | 2012-11-10 00:08:44 +0200 | [diff] [blame] | 192 | #elif defined(GLFW_INCLUDE_ES1) |
| 193 | #include <GLES/gl.h> |
Camilla Berglund | 3fd1774 | 2012-07-19 23:20:47 +0200 | [diff] [blame] | 194 | #elif defined(GLFW_INCLUDE_ES2) |
| 195 | #include <GLES2/gl2.h> |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 196 | #else |
| 197 | #include <GL/gl.h> |
| 198 | #endif |
Camilla Berglund | 2213450 | 2012-06-05 23:55:10 +0200 | [diff] [blame] | 199 | #if defined(GLFW_INCLUDE_GLU) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 200 | #include <GL/glu.h> |
| 201 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 202 | #endif |
| 203 | |
| 204 | |
| 205 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 206 | * GLFW API tokens |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 207 | *************************************************************************/ |
| 208 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 209 | /*! @name GLFW version macros |
| 210 | * @{ */ |
| 211 | /*! @brief The major version number of the GLFW library. |
| 212 | * |
| 213 | * This is incremented when the API is changed in non-compatible ways. |
| 214 | * @ingroup init |
| 215 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 216 | #define GLFW_VERSION_MAJOR 3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 217 | /*! @brief The minor version number of the GLFW library. |
| 218 | * |
| 219 | * This is incremented when features are added to the API but it remains |
| 220 | * backward-compatible. |
| 221 | * @ingroup init |
| 222 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 223 | #define GLFW_VERSION_MINOR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 224 | /*! @brief The revision number of the GLFW library. |
| 225 | * |
| 226 | * This is incremented when a bug fix release is made that does not contain any |
| 227 | * API changes. |
| 228 | * @ingroup init |
| 229 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 230 | #define GLFW_VERSION_REVISION 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 231 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 232 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 233 | /*! @name Key and button actions |
| 234 | * @{ */ |
| 235 | /*! @brief The key or button was released. |
| 236 | * @ingroup input |
| 237 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 238 | #define GLFW_RELEASE 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 239 | /*! @brief The key or button was pressed. |
| 240 | * @ingroup input |
| 241 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 242 | #define GLFW_PRESS 1 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 243 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 244 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 245 | /* Keyboard raw key codes. |
| 246 | * These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60), |
| 247 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
| 248 | * put in the 256+ range). |
| 249 | * The naming of the key codes follow these rules: |
| 250 | * - The US keyboard layout is used. |
| 251 | * - Names of printable alpha-numeric characters are used (e.g. "A", "R", |
| 252 | * "3", etc). |
| 253 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
| 254 | * "COMMA", "LEFT_SQUARE_BRACKET", etc). Note that some names do not |
| 255 | * correspond to the Unicode standard (usually for brevity). |
| 256 | * - Keys that lack a clear US mapping are named "WORLD_x". |
| 257 | * - For non-printable keys, custom names are used (e.g. "F4", |
| 258 | * "BACKSPACE", etc). |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 259 | */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 260 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 261 | /*! @defgroup keys Keyboard keys |
| 262 | * @ingroup input |
| 263 | * @{ |
| 264 | */ |
| 265 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 266 | /* Printable keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 267 | #define GLFW_KEY_SPACE 32 |
| 268 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
| 269 | #define GLFW_KEY_COMMA 44 /* , */ |
| 270 | #define GLFW_KEY_MINUS 45 /* - */ |
| 271 | #define GLFW_KEY_PERIOD 46 /* . */ |
| 272 | #define GLFW_KEY_SLASH 47 /* / */ |
| 273 | #define GLFW_KEY_0 48 |
| 274 | #define GLFW_KEY_1 49 |
| 275 | #define GLFW_KEY_2 50 |
| 276 | #define GLFW_KEY_3 51 |
| 277 | #define GLFW_KEY_4 52 |
| 278 | #define GLFW_KEY_5 53 |
| 279 | #define GLFW_KEY_6 54 |
| 280 | #define GLFW_KEY_7 55 |
| 281 | #define GLFW_KEY_8 56 |
| 282 | #define GLFW_KEY_9 57 |
| 283 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
| 284 | #define GLFW_KEY_EQUAL 61 /* = */ |
| 285 | #define GLFW_KEY_A 65 |
| 286 | #define GLFW_KEY_B 66 |
| 287 | #define GLFW_KEY_C 67 |
| 288 | #define GLFW_KEY_D 68 |
| 289 | #define GLFW_KEY_E 69 |
| 290 | #define GLFW_KEY_F 70 |
| 291 | #define GLFW_KEY_G 71 |
| 292 | #define GLFW_KEY_H 72 |
| 293 | #define GLFW_KEY_I 73 |
| 294 | #define GLFW_KEY_J 74 |
| 295 | #define GLFW_KEY_K 75 |
| 296 | #define GLFW_KEY_L 76 |
| 297 | #define GLFW_KEY_M 77 |
| 298 | #define GLFW_KEY_N 78 |
| 299 | #define GLFW_KEY_O 79 |
| 300 | #define GLFW_KEY_P 80 |
| 301 | #define GLFW_KEY_Q 81 |
| 302 | #define GLFW_KEY_R 82 |
| 303 | #define GLFW_KEY_S 83 |
| 304 | #define GLFW_KEY_T 84 |
| 305 | #define GLFW_KEY_U 85 |
| 306 | #define GLFW_KEY_V 86 |
| 307 | #define GLFW_KEY_W 87 |
| 308 | #define GLFW_KEY_X 88 |
| 309 | #define GLFW_KEY_Y 89 |
| 310 | #define GLFW_KEY_Z 90 |
| 311 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
| 312 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
| 313 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
| 314 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
| 315 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
| 316 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 317 | |
| 318 | /* Function keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 319 | #define GLFW_KEY_ESCAPE 256 |
| 320 | #define GLFW_KEY_ENTER 257 |
| 321 | #define GLFW_KEY_TAB 258 |
| 322 | #define GLFW_KEY_BACKSPACE 259 |
| 323 | #define GLFW_KEY_INSERT 260 |
| 324 | #define GLFW_KEY_DELETE 261 |
| 325 | #define GLFW_KEY_RIGHT 262 |
| 326 | #define GLFW_KEY_LEFT 263 |
| 327 | #define GLFW_KEY_DOWN 264 |
| 328 | #define GLFW_KEY_UP 265 |
| 329 | #define GLFW_KEY_PAGE_UP 266 |
| 330 | #define GLFW_KEY_PAGE_DOWN 267 |
| 331 | #define GLFW_KEY_HOME 268 |
| 332 | #define GLFW_KEY_END 269 |
| 333 | #define GLFW_KEY_CAPS_LOCK 280 |
| 334 | #define GLFW_KEY_SCROLL_LOCK 281 |
| 335 | #define GLFW_KEY_NUM_LOCK 282 |
| 336 | #define GLFW_KEY_PRINT_SCREEN 283 |
| 337 | #define GLFW_KEY_PAUSE 284 |
| 338 | #define GLFW_KEY_F1 290 |
| 339 | #define GLFW_KEY_F2 291 |
| 340 | #define GLFW_KEY_F3 292 |
| 341 | #define GLFW_KEY_F4 293 |
| 342 | #define GLFW_KEY_F5 294 |
| 343 | #define GLFW_KEY_F6 295 |
| 344 | #define GLFW_KEY_F7 296 |
| 345 | #define GLFW_KEY_F8 297 |
| 346 | #define GLFW_KEY_F9 298 |
| 347 | #define GLFW_KEY_F10 299 |
| 348 | #define GLFW_KEY_F11 300 |
| 349 | #define GLFW_KEY_F12 301 |
| 350 | #define GLFW_KEY_F13 302 |
| 351 | #define GLFW_KEY_F14 303 |
| 352 | #define GLFW_KEY_F15 304 |
| 353 | #define GLFW_KEY_F16 305 |
| 354 | #define GLFW_KEY_F17 306 |
| 355 | #define GLFW_KEY_F18 307 |
| 356 | #define GLFW_KEY_F19 308 |
| 357 | #define GLFW_KEY_F20 309 |
| 358 | #define GLFW_KEY_F21 310 |
| 359 | #define GLFW_KEY_F22 311 |
| 360 | #define GLFW_KEY_F23 312 |
| 361 | #define GLFW_KEY_F24 313 |
| 362 | #define GLFW_KEY_F25 314 |
| 363 | #define GLFW_KEY_KP_0 320 |
| 364 | #define GLFW_KEY_KP_1 321 |
| 365 | #define GLFW_KEY_KP_2 322 |
| 366 | #define GLFW_KEY_KP_3 323 |
| 367 | #define GLFW_KEY_KP_4 324 |
| 368 | #define GLFW_KEY_KP_5 325 |
| 369 | #define GLFW_KEY_KP_6 326 |
| 370 | #define GLFW_KEY_KP_7 327 |
| 371 | #define GLFW_KEY_KP_8 328 |
| 372 | #define GLFW_KEY_KP_9 329 |
| 373 | #define GLFW_KEY_KP_DECIMAL 330 |
| 374 | #define GLFW_KEY_KP_DIVIDE 331 |
| 375 | #define GLFW_KEY_KP_MULTIPLY 332 |
| 376 | #define GLFW_KEY_KP_SUBTRACT 333 |
| 377 | #define GLFW_KEY_KP_ADD 334 |
| 378 | #define GLFW_KEY_KP_ENTER 335 |
| 379 | #define GLFW_KEY_KP_EQUAL 336 |
| 380 | #define GLFW_KEY_LEFT_SHIFT 340 |
| 381 | #define GLFW_KEY_LEFT_CONTROL 341 |
| 382 | #define GLFW_KEY_LEFT_ALT 342 |
| 383 | #define GLFW_KEY_LEFT_SUPER 343 |
| 384 | #define GLFW_KEY_RIGHT_SHIFT 344 |
| 385 | #define GLFW_KEY_RIGHT_CONTROL 345 |
| 386 | #define GLFW_KEY_RIGHT_ALT 346 |
| 387 | #define GLFW_KEY_RIGHT_SUPER 347 |
| 388 | #define GLFW_KEY_MENU 348 |
| 389 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 390 | |
| 391 | /* GLFW 2.x key name aliases (deprecated) */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 392 | #define GLFW_KEY_ESC GLFW_KEY_ESCAPE |
| 393 | #define GLFW_KEY_DEL GLFW_KEY_DELETE |
| 394 | #define GLFW_KEY_PAGEUP GLFW_KEY_PAGE_UP |
| 395 | #define GLFW_KEY_PAGEDOWN GLFW_KEY_PAGE_DOWN |
| 396 | #define GLFW_KEY_KP_NUM_LOCK GLFW_KEY_NUM_LOCK |
| 397 | #define GLFW_KEY_LCTRL GLFW_KEY_LEFT_CONTROL |
| 398 | #define GLFW_KEY_LSHIFT GLFW_KEY_LEFT_SHIFT |
| 399 | #define GLFW_KEY_LALT GLFW_KEY_LEFT_ALT |
| 400 | #define GLFW_KEY_LSUPER GLFW_KEY_LEFT_SUPER |
| 401 | #define GLFW_KEY_RCTRL GLFW_KEY_RIGHT_CONTROL |
| 402 | #define GLFW_KEY_RSHIFT GLFW_KEY_RIGHT_SHIFT |
| 403 | #define GLFW_KEY_RALT GLFW_KEY_RIGHT_ALT |
| 404 | #define GLFW_KEY_RSUPER GLFW_KEY_RIGHT_SUPER |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 405 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 406 | /*! @} */ |
| 407 | |
| 408 | /*! @defgroup buttons Mouse buttons |
| 409 | * @ingroup input |
| 410 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 411 | #define GLFW_MOUSE_BUTTON_1 0 |
| 412 | #define GLFW_MOUSE_BUTTON_2 1 |
| 413 | #define GLFW_MOUSE_BUTTON_3 2 |
| 414 | #define GLFW_MOUSE_BUTTON_4 3 |
| 415 | #define GLFW_MOUSE_BUTTON_5 4 |
| 416 | #define GLFW_MOUSE_BUTTON_6 5 |
| 417 | #define GLFW_MOUSE_BUTTON_7 6 |
| 418 | #define GLFW_MOUSE_BUTTON_8 7 |
| 419 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
| 420 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
| 421 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
| 422 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 423 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 424 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 425 | /*! @defgroup joysticks Joysticks |
| 426 | * @ingroup input |
| 427 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 428 | #define GLFW_JOYSTICK_1 0 |
| 429 | #define GLFW_JOYSTICK_2 1 |
| 430 | #define GLFW_JOYSTICK_3 2 |
| 431 | #define GLFW_JOYSTICK_4 3 |
| 432 | #define GLFW_JOYSTICK_5 4 |
| 433 | #define GLFW_JOYSTICK_6 5 |
| 434 | #define GLFW_JOYSTICK_7 6 |
| 435 | #define GLFW_JOYSTICK_8 7 |
| 436 | #define GLFW_JOYSTICK_9 8 |
| 437 | #define GLFW_JOYSTICK_10 9 |
| 438 | #define GLFW_JOYSTICK_11 10 |
| 439 | #define GLFW_JOYSTICK_12 11 |
| 440 | #define GLFW_JOYSTICK_13 12 |
| 441 | #define GLFW_JOYSTICK_14 13 |
| 442 | #define GLFW_JOYSTICK_15 14 |
| 443 | #define GLFW_JOYSTICK_16 15 |
| 444 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 445 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 446 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 447 | /*! @defgroup errors Error codes |
| 448 | * @ingroup error |
| 449 | * @{ */ |
| 450 | /*! @brief No error has occurred. |
| 451 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 452 | #define GLFW_NO_ERROR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 453 | /*! @brief GLFW has not been initialized. |
| 454 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 455 | #define GLFW_NOT_INITIALIZED 0x00070001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 456 | /*! @brief No context is current for this thread. |
| 457 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 458 | #define GLFW_NO_CURRENT_CONTEXT 0x00070002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 459 | /*! @brief One of the enum parameters for the function was given an invalid |
| 460 | * enum. |
| 461 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 462 | #define GLFW_INVALID_ENUM 0x00070003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 463 | /*! @brief One of the parameters for the function was given an invalid value. |
| 464 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 465 | #define GLFW_INVALID_VALUE 0x00070004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 466 | /*! @brief A memory allocation failed. |
| 467 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 468 | #define GLFW_OUT_OF_MEMORY 0x00070005 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 469 | /*! @brief GLFW could not find support for the requested client API on the |
| 470 | * system. |
| 471 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 472 | #define GLFW_API_UNAVAILABLE 0x00070006 |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 473 | /*! @brief The requested client API version is not available. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 474 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 475 | #define GLFW_VERSION_UNAVAILABLE 0x00070007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 476 | /*! @brief A platform-specific error occurred that does not match any of the |
| 477 | * more specific categories. |
| 478 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 479 | #define GLFW_PLATFORM_ERROR 0x00070008 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 480 | /*! @brief The clipboard did not contain data in the requested format. |
| 481 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 482 | #define GLFW_FORMAT_UNAVAILABLE 0x00070009 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 483 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 484 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 485 | #define GLFW_FOCUSED 0x00020001 |
| 486 | #define GLFW_ICONIFIED 0x00020002 |
| 487 | #define GLFW_SHOULD_CLOSE 0x00020003 |
| 488 | #define GLFW_RESIZABLE 0x00022007 |
| 489 | #define GLFW_VISIBLE 0x00022008 |
| 490 | #define GLFW_POSITION_X 0x00022009 |
| 491 | #define GLFW_POSITION_Y 0x0002200A |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 492 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 493 | #define GLFW_CONTEXT_REVISION 0x00020004 |
| 494 | #define GLFW_RED_BITS 0x00021000 |
| 495 | #define GLFW_GREEN_BITS 0x00021001 |
| 496 | #define GLFW_BLUE_BITS 0x00021002 |
| 497 | #define GLFW_ALPHA_BITS 0x00021003 |
| 498 | #define GLFW_DEPTH_BITS 0x00021004 |
| 499 | #define GLFW_STENCIL_BITS 0x00021005 |
| 500 | #define GLFW_ACCUM_RED_BITS 0x00021006 |
| 501 | #define GLFW_ACCUM_GREEN_BITS 0x00021007 |
| 502 | #define GLFW_ACCUM_BLUE_BITS 0x00021008 |
| 503 | #define GLFW_ACCUM_ALPHA_BITS 0x00021009 |
| 504 | #define GLFW_AUX_BUFFERS 0x0002100A |
| 505 | #define GLFW_STEREO 0x0002100B |
| 506 | #define GLFW_SAMPLES 0x0002100C |
| 507 | #define GLFW_SRGB_CAPABLE 0x0002100D |
Camilla Berglund | deb0b3d | 2012-12-02 21:00:15 +0100 | [diff] [blame] | 508 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 509 | #define GLFW_CLIENT_API 0x00022000 |
| 510 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022001 |
| 511 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022002 |
| 512 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022003 |
| 513 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022004 |
| 514 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022005 |
| 515 | #define GLFW_OPENGL_PROFILE 0x00022006 |
| 516 | |
| 517 | #define GLFW_OPENGL_API 0x00000001 |
| 518 | #define GLFW_OPENGL_ES_API 0x00000002 |
| 519 | |
| 520 | #define GLFW_NO_ROBUSTNESS 0x00000000 |
| 521 | #define GLFW_NO_RESET_NOTIFICATION 0x00000001 |
| 522 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00000002 |
| 523 | |
| 524 | #define GLFW_OPENGL_NO_PROFILE 0x00000000 |
| 525 | #define GLFW_OPENGL_CORE_PROFILE 0x00000001 |
| 526 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00000002 |
| 527 | |
| 528 | #define GLFW_CURSOR_MODE 0x00030001 |
| 529 | #define GLFW_STICKY_KEYS 0x00030002 |
| 530 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00030003 |
| 531 | |
| 532 | #define GLFW_CURSOR_NORMAL 0x00040001 |
| 533 | #define GLFW_CURSOR_HIDDEN 0x00040002 |
| 534 | #define GLFW_CURSOR_CAPTURED 0x00040003 |
| 535 | |
| 536 | #define GLFW_PRESENT 0x00050001 |
| 537 | #define GLFW_AXES 0x00050002 |
| 538 | #define GLFW_BUTTONS 0x00050003 |
| 539 | |
| 540 | #define GLFW_GAMMA_RAMP_SIZE 256 |
| 541 | |
| 542 | #define GLFW_MONITOR_WIDTH_MM 0x00060001 |
| 543 | #define GLFW_MONITOR_HEIGHT_MM 0x00060002 |
Camilla Berglund | ac5fee4 | 2013-01-17 21:56:02 +0100 | [diff] [blame] | 544 | /* reuse GLFW_POSITION_X */ |
| 545 | /* reuse GLFW_POSITION_Y */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 546 | |
| 547 | #define GLFW_CONNECTED 0x00061000 |
| 548 | #define GLFW_DISCONNECTED 0x00061001 |
| 549 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 550 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 551 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 552 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 553 | *************************************************************************/ |
| 554 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 555 | /*! @brief Client API function pointer type. |
| 556 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 557 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 558 | typedef void (*GLFWglproc)(void); |
| 559 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 560 | /*! @brief Opaque monitor object. |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 561 | * @ingroup monitor |
| 562 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 563 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 564 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 565 | /*! @brief Opaque window object. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 566 | * @ingroup window |
| 567 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 568 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 569 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 570 | /*! @brief The function signature for error callbacks. |
| 571 | * @param[in] error An @link errors error code @endlink. |
| 572 | * @param[in] description A UTF-8 encoded string describing the error. |
| 573 | * @ingroup error |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 574 | * |
| 575 | * @sa glfwSetErrorCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 576 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 577 | typedef void (* GLFWerrorfun)(int,const char*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 578 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 579 | /*! @brief The function signature for window position callbacks. |
| 580 | * @param[in] window The window that the user moved. |
| 581 | * @param[in] x The new x-coordinate, in pixels, of the upper-left corner of |
| 582 | * the client area of the window. |
| 583 | * @param[in] y The new y-coordinate, in pixels, of the upper-left corner of |
| 584 | * the client area of the window. |
| 585 | * @ingroup window |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 586 | * |
| 587 | * @sa glfwSetWindowPosCallback |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 588 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 589 | typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 590 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 591 | /*! @brief The function signature for window resize callbacks. |
| 592 | * @param[in] window The window that the user resized. |
| 593 | * @param[in] width The new width, in pixels, of the window. |
| 594 | * @param[in] height The new height, in pixels, of the window. |
| 595 | * @ingroup window |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 596 | * |
| 597 | * @sa glfwSetWindowSizeCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 598 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 599 | typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 600 | |
| 601 | /*! @brief The function signature for window close callbacks. |
| 602 | * @param[in] window The window that the user attempted to close. |
| 603 | * @return @c GL_TRUE to allow the window to be closed, or @c GL_FALSE to |
| 604 | * ignore the attempt. |
| 605 | * @ingroup window |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 606 | * |
| 607 | * @sa glfwSetWindowCloseCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 608 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 609 | typedef int (* GLFWwindowclosefun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 610 | |
| 611 | /*! @brief The function signature for window content refresh callbacks. |
| 612 | * @param[in] window The window whose content needs to be refreshed. |
| 613 | * @ingroup window |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 614 | * |
| 615 | * @sa glfwSetWindowRefreshCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 616 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 617 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 618 | |
| 619 | /*! @brief The function signature for window focus/defocus callbacks. |
| 620 | * @param[in] window The window that was focused or defocused. |
| 621 | * @param[in] focused @c GL_TRUE if the window was focused, or @c GL_FALSE if |
| 622 | * it was defocused. |
| 623 | * @ingroup window |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 624 | * |
| 625 | * @sa glfwSetWindowFocusCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 626 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 627 | typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 628 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 629 | /*! @brief The function signature for window iconify/restore callbacks. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 630 | * @param[in] window The window that was iconified or restored. |
| 631 | * @param[in] iconified @c GL_TRUE if the window was iconified, or @c GL_FALSE |
| 632 | * if it was restored. |
| 633 | * @ingroup window |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 634 | * |
| 635 | * @sa glfwSetWindowIconifyCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 636 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 637 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 638 | |
| 639 | /*! @brief The function signature for mouse button callbacks. |
| 640 | * @param[in] window The window that received the event. |
| 641 | * @param[in] button The @link buttons mouse button @endlink that was pressed |
| 642 | * or released. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 643 | * @param[in] action One of @ref GLFW_PRESS or @ref GLFW_RELEASE. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 644 | * @ingroup input |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 645 | * |
| 646 | * @sa glfwSetMouseButtonCallback |
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 (* GLFWmousebuttonfun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 649 | |
| 650 | /*! @brief The function signature for cursor position callbacks. |
| 651 | * @param[in] window The window that received the event. |
| 652 | * @param[in] x The new x-coordinate of the cursor. |
| 653 | * @param[in] y The new y-coordinate of the cursor. |
| 654 | * @ingroup input |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 655 | * |
| 656 | * @sa glfwSetCursorPosCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 657 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 658 | typedef void (* GLFWcursorposfun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 659 | |
| 660 | /*! @brief The function signature for cursor enter/exit callbacks. |
| 661 | * @param[in] window The window that received the event. |
| 662 | * @param[in] entered @c GL_TRUE if the cursor entered the window's client |
| 663 | * area, or @c GL_FALSE if it left it. |
| 664 | * @ingroup input |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 665 | * |
| 666 | * @sa glfwSetCursorEnterCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 667 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 668 | typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 669 | |
| 670 | /*! @brief The function signature for scroll callbacks. |
| 671 | * @param[in] window The window that received the event. |
| 672 | * @param[in] x The scroll offset along the x-axis. |
| 673 | * @param[in] y The scroll offset along the y-axis. |
| 674 | * @ingroup input |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 675 | * |
| 676 | * @sa glfwSetScrollCallback |
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 (* GLFWscrollfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 679 | |
| 680 | /*! @brief The function signature for keyboard key callbacks. |
| 681 | * @param[in] window The window that received the event. |
| 682 | * @param[in] key The @link keys keyboard key @endlink that was pressed or |
| 683 | * released. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 684 | * @param[in] action One of @ref GLFW_PRESS or @ref GLFW_RELEASE. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 685 | * @ingroup input |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 686 | * |
| 687 | * @sa glfwSetKeyCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 688 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 689 | typedef void (* GLFWkeyfun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 690 | |
| 691 | /*! @brief The function signature for Unicode character callbacks. |
| 692 | * @param[in] window The window that received the event. |
| 693 | * @param[in] character The Unicode code point of the character. |
| 694 | * @ingroup input |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 695 | * |
| 696 | * @sa glfwSetCharCallback |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 697 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 698 | typedef void (* GLFWcharfun)(GLFWwindow*,int); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 699 | |
| 700 | /*! @brief The function signature for monitor configuration callbacks. |
| 701 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 702 | * @param[in] event One of @ref GLFW_CONNECTED or @ref GLFW_DISCONNECTED. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 703 | * @ingroup monitor |
| 704 | * |
| 705 | * @sa glfwSetMonitorCallback |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 706 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 707 | typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 708 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 709 | /* @brief Video mode type. |
| 710 | * @ingroup monitor |
| 711 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 712 | typedef struct |
| 713 | { |
| 714 | int width; |
| 715 | int height; |
| 716 | int redBits; |
| 717 | int blueBits; |
| 718 | int greenBits; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 719 | } GLFWvidmode; |
| 720 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 721 | /*! @brief Gamma ramp. |
| 722 | * @ingroup gamma |
| 723 | */ |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 724 | typedef struct |
| 725 | { |
| 726 | unsigned short red[GLFW_GAMMA_RAMP_SIZE]; |
| 727 | unsigned short green[GLFW_GAMMA_RAMP_SIZE]; |
| 728 | unsigned short blue[GLFW_GAMMA_RAMP_SIZE]; |
| 729 | } GLFWgammaramp; |
| 730 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 731 | |
| 732 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 733 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 734 | *************************************************************************/ |
| 735 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 736 | /*! @brief Initializes the GLFW library. |
| 737 | * |
| 738 | * Before most GLFW functions can be used, GLFW must be initialized, and before |
| 739 | * a program terminates GLFW should be terminated in order to free allocated |
| 740 | * resources, memory, etc. |
| 741 | * |
| 742 | * @return @c GL_TRUE if successful, or @c GL_FALSE if an error occurred. |
| 743 | * @ingroup init |
| 744 | * |
| 745 | * @remarks Additional calls to this function after successful initialization |
| 746 | * but before termination will succeed but will do nothing. |
| 747 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 748 | * @note This function may only be called from the main thread. |
| 749 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 750 | * @note This function may take several seconds to complete on some systems, |
| 751 | * while on other systems it may take only a fraction of a second to complete. |
| 752 | * |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 753 | * @note <b>Mac OS X:</b> This function will change the current directory of the |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 754 | * application to the @c Contents/Resources subdirectory of the application's |
| 755 | * bundle, if present. |
| 756 | * |
| 757 | * @sa glfwTerminate |
| 758 | */ |
| 759 | GLFWAPI int glfwInit(void); |
| 760 | |
| 761 | /*! @brief Terminates the GLFW library. |
| 762 | * @ingroup init |
| 763 | * |
| 764 | * @remarks This function may be called before @ref glfwInit. |
| 765 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 766 | * @note This function may only be called from the main thread. |
| 767 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 768 | * @note This function closes all GLFW windows. |
| 769 | * |
| 770 | * @note This function should be called before the program exits. |
| 771 | * |
| 772 | * @warning No window's context may be current on another thread when this |
| 773 | * function is called. |
| 774 | * |
| 775 | * @sa glfwInit |
| 776 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 777 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 778 | |
| 779 | /*! @brief Retrieves the version of the GLFW library. |
| 780 | * @param[out] major Where to store the major version number, or @c NULL. |
| 781 | * @param[out] minor Where to store the minor version number, or @c NULL. |
| 782 | * @param[out] rev Where to store the revision number, or @c NULL. |
| 783 | * @ingroup init |
| 784 | * |
| 785 | * @remarks This function may be called before @ref glfwInit. |
| 786 | * |
| 787 | * @remarks This function may be called from secondary threads. |
| 788 | * |
| 789 | * @sa glfwGetVersionString |
| 790 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 791 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 792 | |
| 793 | /*! @brief Returns the version string of the GLFW library. |
| 794 | * |
| 795 | * The version string contains information about what compile-time options were |
| 796 | * enabled when the library was built. |
| 797 | * |
| 798 | * @return The GLFW version string. |
| 799 | * @ingroup init |
| 800 | * |
| 801 | * @remarks This function may be called before @ref glfwInit. |
| 802 | * |
| 803 | * @remarks This function may be called from secondary threads. |
| 804 | * |
| 805 | * @sa glfwGetVersion |
| 806 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 807 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 808 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 809 | /*! @brief Sets the error callback. |
| 810 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 811 | * callback. |
| 812 | * @ingroup error |
| 813 | * |
| 814 | * @remarks This function may be called before @ref glfwInit. |
| 815 | * |
Camilla Berglund | 9bfb925 | 2013-01-07 17:22:02 +0100 | [diff] [blame] | 816 | * @note The error callback is called by the thread where the error was |
| 817 | * generated. If you are using GLFW from multiple threads, your error callback |
| 818 | * needs to be written accordingly. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 819 | * |
| 820 | * @note Because the description string provided to the callback may have been |
| 821 | * generated specifically for that error, it is not guaranteed to be valid |
| 822 | * after the callback has returned. If you wish to use it after that, you need |
| 823 | * to make your own copy of it before returning. |
| 824 | */ |
Camilla Berglund | f1e7d7c | 2010-11-23 17:45:23 +0100 | [diff] [blame] | 825 | GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 826 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 827 | /*! @brief Returns the currently connected monitors. |
| 828 | * @param[out] count The size of the returned array. |
| 829 | * @return An array of monitor handles. |
| 830 | * @ingroup monitor |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 831 | * |
| 832 | * @sa glfwGetPrimaryMonitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 833 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 834 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 835 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 836 | /*! @brief Returns the primary monitor. |
| 837 | * @return The primary monitor. |
| 838 | * @ingroup monitor |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 839 | * |
| 840 | * @sa glfwGetMonitors |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 841 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 842 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 843 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 844 | /*! @brief Returns a property of the specified monitor. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 845 | * @param[in] monitor The monitor to query. |
| 846 | * @param[in] param The property whose value to return. |
| 847 | * @return The value of the property, or zero if an error occurred. |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 848 | * @ingroup monitor |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 849 | * |
| 850 | * @par Monitor properties |
| 851 | * |
| 852 | * The @ref GLFW_MONITOR_WIDTH_MM and @ref GLFW_MONITOR_HEIGHT_MM properties |
| 853 | * indicate the physical with, in mm, of the monitor. |
| 854 | * |
| 855 | * The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y properties indiciate the |
| 856 | * position, in virtual screen coordinates, of the monitor's viewport. |
| 857 | * |
| 858 | * @sa glfwGetVideoMode, glfwGetVideoModes, glfwGetMonitorName |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 859 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 860 | GLFWAPI int glfwGetMonitorParam(GLFWmonitor* monitor, int param); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 861 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 862 | /*! @brief Returns the name of the specified monitor. |
| 863 | * @param[in] monitor The monitor to query. |
| 864 | * @return The UTF-8 encoded name of the monitor. |
| 865 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 866 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 867 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 868 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 869 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 870 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 871 | * callback. |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 872 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 873 | */ |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 874 | GLFWAPI void glfwSetMonitorCallback(GLFWmonitorfun cbfun); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 875 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 876 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 877 | * @param[in] monitor The monitor to query. |
| 878 | * @param[out] count The number of video modes in the returned array. |
| 879 | * @return An array of video modes. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 880 | * @ingroup monitor |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 881 | * |
| 882 | * @sa glfwGetVideoMode |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 883 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 884 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 885 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 886 | /*! @brief Returns the current mode of the specified monitor. |
| 887 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 888 | * @return The current mode of the monitor. |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 889 | * @ingroup monitor |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 890 | * |
| 891 | * @sa glfwGetVideoModes |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 892 | */ |
Camilla Berglund | 316ee1d | 2013-01-05 22:07:06 +0100 | [diff] [blame] | 893 | GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 894 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 895 | /*! @brief Sets the system gamma ramp for all connected monitors to one |
| 896 | * generated from the specified exponent. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 897 | * @param[in] gamma The desired exponent. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 898 | * @ingroup gamma |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 899 | * |
| 900 | * @remarks This is a helper function layered on top of @ref glfwSetGammaRamp. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 901 | */ |
Camilla Berglund | ca0dbdb | 2011-09-06 15:43:31 +0200 | [diff] [blame] | 902 | GLFWAPI void glfwSetGamma(float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 903 | |
| 904 | /*! @brief Retrieves the current system gamma ramp. |
| 905 | * @param[out] ramp Where to store the gamma ramp. |
| 906 | * @ingroup gamma |
| 907 | */ |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 908 | GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 909 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 910 | /*! @brief Sets the system gamma ramp for all connected monitors to the one |
| 911 | * specified. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 912 | * @param[in] ramp The gamma ramp to use. |
| 913 | * @ingroup gamma |
| 914 | */ |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 915 | GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp); |
| 916 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 917 | /*! @brief Resets all window hints to their default values |
| 918 | * |
| 919 | * The @ref GLFW_RED_BITS, @ref GLFW_GREEN_BITS, @ref GLFW_BLUE_BITS, @ref |
| 920 | * GLFW_ALPHA_BITS and @ref GLFW_STENCIL_BITS hints are set to 8. |
| 921 | * |
| 922 | * The @ref GLFW_DEPTH_BITS hint is set to 24. |
| 923 | * |
| 924 | * The @ref GLFW_VISIBLE and @ref GLFW_RESIZABLE hints are set to 1. |
| 925 | * |
| 926 | * The @ref GLFW_CLIENT_API hint is set to @ref GLFW_OPENGL_API. |
| 927 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 928 | * The @ref GLFW_CONTEXT_VERSION_MAJOR and @ref GLFW_CONTEXT_VERSION_MINOR |
| 929 | * hints are set to 1 and 0, respectively. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 930 | * |
Camilla Berglund | 1395ec2 | 2012-12-22 19:21:35 +0100 | [diff] [blame] | 931 | * The @ref GLFW_CONTEXT_ROBUSTNESS hint is set to @ref GLFW_NO_ROBUSTNESS. |
| 932 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 933 | * The @ref GLFW_OPENGL_PROFILE hint is set to @ref GLFW_OPENGL_NO_PROFILE. |
| 934 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 935 | * All other hints are set to 0. |
| 936 | * |
| 937 | * @ingroup window |
| 938 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 939 | * @note This function may only be called from the main thread. |
| 940 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 941 | * @sa glfwWindowHint |
| 942 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 943 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 944 | |
| 945 | /*! @brief Sets the specified window hint to the desired value. |
| 946 | * @param[in] target The window hint to set. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 947 | * @param[in] hint The new value of the window hint. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 948 | * @ingroup window |
| 949 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 950 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 951 | * hints, once set, retain their values until changed by a call to @ref |
| 952 | * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is |
| 953 | * terminated with @ref glfwTerminate. |
| 954 | * |
Camilla Berglund | d406b48 | 2013-01-17 18:10:28 +0100 | [diff] [blame] | 955 | * @par Hard and soft constraints |
| 956 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 957 | * Some window hints are hard constraints. These must match the available |
| 958 | * capabilities @em exactly for window and context creation to succeed. Hints |
| 959 | * that are not hard constraints are matched as closely as possible, but the |
| 960 | * resulting window and context may differ from what these hints requested. To |
| 961 | * find out the actual properties of the created window and context, use the |
| 962 | * @ref glfwGetWindowParam function. |
| 963 | * |
| 964 | * The following hints are hard constraints: |
| 965 | * @arg @ref GLFW_STEREO |
| 966 | * @arg @ref GLFW_CLIENT_API |
| 967 | * |
| 968 | * The following additional hints are hard constraints if requesting an OpenGL |
| 969 | * context: |
| 970 | * @arg @ref GLFW_OPENGL_FORWARD_COMPAT |
| 971 | * @arg @ref GLFW_OPENGL_PROFILE |
| 972 | * |
| 973 | * Hints that do not apply to a given type of window or context are ignored. |
| 974 | * |
| 975 | * @par Framebuffer hints |
| 976 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 977 | * The @ref GLFW_RED_BITS, @ref GLFW_GREEN_BITS, @ref GLFW_BLUE_BITS, @ref |
| 978 | * GLFW_ALPHA_BITS, @ref GLFW_DEPTH_BITS and @ref GLFW_STENCIL_BITS hints |
| 979 | * specify the desired bit depths of the various components of the default |
| 980 | * framebuffer. |
| 981 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 982 | * The @ref GLFW_ACCUM_RED_BITS, @ref GLFW_ACCUM_GREEN_BITS, @ref |
| 983 | * GLFW_ACCUM_BLUE_BITS and @ref GLFW_ACCUM_ALPHA_BITS hints specify the |
| 984 | * desired bit depths of the various components of the accumulation buffer. |
| 985 | * |
| 986 | * The @ref GLFW_AUX_BUFFERS hint specifies the desired number of auxiliary |
| 987 | * buffers. |
| 988 | * |
| 989 | * The @ref GLFW_STEREO hint specifies whether to use stereoscopic rendering. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 990 | * |
Camilla Berglund | 21f41a2 | 2012-12-31 19:45:13 +0100 | [diff] [blame] | 991 | * The @ref GLFW_SAMPLES hint specifies the desired number of samples to use |
| 992 | * for multisampling. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 993 | * |
Camilla Berglund | 69a9005 | 2012-12-02 16:10:00 +0100 | [diff] [blame] | 994 | * The @ref GLFW_SRGB_CAPABLE hint specifies whether the framebuffer should be |
| 995 | * sRGB capable. |
| 996 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 997 | * @par Context hints |
| 998 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 999 | * The @ref GLFW_CLIENT_API hint specifies which client API to create the |
| 1000 | * context for. Possible values are @ref GLFW_OPENGL_API and @ref |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1001 | * GLFW_OPENGL_ES_API. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1002 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1003 | * The @ref GLFW_CONTEXT_VERSION_MAJOR and @ref GLFW_CONTEXT_VERSION_MINOR |
| 1004 | * hints specify the client API version that the created context must be |
| 1005 | * compatible with. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1006 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1007 | * For OpenGL, these hints are @em not hard constraints, as they don't have to |
| 1008 | * match exactly, but @ref glfwCreateWindow will still fail if the resulting |
| 1009 | * OpenGL version is less than the one requested. It is therefore perfectly |
| 1010 | * safe to use the default of version 1.0 for legacy code and you will still |
| 1011 | * get backwards-compatible contexts of version 3.0 and above when available. |
| 1012 | * |
| 1013 | * For OpenGL ES, these hints are hard constraints, as there is no backward |
| 1014 | * compatibility between OpenGL ES versions. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1015 | * |
Camilla Berglund | 1395ec2 | 2012-12-22 19:21:35 +0100 | [diff] [blame] | 1016 | * If an OpenGL context is requested, the @ref GLFW_OPENGL_FORWARD_COMPAT hint |
| 1017 | * specifies whether the OpenGL context should be forward-compatible, i.e. one |
| 1018 | * where all functionality deprecated in the requested version of OpenGL is |
| 1019 | * removed. This may only be used if the requested OpenGL version is 3.0 or |
| 1020 | * above. If another client API is requested, this hint is ignored. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1021 | * |
Camilla Berglund | 1395ec2 | 2012-12-22 19:21:35 +0100 | [diff] [blame] | 1022 | * If an OpenGL context is requested, the @ref GLFW_OPENGL_DEBUG_CONTEXT hint |
| 1023 | * specifies whether to create a debug OpenGL context, which may have |
| 1024 | * additional error and performance issue reporting functionality. If another |
| 1025 | * client API is requested, this hint is ignored. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1026 | * |
Camilla Berglund | 1395ec2 | 2012-12-22 19:21:35 +0100 | [diff] [blame] | 1027 | * If an OpenGL context is requested, the @ref GLFW_OPENGL_PROFILE hint |
| 1028 | * specifies which OpenGL profile to create the context for. Possible values |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1029 | * are one of @ref GLFW_OPENGL_CORE_PROFILE or @ref GLFW_OPENGL_COMPAT_PROFILE, |
| 1030 | * or @ref GLFW_OPENGL_NO_PROFILE to not request a specific profile. If |
| 1031 | * requesting an OpenGL version below 3.2, @ref GLFW_OPENGL_NO_PROFILE must be |
| 1032 | * used. If another client API is requested, this hint is ignored. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1033 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1034 | * The @ref GLFW_CONTEXT_ROBUSTNESS hint specifies the robustness strategy to |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1035 | * be used by the context. This can be one of @ref GLFW_NO_RESET_NOTIFICATION |
| 1036 | * or @ref GLFW_LOSE_CONTEXT_ON_RESET, or @ref GLFW_NO_ROBUSTNESS to not |
| 1037 | * request a robustness strategy. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1038 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 1039 | * @par Window hints |
| 1040 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1041 | * The @ref GLFW_RESIZABLE hint specifies whether the window will be resizable |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1042 | * by the user. The window will still be resizable using the @ref |
| 1043 | * glfwSetWindowSize function. This hint is ignored for fullscreen windows. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1044 | * |
| 1045 | * The @ref GLFW_VISIBLE hint specifies whether the window will be initially |
| 1046 | * visible. This hint is ignored for fullscreen windows. |
| 1047 | * |
| 1048 | * The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y hints specify the initial |
| 1049 | * position of the window. These hints are ignored for fullscreen windows. |
| 1050 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1051 | * @note This function may only be called from the main thread. |
| 1052 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1053 | * @sa glfwDefaultWindowHints |
| 1054 | */ |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 1055 | GLFWAPI void glfwWindowHint(int target, int hint); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1056 | |
| 1057 | /*! @brief Creates a window and its associated context. |
| 1058 | * |
Camilla Berglund | b8c16e4 | 2012-11-22 17:04:54 +0100 | [diff] [blame] | 1059 | * @param[in] width The desired width, in pixels, of the window. This must be |
| 1060 | * greater than zero. |
| 1061 | * @param[in] height The desired height, in pixels, of the window. This must |
| 1062 | * be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1063 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1064 | * @param[in] monitor The monitor to use for fullscreen mode, or @c NULL to use |
| 1065 | * windowed mode. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1066 | * @param[in] share The window whose context to share resources with, or @c |
| 1067 | * NULL to not share resources. |
| 1068 | * @return The handle of the created window, or @c NULL if an error occurred. |
| 1069 | * @ingroup window |
| 1070 | * |
| 1071 | * @remarks Most of the options for how the window and its context should be |
| 1072 | * created are specified via the @ref glfwWindowHint function. |
| 1073 | * |
| 1074 | * @remarks This function does not change which context is current. Before you |
| 1075 | * can use the newly created context, you need to make it current using @ref |
| 1076 | * glfwMakeContextCurrent. |
| 1077 | * |
| 1078 | * @remarks For fullscreen windows the initial cursor mode is @ref |
| 1079 | * GLFW_CURSOR_CAPTURED and the screensaver is prohibited from starting. For |
| 1080 | * regular windows the initial cursor mode is @ref GLFW_CURSOR_NORMAL and the |
| 1081 | * screensaver is allowed to start. |
| 1082 | * |
| 1083 | * @remarks In order to determine the actual properties of an opened window, |
| 1084 | * use @ref glfwGetWindowParam and @ref glfwGetWindowSize. |
| 1085 | * |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1086 | * @remarks <b>Windows:</b> If the executable has an icon resource named @c |
| 1087 | * GLFW_ICON, it will be set as the icon for the window. If no such icon is |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1088 | * present, the @c IDI_WINLOGO icon will be used instead. |
| 1089 | * |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1090 | * @remarks <b>Mac OS X:</b> The GLFW window has no icon, as it is not |
| 1091 | * a document window, but the dock icon will be the same as the application |
| 1092 | * bundle's icon. Also, the first time a window is opened the menu bar is |
| 1093 | * populated with common commands like Hide, Quit and About. The (minimal) |
| 1094 | * about dialog uses information from the application's bundle. For more |
| 1095 | * information on bundles, see the Bundle Programming Guide provided by Apple. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1096 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1097 | * @note This function may only be called from the main thread. |
| 1098 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1099 | * @sa glfwDestroyWindow |
| 1100 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1101 | 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] | 1102 | |
| 1103 | /*! @brief Destroys the specified window and its context. |
| 1104 | * @param[in] window The window to destroy. |
| 1105 | * @ingroup window |
| 1106 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1107 | * @note This function may only be called from the main thread. |
| 1108 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1109 | * @note If the window's context is current on the main thread, it is |
| 1110 | * detached before being destroyed. |
| 1111 | * |
Camilla Berglund | 948be59 | 2012-12-27 18:26:51 +0100 | [diff] [blame] | 1112 | * @note On calling this function, no further callbacks will be called for |
| 1113 | * the specified window, even if their associated events occur during window |
| 1114 | * destruction. |
| 1115 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1116 | * @warning The window's context must not be current on any other thread. |
| 1117 | * |
| 1118 | * @sa glfwCreateWindow |
| 1119 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1120 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1121 | |
| 1122 | /*! @brief Sets the title of the specified window. |
| 1123 | * @param[in] window The window whose title to change. |
| 1124 | * @param[in] title The UTF-8 encoded window title. |
| 1125 | * @ingroup window |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1126 | * |
| 1127 | * @note This function may only be called from the main thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1128 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1129 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1130 | |
| 1131 | /*! @brief Retrieves the size of the client area of the specified window. |
| 1132 | * @param[in] window The window whose size to retrieve. |
| 1133 | * @param[out] width The width of the client area. |
| 1134 | * @param[out] height The height of the client area. |
| 1135 | * @ingroup window |
| 1136 | * |
| 1137 | * @sa glfwSetWindowSize |
| 1138 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1139 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1140 | |
| 1141 | /*! @brief Sets the size of the client area of the specified window. |
| 1142 | * @param[in] window The window to resize. |
| 1143 | * @param[in] width The desired width of the specified window. |
| 1144 | * @param[in] height The desired height of the specified window. |
| 1145 | * @ingroup window |
| 1146 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1147 | * @note This function may only be called from the main thread. |
| 1148 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1149 | * @note The window manager may put limits on what window sizes are allowed. |
| 1150 | * |
| 1151 | * @note For fullscreen windows, this function selects and switches to the |
| 1152 | * resolution closest to the specified size, without destroying the window's |
| 1153 | * context. |
| 1154 | * |
| 1155 | * @sa glfwGetWindowSize |
| 1156 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1157 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1158 | |
| 1159 | /*! @brief Iconifies the specified window. |
| 1160 | * @param[in] window The window to iconify. |
| 1161 | * @ingroup window |
| 1162 | * |
| 1163 | * @remarks If the window is already iconified, this function does nothing. |
| 1164 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1165 | * @note This function may only be called from the main thread. |
| 1166 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1167 | * @sa glfwRestoreWindow |
| 1168 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1169 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1170 | |
| 1171 | /*! @brief Restores the specified window. |
| 1172 | * @param[in] window The window to restore. |
| 1173 | * @ingroup window |
| 1174 | * |
| 1175 | * @remarks If the window is already restored, this function does nothing. |
| 1176 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1177 | * @note This function may only be called from the main thread. |
| 1178 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1179 | * @sa glfwIconifyWindow |
| 1180 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1181 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1182 | |
| 1183 | /*! @brief Makes the specified window visible. |
| 1184 | * @param[in] window The window to make visible. |
| 1185 | * @ingroup window |
| 1186 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1187 | * @remarks If the window is already visible or is in fullscreen mode, this |
| 1188 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1189 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1190 | * @note This function may only be called from the main thread. |
| 1191 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1192 | * @sa glfwHideWindow |
| 1193 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1194 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1195 | |
| 1196 | /*! @brief Hides the specified window. |
| 1197 | * @param[in] window The window to hide. |
| 1198 | * @ingroup window |
| 1199 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1200 | * @remarks If the window is already hidden or is in fullscreen mode, this |
| 1201 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1202 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1203 | * @note This function may only be called from the main thread. |
| 1204 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1205 | * @sa glfwShowWindow |
| 1206 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1207 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1208 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1209 | /*! @brief Returns the monitor that the window uses for fullscreen mode |
| 1210 | * @param[in] window The window to query. |
| 1211 | * @return The monitor, or @c NULL if the window is in windowed mode. |
| 1212 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1213 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1214 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1215 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1216 | /*! @brief Returns a property of the specified window. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1217 | * @param[in] window The window to query. |
| 1218 | * @param[in] param The property whose value to return. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1219 | * @return The value of the property, or zero if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1220 | * @ingroup window |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1221 | * |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1222 | * @par Window properties |
| 1223 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1224 | * The @ref GLFW_FOCUSED property indicates whether the window is focused. |
| 1225 | * |
| 1226 | * The @ref GLFW_ICONIFIED property indicates whether the window is iconified. |
| 1227 | * |
| 1228 | * The @ref GLFW_VISIBLE property indicates whether the window is visible. |
| 1229 | * |
| 1230 | * The @ref GLFW_RESIZABLE property indicates whether the window is resizable |
| 1231 | * by the user. |
| 1232 | * |
Camilla Berglund | 21f41a2 | 2012-12-31 19:45:13 +0100 | [diff] [blame] | 1233 | * The @ref GLFW_SHOULD_CLOSE property indicates whether the window has been |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1234 | * requested by the user to close. |
| 1235 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1236 | * The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y properties indicate the |
| 1237 | * screen position, in pixels, of the upper-left corner of the window's client |
| 1238 | * area. |
| 1239 | * |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1240 | * @par Context properties |
| 1241 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1242 | * The @ref GLFW_CLIENT_API property indicates the client API provided by the |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1243 | * window's context; either @ref GLFW_OPENGL_API or @ref GLFW_OPENGL_ES_API. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1244 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1245 | * The @ref GLFW_CONTEXT_VERSION_MAJOR, @ref GLFW_CONTEXT_VERSION_MINOR and |
| 1246 | * @ref GLFW_CONTEXT_REVISION properties indicate the client API version of the |
| 1247 | * window's context. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1248 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1249 | * The @ref GLFW_OPENGL_FORWARD_COMPAT property is @c GL_TRUE if the window's |
| 1250 | * context is an OpenGL forward-compatible one, or @c GL_FALSE otherwise. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1251 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1252 | * The @ref GLFW_OPENGL_DEBUG_CONTEXT property is @c GL_TRUE if the window's |
| 1253 | * context is an OpenGL debug context, or @c GL_FALSE otherwise. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1254 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1255 | * The @ref GLFW_OPENGL_PROFILE property indicates the OpenGL profile used by |
| 1256 | * the context. This is @ref GLFW_OPENGL_CORE_PROFILE or @ref |
| 1257 | * GLFW_OPENGL_COMPAT_PROFILE if the context uses a known profile, or @ref |
| 1258 | * GLFW_OPENGL_NO_PROFILE if the OpenGL profile is unknown or the context is |
| 1259 | * for another client API. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1260 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1261 | * The @ref GLFW_CONTEXT_ROBUSTNESS property indicates the robustness strategy |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1262 | * used by the context. This is @ref GLFW_LOSE_CONTEXT_ON_RESET or @ref |
| 1263 | * GLFW_NO_RESET_NOTIFICATION if the window's context supports robustness, or |
| 1264 | * @ref GLFW_NO_ROBUSTNESS otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1265 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1266 | GLFWAPI int glfwGetWindowParam(GLFWwindow* window, int param); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1267 | |
| 1268 | /*! @brief Sets the user pointer of the specified window. |
| 1269 | * @param[in] window The window whose pointer to set. |
| 1270 | * @param[in] pointer The new value. |
| 1271 | * @ingroup window |
| 1272 | * |
| 1273 | * @sa glfwGetWindowUserPointer |
| 1274 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1275 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1276 | |
| 1277 | /*! @brief Returns the user pointer of the specified window. |
| 1278 | * @param[in] window The window whose pointer to return. |
| 1279 | * @ingroup window |
| 1280 | * |
| 1281 | * @sa glfwSetWindowUserPointer |
| 1282 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1283 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1284 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1285 | /*! @brief Sets the position callback for the specified window. |
| 1286 | * @param[in] window The window whose callback to set. |
| 1287 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1288 | * callback. |
| 1289 | * @ingroup window |
| 1290 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1291 | GLFWAPI void glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1292 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1293 | /*! @brief Sets the size callback for the specified window. |
| 1294 | * @param[in] window The window whose callback to set. |
| 1295 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1296 | * callback. |
| 1297 | * @ingroup window |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1298 | * |
| 1299 | * This callback is called when the window is resized. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1300 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1301 | GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1302 | |
| 1303 | /*! @brief Sets the close callback for the specified window. |
| 1304 | * @param[in] window The window whose callback to set. |
| 1305 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1306 | * callback. |
| 1307 | * @ingroup window |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1308 | * |
| 1309 | * This callback is called when the user attempts to close the window, i.e. |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1310 | * clicks the window's close widget. Calling @ref glfwDestroyWindow does not |
| 1311 | * cause this callback to be called. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1312 | * |
| 1313 | * The return value of the close callback becomes the new value of the @ref |
Camilla Berglund | 21f41a2 | 2012-12-31 19:45:13 +0100 | [diff] [blame] | 1314 | * GLFW_SHOULD_CLOSE window parameter. |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1315 | * |
| 1316 | * @remarks <b>Mac OS X:</b> Selecting Quit from the application menu will |
| 1317 | * trigger the close callback for all windows. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1318 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1319 | GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1320 | |
| 1321 | /*! @brief Sets the refresh callback for the specified window. |
| 1322 | * @param[in] window The window whose callback to set. |
| 1323 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1324 | * callback. |
| 1325 | * @ingroup window |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1326 | * |
| 1327 | * This callback is called when the client area of the window needs to be |
| 1328 | * redrawn, for example if the window has been exposed after having been |
| 1329 | * covered by another window. |
| 1330 | * |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1331 | * @note On compositing window systems such as Aero, Compiz or Aqua, where the |
| 1332 | * window contents are saved off-screen, this callback may be called only very |
| 1333 | * infrequently or never at all. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1334 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1335 | GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1336 | |
| 1337 | /*! @brief Sets the focus callback for the specified window. |
| 1338 | * @param[in] window The window whose callback to set. |
| 1339 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1340 | * callback. |
| 1341 | * @ingroup window |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1342 | * |
| 1343 | * This callback is called when the window gains or loses focus. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1344 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1345 | GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1346 | |
| 1347 | /*! @brief Sets the iconify callback for the specified window. |
| 1348 | * @param[in] window The window whose callback to set. |
| 1349 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1350 | * callback. |
| 1351 | * @ingroup window |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1352 | * |
| 1353 | * This callback is called when the window is iconified or restored. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1354 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1355 | GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1356 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1357 | /*! @brief Processes all pending events. |
| 1358 | * @ingroup window |
| 1359 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1360 | * @note This function may only be called from the main thread. |
| 1361 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1362 | * @sa glfwWaitEvents |
| 1363 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1364 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1365 | |
| 1366 | /*! @brief Waits until events are pending and processes them. |
| 1367 | * @ingroup window |
| 1368 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1369 | * @note This function may only be called from the main thread. |
| 1370 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1371 | * @sa glfwPollEvents |
| 1372 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1373 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1374 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1375 | /*! @brief Returns the value of an input option for the specified window. |
| 1376 | * @param[in] window The window to query. |
| 1377 | * @param[in] mode One of the following: |
| 1378 | * @arg @ref GLFW_CURSOR_MODE Sets the cursor mode. |
| 1379 | * @arg @ref GLFW_STICKY_KEYS Sets whether sticky keys are enabled. |
| 1380 | * @arg @ref GLFW_STICKY_MOUSE_BUTTONS Sets whether sticky mouse buttons are enabled. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1381 | * @ingroup input |
| 1382 | * |
| 1383 | * @sa glfwSetInputMode |
| 1384 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1385 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1386 | |
| 1387 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1388 | * @param[in] window The window whose input mode to set. |
| 1389 | * @param[in] mode One of @ref GLFW_CURSOR_MODE, @ref GLFW_STICKY_KEYS or @ref |
| 1390 | * GLFW_STICKY_MOUSE_BUTTONS. |
| 1391 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1392 | * @ingroup input |
| 1393 | * |
| 1394 | * @sa glfwGetInputMode |
| 1395 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1396 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1397 | |
| 1398 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 1399 | * window. |
| 1400 | * @param[in] window The desired window. |
| 1401 | * @param[in] key The desired @link keys keyboard key @endlink. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1402 | * @return One of @ref GLFW_PRESS or @ref GLFW_RELEASE. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1403 | * @ingroup input |
| 1404 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1405 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1406 | |
| 1407 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 1408 | * window. |
| 1409 | * @param[in] window The desired window. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1410 | * @param[in] button The desired @link buttons mouse buttons @endlink. |
| 1411 | * @return One of @ref GLFW_PRESS or @ref GLFW_RELEASE. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1412 | * @ingroup input |
| 1413 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1414 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1415 | |
| 1416 | /*! @brief Retrieves the last reported cursor position, relative to the client |
| 1417 | * area of the window. |
| 1418 | * @param[in] window The desired window. |
| 1419 | * @param[out] xpos The cursor x-coordinate, relative to the left edge of the |
| 1420 | * client area, or @c NULL. |
| 1421 | * @param[out] ypos The cursor y-coordinate, relative to the to top edge of the |
| 1422 | * client area, or @c NULL. |
| 1423 | * @ingroup input |
| 1424 | * |
| 1425 | * @sa glfwSetCursorPos |
| 1426 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1427 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, int* xpos, int* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1428 | |
| 1429 | /*! @brief Sets the position of the cursor, relative to the client area of the window. |
| 1430 | * @param[in] window The desired window. |
| 1431 | * @param[in] xpos The desired x-coordinate, relative to the left edge of the |
| 1432 | * client area, or @c NULL. |
| 1433 | * @param[in] ypos The desired y-coordinate, relative to the top edge of the |
| 1434 | * client area, or @c NULL. |
| 1435 | * @ingroup input |
| 1436 | * |
Camilla Berglund | 14355d6 | 2012-11-22 17:04:44 +0100 | [diff] [blame] | 1437 | * @note The specified window must be focused. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1438 | * |
| 1439 | * @sa glfwGetCursorPos |
| 1440 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1441 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1442 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1443 | /*! @brief Sets the key callback. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1444 | * @param[in] window The window whose callback to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1445 | * @param[in] cbfun The new key callback, or @c NULL to remove the currently |
| 1446 | * set callback. |
| 1447 | * @ingroup input |
| 1448 | * |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1449 | * @remarks The key callback deals with physical keys, with @link keys tokens |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1450 | * @endlink named after their use on the standard US keyboard layout. If you |
| 1451 | * want to input text, use the Unicode character callback instead. |
| 1452 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1453 | GLFWAPI void glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1454 | |
| 1455 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1456 | * @param[in] window The window whose callback to set. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1457 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1458 | * callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1459 | * @ingroup input |
| 1460 | * |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1461 | * @remarks The Unicode character callback is for text input. If you want to |
| 1462 | * know whether a specific key was pressed or released, use the key callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1463 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1464 | GLFWAPI void glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1465 | |
| 1466 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1467 | * @param[in] window The window whose callback to set. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1468 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1469 | * callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1470 | * @ingroup input |
| 1471 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1472 | GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1473 | |
| 1474 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1475 | * @param[in] window The window whose callback to set. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1476 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1477 | * callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1478 | * @ingroup input |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1479 | * |
| 1480 | * @remarks The position is relative to the upper-left corner of the client |
| 1481 | * area of the window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1482 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1483 | GLFWAPI void glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1484 | |
| 1485 | /*! @brief Sets the cursor enter/exit callback. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1486 | * @param[in] window The window whose callback to set. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame^] | 1487 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1488 | * callback. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1489 | * @ingroup input |
| 1490 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1491 | GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1492 | |
| 1493 | /*! @brief Sets the scroll callback. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1494 | * @param[in] window The window whose callback to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1495 | * @param[in] cbfun The new scroll callback, or @c NULL to remove the currently |
| 1496 | * set callback. |
| 1497 | * @ingroup input |
| 1498 | * |
| 1499 | * @note This receives all scrolling input, like that from a mouse wheel or |
| 1500 | * a touchpad scrolling area. |
| 1501 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1502 | GLFWAPI void glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1503 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1504 | /*! @brief Returns a property of the specified joystick. |
| 1505 | * @param[in] joy The joystick to query. |
| 1506 | * @param[in] param The property whose value to return. |
| 1507 | * @return The specified joystick's current value, or zero if the joystick is |
| 1508 | * not present. |
| 1509 | * @ingroup input |
| 1510 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1511 | GLFWAPI int glfwGetJoystickParam(int joy, int param); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1512 | |
| 1513 | /*! @brief Returns the values of axes of the specified joystick. |
| 1514 | * @param[in] joy The joystick to query. |
| 1515 | * @param[out] axes The array to hold the values. |
| 1516 | * @param[in] numaxes The size of the provided array. |
| 1517 | * @return The number of values written to @p axes. |
| 1518 | * @ingroup input |
| 1519 | */ |
Camilla Berglund | 2502e4d | 2012-08-29 18:31:12 +0200 | [diff] [blame] | 1520 | GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1521 | |
| 1522 | /*! @brief Returns the values of buttons of the specified joystick. |
| 1523 | * @param[in] joy The joystick to query. |
| 1524 | * @param[out] buttons The array to hold the values. |
| 1525 | * @param[in] numbuttons The size of the provided array. |
| 1526 | * @return The number of values written to @p buttons. |
| 1527 | * @ingroup input |
| 1528 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1529 | GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1530 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 1531 | /*! @brief Returns the name of the specified joystick. |
| 1532 | * @param[in] joy The joystick to query. |
| 1533 | * @return The UTF-8 encoded name of the joystick, or @c NULL if the joystick |
| 1534 | * is not present. |
| 1535 | * @ingroup input |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 1536 | * |
| 1537 | * @note The returned string is valid only until the next call to @ref |
| 1538 | * glfwGetJoystickName. |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 1539 | */ |
Camilla Berglund | 93a1d1c | 2012-09-07 01:01:34 +0200 | [diff] [blame] | 1540 | GLFWAPI const char* glfwGetJoystickName(int joy); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1541 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1542 | /*! @brief Sets the clipboard to the specified string. |
| 1543 | * @param[in] window The window that will own the clipboard contents. |
| 1544 | * @param[in] string A UTF-8 encoded string. |
| 1545 | * @ingroup clipboard |
| 1546 | * |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1547 | * @note This function may only be called from the main thread. |
| 1548 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1549 | * @sa glfwGetClipboardString |
| 1550 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1551 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1552 | |
| 1553 | /*! @brief Retrieves the contents of the clipboard as a string. |
| 1554 | * @param[in] window The window that will request the clipboard contents. |
| 1555 | * @return The contents of the clipboard as a UTF-8 encoded string, or @c NULL |
| 1556 | * if that format was unavailable. |
| 1557 | * @ingroup clipboard |
| 1558 | * |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1559 | * @note This function may only be called from the main thread. |
| 1560 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1561 | * @note The returned string is valid only until the next call to @ref |
| 1562 | * glfwGetClipboardString or @ref glfwSetClipboardString. |
| 1563 | * |
| 1564 | * @sa glfwSetClipboardString |
| 1565 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1566 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 1567 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1568 | /*! @brief Retrieves the current value of the GLFW timer. |
| 1569 | * @return The current value, in seconds. |
| 1570 | * @ingroup time |
| 1571 | * |
| 1572 | * @remarks This function may be called from secondary threads. |
| 1573 | * |
| 1574 | * @remarks Unless the timer has been set using @ref glfwSetTime, the timer |
| 1575 | * measures time elapsed since GLFW was initialized. |
| 1576 | * |
| 1577 | * @note The resolution of the timer is system dependent. |
| 1578 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1579 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1580 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1581 | /*! @brief Sets the GLFW timer. |
| 1582 | * @param[in] time The new value, in seconds. |
| 1583 | * @ingroup time |
| 1584 | * |
| 1585 | * @note The resolution of the timer is system dependent. |
| 1586 | */ |
| 1587 | GLFWAPI void glfwSetTime(double time); |
| 1588 | |
| 1589 | /*! @brief Makes the context of the specified window current for this thread. |
| 1590 | * @param[in] window The window whose context to make current, or @c NULL to |
| 1591 | * detach the current context. |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1592 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1593 | * |
| 1594 | * @remarks This function may be called from secondary threads. |
| 1595 | * |
| 1596 | * @note A context may only be current for a single thread at a time. |
| 1597 | * |
| 1598 | * @sa glfwGetCurrentContext |
| 1599 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1600 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1601 | |
| 1602 | /*! @brief Returns the window whose context is current on this thread. |
| 1603 | * @return The window whose context is current, or @c NULL if no window's |
| 1604 | * context is current. |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1605 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1606 | * |
| 1607 | * @remarks This function may be called from secondary threads. |
| 1608 | * |
| 1609 | * @sa glfwMakeContextCurrent |
| 1610 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1611 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1612 | |
| 1613 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1614 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1615 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1616 | * |
| 1617 | * @remarks This function may be called from secondary threads. |
| 1618 | * |
| 1619 | * @sa glfwSwapInterval |
| 1620 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1621 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1622 | |
| 1623 | /*! @brief Sets the swap interval for the current context. |
| 1624 | * @param[in] interval The minimum number of video frame periods to wait for |
| 1625 | * until the buffers are swapped by @ref glfwSwapBuffers. |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1626 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1627 | * |
| 1628 | * @remarks This function may be called from secondary threads. |
| 1629 | * |
| 1630 | * @sa glfwSwapBuffers |
| 1631 | */ |
| 1632 | GLFWAPI void glfwSwapInterval(int interval); |
| 1633 | |
| 1634 | /*! @brief Checks whether the specified extension is available. |
| 1635 | * @param[in] extension The ASCII encoded name of the extension. |
| 1636 | * @return @c GL_TRUE if the extension is available, or @c FALSE otherwise. |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1637 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1638 | * |
| 1639 | * @remarks This function may be called from secondary threads. |
| 1640 | * |
| 1641 | * @note This function checks not only the client API extension string, but |
| 1642 | * also any platform-specific context creation API extension strings. |
| 1643 | */ |
| 1644 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 1645 | |
| 1646 | /*! @brief Returns the address of the specified client API function for the |
| 1647 | * current context. |
| 1648 | * @param[in] procname The ASCII encoded name of the function. |
| 1649 | * @return The address of the function, or @c NULL if the function is |
| 1650 | * unavailable. |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1651 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1652 | * |
| 1653 | * @remarks This function may be called from secondary threads. |
| 1654 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 1655 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1656 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1657 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 1658 | /************************************************************************* |
| 1659 | * Global definition cleanup |
| 1660 | *************************************************************************/ |
| 1661 | |
| 1662 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 1663 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 1664 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 1665 | #undef WINGDIAPI |
| 1666 | #undef GLFW_WINGDIAPI_DEFINED |
| 1667 | #endif |
| 1668 | |
| 1669 | #ifdef GLFW_CALLBACK_DEFINED |
| 1670 | #undef CALLBACK |
| 1671 | #undef GLFW_CALLBACK_DEFINED |
| 1672 | #endif |
| 1673 | |
| 1674 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 1675 | |
| 1676 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1677 | #ifdef __cplusplus |
| 1678 | } |
| 1679 | #endif |
| 1680 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 1681 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1682 | |