glfw3.h 80 KB

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