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 | 36e5409 | 2010-11-09 02:58:35 +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 | */ |
| 51 | /*! @defgroup error Error handling |
| 52 | */ |
| 53 | /*! @defgroup gamma Gamma ramp support |
| 54 | */ |
| 55 | /*! @defgroup init Initialization and version information |
| 56 | */ |
| 57 | /*! @defgroup input Input handling |
| 58 | */ |
| 59 | /*! @defgroup opengl OpenGL support |
| 60 | */ |
| 61 | /*! @defgroup time Time input |
| 62 | */ |
| 63 | /*! @defgroup window Window handling |
| 64 | * |
| 65 | * The primary purpose of GLFW is to provide a simple interface to OpenGL |
| 66 | * context creation and window management. GLFW supports multiple windows, |
| 67 | * which can be either a normal desktop window or a fullscreen window. |
| 68 | */ |
| 69 | /*! @defgroup monitor Monitor handling |
| 70 | */ |
| 71 | |
| 72 | |
| 73 | /************************************************************************* |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 74 | * Global definitions |
| 75 | *************************************************************************/ |
| 76 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 77 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 78 | |
| 79 | /* Please report any probles that you find with your compiler, which may |
| 80 | * be solved in this section! There are several compilers that I have not |
| 81 | * been able to test this file with yet. |
| 82 | * |
| 83 | * First: If we are we on Windows, we want a single define for it (_WIN32) |
| 84 | * (Note: For Cygwin the compiler flag -mwin32 should be used, but to |
| 85 | * make sure that things run smoothly for Cygwin users, we add __CYGWIN__ |
| 86 | * to the list of "valid Win32 identifiers", which removes the need for |
| 87 | * -mwin32) |
| 88 | */ |
| 89 | #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)) |
| 90 | #define _WIN32 |
| 91 | #endif /* _WIN32 */ |
| 92 | |
| 93 | /* In order for extension support to be portable, we need to define an |
| 94 | * OpenGL function call method. We use the keyword APIENTRY, which is |
| 95 | * defined for Win32. (Note: Windows also needs this for <GL/gl.h>) |
| 96 | */ |
| 97 | #ifndef APIENTRY |
| 98 | #ifdef _WIN32 |
| 99 | #define APIENTRY __stdcall |
| 100 | #else |
| 101 | #define APIENTRY |
| 102 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 103 | #endif /* APIENTRY */ |
| 104 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 105 | /* The following three defines are here solely to make some Windows-based |
| 106 | * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but |
| 107 | * it has the major drawback of severely polluting our namespace. |
| 108 | */ |
| 109 | |
| 110 | /* Under Windows, we need WINGDIAPI defined */ |
| 111 | #if !defined(WINGDIAPI) && defined(_WIN32) |
| 112 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__) |
| 113 | /* Microsoft Visual C++, Borland C++ Builder and Pelles C */ |
| 114 | #define WINGDIAPI __declspec(dllimport) |
| 115 | #elif defined(__LCC__) |
| 116 | /* LCC-Win32 */ |
| 117 | #define WINGDIAPI __stdcall |
| 118 | #else |
| 119 | /* Others (e.g. MinGW, Cygwin) */ |
| 120 | #define WINGDIAPI extern |
| 121 | #endif |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 122 | #define GLFW_WINGDIAPI_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 123 | #endif /* WINGDIAPI */ |
| 124 | |
| 125 | /* Some <GL/glu.h> files also need CALLBACK defined */ |
| 126 | #if !defined(CALLBACK) && defined(_WIN32) |
| 127 | #if defined(_MSC_VER) |
| 128 | /* Microsoft Visual C++ */ |
| 129 | #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) |
| 130 | #define CALLBACK __stdcall |
| 131 | #else |
| 132 | #define CALLBACK |
| 133 | #endif |
| 134 | #else |
| 135 | /* Other Windows compilers */ |
| 136 | #define CALLBACK __stdcall |
| 137 | #endif |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 138 | #define GLFW_CALLBACK_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 139 | #endif /* CALLBACK */ |
| 140 | |
Camilla Berglund | 3c912cb | 2012-08-02 21:25:00 +0200 | [diff] [blame] | 141 | /* Most <GL/glu.h> variants on Windows need wchar_t */ |
| 142 | #if defined(_WIN32) |
| 143 | #include <stddef.h> |
| 144 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 145 | |
| 146 | |
| 147 | /* ---------------- GLFW related system specific defines ----------------- */ |
| 148 | |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 149 | #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) |
| 150 | #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" |
| 151 | #endif |
| 152 | |
Camilla Berglund | 2588c9b | 2012-03-25 17:40:30 +0200 | [diff] [blame] | 153 | #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 154 | |
| 155 | /* We are building a Win32 DLL */ |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 156 | #define GLFWAPI __declspec(dllexport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 157 | |
| 158 | #elif defined(_WIN32) && defined(GLFW_DLL) |
| 159 | |
| 160 | /* We are calling a Win32 DLL */ |
| 161 | #if defined(__LCC__) |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 162 | #define GLFWAPI extern |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 163 | #else |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 164 | #define GLFWAPI __declspec(dllimport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 165 | #endif |
| 166 | |
| 167 | #else |
| 168 | |
| 169 | /* We are either building/calling a static lib or we are non-win32 */ |
| 170 | #define GLFWAPI |
| 171 | |
| 172 | #endif |
| 173 | |
| 174 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 175 | |
Camilla Berglund | 2213450 | 2012-06-05 23:55:10 +0200 | [diff] [blame] | 176 | /* Include the chosen OpenGL header and, optionally, the GLU header. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 177 | */ |
| 178 | #if defined(__APPLE_CC__) |
Camilla Berglund | 410a4e2 | 2012-09-27 22:28:04 +0200 | [diff] [blame] | 179 | #if defined(GLFW_INCLUDE_GLCOREARB) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 180 | #include <OpenGL/gl3.h> |
| 181 | #else |
| 182 | #define GL_GLEXT_LEGACY |
| 183 | #include <OpenGL/gl.h> |
| 184 | #endif |
Camilla Berglund | 2213450 | 2012-06-05 23:55:10 +0200 | [diff] [blame] | 185 | #if defined(GLFW_INCLUDE_GLU) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 186 | #include <OpenGL/glu.h> |
| 187 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 188 | #else |
Camilla Berglund | 410a4e2 | 2012-09-27 22:28:04 +0200 | [diff] [blame] | 189 | #if defined(GLFW_INCLUDE_GLCOREARB) |
| 190 | #include <GL/glcorearb.h> |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 191 | #else |
| 192 | #include <GL/gl.h> |
| 193 | #endif |
Camilla Berglund | 2213450 | 2012-06-05 23:55:10 +0200 | [diff] [blame] | 194 | #if defined(GLFW_INCLUDE_GLU) |
Camilla Berglund | d88789e | 2011-09-16 04:44:40 +0200 | [diff] [blame] | 195 | #include <GL/glu.h> |
| 196 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 197 | #endif |
| 198 | |
| 199 | |
| 200 | /************************************************************************* |
| 201 | * GLFW version |
| 202 | *************************************************************************/ |
| 203 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 204 | /*! @name GLFW version macros |
| 205 | * @{ */ |
| 206 | /*! @brief The major version number of the GLFW library. |
| 207 | * |
| 208 | * This is incremented when the API is changed in non-compatible ways. |
| 209 | * @ingroup init |
| 210 | */ |
Camilla Berglund | 38b0ccb | 2010-09-07 17:41:26 +0200 | [diff] [blame] | 211 | #define GLFW_VERSION_MAJOR 3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 212 | /*! @brief The minor version number of the GLFW library. |
| 213 | * |
| 214 | * This is incremented when features are added to the API but it remains |
| 215 | * backward-compatible. |
| 216 | * @ingroup init |
| 217 | */ |
Camilla Berglund | 38b0ccb | 2010-09-07 17:41:26 +0200 | [diff] [blame] | 218 | #define GLFW_VERSION_MINOR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 219 | /*! @brief The revision number of the GLFW library. |
| 220 | * |
| 221 | * This is incremented when a bug fix release is made that does not contain any |
| 222 | * API changes. |
| 223 | * @ingroup init |
| 224 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 225 | #define GLFW_VERSION_REVISION 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 226 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 227 | |
| 228 | |
| 229 | /************************************************************************* |
| 230 | * Input handling definitions |
| 231 | *************************************************************************/ |
| 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 | 3249f81 | 2010-09-07 17:34:51 +0200 | [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 | 3249f81 | 2010-09-07 17:34:51 +0200 | [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 */ |
| 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 |
Marcus | 3b00847 | 2011-01-03 22:07:01 +0100 | [diff] [blame] | 311 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 312 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
Marcus | 3b00847 | 2011-01-03 22:07:01 +0100 | [diff] [blame] | 313 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 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 */ |
| 317 | |
| 318 | /* Function keys */ |
| 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 |
| 390 | |
| 391 | /* GLFW 2.x key name aliases (deprecated) */ |
| 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 | 3249f81 | 2010-09-07 17:34:51 +0200 | [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 |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 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 | 3249f81 | 2010-09-07 17:34:51 +0200 | [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 | |
| 447 | |
| 448 | /************************************************************************* |
| 449 | * Other definitions |
| 450 | *************************************************************************/ |
| 451 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 452 | /*! @brief A regular, overlapped window. |
| 453 | * @ingroup window |
| 454 | */ |
Camilla Berglund | 484a271 | 2010-09-10 13:24:19 +0200 | [diff] [blame] | 455 | #define GLFW_WINDOWED 0x00010001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 456 | /*! @brief A fullscreen window that may changed the monitor's resolution. |
| 457 | * @ingroup window |
| 458 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 459 | #define GLFW_FULLSCREEN 0x00010002 |
| 460 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 461 | /*! @defgroup paramhints Window parameters and hints |
| 462 | * @ingroup window |
| 463 | * @{ */ |
| 464 | |
Camilla Berglund | 14355d6 | 2012-11-22 17:04:44 +0100 | [diff] [blame] | 465 | /*! @brief @c GL_TRUE if the window has focus, or @c GL_FALSE otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 466 | */ |
Camilla Berglund | 14355d6 | 2012-11-22 17:04:44 +0100 | [diff] [blame] | 467 | #define GLFW_FOCUSED 0x00020001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 468 | /*! @brief @c GL_TRUE if the window is iconified, or @c GL_FALSE otherwise. |
| 469 | */ |
Camilla Berglund | 39dfa7d | 2010-11-15 21:39:46 +0100 | [diff] [blame] | 470 | #define GLFW_ICONIFIED 0x00020002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 471 | /*! @brief @c GL_TRUE if the window has been requested to close, or @c GL_FALSE |
| 472 | * otherwise. |
| 473 | */ |
Camilla Berglund | 2410e2a | 2012-08-10 13:31:15 +0200 | [diff] [blame] | 474 | #define GLFW_CLOSE_REQUESTED 0x00020003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 475 | /*! @brief The OpenGL API version revision. |
| 476 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 477 | #define GLFW_OPENGL_REVISION 0x00020004 |
Camilla Berglund | 950a3be | 2010-09-09 19:58:51 +0200 | [diff] [blame] | 478 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 479 | /*! @brief The bit depth of the red component of the color buffer. |
| 480 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 481 | #define GLFW_RED_BITS 0x00021000 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 482 | /*! @brief The bit depth of the green component of the color buffer. |
| 483 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 484 | #define GLFW_GREEN_BITS 0x00021001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 485 | /*! @brief The bit depth of the blue component of the color buffer. |
| 486 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 487 | #define GLFW_BLUE_BITS 0x00021002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 488 | /*! @brief The bit depth of the alpha component of the color buffer. |
| 489 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 490 | #define GLFW_ALPHA_BITS 0x00021003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 491 | /*! @brief The bit depth of the depth buffer of the default framebuffer. |
| 492 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 493 | #define GLFW_DEPTH_BITS 0x00021004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 494 | /*! @brief The bit depth of the stencil buffer of the default framebuffer. |
| 495 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 496 | #define GLFW_STENCIL_BITS 0x00021005 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 497 | /*! @brief The monitor refresh rate. |
| 498 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 499 | #define GLFW_REFRESH_RATE 0x00021006 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 500 | /*! @brief The bit depth of the red component of the accumulation buffer. |
| 501 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 502 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 503 | /*! @brief The bit depth of the red component of the accumulation buffer. |
| 504 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 505 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 506 | /*! @brief The bit depth of the red component of the accumulation buffer. |
| 507 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 508 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 509 | /*! @brief The bit depth of the red component of the accumulation buffer. |
| 510 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 511 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 512 | /*! @brief The number of auxiliary buffers. |
| 513 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 514 | #define GLFW_AUX_BUFFERS 0x0002100B |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 515 | /*! @brief @c GL_TRUE for stereo rendering, or @c GL_FALSE otherwise. |
| 516 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 517 | #define GLFW_STEREO 0x0002100C |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 518 | /*! @brief The number of samples used for default framebuffer multisampling. |
| 519 | */ |
Camilla Berglund | 4fb5578 | 2011-08-15 01:40:10 +0200 | [diff] [blame] | 520 | #define GLFW_FSAA_SAMPLES 0x0002100E |
Camilla Berglund | ddcf5d4 | 2012-08-10 13:03:11 +0200 | [diff] [blame] | 521 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 522 | /*! @brief The @link clients client API @endlink to create a context for. |
Camilla Berglund | ddcf5d4 | 2012-08-10 13:03:11 +0200 | [diff] [blame] | 523 | */ |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 524 | #define GLFW_CLIENT_API 0x00022000 |
| 525 | #define GLFW_OPENGL_VERSION_MAJOR 0x00022001 |
| 526 | #define GLFW_OPENGL_VERSION_MINOR 0x00022002 |
| 527 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022003 |
| 528 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022004 |
| 529 | #define GLFW_OPENGL_PROFILE 0x00022005 |
| 530 | #define GLFW_OPENGL_ROBUSTNESS 0x00022006 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 531 | /*! @brief @c GL_TRUE if the window is resizable, or @c GL_FALSE otherwise. |
| 532 | */ |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 533 | #define GLFW_RESIZABLE 0x00022007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 534 | /*! @brief @c GL_TRUE if the window is visible, or @c GL_FALSE otherwise. |
| 535 | */ |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 536 | #define GLFW_VISIBLE 0x00022008 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 537 | /*! @brief The x-coordinate, in pixels, of the upper-left corner of the |
| 538 | * client area of the window. |
| 539 | */ |
m@bitsnbites.eu | c9f4ded | 2012-10-28 00:23:28 +0200 | [diff] [blame] | 540 | #define GLFW_POSITION_X 0x00022009 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 541 | /*! @brief The y-coordinate, in pixels, of the upper-left corner of the |
| 542 | * client area of the window. |
| 543 | */ |
m@bitsnbites.eu | c9f4ded | 2012-10-28 00:23:28 +0200 | [diff] [blame] | 544 | #define GLFW_POSITION_Y 0x0002200A |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 545 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 546 | /*! @} */ |
| 547 | |
| 548 | /*! @name Client APIs |
| 549 | * @{ */ |
| 550 | /*! @brief The OpenGL API. |
| 551 | * @ingroup opengl |
| 552 | */ |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 553 | #define GLFW_OPENGL_API 0x00000001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 554 | /*! @brief The OpenGL ES API. |
| 555 | * @ingroup opengl |
| 556 | */ |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 557 | #define GLFW_OPENGL_ES_API 0x00000002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 558 | /*! @} */ |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 559 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 560 | /*! @name OpenGL robustness strategies |
| 561 | * @{ */ |
| 562 | /*! @brief No robustness strategy is used. |
| 563 | * |
| 564 | * This is the default. |
| 565 | * @ingroup opengl |
| 566 | */ |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 567 | #define GLFW_OPENGL_NO_ROBUSTNESS 0x00000000 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 568 | /*! @brief |
| 569 | * @ingroup opengl |
| 570 | */ |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 571 | #define GLFW_OPENGL_NO_RESET_NOTIFICATION 0x00000001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 572 | /*! @brief |
| 573 | * @ingroup opengl |
| 574 | */ |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 575 | #define GLFW_OPENGL_LOSE_CONTEXT_ON_RESET 0x00000002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 576 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 577 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 578 | /*! @name OpenGL profiles |
| 579 | * @{ */ |
| 580 | /*! @brief No OpenGL profile. |
| 581 | * @ingroup opengl |
| 582 | */ |
Camilla Berglund | e2c58b0 | 2011-09-19 21:00:29 +0200 | [diff] [blame] | 583 | #define GLFW_OPENGL_NO_PROFILE 0x00000000 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 584 | /*! @brief The OpenGL core profile. |
| 585 | * @ingroup opengl |
| 586 | */ |
Camilla Berglund | 20662dd | 2010-11-15 21:40:43 +0100 | [diff] [blame] | 587 | #define GLFW_OPENGL_CORE_PROFILE 0x00000001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 588 | /*! @brief The OpenGL compatibility profile. |
| 589 | * @ingroup opengl |
| 590 | */ |
Camilla Berglund | 20662dd | 2010-11-15 21:40:43 +0100 | [diff] [blame] | 591 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00000002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 592 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 593 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 594 | /*! @name Input modes |
| 595 | * @{ */ |
| 596 | /*! @brief The behaviour of the cursor. |
| 597 | * @ingroup input |
| 598 | */ |
Camilla Berglund | ce288a8 | 2012-02-04 00:51:35 +0100 | [diff] [blame] | 599 | #define GLFW_CURSOR_MODE 0x00030001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 600 | /*! @brief Whether the @ref glfwGetKey function uses sticky state. |
| 601 | * @ingroup input |
| 602 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 603 | #define GLFW_STICKY_KEYS 0x00030002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 604 | /*! @brief Whether the @ref glfwGetMouseButton function uses sticky state. |
| 605 | * @ingroup input |
| 606 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 607 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00030003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 608 | /*! @brief Whether to allow key repeat for the @link GLFWkeyfun key callback |
| 609 | * @endlink. |
| 610 | * @ingroup input |
| 611 | */ |
m@bitsnbites.eu | 1c21fc1 | 2012-10-28 00:50:38 +0200 | [diff] [blame] | 612 | #define GLFW_KEY_REPEAT 0x00030004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 613 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 614 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 615 | /*! @name Cursor modes |
| 616 | * @{ */ |
| 617 | /*! @brief The cursor is visible and behaves normally. |
| 618 | * @ingroup input |
| 619 | */ |
Camilla Berglund | b1656d7 | 2011-09-06 13:55:29 +0200 | [diff] [blame] | 620 | #define GLFW_CURSOR_NORMAL 0x00040001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 621 | /*! @brief The cursor is hidden when over the client area of the window. |
| 622 | * @ingroup input |
| 623 | */ |
Camilla Berglund | b1656d7 | 2011-09-06 13:55:29 +0200 | [diff] [blame] | 624 | #define GLFW_CURSOR_HIDDEN 0x00040002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 625 | /*! @brief The cursor is disabled and cursor movement is unbounded. |
| 626 | * @ingroup input |
| 627 | */ |
Camilla Berglund | b1656d7 | 2011-09-06 13:55:29 +0200 | [diff] [blame] | 628 | #define GLFW_CURSOR_CAPTURED 0x00040003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 629 | /*! @} */ |
Camilla Berglund | b1656d7 | 2011-09-06 13:55:29 +0200 | [diff] [blame] | 630 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 631 | /*! @name Joystick parameters |
| 632 | * @{ */ |
| 633 | /*! @brief @c GL_TRUE if the joystick is present, or @c GL_FALSE otherwise. |
| 634 | * @ingroup input |
| 635 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 636 | #define GLFW_PRESENT 0x00050001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 637 | /*! @brief The number of axes on the specified joystick, or zero if the joystick |
| 638 | * is not present. |
| 639 | * @ingroup input |
| 640 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 641 | #define GLFW_AXES 0x00050002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 642 | /*! @brief The number of buttons on the specified joystick, or zero if the |
| 643 | * joystick is not present. |
| 644 | * @ingroup input |
| 645 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 646 | #define GLFW_BUTTONS 0x00050003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 647 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 648 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 649 | /*! @defgroup errors Error codes |
| 650 | * @ingroup error |
| 651 | * @{ */ |
| 652 | /*! @brief No error has occurred. |
| 653 | */ |
Camilla Berglund | e28543c | 2010-09-09 21:08:50 +0200 | [diff] [blame] | 654 | #define GLFW_NO_ERROR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 655 | /*! @brief GLFW has not been initialized. |
| 656 | */ |
Camilla Berglund | e28543c | 2010-09-09 21:08:50 +0200 | [diff] [blame] | 657 | #define GLFW_NOT_INITIALIZED 0x00070001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 658 | /*! @brief No context is current for this thread. |
| 659 | */ |
Camilla Berglund | 957ecdc | 2012-08-02 15:36:15 +0200 | [diff] [blame] | 660 | #define GLFW_NO_CURRENT_CONTEXT 0x00070002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 661 | /*! @brief One of the enum parameters for the function was given an invalid |
| 662 | * enum. |
| 663 | */ |
Camilla Berglund | 5254617 | 2010-10-05 00:08:19 +0200 | [diff] [blame] | 664 | #define GLFW_INVALID_ENUM 0x00070003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 665 | /*! @brief One of the parameters for the function was given an invalid value. |
| 666 | */ |
Camilla Berglund | 5254617 | 2010-10-05 00:08:19 +0200 | [diff] [blame] | 667 | #define GLFW_INVALID_VALUE 0x00070004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 668 | /*! @brief A memory allocation failed. |
| 669 | */ |
Camilla Berglund | 5254617 | 2010-10-05 00:08:19 +0200 | [diff] [blame] | 670 | #define GLFW_OUT_OF_MEMORY 0x00070005 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 671 | /*! @brief GLFW could not find support for the requested client API on the |
| 672 | * system. |
| 673 | */ |
Camilla Berglund | 5254617 | 2010-10-05 00:08:19 +0200 | [diff] [blame] | 674 | #define GLFW_OPENGL_UNAVAILABLE 0x00070006 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 675 | /*! @brief The requested OpenGL or GLES version is not available. |
| 676 | */ |
Camilla Berglund | 5254617 | 2010-10-05 00:08:19 +0200 | [diff] [blame] | 677 | #define GLFW_VERSION_UNAVAILABLE 0x00070007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 678 | /*! @brief A platform-specific error occurred that does not match any of the |
| 679 | * more specific categories. |
| 680 | */ |
Camilla Berglund | 5254617 | 2010-10-05 00:08:19 +0200 | [diff] [blame] | 681 | #define GLFW_PLATFORM_ERROR 0x00070008 |
Camilla Berglund | 14355d6 | 2012-11-22 17:04:44 +0100 | [diff] [blame] | 682 | /*! @brief The specified window needed to be focused for the call to succeed. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 683 | */ |
Camilla Berglund | 14355d6 | 2012-11-22 17:04:44 +0100 | [diff] [blame] | 684 | #define GLFW_WINDOW_NOT_FOCUSED 0x00070009 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 685 | /*! @brief The clipboard did not contain data in the requested format. |
| 686 | */ |
Camilla Berglund | 7044ed6 | 2012-04-09 15:54:36 +0200 | [diff] [blame] | 687 | #define GLFW_FORMAT_UNAVAILABLE 0x0007000A |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 688 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 689 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 690 | /*! @brief The number of entries in the gamma ramp. |
| 691 | * @ingroup gamma |
| 692 | */ |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 693 | #define GLFW_GAMMA_RAMP_SIZE 256 |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 694 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 695 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 696 | /************************************************************************* |
| 697 | * Typedefs |
| 698 | *************************************************************************/ |
| 699 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 700 | /*! @brief OpenGL function pointer type. |
| 701 | * @ingroup opengl |
| 702 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 703 | typedef void (*GLFWglproc)(void); |
| 704 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 705 | /*! @brief Window handle type. |
| 706 | * @ingroup window |
| 707 | */ |
Camilla Berglund | a66a4cd | 2011-02-09 12:37:42 +0100 | [diff] [blame] | 708 | typedef void* GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 709 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 710 | /*! @brief The function signature for error callbacks. |
| 711 | * @param[in] error An @link errors error code @endlink. |
| 712 | * @param[in] description A UTF-8 encoded string describing the error. |
| 713 | * @ingroup error |
| 714 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 715 | typedef void (* GLFWerrorfun)(int,const char*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 716 | |
| 717 | /*! @brief The function signature for window resize callbacks. |
| 718 | * @param[in] window The window that the user resized. |
| 719 | * @param[in] width The new width, in pixels, of the window. |
| 720 | * @param[in] height The new height, in pixels, of the window. |
| 721 | * @ingroup window |
| 722 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 723 | typedef void (* GLFWwindowsizefun)(GLFWwindow,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 724 | |
| 725 | /*! @brief The function signature for window close callbacks. |
| 726 | * @param[in] window The window that the user attempted to close. |
| 727 | * @return @c GL_TRUE to allow the window to be closed, or @c GL_FALSE to |
| 728 | * ignore the attempt. |
| 729 | * @ingroup window |
| 730 | */ |
| 731 | typedef int (* GLFWwindowclosefun)(GLFWwindow); |
| 732 | |
| 733 | /*! @brief The function signature for window content refresh callbacks. |
| 734 | * @param[in] window The window whose content needs to be refreshed. |
| 735 | * @ingroup window |
| 736 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 737 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 738 | |
| 739 | /*! @brief The function signature for window focus/defocus callbacks. |
| 740 | * @param[in] window The window that was focused or defocused. |
| 741 | * @param[in] focused @c GL_TRUE if the window was focused, or @c GL_FALSE if |
| 742 | * it was defocused. |
| 743 | * @ingroup window |
| 744 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 745 | typedef void (* GLFWwindowfocusfun)(GLFWwindow,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 746 | |
| 747 | /*! @brief The function signature for window iconfiy/restore callbacks. |
| 748 | * @param[in] window The window that was iconified or restored. |
| 749 | * @param[in] iconified @c GL_TRUE if the window was iconified, or @c GL_FALSE |
| 750 | * if it was restored. |
| 751 | * @ingroup window |
| 752 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 753 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 754 | |
| 755 | /*! @brief The function signature for mouse button callbacks. |
| 756 | * @param[in] window The window that received the event. |
| 757 | * @param[in] button The @link buttons mouse button @endlink that was pressed |
| 758 | * or released. |
| 759 | * @param[in] action @ref GLFW_PRESS or @ref GLFW_RELEASE. |
| 760 | * @ingroup input |
| 761 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 762 | typedef void (* GLFWmousebuttonfun)(GLFWwindow,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 763 | |
| 764 | /*! @brief The function signature for cursor position callbacks. |
| 765 | * @param[in] window The window that received the event. |
| 766 | * @param[in] x The new x-coordinate of the cursor. |
| 767 | * @param[in] y The new y-coordinate of the cursor. |
| 768 | * @ingroup input |
| 769 | */ |
Camilla Berglund | cef9dea | 2012-06-22 13:53:02 +0200 | [diff] [blame] | 770 | typedef void (* GLFWcursorposfun)(GLFWwindow,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 771 | |
| 772 | /*! @brief The function signature for cursor enter/exit callbacks. |
| 773 | * @param[in] window The window that received the event. |
| 774 | * @param[in] entered @c GL_TRUE if the cursor entered the window's client |
| 775 | * area, or @c GL_FALSE if it left it. |
| 776 | * @ingroup input |
| 777 | */ |
Camilla Berglund | c4806b9 | 2012-01-30 22:59:38 +0100 | [diff] [blame] | 778 | typedef void (* GLFWcursorenterfun)(GLFWwindow,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 779 | |
| 780 | /*! @brief The function signature for scroll callbacks. |
| 781 | * @param[in] window The window that received the event. |
| 782 | * @param[in] x The scroll offset along the x-axis. |
| 783 | * @param[in] y The scroll offset along the y-axis. |
| 784 | * @ingroup input |
| 785 | */ |
Camilla Berglund | 4ef9aec | 2012-03-28 21:54:09 +0200 | [diff] [blame] | 786 | typedef void (* GLFWscrollfun)(GLFWwindow,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 787 | |
| 788 | /*! @brief The function signature for keyboard key callbacks. |
| 789 | * @param[in] window The window that received the event. |
| 790 | * @param[in] key The @link keys keyboard key @endlink that was pressed or |
| 791 | * released. |
| 792 | * @param[in] action @ref GLFW_PRESS or @ref GLFW_RELEASE. |
| 793 | * @ingroup input |
| 794 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 795 | typedef void (* GLFWkeyfun)(GLFWwindow,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 796 | |
| 797 | /*! @brief The function signature for Unicode character callbacks. |
| 798 | * @param[in] window The window that received the event. |
| 799 | * @param[in] character The Unicode code point of the character. |
| 800 | * @ingroup input |
| 801 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 802 | typedef void (* GLFWcharfun)(GLFWwindow,int); |
| 803 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 804 | /* @brief Video mode type. |
| 805 | * @ingroup monitor |
| 806 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 807 | typedef struct |
| 808 | { |
| 809 | int width; |
| 810 | int height; |
| 811 | int redBits; |
| 812 | int blueBits; |
| 813 | int greenBits; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 814 | } GLFWvidmode; |
| 815 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 816 | /*! @brief Gamma ramp. |
| 817 | * @ingroup gamma |
| 818 | */ |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 819 | typedef struct |
| 820 | { |
| 821 | unsigned short red[GLFW_GAMMA_RAMP_SIZE]; |
| 822 | unsigned short green[GLFW_GAMMA_RAMP_SIZE]; |
| 823 | unsigned short blue[GLFW_GAMMA_RAMP_SIZE]; |
| 824 | } GLFWgammaramp; |
| 825 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 826 | |
| 827 | /************************************************************************* |
| 828 | * Prototypes |
| 829 | *************************************************************************/ |
| 830 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 831 | /*! @brief Initializes the GLFW library. |
| 832 | * |
| 833 | * Before most GLFW functions can be used, GLFW must be initialized, and before |
| 834 | * a program terminates GLFW should be terminated in order to free allocated |
| 835 | * resources, memory, etc. |
| 836 | * |
| 837 | * @return @c GL_TRUE if successful, or @c GL_FALSE if an error occurred. |
| 838 | * @ingroup init |
| 839 | * |
| 840 | * @remarks Additional calls to this function after successful initialization |
| 841 | * but before termination will succeed but will do nothing. |
| 842 | * |
| 843 | * @note This function may take several seconds to complete on some systems, |
| 844 | * while on other systems it may take only a fraction of a second to complete. |
| 845 | * |
| 846 | * @note On Mac OS X, this function will change the current directory of the |
| 847 | * application to the @c Contents/Resources subdirectory of the application's |
| 848 | * bundle, if present. |
| 849 | * |
| 850 | * @sa glfwTerminate |
| 851 | */ |
| 852 | GLFWAPI int glfwInit(void); |
| 853 | |
| 854 | /*! @brief Terminates the GLFW library. |
| 855 | * @ingroup init |
| 856 | * |
| 857 | * @remarks This function may be called before @ref glfwInit. |
| 858 | * |
| 859 | * @note This function closes all GLFW windows. |
| 860 | * |
| 861 | * @note This function should be called before the program exits. |
| 862 | * |
| 863 | * @warning No window's context may be current on another thread when this |
| 864 | * function is called. |
| 865 | * |
| 866 | * @sa glfwInit |
| 867 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 868 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 869 | |
| 870 | /*! @brief Retrieves the version of the GLFW library. |
| 871 | * @param[out] major Where to store the major version number, or @c NULL. |
| 872 | * @param[out] minor Where to store the minor version number, or @c NULL. |
| 873 | * @param[out] rev Where to store the revision number, or @c NULL. |
| 874 | * @ingroup init |
| 875 | * |
| 876 | * @remarks This function may be called before @ref glfwInit. |
| 877 | * |
| 878 | * @remarks This function may be called from secondary threads. |
| 879 | * |
| 880 | * @sa glfwGetVersionString |
| 881 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 882 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 883 | |
| 884 | /*! @brief Returns the version string of the GLFW library. |
| 885 | * |
| 886 | * The version string contains information about what compile-time options were |
| 887 | * enabled when the library was built. |
| 888 | * |
| 889 | * @return The GLFW version string. |
| 890 | * @ingroup init |
| 891 | * |
| 892 | * @remarks This function may be called before @ref glfwInit. |
| 893 | * |
| 894 | * @remarks This function may be called from secondary threads. |
| 895 | * |
| 896 | * @sa glfwGetVersion |
| 897 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 898 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 899 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 900 | /*! @brief Retrieves the latest error. |
| 901 | * @return The latest @link errors error code @endlink. |
| 902 | * @ingroup error |
| 903 | * |
| 904 | * @remarks This function may be called before @ref glfwInit. |
| 905 | */ |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 906 | GLFWAPI int glfwGetError(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 907 | |
| 908 | /*! @brief Retrieves a generic, human readable description of the specified error. |
| 909 | * @param[in] error The @link errors error code @endlink to be described. |
| 910 | * @return A UTF-8 encoded string describing the error. |
| 911 | * @ingroup error |
| 912 | * |
| 913 | * @remarks This function may be called before @ref glfwInit. |
| 914 | * |
| 915 | * @remarks This function may be called from secondary threads. |
| 916 | */ |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 917 | GLFWAPI const char* glfwErrorString(int error); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 918 | |
| 919 | /*! @brief Sets the error callback. |
| 920 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 921 | * callback. |
| 922 | * @ingroup error |
| 923 | * |
| 924 | * @remarks This function may be called before @ref glfwInit. |
| 925 | * |
| 926 | * @remarks The error callback is the preferred error retrieval mechanism, as |
| 927 | * it may be provided with a more specific error description than the generic |
| 928 | * one returned by @ref glfwErrorString. |
| 929 | * |
| 930 | * @note Because the description string provided to the callback may have been |
| 931 | * generated specifically for that error, it is not guaranteed to be valid |
| 932 | * after the callback has returned. If you wish to use it after that, you need |
| 933 | * to make your own copy of it before returning. |
| 934 | */ |
Camilla Berglund | f1e7d7c | 2010-11-23 17:45:23 +0100 | [diff] [blame] | 935 | GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 936 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 937 | /*! @ingroup monitor |
| 938 | */ |
Camilla Berglund | 871e1a7 | 2012-08-02 18:03:43 +0200 | [diff] [blame] | 939 | GLFWAPI GLFWvidmode* glfwGetVideoModes(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 940 | |
| 941 | /*! @ingroup monitor |
| 942 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 943 | GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 944 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 945 | /*! @brief Sets the system gamma ramp to one generated from the specified |
| 946 | * exponent. |
| 947 | * @param[in] The desired exponent. |
| 948 | * @ingroup gamma |
| 949 | */ |
Camilla Berglund | ca0dbdb | 2011-09-06 15:43:31 +0200 | [diff] [blame] | 950 | GLFWAPI void glfwSetGamma(float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 951 | |
| 952 | /*! @brief Retrieves the current system gamma ramp. |
| 953 | * @param[out] ramp Where to store the gamma ramp. |
| 954 | * @ingroup gamma |
| 955 | */ |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 956 | GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 957 | |
| 958 | /*! @brief Sets the system gamma ramp to the one specified. |
| 959 | * @param[in] ramp The gamma ramp to use. |
| 960 | * @ingroup gamma |
| 961 | */ |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 962 | GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp); |
| 963 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 964 | /*! @brief Resets all window hints to their default values |
| 965 | * |
| 966 | * The @ref GLFW_RED_BITS, @ref GLFW_GREEN_BITS, @ref GLFW_BLUE_BITS, @ref |
| 967 | * GLFW_ALPHA_BITS and @ref GLFW_STENCIL_BITS hints are set to 8. |
| 968 | * |
| 969 | * The @ref GLFW_DEPTH_BITS hint is set to 24. |
| 970 | * |
| 971 | * The @ref GLFW_VISIBLE and @ref GLFW_RESIZABLE hints are set to 1. |
| 972 | * |
| 973 | * The @ref GLFW_CLIENT_API hint is set to @ref GLFW_OPENGL_API. |
| 974 | * |
| 975 | * The @ref GLFW_OPENGL_VERSION_MAJOR and @ref GLFW_OPENGL_VERSION_MINOR hints |
| 976 | * are set to 1 and 0, respectively. |
| 977 | * |
| 978 | * All other hints are set to 0. |
| 979 | * |
| 980 | * @ingroup window |
| 981 | * |
| 982 | * @sa glfwWindowHint |
| 983 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 984 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 985 | |
| 986 | /*! @brief Sets the specified window hint to the desired value. |
| 987 | * @param[in] target The window hint to set. |
| 988 | * @param[in] target The new value of the window hint. |
| 989 | * @ingroup window |
| 990 | * |
| 991 | * The @ref GLFW_RED_BITS, @ref GLFW_GREEN_BITS, @ref GLFW_BLUE_BITS, @ref |
| 992 | * GLFW_ALPHA_BITS, @ref GLFW_DEPTH_BITS and @ref GLFW_STENCIL_BITS hints |
| 993 | * specify the desired bit depths of the various components of the default |
| 994 | * framebuffer. |
| 995 | * |
| 996 | * The @ref GLFW_REFRESH_RATE hint specifies the desired monitor refresh rate |
| 997 | * for fullscreen windows. |
| 998 | * |
| 999 | * The @ref GLFW_ACCUM_RED_BITS, @ref GLFW_ACCUM_GREEN_BITS, @ref |
| 1000 | * GLFW_ACCUM_BLUE_BITS and @ref GLFW_ACCUM_ALPHA_BITS hints specify the |
| 1001 | * desired bit depths of the various components of the accumulation buffer. |
| 1002 | * |
| 1003 | * The @ref GLFW_AUX_BUFFERS hint specifies the desired number of auxiliary |
| 1004 | * buffers. |
| 1005 | * |
| 1006 | * The @ref GLFW_STEREO hint specifies whether to use stereoscopic rendering. |
| 1007 | * This is a hard constraint. |
| 1008 | * |
| 1009 | * The @ref GLFW_FSAA_SAMPLES hint specifies the desired number of samples to |
| 1010 | * use for multisampling. |
| 1011 | * |
| 1012 | * The @ref GLFW_CLIENT_API hint specifies which client API to create the |
| 1013 | * context for. Possible values are @ref GLFW_OPENGL_API and @ref |
| 1014 | * GLFW_OPENGL_ES_API. This is a hard constraint. |
| 1015 | * |
| 1016 | * The @ref GLFW_OPENGL_VERSION_MAJOR and @ref GLFW_OPENGL_VERSION_MINOR hints |
| 1017 | * specify the OpenGL version that the created context must be compatible with. |
| 1018 | * |
| 1019 | * These hints are @em not hard constraints, as they don't have to match |
| 1020 | * exactly, but @ref glfwCreateWindow will still fail if the resulting OpenGL |
| 1021 | * version is less than the one requested with hints. It is therefore |
| 1022 | * perfectly safe to use the default of version 1.0 for legacy code and you |
| 1023 | * will still get backwards-compatible contexts of version 3.0 and above when |
| 1024 | * available. |
| 1025 | * |
| 1026 | * The @ref GLFW_OPENGL_FORWARD_COMPAT hint specifies whether the OpenGL |
| 1027 | * context should be forward-compatible. This is a hard constraint. |
| 1028 | * |
| 1029 | * The @ref GLFW_OPENGL_DEBUG_CONTEXT hint specifies whether to create a debug |
| 1030 | * OpenGL context. |
| 1031 | * |
| 1032 | * The @ref GLFW_OPENGL_PROFILE hint specifies which OpenGL profile to create |
| 1033 | * the context for. Possible values are @ref GLFW_OPENGL_NO_PROFILE, @ref |
| 1034 | * GLFW_OPENGL_CORE_PROFILE and @ref GLFW_OPENGL_COMPAT_PROFILE. This is |
| 1035 | * a hard constraint. |
| 1036 | * |
| 1037 | * The @ref GLFW_OPENGL_ROBUSTNESS hint specifies the robustness strategy to be |
| 1038 | * used by the OpenGL context. |
| 1039 | * |
| 1040 | * The @ref GLFW_RESIZABLE hint specifies whether the window will be resizable |
| 1041 | * by the user. This hint is ignored for fullscreen windows. |
| 1042 | * |
| 1043 | * The @ref GLFW_VISIBLE hint specifies whether the window will be initially |
| 1044 | * visible. This hint is ignored for fullscreen windows. |
| 1045 | * |
| 1046 | * The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y hints specify the initial |
| 1047 | * position of the window. These hints are ignored for fullscreen windows. |
| 1048 | * |
| 1049 | * Some window hints are hard constraints. These must match the available |
| 1050 | * capabilities @em exactly for window and context creation to succeed. Hints |
| 1051 | * that are not hard constraints are matched as closely as possible, but the |
| 1052 | * resulting window and context may differ from what these hints requested. |
| 1053 | * |
| 1054 | * The following window hints are hard constraints: |
| 1055 | * @arg @ref GLFW_STEREO |
| 1056 | * @arg @ref GLFW_CLIENT_API |
| 1057 | * @arg @ref GLFW_OPENGL_FORWARD_COMPAT |
| 1058 | * @arg @ref GLFW_OPENGL_PROFILE |
| 1059 | * |
| 1060 | * @sa glfwDefaultWindowHints |
| 1061 | */ |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 1062 | GLFWAPI void glfwWindowHint(int target, int hint); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1063 | |
| 1064 | /*! @brief Creates a window and its associated context. |
| 1065 | * |
Camilla Berglund | b8c16e4 | 2012-11-22 17:04:54 +0100 | [diff] [blame^] | 1066 | * @param[in] width The desired width, in pixels, of the window. This must be |
| 1067 | * greater than zero. |
| 1068 | * @param[in] height The desired height, in pixels, of the window. This must |
| 1069 | * be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1070 | * @param[in] mode One of @ref GLFW_WINDOWED or @ref GLFW_FULLSCREEN. |
| 1071 | * @param[in] title The initial, UTF-8 encoded window title. |
| 1072 | * @param[in] share The window whose context to share resources with, or @c |
| 1073 | * NULL to not share resources. |
| 1074 | * @return The handle of the created window, or @c NULL if an error occurred. |
| 1075 | * @ingroup window |
| 1076 | * |
| 1077 | * @remarks Most of the options for how the window and its context should be |
| 1078 | * created are specified via the @ref glfwWindowHint function. |
| 1079 | * |
| 1080 | * @remarks This function does not change which context is current. Before you |
| 1081 | * can use the newly created context, you need to make it current using @ref |
| 1082 | * glfwMakeContextCurrent. |
| 1083 | * |
| 1084 | * @remarks For fullscreen windows the initial cursor mode is @ref |
| 1085 | * GLFW_CURSOR_CAPTURED and the screensaver is prohibited from starting. For |
| 1086 | * regular windows the initial cursor mode is @ref GLFW_CURSOR_NORMAL and the |
| 1087 | * screensaver is allowed to start. |
| 1088 | * |
| 1089 | * @remarks In order to determine the actual properties of an opened window, |
| 1090 | * use @ref glfwGetWindowParam and @ref glfwGetWindowSize. |
| 1091 | * |
| 1092 | * @remarks On Microsoft Windows, if the executable has an icon resource named |
| 1093 | * @c GLFW_ICON, it will be set as the icon for the window. If no such icon is |
| 1094 | * present, the @c IDI_WINLOGO icon will be used instead. |
| 1095 | * |
| 1096 | * @remarks On Mac OS X the GLFW window has no icon, but programs using GLFW |
| 1097 | * will use the application bundle's icon. Also, the first time a window is |
| 1098 | * opened the menu bar is populated with common commands like Hide, Quit and |
| 1099 | * About. The (minimal) about dialog uses information from the application's |
| 1100 | * bundle. For more information on bundles, see the Bundle Programming Guide |
| 1101 | * provided by Apple. |
| 1102 | * |
| 1103 | * @sa glfwDestroyWindow |
| 1104 | */ |
Camilla Berglund | 2212cd9 | 2012-08-10 13:29:45 +0200 | [diff] [blame] | 1105 | GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, int mode, const char* title, GLFWwindow share); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1106 | |
| 1107 | /*! @brief Destroys the specified window and its context. |
| 1108 | * @param[in] window The window to destroy. |
| 1109 | * @ingroup window |
| 1110 | * |
| 1111 | * @note If the window's context is current on the main thread, it is |
| 1112 | * detached before being destroyed. |
| 1113 | * |
| 1114 | * @warning The window's context must not be current on any other thread. |
| 1115 | * |
| 1116 | * @sa glfwCreateWindow |
| 1117 | */ |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 1118 | GLFWAPI void glfwDestroyWindow(GLFWwindow window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1119 | |
| 1120 | /*! @brief Sets the title of the specified window. |
| 1121 | * @param[in] window The window whose title to change. |
| 1122 | * @param[in] title The UTF-8 encoded window title. |
| 1123 | * @ingroup window |
| 1124 | */ |
Camilla Berglund | a339098 | 2012-09-02 15:22:56 +0200 | [diff] [blame] | 1125 | GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1126 | |
| 1127 | /*! @brief Retrieves the size of the client area of the specified window. |
| 1128 | * @param[in] window The window whose size to retrieve. |
| 1129 | * @param[out] width The width of the client area. |
| 1130 | * @param[out] height The height of the client area. |
| 1131 | * @ingroup window |
| 1132 | * |
| 1133 | * @sa glfwSetWindowSize |
| 1134 | */ |
Camilla Berglund | a339098 | 2012-09-02 15:22:56 +0200 | [diff] [blame] | 1135 | GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1136 | |
| 1137 | /*! @brief Sets the size of the client area of the specified window. |
| 1138 | * @param[in] window The window to resize. |
| 1139 | * @param[in] width The desired width of the specified window. |
| 1140 | * @param[in] height The desired height of the specified window. |
| 1141 | * @ingroup window |
| 1142 | * |
| 1143 | * @note The window manager may put limits on what window sizes are allowed. |
| 1144 | * |
| 1145 | * @note For fullscreen windows, this function selects and switches to the |
| 1146 | * resolution closest to the specified size, without destroying the window's |
| 1147 | * context. |
| 1148 | * |
| 1149 | * @sa glfwGetWindowSize |
| 1150 | */ |
Camilla Berglund | a339098 | 2012-09-02 15:22:56 +0200 | [diff] [blame] | 1151 | GLFWAPI void glfwSetWindowSize(GLFWwindow window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1152 | |
| 1153 | /*! @brief Iconifies the specified window. |
| 1154 | * @param[in] window The window to iconify. |
| 1155 | * @ingroup window |
| 1156 | * |
| 1157 | * @remarks If the window is already iconified, this function does nothing. |
| 1158 | * |
| 1159 | * @sa glfwRestoreWindow |
| 1160 | */ |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1161 | GLFWAPI void glfwIconifyWindow(GLFWwindow window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1162 | |
| 1163 | /*! @brief Restores the specified window. |
| 1164 | * @param[in] window The window to restore. |
| 1165 | * @ingroup window |
| 1166 | * |
| 1167 | * @remarks If the window is already restored, this function does nothing. |
| 1168 | * |
| 1169 | * @sa glfwIconifyWindow |
| 1170 | */ |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1171 | GLFWAPI void glfwRestoreWindow(GLFWwindow window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1172 | |
| 1173 | /*! @brief Makes the specified window visible. |
| 1174 | * @param[in] window The window to make visible. |
| 1175 | * @ingroup window |
| 1176 | * |
| 1177 | * @remarks If the window is already visible, this function does nothing. |
| 1178 | * |
| 1179 | * @sa glfwHideWindow |
| 1180 | */ |
Riku Salminen | 596132c | 2012-08-21 21:01:57 +0300 | [diff] [blame] | 1181 | GLFWAPI void glfwShowWindow(GLFWwindow window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1182 | |
| 1183 | /*! @brief Hides the specified window. |
| 1184 | * @param[in] window The window to hide. |
| 1185 | * @ingroup window |
| 1186 | * |
| 1187 | * @remarks If the window is already hidden, this function does nothing. |
| 1188 | * |
| 1189 | * @sa glfwShowWindow |
| 1190 | */ |
Riku Salminen | 596132c | 2012-08-21 21:01:57 +0300 | [diff] [blame] | 1191 | GLFWAPI void glfwHideWindow(GLFWwindow window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1192 | |
| 1193 | /*! @brief Returns a property of the specified window. |
| 1194 | * @ingroup window |
| 1195 | */ |
| 1196 | GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param); |
| 1197 | |
| 1198 | /*! @brief Sets the user pointer of the specified window. |
| 1199 | * @param[in] window The window whose pointer to set. |
| 1200 | * @param[in] pointer The new value. |
| 1201 | * @ingroup window |
| 1202 | * |
| 1203 | * @sa glfwGetWindowUserPointer |
| 1204 | */ |
Camilla Berglund | 48f5a7e | 2010-09-09 22:44:38 +0200 | [diff] [blame] | 1205 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1206 | |
| 1207 | /*! @brief Returns the user pointer of the specified window. |
| 1208 | * @param[in] window The window whose pointer to return. |
| 1209 | * @ingroup window |
| 1210 | * |
| 1211 | * @sa glfwSetWindowUserPointer |
| 1212 | */ |
Camilla Berglund | 48f5a7e | 2010-09-09 22:44:38 +0200 | [diff] [blame] | 1213 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1214 | |
| 1215 | /*! @brief Sets the size callback for the specified window. |
| 1216 | * @param[in] window The window whose callback to set. |
| 1217 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1218 | * callback. |
| 1219 | * @ingroup window |
| 1220 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1221 | GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1222 | |
| 1223 | /*! @brief Sets the close callback for the specified window. |
| 1224 | * @param[in] window The window whose callback to set. |
| 1225 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1226 | * callback. |
| 1227 | * @ingroup window |
| 1228 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1229 | GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1230 | |
| 1231 | /*! @brief Sets the refresh callback for the specified window. |
| 1232 | * @param[in] window The window whose callback to set. |
| 1233 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1234 | * callback. |
| 1235 | * @ingroup window |
| 1236 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1237 | GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1238 | |
| 1239 | /*! @brief Sets the focus callback for the specified window. |
| 1240 | * @param[in] window The window whose callback to set. |
| 1241 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1242 | * callback. |
| 1243 | * @ingroup window |
| 1244 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1245 | GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1246 | |
| 1247 | /*! @brief Sets the iconify callback for the specified window. |
| 1248 | * @param[in] window The window whose callback to set. |
| 1249 | * @param[in] cbfun The new callback, or @c NULL to remove the currently set |
| 1250 | * callback. |
| 1251 | * @ingroup window |
| 1252 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1253 | GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow window, GLFWwindowiconifyfun cbfun); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1254 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1255 | /*! @brief Processes all pending events. |
| 1256 | * @ingroup window |
| 1257 | * |
| 1258 | * @sa glfwWaitEvents |
| 1259 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1260 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1261 | |
| 1262 | /*! @brief Waits until events are pending and processes them. |
| 1263 | * @ingroup window |
| 1264 | * |
| 1265 | * @sa glfwPollEvents |
| 1266 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1267 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1268 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1269 | /*! @brief Returns the value of an input option for the specified window. |
| 1270 | * @param[in] window The window to query. |
| 1271 | * @param[in] mode One of the following: |
| 1272 | * @arg @ref GLFW_CURSOR_MODE Sets the cursor mode. |
| 1273 | * @arg @ref GLFW_STICKY_KEYS Sets whether sticky keys are enabled. |
| 1274 | * @arg @ref GLFW_STICKY_MOUSE_BUTTONS Sets whether sticky mouse buttons are enabled. |
| 1275 | * @arg @ref GLFW_KEY_REPEAT Sets whether key repeat is enabled. |
| 1276 | * @ingroup input |
| 1277 | * |
| 1278 | * @sa glfwSetInputMode |
| 1279 | */ |
| 1280 | GLFWAPI int glfwGetInputMode(GLFWwindow window, int mode); |
| 1281 | |
| 1282 | /*! @brief Sets an input option for the specified window. |
| 1283 | * @param[in] mode One of the following: |
| 1284 | * @arg @ref GLFW_CURSOR_MODE Sets the cursor mode. |
| 1285 | * @arg @ref GLFW_STICKY_KEYS Sets whether sticky keys are enabled. |
| 1286 | * @arg @ref GLFW_STICKY_MOUSE_BUTTONS Sets whether sticky mouse buttons are enabled. |
| 1287 | * @arg @ref GLFW_KEY_REPEAT Sets whether key repeat is enabled. |
| 1288 | * @ingroup input |
| 1289 | * |
| 1290 | * @sa glfwGetInputMode |
| 1291 | */ |
Camilla Berglund | 609c008 | 2012-02-04 01:34:12 +0100 | [diff] [blame] | 1292 | GLFWAPI void glfwSetInputMode(GLFWwindow window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1293 | |
| 1294 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 1295 | * window. |
| 1296 | * @param[in] window The desired window. |
| 1297 | * @param[in] key The desired @link keys keyboard key @endlink. |
| 1298 | * @return @ref GLFW_PRESS or @ref GLFW_RELEASE. |
| 1299 | * @ingroup input |
| 1300 | */ |
| 1301 | GLFWAPI int glfwGetKey(GLFWwindow window, int key); |
| 1302 | |
| 1303 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 1304 | * window. |
| 1305 | * @param[in] window The desired window. |
| 1306 | * @param[in] key The desired @link buttons mouse buttons @endlink. |
| 1307 | * @return @ref GLFW_PRESS or @ref GLFW_RELEASE. |
| 1308 | * @ingroup input |
| 1309 | */ |
| 1310 | GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button); |
| 1311 | |
| 1312 | /*! @brief Retrieves the last reported cursor position, relative to the client |
| 1313 | * area of the window. |
| 1314 | * @param[in] window The desired window. |
| 1315 | * @param[out] xpos The cursor x-coordinate, relative to the left edge of the |
| 1316 | * client area, or @c NULL. |
| 1317 | * @param[out] ypos The cursor y-coordinate, relative to the to top edge of the |
| 1318 | * client area, or @c NULL. |
| 1319 | * @ingroup input |
| 1320 | * |
| 1321 | * @sa glfwSetCursorPos |
| 1322 | */ |
Camilla Berglund | cef9dea | 2012-06-22 13:53:02 +0200 | [diff] [blame] | 1323 | GLFWAPI void glfwGetCursorPos(GLFWwindow window, int* xpos, int* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1324 | |
| 1325 | /*! @brief Sets the position of the cursor, relative to the client area of the window. |
| 1326 | * @param[in] window The desired window. |
| 1327 | * @param[in] xpos The desired x-coordinate, relative to the left edge of the |
| 1328 | * client area, or @c NULL. |
| 1329 | * @param[in] ypos The desired y-coordinate, relative to the top edge of the |
| 1330 | * client area, or @c NULL. |
| 1331 | * @ingroup input |
| 1332 | * |
Camilla Berglund | 14355d6 | 2012-11-22 17:04:44 +0100 | [diff] [blame] | 1333 | * @note The specified window must be focused. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1334 | * |
| 1335 | * @sa glfwGetCursorPos |
| 1336 | */ |
Camilla Berglund | cef9dea | 2012-06-22 13:53:02 +0200 | [diff] [blame] | 1337 | GLFWAPI void glfwSetCursorPos(GLFWwindow window, int xpos, int ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1338 | |
| 1339 | /*! @ingroup input |
| 1340 | */ |
Camilla Berglund | 4ef9aec | 2012-03-28 21:54:09 +0200 | [diff] [blame] | 1341 | GLFWAPI void glfwGetScrollOffset(GLFWwindow window, double* xoffset, double* yoffset); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1342 | |
| 1343 | /*! @brief Sets the key callback. |
| 1344 | * @param[in] cbfun The new key callback, or @c NULL to remove the currently |
| 1345 | * set callback. |
| 1346 | * @ingroup input |
| 1347 | * |
| 1348 | * @note The key callback deals with physical keys, with @link keys tokens |
| 1349 | * @endlink named after their use on the standard US keyboard layout. If you |
| 1350 | * want to input text, use the Unicode character callback instead. |
| 1351 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1352 | GLFWAPI void glfwSetKeyCallback(GLFWwindow window, GLFWkeyfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1353 | |
| 1354 | /*! @brief Sets the Unicode character callback. |
| 1355 | * @param[in] cbfun The new Unicode character callback, or @c NULL to remove |
| 1356 | * the currently set callback. |
| 1357 | * @ingroup input |
| 1358 | * |
| 1359 | * @note The Unicode character callback is for text input. If you want to know |
| 1360 | * whether a specific key was pressed or released, use the key callback. |
| 1361 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1362 | GLFWAPI void glfwSetCharCallback(GLFWwindow window, GLFWcharfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1363 | |
| 1364 | /*! @brief Sets the mouse button callback. |
| 1365 | * @param[in] cbfun The new mouse button callback, or @c NULL to remove the |
| 1366 | * currently set callback. |
| 1367 | * @ingroup input |
| 1368 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1369 | GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow window, GLFWmousebuttonfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1370 | |
| 1371 | /*! @brief Sets the cursor position callback. |
| 1372 | * @param[in] cbfun The new cursor position callback, or @c NULL to remove the |
| 1373 | * currently set callback. |
| 1374 | * @ingroup input |
| 1375 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1376 | GLFWAPI void glfwSetCursorPosCallback(GLFWwindow window, GLFWcursorposfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1377 | |
| 1378 | /*! @brief Sets the cursor enter/exit callback. |
| 1379 | * @param[in] cbfun The new cursor enter/exit callback, or @c NULL to remove |
| 1380 | * the currently set callback. |
| 1381 | * @ingroup input |
| 1382 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1383 | GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow window, GLFWcursorenterfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1384 | |
| 1385 | /*! @brief Sets the scroll callback. |
| 1386 | * @param[in] cbfun The new scroll callback, or @c NULL to remove the currently |
| 1387 | * set callback. |
| 1388 | * @ingroup input |
| 1389 | * |
| 1390 | * @note This receives all scrolling input, like that from a mouse wheel or |
| 1391 | * a touchpad scrolling area. |
| 1392 | */ |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 1393 | GLFWAPI void glfwSetScrollCallback(GLFWwindow window, GLFWscrollfun cbfun); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1394 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1395 | /*! @brief Returns a property of the specified joystick. |
| 1396 | * @param[in] joy The joystick to query. |
| 1397 | * @param[in] param The property whose value to return. |
| 1398 | * @return The specified joystick's current value, or zero if the joystick is |
| 1399 | * not present. |
| 1400 | * @ingroup input |
| 1401 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1402 | GLFWAPI int glfwGetJoystickParam(int joy, int param); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1403 | |
| 1404 | /*! @brief Returns the values of axes of the specified joystick. |
| 1405 | * @param[in] joy The joystick to query. |
| 1406 | * @param[out] axes The array to hold the values. |
| 1407 | * @param[in] numaxes The size of the provided array. |
| 1408 | * @return The number of values written to @p axes. |
| 1409 | * @ingroup input |
| 1410 | */ |
Camilla Berglund | 2502e4d | 2012-08-29 18:31:12 +0200 | [diff] [blame] | 1411 | GLFWAPI int glfwGetJoystickAxes(int joy, float* axes, int numaxes); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1412 | |
| 1413 | /*! @brief Returns the values of buttons of the specified joystick. |
| 1414 | * @param[in] joy The joystick to query. |
| 1415 | * @param[out] buttons The array to hold the values. |
| 1416 | * @param[in] numbuttons The size of the provided array. |
| 1417 | * @return The number of values written to @p buttons. |
| 1418 | * @ingroup input |
| 1419 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1420 | GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1421 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1422 | /*! @brief Sets the clipboard to the specified string. |
| 1423 | * @param[in] window The window that will own the clipboard contents. |
| 1424 | * @param[in] string A UTF-8 encoded string. |
| 1425 | * @ingroup clipboard |
| 1426 | * |
| 1427 | * @sa glfwGetClipboardString |
| 1428 | */ |
Camilla Berglund | 1214fa1 | 2012-04-09 16:03:14 +0200 | [diff] [blame] | 1429 | GLFWAPI void glfwSetClipboardString(GLFWwindow window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1430 | |
| 1431 | /*! @brief Retrieves the contents of the clipboard as a string. |
| 1432 | * @param[in] window The window that will request the clipboard contents. |
| 1433 | * @return The contents of the clipboard as a UTF-8 encoded string, or @c NULL |
| 1434 | * if that format was unavailable. |
| 1435 | * @ingroup clipboard |
| 1436 | * |
| 1437 | * @note The returned string is valid only until the next call to @ref |
| 1438 | * glfwGetClipboardString or @ref glfwSetClipboardString. |
| 1439 | * |
| 1440 | * @sa glfwSetClipboardString |
| 1441 | */ |
Camilla Berglund | f868712 | 2012-04-12 00:51:58 +0200 | [diff] [blame] | 1442 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 1443 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1444 | /*! @brief Retrieves the current value of the GLFW timer. |
| 1445 | * @return The current value, in seconds. |
| 1446 | * @ingroup time |
| 1447 | * |
| 1448 | * @remarks This function may be called from secondary threads. |
| 1449 | * |
| 1450 | * @remarks Unless the timer has been set using @ref glfwSetTime, the timer |
| 1451 | * measures time elapsed since GLFW was initialized. |
| 1452 | * |
| 1453 | * @note The resolution of the timer is system dependent. |
| 1454 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1455 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1456 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1457 | /*! @brief Sets the GLFW timer. |
| 1458 | * @param[in] time The new value, in seconds. |
| 1459 | * @ingroup time |
| 1460 | * |
| 1461 | * @note The resolution of the timer is system dependent. |
| 1462 | */ |
| 1463 | GLFWAPI void glfwSetTime(double time); |
| 1464 | |
| 1465 | /*! @brief Makes the context of the specified window current for this thread. |
| 1466 | * @param[in] window The window whose context to make current, or @c NULL to |
| 1467 | * detach the current context. |
| 1468 | * @ingroup opengl |
| 1469 | * |
| 1470 | * @remarks This function may be called from secondary threads. |
| 1471 | * |
| 1472 | * @note A context may only be current for a single thread at a time. |
| 1473 | * |
| 1474 | * @sa glfwGetCurrentContext |
| 1475 | */ |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 1476 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1477 | |
| 1478 | /*! @brief Returns the window whose context is current on this thread. |
| 1479 | * @return The window whose context is current, or @c NULL if no window's |
| 1480 | * context is current. |
| 1481 | * @ingroup opengl |
| 1482 | * |
| 1483 | * @remarks This function may be called from secondary threads. |
| 1484 | * |
| 1485 | * @sa glfwMakeContextCurrent |
| 1486 | */ |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 1487 | GLFWAPI GLFWwindow glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1488 | |
| 1489 | /*! @brief Swaps the front and back buffers of the specified window. |
| 1490 | * @param[in] The window whose buffers to swap. |
| 1491 | * @ingroup opengl |
| 1492 | * |
| 1493 | * @remarks This function may be called from secondary threads. |
| 1494 | * |
| 1495 | * @sa glfwSwapInterval |
| 1496 | */ |
| 1497 | GLFWAPI void glfwSwapBuffers(GLFWwindow window); |
| 1498 | |
| 1499 | /*! @brief Sets the swap interval for the current context. |
| 1500 | * @param[in] interval The minimum number of video frame periods to wait for |
| 1501 | * until the buffers are swapped by @ref glfwSwapBuffers. |
| 1502 | * @ingroup opengl |
| 1503 | * |
| 1504 | * @remarks This function may be called from secondary threads. |
| 1505 | * |
| 1506 | * @sa glfwSwapBuffers |
| 1507 | */ |
| 1508 | GLFWAPI void glfwSwapInterval(int interval); |
| 1509 | |
| 1510 | /*! @brief Checks whether the specified extension is available. |
| 1511 | * @param[in] extension The ASCII encoded name of the extension. |
| 1512 | * @return @c GL_TRUE if the extension is available, or @c FALSE otherwise. |
| 1513 | * @ingroup opengl |
| 1514 | * |
| 1515 | * @remarks This function may be called from secondary threads. |
| 1516 | * |
| 1517 | * @note This function checks not only the client API extension string, but |
| 1518 | * also any platform-specific context creation API extension strings. |
| 1519 | */ |
| 1520 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 1521 | |
| 1522 | /*! @brief Returns the address of the specified client API function for the |
| 1523 | * current context. |
| 1524 | * @param[in] procname The ASCII encoded name of the function. |
| 1525 | * @return The address of the function, or @c NULL if the function is |
| 1526 | * unavailable. |
| 1527 | * @ingroup opengl |
| 1528 | * |
| 1529 | * @remarks This function may be called from secondary threads. |
| 1530 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 1531 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1532 | |
| 1533 | /*! @brief Copies the desired parts of the state of one window's context to another. |
| 1534 | * @ingroup opengl |
| 1535 | * |
| 1536 | * @remarks This function may be called from secondary threads. |
| 1537 | */ |
| 1538 | GLFWAPI void glfwCopyContext(GLFWwindow src, GLFWwindow dst, unsigned long mask); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1539 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1540 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 1541 | /************************************************************************* |
| 1542 | * Global definition cleanup |
| 1543 | *************************************************************************/ |
| 1544 | |
| 1545 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 1546 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 1547 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 1548 | #undef WINGDIAPI |
| 1549 | #undef GLFW_WINGDIAPI_DEFINED |
| 1550 | #endif |
| 1551 | |
| 1552 | #ifdef GLFW_CALLBACK_DEFINED |
| 1553 | #undef CALLBACK |
| 1554 | #undef GLFW_CALLBACK_DEFINED |
| 1555 | #endif |
| 1556 | |
| 1557 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 1558 | |
| 1559 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1560 | #ifdef __cplusplus |
| 1561 | } |
| 1562 | #endif |
| 1563 | |
Camilla Berglund | 36e5409 | 2010-11-09 02:58:35 +0100 | [diff] [blame] | 1564 | #endif /* __glfw3_h__ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1565 | |