glfw.pas 160 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587
  1. {
  2. More info:
  3. http://forum.lazarus.freepascal.org/index.php/topic,21961.msg129100.html#msg129100
  4. GLFW 3.3.8 - www.glfw.org
  5. A library for OpenGL, window and input
  6. ------------------------------------------------------------------------
  7. Copyright (c) 2002-2006 Marcus Geelnard
  8. Copyright (c) 2006-2010 Camilla Berglund <elmindredaelmindreda.org>
  9. This software is provided 'as-is', without any express or implied
  10. warranty. In no event will the authors be held liable for any damages
  11. arising from the use of this software.
  12. 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. 1. The origin of this software must not be misrepresented; you must not
  16. claim that you wrote the original software. If you use this software
  17. in a product, an acknowledgment in the product documentation would
  18. be appreciated but is not required.
  19. 2. Altered source versions must be plainly marked as such, and must not
  20. be misrepresented as being the original software.
  21. 3. This notice may not be removed or altered from any source
  22. distribution.
  23. Pascal header translate by: Jorge Turiel (Aka BlueIcaro)
  24. with the help of the lazarus community (http://www.lazarus.freepascal.org/index.php)
  25. GLFW 3.3.8; Date: 220822. Updated headers to 3.3.8 revision
  26. GLFW 3.3.7; Date: 220417. Updated headers to 3.3.7 revision
  27. GLFW 3.1; Date: 20150216
  28. GLFW 3; Date: 20130912
  29. }
  30. unit glfw;
  31. {$mode objfpc}{$H+}
  32. interface
  33. uses
  34. GL;
  35. type
  36. GLFW_INT = integer;
  37. GLFWwindow = integer;
  38. pGLFWwindow = ^GLFWwindow;
  39. GLFWmonitor = integer;
  40. pGLFWmonitor = ^GLFWmonitor;
  41. pFloat = ^longint;
  42. type
  43. GLFWvidmode = record
  44. Width: integer;
  45. Height: integer;
  46. redBits: integer;
  47. greenBits: integer;
  48. blueBits: integer;
  49. refreshRate: integer;
  50. end;
  51. pGLFWvidmode = ^GLFWvidmode;
  52. type
  53. PGLFWgammaramp = ^GLFWgammaramp;
  54. GLFWgammaramp = record
  55. red: smallint;
  56. green: smallint;
  57. blue: smallint;
  58. size: dword;
  59. end;
  60. type
  61. CharArray = array of char;
  62. pCharArray = CharArray;
  63. type
  64. pGLFWcursor = ^GLFWcursor;
  65. GLFWcursor = integer;
  66. type
  67. pGLFWimage = ^GLFWimage;
  68. GLFWimage = record
  69. Width: integer;
  70. Height: integer;
  71. pixels: ^byte;
  72. end;
  73. type
  74. pGLFWgamepadstate = ^GLFWgamepadstate;
  75. GLFWgamepadstate = record
  76. Buttons: array [0..15] of char;
  77. axex: array [0..6] of single;
  78. end;
  79. type
  80. pGLFWKeyFun = ^GLFWKeyFun;
  81. GLFWKeyFun = procedure(p: pGLFWWindow; i2, i3, i4, i5: longint); cdecl;
  82. pGLFWerrorfun = ^GLFWerrorfun;
  83. GLFWerrorfun = procedure(Error: GLFW_INT; Description: PChar); cdecl;
  84. pGLFWmonitorfun = ^GLFWmonitorfun;
  85. GLFWmonitorfun = procedure(Monitor: GLFWmonitor); cdecl;
  86. pGLFWjoystickfun = ^GLFWjoystickfun;
  87. GLFWjoystickfun = procedure(jig, event: GLFW_INT); cdecl;
  88. pGLFWwindowposfun = ^GLFWwindowposfun;
  89. GLFWwindowposfun = procedure(window: pGLFWwindow; PosX, PosY: integer); cdecl;
  90. pGLFWwindowsizefun = ^GLFWwindowsizefun;
  91. GLFWwindowsizefun = procedure(window: pGLFWwindow; Width, Height: integer); cdecl;
  92. pGLFWwindowclosefun = ^GLFWwindowclosefun;
  93. GLFWwindowclosefun = procedure(window: pGLFWwindow); cdecl;
  94. pGLFWwindowrefreshfun = ^GLFWwindowrefreshfun;
  95. GLFWwindowrefreshfun = procedure(window: pGLFWwindow); cdecl;
  96. pGLFWwindowfocusfun = ^GLFWwindowfocusfun;
  97. GLFWwindowfocusfun = procedure(window: pGLFWwindow); cdecl;
  98. pGLFWwindowiconifyfun = ^GLFWwindowiconifyfun;
  99. GLFWwindowiconifyfun = procedure(window: pGLFWwindow); cdecl;
  100. { The function pointer type for window maximize callbacks.
  101. This is the function pointer type for window maximize callbacks. A window
  102. maximize callback function has the following signature:
  103. void function_name(GLFWwindow window, int maximized)
  104. endcode
  105. param[in] window The window that was maximized or restored.
  106. param[in] maximized `GLFW_TRUE` if the window was maximized, or
  107. `GLFW_FALSE` if it was restored.
  108. sa ref window_maximize
  109. sa glfwSetWindowMaximizeCallback
  110. since Added in version 3.3.
  111. }
  112. pGLFWwindowmaximizefun = ^GLFWwindowmaximizefun;
  113. GLFWwindowmaximizefun = procedure(Windows: pGLFWwindow); cdecl;
  114. pGLFWframebuffersizefun = ^GLFWframebuffersizefun;
  115. GLFWframebuffersizefun = procedure(window: pGLFWwindow;
  116. witdth, Height: integer); cdecl;
  117. { The function pointer type for window content scale callbacks.
  118. This is the function pointer type for window content scale callbacks.
  119. A window content scale callback function has the following signature:
  120. void function_name(GLFWwindow window, float xscale, float yscale)
  121. endcode
  122. param[in] window The window whose content scale changed.
  123. param[in] xscale The new x-axis content scale of the window.
  124. param[in] yscale The new y-axis content scale of the window.
  125. sa ref window_scale
  126. sa ref glfwSetWindowContentScaleCallback
  127. since Added in version 3.3.
  128. ingroup window
  129. }
  130. pGLFWwindowcontentscalefun = ^GLFWwindowcontentscalefun;
  131. GLFWwindowcontentscalefun = procedure(window: pGLFWwindow;
  132. xscale, yscale: single); cdecl;
  133. pGLFWcharfun = ^GLFWcharfun;
  134. GLFWcharfun = procedure(window: pGLFWwindow); cdecl;
  135. pGLFWmousebuttonfun = ^GLFWmousebuttonfun;
  136. GLFWmousebuttonfun = procedure(window: pGLFWwindow;
  137. button, action, mods: integer); cdecl;
  138. pGLFWcursorposfun = ^GLFWcursorposfun;
  139. GLFWcursorposfun = procedure(window: pGLFWwindow; xpos, ypos: integer); cdecl;
  140. pGLFWcursorenterfun = ^GLFWcursorenterfun;
  141. GLFWcursorenterfun = procedure(window: pGLFWwindow); cdecl;
  142. pGLFWscrollfun = ^GLFWscrollfun;
  143. GLFWscrollfun = procedure(window: pGLFWwindow; xoffset, yoffset: integer); cdecl;
  144. pGLFWglproc = ^GLFWglproc;
  145. GLFWglproc = procedure; cdecl;
  146. { Vulkan API function pointer type.
  147. Generic function pointer used for returning Vulkan API function pointers
  148. without forcing a cast from a regular pointer.
  149. sa ref vulkan_proc
  150. sa ref glfwGetInstanceProcAddress
  151. since Added in version 3.2.
  152. ingroup vulkan
  153. }
  154. pGLFWvkproc = ^GLFWvkproc;
  155. GLFWvkproc = procedure; cdecl;
  156. PGLFWcharmodsfun = ^GLFWcharmodsfun;
  157. GLFWcharmodsfun = procedure(window: pGLFWwindow; cbfun: pGLFWcharmodsfun);
  158. type
  159. pGLFWdropfun = ^GLFWdropfun;
  160. GLFWdropfun = procedure(window: pGLFWwindow; Count: integer; names: PChar);
  161. const
  162. {$IFDEF MSWINDOWS}
  163. GLFW_DLL = 'GLFW3.DLL';
  164. {$ELSE}
  165. GLFW_DLL = 'GLFW3.so';
  166. {$ENDIF}
  167. //========================================================================
  168. // GLFW version
  169. //========================================================================
  170. {
  171. The major version number of the GLFW header.
  172. The major version number of the GLFW header. This is incremented when the
  173. API is changed in non-compatible ways.
  174. }
  175. GLFW_VERSION_MAJOR = 3;
  176. {
  177. The minor version number of the GLFW header.
  178. The minor version number of the GLFW header. This is incremented when
  179. features are added to the API but it remains backward-compatible.
  180. }
  181. GLFW_VERSION_MINOR = 3;
  182. {
  183. The revision number of the GLFW header.
  184. The revision number of the GLFW header. This is incremented when a bug fix
  185. release is made that does not contain any API changes.
  186. }
  187. GLFW_VERSION_REVISION = 8;
  188. {
  189. The key or mouse button was released.
  190. }
  191. GLFW_RELEASE = 0;
  192. {
  193. The key or mouse button was pressed.
  194. }
  195. GLFW_PRESS = 1;
  196. {
  197. The key was held down until it repeated.
  198. }
  199. GLFW_REPEAT = 2;
  200. //Version 334
  201. {
  202. hat_state Joystick hat states
  203. Joystick hat states.
  204. See joystick hat input (ref joystick_hat) for how these are used.
  205. }
  206. GLFW_HAT_CENTERED = 0;
  207. GLFW_HAT_UP = 1;
  208. GLFW_HAT_RIGHT = 2;
  209. GLFW_HAT_DOWN = 4;
  210. GLFW_HAT_LEFT = 8;
  211. GLFW_HAT_RIGHT_UP = GLFW_HAT_RIGHT or GLFW_HAT_UP;
  212. GLFW_HAT_RIGHT_DOWN = GLFW_HAT_RIGHT or GLFW_HAT_DOWN;
  213. GLFW_HAT_LEFT_UP = GLFW_HAT_LEFT or GLFW_HAT_UP;
  214. GLFW_HAT_LEFT_DOWN = GLFW_HAT_LEFT or GLFW_HAT_DOWN;
  215. GLFW_KEY_UNKNOWN = -(1);
  216. GLFW_KEY_SPACE = 32;
  217. GLFW_KEY_APOSTROPHE = 39;
  218. GLFW_KEY_COMMA = 44;
  219. GLFW_KEY_MINUS = 45;
  220. GLFW_KEY_PERIOD = 46;
  221. GLFW_KEY_SLASH = 47;
  222. GLFW_KEY_0 = 48;
  223. GLFW_KEY_1 = 49;
  224. GLFW_KEY_2 = 50;
  225. GLFW_KEY_3 = 51;
  226. GLFW_KEY_4 = 52;
  227. GLFW_KEY_5 = 53;
  228. GLFW_KEY_6 = 54;
  229. GLFW_KEY_7 = 55;
  230. GLFW_KEY_8 = 56;
  231. GLFW_KEY_9 = 57;
  232. GLFW_KEY_SEMICOLON = 59;
  233. GLFW_KEY_EQUAL = 61;
  234. GLFW_KEY_A = 65;
  235. GLFW_KEY_B = 66;
  236. GLFW_KEY_C = 67;
  237. GLFW_KEY_D = 68;
  238. GLFW_KEY_E = 69;
  239. GLFW_KEY_F = 70;
  240. GLFW_KEY_G = 71;
  241. GLFW_KEY_H = 72;
  242. GLFW_KEY_I = 73;
  243. GLFW_KEY_J = 74;
  244. GLFW_KEY_K = 75;
  245. GLFW_KEY_L = 76;
  246. GLFW_KEY_M = 77;
  247. GLFW_KEY_N = 78;
  248. GLFW_KEY_O = 79;
  249. GLFW_KEY_P = 80;
  250. GLFW_KEY_Q = 81;
  251. GLFW_KEY_R = 82;
  252. GLFW_KEY_S = 83;
  253. GLFW_KEY_T = 84;
  254. GLFW_KEY_U = 85;
  255. GLFW_KEY_V = 86;
  256. GLFW_KEY_W = 87;
  257. GLFW_KEY_X = 88;
  258. GLFW_KEY_Y = 89;
  259. GLFW_KEY_Z = 90;
  260. GLFW_KEY_LEFT_BRACKET = 91;
  261. GLFW_KEY_BACKSLASH = 92;
  262. GLFW_KEY_RIGHT_BRACKET = 93;
  263. GLFW_KEY_GRAVE_ACCENT = 96;
  264. GLFW_KEY_WORLD_1 = 161;
  265. GLFW_KEY_WORLD_2 = 162; // non-US #2
  266. GLFW_KEY_ESCAPE = 256;
  267. GLFW_KEY_ENTER = 257;
  268. GLFW_KEY_TAB = 258;
  269. GLFW_KEY_BACKSPACE = 259;
  270. GLFW_KEY_INSERT = 260;
  271. GLFW_KEY_DELETE = 261;
  272. GLFW_KEY_RIGHT = 262;
  273. GLFW_KEY_LEFT = 263;
  274. GLFW_KEY_DOWN = 264;
  275. GLFW_KEY_UP = 265;
  276. GLFW_KEY_PAGE_UP = 266;
  277. GLFW_KEY_PAGE_DOWN = 267;
  278. GLFW_KEY_HOME = 268;
  279. GLFW_KEY_END = 269;
  280. GLFW_KEY_CAPS_LOCK = 280;
  281. GLFW_KEY_SCROLL_LOCK = 281;
  282. GLFW_KEY_NUM_LOCK = 282;
  283. GLFW_KEY_PRINT_SCREEN = 283;
  284. GLFW_KEY_PAUSE = 284;
  285. GLFW_KEY_F1 = 290;
  286. GLFW_KEY_F2 = 291;
  287. GLFW_KEY_F3 = 292;
  288. GLFW_KEY_F4 = 293;
  289. GLFW_KEY_F5 = 294;
  290. GLFW_KEY_F6 = 295;
  291. GLFW_KEY_F7 = 296;
  292. GLFW_KEY_F8 = 297;
  293. GLFW_KEY_F9 = 298;
  294. GLFW_KEY_F10 = 299;
  295. GLFW_KEY_F11 = 300;
  296. GLFW_KEY_F12 = 301;
  297. GLFW_KEY_F13 = 302;
  298. GLFW_KEY_F14 = 303;
  299. GLFW_KEY_F15 = 304;
  300. GLFW_KEY_F16 = 305;
  301. GLFW_KEY_F17 = 306;
  302. GLFW_KEY_F18 = 307;
  303. GLFW_KEY_F19 = 308;
  304. GLFW_KEY_F20 = 309;
  305. GLFW_KEY_F21 = 310;
  306. GLFW_KEY_F22 = 311;
  307. GLFW_KEY_F23 = 312;
  308. GLFW_KEY_F24 = 313;
  309. GLFW_KEY_F25 = 314;
  310. GLFW_KEY_KP_0 = 320;
  311. GLFW_KEY_KP_1 = 321;
  312. GLFW_KEY_KP_2 = 322;
  313. GLFW_KEY_KP_3 = 323;
  314. GLFW_KEY_KP_4 = 324;
  315. GLFW_KEY_KP_5 = 325;
  316. GLFW_KEY_KP_6 = 326;
  317. GLFW_KEY_KP_7 = 327;
  318. GLFW_KEY_KP_8 = 328;
  319. GLFW_KEY_KP_9 = 329;
  320. GLFW_KEY_KP_DECIMAL = 330;
  321. GLFW_KEY_KP_DIVIDE = 331;
  322. GLFW_KEY_KP_MULTIPLY = 332;
  323. GLFW_KEY_KP_SUBTRACT = 333;
  324. GLFW_KEY_KP_ADD = 334;
  325. GLFW_KEY_KP_ENTER = 335;
  326. GLFW_KEY_KP_EQUAL = 336;
  327. GLFW_KEY_LEFT_SHIFT = 340;
  328. GLFW_KEY_LEFT_CONTROL = 341;
  329. GLFW_KEY_LEFT_ALT = 342;
  330. GLFW_KEY_LEFT_SUPER = 343;
  331. GLFW_KEY_RIGHT_SHIFT = 344;
  332. GLFW_KEY_RIGHT_CONTROL = 345;
  333. GLFW_KEY_RIGHT_ALT = 346;
  334. GLFW_KEY_RIGHT_SUPER = 347;
  335. GLFW_KEY_MENU = 348;
  336. GLFW_KEY_LAST = GLFW_KEY_MENU;
  337. GLFW_MOD_SHIFT = $0001;
  338. GLFW_MOD_CONTROL = $0002;
  339. GLFW_MOD_ALT = $0004;
  340. GLFW_MOD_SUPER = $0008;
  341. GLFW_MOUSE_BUTTON_1 = 0;
  342. GLFW_MOUSE_BUTTON_2 = 1;
  343. GLFW_MOUSE_BUTTON_3 = 2;
  344. GLFW_MOUSE_BUTTON_4 = 3;
  345. GLFW_MOUSE_BUTTON_5 = 4;
  346. GLFW_MOUSE_BUTTON_6 = 5;
  347. GLFW_MOUSE_BUTTON_7 = 6;
  348. GLFW_MOUSE_BUTTON_8 = 7;
  349. GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8;
  350. GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1;
  351. GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2;
  352. GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3;
  353. GLFW_JOYSTICK_1 = 0;
  354. GLFW_JOYSTICK_2 = 1;
  355. GLFW_JOYSTICK_3 = 2;
  356. GLFW_JOYSTICK_4 = 3;
  357. GLFW_JOYSTICK_5 = 4;
  358. GLFW_JOYSTICK_6 = 5;
  359. GLFW_JOYSTICK_7 = 6;
  360. GLFW_JOYSTICK_8 = 7;
  361. GLFW_JOYSTICK_9 = 8;
  362. GLFW_JOYSTICK_10 = 9;
  363. GLFW_JOYSTICK_11 = 10;
  364. GLFW_JOYSTICK_12 = 11;
  365. GLFW_JOYSTICK_13 = 12;
  366. GLFW_JOYSTICK_14 = 13;
  367. GLFW_JOYSTICK_15 = 14;
  368. GLFW_JOYSTICK_16 = 15;
  369. GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16;
  370. {
  371. See ref gamepad for how these are used.
  372. }
  373. GLFW_GAMEPAD_BUTTON_A = 0;
  374. GLFW_GAMEPAD_BUTTON_B = 1;
  375. GLFW_GAMEPAD_BUTTON_X = 2;
  376. GLFW_GAMEPAD_BUTTON_Y = 3;
  377. GLFW_GAMEPAD_BUTTON_LEFT_BUMPER = 4;
  378. GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER = 5;
  379. GLFW_GAMEPAD_BUTTON_BACK = 6;
  380. GLFW_GAMEPAD_BUTTON_START = 7;
  381. GLFW_GAMEPAD_BUTTON_GUIDE = 8;
  382. GLFW_GAMEPAD_BUTTON_LEFT_THUMB = 9;
  383. GLFW_GAMEPAD_BUTTON_RIGHT_THUMB = 10;
  384. GLFW_GAMEPAD_BUTTON_DPAD_UP = 11;
  385. GLFW_GAMEPAD_BUTTON_DPAD_RIGHT = 12;
  386. GLFW_GAMEPAD_BUTTON_DPAD_DOWN = 13;
  387. GLFW_GAMEPAD_BUTTON_DPAD_LEFT = 14;
  388. GLFW_GAMEPAD_BUTTON_LAST = GLFW_GAMEPAD_BUTTON_DPAD_LEFT;
  389. GLFW_GAMEPAD_BUTTON_CROSS = GLFW_GAMEPAD_BUTTON_A;
  390. GLFW_GAMEPAD_BUTTON_CIRCLE = GLFW_GAMEPAD_BUTTON_B;
  391. GLFW_GAMEPAD_BUTTON_SQUARE = GLFW_GAMEPAD_BUTTON_X;
  392. GLFW_GAMEPAD_BUTTON_TRIANGLE = GLFW_GAMEPAD_BUTTON_Y;
  393. { Gamepad axes.
  394. See ref gamepad for how these are used.
  395. }
  396. GLFW_GAMEPAD_AXIS_LEFT_X = 0;
  397. GLFW_GAMEPAD_AXIS_LEFT_Y = 1;
  398. GLFW_GAMEPAD_AXIS_RIGHT_X = 2;
  399. GLFW_GAMEPAD_AXIS_RIGHT_Y = 3;
  400. GLFW_GAMEPAD_AXIS_LEFT_TRIGGER = 4;
  401. GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER = 5;
  402. GLFW_GAMEPAD_AXIS_LAST = GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER;
  403. GLFW_NO_ERROR = $0;
  404. GLFW_NOT_INITIALIZED = $00010001;
  405. GLFW_NO_CURRENT_CONTEXT = $00010002;
  406. GLFW_INVALID_ENUM = $00010003;
  407. GLFW_INVALID_VALUE = $00010004;
  408. GLFW_OUT_OF_MEMORY = $00010005;
  409. GLFW_API_UNAVAILABLE = $00010006;
  410. GLFW_VERSION_UNAVAILABLE = $00010007;
  411. GLFW_PLATFORM_ERROR = $00010008;
  412. GLFW_FORMAT_UNAVAILABLE = $00010009;
  413. GLFW_FOCUSED = $00020001;
  414. GLFW_ICONIFIED = $00020002;
  415. GLFW_RESIZABLE = $00020003;
  416. GLFW_VISIBLE = $00020004;
  417. GLFW_DECORATED = $00020005;
  418. GLFW_AUTO_ICONIFY = $00020006;
  419. GLFW_FLOATING = $00020007;
  420. GLFW_RED_BITS = $00021001;
  421. GLFW_GREEN_BITS = $00021002;
  422. GLFW_BLUE_BITS = $00021003;
  423. GLFW_ALPHA_BITS = $00021004;
  424. GLFW_DEPTH_BITS = $00021005;
  425. GLFW_STENCIL_BITS = $00021006;
  426. GLFW_ACCUM_RED_BITS = $00021007;
  427. GLFW_ACCUM_GREEN_BITS = $00021008;
  428. GLFW_ACCUM_BLUE_BITS = $00021009;
  429. GLFW_ACCUM_ALPHA_BITS = $0002100A;
  430. GLFW_AUX_BUFFERS = $0002100B;
  431. GLFW_STEREO = $0002100C;
  432. GLFW_SAMPLES = $0002100D;
  433. GLFW_SRGB_CAPABLE = $0002100E;
  434. GLFW_REFRESH_RATE = $0002100F;
  435. GLFW_DOUBLEBUFFER = $00021010;
  436. GLFW_CLIENT_API = $00022001;
  437. GLFW_CONTEXT_VERSION_MAJOR = $00022002;
  438. GLFW_CONTEXT_VERSION_MINOR = $00022003;
  439. GLFW_CONTEXT_REVISION = $00022004;
  440. GLFW_CONTEXT_ROBUSTNESS = $00022005;
  441. GLFW_OPENGL_FORWARD_COMPAT = $00022006;
  442. GLFW_OPENGL_DEBUG_CONTEXT = $00022007;
  443. GLFW_OPENGL_PROFILE = $00022008;
  444. GLFW_CONTEXT_RELEASE_BEHAVIOR = $00022009;
  445. GLFW_OPENGL_API = $00030001;
  446. GLFW_OPENGL_ES_API = $00030002;
  447. GLFW_NO_ROBUSTNESS = 0;
  448. GLFW_NO_RESET_NOTIFICATION = $00031001;
  449. GLFW_LOSE_CONTEXT_ON_RESET = $00031002;
  450. GLFW_OPENGL_ANY_PROFILE = 0;
  451. GLFW_OPENGL_CORE_PROFILE = $00032001;
  452. GLFW_OPENGL_COMPAT_PROFILE = $00032002;
  453. GLFW_CURSOR = $00033001;
  454. GLFW_STICKY_KEYS = $00033002;
  455. GLFW_STICKY_MOUSE_BUTTONS = $00033003;
  456. GLFW_CURSOR_NORMAL = $00034001;
  457. GLFW_CURSOR_HIDDEN = $00034002;
  458. GLFW_CURSOR_DISABLED = $00034003;
  459. GLFW_ANY_RELEASE_BEHAVIOR = 0;
  460. GLFW_RELEASE_BEHAVIOR_FLUSH = $00035001;
  461. GLFW_RELEASE_BEHAVIOR_NONE = $00035002;
  462. GLFW_ARROW_CURSOR = $00036001;
  463. GLFW_IBEAM_CURSOR = $00036002;
  464. GLFW_CROSSHAIR_CURSOR = $00036003;
  465. GLFW_HAND_CURSOR = $00036004;
  466. GLFW_HRESIZE_CURSOR = $00036005;
  467. GLFW_VRESIZE_CURSOR = $00036006;
  468. GLFW_CONNECTED = $00040001;
  469. GLFW_DISCONNECTED = $00040002;
  470. {
  471. Joystick hat buttons init hint.
  472. Joystick hat buttons (ref GLFW_JOYSTICK_HAT_BUTTONS).
  473. }
  474. GLFW_JOYSTICK_HAT_BUTTONS = $00050001;
  475. { macOS specific init hint.
  476. macOS specific .
  477. }
  478. GLFW_COCOA_CHDIR_RESOURCES = $00051001;
  479. {! macOS specific init hint.
  480. macOS specific ).
  481. }
  482. GLFW_COCOA_MENUBAR = $00051002;
  483. GLFW_DONT_CARE = -1;
  484. //All call must be cdecl
  485. //========================================================================
  486. //Init
  487. //========================================================================
  488. {
  489. Initializes the GLFW library.
  490. This function initializes the GLFW library. Before most GLFW functions can
  491. be used, GLFW must be initialized, and before an application terminates GLFW
  492. should be terminated in order to free any resources allocated during or
  493. after initialization.
  494. If this function fails, it calls ref glfwTerminate before returning. If it
  495. succeeds, you should call ref glfwTerminate before the application exits.
  496. Additional calls to this function after successful initialization but before
  497. termination will return `GLFW_TRUE` immediately.
  498. return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an occurred.
  499. errors Possible errors include ref GLFW_PLATFORM_ERROR.
  500. remark macos This function will change the current directory of the
  501. application to the `Contents/Resources` subdirectory of the application's
  502. bundle, if present. This can be disabled with the ref
  503. GLFW_COCOA_CHDIR_RESOURCES init hint.
  504. remark x11 This function will set the `LC_CTYPE` category of the
  505. application locale according to the current environment if that category is
  506. still "C". This is because the "C" locale breaks Unicode text input.
  507. thread_safety This function must only be called from the main thread.
  508. since Added in version 1.0.
  509. }
  510. function glfwInit: integer cdecl; external GLFW_DLL;
  511. {
  512. Terminates the GLFW library.
  513. This function destroys all remaining windows and cursors, restores any
  514. modified gamma ramps and frees any other allocated resources. Once this
  515. function is called, you must again call ref glfwInit successfully before
  516. you will be able to use most GLFW functions.
  517. If GLFW has been successfully initialized, this function should be called
  518. before the application exits. If initialization fails, there is no need to
  519. call this function, as it is called by ref glfwInit before it returns
  520. failure.
  521. This function has no effect if GLFW is not initialized.
  522. errors Possible errors include ref GLFW_PLATFORM_ERROR.
  523. remark This function may be called before ref glfwInit.
  524. warning The contexts of any remaining windows must not be current on any
  525. other thread when this function is called.
  526. reentrancy This function must not be called from a callback.
  527. thread_safety This function must only be called from the main thread.
  528. sa ref intro_init
  529. sa ref glfwInit
  530. since Added in version 1.0.
  531. }
  532. procedure glfwTerminate; cdecl; external GLFW_DLL;
  533. {
  534. Sets the specified init hint to the desired value.
  535. This function sets hints for the next initialization of GLFW.
  536. The values you set hints to are never reset by GLFW, but they only take
  537. effect during initialization. Once GLFW has been initialized, any values
  538. you set will be ignored until the library is terminated and initialized
  539. again.
  540. Some hints are platform specific. These may be set on any platform but they
  541. will only affect their specific platform. Other platforms will ignore them.
  542. Setting these hints requires no platform specific headers or functions.
  543. param[in] hint The [init hint](ref init_hints) to set.
  544. param[in] value The new value of the init hint.
  545. errors Possible errors include ref GLFW_INVALID_ENUM and ref
  546. GLFW_INVALID_VALUE.
  547. remarks This function may be called before ref glfwInit.
  548. thread_safety This function must only be called from the main thread.
  549. }
  550. procedure glfwInitHint(hint: integer; Value: integer); cdecl; external GLFW_DLL;
  551. {
  552. Retrieves the version of the GLFW library.
  553. This function retrieves the major, minor and revision numbers of the GLFW
  554. library. It is intended for when you are using GLFW as a shared library and
  555. want to ensure that you are using the minimum required version.
  556. Any or all of the version arguments may be `NULL`.
  557. param[out] major Where to store the major version number, or `NULL`.
  558. param[out] minor Where to store the minor version number, or `NULL`.
  559. param[out] rev Where to store the revision number, or `NULL`.
  560. errors None.
  561. remark This function may be called before ref glfwInit.
  562. thread_safety This function may be called from any thread.
  563. }
  564. procedure glfwGetVersion(major, minor, rev: integer);
  565. cdecl; external GLFW_DLL;
  566. {
  567. Returns a string describing the compile-time configuration.
  568. This function returns the compile-time generated
  569. [version string](ref intro_version_string) of the GLFW library binary. It
  570. describes the version, platform, compiler and any platform-specific
  571. compile-time options. It should not be confused with the OpenGL or OpenGL
  572. ES version string, queried with `glGetString`.
  573. __Do not use the version string__ to parse the GLFW library version. The
  574. ref glfwGetVersion function provides the version of the running library
  575. binary in numerical format.
  576. return The ASCII encoded GLFW version string.
  577. errors None.
  578. remark This function may be called before ref glfwInit.
  579. pointer_lifetime The returned string is static and compile-time generated.
  580. thread_safety This function may be called from any thread.
  581. }
  582. function glfwGetVersionString: PChar; cdecl; external GLFW_DLL;
  583. {
  584. Returns and clears the last error for the calling thread.
  585. This function returns and clears the [error code](ref errors) of the last
  586. error that occurred on the calling thread, and optionally a UTF-8 encoded
  587. human-readable description of it. If no error has occurred since the last
  588. call, it returns ref GLFW_NO_ERROR (zero) and the description pointer is
  589. set to `NULL`.
  590. param[in] description Where to store the error description pointer, or `NULL`.
  591. return The last error code for the calling thread, or ref GLFW_NO_ERROR
  592. (zero).
  593. errors None.
  594. pointer_lifetime The returned string is allocated and freed by GLFW. You
  595. should not free it yourself. It is guaranteed to be valid only until the
  596. next error occurs or the library is terminated.
  597. remark This function may be called before ref glfwInit.
  598. thread_safety This function may be called from any thread.
  599. sa ref error_handling
  600. sa ref glfwSetErrorCallback
  601. since Added in version 3.3.
  602. ingroup init
  603. }
  604. function glfwGetError(description: PChar): integer; cdecl; external GLFW_DLL;
  605. //========================================================================
  606. //Monitor
  607. //========================================================================
  608. {
  609. /! Returns the currently connected monitors.
  610. This function returns an array of handles for all currently connected
  611. monitors. The primary monitor is always first in the returned array. If no
  612. monitors were found, this function returns `NULL`.
  613. param[out] count Where to store the number of monitors in the returned
  614. array. This is set to zero if an error occurred.
  615. return An array of monitor handles, or `NULL` if no monitors were found or
  616. if an [error](ref error_handling) occurred.
  617. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  618. pointer_lifetime The returned array is allocated and freed by GLFW. You
  619. should not free it yourself. It is guaranteed to be valid only until the
  620. monitor configuration changes or the library is terminated.
  621. thread_safety This function must only be called from the main thread.
  622. sa ref monitor_monitors
  623. sa ref monitor_event
  624. sa ref glfwGetPrimaryMonitor
  625. since Added in version 3.0.
  626. }
  627. function glfwGetMonitors(var Monitors: GLFW_INT): GLFWmonitor; cdecl; external GLFW_DLL;
  628. {
  629. /! Returns the primary monitor.
  630. This function returns the primary monitor. This is usually the monitor
  631. where elements like the task bar or global menu bar are located.
  632. return The primary monitor, or `NULL` if no monitors were found or if an
  633. [error](ref error_handling) occurred.
  634. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  635. thread_safety This function must only be called from the main thread.
  636. remark The primary monitor is always first in the array returned by ref
  637. glfwGetMonitors.
  638. sa ref monitor_monitors
  639. sa ref glfwGetMonitors
  640. since Added in version 3.0.
  641. }
  642. function glfwGetPrimaryMonitor: pGLFWmonitor; cdecl; external GLFW_DLL;
  643. {
  644. /! Returns the position of the monitor's viewport on the virtual screen.
  645. This function returns the position, in screen coordinates, of the upper-left
  646. corner of the specified monitor.
  647. Any or all of the position arguments may be `NULL`. If an error occurs, all
  648. non-`NULL` position arguments will be set to zero.
  649. param[in] monitor The monitor to query.
  650. param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
  651. param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
  652. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  653. GLFW_PLATFORM_ERROR.
  654. thread_safety This function must only be called from the main thread.
  655. sa ref monitor_properties
  656. since Added in version 3.0.
  657. }
  658. procedure glfwGetMonitorPos(monitor: pGLFWmonitor; var xpos: GLFW_INT;
  659. var ypos: GLFW_INT); cdecl; external GLFW_DLL;
  660. { Retrieves the work area of the monitor.
  661. This function returns the position, in screen coordinates, of the upper-left
  662. corner of the work area of the specified monitor along with the work area
  663. size in screen coordinates. The work area is defined as the area of the
  664. monitor not occluded by the operating system task bar where present. If no
  665. task bar exists then the work area is the monitor resolution in screen
  666. coordinates.
  667. Any or all of the position and size arguments may be `NULL`. If an error
  668. occurs, all non-`NULL` position and size arguments will be set to zero.
  669. param[in] monitor The monitor to query.
  670. param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
  671. param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
  672. param[out] width Where to store the monitor width, or `NULL`.
  673. param[out] height Where to store the monitor height, or `NULL`.
  674. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  675. GLFW_PLATFORM_ERROR.
  676. thread_safety This function must only be called from the main thread.
  677. sa ref monitor_workarea
  678. since Added in version 3.3.
  679. ingroup monitor
  680. /
  681. GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor monitor, int xpos, int ypos, int width, int height);}
  682. procedure glfwGetMonitorWorkarea(monitor: pGLFWmonitor;
  683. var xpos, ypos, Width, Height: GLFW_INT); cdecl; external GLFW_DLL;
  684. {
  685. /! Returns the physical size of the monitor.
  686. This function returns the size, in millimetres, of the display area of the
  687. specified monitor.
  688. Some systems do not provide accurate monitor size information, either
  689. because the monitor
  690. [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
  691. data is incorrect or because the driver does not report it accurately.
  692. Any or all of the size arguments may be `NULL`. If an error occurs, all
  693. non-`NULL` size arguments will be set to zero.
  694. param[in] monitor The monitor to query.
  695. param[out] widthMM Where to store the width, in millimetres, of the
  696. monitor's display area, or `NULL`.
  697. param[out] heightMM Where to store the height, in millimetres, of the
  698. monitor's display area, or `NULL`.
  699. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  700. remark win32 On Windows 8 and earlier the physical size is calculated from
  701. the current resolution and system DPI instead of querying the monitor EDID data.
  702. thread_safety This function must only be called from the main thread.
  703. sa ref monitor_properties
  704. since Added in version 3.0.
  705. }
  706. procedure glfwGetMonitorPhysicalSize(Monitor: pGLFWmonitor; var Width: GLFW_INT;
  707. var Height: GLFW_INT); cdecl; external GLFW_DLL;
  708. { Retrieves the content scale for the specified monitor.
  709. This function retrieves the content scale for the specified monitor. The
  710. content scale is the ratio between the current DPI and the platform's
  711. default DPI. This is especially important for text and any UI elements. If
  712. the pixel dimensions of your UI scaled by this look appropriate on your
  713. machine then it should appear at a reasonable size on other machines
  714. regardless of their DPI and scaling settings. This relies on the system DPI
  715. and scaling settings being somewhat correct.
  716. The content scale may depend on both the monitor resolution and pixel
  717. density and on user settings. It may be very different from the raw DPI
  718. calculated from the physical size and current resolution.
  719. param[in] monitor The monitor to query.
  720. param[out] xscale Where to store the x-axis content scale, or `NULL`.
  721. param[out] yscale Where to store the y-axis content scale, or `NULL`.
  722. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  723. GLFW_PLATFORM_ERROR.
  724. thread_safety This function must only be called from the main thread.
  725. sa ref monitor_scale
  726. sa ref glfwGetWindowContentScale
  727. since Added in version 3.3.
  728. ingroup monitor
  729. }
  730. procedure glfwGetMonitorContentScale(monitor: pGLFWmonitor; var xscale, yscale: single);
  731. cdecl; external GLFW_DLL;
  732. {
  733. /! Returns the name of the specified monitor.
  734. This function returns a human-readable name, encoded as UTF-8, of the
  735. specified monitor. The name typically reflects the make and model of the
  736. monitor and is not guaranteed to be unique among the connected monitors.
  737. param[in] monitor The monitor to query.
  738. return The UTF-8 encoded name of the monitor, or `NULL` if an
  739. [error](ref error_handling) occurred.
  740. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  741. pointer_lifetime The returned string is allocated and freed by GLFW. You
  742. should not free it yourself. It is valid until the specified monitor is
  743. disconnected or the library is terminated.
  744. thread_safety This function must only be called from the main thread.
  745. sa ref monitor_properties
  746. since Added in version 3.0.
  747. }
  748. function glfwGetMonitorName(Monitor: pGLFWmonitor): PChar; cdecl; external GLFW_DLL;
  749. { Sets the user pointer of the specified monitor.
  750. This function sets the user-defined pointer of the specified monitor. The
  751. current value is retained until the monitor is disconnected. The initial
  752. value is `NULL`.
  753. This function may be called from the monitor callback, even for a monitor
  754. that is being disconnected.
  755. param[in] monitor The monitor whose pointer to set.
  756. param[in] pointer The new value.
  757. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  758. thread_safety This function may be called from any thread. Access is not
  759. synchronized.
  760. sa ref monitor_userptr
  761. sa ref glfwGetMonitorUserPointer
  762. since Added in version 3.3.
  763. ingroup monitor
  764. /
  765. GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor monitor, void pointer);}
  766. procedure glfwSetMonitorUserPointer(pGLFWmonitor, UserPointer: Pointer);
  767. cdecl; external GLFW_DLL;
  768. { Returns the user pointer of the specified monitor.
  769. This function returns the current value of the user-defined pointer of the
  770. specified monitor. The initial value is `NULL`.
  771. This function may be called from the monitor callback, even for a monitor
  772. that is being disconnected.
  773. param[in] monitor The monitor whose pointer to return.
  774. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  775. thread_safety This function may be called from any thread. Access is not
  776. synchronized.
  777. sa ref monitor_userptr
  778. sa ref glfwSetMonitorUserPointer
  779. since Added in version 3.3.
  780. ingroup monitor
  781. /
  782. GLFWAPI void glfwGetMonitorUserPointer(GLFWmonitor monitor);}
  783. function glfwGetMonitorUserPointer(monitor: pGLFWmonitor): Pointer;
  784. cdecl; external GLFW_DLL;
  785. {
  786. /! Sets the monitor configuration callback.
  787. This function sets the monitor configuration callback, or removes the
  788. currently set callback. This is called when a monitor is connected to or
  789. disconnected from the system.
  790. param[in] callback The new callback, or `NULL` to remove the currently set
  791. callback.
  792. return The previously set callback, or `NULL` if no callback was set or the
  793. library had not been [initialized](ref intro_init).
  794. callback_signature
  795. code
  796. void function_name(GLFWmonitor monitor, int event)
  797. endcode
  798. For more information about the callback parameters, see the
  799. [function pointer type](ref GLFWmonitorfun).
  800. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  801. thread_safety This function must only be called from the main thread.
  802. sa ref monitor_event
  803. since Added in version 3.0.
  804. }
  805. function glfwSetMonitorCallback(cbfun: GLFWmonitorfun): pGLFWmonitorfun;
  806. cdecl; external GLFW_DLL; //Untest
  807. //========================================================================
  808. //Video Mode
  809. //========================================================================
  810. {
  811. /! Returns the available video modes for the specified monitor.
  812. This function returns an array of all video modes supported by the specified
  813. monitor. The returned array is sorted in ascending order, first by color
  814. bit depth (the sum of all channel depths), then by resolution area (the
  815. product of width and height), then resolution width and finally by refresh
  816. rate.
  817. param[in] monitor The monitor to query.
  818. param[out] count Where to store the number of video modes in the returned
  819. array. This is set to zero if an error occurred.
  820. return An array of video modes, or `NULL` if an
  821. [error](ref error_handling) occurred.
  822. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  823. GLFW_PLATFORM_ERROR.
  824. pointer_lifetime The returned array is allocated and freed by GLFW. You
  825. should not free it yourself. It is valid until the specified monitor is
  826. disconnected, this function is called again for that monitor or the library
  827. is terminated.
  828. thread_safety This function must only be called from the main thread.
  829. sa ref monitor_modes
  830. sa ref glfwGetVideoMode
  831. since Added in version 1.0.
  832. glfw3 Changed to return an array of modes for a specific monitor.
  833. ingroup monitor
  834. /
  835. }
  836. function glfwGetVideoModes(monitor: pGLFWmonitor; var Count: longint): PGLFWvidmode;
  837. cdecl; external GLFW_DLL;
  838. {
  839. /! Returns the current mode of the specified monitor.
  840. This function returns the current video mode of the specified monitor. If
  841. you have created a full screen window for that monitor, the return value
  842. will depend on whether that window is iconified.
  843. param[in] monitor The monitor to query.
  844. return The current mode of the monitor, or `NULL` if an
  845. [error](ref error_handling) occurred.
  846. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  847. GLFW_PLATFORM_ERROR.
  848. pointer_lifetime The returned array is allocated and freed by GLFW. You
  849. should not free it yourself. It is valid until the specified monitor is
  850. disconnected or the library is terminated.
  851. thread_safety This function must only be called from the main thread.
  852. sa ref monitor_modes
  853. sa ref glfwGetVideoModes
  854. since Added in version 3.0. Replaces `glfwGetDesktopMode`.
  855. ingroup monitor
  856. /
  857. }
  858. function glfwGetVideoMode(monitor: pGLFWmonitor): pGLFWvidmode;
  859. cdecl; external GLFW_DLL;
  860. {
  861. ! Generates a gamma ramp and sets it for the specified monitor.
  862. This function generates an appropriately sized gamma ramp from the specified
  863. exponent and then calls ref glfwSetGammaRamp with it. The value must be
  864. a finite number greater than zero.
  865. The software controlled gamma ramp is applied _in addition_ to the hardware
  866. gamma correction, which today is usually an approximation of sRGB gamma.
  867. This means that setting a perfectly linear ramp, or gamma 1.0, will produce
  868. the default (usually sRGB-like) behavior.
  869. For gamma correct rendering with OpenGL or OpenGL ES, see the ref
  870. GLFW_SRGB_CAPABLE hint.
  871. param[in] monitor The monitor whose gamma ramp to set.
  872. param[in] gamma The desired exponent.
  873. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  874. GLFW_INVALID_VALUE and ref GLFW_PLATFORM_ERROR.
  875. remark wayland Gamma handling is a privileged protocol, this function
  876. will thus never be implemented and emits ref GLFW_PLATFORM_ERROR.
  877. thread_safety This function must only be called from the main thread.
  878. sa ref monitor_gamma
  879. since Added in version 3.0
  880. }
  881. procedure glfwSetGamma(monitor: pGLFWmonitor; gamma: single); cdecl; external GLFW_DLL;
  882. {
  883. /! Returns the current gamma ramp for the specified monitor.
  884. This function returns the current gamma ramp of the specified monitor.
  885. param[in] monitor The monitor to query.
  886. return The current gamma ramp, or `NULL` if an
  887. [error](ref error_handling) occurred.
  888. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  889. GLFW_PLATFORM_ERROR.
  890. remark wayland Gamma handling is a privileged protocol, this function
  891. will thus never be implemented and emits ref GLFW_PLATFORM_ERROR while
  892. returning `NULL`.
  893. pointer_lifetime The returned structure and its arrays are allocated and
  894. freed by GLFW. You should not free them yourself. They are valid until the
  895. specified monitor is disconnected, this function is called again for that
  896. monitor or the library is terminated.
  897. thread_safety This function must only be called from the main thread.
  898. }
  899. function glfwGetGammaRamp(monitor: pGLFWmonitor): PGLFWgammaramp;
  900. cdecl; external GLFW_DLL;
  901. {
  902. ! Sets the current gamma ramp for the specified monitor.
  903. This function sets the current gamma ramp for the specified monitor. The
  904. original gamma ramp for that monitor is saved by GLFW the first time this
  905. function is called and is restored by ref glfwTerminate.
  906. The software controlled gamma ramp is applied _in addition_ to the hardware
  907. gamma correction, which today is usually an approximation of sRGB gamma.
  908. This means that setting a perfectly linear ramp, or gamma 1.0, will produce
  909. the default (usually sRGB-like) behavior.
  910. For gamma correct rendering with OpenGL or OpenGL ES, see the ref
  911. GLFW_SRGB_CAPABLE hint.
  912. param[in] monitor The monitor whose gamma ramp to set.
  913. param[in] ramp The gamma ramp to use.
  914. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  915. GLFW_PLATFORM_ERROR.
  916. remark The size of the specified gamma ramp should match the size of the
  917. current ramp for that monitor.
  918. remark win32 The gamma ramp size must be 256.
  919. remark wayland Gamma handling is a privileged protocol, this function
  920. will thus never be implemented and emits ref GLFW_PLATFORM_ERROR.
  921. pointer_lifetime The specified gamma ramp is copied before this function
  922. returns.
  923. thread_safety This function must only be called from the main thread.
  924. sa ref monitor_gamma
  925. since Added in version 3.0.
  926. }
  927. procedure glfwSetGammaRamp(monitor: pGLFWmonitor; ramp: pGLFWgammaramp);
  928. cdecl; external GLFW_DLL;
  929. //========================================================================
  930. //Windows (not the SO)
  931. //========================================================================
  932. {
  933. /! Resets all window hints to their default values.
  934. This function resets all window hints to their
  935. [default values](ref window_hints_values).
  936. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  937. thread_safety This function must only be called from the main thread.
  938. sa ref window_hints
  939. sa ref glfwWindowHint
  940. sa ref glfwWindowHintString
  941. since Added in version 3.0.
  942. }
  943. procedure glfwDefaultWindowHints; cdecl; external GLFW_DLL;
  944. {
  945. /! Sets the specified window hint to the desired value.
  946. This function sets hints for the next call to ref glfwCreateWindow. The
  947. hints, once set, retain their values until changed by a call to this
  948. function or ref glfwDefaultWindowHints, or until the library is terminated.
  949. Only integer value hints can be set with this function. String value hints
  950. are set with ref glfwWindowHintString.
  951. This function does not check whether the specified hint values are valid.
  952. If you set hints to invalid values this will instead be reported by the next
  953. call to ref glfwCreateWindow.
  954. Some hints are platform specific. These may be set on any platform but they
  955. will only affect their specific platform. Other platforms will ignore them.
  956. Setting these hints requires no platform specific headers or functions.
  957. param[in] hint The [window hint](ref window_hints) to set.
  958. param[in] value The new value of the window hint.
  959. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  960. GLFW_INVALID_ENUM.
  961. thread_safety This function must only be called from the main thread.
  962. sa ref window_hints
  963. sa ref glfwWindowHintString
  964. sa ref glfwDefaultWindowHints
  965. since Added in version 3.0. Replaces `glfwOpenWindowHint`.
  966. }
  967. procedure glfwWindowHint(target: integer; hint: integer); cdecl; external GLFW_DLL;
  968. {
  969. /! Sets the specified window hint to the desired value.
  970. This function sets hints for the next call to ref glfwCreateWindow. The
  971. hints, once set, retain their values until changed by a call to this
  972. function or ref glfwDefaultWindowHints, or until the library is terminated.
  973. Only string type hints can be set with this function. Integer value hints
  974. are set with ref glfwWindowHint.
  975. This function does not check whether the specified hint values are valid.
  976. If you set hints to invalid values this will instead be reported by the next
  977. call to ref glfwCreateWindow.
  978. Some hints are platform specific. These may be set on any platform but they
  979. will only affect their specific platform. Other platforms will ignore them.
  980. Setting these hints requires no platform specific headers or functions.
  981. param[in] hint The [window hint](ref window_hints) to set.
  982. param[in] value The new value of the window hint.
  983. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  984. GLFW_INVALID_ENUM.
  985. pointer_lifetime The specified string is copied before this function
  986. returns.
  987. thread_safety This function must only be called from the main thread.
  988. sa ref window_hints
  989. sa ref glfwWindowHint
  990. sa ref glfwDefaultWindowHints
  991. since Added in version 3.3.
  992. }
  993. procedure glfwWindowHintString(hint: integer; const Value: PChar);
  994. cdecl; external GLFW_DLL;
  995. {
  996. /! Creates a window and its associated context.
  997. This function creates a window and its associated OpenGL or OpenGL ES
  998. context. Most of the options controlling how the window and its context
  999. should be created are specified with [window hints](ref window_hints).
  1000. Successful creation does not change which context is current. Before you
  1001. can use the newly created context, you need to
  1002. [make it current](ref context_current). For information about the `share`
  1003. parameter, see ref context_sharing.
  1004. The created window, framebuffer and context may differ from what you
  1005. requested, as not all parameters and hints are
  1006. [hard constraints](ref window_hints_hard). This includes the size of the
  1007. window, especially for full screen windows. To query the actual attributes
  1008. of the created window, framebuffer and context, see ref
  1009. glfwGetWindowAttrib, ref glfwGetWindowSize and ref glfwGetFramebufferSize.
  1010. To create a full screen window, you need to specify the monitor the window
  1011. will cover. If no monitor is specified, the window will be windowed mode.
  1012. Unless you have a way for the user to choose a specific monitor, it is
  1013. recommended that you pick the primary monitor. For more information on how
  1014. to query connected monitors, see ref monitor_monitors.
  1015. For full screen windows, the specified size becomes the resolution of the
  1016. window's _desired video mode_. As long as a full screen window is not
  1017. iconified, the supported video mode most closely matching the desired video
  1018. mode is set for the specified monitor. For more information about full
  1019. screen windows, including the creation of so called _windowed full screen_
  1020. or _borderless full screen_ windows, see ref window_windowed_full_screen.
  1021. Once you have created the window, you can switch it between windowed and
  1022. full screen mode with ref glfwSetWindowMonitor. This will not affect its
  1023. OpenGL or OpenGL ES context.
  1024. By default, newly created windows use the placement recommended by the
  1025. window system. To create the window at a specific position, make it
  1026. initially invisible using the [GLFW_VISIBLE](ref GLFW_VISIBLE_hint) window
  1027. hint, set its [position](ref window_pos) and then [show](ref window_hide)
  1028. it.
  1029. As long as at least one full screen window is not iconified, the screensaver
  1030. is prohibited from starting.
  1031. Window systems put limits on window sizes. Very large or very small window
  1032. dimensions may be overridden by the window system on creation. Check the
  1033. actual [size](ref window_size) after creation.
  1034. The [swap interval](ref buffer_swap) is not set during window creation and
  1035. the initial value may vary depending on driver settings and defaults.
  1036. param[in] width The desired width, in screen coordinates, of the window.
  1037. This must be greater than zero.
  1038. param[in] height The desired height, in screen coordinates, of the window.
  1039. This must be greater than zero.
  1040. param[in] title The initial, UTF-8 encoded window title.
  1041. param[in] monitor The monitor to use for full screen mode, or `NULL` for
  1042. windowed mode.
  1043. param[in] share The window whose context to share resources with, or `NULL`
  1044. to not share resources.
  1045. return The handle of the created window, or `NULL` if an
  1046. [error](ref error_handling) occurred.
  1047. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  1048. GLFW_INVALID_ENUM, ref GLFW_INVALID_VALUE, ref GLFW_API_UNAVAILABLE, ref
  1049. GLFW_VERSION_UNAVAILABLE, ref GLFW_FORMAT_UNAVAILABLE and ref
  1050. GLFW_PLATFORM_ERROR.
  1051. remark win32 Window creation will fail if the Microsoft GDI software
  1052. OpenGL implementation is the only one available.
  1053. remark win32 If the executable has an icon resource named `GLFW_ICON,` it
  1054. will be set as the initial icon for the window. If no such icon is present,
  1055. the `IDI_APPLICATION` icon will be used instead. To set a different icon,
  1056. see ref glfwSetWindowIcon.
  1057. remark win32 The context to share resources with must not be current on
  1058. any other thread.
  1059. remark macos The OS only supports forward-compatible core profile contexts
  1060. for OpenGL versions 3.2 and later. Before creating an OpenGL context of
  1061. version 3.2 or later you must set the
  1062. [GLFW_OPENGL_FORWARD_COMPAT](ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
  1063. [GLFW_OPENGL_PROFILE](ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
  1064. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
  1065. remark macos The GLFW window has no icon, as it is not a document
  1066. window, but the dock icon will be the same as the application bundle's icon.
  1067. For more information on bundles, see the
  1068. [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
  1069. in the Mac Developer Library.
  1070. remark macos The first time a window is created the menu bar is created.
  1071. If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu
  1072. bar. Otherwise a minimal menu bar is created manually with common commands
  1073. like Hide, Quit and About. The About entry opens a minimal about dialog
  1074. with information from the application's bundle. Menu bar creation can be
  1075. disabled entirely with the ref GLFW_COCOA_MENUBAR init hint.
  1076. remark macos On OS X 10.10 and later the window frame will not be rendered
  1077. at full resolution on Retina displays unless the
  1078. [GLFW_COCOA_RETINA_FRAMEBUFFER](ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
  1079. hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
  1080. application bundle's `Info.plist`. For more information, see
  1081. [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
  1082. in the Mac Developer Library. The GLFW test and example programs use
  1083. a custom `Info.plist` template for this, which can be found as
  1084. `CMake/MacOSXBundleInfo.plist.in` in the source tree.
  1085. remark macos When activating frame autosaving with
  1086. [GLFW_COCOA_FRAME_NAME](ref GLFW_COCOA_FRAME_NAME_hint), the specified
  1087. window size and position may be overridden by previously saved values.
  1088. remark x11 Some window managers will not respect the placement of
  1089. initially hidden windows.
  1090. remark x11 Due to the asynchronous nature of X11, it may take a moment for
  1091. a window to reach its requested state. This means you may not be able to
  1092. query the final size, position or other attributes directly after window
  1093. creation.
  1094. remark x11 The class part of the `WM_CLASS` window property will by
  1095. default be set to the window title passed to this function. The instance
  1096. part will use the contents of the `RESOURCE_NAME` environment variable, if
  1097. present and not empty, or fall back to the window title. Set the
  1098. [GLFW_X11_CLASS_NAME](ref GLFW_X11_CLASS_NAME_hint) and
  1099. [GLFW_X11_INSTANCE_NAME](ref GLFW_X11_INSTANCE_NAME_hint) window hints to
  1100. override this.
  1101. remark wayland Compositors should implement the xdg-decoration protocol
  1102. for GLFW to decorate the window properly. If this protocol isn't
  1103. supported, or if the compositor prefers client-side decorations, a very
  1104. simple fallback frame will be drawn using the wp_viewporter protocol. A
  1105. compositor can still emit close, maximize or fullscreen events, using for
  1106. instance a keybind mechanism. If neither of these protocols is supported,
  1107. the window won't be decorated.
  1108. remark wayland A full screen window will not attempt to change the mode,
  1109. no matter what the requested size or refresh rate.
  1110. remark wayland Screensaver inhibition requires the idle-inhibit protocol
  1111. to be implemented in the user's compositor.
  1112. thread_safety This function must only be called from the main thread.
  1113. sa ref window_creation
  1114. sa ref glfwDestroyWindow
  1115. since Added in version 3.0. Replaces `glfwOpenWindow`.
  1116. }
  1117. function glfwCreateWindow(Width, Height: integer; title: PChar;
  1118. monitor: pGLFWmonitor; share: pGLFWwindow): pGLFWwindow; cdecl; external GLFW_DLL;
  1119. {
  1120. Destroys the specified window and its context.
  1121. This function destroys the specified window and its context. On calling
  1122. this function, no further callbacks will be called for that window.
  1123. If the context of the specified window is current on the main thread, it is
  1124. detached before being destroyed.
  1125. param[in] window The window to destroy.
  1126. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1127. GLFW_PLATFORM_ERROR.
  1128. note The context of the specified window must not be current on any other
  1129. thread when this function is called.
  1130. reentrancy This function must not be called from a callback.
  1131. thread_safety This function must only be called from the main thread.
  1132. sa ref window_creation
  1133. sa ref glfwCreateWindow
  1134. since Added in version 3.0. Replaces `glfwCloseWindow`.
  1135. ingroup window
  1136. }
  1137. procedure glfwDestroyWindow(Window: pGLFWwindow); cdecl; external GLFW_DLL;
  1138. {
  1139. Checks the close flag of the specified window.
  1140. This function returns the value of the close flag of the specified window.
  1141. param[in] window The window to query.
  1142. return The value of the close flag.
  1143. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1144. thread_safety This function may be called from any thread. Access is not
  1145. synchronized.
  1146. sa ref window_close
  1147. since Added in version 3.0.
  1148. }
  1149. function glfwWindowShouldClose(Window: pGLFWwindow): integer; cdecl; external GLFW_DLL;
  1150. {
  1151. Sets the close flag of the specified window.
  1152. This function sets the value of the close flag of the specified window.
  1153. This can be used to override the user's attempt to close the window, or
  1154. to signal that it should be closed.
  1155. param[in] window The window whose flag to change.
  1156. param[in] value The new value.
  1157. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1158. thread_safety This function may be called from any thread. Access is not
  1159. synchronized.
  1160. sa ref window_close
  1161. since Added in version 3.0.
  1162. }
  1163. procedure glfwSetWindowShouldClose(window: pGLFWwindow; Action: GLFW_INT);
  1164. cdecl; external GLFW_DLL;
  1165. {
  1166. Sets the title of the specified window.
  1167. This function sets the window title, encoded as UTF-8, of the specified
  1168. window.
  1169. param[in] window The window whose title to change.
  1170. param[in] title The UTF-8 encoded window title.
  1171. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1172. GLFW_PLATFORM_ERROR.
  1173. remark macos The window title will not be updated until the next time you
  1174. process events.
  1175. thread_safety This function must only be called from the main thread.
  1176. sa ref window_title
  1177. since Added in version 1.0.
  1178. glfw3 Added window handle parameter.
  1179. }
  1180. procedure glfwSetWindowTitle(window: pGLFWwindow; title: PChar); cdecl;
  1181. external GLFW_DLL;
  1182. {
  1183. Sets the icon for the specified window.
  1184. This function sets the icon of the specified window. If passed an array of
  1185. candidate images, those of or closest to the sizes desired by the system are
  1186. selected. If no images are specified, the window reverts to its default
  1187. icon.
  1188. The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
  1189. bits per channel with the red channel first. They are arranged canonically
  1190. as packed sequential rows, starting from the top-left corner.
  1191. The desired image sizes varies depending on platform and system settings.
  1192. The selected images will be rescaled as needed. Good sizes include 16x16,
  1193. 32x32 and 48x48.
  1194. param[in] window The window whose icon to set.
  1195. param[in] count The number of images in the specified array, or zero to
  1196. revert to the default window icon.
  1197. param[in] images The images to create the icon from. This is ignored if
  1198. count is zero.
  1199. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  1200. GLFW_INVALID_VALUE and ref GLFW_PLATFORM_ERROR.
  1201. pointer_lifetime The specified image data is copied before this function
  1202. returns.
  1203. remark macos The GLFW window has no icon, as it is not a document
  1204. window, so this function does nothing. The dock icon will be the same as
  1205. the application bundle's icon. For more information on bundles, see the
  1206. [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
  1207. in the Mac Developer Library.
  1208. remark wayland There is no existing protocol to change an icon, the
  1209. window will thus inherit the one defined in the application's desktop file.
  1210. This function always emits ref GLFW_PLATFORM_ERROR.
  1211. thread_safety This function must only be called from the main thread.
  1212. sa ref window_icon
  1213. since Added in version 3.2.
  1214. }
  1215. procedure glfwSetWindowIcon(window: pGLFWWindow; Count: integer; images: pGLFWimage);
  1216. cdecl; external GLFW_DLL;
  1217. {
  1218. Sets the position of the content area of the specified window.
  1219. This function sets the position, in screen coordinates, of the upper-left
  1220. corner of the content area of the specified windowed mode window. If the
  1221. window is a full screen window, this function does nothing.
  1222. __Do not use this function__ to move an already visible window unless you
  1223. have very good reasons for doing so, as it will confuse and annoy the user.
  1224. The window manager may put limits on what positions are allowed. GLFW
  1225. cannot and should not override these limits.
  1226. param[in] window The window to query.
  1227. param[in] xpos The x-coordinate of the upper-left corner of the content area.
  1228. param[in] ypos The y-coordinate of the upper-left corner of the content area.
  1229. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1230. GLFW_PLATFORM_ERROR.
  1231. remark wayland There is no way for an application to set the global
  1232. position of its windows, this function will always emit ref
  1233. GLFW_PLATFORM_ERROR.
  1234. thread_safety This function must only be called from the main thread.
  1235. sa ref window_pos
  1236. sa ref glfwGetWindowPos
  1237. since Added in version 1.0.
  1238. glfw3 Added window handle parameter.
  1239. }
  1240. procedure glfwSetWindowPos(window: pGLFWwindow; xpos, ypos: integer);
  1241. cdecl; external GLFW_DLL;
  1242. {
  1243. Retrieves the size of the content area of the specified window.
  1244. This function retrieves the size, in screen coordinates, of the content area
  1245. of the specified window. If you wish to retrieve the size of the
  1246. framebuffer of the window in pixels, see ref glfwGetFramebufferSize.
  1247. Any or all of the size arguments may be `NULL`. If an error occurs, all
  1248. non-`NULL` size arguments will be set to zero.
  1249. param[in] window The window whose size to retrieve.
  1250. param[out] width Where to store the width, in screen coordinates, of the
  1251. content area, or `NULL`.
  1252. param[out] height Where to store the height, in screen coordinates, of the
  1253. content area, or `NULL`.
  1254. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1255. GLFW_PLATFORM_ERROR.
  1256. thread_safety This function must only be called from the main thread.
  1257. sa ref window_size
  1258. sa ref glfwSetWindowSize
  1259. since Added in version 1.0.
  1260. glfw3 Added window handle parameter.
  1261. }
  1262. procedure glfwGetWindowSize(window: pGLFWwindow; var Width, Height: integer); cdecl;
  1263. external GLFW_DLL;
  1264. {
  1265. Sets the size limits of the specified window.
  1266. This function sets the size limits of the content area of the specified
  1267. window. If the window is full screen, the size limits only take effect
  1268. once it is made windowed. If the window is not resizable, this function
  1269. does nothing.
  1270. The size limits are applied immediately to a windowed mode window and may
  1271. cause it to be resized.
  1272. The maximum dimensions must be greater than or equal to the minimum
  1273. dimensions and all must be greater than or equal to zero.
  1274. param[in] window The window to set limits for.
  1275. param[in] minwidth The minimum width, in screen coordinates, of the content
  1276. area, or `GLFW_DONT_CARE`.
  1277. param[in] minheight The minimum height, in screen coordinates, of the
  1278. content area, or `GLFW_DONT_CARE`.
  1279. param[in] maxwidth The maximum width, in screen coordinates, of the content
  1280. area, or `GLFW_DONT_CARE`.
  1281. param[in] maxheight The maximum height, in screen coordinates, of the
  1282. content area, or `GLFW_DONT_CARE`.
  1283. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  1284. GLFW_INVALID_VALUE and ref GLFW_PLATFORM_ERROR.
  1285. remark If you set size limits and an aspect ratio that conflict, the
  1286. results are undefined.
  1287. remark wayland The size limits will not be applied until the window is
  1288. actually resized, either by the user or by the compositor.
  1289. thread_safety This function must only be called from the main thread.
  1290. sa ref window_sizelimits
  1291. sa ref glfwSetWindowAspectRatio
  1292. since Added in version 3.2.
  1293. }
  1294. procedure glfwSetWindowSizeLimits(window: pGLFWwindow; minwidth: integer;
  1295. minheight: integer; maxwidth: integer; maxheight: integer); cdecl; external GLFW_DLL;
  1296. {
  1297. Sets the aspect ratio of the specified window.
  1298. This function sets the required aspect ratio of the content area of the
  1299. specified window. If the window is full screen, the aspect ratio only takes
  1300. effect once it is made windowed. If the window is not resizable, this
  1301. function does nothing.
  1302. The aspect ratio is specified as a numerator and a denominator and both
  1303. values must be greater than zero. For example, the common 16:9 aspect ratio
  1304. is specified as 16 and 9, respectively.
  1305. If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
  1306. ratio limit is disabled.
  1307. The aspect ratio is applied immediately to a windowed mode window and may
  1308. cause it to be resized.
  1309. param[in] window The window to set limits for.
  1310. param[in] numer The numerator of the desired aspect ratio, or
  1311. `GLFW_DONT_CARE`.
  1312. param[in] denom The denominator of the desired aspect ratio, or
  1313. `GLFW_DONT_CARE`.
  1314. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  1315. GLFW_INVALID_VALUE and ref GLFW_PLATFORM_ERROR.
  1316. remark If you set size limits and an aspect ratio that conflict, the
  1317. results are undefined.
  1318. remark wayland The aspect ratio will not be applied until the window is
  1319. actually resized, either by the user or by the compositor.
  1320. thread_safety This function must only be called from the main thread.
  1321. sa ref window_sizelimits
  1322. sa ref glfwSetWindowSizeLimits
  1323. since Added in version 3.2.
  1324. }
  1325. procedure glfwSetWindowAspectRatio(window: pGLFWwindow; numer: integer; demon: integer);
  1326. cdecl; external GLFW_DLL;
  1327. {
  1328. /*! @ Sets the size of the content area of the specified window.
  1329. *
  1330. * This function sets the size, in screen coordinates, of the content area of
  1331. * the specified window.
  1332. *
  1333. * For full screen windows, this function updates the resolution of its desired
  1334. * video mode and switches to the video mode closest to it, without affecting
  1335. * the window's context. As the context is unaffected, the bit depths of the
  1336. * framebuffer remain unchanged.
  1337. *
  1338. * If you wish to update the refresh rate of the desired video mode in addition
  1339. * to its resolution, see @ref glfwSetWindowMonitor.
  1340. *
  1341. * The window manager may put limits on what sizes are allowed. GLFW cannot
  1342. * and should not override these limits.
  1343. *
  1344. * @param[in] window The window to resize.
  1345. * @param[in] width The desired width, in screen coordinates, of the window
  1346. * content area.
  1347. * @param[in] height The desired height, in screen coordinates, of the window
  1348. * content area.
  1349. *
  1350. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  1351. * GLFW_PLATFORM_ERROR.
  1352. *
  1353. * @remark @wayland A full screen window will not attempt to change the mode,
  1354. * no matter what the requested size.
  1355. *
  1356. * @thread_safety This function must only be called from the main thread.
  1357. *
  1358. * @sa @ref window_size
  1359. * @sa @ref glfwGetWindowSize
  1360. * @sa @ref glfwSetWindowMonitor
  1361. *
  1362. * @since Added in version 1.0.
  1363. * @glfw3 Added window handle parameter.
  1364. *
  1365. }
  1366. procedure glfwSetWindowSize(window: pGLFWwindow; var Width, Height: integer);
  1367. cdecl; external GLFW_DLL;
  1368. {
  1369. Retrieves the size of the framebuffer of the specified window.
  1370. This function retrieves the size, in pixels, of the framebuffer of the
  1371. specified window. If you wish to retrieve the size of the window in screen
  1372. coordinates, see ref glfwGetWindowSize.
  1373. Any or all of the size arguments may be `NULL`. If an error occurs, all
  1374. non-`NULL` size arguments will be set to zero.
  1375. param[in] window The window whose framebuffer to query.
  1376. param[out] width Where to store the width, in pixels, of the framebuffer,
  1377. or `NULL`.
  1378. param[out] height Where to store the height, in pixels, of the framebuffer,
  1379. or `NULL`.
  1380. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1381. GLFW_PLATFORM_ERROR.
  1382. thread_safety This function must only be called from the main thread.
  1383. sa ref window_fbsize
  1384. sa ref glfwSetFramebufferSizeCallback
  1385. since Added in version 3.0.
  1386. }
  1387. procedure glfwGetFramebufferSize(window: pGLFWwindow; var Width, Height: integer);
  1388. cdecl; external GLFW_DLL;
  1389. {
  1390. Retrieves the size of the frame of the window.
  1391. This function retrieves the size, in screen coordinates, of each edge of the
  1392. frame of the specified window. This size includes the title bar, if the
  1393. window has one. The size of the frame may vary depending on the
  1394. [window-related hints](ref window_hints_wnd) used to create it.
  1395. Because this function retrieves the size of each window frame edge and not
  1396. the offset along a particular coordinate axis, the retrieved values will
  1397. always be zero or positive.
  1398. Any or all of the size arguments may be `NULL`. If an error occurs, all
  1399. non-`NULL` size arguments will be set to zero.
  1400. param[in] window The window whose frame size to query.
  1401. param[out] left Where to store the size, in screen coordinates, of the left
  1402. edge of the window frame, or `NULL`.
  1403. param[out] top Where to store the size, in screen coordinates, of the top
  1404. edge of the window frame, or `NULL`.
  1405. param[out] right Where to store the size, in screen coordinates, of the
  1406. right edge of the window frame, or `NULL`.
  1407. param[out] bottom Where to store the size, in screen coordinates, of the
  1408. bottom edge of the window frame, or `NULL`.
  1409. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1410. GLFW_PLATFORM_ERROR.
  1411. thread_safety This function must only be called from the main thread.
  1412. sa ref window_size
  1413. since Added in version 3.1.
  1414. }
  1415. procedure glfwGetWindowFrameSize(window: GLFWwindow; left, top, right, bottom: integer);
  1416. cdecl; external GLFW_DLL;
  1417. {
  1418. Retrieves the content scale for the specified window.
  1419. This function retrieves the content scale for the specified window. The
  1420. content scale is the ratio between the current DPI and the platform's
  1421. default DPI. This is especially important for text and any UI elements. If
  1422. the pixel dimensions of your UI scaled by this look appropriate on your
  1423. machine then it should appear at a reasonable size on other machines
  1424. regardless of their DPI and scaling settings. This relies on the system DPI
  1425. and scaling settings being somewhat correct.
  1426. On systems where each monitors can have its own content scale, the window
  1427. content scale will depend on which monitor the system considers the window
  1428. to be on.
  1429. param[in] window The window to query.
  1430. param[out] xscale Where to store the x-axis content scale, or `NULL`.
  1431. param[out] yscale Where to store the y-axis content scale, or `NULL`.
  1432. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1433. GLFW_PLATFORM_ERROR.
  1434. thread_safety This function must only be called from the main thread.
  1435. sa ref window_scale
  1436. sa ref glfwSetWindowContentScaleCallback
  1437. sa ref glfwGetMonitorContentScale
  1438. since Added in version 3.3.
  1439. }
  1440. procedure glfwGetWindowContentScale(window: pGLFWwindow; var xscale, yscale: single);
  1441. cdecl; external GLFW_DLL;
  1442. { Returns the opacity of the whole window.
  1443. This function returns the opacity of the window, including any decorations.
  1444. The opacity (or alpha) value is a positive finite number between zero and
  1445. one, where zero is fully transparent and one is fully opaque. If the system
  1446. does not support whole window transparency, this function always returns one.
  1447. The initial opacity value for newly created windows is one.
  1448. param[in] window The window to query.
  1449. return The opacity value of the specified window.
  1450. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1451. GLFW_PLATFORM_ERROR.
  1452. thread_safety This function must only be called from the main thread.
  1453. sa ref window_transparency
  1454. sa ref glfwSetWindowOpacity
  1455. since Added in version 3.3.
  1456. }
  1457. function glfwGetWindowOpacity(window: pGLFWwindow): single; cdecl; external GLFW_DLL;
  1458. { Sets the opacity of the whole window.
  1459. This function sets the opacity of the window, including any decorations.
  1460. The opacity (or alpha) value is a positive finite number between zero and
  1461. one, where zero is fully transparent and one is fully opaque.
  1462. The initial opacity value for newly created windows is one.
  1463. A window created with framebuffer transparency may not use whole window
  1464. transparency. The results of doing this are undefined.
  1465. param[in] window The window to set the opacity for.
  1466. param[in] opacity The desired opacity of the specified window.
  1467. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1468. GLFW_PLATFORM_ERROR.
  1469. thread_safety This function must only be called from the main thread.
  1470. sa ref window_transparency
  1471. sa ref glfwGetWindowOpacity
  1472. since Added in version 3.3.
  1473. }
  1474. procedure glfwSetWindowOpacity(monitor: pGLFWwindow; opacity: single);
  1475. cdecl; external GLFW_DLL;
  1476. {
  1477. Iconifies the specified window.
  1478. This function iconifies (minimizes) the specified window if it was
  1479. previously restored. If the window is already iconified, this function does
  1480. nothing.
  1481. If the specified window is a full screen window, GLFW restores the original
  1482. video mode of the monitor. The window's desired video mode is set again
  1483. when the window is restored.
  1484. param[in] window The window to iconify.
  1485. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1486. GLFW_PLATFORM_ERROR.
  1487. thread_safety This function must only be called from the main thread.
  1488. sa ref window_iconify
  1489. sa ref glfwRestoreWindow
  1490. sa ref glfwMaximizeWindow
  1491. since Added in version 2.1.
  1492. glfw3 Added window handle parameter.
  1493. }
  1494. procedure glfwIconifyWindow(window: pGLFWwindow); cdecl; external GLFW_DLL;
  1495. { Restores the specified window.
  1496. This function restores the specified window if it was previously iconified
  1497. (minimized) or maximized. If the window is already restored, this function
  1498. does nothing.
  1499. If the specified window is an iconified full screen window, its desired
  1500. video mode is set again for its monitor when the window is restored.
  1501. param[in] window The window to restore.
  1502. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1503. GLFW_PLATFORM_ERROR.
  1504. thread_safety This function must only be called from the main thread.
  1505. sa ref window_iconify
  1506. sa ref glfwIconifyWindow
  1507. sa ref glfwMaximizeWindow
  1508. since Added in version 2.1.
  1509. glfw3 Added window handle parameter.
  1510. }
  1511. procedure glfwRestoreWindow(window: pGLFWwindow); cdecl; external GLFW_DLL;
  1512. {
  1513. Maximizes the specified window.
  1514. This function maximizes the specified window if it was previously not
  1515. maximized. If the window is already maximized, this function does nothing.
  1516. If the specified window is a full screen window, this function does nothing.
  1517. param[in] window The window to maximize.
  1518. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1519. GLFW_PLATFORM_ERROR.
  1520. par Thread Safety
  1521. This function may only be called from the main thread.
  1522. sa ref window_iconify
  1523. sa ref glfwIconifyWindow
  1524. sa ref glfwRestoreWindow
  1525. since Added in GLFW 3.2.
  1526. }
  1527. procedure glfwMaximizeWindow(window: pGLFWwindow); cdecl; external GLFW_DLL;
  1528. {
  1529. Makes the specified window visible.
  1530. This function makes the specified window visible if it was previously
  1531. hidden. If the window is already visible or is in full screen mode, this
  1532. function does nothing.
  1533. By default, windowed mode windows are focused when shown
  1534. Set the [GLFW_FOCUS_ON_SHOW](ref GLFW_FOCUS_ON_SHOW_hint) window hint
  1535. to change this behavior for all newly created windows, or change the
  1536. behavior for an existing window with ref glfwSetWindowAttrib.
  1537. param[in] window The window to make visible.
  1538. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1539. GLFW_PLATFORM_ERROR.
  1540. remark wayland Because Wayland wants every frame of the desktop to be
  1541. complete, this function does not immediately make the window visible.
  1542. Instead it will become visible the next time the window framebuffer is
  1543. updated after this call.
  1544. thread_safety This function must only be called from the main thread.
  1545. sa ref window_hide
  1546. sa ref glfwHideWindow
  1547. since Added in version 3.0.
  1548. }
  1549. procedure glfwShowWindow(window: pGLFWwindow); cdecl; external GLFW_DLL;
  1550. {
  1551. Hides the specified window.
  1552. This function hides the specified window if it was previously visible. If
  1553. the window is already hidden or is in full screen mode, this function does
  1554. nothing.
  1555. param[in] window The window to hide.
  1556. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1557. GLFW_PLATFORM_ERROR.
  1558. thread_safety This function must only be called from the main thread.
  1559. sa ref window_hide
  1560. sa ref glfwShowWindow
  1561. since Added in version 3.0.
  1562. }
  1563. procedure glfwHideWindow(window: pGLFWwindow); cdecl; external GLFW_DLL;
  1564. {
  1565. Brings the specified window to front and sets input focus.
  1566. This function brings the specified window to front and sets input focus.
  1567. The window should already be visible and not iconified.
  1568. By default, both windowed and full screen mode windows are focused when
  1569. initially created. Set the [GLFW_FOCUSED](ref GLFW_FOCUSED_hint) to
  1570. disable this behavior.
  1571. Also by default, windowed mode windows are focused when shown
  1572. with ref glfwShowWindow. Set the
  1573. [GLFW_FOCUS_ON_SHOW](ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior.
  1574. __Do not use this function__ to steal focus from other applications unless
  1575. you are certain that is what the user wants. Focus stealing can be
  1576. extremely disruptive.
  1577. For a less disruptive way of getting the user's attention, see
  1578. [attention requests](ref window_attention).
  1579. param[in] window The window to give input focus.
  1580. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1581. GLFW_PLATFORM_ERROR.
  1582. remark wayland It is not possible for an application to bring its windows
  1583. to front, this function will always emit ref GLFW_PLATFORM_ERROR.
  1584. thread_safety This function must only be called from the main thread.
  1585. sa ref window_focus
  1586. sa ref window_attention
  1587. since Added in version 3.2.
  1588. }
  1589. procedure glfwFocusWindow(window: pGLFWwindow); cdecl; external GLFW_DLL;
  1590. { Requests user attention to the specified window.
  1591. This function requests user attention to the specified window. On
  1592. platforms where this is not supported, attention is requested to the
  1593. application as a whole.
  1594. Once the user has given attention, usually by focusing the window or
  1595. application, the system will end the request automatically.
  1596. param[in] window The window to request attention to.
  1597. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1598. GLFW_PLATFORM_ERROR.
  1599. remark macos Attention is requested to the application as a whole, not the
  1600. specific window.
  1601. thread_safety This function must only be called from the main thread.
  1602. sa ref window_attention
  1603. since Added in version 3.3.
  1604. }
  1605. procedure glfwRequestWindowAttention(window: pGLFWwindow); cdecl; external GLFW_DLL;
  1606. {
  1607. Returns the monitor that the window uses for full screen mode.
  1608. This function returns the handle of the monitor that the specified window is
  1609. in full screen on.
  1610. param[in] window The window to query.
  1611. return The monitor, or `NULL` if the window is in windowed mode or an
  1612. [error](ref error_handling) occurred.
  1613. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1614. thread_safety This function must only be called from the main thread.
  1615. sa ref window_monitor
  1616. sa ref glfwSetWindowMonitor
  1617. since Added in version 3.0.
  1618. }
  1619. function glfwGetWindowMonitor(window: pGLFWwindow): pGLFWmonitor;
  1620. cdecl; external GLFW_DLL;
  1621. {
  1622. Sets the mode, monitor, video mode and placement of a window.
  1623. This function sets the monitor that the window uses for full screen mode or,
  1624. if the monitor is `NULL`, makes it windowed mode.
  1625. When setting a monitor, this function updates the width, height and refresh
  1626. rate of the desired video mode and switches to the video mode closest to it.
  1627. The window position is ignored when setting a monitor.
  1628. When the monitor is `NULL`, the position, width and height are used to
  1629. place the window content area. The refresh rate is ignored when no monitor
  1630. is specified.
  1631. If you only wish to update the resolution of a full screen window or the
  1632. size of a windowed mode window, see ref glfwSetWindowSize.
  1633. When a window transitions from full screen to windowed mode, this function
  1634. restores any previous window settings such as whether it is decorated,
  1635. floating, resizable, has size or aspect ratio limits, etc.
  1636. param[in] window The window whose monitor, size or video mode to set.
  1637. param[in] monitor The desired monitor, or `NULL` to set windowed mode.
  1638. param[in] xpos The desired x-coordinate of the upper-left corner of the
  1639. content area.
  1640. param[in] ypos The desired y-coordinate of the upper-left corner of the
  1641. content area.
  1642. param[in] width The desired with, in screen coordinates, of the content
  1643. area or video mode.
  1644. param[in] height The desired height, in screen coordinates, of the content
  1645. area or video mode.
  1646. param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
  1647. or `GLFW_DONT_CARE`.
  1648. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1649. GLFW_PLATFORM_ERROR.
  1650. remark The OpenGL or OpenGL ES context will not be destroyed or otherwise
  1651. affected by any resizing or mode switching, although you may need to update
  1652. your viewport if the framebuffer size has changed.
  1653. remark wayland The desired window position is ignored, as there is no way
  1654. for an application to set this property.
  1655. remark wayland Setting the window to full screen will not attempt to
  1656. change the mode, no matter what the requested size or refresh rate.
  1657. thread_safety This function must only be called from the main thread.
  1658. sa ref window_monitor
  1659. sa ref window_full_screen
  1660. sa ref glfwGetWindowMonitor
  1661. sa ref glfwSetWindowSize
  1662. since Added in version 3.2.
  1663. }
  1664. procedure glfwSetWindowMonitor(window: pGLFWwindow; monitor: pGLFWmonitor;
  1665. xpos, ypos, Width, Height, refreshRate: integer); cdecl; external GLFW_DLL;
  1666. {
  1667. Returns an attribute of the specified window.
  1668. This function returns the value of an attribute of the specified window or
  1669. its OpenGL or OpenGL ES context.
  1670. param[in] window The window to query.
  1671. param[in] attrib The [window attribute](ref window_attribs) whose value to
  1672. return.
  1673. return The value of the attribute, or zero if an
  1674. [error](ref error_handling) occurred.
  1675. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  1676. GLFW_INVALID_ENUM and ref GLFW_PLATFORM_ERROR.
  1677. remark Framebuffer related hints are not window attributes. See ref
  1678. window_attribs_fb for more information.
  1679. remark Zero is a valid value for many window and context related
  1680. attributes so you cannot use a return value of zero as an indication of
  1681. errors. However, this function should not fail as long as it is passed
  1682. valid arguments and the library has been [initialized](ref intro_init).
  1683. remark wayland The Wayland protocol provides no way to check whether a
  1684. window is iconfied, so ref GLFW_ICONIFIED always returns `GLFW_FALSE`.
  1685. thread_safety This function must only be called from the main thread.
  1686. sa ref window_attribs
  1687. sa ref glfwSetWindowAttrib
  1688. since Added in version 3.0. Replaces `glfwGetWindowParam` and
  1689. `glfwGetGLVersion`.
  1690. }
  1691. procedure glfwGetWindowAttrib(window: pGLFWwindow; attrib: integer);
  1692. cdecl; external GLFW_DLL;
  1693. {
  1694. Sets an attribute of the specified window.
  1695. This function sets the value of an attribute of the specified window.
  1696. The supported attributes are [GLFW_DECORATED](ref GLFW_DECORATED_attrib),
  1697. [GLFW_RESIZABLE](ref GLFW_RESIZABLE_attrib),
  1698. [GLFW_FLOATING](ref GLFW_FLOATING_attrib),
  1699. [GLFW_AUTO_ICONIFY](ref GLFW_AUTO_ICONIFY_attrib) and
  1700. [GLFW_FOCUS_ON_SHOW](ref GLFW_FOCUS_ON_SHOW_attrib).
  1701. Some of these attributes are ignored for full screen windows. The new
  1702. value will take effect if the window is later made windowed.
  1703. Some of these attributes are ignored for windowed mode windows. The new
  1704. value will take effect if the window is later made full screen.
  1705. param[in] window The window to set the attribute for.
  1706. param[in] attrib A supported window attribute.
  1707. param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
  1708. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  1709. GLFW_INVALID_ENUM, ref GLFW_INVALID_VALUE and ref GLFW_PLATFORM_ERROR.
  1710. remark Calling ref glfwGetWindowAttrib will always return the latest
  1711. value, even if that value is ignored by the current mode of the window.
  1712. thread_safety This function must only be called from the main thread.
  1713. sa ref window_attribs
  1714. sa ref glfwGetWindowAttrib
  1715. since Added in version 3.3.
  1716. ingroup window
  1717. }
  1718. procedure glfwSetWindowAttrib(window: pGLFWwindow; att: integer; Value: integer);
  1719. cdecl; external GLFW_DLL;
  1720. procedure glfwGetWindowPos(window: pGLFWWindow; var xpos, ypos: integer);
  1721. cdecl; external GLFW_DLL;
  1722. {
  1723. Sets the user pointer of the specified window.
  1724. This function sets the user-defined pointer of the specified window. The
  1725. current value is retained until the window is destroyed. The initial value
  1726. is `NULL`.
  1727. param[in] window The window whose pointer to set.
  1728. param[in] pointer The new value.
  1729. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1730. thread_safety This function may be called from any thread. Access is not
  1731. synchronized.
  1732. sa ref window_userptr
  1733. sa ref glfwGetWindowUserPointer
  1734. since Added in version 3.0.
  1735. }
  1736. procedure glfwSetWindowUserPointer(window: pGLFWwindow; p: pointer);
  1737. cdecl; external GLFW_DLL;
  1738. {
  1739. /! Returns the user pointer of the specified window.
  1740. This function returns the current value of the user-defined pointer of the
  1741. specified window. The initial value is `NULL`.
  1742. param[in] window The window whose pointer to return.
  1743. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1744. thread_safety This function may be called from any thread. Access is not
  1745. synchronized.
  1746. sa ref window_userptr
  1747. sa ref glfwSetWindowUserPointer
  1748. since Added in version 3.0.
  1749. }
  1750. function glfwGetWindowUserPointer(window: GLFWwindow): Pointer; cdecl; external GLFW_DLL;
  1751. {
  1752. /! Sets the position callback for the specified window.
  1753. This function sets the position callback of the specified window, which is
  1754. called when the window is moved. The callback is provided with the
  1755. position, in screen coordinates, of the upper-left corner of the content
  1756. area of the window.
  1757. param[in] window The window whose callback to set.
  1758. param[in] callback The new callback, or `NULL` to remove the currently set
  1759. callback.
  1760. return The previously set callback, or `NULL` if no callback was set or the
  1761. library had not been [initialized](ref intro_init).
  1762. callback_signature
  1763. code
  1764. void function_name(GLFWwindow window, int xpos, int ypos)
  1765. endcode
  1766. For more information about the callback parameters, see the
  1767. [function pointer type](ref GLFWwindowposfun).
  1768. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1769. remark wayland This callback will never be called, as there is no way for
  1770. an application to know its global position.
  1771. thread_safety This function must only be called from the main thread.
  1772. sa ref window_pos
  1773. }
  1774. function glfwSetWindowPosCallback(window: pGLFWwindow;
  1775. cbfun: GLFWwindowposfun): pGLFWwindowposfun; cdecl; external GLFW_DLL;
  1776. {
  1777. /! Sets the size callback for the specified window.
  1778. This function sets the size callback of the specified window, which is
  1779. called when the window is resized. The callback is provided with the size,
  1780. in screen coordinates, of the content area of the window.
  1781. param[in] window The window whose callback to set.
  1782. param[in] callback The new callback, or `NULL` to remove the currently set
  1783. callback.
  1784. return The previously set callback, or `NULL` if no callback was set or the
  1785. library had not been [initialized](ref intro_init).
  1786. callback_signature
  1787. code
  1788. void function_name(GLFWwindow window, int width, int height)
  1789. endcode
  1790. For more information about the callback parameters, see the
  1791. [function pointer type](ref GLFWwindowsizefun).
  1792. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1793. thread_safety This function must only be called from the main thread.
  1794. sa ref window_size
  1795. since Added in version 1.0.
  1796. glfw3 Added window handle parameter and return value.
  1797. }
  1798. function glfwSetWindowSizeCallback(window: pGLFWwindow;
  1799. cbfun: GLFWwindowsizefun): pGLFWwindowsizefun; cdecl; external GLFW_DLL;
  1800. {
  1801. /! Sets the close callback for the specified window.
  1802. This function sets the close callback of the specified window, which is
  1803. called when the user attempts to close the window, for example by clicking
  1804. the close widget in the title bar.
  1805. The close flag is set before this callback is called, but you can modify it
  1806. at any time with ref glfwSetWindowShouldClose.
  1807. The close callback is not triggered by ref glfwDestroyWindow.
  1808. param[in] window The window whose callback to set.
  1809. param[in] callback The new callback, or `NULL` to remove the currently set
  1810. callback.
  1811. return The previously set callback, or `NULL` if no callback was set or the
  1812. library had not been [initialized](ref intro_init).
  1813. callback_signature
  1814. code
  1815. void function_name(GLFWwindow window)
  1816. endcode
  1817. For more information about the callback parameters, see the
  1818. [function pointer type](ref GLFWwindowclosefun).
  1819. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1820. remark macos Selecting Quit from the application menu will trigger the
  1821. close callback for all windows.
  1822. thread_safety This function must only be called from the main thread.
  1823. sa ref window_close
  1824. since Added in version 2.5.
  1825. glfw3 Added window handle parameter and return value.
  1826. }
  1827. function glfwSetWindowCloseCallback(window: pGLFWwindow;
  1828. ccbfun: GLFWwindowclosefun): pGLFWwindowclosefun; cdecl; external GLFW_DLL;
  1829. {
  1830. /! Sets the refresh callback for the specified window.
  1831. This function sets the refresh callback of the specified window, which is
  1832. called when the content area of the window needs to be redrawn, for example
  1833. if the window has been exposed after having been covered by another window.
  1834. On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
  1835. the window contents are saved off-screen, this callback may be called only
  1836. very infrequently or never at all.
  1837. param[in] window The window whose callback to set.
  1838. param[in] callback The new callback, or `NULL` to remove the currently set
  1839. callback.
  1840. return The previously set callback, or `NULL` if no callback was set or the
  1841. library had not been [initialized](ref intro_init).
  1842. callback_signature
  1843. code
  1844. void function_name(GLFWwindow window);
  1845. endcode
  1846. For more information about the callback parameters, see the
  1847. [function pointer type](ref GLFWwindowrefreshfun).
  1848. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1849. thread_safety This function must only be called from the main thread.
  1850. sa ref window_refresh
  1851. since Added in version 2.5.
  1852. glfw3 Added window handle parameter and return value.
  1853. }
  1854. function glfwSetWindowRefreshCallback(window: pGLFWwindow;
  1855. cbfun: GLFWwindowrefreshfun): pGLFWwindowrefreshfun; cdecl; external GLFW_DLL;
  1856. {
  1857. /! Sets the focus callback for the specified window.
  1858. This function sets the focus callback of the specified window, which is
  1859. called when the window gains or loses input focus.
  1860. After the focus callback is called for a window that lost input focus,
  1861. synthetic key and mouse button release events will be generated for all such
  1862. that had been pressed. For more information, see ref glfwSetKeyCallback
  1863. and ref glfwSetMouseButtonCallback.
  1864. param[in] window The window whose callback to set.
  1865. param[in] callback The new callback, or `NULL` to remove the currently set
  1866. callback.
  1867. return The previously set callback, or `NULL` if no callback was set or the
  1868. library had not been [initialized](ref intro_init).
  1869. callback_signature
  1870. code
  1871. void function_name(GLFWwindow window, int focused)
  1872. endcode
  1873. For more information about the callback parameters, see the
  1874. [function pointer type](ref GLFWwindowfocusfun).
  1875. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1876. thread_safety This function must only be called from the main thread.
  1877. sa ref window_focus
  1878. since Added in version 3.0.
  1879. }
  1880. function glfwSetWindowFocusCallback(window: pGLFWwindow;
  1881. cbfun: GLFWwindowfocusfun): pGLFWwindowfocusfun; cdecl; external GLFW_DLL;
  1882. {
  1883. /! Sets the iconify callback for the specified window.
  1884. This function sets the iconification callback of the specified window, which
  1885. is called when the window is iconified or restored.
  1886. param[in] window The window whose callback to set.
  1887. param[in] callback The new callback, or `NULL` to remove the currently set
  1888. callback.
  1889. return The previously set callback, or `NULL` if no callback was set or the
  1890. library had not been [initialized](ref intro_init).
  1891. callback_signature
  1892. code
  1893. void function_name(GLFWwindow window, int iconified)
  1894. endcode
  1895. For more information about the callback parameters, see the
  1896. [function pointer type](ref GLFWwindowiconifyfun).
  1897. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1898. remark wayland The XDG-shell protocol has no event for iconification, so
  1899. this callback will never be called.
  1900. thread_safety This function must only be called from the main thread.
  1901. sa ref window_iconify
  1902. }
  1903. function glfwSetWindowIconifyCallback(window: pGLFWwindow;
  1904. cbfun: GLFWwindowiconifyfun): pGLFWwindowiconifyfun; cdecl; external GLFW_DLL;
  1905. { Sets the maximize callback for the specified window.
  1906. This function sets the maximization callback of the specified window, which
  1907. is called when the window is maximized or restored.
  1908. param[in] window The window whose callback to set.
  1909. param[in] callback The new callback, or `NULL` to remove the currently set
  1910. callback.
  1911. return The previously set callback, or `NULL` if no callback was set or the
  1912. library had not been [initialized](ref intro_init).
  1913. callback_signature
  1914. void function_name(GLFWwindow window, int maximized)
  1915. endcode
  1916. For more information about the callback parameters, see the
  1917. [function pointer type](ref GLFWwindowmaximizefun).
  1918. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1919. thread_safety This function must only be called from the main thread.
  1920. sa ref window_maximize
  1921. since Added in version 3.3.
  1922. // }
  1923. function glfwSetWindowMaximizeCallback(Windows: pGLFWwindow;
  1924. cbfun: GLFWwindowmaximizefun): pGLFWwindowmaximizefun; cdecl; external GLFW_DLL;
  1925. {
  1926. /! Sets the framebuffer resize callback for the specified window.
  1927. This function sets the framebuffer resize callback of the specified window,
  1928. which is called when the framebuffer of the specified window is resized.
  1929. param[in] window The window whose callback to set.
  1930. param[in] callback The new callback, or `NULL` to remove the currently set
  1931. callback.
  1932. return The previously set callback, or `NULL` if no callback was set or the
  1933. library had not been [initialized](ref intro_init).
  1934. callback_signature
  1935. code
  1936. void function_name(GLFWwindow window, int width, int height)
  1937. endcode
  1938. For more information about the callback parameters, see the
  1939. [function pointer type](ref GLFWframebuffersizefun).
  1940. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1941. thread_safety This function must only be called from the main thread.
  1942. sa ref window_fbsize
  1943. since Added in version 3.0.
  1944. /
  1945. }
  1946. function glfwSetFramebufferSizeCallback(window: pGLFWwindow;
  1947. cbfun: GLFWframebuffersizefun): pGLFWframebuffersizefun; cdecl; external GLFW_DLL;
  1948. {
  1949. Sets the window content scale callback for the specified window.
  1950. This function sets the window content scale callback of the specified window,
  1951. which is called when the content scale of the specified window changes.
  1952. param[in] window The window whose callback to set.
  1953. param[in] callback The new callback, or `NULL` to remove the currently set
  1954. callback.
  1955. return The previously set callback, or `NULL` if no callback was set or the
  1956. library had not been [initialized](ref intro_init).
  1957. callback_signature
  1958. void function_name(GLFWwindow window, float xscale, float yscale)
  1959. endcode
  1960. For more information about the callback parameters, see the
  1961. [function pointer type](ref GLFWwindowcontentscalefun).
  1962. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  1963. thread_safety This function must only be called from the main thread.
  1964. sa ref window_scale
  1965. sa ref glfwGetWindowContentScale
  1966. since Added in version 3.3.
  1967. ingroup window
  1968. }
  1969. function glfwSetWindowContentScaleCallback(window: pGLFWwindow;
  1970. cbfun: GLFWwindowcontentscalefun): pGLFWwindowcontentscalefun;
  1971. cdecl; external GLFW_DLL;
  1972. {
  1973. /! Processes all pending events.
  1974. This function processes only those events that are already in the event
  1975. queue and then returns immediately. Processing events will cause the window
  1976. and input callbacks associated with those events to be called.
  1977. On some platforms, a window move, resize or menu operation will cause event
  1978. processing to block. This is due to how event processing is designed on
  1979. those platforms. You can use the
  1980. [window refresh callback](ref window_refresh) to redraw the contents of
  1981. your window when necessary during such operations.
  1982. Do not assume that callbacks you set will _only_ be called in response to
  1983. event processing functions like this one. While it is necessary to poll for
  1984. events, window systems that require GLFW to register callbacks of its own
  1985. can pass events to GLFW in response to many window system function calls.
  1986. GLFW will pass those events on to the application callbacks before
  1987. returning.
  1988. Event processing is not required for joystick input to work.
  1989. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  1990. GLFW_PLATFORM_ERROR.
  1991. reentrancy This function must not be called from a callback.
  1992. thread_safety This function must only be called from the main thread.
  1993. sa ref events
  1994. sa ref glfwWaitEvents
  1995. sa ref glfwWaitEventsTimeout
  1996. since Added in version 1.0.
  1997. }
  1998. procedure glfwPollEvents; cdecl; external GLFW_DLL;
  1999. {
  2000. /! Waits until events are queued and processes them.
  2001. This function puts the calling thread to sleep until at least one event is
  2002. available in the event queue. Once one or more events are available,
  2003. it behaves exactly like ref glfwPollEvents, i.e. the events in the queue
  2004. are processed and the function then returns immediately. Processing events
  2005. will cause the window and input callbacks associated with those events to be
  2006. called.
  2007. Since not all events are associated with callbacks, this function may return
  2008. without a callback having been called even if you are monitoring all
  2009. callbacks.
  2010. On some platforms, a window move, resize or menu operation will cause event
  2011. processing to block. This is due to how event processing is designed on
  2012. those platforms. You can use the
  2013. [window refresh callback](ref window_refresh) to redraw the contents of
  2014. your window when necessary during such operations.
  2015. Do not assume that callbacks you set will _only_ be called in response to
  2016. event processing functions like this one. While it is necessary to poll for
  2017. events, window systems that require GLFW to register callbacks of its own
  2018. can pass events to GLFW in response to many window system function calls.
  2019. GLFW will pass those events on to the application callbacks before
  2020. returning.
  2021. Event processing is not required for joystick input to work.
  2022. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2023. GLFW_PLATFORM_ERROR.
  2024. reentrancy This function must not be called from a callback.
  2025. thread_safety This function must only be called from the main thread.
  2026. sa ref events
  2027. sa ref glfwPollEvents
  2028. sa ref glfwWaitEventsTimeout
  2029. since Added in version 2.5.
  2030. }
  2031. procedure glfwWaitEvents; cdecl; external GLFW_DLL;
  2032. { Waits with timeout until events are queued and processes them.
  2033. This function puts the calling thread to sleep until at least one event is
  2034. available in the event queue, or until the specified timeout is reached. If
  2035. one or more events are available, it behaves exactly like ref
  2036. glfwPollEvents, i.e. the events in the queue are processed and the function
  2037. then returns immediately. Processing events will cause the window and input
  2038. callbacks associated with those events to be called.
  2039. The timeout value must be a positive finite number.
  2040. Since not all events are associated with callbacks, this function may return
  2041. without a callback having been called even if you are monitoring all
  2042. callbacks.
  2043. On some platforms, a window move, resize or menu operation will cause event
  2044. processing to block. This is due to how event processing is designed on
  2045. those platforms. You can use the
  2046. [window refresh callback](ref window_refresh) to redraw the contents of
  2047. your window when necessary during such operations.
  2048. Do not assume that callbacks you set will _only_ be called in response to
  2049. event processing functions like this one. While it is necessary to poll for
  2050. events, window systems that require GLFW to register callbacks of its own
  2051. can pass events to GLFW in response to many window system function calls.
  2052. GLFW will pass those events on to the application callbacks before
  2053. returning.
  2054. Event processing is not required for joystick input to work.
  2055. param[in] timeout The maximum amount of time, in seconds, to wait.
  2056. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  2057. GLFW_INVALID_VALUE and ref GLFW_PLATFORM_ERROR.
  2058. reentrancy This function must not be called from a callback.
  2059. thread_safety This function must only be called from the main thread.
  2060. sa ref events
  2061. sa ref glfwPollEvents
  2062. sa ref glfwWaitEvents
  2063. since Added in version 3.2.
  2064. }
  2065. procedure glfwWaitEventsTimeout(timeout: double); cdecl; external GLFW_DLL;
  2066. { Posts an empty event to the event queue.
  2067. This function posts an empty event from the current thread to the event
  2068. queue, causing ref glfwWaitEvents or ref glfwWaitEventsTimeout to return.
  2069. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2070. GLFW_PLATFORM_ERROR.
  2071. thread_safety This function may be called from any thread.
  2072. sa ref events
  2073. sa ref glfwWaitEvents
  2074. sa ref glfwWaitEventsTimeout
  2075. since Added in version 3.1.}
  2076. procedure glfwPostEmptyEvent; cdecl; external GLFW_DLL; //Version 3.1
  2077. //========================================================================
  2078. //Input
  2079. //========================================================================
  2080. {
  2081. /! Returns the value of an input option for the specified window.
  2082. This function returns the value of an input option for the specified window.
  2083. The mode must be one of ref GLFW_CURSOR, ref GLFW_STICKY_KEYS,
  2084. ref GLFW_STICKY_MOUSE_BUTTONS, ref GLFW_LOCK_KEY_MODS or
  2085. ref GLFW_RAW_MOUSE_MOTION.
  2086. param[in] window The window to query.
  2087. param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
  2088. `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
  2089. `GLFW_RAW_MOUSE_MOTION`.
  2090. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2091. GLFW_INVALID_ENUM.
  2092. thread_safety This function must only be called from the main thread.
  2093. sa ref glfwSetInputMode
  2094. since Added in version 3.0.
  2095. }
  2096. function glfwGetInputMode(window: pGLFWwindow; mode: integer): integer;
  2097. cdecl; external GLFW_DLL;
  2098. {
  2099. /! Sets an input option for the specified window.
  2100. This function sets an input mode option for the specified window. The mode
  2101. must be one of ref GLFW_CURSOR, ref GLFW_STICKY_KEYS,
  2102. ref GLFW_STICKY_MOUSE_BUTTONS, ref GLFW_LOCK_KEY_MODS or
  2103. ref GLFW_RAW_MOUSE_MOTION.
  2104. If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
  2105. modes:
  2106. - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
  2107. - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the
  2108. content area of the window but does not restrict the cursor from leaving.
  2109. - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
  2110. and unlimited cursor movement. This is useful for implementing for
  2111. example 3D camera controls.
  2112. If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
  2113. enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
  2114. enabled, a key press will ensure that ref glfwGetKey returns `GLFW_PRESS`
  2115. the next time it is called even if the key had been released before the
  2116. call. This is useful when you are only interested in whether keys have been
  2117. pressed but not when or in which order.
  2118. If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
  2119. `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
  2120. If sticky mouse buttons are enabled, a mouse button press will ensure that
  2121. ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
  2122. if the mouse button had been released before the call. This is useful when
  2123. you are only interested in whether mouse buttons have been pressed but not
  2124. when or in which order.
  2125. If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to
  2126. enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled,
  2127. callbacks that receive modifier bits will also have the ref
  2128. GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on,
  2129. and the ref GLFW_MOD_NUM_LOCK bit when Num Lock was on.
  2130. If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE`
  2131. to enable raw (unscaled and unaccelerated) mouse motion when the cursor is
  2132. disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported,
  2133. attempting to set this will emit ref GLFW_PLATFORM_ERROR. Call ref
  2134. glfwRawMouseMotionSupported to check for support.
  2135. param[in] window The window whose input mode to set.
  2136. param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
  2137. `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
  2138. `GLFW_RAW_MOUSE_MOTION`.
  2139. param[in] value The new value of the specified input mode.
  2140. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  2141. GLFW_INVALID_ENUM and ref GLFW_PLATFORM_ERROR.
  2142. thread_safety This function must only be called from the main thread.
  2143. sa ref glfwGetInputMode
  2144. since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
  2145. }
  2146. procedure glfwSetInputMode(window: pGLFWwindow; mode, Value: integer); cdecl;
  2147. external GLFW_DLL;
  2148. { Returns whether raw mouse motion is supported.
  2149. This function returns whether raw mouse motion is supported on the current
  2150. system. This status does not change after GLFW has been initialized so you
  2151. only need to check this once. If you attempt to enable raw motion on
  2152. a system that does not support it, ref GLFW_PLATFORM_ERROR will be emitted.
  2153. Raw mouse motion is closer to the actual motion of the mouse across
  2154. a surface. It is not affected by the scaling and acceleration applied to
  2155. the motion of the desktop cursor. That processing is suitable for a cursor
  2156. while raw motion is better for controlling for example a 3D camera. Because
  2157. of this, raw mouse motion is only provided when the cursor is disabled.
  2158. return `GLFW_TRUE` if raw mouse motion is supported on the current machine,
  2159. or `GLFW_FALSE` otherwise.
  2160. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2161. thread_safety This function must only be called from the main thread.
  2162. sa ref raw_mouse_motion
  2163. sa ref glfwSetInputMode
  2164. since Added in version 3.3.
  2165. }
  2166. function glfwRawMouseMotionSupported(): integer; cdecl; external GLFW_DLL;
  2167. {
  2168. Returns the layout-specific name of the specified printable key.
  2169. This function returns the name of the specified printable key, encoded as
  2170. UTF-8. This is typically the character that key would produce without any
  2171. modifier keys, intended for displaying key bindings to the user. For dead
  2172. keys, it is typically the diacritic it would add to a character.
  2173. __Do not use this function__ for [text input](ref input_char). You will
  2174. break text input for many languages even if it happens to work for yours.
  2175. If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key,
  2176. otherwise the scancode is ignored. If you specify a non-printable key, or
  2177. `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this
  2178. function returns `NULL` but does not emit an error.
  2179. This behavior allows you to always pass in the arguments in the
  2180. [key callback](ref input_key) without modification.
  2181. The printable keys are:
  2182. - `GLFW_KEY_APOSTROPHE`
  2183. - `GLFW_KEY_COMMA`
  2184. - `GLFW_KEY_MINUS`
  2185. - `GLFW_KEY_PERIOD`
  2186. - `GLFW_KEY_SLASH`
  2187. - `GLFW_KEY_SEMICOLON`
  2188. - `GLFW_KEY_EQUAL`
  2189. - `GLFW_KEY_LEFT_BRACKET`
  2190. - `GLFW_KEY_RIGHT_BRACKET`
  2191. - `GLFW_KEY_BACKSLASH`
  2192. - `GLFW_KEY_WORLD_1`
  2193. - `GLFW_KEY_WORLD_2`
  2194. - `GLFW_KEY_0` to `GLFW_KEY_9`
  2195. - `GLFW_KEY_A` to `GLFW_KEY_Z`
  2196. - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
  2197. - `GLFW_KEY_KP_DECIMAL`
  2198. - `GLFW_KEY_KP_DIVIDE`
  2199. - `GLFW_KEY_KP_MULTIPLY`
  2200. - `GLFW_KEY_KP_SUBTRACT`
  2201. - `GLFW_KEY_KP_ADD`
  2202. - `GLFW_KEY_KP_EQUAL`
  2203. Names for printable keys depend on keyboard layout, while names for
  2204. non-printable keys are the same across layouts but depend on the application
  2205. language and should be localized along with other user interface text.
  2206. param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
  2207. param[in] scancode The scancode of the key to query.
  2208. return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
  2209. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2210. GLFW_PLATFORM_ERROR.
  2211. remark The contents of the returned string may change when a keyboard
  2212. layout change event is received.
  2213. pointer_lifetime The returned string is allocated and freed by GLFW. You
  2214. should not free it yourself. It is valid until the library is terminated.
  2215. thread_safety This function must only be called from the main thread.
  2216. sa ref input_key_name
  2217. since Added in version 3.2.
  2218. }
  2219. function glfwGetKeyName(key, scancode: integer): PChar; cdecl; external GLFW_DLL;
  2220. { Returns the platform-specific scancode of the specified key.
  2221. This function returns the platform-specific scancode of the specified key.
  2222. If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
  2223. method will return `-1`.
  2224. param[in] key Any [named key](ref keys).
  2225. return The platform-specific scancode for the key, or `-1` if an
  2226. [error](ref error_handling) occurred.
  2227. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  2228. GLFW_INVALID_ENUM and ref GLFW_PLATFORM_ERROR.
  2229. thread_safety This function may be called from any thread.
  2230. sa ref input_key
  2231. since Added in version 3.3.
  2232. ingroup input
  2233. }
  2234. function glfwGetKeyScancode(key: integer): integer; cdecl; external GLFW_DLL;
  2235. {
  2236. /! Returns the last reported state of a keyboard key for the specified
  2237. window.
  2238. This function returns the last state reported for the specified key to the
  2239. specified window. The returned state is one of `GLFW_PRESS` or
  2240. `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback.
  2241. If the ref GLFW_STICKY_KEYS input mode is enabled, this function returns
  2242. `GLFW_PRESS` the first time you call it for a key that was pressed, even if
  2243. that key has already been released.
  2244. The key functions deal with physical keys, with [key tokens](ref keys)
  2245. named after their use on the standard US keyboard layout. If you want to
  2246. input text, use the Unicode character callback instead.
  2247. The [modifier key bit masks](ref mods) are not key tokens and cannot be
  2248. used with this function.
  2249. __Do not use this function__ to implement [text input](ref input_char).
  2250. param[in] window The desired window.
  2251. param[in] key The desired [keyboard key](ref keys). `GLFW_KEY_UNKNOWN` is
  2252. not a valid key for this function.
  2253. return One of `GLFW_PRESS` or `GLFW_RELEASE`.
  2254. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2255. GLFW_INVALID_ENUM.
  2256. thread_safety This function must only be called from the main thread.
  2257. sa ref input_key
  2258. since Added in version 1.0.
  2259. glfw3 Added window handle parameter.
  2260. }
  2261. function glfwGetKey(window: pGLFWwindow; key: integer): integer;
  2262. cdecl; external GLFW_DLL;
  2263. {
  2264. /! Returns the last reported state of a mouse button for the specified
  2265. window.
  2266. This function returns the last state reported for the specified mouse button
  2267. to the specified window. The returned state is one of `GLFW_PRESS` or
  2268. `GLFW_RELEASE`.
  2269. If the ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function
  2270. returns `GLFW_PRESS` the first time you call it for a mouse button that was
  2271. pressed, even if that mouse button has already been released.
  2272. param[in] window The desired window.
  2273. param[in] button The desired [mouse button](ref buttons).
  2274. return One of `GLFW_PRESS` or `GLFW_RELEASE`.
  2275. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2276. GLFW_INVALID_ENUM.
  2277. thread_safety This function must only be called from the main thread.
  2278. sa ref input_mouse_button
  2279. since Added in version 1.0.
  2280. glfw3 Added window handle parameter.
  2281. }
  2282. function glfwGetMouseButton(window: pGLFWwindow; button: integer): integer;
  2283. cdecl; external GLFW_DLL;
  2284. {
  2285. /! Retrieves the position of the cursor relative to the content area of
  2286. the window.
  2287. This function returns the position of the cursor, in screen coordinates,
  2288. relative to the upper-left corner of the content area of the specified
  2289. window.
  2290. If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
  2291. position is unbounded and limited only by the minimum and maximum values of
  2292. a `double`.
  2293. The coordinate can be converted to their integer equivalents with the
  2294. `floor` function. Casting directly to an integer type works for positive
  2295. coordinates, but fails for negative ones.
  2296. Any or all of the position arguments may be `NULL`. If an error occurs, all
  2297. non-`NULL` position arguments will be set to zero.
  2298. param[in] window The desired window.
  2299. param[out] xpos Where to store the cursor x-coordinate, relative to the
  2300. left edge of the content area, or `NULL`.
  2301. param[out] ypos Where to store the cursor y-coordinate, relative to the to
  2302. top edge of the content area, or `NULL`.
  2303. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2304. GLFW_PLATFORM_ERROR.
  2305. thread_safety This function must only be called from the main thread.
  2306. sa ref cursor_pos
  2307. sa ref glfwSetCursorPos
  2308. since Added in version 3.0. Replaces `glfwGetMousePos`.
  2309. }
  2310. function glfwGetCursorPos(window: pGLFWwindow; var xpos, ypos: double): integer;
  2311. cdecl; external GLFW_DLL;
  2312. {
  2313. /! Sets the position of the cursor, relative to the content area of the
  2314. window.
  2315. This function sets the position, in screen coordinates, of the cursor
  2316. relative to the upper-left corner of the content area of the specified
  2317. window. The window must have input focus. If the window does not have
  2318. input focus when this function is called, it fails silently.
  2319. __Do not use this function__ to implement things like camera controls. GLFW
  2320. already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
  2321. cursor, transparently re-centers it and provides unconstrained cursor
  2322. motion. See ref glfwSetInputMode for more information.
  2323. If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
  2324. unconstrained and limited only by the minimum and maximum values of
  2325. a `double`.
  2326. param[in] window The desired window.
  2327. param[in] xpos The desired x-coordinate, relative to the left edge of the
  2328. content area.
  2329. param[in] ypos The desired y-coordinate, relative to the top edge of the
  2330. content area.
  2331. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2332. GLFW_PLATFORM_ERROR.
  2333. remark wayland This function will only work when the cursor mode is
  2334. `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
  2335. thread_safety This function must only be called from the main thread.
  2336. sa ref cursor_pos
  2337. sa ref glfwGetCursorPos
  2338. since Added in version 3.0. Replaces `glfwSetMousePos`.
  2339. ingroup input
  2340. /
  2341. }
  2342. procedure glfwSetCursorPos(window: pGLFWwindow; xpos, ypos: double);
  2343. cdecl; external GLFW_DLL;
  2344. {
  2345. /! Creates a custom cursor.
  2346. Creates a new custom cursor image that can be set for a window with ref
  2347. glfwSetCursor. The cursor can be destroyed with ref glfwDestroyCursor.
  2348. Any remaining cursors are destroyed by ref glfwTerminate.
  2349. The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
  2350. bits per channel with the red channel first. They are arranged canonically
  2351. as packed sequential rows, starting from the top-left corner.
  2352. The cursor hotspot is specified in pixels, relative to the upper-left corner
  2353. of the cursor image. Like all other coordinate systems in GLFW, the X-axis
  2354. points to the right and the Y-axis points down.
  2355. param[in] image The desired cursor image.
  2356. param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
  2357. param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
  2358. return The handle of the created cursor, or `NULL` if an
  2359. [error](ref error_handling) occurred.
  2360. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  2361. GLFW_INVALID_VALUE and ref GLFW_PLATFORM_ERROR.
  2362. pointer_lifetime The specified image data is copied before this function
  2363. returns.
  2364. thread_safety This function must only be called from the main thread.
  2365. sa ref cursor_object
  2366. sa ref glfwDestroyCursor
  2367. sa ref glfwCreateStandardCursor
  2368. since Added in version 3.1.
  2369. }
  2370. function glfwCreateCursor(const image: pGLFWimage; var xhot, yhot: integer): pGLFWcursor;
  2371. cdecl; external GLFW_DLL;
  2372. {
  2373. /! Creates a cursor with a standard shape.
  2374. Returns a cursor with a [standard shape](ref shapes), that can be set for
  2375. a window with ref glfwSetCursor.
  2376. param[in] shape One of the [standard shapes](ref shapes).
  2377. return A new cursor ready to use or `NULL` if an
  2378. [error](ref error_handling) occurred.
  2379. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  2380. GLFW_INVALID_ENUM and ref GLFW_PLATFORM_ERROR.
  2381. thread_safety This function must only be called from the main thread.
  2382. sa ref cursor_object
  2383. sa ref glfwCreateCursor
  2384. }
  2385. function glfwCreateStandardCursor(shape: integer): pGLFWcursor;
  2386. cdecl; external GLFW_DLL;
  2387. {
  2388. /! Destroys a cursor.
  2389. This function destroys a cursor previously created with ref
  2390. glfwCreateCursor. Any remaining cursors will be destroyed by ref
  2391. glfwTerminate.
  2392. If the specified cursor is current for any window, that window will be
  2393. reverted to the default cursor. This does not affect the cursor mode.
  2394. param[in] cursor The cursor object to destroy.
  2395. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2396. GLFW_PLATFORM_ERROR.
  2397. reentrancy This function must not be called from a callback.
  2398. thread_safety This function must only be called from the main thread.
  2399. sa ref cursor_object
  2400. sa ref glfwCreateCursor
  2401. since Added in version 3.1.
  2402. }
  2403. procedure glfwDestroyCursor(cursor: pGLFWcursor);
  2404. cdecl; external GLFW_DLL;
  2405. {
  2406. /! Sets the cursor for the window.
  2407. This function sets the cursor image to be used when the cursor is over the
  2408. content area of the specified window. The set cursor will only be visible
  2409. when the [cursor mode](ref cursor_mode) of the window is
  2410. `GLFW_CURSOR_NORMAL`.
  2411. On some platforms, the set cursor may not be visible unless the window also
  2412. has input focus.
  2413. param[in] window The window to set the cursor for.
  2414. param[in] cursor The cursor to set, or `NULL` to switch back to the default
  2415. arrow cursor.
  2416. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2417. GLFW_PLATFORM_ERROR.
  2418. thread_safety This function must only be called from the main thread.
  2419. sa ref cursor_object
  2420. since Added in version 3.1.
  2421. }
  2422. procedure glfwSetCursor(window: pGLFWwindow; cursor: pGLFWcursor);
  2423. cdecl; external GLFW_DLL;
  2424. {
  2425. /! Sets the key callback.
  2426. This function sets the key callback of the specified window, which is called
  2427. when a key is pressed, repeated or released.
  2428. The key functions deal with physical keys, with layout independent
  2429. [key tokens](ref keys) named after their values in the standard US keyboard
  2430. layout. If you want to input text, use the
  2431. [character callback](ref glfwSetCharCallback) instead.
  2432. When a window loses input focus, it will generate synthetic key release
  2433. events for all pressed keys. You can tell these events from user-generated
  2434. events by the fact that the synthetic ones are generated after the focus
  2435. loss event has been processed, i.e. after the
  2436. [window focus callback](ref glfwSetWindowFocusCallback) has been called.
  2437. The scancode of a key is specific to that platform or sometimes even to that
  2438. machine. Scancodes are intended to allow users to bind keys that don't have
  2439. a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
  2440. state is not saved and so it cannot be queried with ref glfwGetKey.
  2441. Sometimes GLFW needs to generate synthetic key events, in which case the
  2442. scancode may be zero.
  2443. param[in] window The window whose callback to set.
  2444. param[in] callback The new key callback, or `NULL` to remove the currently
  2445. set callback.
  2446. return The previously set callback, or `NULL` if no callback was set or the
  2447. library had not been [initialized](ref intro_init).
  2448. callback_signature
  2449. code
  2450. void function_name(GLFWwindow window, int key, int scancode, int action, int mods)
  2451. endcode
  2452. For more information about the callback parameters, see the
  2453. [function pointer type](ref GLFWkeyfun).
  2454. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2455. thread_safety This function must only be called from the main thread.
  2456. sa ref input_key
  2457. since Added in version 1.0.
  2458. glfw3 Added window handle parameter and return value.
  2459. }
  2460. function glfwSetKeyCallback(window: pGLFWwindow; cbfun: GLFWkeyfun): pGLFWKeyFun;
  2461. cdecl; external GLFW_DLL;
  2462. {
  2463. /! Sets the Unicode character callback.
  2464. This function sets the character callback of the specified window, which is
  2465. called when a Unicode character is input.
  2466. The character callback is intended for Unicode text input. As it deals with
  2467. characters, it is keyboard layout dependent, whereas the
  2468. [key callback](ref glfwSetKeyCallback) is not. Characters do not map 1:1
  2469. to physical keys, as a key may produce zero, one or more characters. If you
  2470. want to know whether a specific physical key was pressed or released, see
  2471. the key callback instead.
  2472. The character callback behaves as system text input normally does and will
  2473. not be called if modifier keys are held down that would prevent normal text
  2474. input on that platform, for example a Super (Command) key on macOS or Alt key
  2475. on Windows.
  2476. param[in] window The window whose callback to set.
  2477. param[in] callback The new callback, or `NULL` to remove the currently set
  2478. callback.
  2479. return The previously set callback, or `NULL` if no callback was set or the
  2480. library had not been [initialized](ref intro_init).
  2481. callback_signature
  2482. code
  2483. void function_name(GLFWwindow window, unsigned int codepoint)
  2484. endcode
  2485. For more information about the callback parameters, see the
  2486. [function pointer type](ref GLFWcharfun).
  2487. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2488. thread_safety This function must only be called from the main thread.
  2489. sa ref input_char
  2490. since Added in version 2.4.
  2491. }
  2492. function glfwSetCharCallback(window: pGLFWwindow; cdfun: GLFWcharfun): pGLFWcharfun;
  2493. cdecl; external GLFW_DLL;
  2494. {
  2495. /! Sets the Unicode character with modifiers callback.
  2496. This function sets the character with modifiers callback of the specified
  2497. window, which is called when a Unicode character is input regardless of what
  2498. modifier keys are used.
  2499. The character with modifiers callback is intended for implementing custom
  2500. Unicode character input. For regular Unicode text input, see the
  2501. [character callback](ref glfwSetCharCallback). Like the character
  2502. callback, the character with modifiers callback deals with characters and is
  2503. keyboard layout dependent. Characters do not map 1:1 to physical keys, as
  2504. a key may produce zero, one or more characters. If you want to know whether
  2505. a specific physical key was pressed or released, see the
  2506. [key callback](ref glfwSetKeyCallback) instead.
  2507. param[in] window The window whose callback to set.
  2508. param[in] callback The new callback, or `NULL` to remove the currently set
  2509. callback.
  2510. return The previously set callback, or `NULL` if no callback was set or an
  2511. [error](ref error_handling) occurred.
  2512. callback_signature
  2513. code
  2514. void function_name(GLFWwindow window, unsigned int codepoint, int mods)
  2515. endcode
  2516. For more information about the callback parameters, see the
  2517. [function pointer type](ref GLFWcharmodsfun).
  2518. deprecated Scheduled for removal in version 4.0.
  2519. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2520. thread_safety This function must only be called from the main thread.
  2521. sa ref input_char
  2522. since Added in version 3.1.
  2523. }
  2524. function glfwSetCharModsCallback(window: GLFWwindow;
  2525. cbfun: PGLFWcharmodsfun): PGLFWcharmodsfun; cdecl; external GLFW_DLL; //Version 3.1
  2526. {
  2527. /! Sets the mouse button callback.
  2528. This function sets the mouse button callback of the specified window, which
  2529. is called when a mouse button is pressed or released.
  2530. When a window loses input focus, it will generate synthetic mouse button
  2531. release events for all pressed mouse buttons. You can tell these events
  2532. from user-generated events by the fact that the synthetic ones are generated
  2533. after the focus loss event has been processed, i.e. after the
  2534. [window focus callback](ref glfwSetWindowFocusCallback) has been called.
  2535. param[in] window The window whose callback to set.
  2536. param[in] callback The new callback, or `NULL` to remove the currently set
  2537. callback.
  2538. return The previously set callback, or `NULL` if no callback was set or the
  2539. library had not been [initialized](ref intro_init).
  2540. callback_signature
  2541. code
  2542. void function_name(GLFWwindow window, int button, int action, int mods)
  2543. endcode
  2544. For more information about the callback parameters, see the
  2545. [function pointer type](ref GLFWmousebuttonfun).
  2546. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2547. thread_safety This function must only be called from the main thread.
  2548. sa ref input_mouse_button
  2549. since Added in version 1.0.
  2550. glfw3 Added window handle parameter and return value.
  2551. }
  2552. function glfwSetMouseButtonCallback(window: pGLFWwindow;
  2553. cbfun: GLFWmousebuttonfun): pGLFWmousebuttonfun; cdecl; external GLFW_DLL;
  2554. {
  2555. /! Sets the cursor position callback.
  2556. This function sets the cursor position callback of the specified window,
  2557. which is called when the cursor is moved. The callback is provided with the
  2558. position, in screen coordinates, relative to the upper-left corner of the
  2559. content area of the window.
  2560. param[in] window The window whose callback to set.
  2561. param[in] callback The new callback, or `NULL` to remove the currently set
  2562. callback.
  2563. return The previously set callback, or `NULL` if no callback was set or the
  2564. library had not been [initialized](ref intro_init).
  2565. callback_signature
  2566. code
  2567. void function_name(GLFWwindow window, double xpos, double ypos);
  2568. endcode
  2569. For more information about the callback parameters, see the
  2570. [function pointer type](ref GLFWcursorposfun).
  2571. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2572. thread_safety This function must only be called from the main thread.
  2573. sa ref cursor_pos
  2574. since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
  2575. }
  2576. function glfwSetCursorPosCallback(window: pGLFWwindow;
  2577. cbfun: GLFWcursorposfun): pGLFWcursorposfun; cdecl; external GLFW_DLL;
  2578. {
  2579. /! Sets the cursor enter/leave callback.
  2580. This function sets the cursor boundary crossing callback of the specified
  2581. window, which is called when the cursor enters or leaves the content area of
  2582. the window.
  2583. param[in] window The window whose callback to set.
  2584. param[in] callback The new callback, or `NULL` to remove the currently set
  2585. callback.
  2586. return The previously set callback, or `NULL` if no callback was set or the
  2587. library had not been [initialized](ref intro_init).
  2588. callback_signature
  2589. code
  2590. void function_name(GLFWwindow window, int entered)
  2591. endcode
  2592. For more information about the callback parameters, see the
  2593. [function pointer type](ref GLFWcursorenterfun).
  2594. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2595. thread_safety This function must only be called from the main thread.
  2596. sa ref cursor_enter
  2597. since Added in version 3.0.
  2598. }
  2599. function glfwSetCursorEnterCallback(window: pGLFWwindow;
  2600. cbfun: GLFWcursorenterfun): pGLFWcursorenterfun; cdecl; external GLFW_DLL;
  2601. {
  2602. /! Sets the scroll callback.
  2603. This function sets the scroll callback of the specified window, which is
  2604. called when a scrolling device is used, such as a mouse wheel or scrolling
  2605. area of a touchpad.
  2606. The scroll callback receives all scrolling input, like that from a mouse
  2607. wheel or a touchpad scrolling area.
  2608. param[in] window The window whose callback to set.
  2609. param[in] callback The new scroll callback, or `NULL` to remove the
  2610. currently set callback.
  2611. return The previously set callback, or `NULL` if no callback was set or the
  2612. library had not been [initialized](ref intro_init).
  2613. callback_signature
  2614. code
  2615. void function_name(GLFWwindow window, double xoffset, double yoffset)
  2616. endcode
  2617. For more information about the callback parameters, see the
  2618. [function pointer type](ref GLFWscrollfun).
  2619. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2620. thread_safety This function must only be called from the main thread.
  2621. sa ref scrolling
  2622. since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
  2623. }
  2624. function glfwSetScrollCallback(window: pGLFWwindow;
  2625. cbfun: GLFWscrollfun): pGLFWscrollfun; cdecl; external GLFW_DLL;
  2626. {
  2627. Sets the path drop callback.
  2628. *
  2629. * This function sets the path drop callback of the specified window, which is
  2630. * called when one or more dragged paths are dropped on the window.
  2631. *
  2632. * Because the path array and its strings may have been generated specifically
  2633. * for that event, they are not guaranteed to be valid after the callback has
  2634. * returned. If you wish to use them after the callback returns, you need to
  2635. * make a deep copy.
  2636. *
  2637. * @param[in] window The window whose callback to set.
  2638. * @param[in] callback The new file drop callback, or `NULL` to remove the
  2639. * currently set callback.
  2640. * @return The previously set callback, or `NULL` if no callback was set or the
  2641. * library had not been [initialized](@ref intro_init).
  2642. *
  2643. * @callback_signature
  2644. * @code
  2645. * void function_name(GLFWwindow* window, int path_count, const char* paths[])
  2646. * @endcode
  2647. * For more information about the callback parameters, see the
  2648. * [function pointer type](@ref GLFWdropfun).
  2649. *
  2650. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  2651. *
  2652. * @remark @wayland File drop is currently unimplemented.
  2653. *
  2654. * @thread_safety This function must only be called from the main thread.
  2655. *
  2656. * @sa @ref path_drop
  2657. *
  2658. * @since Added in version 3.1.
  2659. }
  2660. function glfwSetDropCallback(window: pGLFWwindow; cbfun: GLFWdropfun): pGLFWdropfun;
  2661. cdecl; external GLFW_DLL;
  2662. {
  2663. Returns whether the specified joystick is present.
  2664. *
  2665. * This function returns whether the specified joystick is present.
  2666. *
  2667. * There is no need to call this function before other functions that accept
  2668. * a joystick ID, as they all check for presence before performing any other
  2669. * work.
  2670. *
  2671. * @param[in] jid The [joystick](@ref joysticks) to query.
  2672. * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
  2673. *
  2674. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2675. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  2676. *
  2677. * @thread_safety This function must only be called from the main thread.
  2678. *
  2679. * @sa @ref joystick
  2680. *
  2681. * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
  2682. }
  2683. function glfwJoystickPresent(joy: integer): integer; cdecl; external GLFW_DLL;
  2684. {
  2685. Returns the values of all axes of the specified joystick.
  2686. *
  2687. * This function returns the values of all axes of the specified joystick.
  2688. * Each element in the array is a value between -1.0 and 1.0.
  2689. *
  2690. * If the specified joystick is not present this function will return `NULL`
  2691. * but will not generate an error. This can be used instead of first calling
  2692. * @ref glfwJoystickPresent.
  2693. *
  2694. * @param[in] jid The [joystick](@ref joysticks) to query.
  2695. * @param[out] count Where to store the number of axis values in the returned
  2696. * array. This is set to zero if the joystick is not present or an error
  2697. * occurred.
  2698. * @return An array of axis values, or `NULL` if the joystick is not present or
  2699. * an [error](@ref error_handling) occurred.
  2700. *
  2701. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2702. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  2703. *
  2704. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  2705. * should not free it yourself. It is valid until the specified joystick is
  2706. * disconnected or the library is terminated.
  2707. *
  2708. * @thread_safety This function must only be called from the main thread.
  2709. *
  2710. * @sa @ref joystick_axis
  2711. *
  2712. * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
  2713. }
  2714. function glfwGetJoystickAxes(joy: integer; var Count: integer): pfloat;
  2715. cdecl; external GLFW_DLL;
  2716. {
  2717. Returns the state of all buttons of the specified joystick.
  2718. *
  2719. * This function returns the state of all buttons of the specified joystick.
  2720. * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
  2721. *
  2722. * For backward compatibility with earlier versions that did not have @ref
  2723. * glfwGetJoystickHats, the button array also includes all hats, each
  2724. * represented as four buttons. The hats are in the same order as returned by
  2725. * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and
  2726. * _left_. To disable these extra buttons, set the @ref
  2727. * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.
  2728. *
  2729. * If the specified joystick is not present this function will return `NULL`
  2730. * but will not generate an error. This can be used instead of first calling
  2731. * @ref glfwJoystickPresent.
  2732. *
  2733. * @param[in] jid The [joystick](@ref joysticks) to query.
  2734. * @param[out] count Where to store the number of button states in the returned
  2735. * array. This is set to zero if the joystick is not present or an error
  2736. * occurred.
  2737. * @return An array of button states, or `NULL` if the joystick is not present
  2738. * or an [error](@ref error_handling) occurred.
  2739. *
  2740. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  2741. * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
  2742. *
  2743. * @pointer_lifetime The returned array is allocated and freed by GLFW. You
  2744. * should not free it yourself. It is valid until the specified joystick is
  2745. * disconnected or the library is terminated.
  2746. *
  2747. * @thread_safety This function must only be called from the main thread.
  2748. *
  2749. * @sa @ref joystick_button
  2750. *
  2751. * @since Added in version 2.2.
  2752. * @glfw3 Changed to return a dynamic array.
  2753. }
  2754. function glfwGetJoystickButtons(joy: integer; varcount: integer): pCharArray;
  2755. cdecl; external GLFW_DLL;
  2756. {
  2757. Returns the state of all hats of the specified joystick.
  2758. This function returns the state of all hats of the specified joystick.
  2759. Each element in the array is one of the following values:
  2760. Name | Value
  2761. ---- | -----
  2762. `GLFW_HAT_CENTERED` | 0
  2763. `GLFW_HAT_UP` | 1
  2764. `GLFW_HAT_RIGHT` | 2
  2765. `GLFW_HAT_DOWN` | 4
  2766. `GLFW_HAT_LEFT` | 8
  2767. `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP`
  2768. `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN`
  2769. `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP`
  2770. `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN`
  2771. The diagonal directions are bitwise combinations of the primary (up, right,
  2772. down and left) directions and you can test for these individually by ANDing
  2773. it with the corresponding direction.
  2774. if the specified joystick is not present this function will return `NULL`
  2775. but will not generate an error. This can be used instead of first calling
  2776. ref glfwJoystickPresent.
  2777. param[in] jid The [joystick](ref joysticks) to query.
  2778. param[out] count Where to store the number of hat states in the returned
  2779. array. This is set to zero if the joystick is not present or an error
  2780. occurred.
  2781. return An array of hat states, or `NULL` if the joystick is not present
  2782. or an [error](ref error_handling) occurred.
  2783. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  2784. GLFW_INVALID_ENUM and ref GLFW_PLATFORM_ERROR.
  2785. pointer_lifetime The returned array is allocated and freed by GLFW. You
  2786. should not free it yourself. It is valid until the specified joystick is
  2787. disconnected, this function is called again for that joystick or the library
  2788. is terminated.
  2789. thread_safety This function must only be called from the main thread.
  2790. sa ref joystick_hat
  2791. since Added in version 3.3.
  2792. ingroup input
  2793. }
  2794. function glfwGetJoystickHats(jid: integer; var Count: integer): PChar;
  2795. cdecl; external GLFW_DLL;
  2796. function glfwGetJoystickName(joy: integer): PChar; cdecl; external GLFW_DLL;
  2797. { Returns the SDL compatible GUID of the specified joystick.
  2798. This function returns the SDL compatible GUID, as a UTF-8 encoded
  2799. hexadecimal string, of the specified joystick. The returned string is
  2800. allocated and freed by GLFW. You should not free it yourself.
  2801. The GUID is what connects a joystick to a gamepad mapping. A connected
  2802. joystick will always have a GUID even if there is no gamepad mapping
  2803. assigned to it.
  2804. If the specified joystick is not present this function will return `NULL`
  2805. but will not generate an error. This can be used instead of first calling
  2806. ref glfwJoystickPresent.
  2807. The GUID uses the format introduced in SDL 2.0.5. This GUID tries to
  2808. uniquely identify the make and model of a joystick but does not identify
  2809. a specific unit, e.g. all wired Xbox 360 controllers will have the same
  2810. GUID on that platform. The GUID for a unit may vary between platforms
  2811. depending on what hardware information the platform specific APIs provide.
  2812. param[in] jid The [joystick](ref joysticks) to query.
  2813. return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick
  2814. is not present or an [error](ref error_handling) occurred.
  2815. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  2816. GLFW_INVALID_ENUM and ref GLFW_PLATFORM_ERROR.
  2817. pointer_lifetime The returned string is allocated and freed by GLFW. You
  2818. should not free it yourself. It is valid until the specified joystick is
  2819. disconnected or the library is terminated.
  2820. thread_safety This function must only be called from the main thread.
  2821. sa ref gamepad
  2822. since Added in version 3.3.
  2823. ingroup input
  2824. /
  2825. }
  2826. function glfwGetJoystickGUID(jid: integer): PChar; cdecl; external GLFW_DLL;
  2827. { Sets the user pointer of the specified joystick.
  2828. This function sets the user-defined pointer of the specified joystick. The
  2829. current value is retained until the joystick is disconnected. The initial
  2830. value is `NULL`.
  2831. This function may be called from the joystick callback, even for a joystick
  2832. that is being disconnected.
  2833. param[in] jid The joystick whose pointer to set.
  2834. param[in] pointer The new value.
  2835. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2836. thread_safety This function may be called from any thread. Access is not
  2837. synchronized.
  2838. sa ref joystick_userptr
  2839. sa ref glfwGetJoystickUserPointer
  2840. since Added in version 3.3.
  2841. ingroup input
  2842. /
  2843. }
  2844. procedure glfwSetJoystickUserPointer(jid: integer; newvalue: Pointer);
  2845. cdecl; external GLFW_DLL;
  2846. { Returns the user pointer of the specified joystick.
  2847. This function returns the current value of the user-defined pointer of the
  2848. specified joystick. The initial value is `NULL`.
  2849. This function may be called from the joystick callback, even for a joystick
  2850. that is being disconnected.
  2851. param[in] jid The joystick whose pointer to return.
  2852. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2853. thread_safety This function may be called from any thread. Access is not
  2854. synchronized.
  2855. sa ref joystick_userptr
  2856. sa ref glfwSetJoystickUserPointer
  2857. since Added in version 3.3.
  2858. ingroup input
  2859. /
  2860. }
  2861. function glfwGetJoystickUserPointer(jid: integer): Pointer; cdecl; external GLFW_DLL;
  2862. { Returns whether the specified joystick has a gamepad mapping.
  2863. This function returns whether the specified joystick is both present and has
  2864. a gamepad mapping.
  2865. If the specified joystick is present but does not have a gamepad mapping
  2866. this function will return `GLFW_FALSE` but will not generate an error. Call
  2867. ref glfwJoystickPresent to check if a joystick is present regardless of
  2868. whether it has a mapping.
  2869. param[in] jid The [joystick](ref joysticks) to query.
  2870. return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping,
  2871. or `GLFW_FALSE` otherwise.
  2872. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2873. GLFW_INVALID_ENUM.
  2874. thread_safety This function must only be called from the main thread.
  2875. sa ref gamepad
  2876. sa ref glfwGetGamepadState
  2877. since Added in version 3.3.
  2878. ingroup input
  2879. }
  2880. function glfwJoystickIsGamepad(jid: integer): GLFW_INT; cdecl; external GLFW_DLL;
  2881. { Sets the joystick configuration callback.
  2882. This function sets the joystick configuration callback, or removes the
  2883. currently set callback. This is called when a joystick is connected to or
  2884. disconnected from the system.
  2885. For joystick connection and disconnection events to be delivered on all
  2886. platforms, you need to call one of the [event processing](ref events)
  2887. functions. Joystick disconnection may also be detected and the callback
  2888. called by joystick functions. The function will then return whatever it
  2889. returns if the joystick is not present.
  2890. param[in] callback The new callback, or `NULL` to remove the currently set
  2891. callback.
  2892. return The previously set callback, or `NULL` if no callback was set or the
  2893. library had not been [initialized](ref intro_init).
  2894. callback_signature
  2895. void function_name(int jid, int event)
  2896. For more information about the callback parameters, see the
  2897. [function pointer type](ref GLFWjoystickfun).
  2898. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2899. thread_safety This function must only be called from the main thread.
  2900. sa ref joystick_event
  2901. since Added in version 3.2.
  2902. ingroup input
  2903. }
  2904. function glfwSetJoystickCallback(cbfun: GLFWjoystickfun): pGLFWjoystickfun; cdecl;
  2905. external GLFW_DLL;
  2906. {
  2907. Adds the specified SDL_GameControllerDB gamepad mappings.
  2908. This function parses the specified ASCII encoded string and updates the
  2909. internal list with any gamepad mappings it finds. This string may
  2910. contain either a single gamepad mapping or many mappings separated by
  2911. newlines. The parser supports the full format of the `gamecontrollerdb.txt`
  2912. source file including empty lines and comments.
  2913. See ref gamepad_mapping for a description of the format.
  2914. If there is already a gamepad mapping for a given GUID in the internal list,
  2915. it will be replaced by the one passed to this function. If the library is
  2916. terminated and re-initialized the internal list will revert to the built-in
  2917. default.
  2918. param[in] string The string containing the gamepad mappings.
  2919. return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
  2920. [error](ref error_handling) occurred.
  2921. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2922. GLFW_INVALID_VALUE.
  2923. thread_safety This function must only be called from the main thread.
  2924. sa ref gamepad
  2925. sa ref glfwJoystickIsGamepad
  2926. sa ref glfwGetGamepadName
  2927. since Added in version 3.3.
  2928. ingroup input
  2929. }
  2930. function glfwUpdateGamepadMappings(mappings: PChar): GLFW_INT; cdecl; external GLFW_DLL;
  2931. {
  2932. ! Returns the human-readable gamepad name for the specified joystick.
  2933. This function returns the human-readable name of the gamepad from the
  2934. gamepad mapping assigned to the specified joystick.
  2935. If the specified joystick is not present or does not have a gamepad mapping
  2936. this function will return `NULL` but will not generate an error. Call
  2937. ref glfwJoystickPresent to check whether it is present regardless of
  2938. whether it has a mapping.
  2939. param[in] jid The [joystick](ref joysticks) to query.
  2940. return The UTF-8 encoded name of the gamepad, or `NULL` if the
  2941. joystick is not present, does not have a mapping or an
  2942. [error](ref error_handling) occurred.
  2943. pointer_lifetime The returned string is allocated and freed by GLFW. You
  2944. should not free it yourself. It is valid until the specified joystick is
  2945. disconnected, the gamepad mappings are updated or the library is terminated.
  2946. thread_safety This function must only be called from the main thread.
  2947. sa ref gamepad
  2948. sa ref glfwJoystickIsGamepad
  2949. since Added in version 3.3.
  2950. ingroup input
  2951. }
  2952. function glfwGetGamepadName(jid: GLFW_INT): PChar; cdecl; external GLFW_DLL;
  2953. { ! Retrieves the state of the specified joystick remapped as a gamepad.
  2954. This function retrieves the state of the specified joystick remapped to
  2955. an Xbox-like gamepad.
  2956. If the specified joystick is not present or does not have a gamepad mapping
  2957. this function will return `GLFW_FALSE` but will not generate an error. Call
  2958. ref glfwJoystickPresent to check whether it is present regardless of
  2959. whether it has a mapping.
  2960. The Guide button may not be available for input as it is often hooked by the
  2961. system or the Steam client.
  2962. Not all devices have all the buttons or axes provided by ref
  2963. GLFWgamepadstate. Unavailable buttons and axes will always report
  2964. `GLFW_RELEASE` and 0.0 respectively.
  2965. param[in] jid The [joystick](ref joysticks) to query.
  2966. param[out] state The gamepad input state of the joystick.
  2967. return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is
  2968. connected, it has no gamepad mapping or an [error](ref error_handling)
  2969. occurred.
  2970. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  2971. GLFW_INVALID_ENUM.
  2972. thread_safety This function must only be called from the main thread.
  2973. sa ref gamepad
  2974. sa ref glfwUpdateGamepadMappings
  2975. sa ref glfwJoystickIsGamepad
  2976. since Added in version 3.3.
  2977. ingroup input
  2978. }
  2979. function glfwGetGamepadState(jid: GLFW_INT; state: pGLFWgamepadstate): GLFW_INT;
  2980. cdecl; external GLFW_DLL;
  2981. // ========================================================================
  2982. // clipboard
  2983. // ========================================================================
  2984. procedure glfwSetClipboardString(window: pGLFWwindow; char: string);
  2985. cdecl; external GLFW_DLL;
  2986. function glfwGetClipboardString(window: pGLFWwindow): PChar; cdecl; external GLFW_DLL;
  2987. //Time
  2988. //========================================================================
  2989. procedure glfwSetTime(time: double); cdecl; external GLFW_DLL;
  2990. {
  2991. ! Returns the current value of the raw timer.
  2992. This function returns the current value of the raw timer, measured in
  2993. 1&nbsp; &nbsp;frequency seconds. To get the frequency, call ref
  2994. glfwGetTimerFrequency.
  2995. return The value of the timer, or zero if an
  2996. [error](ref error_handling) occurred.
  2997. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  2998. thread_safety This function may be called from any thread.
  2999. sa ref time
  3000. sa ref glfwGetTimerFrequency
  3001. since Added in version 3.2.
  3002. ingroup input
  3003. }
  3004. function glfwGetTimerValue(): uint64; cdecl; external GLFW_DLL;
  3005. {
  3006. ! Returns the frequency, in Hz, of the raw timer.
  3007. This function returns the frequency, in Hz, of the raw timer.
  3008. return The frequency of the timer, in Hz, or zero if an
  3009. [error](ref error_handling) occurred.
  3010. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  3011. thread_safety This function may be called from any thread.
  3012. sa ref time
  3013. sa ref glfwGetTimerValue
  3014. since Added in version 3.2.
  3015. }
  3016. function glfwGetTimerFrequency(): uint64; cdecl; external GLFW_DLL;
  3017. {
  3018. Makes the context of the specified window current for the calling
  3019. * thread.
  3020. *
  3021. * This function makes the OpenGL or OpenGL ES context of the specified window
  3022. * current on the calling thread. A context must only be made current on
  3023. * a single thread at a time and each thread can have only a single current
  3024. * context at a time.
  3025. *
  3026. * When moving a context between threads, you must make it non-current on the
  3027. * old thread before making it current on the new one.
  3028. *
  3029. * By default, making a context non-current implicitly forces a pipeline flush.
  3030. * On machines that support `GL_KHR_context_flush_control`, you can control
  3031. * whether a context performs this flush by setting the
  3032. * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)
  3033. * hint.
  3034. *
  3035. * The specified window must have an OpenGL or OpenGL ES context. Specifying
  3036. * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
  3037. * error.
  3038. *
  3039. * @param[in] window The window whose context to make current, or `NULL` to
  3040. * detach the current context.
  3041. *
  3042. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3043. * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  3044. *
  3045. * @thread_safety This function may be called from any thread.
  3046. *
  3047. * @sa @ref context_current
  3048. * @sa @ref glfwGetCurrentContext
  3049. *
  3050. * @since Added in version 3.0.
  3051. }
  3052. procedure glfwMakeContextCurrent(window: pGLFWwindow); cdecl; external GLFW_DLL;
  3053. {
  3054. Returns the window whose context is current on the calling thread.
  3055. *
  3056. * This function returns the window whose OpenGL or OpenGL ES context is
  3057. * current on the calling thread.
  3058. *
  3059. * @return The window whose context is current, or `NULL` if no window's
  3060. * context is current.
  3061. *
  3062. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  3063. *
  3064. * @thread_safety This function may be called from any thread.
  3065. *
  3066. * @sa @ref context_current
  3067. * @sa @ref glfwMakeContextCurrent
  3068. *
  3069. * @since Added in version 3.0.
  3070. }
  3071. function glfwGetCurrentContext: pGLFWwindow; cdecl; external GLFW_DLL;
  3072. //========================================================================
  3073. //Context
  3074. //========================================================================
  3075. {
  3076. Swaps the front and back buffers of the specified window.
  3077. This function swaps the front and back buffers of the specified window when
  3078. rendering with OpenGL or OpenGL ES. If the swap interval is greater than
  3079. zero, the GPU driver waits the specified number of screen updates before
  3080. swapping the buffers.
  3081. The specified window must have an OpenGL or OpenGL ES context. Specifying
  3082. a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
  3083. error.
  3084. This function does not apply to Vulkan. If you are rendering with Vulkan,
  3085. see `vkQueuePresentKHR` instead.
  3086. @param[in] window The window whose buffers to swap.
  3087. @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3088. GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  3089. @remark __EGL:__ The context of the specified window must be current on the
  3090. calling thread.
  3091. @thread_safety This function may be called from any thread.
  3092. @sa @ref buffer_swap
  3093. @sa @ref glfwSwapInterval
  3094. @since Added in version 1.0.
  3095. @glfw3 Added window handle parameter.
  3096. }
  3097. procedure glfwSwapBuffers(window: pGLFWwindow); cdecl; external GLFW_DLL;
  3098. {
  3099. Sets the swap interval for the current context.
  3100. This function sets the swap interval for the current OpenGL or OpenGL ES
  3101. context, i.e. the number of screen updates to wait from the time @ref
  3102. glfwSwapBuffers was called before swapping the buffers and returning. This
  3103. is sometimes called _vertical synchronization_, _vertical retrace
  3104. synchronization_ or just _vsync_.
  3105. A context that supports either of the `WGL_EXT_swap_control_tear` and
  3106. `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap
  3107. intervals, which allows the driver to swap immediately even if a frame
  3108. arrives a little bit late. You can check for these extensions with @ref
  3109. glfwExtensionSupported.
  3110. A context must be current on the calling thread. Calling this function
  3111. without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
  3112. This function does not apply to Vulkan. If you are rendering with Vulkan,
  3113. see the present mode of your swapchain instead.
  3114. @param[in] interval The minimum number of screen updates to wait for
  3115. until the buffers are swapped by @ref glfwSwapBuffers.
  3116. @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3117. GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  3118. @remark This function is not called during context creation, leaving the
  3119. swap interval set to whatever is the default on that platform. This is done
  3120. because some swap interval extensions used by GLFW do not allow the swap
  3121. interval to be reset to zero once it has been set to a non-zero value.
  3122. @remark Some GPU drivers do not honor the requested swap interval, either
  3123. because of a user setting that overrides the application's request or due to
  3124. bugs in the driver.
  3125. @thread_safety This function may be called from any thread.
  3126. @sa @ref buffer_swap
  3127. @sa @ref glfwSwapBuffers
  3128. @since Added in version 1.0.
  3129. }
  3130. procedure glfwSwapInterval(interval: integer); cdecl; external GLFW_DLL;
  3131. {
  3132. Returns whether the specified extension is available.
  3133. This function returns whether the specified
  3134. [API extension](@ref context_glext) is supported by the current OpenGL or
  3135. OpenGL ES context. It searches both for client API extension and context
  3136. creation API extensions.
  3137. A context must be current on the calling thread. Calling this function
  3138. without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
  3139. As this functions retrieves and searches one or more extension strings each
  3140. call, it is recommended that you cache its results if it is going to be used
  3141. frequently. The extension strings will not change during the lifetime of
  3142. a context, so there is no danger in doing this.
  3143. This function does not apply to Vulkan. If you are using Vulkan, see @ref
  3144. glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
  3145. and `vkEnumerateDeviceExtensionProperties` instead.
  3146. @param[in] extension The ASCII encoded name of the extension.
  3147. @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
  3148. otherwise.
  3149. @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3150. GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
  3151. GLFW_PLATFORM_ERROR.
  3152. @thread_safety This function may be called from any thread.
  3153. @sa @ref context_glext
  3154. @sa @ref glfwGetProcAddress
  3155. @since Added in version 1.0.
  3156. }
  3157. function glfwExtensionSupported(extension: PChar): integer; cdecl; external GLFW_DLL;
  3158. {
  3159. Returns the address of the specified function for the current
  3160. context.
  3161. This function returns the address of the specified OpenGL or OpenGL ES
  3162. [core or extension function](@ref context_glext), if it is supported
  3163. by the current context.
  3164. A context must be current on the calling thread. Calling this function
  3165. without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
  3166. This function does not apply to Vulkan. If you are rendering with Vulkan,
  3167. see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
  3168. `vkGetDeviceProcAddr` instead.
  3169. @aram[in] procname The ASCII encoded name of the function.
  3170. return The address of the function, or `NULL` if an
  3171. [error](@ref error_handling) occurred.
  3172. errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  3173. GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  3174. remark The address of a given function is not guaranteed to be the same
  3175. between contexts.
  3176. remark This function may return a non-`NULL` address despite the
  3177. associated version or extension not being available. Always check the
  3178. context version or extension string first.
  3179. pointer_lifetime The returned function pointer is valid until the context
  3180. is destroyed or the library is terminated.
  3181. thread_safety This function may be called from any thread.
  3182. sa @ref context_glext
  3183. sa @ref glfwExtensionSupported
  3184. since Added in version 1.0.
  3185. }
  3186. function glfwGetProcAddress(procname: PChar): pGLFWglproc; cdecl; external GLFW_DLL;
  3187. { Returns whether the Vulkan loader and an ICD have been found.
  3188. This function returns whether the Vulkan loader and any minimally functional
  3189. ICD have been found.
  3190. The availability of a Vulkan loader and even an ICD does not by itself
  3191. guarantee that surface creation or even instance creation is possible.
  3192. For example, on Fermi systems Nvidia will install an ICD that provides no
  3193. actual Vulkan support. Call ref glfwGetRequiredInstanceExtensions to check
  3194. whether the extensions necessary for Vulkan surface creation are available
  3195. and ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
  3196. family of a physical device supports image presentation.
  3197. return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
  3198. otherwise.
  3199. errors Possible errors include ref GLFW_NOT_INITIALIZED.
  3200. thread_safety This function may be called from any thread.
  3201. sa ref vulkan_support
  3202. since Added in version 3.2.
  3203. ingroup vulkan
  3204. }
  3205. function glfwVulkanSupported(): integer; cdecl; external GLFW_DLL;
  3206. { Returns the Vulkan instance extensions required by GLFW.
  3207. This function returns an array of names of Vulkan instance extensions required
  3208. by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
  3209. list will always contain `VK_KHR_surface`, so if you don't require any
  3210. additional extensions you can pass this list directly to the
  3211. `VkInstanceCreateInfo` struct.
  3212. If Vulkan is not available on the machine, this function returns `NULL` and
  3213. generates a ref GLFW_API_UNAVAILABLE error. Call ref glfwVulkanSupported
  3214. to check whether Vulkan is at least minimally available.
  3215. If Vulkan is available but no set of extensions allowing window surface
  3216. creation was found, this function returns `NULL`. You may still use Vulkan
  3217. for off-screen rendering and compute work.
  3218. param[out] count Where to store the number of extensions in the returned
  3219. array. This is set to zero if an error occurred.
  3220. return An array of ASCII encoded extension names, or `NULL` if an
  3221. [error](ref error_handling) occurred.
  3222. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  3223. GLFW_API_UNAVAILABLE.
  3224. remark Additional extensions may be required by future versions of GLFW.
  3225. You should check if any extensions you wish to enable are already in the
  3226. returned array, as it is an error to specify an extension more than once in
  3227. the `VkInstanceCreateInfo` struct.
  3228. remark macos This function currently supports either the
  3229. `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface`
  3230. extension.
  3231. pointer_lifetime The returned array is allocated and freed by GLFW. You
  3232. should not free it yourself. It is guaranteed to be valid only until the
  3233. library is terminated.
  3234. thread_safety This function may be called from any thread.
  3235. sa ref vulkan_ext
  3236. sa ref glfwCreateWindowSurface
  3237. since Added in version 3.2.
  3238. ingroup vulkan
  3239. }
  3240. function glfwGetRequiredInstanceExtensions(var Count: uint32): PChar;
  3241. cdecl; external GLFW_DLL;
  3242. {$IFDEF VK_VERSION_1_0}
  3243. {
  3244. Returns the address of the specified Vulkan instance function.
  3245. This function returns the address of the specified Vulkan core or extension
  3246. function for the specified instance. If instance is set to `NULL` it can
  3247. return any function exported from the Vulkan loader, including at least the
  3248. following functions:
  3249. - vkEnumerateInstanceExtensionProperties`
  3250. - vkEnumerateInstanceLayerProperties`
  3251. - vkCreateInstance`
  3252. - vkGetInstanceProcAddr`
  3253. If Vulkan is not available on the machine, this function returns `NULL` and
  3254. generates a ref GLFW_API_UNAVAILABLE error. Call ref glfwVulkanSupported
  3255. to check whether Vulkan is at least minimally available.
  3256. This function is equivalent to calling `vkGetInstanceProcAddr` with
  3257. a platform-specific query of the Vulkan loader as a fallback.
  3258. param[in] instance The Vulkan instance to query, or `NULL` to retrieve
  3259. functions related to instance creation.
  3260. param[in] procname The ASCII encoded name of the function.
  3261. return The address of the function, or `NULL` if an
  3262. [error](ref error_handling) occurred.
  3263. errors Possible errors include ref GLFW_NOT_INITIALIZED and ref
  3264. GLFW_API_UNAVAILABLE.
  3265. pointer_lifetime The returned function pointer is valid until the library
  3266. is terminated.
  3267. thread_safety This function may be called from any thread.
  3268. sa ref vulkan_proc
  3269. since Added in version 3.2.
  3270. }
  3271. function glfwGetInstanceProcAddress(instance: VkInstance;
  3272. procname: PChar): pglfwGetInstanceProcAddress; cdecl; external GLFW_DLL;
  3273. {
  3274. f Returns whether the specified queue family can present images.
  3275. This function returns whether the specified queue family of the specified
  3276. physical device supports presentation to the platform GLFW was built for.
  3277. If Vulkan or the required window surface creation instance extensions are
  3278. not available on the machine, or if the specified instance was not created
  3279. with the required extensions, this function returns `GLFW_FALSE` and
  3280. generates a ref GLFW_API_UNAVAILABLE error. Call ref glfwVulkanSupported
  3281. to check whether Vulkan is at least minimally available and ref
  3282. glfwGetRequiredInstanceExtensions to check what instance extensions are
  3283. required.
  3284. param[in] instance The instance that the physical device belongs to.
  3285. param[in] device The physical device that the queue family belongs to.
  3286. param[in] queuefamily The index of the queue family to query.
  3287. return `GLFW_TRUE` if the queue family supports presentation, or
  3288. `GLFW_FALSE` otherwise.
  3289. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  3290. GLFW_API_UNAVAILABLE and ref GLFW_PLATFORM_ERROR.
  3291. remark macos This function currently always returns `GLFW_TRUE`, as the
  3292. `VK_MVK_macos_surface` extension does not provide
  3293. a `vkGetPhysicalDevicePresentationSupport` type function.
  3294. thread_safety This function may be called from any thread. For
  3295. synchronization details of Vulkan objects, see the Vulkan specification.
  3296. sa ref vulkan_present
  3297. since Added in version 3.2.
  3298. }
  3299. function glfwGetPhysicalDevicePresentationSupport(instance: VkInstance;
  3300. device: VkPhysicalDevice; queuefamily: UInt32): integer; cdecl; external GLFW_DLL;
  3301. { Creates a Vulkan surface for the specified window.
  3302. This function creates a Vulkan surface for the specified window.
  3303. If the Vulkan loader or at least one minimally functional ICD were not found,
  3304. this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a ref
  3305. GLFW_API_UNAVAILABLE error. Call ref glfwVulkanSupported to check whether
  3306. Vulkan is at least minimally available.
  3307. If the required window surface creation instance extensions are not
  3308. available or if the specified instance was not created with these extensions
  3309. enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
  3310. generates a ref GLFW_API_UNAVAILABLE error. Call ref
  3311. glfwGetRequiredInstanceExtensions to check what instance extensions are
  3312. required.
  3313. The window surface cannot be shared with another API so the window must
  3314. have been created with the [client api hint](ref GLFW_CLIENT_API_attrib)
  3315. set to `GLFW_NO_API` otherwise it generates a ref GLFW_INVALID_VALUE error
  3316. and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`.
  3317. The window surface must be destroyed before the specified Vulkan instance.
  3318. It is the responsibility of the caller to destroy the window surface. GLFW
  3319. does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
  3320. surface.
  3321. param[in] instance The Vulkan instance to create the surface in.
  3322. param[in] window The window to create the surface for.
  3323. param[in] allocator The allocator to use, or `NULL` to use the default
  3324. allocator.
  3325. param[out] surface Where to store the handle of the surface. This is set
  3326. to `VK_NULL_HANDLE` if an error occurred.
  3327. return `VK_SUCCESS` if successful, or a Vulkan error code if an
  3328. [error](ref error_handling) occurred.
  3329. errors Possible errors include ref GLFW_NOT_INITIALIZED, ref
  3330. GLFW_API_UNAVAILABLE, ref GLFW_PLATFORM_ERROR and ref GLFW_INVALID_VALUE
  3331. remark If an error occurs before the creation call is made, GLFW returns
  3332. the Vulkan error code most appropriate for the error. Appropriate use of
  3333. ref glfwVulkanSupported and ref glfwGetRequiredInstanceExtensions should
  3334. eliminate almost all occurrences of these errors.
  3335. remark macos This function currently only supports the
  3336. `VK_MVK_macos_surface` extension from MoltenVK.
  3337. remark macos This function creates and sets a `CAMetalLayer` instance for
  3338. the window content view, which is required for MoltenVK to function.
  3339. thread_safety This function may be called from any thread. For
  3340. synchronization details of Vulkan objects, see the Vulkan specification.
  3341. sa ref vulkan_surface
  3342. sa ref glfwGetRequiredInstanceExtensions
  3343. since Added in version 3.2.
  3344. }
  3345. function glfwCreateWindowSurface(instance: VkInstance; window: pGLFWwindow;
  3346. var allocator: VkAllocationCallbacks; var surface: VkSurfaceKHR): VkResult;
  3347. cdecl; external GLFW_DLL;
  3348. {$ENDIF}
  3349. // ========================================================================
  3350. // Error
  3351. // ========================================================================
  3352. {
  3353. Sets the error callback.
  3354. This function sets the error callback, which is called with an error code
  3355. and a human-readable description each time a GLFW error occurs.
  3356. The error code is set before the callback is called. Calling ref
  3357. glfwGetError from the error callback will return the same value as the error
  3358. code argument.
  3359. The error callback is called on the thread where the error occurred. If you
  3360. are using GLFW from multiple threads, your error callback needs to be
  3361. written accordingly.
  3362. Because the description string may have been generated specifically for that
  3363. error, it is not guaranteed to be valid after the callback has returned. If
  3364. you wish to use it after the callback returns, you need to make a copy.
  3365. Once set, the error callback remains set even after the library has been
  3366. terminated.
  3367. param[in] callback The new callback, or `NULL` to remove the currently set
  3368. callback.
  3369. return The previously set callback, or `NULL` if no callback was set.
  3370. callback_signature
  3371. code
  3372. void callback_name(int error_code, const char description)
  3373. endcode
  3374. For more information about the callback parameters, see the
  3375. [callback pointer type](ref GLFWerrorfun).
  3376. errors None.
  3377. remark This function may be called before ref glfwInit.
  3378. thread_safety This function must only be called from the main thread.
  3379. }
  3380. function glfwSetErrorCallback(cbfun: GLFWerrorfun): pGLFWerrorfun;
  3381. cdecl; external GLFW_DLL;
  3382. implementation
  3383. end.