SDL2.Import.pas 325 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051
  1. unit SDL2.Import;
  2. {*******************************************************************************
  3. SDL2.pas v1.0 29/07/2013 first version for DelphiXE
  4. v1.1 27/08/2013 add MACOS compability
  5. v1.2 31/05/2014 delete sdl2.inc
  6. Simple DirectMedia Layer
  7. Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
  8. Pascal-Header-Conversion SDL from the JEDI-Team written by Domenique Louis and others.
  9. Pascal-Header-Conversion SDL2 from the Copyright (C) 2012/13 Tim Blume aka End.
  10. convert SDL/SDL2 to SDL2 for DelphiXE by Kotai 2013/2014 www.remakesonline.com
  11. The initial developer of this Pascal code was :
  12. Dominqiue Louis <[email protected]>
  13. *******************************************************************************}
  14. interface
  15. uses
  16. {$IFDEF FPC}
  17. SysUtils,
  18. Classes,
  19. Windows
  20. {$ELSE}
  21. System.SysUtils,
  22. System.Classes,
  23. Winapi.Windows
  24. {$ENDIF}
  25. {$IFDEF LINUX}
  26. ,X
  27. ,XLib;
  28. {$ELSE}
  29. ;
  30. {$ENDIF}
  31. const
  32. {$IFDEF MSWINDOWS}
  33. {$IFDEF WIN64}
  34. SDL_LibName = 'sdl2_64.dll';
  35. {$ELSE}
  36. SDL_LibName = 'sdl2_32.dll';
  37. {$ENDIF}
  38. {$ENDIF}
  39. {$IFDEF ANDROID}
  40. SDL_LibName = 'libsdl2.so';
  41. {$ENDIF}
  42. {$IFDEF MACOS}
  43. {$IFDEF IOS}
  44. SDL_LibName = 'libsdl2.a';
  45. {$ELSE}
  46. SDL_LibName = 'sdl2';
  47. {$ENDIF}
  48. {$ENDIF}
  49. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  50. ////////////////////// SDLtype_s.h / SDL_stdinc.h ////////////////////////////////////////////////////
  51. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  52. type
  53. TSDL_Bool = (SDL_FALSE,SDL_TRUE);
  54. DWord = LongWord;
  55. PUInt8Array = ^TUInt8Array;
  56. PUInt8 = ^UInt8;
  57. PPUInt8 = ^PUInt8;
  58. UInt8 = Byte;
  59. {$EXTERNALSYM UInt8}
  60. TUInt8Array = array [0..MAXINT shr 1] of UInt8;
  61. PUInt16 = ^UInt16;
  62. UInt16 = word;
  63. {$EXTERNALSYM UInt16}
  64. PSInt8 = ^SInt8;
  65. SInt8 = Shortint;
  66. {$EXTERNALSYM SInt8}
  67. PSInt16 = ^SInt16;
  68. SInt16 = smallint;
  69. {$EXTERNALSYM SInt16}
  70. PUInt32 = ^UInt32;
  71. UInt32 = Cardinal;
  72. {$EXTERNALSYM UInt32}
  73. SInt32 = LongInt;
  74. {$EXTERNALSYM SInt32}
  75. PFloat = ^Float;
  76. PInt = ^LongInt;
  77. PShortInt = ^ShortInt;
  78. PSInt64 = ^SInt64;
  79. SInt64 = Int64;
  80. {$IFNDEF WIN64}
  81. size_t = UInt32;
  82. {$ELSE}
  83. size_t = UInt64;
  84. {$ENDIF}
  85. {$EXTERNALSYM SIZE_T}
  86. Float = Single;
  87. {$EXTERNALSYM Float}
  88. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  89. ////////////////////// SDL_version.h ////////////////////////////////////////////////////
  90. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  91. {**
  92. * Information the version of SDL in use.
  93. *
  94. * Represents the library's version as three levels: major revision
  95. * (increments with massive changes, additions, and enhancements),
  96. * minor revision (increments with backwards-compatible changes to the
  97. * major revision), and patchlevel (increments with fixes to the minor
  98. * revision).
  99. *
  100. * SDL_VERSION
  101. * SDL_GetVersion
  102. *}
  103. type
  104. PSDL_Version = ^TSDL_Version;
  105. TSDL_Version = record
  106. major, {**< major version *}
  107. minor, {**< minor version *}
  108. patch: UInt8; {**< update version *}
  109. end;
  110. {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
  111. *}
  112. const
  113. SDL_MAJOR_VERSION = 2;
  114. SDL_MINOR_VERSION = 0;
  115. SDL_PATCHLEVEL = 0;
  116. {**
  117. * Macro to determine SDL version program was compiled against.
  118. *
  119. * This macro fills in a SDL_version structure with the version of the
  120. * library you compiled against. This is determined by what header the
  121. * compiler uses. Note that if you dynamically linked the library, you might
  122. * have a slightly newer or older version at runtime. That version can be
  123. * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
  124. * is not a macro.
  125. *
  126. * x A pointer to a SDL_version struct to initialize.
  127. *
  128. * SDL_version
  129. * SDL_GetVersion
  130. *}
  131. procedure SDL_VERSION(x: PSDL_Version);
  132. {**
  133. * This macro turns the version numbers into a numeric value:
  134. *
  135. * (1,2,3) -> (1203)
  136. *
  137. *
  138. * This assumes that there will never be more than 100 patchlevels.
  139. *}
  140. function SDL_VERSIONNUM(X,Y,Z: UInt32): Cardinal;
  141. {**
  142. * This is the version number macro for the current SDL version.
  143. *}
  144. function SDL_COMPILEDVERSION(): Cardinal;
  145. {**
  146. * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
  147. *}
  148. function SDL_VERSION_ATLEAST(X,Y,Z: Cardinal): Boolean;
  149. {**
  150. * Get the version of SDL that is linked against your program.
  151. *
  152. * If you are linking to SDL dynamically, then it is possible that the
  153. * current version will be different than the version you compiled against.
  154. * This function returns the current version, while SDL_VERSION() is a
  155. * macro that tells you what version you compiled with.
  156. *
  157. *
  158. * compiled: TSDL_Version;
  159. * linked: TSDL_Version;
  160. *
  161. * SDL_VERSION(@compiled);
  162. * SDL_GetVersion(@linked);
  163. * WriteLn('We compiled against SDL version: ' +
  164. * IntToStr(compiled.major) +
  165. * IntToStr(compiled.minor) +
  166. * IntToStr(compiled.patch));
  167. * WriteLn('But we linked against SDL version:' +
  168. * IntToStr(compiled.major) +
  169. * IntToStr(compiled.minor) +
  170. * IntToStr(compiled.patch));
  171. *
  172. *
  173. * This function may be called safely at any time, even before SDL_Init().
  174. *
  175. * SDL_VERSION
  176. *}
  177. procedure SDL_GetVersion(ver: PSDL_Version);
  178. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetVersion' {$ENDIF} {$ENDIF};
  179. {**
  180. * Get the code revision of SDL that is linked against your program.
  181. *
  182. * Returns an arbitrary string (a hash value) uniquely identifying the
  183. * exact revision of the SDL library in use, and is only useful in comparing
  184. * against other revisions. It is NOT an incrementing number.
  185. *}
  186. function SDL_GetRevision(): PChar;
  187. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRevision' {$ENDIF} {$ENDIF};
  188. {**
  189. * Get the revision number of SDL that is linked against your program.
  190. *
  191. * Returns a number uniquely identifying the exact revision of the SDL
  192. * library in use. It is an incrementing number based on commits to
  193. * hg.libsdl.org.
  194. *}
  195. function SDL_GetRevisionNumber(): SInt32;
  196. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRevisionNumber' {$ENDIF} {$ENDIF};
  197. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  198. ////////////////////// SDL_error.h ////////////////////////////////////////////////////
  199. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  200. const
  201. ERR_MAX_STRLEN = 128;
  202. ERR_MAX_ARGS = 5;
  203. {* Public functions *}
  204. {* SDL_SetError() unconditionally returns -1. *}
  205. function SDL_SetError(const fmt: PChar): SInt32;
  206. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetError' {$ENDIF} {$ENDIF};
  207. function SDL_GetError(): PChar;
  208. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetError' {$ENDIF} {$ENDIF};
  209. procedure SDL_ClearError();
  210. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ClearError' {$ENDIF} {$ENDIF};
  211. {*Internal error functions*}
  212. {**
  213. * Internal error functions
  214. *
  215. * Private error reporting function - used internally.
  216. *}
  217. {
  218. #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
  219. #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
  220. #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
  221. }
  222. type
  223. TSDL_ErrorCode = (SDL_ENOMEM,
  224. SDL_EFREAD,
  225. SDL_EFWRITE,
  226. SDL_EFSEEK,
  227. SDL_UNSUPPORTED,
  228. SDL_LASTERROR);
  229. TSDL_Error = record
  230. {* This is a numeric value corresponding to the current error *}
  231. error: SInt32;
  232. {* This is a key used to index into a language hashtable containing
  233. internationalized versions of the SDL error messages. If the key
  234. is not in the hashtable, or no hashtable is available, the key is
  235. used directly as an error message format string.
  236. *}
  237. key: array [0..ERR_MAX_STRLEN] of Char;
  238. // key: String[ERR_MAX_STRLEN]; **KTI**
  239. {* These are the arguments for the error functions *}
  240. argc: SInt32;
  241. case SInt32 of
  242. {* What is a character anyway? (UNICODE issues) *}
  243. 0: (value_c: Byte;);
  244. 1: (value_ptr: Pointer;);
  245. 2: (value_i: SInt32;);
  246. 3: (value_f: Double;);
  247. 4: (buf: array [0..ERR_MAX_STRLEN] of Char;);
  248. // 4: (buf: String[ERR_MAX_STRLEN];); **KTI**
  249. end;
  250. {* SDL_Error() unconditionally returns -1. *}
  251. function SDL_Error(code: TSDL_ErrorCode): SInt32;
  252. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_Error' {$ENDIF} {$ENDIF};
  253. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  254. ////////////////////// SDL_rwops.h ////////////////////////////////////////////////////
  255. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  256. const
  257. {* RWops Types *}
  258. SDL_RWOPS_UNKNOWN = 0; {* Unknown stream type *}
  259. SDL_RWOPS_WINFILE = 1; {* Win32 file *}
  260. SDL_RWOPS_STDFILE = 2; {* Stdio file *}
  261. SDL_RWOPS_JNIFILE = 3; {* Android asset *}
  262. SDL_RWOPS_MEMORY = 4; {* Memory stream *}
  263. SDL_RWOPS_MEMORY_RO = 5; {* Read-Only memory stream *}
  264. type
  265. PSDL_RWops = ^TSDL_RWops;
  266. {**
  267. * This is the read/write operation structure -- very basic.
  268. *}
  269. {**
  270. * Return the size of the file in this rwops, or -1 if unknown
  271. *}
  272. TSize = function(context: PSDL_RWops): SInt64; cdecl;
  273. {**
  274. * Seek to offset relative to whence, one of stdio's whence values:
  275. * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
  276. *
  277. * the final offset in the data stream, or -1 on error.
  278. *}
  279. TSeek = function(context: PSDL_RWops; offset: SInt64; whence: SInt32): SInt64; cdecl;
  280. {**
  281. * Read up to maxnum objects each of size size from the data
  282. * stream to the area pointed at by ptr.
  283. *
  284. * the number of objects read, or 0 at error or end of file.
  285. *}
  286. TRead = function(context: PSDL_RWops; ptr: Pointer; size: size_t; maxnum: size_t): size_t; cdecl;
  287. {**
  288. * Write exactly num objects each of size size from the area
  289. * pointed at by ptr to data stream.
  290. *
  291. * the number of objects written, or 0 at error or end of file.
  292. *}
  293. TWrite = function(context: PSDL_RWops; const ptr: Pointer; size: size_t; num: size_t): size_t; cdecl;
  294. {**
  295. * Close and free an allocated SDL_RWops structure.
  296. *
  297. * 0 if successful or -1 on write error when flushing data.
  298. *}
  299. TClose = function(context: PSDL_RWops): SInt32; cdecl;
  300. TStdio = record
  301. autoclose: TSDL_Bool;
  302. fp: file;
  303. end;
  304. TMem = record
  305. base: PUInt8;
  306. here: PUInt8;
  307. stop: PUInt8;
  308. end;
  309. TUnknown = record
  310. data1: Pointer;
  311. end;
  312. TAndroidIO = record
  313. fileNameRef: Pointer;
  314. inputStreamRef: Pointer;
  315. readableByteChannelRef: Pointer;
  316. readMethod: Pointer;
  317. assetFileDescriptorRef: Pointer;
  318. position: LongInt;
  319. size: LongInt;
  320. offset: LongInt;
  321. fd: SInt32;
  322. end;
  323. TWindowsIOBuffer = record
  324. data: Pointer;
  325. size: size_t;
  326. left: size_t;
  327. end;
  328. TWindowsIO = record
  329. append: TSDL_Bool;
  330. h: Pointer;
  331. buffer: TWindowsIOBuffer;
  332. end;
  333. TSDL_RWops = packed record
  334. size: TSize;
  335. seek: TSeek;
  336. read: TRead;
  337. write: TWrite;
  338. close: TClose;
  339. _type: UInt32;
  340. case Integer of
  341. 0: (stdio: TStdio);
  342. 1: (mem: TMem);
  343. 2: (unknown: TUnknown);
  344. {$IFDEF ANDROID}
  345. 3: (androidio: TAndroidIO);
  346. {$ENDIF}
  347. {$IFDEF MSWINDOWS}
  348. 3: (windowsio: TWindowsIO);
  349. {$ENDIF}
  350. end;
  351. {**
  352. * RWFrom functions
  353. *
  354. * Functions to create SDL_RWops structures from various data streams.
  355. *}
  356. function SDL_RWFromFile(const _file: PChar; const mode: PChar): PSDL_RWops;
  357. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RWFromFile' {$ENDIF} {$ENDIF};
  358. function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops;
  359. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RWFromFP' {$ENDIF} {$ENDIF};
  360. function SDL_RWFromMem(mem: Pointer; size: SInt32): PSDL_RWops;
  361. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RWFromMem' {$ENDIF} {$ENDIF};
  362. function SDL_RWFromConstMem(const mem: Pointer; size: SInt32): PSDL_RWops;
  363. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RWFromConstMem' {$ENDIF} {$ENDIF};
  364. {*RWFrom functions*}
  365. function SDL_AllocRW(): PSDL_RWops;
  366. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AllocRW' {$ENDIF} {$ENDIF};
  367. procedure SDL_FreeRW(area: PSDL_RWops);
  368. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FreeRW' {$ENDIF} {$ENDIF};
  369. const
  370. RW_SEEK_SET = 0; {**< Seek from the beginning of data *}
  371. RW_SEEK_CUR = 1; {**< Seek relative to current read point *}
  372. RW_SEEK_END = 2; {**< Seek relative to the end of data *}
  373. {**
  374. * Read/write macros
  375. *
  376. * Macros to easily read and write from an SDL_RWops structure.
  377. *}
  378. function SDL_RWsize(ctx: PSDL_RWops): SInt64;
  379. function SDL_RWseek(ctx: PSDL_RWops; offset: SInt64; whence: SInt32): SInt64;
  380. function SDL_RWtell(ctx: PSDL_RWops): SInt64;
  381. function SDL_RWread(ctx: PSDL_RWops; ptr: Pointer; size: size_t; n: size_t): size_t;
  382. function SDL_RWwrite(ctx: PSDL_RWops; ptr: Pointer; size: size_t; n: size_t): size_t;
  383. function SDL_RWclose(ctx: PSDL_RWops): SInt32;
  384. { Read/write macros }
  385. {**
  386. * Read endian functions
  387. *
  388. * Read an item of the specified endianness and return in native format.
  389. *}
  390. function SDL_ReadU8(src: PSDL_RWops): UInt8;
  391. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ReadU8' {$ENDIF} {$ENDIF};
  392. function SDL_ReadLE16(src: PSDL_RWops): UInt16;
  393. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ReadLE16' {$ENDIF} {$ENDIF};
  394. function SDL_ReadBE16(src: PSDL_RWops): UInt16;
  395. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ReadBE16' {$ENDIF} {$ENDIF};
  396. function SDL_ReadLE32(src: PSDL_RWops): UInt32;
  397. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ReadLE32' {$ENDIF} {$ENDIF};
  398. function SDL_ReadBE32(src: PSDL_RWops): UInt32;
  399. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ReadBE32' {$ENDIF} {$ENDIF};
  400. function SDL_ReadLE64(src: PSDL_RWops): UInt64;
  401. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ReadLE64' {$ENDIF} {$ENDIF};
  402. function SDL_ReadBE64(src: PSDL_RWops): UInt64;
  403. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ReadBE64' {$ENDIF} {$ENDIF};
  404. {*Read endian functions*}
  405. {**
  406. * Write endian functions
  407. *
  408. * Write an item of native format to the specified endianness.
  409. *}
  410. function SDL_WriteU8(dst: PSDL_RWops; value: UInt8): size_t;
  411. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WriteU8' {$ENDIF} {$ENDIF};
  412. function SDL_WriteLE16(dst: PSDL_RWops; value: UInt16): size_t;
  413. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WriteLE16' {$ENDIF} {$ENDIF};
  414. function SDL_WriteBE16(dst: PSDL_RWops; value: UInt16): size_t;
  415. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WriteBE16' {$ENDIF} {$ENDIF};
  416. function SDL_WriteLE32(dst: PSDL_RWops; value: UInt32): size_t;
  417. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WriteLE32' {$ENDIF} {$ENDIF};
  418. function SDL_WriteBE32(dst: PSDL_RWops; value: UInt32): size_t;
  419. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WriteBE32' {$ENDIF} {$ENDIF};
  420. function SDL_WriteLE64(dst: PSDL_RWops; value: UInt64): size_t;
  421. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WriteLE64' {$ENDIF} {$ENDIF};
  422. function SDL_WriteBE64(dst: PSDL_RWops; value: UInt64): size_t;
  423. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WriteBE64' {$ENDIF} {$ENDIF};
  424. { Write endian functions }
  425. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  426. ////////////////////// SDL_audio.h ////////////////////////////////////////////////////
  427. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  428. {**
  429. * Audio format flags.
  430. *
  431. * These are what the 16 bits in SDL_AudioFormat currently mean...
  432. * (Unspecified bits are always zero).
  433. *
  434. *
  435. ++-----------------------sample is signed if set
  436. ||
  437. || ++-----------sample is bigendian if set
  438. || ||
  439. || || ++---sample is float if set
  440. || || ||
  441. || || || +---sample bit size---+
  442. || || || | |
  443. 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
  444. *
  445. * There are macros in SDL 2.0 and later to query these bits.
  446. *}
  447. type
  448. TSDL_AudioFormat = UInt16;
  449. {**
  450. * Audio flags
  451. *}
  452. const
  453. SDL_AUDIO_MASK_BITSIZE = ($FF);
  454. SDL_AUDIO_MASK_DATATYPE = (1 shl 8);
  455. SDL_AUDIO_MASK_ENDIAN = (1 shl 12);
  456. SDL_AUDIO_MASK_SIGNED = (1 shl 15);
  457. function SDL_AUDIO_BITSIZE(x: Cardinal): Cardinal;
  458. function SDL_AUDIO_ISFLOAT(x: Cardinal): Cardinal;
  459. function SDL_AUDIO_ISBIGENDIAN(x: Cardinal): Cardinal;
  460. function SDL_AUDIO_ISSIGNED(x: Cardinal): Cardinal;
  461. function SDL_AUDIO_ISINT(x: Cardinal): Cardinal;
  462. function SDL_AUDIO_ISLITTLEENDIAN(x: Cardinal): Cardinal;
  463. function SDL_AUDIO_ISUNSIGNED(x: Cardinal): Cardinal;
  464. {**
  465. * Audio format flags
  466. *
  467. * Defaults to LSB byte order.
  468. *}
  469. const
  470. AUDIO_U8 = $0008; {**< Unsigned 8-bit samples *}
  471. AUDIO_S8 = $8008; {**< Signed 8-bit samples *}
  472. AUDIO_U16LSB = $0010; {**< Unsigned 16-bit samples *}
  473. AUDIO_S16LSB = $8010; {**< Signed 16-bit samples *}
  474. AUDIO_U16MSB = $1010; {**< As above, but big-endian byte order *}
  475. AUDIO_S16MSB = $9010; {**< As above, but big-endian byte order *}
  476. AUDIO_U16 = AUDIO_U16LSB;
  477. AUDIO_S16 = AUDIO_S16LSB;
  478. {**
  479. * int32 support
  480. *}
  481. const
  482. AUDIO_S32LSB = $8020; {**< 32-bit integer samples *}
  483. AUDIO_S32MSB = $9020; {**< As above, but big-endian byte order *}
  484. AUDIO_S32 = AUDIO_S32LSB;
  485. {**
  486. * float32 support
  487. *}
  488. const
  489. AUDIO_F32LSB = $8120; {**< 32-bit floating point samples *}
  490. AUDIO_F32MSB = $9120; {**< As above, but big-endian byte order *}
  491. AUDIO_F32 = AUDIO_F32LSB;
  492. {**
  493. * Native audio byte ordering
  494. *}
  495. {
  496. #if SDL_BYTEORDER == SDL_LIL_ENDIAN
  497. #define AUDIO_U16SYS AUDIO_U16LSB
  498. #define AUDIO_S16SYS AUDIO_S16LSB
  499. #define AUDIO_S32SYS AUDIO_S32LSB
  500. #define AUDIO_F32SYS AUDIO_F32LSB
  501. #else
  502. #define AUDIO_U16SYS AUDIO_U16MSB
  503. #define AUDIO_S16SYS AUDIO_S16MSB
  504. #define AUDIO_S32SYS AUDIO_S32MSB
  505. #define AUDIO_F32SYS AUDIO_F32MSB
  506. #endif}
  507. {**
  508. * Allow change flags
  509. *
  510. * Which audio format changes are allowed when opening a device.
  511. *}
  512. const
  513. SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = $00000001;
  514. SDL_AUDIO_ALLOW_FORMAT_CHANGE = $00000002;
  515. SDL_AUDIO_ALLOW_CHANNELS_CHANGE = $00000004;
  516. SDL_AUDIO_ALLOW_ANY_CHANGE = (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE or
  517. SDL_AUDIO_ALLOW_FORMAT_CHANGE or
  518. SDL_AUDIO_ALLOW_CHANNELS_CHANGE);
  519. {*Audio flags*}
  520. {**
  521. * This function is called when the audio device needs more data.
  522. *
  523. * userdata An application-specific parameter saved in
  524. * the SDL_AudioSpec structure
  525. * stream A pointer to the audio data buffer.
  526. * len The length of that buffer in bytes.
  527. *
  528. * Once the callback returns, the buffer will no longer be valid.
  529. * Stereo samples are stored in a LRLRLR ordering.
  530. *}
  531. type
  532. TSDL_AudioCallback = procedure(userdata: Pointer; stream: PUInt8; len: Integer);
  533. {**
  534. * The calculated values in this structure are calculated by SDL_OpenAudio().
  535. *}
  536. type
  537. PSDL_AudioSpec = ^TSDL_AudioSpec;
  538. TSDL_AudioSpec = record
  539. freq: Integer; {**< DSP frequency -- samples per second *}
  540. format: TSDL_AudioFormat; {**< Audio data format *}
  541. channels: UInt8; {**< Number of channels: 1 mono, 2 stereo *}
  542. silence: UInt8; {**< Audio buffer silence value (calculated) *}
  543. samples: UInt16; {**< Audio buffer size in samples (power of 2) *}
  544. padding: UInt16; {**< Necessary for some compile environments *}
  545. size: UInt32; {**< Audio buffer size in bytes (calculated) *}
  546. callback: TSDL_AudioCallback;
  547. userdata: Pointer;
  548. end;
  549. PSDL_AudioCVT = ^TSDL_AudioCVT;
  550. TSDL_AudioFilter = procedure(cvt: PSDL_AudioCVT; format: TSDL_AudioFormat);
  551. {**
  552. * A structure to hold a set of audio conversion filters and buffers.
  553. *}
  554. TSDL_AudioCVT = record
  555. needed: Integer; {**< Set to 1 if conversion possible *}
  556. src_format: TSDL_AudioFormat; {**< Source audio format *}
  557. dst_format: TSDL_AudioFormat; {**< Target audio format *}
  558. rate_incr: Double; {**< Rate conversion increment *}
  559. buf: PUInt8; {**< Buffer to hold entire audio data *}
  560. len: Integer; {**< Length of original audio buffer *}
  561. len_cvt: Integer; {**< Length of converted audio buffer *}
  562. len_mult: Integer; {**< buffer must be len*len_mult big *}
  563. len_ratio: Double; {**< Given len, final size is len*len_ratio *}
  564. filters: array[0..9] of TSDL_AudioFilter; {**< Filter list *}
  565. filter_index: Integer; {**< Current audio conversion function *}
  566. end;
  567. {* Function prototypes *}
  568. {**
  569. * Driver discovery functions
  570. *
  571. * These functions return the list of built in audio drivers, in the
  572. * order that they are normally initialized by default.
  573. *}
  574. function SDL_GetNumAudioDrivers(): Integer;
  575. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetNumAudioDrivers' {$ENDIF} {$ENDIF};
  576. function SDL_GetAudioDriver(index: Integer): PChar;
  577. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetAudioDriver' {$ENDIF} {$ENDIF};
  578. {**
  579. * Initialization and cleanup
  580. *
  581. * These functions are used internally, and should not be used unless
  582. * you have a specific need to specify the audio driver you want to
  583. * use. You should normally use SDL_Init() or SDL_InitSubSystem().
  584. *}
  585. function SDL_AudioInit(driver_name: PChar): Integer;
  586. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AudioInit' {$ENDIF} {$ENDIF};
  587. procedure SDL_AudioQuit();
  588. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AudioQuit' {$ENDIF} {$ENDIF};
  589. {**
  590. * This function returns the name of the current audio driver, or NULL
  591. * if no driver has been initialized.
  592. *}
  593. function SDL_GetCurrentAudioDriver(): PChar;
  594. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetCurrentAudioDriver' {$ENDIF} {$ENDIF};
  595. {**
  596. * This function opens the audio device with the desired parameters, and
  597. * returns 0 if successful, placing the actual hardware parameters in the
  598. * structure pointed to by obtained. If obtained is NULL, the audio
  599. * data passed to the callback function will be guaranteed to be in the
  600. * requested format, and will be automatically converted to the hardware
  601. * audio format if necessary. This function returns -1 if it failed
  602. * to open the audio device, or couldn't set up the audio thread.
  603. *
  604. * When filling in the desired audio spec structure,
  605. * - desired->freq should be the desired audio frequency in samples-per-
  606. * second.
  607. * - desired->format should be the desired audio format.
  608. * - desired->samples is the desired size of the audio buffer, in
  609. * samples. This number should be a power of two, and may be adjusted by
  610. * the audio driver to a value more suitable for the hardware. Good values
  611. * seem to range between 512 and 8096 inclusive, depending on the
  612. * application and CPU speed. Smaller values yield faster response time,
  613. * but can lead to underflow if the application is doing heavy processing
  614. * and cannot fill the audio buffer in time. A stereo sample consists of
  615. * both right and left channels in LR ordering.
  616. * Note that the number of samples is directly related to time by the
  617. * following formula: ms := (samples*1000)/freq;
  618. * - desired->size is the size in bytes of the audio buffer, and is
  619. * calculated by SDL_OpenAudio().
  620. * - desired->silence is the value used to set the buffer to silence,
  621. * and is calculated by SDL_OpenAudio().
  622. * - desired->callback should be set to a function that will be called
  623. * when the audio device is ready for more data. It is passed a pointer
  624. * to the audio buffer, and the length in bytes of the audio buffer.
  625. * This function usually runs in a separate thread, and so you should
  626. * protect data structures that it accesses by calling SDL_LockAudio()
  627. * and SDL_UnlockAudio() in your code.
  628. * - desired->userdata is passed as the first parameter to your callback
  629. * function.
  630. *
  631. * The audio device starts out playing silence when it's opened, and should
  632. * be enabled for playing by calling SDL_PauseAudio(0) when you are ready
  633. * for your audio callback function to be called. Since the audio driver
  634. * may modify the requested size of the audio buffer, you should allocate
  635. * any local mixing buffers after you open the audio device.
  636. *}
  637. function SDL_OpenAudio(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): Integer;
  638. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_OpenAudio' {$ENDIF} {$ENDIF};
  639. {**
  640. * SDL Audio Device IDs.
  641. *
  642. * A successful call to SDL_OpenAudio() is always device id 1, and legacy
  643. * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
  644. * always returns devices >= 2 on success. The legacy calls are good both
  645. * for backwards compatibility and when you don't care about multiple,
  646. * specific, or capture devices.
  647. *}
  648. type
  649. TSDL_AudioDeviceID = UInt32;
  650. {**
  651. * Get the number of available devices exposed by the current driver.
  652. * Only valid after a successfully initializing the audio subsystem.
  653. * Returns -1 if an explicit list of devices can't be determined; this is
  654. * not an error. For example, if SDL is set up to talk to a remote audio
  655. * server, it can't list every one available on the Internet, but it will
  656. * still allow a specific host to be specified to SDL_OpenAudioDevice().
  657. *
  658. * In many common cases, when this function returns a value <= 0, it can still
  659. * successfully open the default device (NULL for first argument of
  660. * SDL_OpenAudioDevice()).
  661. *}
  662. function SDL_GetNumAudioDevices(iscapture: Integer): Integer;
  663. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetNumAudioDevices' {$ENDIF} {$ENDIF};
  664. {**
  665. * Get the human-readable name of a specific audio device.
  666. * Must be a value between 0 and (number of audio devices-1).
  667. * Only valid after a successfully initializing the audio subsystem.
  668. * The values returned by this function reflect the latest call to
  669. * SDL_GetNumAudioDevices(); recall that function to redetect available
  670. * hardware.
  671. *
  672. * The string returned by this function is UTF-8 encoded, read-only, and
  673. * managed internally. You are not to free it. If you need to keep the
  674. * string for any length of time, you should make your own copy of it, as it
  675. * will be invalid next time any of several other SDL functions is called.
  676. *}
  677. function SDL_GetAudioDeviceName(index: Integer; iscapture: Integer): PChar;
  678. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetAudioDeviceName' {$ENDIF} {$ENDIF};
  679. {**
  680. * Open a specific audio device. Passing in a device name of NULL requests
  681. * the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
  682. *
  683. * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
  684. * some drivers allow arbitrary and driver-specific strings, such as a
  685. * hostname/IP address for a remote audio server, or a filename in the
  686. * diskaudio driver.
  687. *
  688. * 0 on error, a valid device ID that is >= 2 on success.
  689. *
  690. * SDL_OpenAudio(), unlike this function, always acts on device ID 1.
  691. *}
  692. function SDL_OpenAudioDevice(device: PChar; iscapture: Integer; desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec; allowed_changes: Integer): TSDL_AudioDeviceID;
  693. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_OpenAudioDevice' {$ENDIF} {$ENDIF};
  694. {**
  695. * Audio state
  696. *
  697. * Get the current audio state.
  698. *}
  699. type
  700. TSDL_AudioStatus = (SDL_AUDIO_STOPPED,SDL_AUDIO_PLAYING,SDL_AUDIO_PAUSED);
  701. function SDL_GetAudioStatus(): TSDL_AudioStatus;
  702. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetAudioStatus' {$ENDIF} {$ENDIF};
  703. function SDL_GetAudioDeviceStatus(dev: TSDL_AudioDeviceID): TSDL_AudioStatus;
  704. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetAudioDeviceStatus' {$ENDIF} {$ENDIF};
  705. {*Audio State*}
  706. {**
  707. * Pause audio functions
  708. *
  709. * These functions pause and unpause the audio callback processing.
  710. * They should be called with a parameter of 0 after opening the audio
  711. * device to start playing sound. This is so you can safely initialize
  712. * data for your callback function after opening the audio device.
  713. * Silence will be written to the audio device during the pause.
  714. *}
  715. procedure SDL_PauseAudio(pause_on: Integer);
  716. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_PauseAudio' {$ENDIF} {$ENDIF};
  717. procedure SDL_PauseAudioDevice(dev: TSDL_AudioDeviceID; pause_on: Integer);
  718. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_PauseAudioDevice' {$ENDIF} {$ENDIF};
  719. {*Pause audio functions*}
  720. {**
  721. * This function loads a WAVE from the data source, automatically freeing
  722. * that source if freesrc is non-zero. For example, to load a WAVE file,
  723. * you could do:
  724. *
  725. * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
  726. *
  727. *
  728. * If this function succeeds, it returns the given SDL_AudioSpec,
  729. * filled with the audio data format of the wave data, and sets
  730. * *audio_buf to a malloc()'d buffer containing the audio data,
  731. * and sets *audio_len to the length of that audio buffer, in bytes.
  732. * You need to free the audio buffer with SDL_FreeWAV() when you are
  733. * done with it.
  734. *
  735. * This function returns NULL and sets the SDL error message if the
  736. * wave file cannot be opened, uses an unknown data format, or is
  737. * corrupt. Currently raw and MS-ADPCM WAVE files are supported.
  738. *}
  739. function SDL_LoadWAV_RW(src: PSDL_RWops; freesrc: Integer; spec: PSDL_AudioSpec; audio_buf: PPUInt8; audio_len: PUInt32): PSDL_AudioSpec;
  740. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LoadWAV_RW' {$ENDIF} {$ENDIF};
  741. {**
  742. * Loads a WAV from a file.
  743. * Compatibility convenience function.
  744. *}
  745. function SDL_LoadWAV(_file: PChar; spec: PSDL_AudioSpec; audio_buf: PPUInt8; audio_len: PUInt32): PSDL_AudioSpec;
  746. {**
  747. * This function frees data previously allocated with SDL_LoadWAV_RW()
  748. *}
  749. procedure SDL_FreeWAV(audio_buf: PUInt8);
  750. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FreeWAV' {$ENDIF} {$ENDIF};
  751. {**
  752. * This function takes a source format and rate and a destination format
  753. * and rate, and initializes the cvt structure with information needed
  754. * by SDL_ConvertAudio() to convert a buffer of audio data from one format
  755. * to the other.
  756. *
  757. * -1 if the format conversion is not supported, 0 if there's
  758. * no conversion needed, or 1 if the audio filter is set up.
  759. *}
  760. function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; src_format: TSDL_AudioFormat; src_channels: UInt8; src_rate: Integer; dst_format: TSDL_AudioFormat; dst_channels: UInt8; dst_rate: Integer): Integer;
  761. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_BuildAudioCVT' {$ENDIF} {$ENDIF};
  762. {**
  763. * Once you have initialized the cvt structure using SDL_BuildAudioCVT(),
  764. * created an audio buffer cvt->buf, and filled it with cvt->len bytes of
  765. * audio data in the source format, this function will convert it in-place
  766. * to the desired format.
  767. *
  768. * The data conversion may expand the size of the audio data, so the buffer
  769. * cvt->buf should be allocated after the cvt structure is initialized by
  770. * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
  771. *}
  772. function SDL_ConvertAudio(cvt: PSDL_AudioCVT): Integer;
  773. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ConvertAudio' {$ENDIF} {$ENDIF};
  774. const
  775. SDL_MIX_MAXVOLUME = 128;
  776. {**
  777. * This takes two audio buffers of the playing audio format and mixes
  778. * them, performing addition, volume adjustment, and overflow clipping.
  779. * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME
  780. * for full audio volume. Note this does not change hardware volume.
  781. * This is provided for convenience -- you can mix your own audio data.
  782. *}
  783. procedure SDL_MixAudio(dst: PUInt8; src: PUInt8; len: UInt32; volume: Integer);
  784. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_MixAudio' {$ENDIF} {$ENDIF};
  785. {**
  786. * This works like SDL_MixAudio(), but you specify the audio format instead of
  787. * using the format of audio device 1. Thus it can be used when no audio
  788. * device is open at all.
  789. *}
  790. procedure SDL_MixAudioFormat(dst: PUInt8; src: PUInt8; format: TSDL_AudioFormat; len: UInt32; volume: Integer);
  791. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_MixAudioFormat' {$ENDIF} {$ENDIF};
  792. {**
  793. * Audio lock functions
  794. *
  795. * The lock manipulated by these functions protects the callback function.
  796. * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
  797. * the callback function is not running. Do not call these from the callback
  798. * function or you will cause deadlock.
  799. *}
  800. procedure SDL_LockAudio();
  801. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LockAudio' {$ENDIF} {$ENDIF};
  802. procedure SDL_LockAudioDevice(dev: TSDL_AudioDeviceID);
  803. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LockAudioDevice' {$ENDIF} {$ENDIF};
  804. procedure SDL_UnlockAudio();
  805. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_Unlock' {$ENDIF} {$ENDIF};
  806. procedure SDL_UnlockAudioDevice(dev: TSDL_AudioDeviceID);
  807. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UnlockAudioDevice' {$ENDIF} {$ENDIF};
  808. {*Audio lock functions*}
  809. {**
  810. * This function shuts down audio processing and closes the audio device.
  811. *}
  812. procedure SDL_CloseAudio();
  813. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CloseAudio' {$ENDIF} {$ENDIF};
  814. procedure SDL_CloseAudioDevice(dev: TSDL_AudioDeviceID);
  815. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CloseAudioDevice' {$ENDIF} {$ENDIF};
  816. {**
  817. * 1 if audio device is still functioning, zero if not, -1 on error.
  818. *}
  819. function SDL_AudioDeviceConnected(dev: TSDL_AudioDeviceID): Integer;
  820. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AudioDeviceConnected' {$ENDIF} {$ENDIF};
  821. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  822. ////////////////////// SDL_power.h ////////////////////////////////////////////////////
  823. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  824. {**
  825. * The basic state for the system's power supply.
  826. *}
  827. type
  828. TSDL_PowerState = (SDL_POWERSTATE_UNKNOWN, {**< cannot determine power status *}
  829. SDL_POWERSTATE_ON_BATTERY, {**< Not plugged in, running on the battery *}
  830. SDL_POWERSTATE_NO_BATTERY, {**< Plugged in, no battery available *}
  831. SDL_POWERSTATE_CHARGING, {**< Plugged in, charging battery *}
  832. SDL_POWERSTATE_CHARGED); {**< Plugged in, battery charged *}
  833. {**
  834. * Get the current power supply details.
  835. *
  836. * secs Seconds of battery life left. You can pass a NULL here if
  837. * you don't care. Will return -1 if we can't determine a
  838. * value, or we're not running on a battery.
  839. *
  840. * pct Percentage of battery life left, between 0 and 100. You can
  841. * pass a NULL here if you don't care. Will return -1 if we
  842. * can't determine a value, or we're not running on a battery.
  843. *
  844. * The state of the battery (if any).
  845. *}
  846. function SDL_GetPowerInfo(secs: PInt; pct: PInt): TSDL_PowerState;
  847. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetPowerInfo' {$ENDIF} {$ENDIF};
  848. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  849. ////////////////////// SDL_thread .h ////////////////////////////////////////////////////
  850. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  851. {* The SDL thread structure, defined in SDL_thread.c *}
  852. //todo!
  853. type
  854. {* The SDL thread priority
  855. *
  856. * Note: On many systems you require special privileges to set high priority.
  857. *}
  858. TSDL_ThreadPriority = (SDL_THREAD_PRIORITY_LOW,
  859. SDL_THREAD_PRIORITY_NORMAL,
  860. SDL_THREAD_PRIORITY_HIGH);
  861. {* The function passed to SDL_CreateThread()
  862. It is passed a void* user context parameter and returns an int.
  863. *}
  864. PSDL_ThreadFunction = ^TSDL_ThreadFunction;
  865. TSDL_ThreadFunction = function(data: Pointer): Integer; cdecl;
  866. {* The SDL thread ID *}
  867. TSDL_ThreadID = LongWord;
  868. {
  869. PSDL_Thread = Pointer;
  870. }
  871. PSDL_Thread = ^TSDL_Thread;
  872. TSDL_Thread = record
  873. threadid: TSDL_ThreadID;
  874. handle: THandle;
  875. status: SInt32;
  876. errbuf: TSDL_Error;
  877. name: PChar;
  878. data: Pointer;
  879. end;
  880. TSDL_TLSID = Cardinal;
  881. {$IFDEF MSWINDOWS}
  882. {**
  883. * SDL_thread.h
  884. *
  885. * We compile SDL into a DLL. This means, that it's the DLL which
  886. * creates a new thread for the calling process with the SDL_CreateThread()
  887. * API. There is a problem with this, that only the RTL of the SDL.DLL will
  888. * be initialized for those threads, and not the RTL of the calling
  889. * application!
  890. *
  891. * To solve this, we make a little hack here.
  892. *
  893. * We'll always use the caller's _beginthread() and _endthread() APIs to
  894. * start a new thread. This way, if it's the SDL.DLL which uses this API,
  895. * then the RTL of SDL.DLL will be used to create the new thread, and if it's
  896. * the application, then the RTL of the application will be used.
  897. *
  898. * So, in short:
  899. * Always use the _beginthread() and _endthread() of the calling runtime
  900. * library!
  901. *}
  902. {$DEFINE SDL_PASSED_BEGINTHREAD_ENDTHREAD}
  903. type
  904. TThreadID = Cardinal;
  905. TpfnSDL_CurrentBeginThread = function(SecurityAttributes: Pointer; StackSize: LongWord; ThreadFunc: TThreadFunc; Parameter: Pointer; CreationFlags: LongWord; var ThreadId: TThreadID): Integer;
  906. TpfnSDL_CurrentEndThread = procedure(ExitCode: Integer);
  907. {**
  908. * Create a thread.
  909. *}
  910. function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PChar; data: Pointer; pfnBeginThread: TpfnSDL_CurrentBeginThread; pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread;
  911. cdecl; overload; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateThread' {$ENDIF} {$ENDIF};
  912. {**
  913. * Create a thread.
  914. *}
  915. function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PChar; data: Pointer): PSDL_Thread; overload;
  916. {$ELSE}
  917. {**
  918. * Create a thread.
  919. *
  920. * Thread naming is a little complicated: Most systems have very small
  921. * limits for the string length (BeOS has 32 bytes, Linux currently has 16,
  922. * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll
  923. * have to see what happens with your system's debugger. The name should be
  924. * UTF-8 (but using the naming limits of C identifiers is a better bet).
  925. * There are no requirements for thread naming conventions, so long as the
  926. * string is null-terminated UTF-8, but these guidelines are helpful in
  927. * choosing a name:
  928. *
  929. * http://stackoverflow.com/questions/149932/naming-conventions-for-threads
  930. *
  931. * If a system imposes requirements, SDL will try to munge the string for
  932. * it (truncate, etc), but the original string contents will be available
  933. * from SDL_GetThreadName().
  934. *}
  935. function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PChar; data: Pointer): PSDL_Thread;
  936. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateThread' {$ENDIF} {$ENDIF};
  937. {$ENDIF}
  938. {**
  939. * Get the thread name, as it was specified in SDL_CreateThread().
  940. * This function returns a pointer to a UTF-8 string that names the
  941. * specified thread, or NULL if it doesn't have a name. This is internal
  942. * memory, not to be free()'d by the caller, and remains valid until the
  943. * specified thread is cleaned up by SDL_WaitThread().
  944. *}
  945. function SDL_GetThreadName(thread: PSDL_Thread): PChar;
  946. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetThreadName' {$ENDIF} {$ENDIF};
  947. {**
  948. * Get the thread identifier for the current thread.
  949. *}
  950. function SDL_ThreadID(): TSDL_ThreadID;
  951. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ThreadID' {$ENDIF} {$ENDIF};
  952. {**
  953. * Get the thread identifier for the specified thread.
  954. *
  955. * Equivalent to SDL_ThreadID() if the specified thread is NULL.
  956. *}
  957. function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID;
  958. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetThreadID' {$ENDIF} {$ENDIF};
  959. {**
  960. * Set the priority for the current thread
  961. *}
  962. function SDL_SetThreadPriority(priority: TSDL_ThreadPriority): SInt32;
  963. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetThreadPriority' {$ENDIF} {$ENDIF};
  964. {**
  965. * Wait for a thread to finish.
  966. *
  967. * The return code for the thread function is placed in the area
  968. * pointed to by status, if status is not NULL.
  969. *}
  970. procedure SDL_WaitThread(thread: PSDL_Thread; status: PInt);
  971. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WaitThread' {$ENDIF} {$ENDIF};
  972. {**
  973. * Create an identifier that is globally visible to all threads but refers to data that is thread-specific.
  974. *
  975. * The newly created thread local storage identifier, or 0 on error
  976. *
  977. * static SDL_SpinLock tls_lock;
  978. * static SDL_TLSID thread_local_storage;
  979. *
  980. * void SetMyThreadData(void *value)
  981. * {
  982. * if (!thread_local_storage) {
  983. * SDL_AtomicLock(&tls_lock);
  984. * if (!thread_local_storage) {
  985. * thread_local_storage = SDL_TLSCreate();
  986. * } {
  987. * SDL_AtomicUnLock(&tls_lock);
  988. * } {
  989. * SDL_TLSSet(thread_local_storage, value);
  990. * } {
  991. *
  992. * void *GetMyThreadData(void)
  993. * {
  994. * return SDL_TLSGet(thread_local_storage);
  995. * }{
  996. *
  997. * SDL_TLSGet()
  998. * SDL_TLSSet()
  999. *}
  1000. function SDL_TLSCreate(): TSDL_TLSID;
  1001. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_TLSCreate' {$ENDIF} {$ENDIF};
  1002. {**
  1003. * Get the value associated with a thread local storage ID for the current thread.
  1004. *
  1005. * id The thread local storage ID
  1006. *
  1007. * The value associated with the ID for the current thread, or NULL if no value has been set.
  1008. *
  1009. * SDL_TLSCreate()
  1010. * SDL_TLSSet()
  1011. *}
  1012. function SDL_TLSGet(id: TSDL_TLSID): Pointer;
  1013. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_TLSGet' {$ENDIF} {$ENDIF};
  1014. {**
  1015. * Set the value associated with a thread local storage ID for the current thread.
  1016. *
  1017. * id The thread local storage ID
  1018. * value The value to associate with the ID for the current thread
  1019. * destructor_ A function called when the thread exits, to free the value.
  1020. *
  1021. * 0 on success, -1 on error
  1022. *
  1023. * SDL_TLSCreate()
  1024. * SDL_TLSGet()
  1025. *}
  1026. function SDL_TLSSet(id: TSDL_TLSID; value: Pointer; destructor_: Pointer): SInt32;
  1027. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_TLSSet' {$ENDIF} {$ENDIF};
  1028. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1029. ////////////////////// SDL_mutex.h ////////////////////////////////////////////////////
  1030. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1031. {**
  1032. * Synchronization functions which can time out return this value
  1033. * if they time out.
  1034. *}
  1035. const
  1036. SDL_MUTEX_TIMEDOUT = 1;
  1037. {**
  1038. * This is the timeout value which corresponds to never time out.
  1039. *}
  1040. //SDL_MUTEX_MAXWAIT (~(Uint32)0)
  1041. {**
  1042. * Mutex functions
  1043. *}
  1044. type
  1045. {* The SDL mutex structure, defined in SDL_mutex.c *}
  1046. // PSDL_Mutex = Pointer; //todo!
  1047. PSDL_Mutex = ^TSDL_Mutex; //***KTI***
  1048. TSDL_Mutex = record
  1049. id: THANDLE;
  1050. end;
  1051. {**
  1052. * Create a mutex, initialized unlocked.
  1053. *}
  1054. function SDL_CreateMutex(): PSDL_Mutex;
  1055. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateMutex' {$ENDIF} {$ENDIF};
  1056. {**
  1057. * Lock the mutex.
  1058. *
  1059. * 0, or -1 on error.
  1060. *}
  1061. //#define SDL_mutexP(m) SDL_LockMutex(m)
  1062. function SDL_LockMutex(mutex: PSDL_Mutex): SInt32;
  1063. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LockMutex' {$ENDIF} {$ENDIF};
  1064. {**
  1065. * Try to lock the mutex
  1066. *
  1067. * 0, SDL_MUTEX_TIMEDOUT, or -1 on error
  1068. *}
  1069. function SDL_TryLockMutex(mutex: PSDL_Mutex): SInt32;
  1070. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_TryLockMutex' {$ENDIF} {$ENDIF};
  1071. {**
  1072. * Unlock the mutex.
  1073. *
  1074. * 0, or -1 on error.
  1075. *
  1076. * It is an error to unlock a mutex that has not been locked by
  1077. * the current thread, and doing so results in undefined behavior.
  1078. *}
  1079. //#define SDL_mutexV(m) SDL_UnlockMutex(m)
  1080. function SDL_UnlockMutex(mutex: PSDL_Mutex): SInt32;
  1081. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UnlockMutex' {$ENDIF} {$ENDIF};
  1082. {**
  1083. * Destroy a mutex.
  1084. *}
  1085. procedure SDL_DestroyMutex(mutex: PSDL_Mutex);
  1086. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DestroyMutex' {$ENDIF} {$ENDIF};
  1087. {*Mutex functions*}
  1088. {**
  1089. * Semaphore functions
  1090. *}
  1091. type
  1092. {* The SDL semaphore structure, defined in SDL_sem.c *}
  1093. PSDL_Sem = Pointer; //todo!
  1094. {**
  1095. * Create a semaphore, initialized with value, returns NULL on failure.
  1096. *}
  1097. function SDL_CreateSemaphore(initial_value: UInt32): PSDL_sem;
  1098. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateSemaphore' {$ENDIF} {$ENDIF};
  1099. {**
  1100. * Destroy a semaphore.
  1101. *}
  1102. procedure SDL_DestroySemaphore(sem: PSDL_Sem);
  1103. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DestroySemaphore' {$ENDIF} {$ENDIF};
  1104. {**
  1105. * This function suspends the calling thread until the semaphore pointed
  1106. * to by sem has a positive count. It then atomically decreases the
  1107. * semaphore count.
  1108. *}
  1109. function SDL_SemWait(sem: PSDL_Sem): SInt32;
  1110. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SemWait' {$ENDIF} {$ENDIF};
  1111. {**
  1112. * Non-blocking variant of SDL_SemWait().
  1113. *
  1114. * 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would
  1115. * block, and -1 on error.
  1116. *}
  1117. function SDL_SemTryWait(sem: PSDL_Sem): SInt32;
  1118. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SemTryWait' {$ENDIF} {$ENDIF};
  1119. {**
  1120. * Variant of SDL_SemWait() with a timeout in milliseconds.
  1121. *
  1122. * 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
  1123. * succeed in the allotted time, and -1 on error.
  1124. *
  1125. * On some platforms this function is implemented by looping with a
  1126. * delay of 1 ms, and so should be avoided if possible.
  1127. *}
  1128. function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: UInt32): SInt32;
  1129. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SemWaitTimeout' {$ENDIF} {$ENDIF};
  1130. {**
  1131. * Atomically increases the semaphore's count (not blocking).
  1132. *
  1133. * 0, or -1 on error.
  1134. *}
  1135. function SDL_SemPost(sem: PSDL_Sem): SInt32;
  1136. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SemPost' {$ENDIF} {$ENDIF};
  1137. {**
  1138. * Returns the current count of the semaphore.
  1139. *}
  1140. function SDL_SemValue(sem: PSDL_Sem): UInt32;
  1141. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SemValue' {$ENDIF} {$ENDIF};
  1142. {*Semaphore functions*}
  1143. {**
  1144. * Condition variable functions
  1145. * }
  1146. type
  1147. {* The SDL condition variable structure, defined in SDL_cond.c *}
  1148. PSDL_Cond = Pointer; //todo!!
  1149. {**
  1150. * Create a condition variable.
  1151. *
  1152. * Typical use of condition variables:
  1153. *
  1154. * Thread A:
  1155. * SDL_LockMutex(lock);
  1156. * while ( not condition )
  1157. * begin
  1158. * SDL_CondWait(cond, lock);
  1159. * end;
  1160. * SDL_UnlockMutex(lock);
  1161. *
  1162. * Thread B:
  1163. * SDL_LockMutex(lock);
  1164. * ...
  1165. * condition := true;
  1166. * ...
  1167. * SDL_CondSignal(cond);
  1168. * SDL_UnlockMutex(lock);
  1169. *
  1170. * There is some discussion whether to signal the condition variable
  1171. * with the mutex locked or not. There is some potential performance
  1172. * benefit to unlocking first on some platforms, but there are some
  1173. * potential race conditions depending on how your code is structured.
  1174. *
  1175. * In general it's safer to signal the condition variable while the
  1176. * mutex is locked.
  1177. *}
  1178. function SDL_CreateCond(): PSDL_Cond;
  1179. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateCond' {$ENDIF} {$ENDIF};
  1180. {**
  1181. * Destroy a condition variable.
  1182. *}
  1183. procedure SDL_DestroyCond(cond: PSDL_Cond);
  1184. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DestroyCond' {$ENDIF} {$ENDIF};
  1185. {**
  1186. * Restart one of the threads that are waiting on the condition variable.
  1187. *
  1188. * 0 or -1 on error.
  1189. *}
  1190. function SDL_CondSignal(cond: PSDL_Cond): SInt32;
  1191. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CondSignal' {$ENDIF} {$ENDIF};
  1192. {**
  1193. * Restart all threads that are waiting on the condition variable.
  1194. *
  1195. * 0 or -1 on error.
  1196. *}
  1197. function SDL_CondBroadcast(cond: PSDL_Cond): SInt32;
  1198. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CondBroadcast' {$ENDIF} {$ENDIF};
  1199. {**
  1200. * Wait on the condition variable, unlocking the provided mutex.
  1201. *
  1202. * The mutex must be locked before entering this function!
  1203. *
  1204. * The mutex is re-locked once the condition variable is signaled.
  1205. *
  1206. * 0 when it is signaled, or -1 on error.
  1207. *}
  1208. function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): SInt32;
  1209. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CondWait' {$ENDIF} {$ENDIF};
  1210. {**
  1211. * Waits for at most ms milliseconds, and returns 0 if the condition
  1212. * variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
  1213. * signaled in the allotted time, and -1 on error.
  1214. *
  1215. * On some platforms this function is implemented by looping with a
  1216. * delay of 1 ms, and so should be avoided if possible.
  1217. *}
  1218. function SDL_CondWaitTimeout(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: UInt32): SInt32;
  1219. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CondWaitTimeout' {$ENDIF} {$ENDIF};
  1220. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1221. ////////////////////// SDL_timer.h ////////////////////////////////////////////////////
  1222. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1223. {**
  1224. * Get the number of milliseconds since the SDL library initialization.
  1225. *
  1226. * This value wraps if the program runs for more than ~49 days.
  1227. *}
  1228. function SDL_GetTicks(): UInt32;
  1229. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetTicks' {$ENDIF} {$ENDIF};
  1230. {**
  1231. * Get the current value of the high resolution counter
  1232. *}
  1233. function SDL_GetPerformanceCounter(): UInt64;
  1234. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetPerformanceCounter' {$ENDIF} {$ENDIF};
  1235. {**
  1236. * Get the count per second of the high resolution counter
  1237. *}
  1238. function SDL_GetPerformanceFrequency(): UInt64;
  1239. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetPerformanceFrequency' {$ENDIF} {$ENDIF};
  1240. {**
  1241. * Wait a specified number of milliseconds before returning.
  1242. *}
  1243. procedure SDL_Delay(ms: UInt32);
  1244. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_Delay' {$ENDIF} {$ENDIF};
  1245. {**
  1246. * Function prototype for the timer callback function.
  1247. *
  1248. * The callback function is passed the current timer interval and returns
  1249. * the next timer interval. If the returned value is the same as the one
  1250. * passed in, the periodic alarm continues, otherwise a new alarm is
  1251. * scheduled. If the callback returns 0, the periodic alarm is cancelled.
  1252. *}
  1253. type
  1254. TSDL_TimerCallback = function(interval: UInt32; param: Pointer): UInt32;
  1255. {**
  1256. * Definition of the timer ID type.
  1257. *}
  1258. TSDL_TimerID = SInt32;
  1259. {**
  1260. * Add a new timer to the pool of timers already running.
  1261. *
  1262. * A timer ID, or NULL when an error occurs.
  1263. *}
  1264. function SDL_AddTimer(interval: UInt32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID;
  1265. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AddTimer' {$ENDIF} {$ENDIF};
  1266. {**
  1267. * Remove a timer knowing its ID.
  1268. *
  1269. * A boolean value indicating success or failure.
  1270. *
  1271. * It is not safe to remove a timer multiple times.
  1272. *}
  1273. function SDL_RemoveTimer(id: TSDL_TimerID): Boolean;
  1274. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RemoveTimer' {$ENDIF} {$ENDIF};
  1275. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1276. ////////////////////// SDL_pixels.h ///////////////////////////////////////////////////
  1277. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1278. {**
  1279. * Transparency definitions
  1280. *
  1281. * These define alpha as the opacity of a surface.
  1282. *}
  1283. const
  1284. SDL_ALPHA_OPAQUE = 255;
  1285. SDL_ALPHA_TRANSPARENT = 0;
  1286. {** Pixel type. *}
  1287. SDL_PIXELTYPE_UNKNOWN = 0;
  1288. SDL_PIXELTYPE_INDEX1 = 1;
  1289. SDL_PIXELTYPE_INDEX4 = 2;
  1290. SDL_PIXELTYPE_INDEX8 = 3;
  1291. SDL_PIXELTYPE_PACKED8 = 4;
  1292. SDL_PIXELTYPE_PACKED16 = 5;
  1293. SDL_PIXELTYPE_PACKED32 = 6;
  1294. SDL_PIXELTYPE_ARRAYU8 = 7;
  1295. SDL_PIXELTYPE_ARRAYU16 = 8;
  1296. SDL_PIXELTYPE_ARRAYU32 = 9;
  1297. SDL_PIXELTYPE_ARRAYF16 = 10;
  1298. SDL_PIXELTYPE_ARRAYF32 = 11;
  1299. {** Bitmap pixel order, high bit -> low bit. *}
  1300. SDL_BITMAPORDER_NONE = 0;
  1301. SDL_BITMAPORDER_4321 = 1;
  1302. SDL_BITMAPORDER_1234 = 2;
  1303. {** Packed component order, high bit -> low bit. *}
  1304. SDL_PACKEDORDER_NONE = 0;
  1305. SDL_PACKEDORDER_XRGB = 1;
  1306. SDL_PACKEDORDER_RGBX = 2;
  1307. SDL_PACKEDORDER_ARGB = 3;
  1308. SDL_PACKEDORDER_RGBA = 4;
  1309. SDL_PACKEDORDER_XBGR = 5;
  1310. SDL_PACKEDORDER_BGRX = 6;
  1311. SDL_PACKEDORDER_ABGR = 7;
  1312. SDL_PACKEDORDER_BGRA = 8;
  1313. {** Array component order, low byte -> high byte. *}
  1314. SDL_ARRAYORDER_NONE = 0;
  1315. SDL_ARRAYORDER_RGB = 1;
  1316. SDL_ARRAYORDER_RGBA = 2;
  1317. SDL_ARRAYORDER_ARGB = 3;
  1318. SDL_ARRAYORDER_BGR = 4;
  1319. SDL_ARRAYORDER_BGRA = 5;
  1320. SDL_ARRAYORDER_ABGR = 6;
  1321. {** Packed component layout. *}
  1322. SDL_PACKEDLAYOUT_NONE = 0;
  1323. SDL_PACKEDLAYOUT_332 = 1;
  1324. SDL_PACKEDLAYOUT_4444 = 2;
  1325. SDL_PACKEDLAYOUT_1555 = 3;
  1326. SDL_PACKEDLAYOUT_5551 = 4;
  1327. SDL_PACKEDLAYOUT_565 = 5;
  1328. SDL_PACKEDLAYOUT_8888 = 6;
  1329. SDL_PACKEDLAYOUT_2101010 = 7;
  1330. SDL_PACKEDLAYOUT_1010102 = 8;
  1331. {
  1332. //todo!!
  1333. function SDL_DEFINE_PIXELFORMAT(type, order, layour, bit, bytes: UInt32): Result;
  1334. function SDL_DEFINE_PIXELFOURCC(A,B,C,D: Variant): Variant;
  1335. #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
  1336. ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
  1337. ((bits) << 8) | ((bytes) << 0))
  1338. }
  1339. function SDL_PIXELFLAG(X: Cardinal): Boolean;
  1340. function SDL_PIXELTYPE(X: Cardinal): Boolean;
  1341. function SDL_PIXELORDER(X: Cardinal): Boolean;
  1342. function SDL_PIXELLAYOUT(X: Cardinal): Boolean;
  1343. function SDL_BITSPERPIXEL(X: Cardinal): Boolean;
  1344. function SDL_BYTESPERPIXEL(X: Integer): Integer;
  1345. {
  1346. #define SDL_BYTESPERPIXEL(X) \
  1347. (SDL_ISPIXELFORMAT_FOURCC(X) ? \
  1348. ((((X) == SDL_PIXELFORMAT_YUY2) || \
  1349. ((X) == SDL_PIXELFORMAT_UYVY) || \
  1350. ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
  1351. #define SDL_ISPIXELFORMAT_INDEXED(format) \
  1352. (!SDL_ISPIXELFORMAT_FOURCC(format) && \
  1353. ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
  1354. (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
  1355. (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
  1356. #define SDL_ISPIXELFORMAT_ALPHA(format) \
  1357. (!SDL_ISPIXELFORMAT_FOURCC(format) && \
  1358. ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
  1359. (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
  1360. (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
  1361. (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
  1362. function SDL_IsPixelFormat_FOURCC(format: Variant);
  1363. {* Note: If you modify this list, update SDL_GetPixelFormatName() *}
  1364. const
  1365. SDL_PIXELFORMAT_UNKNOWN = 0;
  1366. SDL_PIXELFORMAT_INDEX1LSB = (1 shl 28) or
  1367. (SDL_PIXELTYPE_INDEX1 shl 24) or
  1368. (SDL_BITMAPORDER_4321 shl 20) or
  1369. (0 shl 16) or
  1370. (1 shl 8) or
  1371. (0 shl 0);
  1372. SDL_PIXELFORMAT_INDEX1MSB = (1 shl 28) or
  1373. (SDL_PIXELTYPE_INDEX1 shl 24) or
  1374. (SDL_BITMAPORDER_1234 shl 20) or
  1375. (0 shl 16) or
  1376. (1 shl 8) or
  1377. (0 shl 0);
  1378. SDL_PIXELFORMAT_INDEX4LSB = (1 shl 28) or
  1379. (SDL_PIXELTYPE_INDEX4 shl 24) or
  1380. (SDL_BITMAPORDER_4321 shl 20) or
  1381. (0 shl 16) or
  1382. (4 shl 8) or
  1383. (0 shl 0);
  1384. SDL_PIXELFORMAT_INDEX4MSB = (1 shl 28) or
  1385. (SDL_PIXELTYPE_INDEX4 shl 24) or
  1386. (SDL_BITMAPORDER_1234 shl 20) or
  1387. (0 shl 16) or
  1388. (4 shl 8) or
  1389. (0 shl 0);
  1390. SDL_PIXELFORMAT_INDEX8 = (1 shl 28) or
  1391. (SDL_PIXELTYPE_PACKED8 shl 24) or
  1392. (0 shl 20) or
  1393. (0 shl 16) or
  1394. (8 shl 8) or
  1395. (1 shl 0);
  1396. SDL_PIXELFORMAT_RGB332 = (1 shl 28) or
  1397. (SDL_PIXELTYPE_PACKED8 shl 24) or
  1398. (SDL_PACKEDORDER_XRGB shl 20) or
  1399. (SDL_PACKEDLAYOUT_332 shl 16) or
  1400. (8 shl 8) or
  1401. (1 shl 0);
  1402. SDL_PIXELFORMAT_RGB444 = (1 shl 28) or
  1403. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1404. (SDL_PACKEDORDER_XRGB shl 20) or
  1405. (SDL_PACKEDLAYOUT_4444 shl 16) or
  1406. (12 shl 8) or
  1407. (2 shl 0);
  1408. SDL_PIXELFORMAT_RGB555 = (1 shl 28) or
  1409. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1410. (SDL_PACKEDORDER_XRGB shl 20) or
  1411. (SDL_PACKEDLAYOUT_1555 shl 16) or
  1412. (15 shl 8) or
  1413. (2 shl 0);
  1414. SDL_PIXELFORMAT_BGR555 = (1 shl 28) or
  1415. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1416. (SDL_PACKEDORDER_XBGR shl 20) or
  1417. (SDL_PACKEDLAYOUT_1555 shl 16) or
  1418. (15 shl 8) or
  1419. (2 shl 0);
  1420. SDL_PIXELFORMAT_ARGB4444 = (1 shl 28) or
  1421. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1422. (SDL_PACKEDORDER_ARGB shl 20) or
  1423. (SDL_PACKEDLAYOUT_4444 shl 16) or
  1424. (16 shl 8) or
  1425. (2 shl 0);
  1426. SDL_PIXELFORMAT_RGBA4444 = (1 shl 28) or
  1427. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1428. (SDL_PACKEDORDER_RGBA shl 20) or
  1429. (SDL_PACKEDLAYOUT_4444 shl 16) or
  1430. (16 shl 8) or
  1431. (2 shl 0);
  1432. SDL_PIXELFORMAT_ABGR4444 = (1 shl 28) or
  1433. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1434. (SDL_PACKEDORDER_ABGR shl 20) or
  1435. (SDL_PACKEDLAYOUT_4444 shl 16) or
  1436. (16 shl 8) or
  1437. (2 shl 0);
  1438. SDL_PIXELFORMAT_BGRA4444 = (1 shl 28) or
  1439. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1440. (SDL_PACKEDORDER_BGRA shl 20) or
  1441. (SDL_PACKEDLAYOUT_4444 shl 16) or
  1442. (16 shl 8) or
  1443. (2 shl 0);
  1444. SDL_PIXELFORMAT_ARGB1555 = (1 shl 28) or
  1445. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1446. (SDL_PACKEDORDER_ARGB shl 20) or
  1447. (SDL_PACKEDLAYOUT_1555 shl 16) or
  1448. (16 shl 8) or
  1449. (2 shl 0);
  1450. SDL_PIXELFORMAT_RGBA5551 = (1 shl 28) or
  1451. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1452. (SDL_PACKEDORDER_RGBA shl 20) or
  1453. (SDL_PACKEDLAYOUT_5551 shl 16) or
  1454. (16 shl 8) or
  1455. (2 shl 0);
  1456. SDL_PIXELFORMAT_ABGR1555 = (1 shl 28) or
  1457. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1458. (SDL_PACKEDORDER_ABGR shl 20) or
  1459. (SDL_PACKEDLAYOUT_1555 shl 16) or
  1460. (16 shl 8) or
  1461. (2 shl 0);
  1462. SDL_PIXELFORMAT_BGRA5551 = (1 shl 28) or
  1463. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1464. (SDL_PACKEDORDER_BGRA shl 20) or
  1465. (SDL_PACKEDLAYOUT_5551 shl 16) or
  1466. (16 shl 8) or
  1467. (2 shl 0);
  1468. SDL_PIXELFORMAT_RGB565 = (1 shl 28) or
  1469. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1470. (SDL_PACKEDORDER_XRGB shl 20) or
  1471. (SDL_PACKEDLAYOUT_565 shl 16) or
  1472. (16 shl 8) or
  1473. (2 shl 0);
  1474. SDL_PIXELFORMAT_BGR565 = (1 shl 28) or
  1475. (SDL_PIXELTYPE_PACKED16 shl 24) or
  1476. (SDL_PACKEDORDER_XBGR shl 20) or
  1477. (SDL_PACKEDLAYOUT_1555 shl 16) or
  1478. (16 shl 8) or
  1479. (2 shl 0);
  1480. SDL_PIXELFORMAT_RGB24 = (1 shl 28) or
  1481. (SDL_PIXELTYPE_ARRAYU8 shl 24) or
  1482. (SDL_ARRAYORDER_RGB shl 20) or
  1483. (0 shl 16) or
  1484. (24 shl 8) or
  1485. (3 shl 0);
  1486. SDL_PIXELFORMAT_BGR24 = (1 shl 28) or
  1487. (SDL_PIXELTYPE_ARRAYU8 shl 24) or
  1488. (SDL_ARRAYORDER_BGR shl 20) or
  1489. (0 shl 16) or
  1490. (24 shl 8) or
  1491. (3 shl 0);
  1492. SDL_PIXELFORMAT_RGB888 = (1 shl 28) or
  1493. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1494. (SDL_PACKEDORDER_XRGB shl 20) or
  1495. (SDL_PACKEDLAYOUT_8888 shl 16) or
  1496. (24 shl 8) or
  1497. (4 shl 0);
  1498. SDL_PIXELFORMAT_RGBX8888 = (1 shl 28) or
  1499. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1500. (SDL_PACKEDORDER_RGBX shl 20) or
  1501. (SDL_PACKEDLAYOUT_8888 shl 16) or
  1502. (24 shl 8) or
  1503. (4 shl 0);
  1504. SDL_PIXELFORMAT_BGR888 = (1 shl 28) or
  1505. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1506. (SDL_PACKEDORDER_XBGR shl 20) or
  1507. (SDL_PACKEDLAYOUT_8888 shl 16) or
  1508. (24 shl 8) or
  1509. (4 shl 0);
  1510. SDL_PIXELFORMAT_BGRX8888 = (1 shl 28) or
  1511. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1512. (SDL_PACKEDORDER_BGRX shl 20) or
  1513. (SDL_PACKEDLAYOUT_8888 shl 16) or
  1514. (24 shl 8) or
  1515. (4 shl 0);
  1516. SDL_PIXELFORMAT_ARGB8888 = (1 shl 28) or
  1517. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1518. (SDL_PACKEDORDER_ARGB shl 20) or
  1519. (SDL_PACKEDLAYOUT_8888 shl 16) or
  1520. (32 shl 8) or
  1521. (4 shl 0);
  1522. SDL_PIXELFORMAT_RGBA8888 = (1 shl 28) or
  1523. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1524. (SDL_PACKEDORDER_RGBA shl 20) or
  1525. (SDL_PACKEDLAYOUT_8888 shl 16) or
  1526. (32 shl 8) or
  1527. (4 shl 0);
  1528. SDL_PIXELFORMAT_ABGR8888 = (1 shl 28) or
  1529. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1530. (SDL_PACKEDORDER_ABGR shl 20) or
  1531. (SDL_PACKEDLAYOUT_8888 shl 16) or
  1532. (32 shl 8) or
  1533. (4 shl 0);
  1534. SDL_PIXELFORMAT_BGRA8888 = (1 shl 28) or
  1535. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1536. (SDL_PACKEDORDER_RGBX shl 20) or
  1537. (SDL_PACKEDLAYOUT_8888 shl 16) or
  1538. (32 shl 8) or
  1539. (4 shl 0);
  1540. SDL_PIXELFORMAT_ARGB2101010 = (1 shl 28) or
  1541. (SDL_PIXELTYPE_PACKED32 shl 24) or
  1542. (SDL_PACKEDORDER_ARGB shl 20) or
  1543. (SDL_PACKEDLAYOUT_2101010 shl 16)or
  1544. (32 shl 8) or
  1545. (4 shl 0);
  1546. {**< Planar mode: Y + V + U (3 planes) *}
  1547. SDL_PIXELFORMAT_YV12 = (Integer('Y') ) or
  1548. (Integer('V') shl 8) or
  1549. (Integer('1') shl 16) or
  1550. (Integer('2') shl 24);
  1551. {**< Planar mode: Y + U + V (3 planes) *}
  1552. SDL_PIXELFORMAT_IYUV = (Integer('I') ) or
  1553. (Integer('Y') shl 8) or
  1554. (Integer('U') shl 16) or
  1555. (Integer('V') shl 24);
  1556. {**< Packed mode: Y0+U0+Y1+V0 (1 plane) *}
  1557. SDL_PIXELFORMAT_YUY2 = (Integer('Y') ) or
  1558. (Integer('U') shl 8) or
  1559. (Integer('Y') shl 16) or
  1560. (Integer('2') shl 24);
  1561. {**< Packed mode: U0+Y0+V0+Y1 (1 plane) *}
  1562. SDL_PIXELFORMAT_UYVY = (Integer('U') ) or
  1563. (Integer('Y') shl 8) or
  1564. (Integer('V') shl 16) or
  1565. (Integer('Y') shl 24);
  1566. {**< Packed mode: Y0+V0+Y1+U0 (1 plane) *}
  1567. SDL_PIXELFORMAT_YVYU = (Integer('Y') ) or
  1568. (Integer('V') shl 8) or
  1569. (Integer('Y') shl 16) or
  1570. (Integer('U') shl 24);
  1571. type
  1572. PSDL_Color = ^TSDL_Color;
  1573. TSDL_Color = record
  1574. r: UInt8;
  1575. g: UInt8;
  1576. b: UInt8;
  1577. unused: UInt8;
  1578. end;
  1579. TSDL_Colour = TSDL_Color;
  1580. PSDL_Colour = ^TSDL_Colour;
  1581. PSDL_Palette = ^TSDL_Palette;
  1582. TSDL_Palette = record
  1583. ncolors: SInt32;
  1584. colors: PSDL_Color;
  1585. version: UInt32;
  1586. refcount: SInt32;
  1587. end;
  1588. {**
  1589. * Everything in the pixel format structure is read-only.
  1590. *}
  1591. PSDL_PixelFormat = ^TSDL_PixelFormat;
  1592. TSDL_PixelFormat = record
  1593. format: UInt32;
  1594. palette: PSDL_Palette;
  1595. BitsPerPixel: UInt8;
  1596. BytesPerPixel: UInt8;
  1597. padding: array[0..1] of UInt8;
  1598. Rmask: UInt32;
  1599. Gmask: UInt32;
  1600. Bmask: UInt32;
  1601. Amask: UInt32;
  1602. Rloss: UInt8;
  1603. Gloss: UInt8;
  1604. Bloss: UInt8;
  1605. Aloss: UInt8;
  1606. Rshift: UInt8;
  1607. Gshift: UInt8;
  1608. Bshift: UInt8;
  1609. Ashift: UInt8;
  1610. refcount: SInt32;
  1611. next: PSDL_PixelFormat;
  1612. end;
  1613. {**
  1614. * Get the human readable name of a pixel format
  1615. *}
  1616. function SDL_GetPixelFormatName(format: UInt32): PChar;
  1617. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetPixelFormatName' {$ENDIF} {$ENDIF};
  1618. {**
  1619. * Convert one of the enumerated pixel formats to a bpp and RGBA masks.
  1620. *
  1621. * SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
  1622. *
  1623. * SDL_MasksToPixelFormatEnum()
  1624. *}
  1625. function SDL_PixelFormatEnumToMasks(format: UInt32; bpp: PInt; Rmask: PUInt32; Gmask: PUInt32; Bmask: PUInt32; Amask: PUInt32): TSDL_Bool;
  1626. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_PixelFormatEnumToMasks' {$ENDIF} {$ENDIF};
  1627. {**
  1628. * Convert a bpp and RGBA masks to an enumerated pixel format.
  1629. *
  1630. * The pixel format, or SDL_PIXELFORMAT_UNKNOWN if the conversion
  1631. * wasn't possible.
  1632. *
  1633. * SDL_PixelFormatEnumToMasks()
  1634. *}
  1635. function SDL_MasksToPixelFormatEnum(bpp: SInt32; Rmask: UInt32; Gmask: UInt32; Bmask: UInt32; Amask: UInt32): UInt32;
  1636. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_MasksToPixelFormatEnum' {$ENDIF} {$ENDIF};
  1637. {**
  1638. * Create an SDL_PixelFormat structure from a pixel format enum.
  1639. *}
  1640. function SDL_AllocFormat(pixel_format: UInt32): PSDL_PixelFormat;
  1641. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AllocFormat' {$ENDIF} {$ENDIF};
  1642. {**
  1643. * Free an SDL_PixelFormat structure.
  1644. *}
  1645. procedure SDL_FreeFormat(format: PSDL_PixelFormat);
  1646. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FreeFormat' {$ENDIF} {$ENDIF};
  1647. {**
  1648. * Create a palette structure with the specified number of color
  1649. * entries.
  1650. *
  1651. * A new palette, or nil if there wasn't enough memory.
  1652. *
  1653. * The palette entries are initialized to white.
  1654. *
  1655. * SDL_FreePalette()
  1656. *}
  1657. function SDL_AllocPalette(ncolors: SInt32): PSDL_Palette;
  1658. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AllocPalette' {$ENDIF} {$ENDIF};
  1659. {**
  1660. * Set the palette for a pixel format structure.
  1661. *}
  1662. function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palette): SInt32;
  1663. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetPixelFormatPalette' {$ENDIF} {$ENDIF};
  1664. {**
  1665. * Set a range of colors in a palette.
  1666. *
  1667. * palette The palette to modify.
  1668. * colors An array of colors to copy into the palette.
  1669. * firstcolor The index of the first palette entry to modify.
  1670. * ncolors The number of entries to modify.
  1671. *
  1672. * 0 on success, or -1 if not all of the colors could be set.
  1673. *}
  1674. function SDL_SetPaletteColors(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: SInt32; ncolors: SInt32): SInt32;
  1675. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetPaletteColors' {$ENDIF} {$ENDIF};
  1676. {**
  1677. * Free a palette created with SDL_AllocPalette().
  1678. *
  1679. * SDL_AllocPalette()
  1680. *}
  1681. procedure SDL_FreePalette(palette: PSDL_Palette);
  1682. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FreePalette' {$ENDIF} {$ENDIF};
  1683. {**
  1684. * Maps an RGB triple to an opaque pixel value for a given pixel format.
  1685. *
  1686. * SDL_MapRGBA
  1687. *}
  1688. function SDL_MapRGB(const format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8): UInt32;
  1689. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_MapRGB' {$ENDIF} {$ENDIF};
  1690. {**
  1691. * Maps an RGBA quadruple to a pixel value for a given pixel format.
  1692. *
  1693. * SDL_MapRGB
  1694. *}
  1695. function SDL_MapRGBA(const format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8; a: UInt8): UInt32;
  1696. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_MapRGBA' {$ENDIF} {$ENDIF};
  1697. {**
  1698. * Get the RGB components from a pixel of the specified format.
  1699. *
  1700. * SDL_GetRGBA
  1701. *}
  1702. procedure SDL_GetRGB(pixel: UInt32; const format: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8);
  1703. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRGB' {$ENDIF} {$ENDIF};
  1704. {**
  1705. * Get the RGBA components from a pixel of the specified format.
  1706. *
  1707. * SDL_GetRGB
  1708. *}
  1709. procedure SDL_GetRGBA(pixel: UInt32; const format: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8; a: PUInt8);
  1710. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRGBA' {$ENDIF} {$ENDIF};
  1711. {**
  1712. * Calculate a 256 entry gamma ramp for a gamma value.
  1713. *}
  1714. procedure SDL_CalculateGammaRamp(gamma: Float; ramp: PUInt16);
  1715. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CalculateGammaRamp' {$ENDIF} {$ENDIF};
  1716. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1717. ////////////////////// SDL_rect.h ////////////////////////////////////////////////////
  1718. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1719. type
  1720. {**
  1721. * The structure that defines a point
  1722. *
  1723. * SDL_EnclosePoints
  1724. *}
  1725. PSDL_Point = ^TSDL_Point;
  1726. TSDL_Point = record
  1727. x: SInt32;
  1728. y: SInt32;
  1729. end;
  1730. {**
  1731. * A rectangle, with the origin at the upper left.
  1732. *
  1733. * SDL_RectEmpty
  1734. * SDL_RectEquals
  1735. * SDL_HasIntersection
  1736. * SDL_IntersectRect
  1737. * SDL_UnionRect
  1738. * SDL_EnclosePoints
  1739. *}
  1740. PSDL_Rect = ^TSDL_Rect;
  1741. TSDL_Rect = record
  1742. x,y: SInt32;
  1743. w,h: SInt32;
  1744. end;
  1745. {**
  1746. * Returns true if the rectangle has no area.
  1747. *}
  1748. //changed from variant(b?????h!) to TSDL_Rect
  1749. //maybe PSDL_Rect?
  1750. function SDL_RectEmpty(X: TSDL_Rect): Boolean;
  1751. {**
  1752. * Returns true if the two rectangles are equal.
  1753. *}
  1754. function SDL_RectEquals(A: TSDL_Rect; B: TSDL_Rect): Boolean;
  1755. {**
  1756. * Determine whether two rectangles intersect.
  1757. *
  1758. * SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
  1759. *}
  1760. function SDL_HasIntersection(const A: PSDL_Rect; const B: PSDL_Rect): TSDL_Bool;
  1761. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HasIntersection' {$ENDIF} {$ENDIF};
  1762. {**
  1763. * Calculate the intersection of two rectangles.
  1764. *
  1765. * SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
  1766. *}
  1767. function SDL_IntersectRect(const A: PSDL_Rect; const B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool;
  1768. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_IntersectRect' {$ENDIF} {$ENDIF};
  1769. {**
  1770. * Calculate the union of two rectangles.
  1771. *}
  1772. procedure SDL_UnionRect(const A: PSDL_Rect; const B: PSDL_Rect; result: PSDL_Rect);
  1773. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UnionRect' {$ENDIF} {$ENDIF};
  1774. {**
  1775. * Calculate a minimal rectangle enclosing a set of points
  1776. *
  1777. * SDL_TRUE if any points were within the clipping rect
  1778. *}
  1779. function SDL_EnclosePoints(const points: PSDL_Point; count: SInt32; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool;
  1780. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_EnclosePoints' {$ENDIF} {$ENDIF};
  1781. {**
  1782. * Calculate the intersection of a rectangle and line segment.
  1783. *
  1784. * SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
  1785. *}
  1786. function SDL_IntersectRectAndLine(const rect: PSDL_Rect; X1: PInt; Y1: PInt; X2: PInt; Y2: PInt): TSDL_Bool;
  1787. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_IntersectRectAndLine' {$ENDIF} {$ENDIF};
  1788. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1789. ////////////////////// SDL_blendmode.h ////////////////////////////////////////////////////
  1790. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1791. {**
  1792. * The blend mode used in SDL_RenderCopy() and drawing operations.
  1793. *}
  1794. type
  1795. PSDL_BlendMode = ^TSDL_BlendMode;
  1796. TSDL_BlendMode = DWord;
  1797. const
  1798. SDL_BLENDMODE_NONE = $00000000; {**< No blending *}
  1799. SDL_BLENDMODE_BLEND = $00000001; {**< dst = (src * A) + (dst * (1-A)) *}
  1800. SDL_BLENDMODE_ADD = $00000002; {**< dst = (src * A) + dst *}
  1801. SDL_BLENDMODE_MOD = $00000004; {**< dst = src * dst *}
  1802. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1803. ////////////////////// SDL_surface.h ////////////////////////////////////////////////////
  1804. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1805. const
  1806. {**
  1807. * Surface flags
  1808. *
  1809. * These are the currently supported flags for the ::SDL_surface.
  1810. *
  1811. * Used internally (read-only).
  1812. *}
  1813. SDL_SWSURFACE = 0; {**< Just here for compatibility *}
  1814. SDL_PREALLOC = $00000001; {**< Surface uses preallocated memory *}
  1815. SDL_RLEACCEL = $00000002; {**< Surface is RLE encoded *}
  1816. SDL_DONTFREE = $00000004; {**< Surface is referenced internally *}
  1817. {*Surface flags*}
  1818. {**
  1819. * Evaluates to true if the surface needs to be locked before access.
  1820. *}
  1821. //SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
  1822. type
  1823. {**
  1824. * A collection of pixels used in software blitting.
  1825. *
  1826. * This structure should be treated as read-only, except for \c pixels,
  1827. * which, if not NULL, contains the raw pixel data for the surface.
  1828. *}
  1829. PSDL_BlitMap = ^TSDL_BlitMap;
  1830. TSDL_BlitMap = record
  1831. map: Pointer;
  1832. end;
  1833. PSDL_Surface = ^TSDL_Surface;
  1834. TSDL_Surface = record
  1835. flags: UInt32; {**< Read-only *}
  1836. format: PSDL_PixelFormat; {**< Read-only *}
  1837. w, h: SInt32; {**< Read-only *}
  1838. pitch: SInt32; {**< Read-only *}
  1839. pixels: Pointer; {**< Read-write *}
  1840. {** Application data associated with the surface *}
  1841. userdata: Pointer; {**< Read-write *}
  1842. {** information needed for surfaces requiring locks *}
  1843. locked: SInt32; {**< Read-only *}
  1844. lock_data: Pointer; {**< Read-only *}
  1845. {** clipping information *}
  1846. clip_rect: PSDL_Rect; {**< Read-only *}
  1847. {** info for fast blit mapping to other surfaces *}
  1848. map: Pointer; {**< Private *} //SDL_BlitMap
  1849. {** Reference count -- used when freeing surface *}
  1850. refcount: SInt32; {**< Read-mostly *}
  1851. end;
  1852. {**
  1853. * The type of function used for surface blitting functions.
  1854. *}
  1855. TSDL_Blit = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32;
  1856. {**
  1857. * Allocate and free an RGB surface.
  1858. *
  1859. * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
  1860. * If the depth is greater than 8 bits, the pixel format is set using the
  1861. * flags '[RGB]mask'.
  1862. *
  1863. * If the function runs out of memory, it will return NULL.
  1864. *
  1865. * flags The flags are obsolete and should be set to 0.
  1866. *}
  1867. function SDL_CreateRGBSurface(flags: UInt32; width: SInt32; height: SInt32; depth: SInt32; Rmask: UInt32; Gmask: UInt32; Bmask: UInt32; Amask: UInt32): PSDL_Surface;
  1868. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateRGBSurface' {$ENDIF} {$ENDIF};
  1869. function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: SInt32; height: SInt32; depth: SInt32; pitch: SInt32; Rmask: UInt32; Gmask: UInt32; Bmask: UInt32; Amask: UInt32): PSDL_Surface;
  1870. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateRGBSurfaceFrom' {$ENDIF} {$ENDIF};
  1871. procedure SDL_FreeSurface(surface: PSDL_Surface);
  1872. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FreeSurface' {$ENDIF} {$ENDIF};
  1873. {**
  1874. * Set the palette used by a surface.
  1875. *
  1876. * 0, or -1 if the surface format doesn't use a palette.
  1877. *
  1878. * A single palette can be shared with many surfaces.
  1879. *}
  1880. function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): SInt32;
  1881. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetSurfacePalette' {$ENDIF} {$ENDIF};
  1882. {**
  1883. * Sets up a surface for directly accessing the pixels.
  1884. *
  1885. * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
  1886. * to and read from surface.pixels, using the pixel format stored in
  1887. * surface.format. Once you are done accessing the surface, you should
  1888. * use SDL_UnlockSurface() to release it.
  1889. *
  1890. * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
  1891. * to 0, then you can read and write to the surface at any time, and the
  1892. * pixel format of the surface will not change.
  1893. *
  1894. * No operating system or library calls should be made between lock/unlock
  1895. * pairs, as critical system locks may be held during this time.
  1896. *
  1897. * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
  1898. *
  1899. * SDL_UnlockSurface()
  1900. *}
  1901. function SDL_LockSurface(surface: PSDL_Surface): SInt32;
  1902. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LockSurface' {$ENDIF} {$ENDIF};
  1903. {** SDL_LockSurface() *}
  1904. procedure SDL_UnlockSurface(surface: PSDL_Surface);
  1905. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UnlockSurface' {$ENDIF} {$ENDIF};
  1906. {**
  1907. * Load a surface from a seekable SDL data stream (memory or file).
  1908. *
  1909. * If freesrc is non-zero, the stream will be closed after being read.
  1910. *
  1911. * The new surface should be freed with SDL_FreeSurface().
  1912. *
  1913. * the new surface, or NULL if there was an error.
  1914. *}
  1915. function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: SInt32): PSDL_Surface;
  1916. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LoadBMP_RW' {$ENDIF} {$ENDIF};
  1917. {**
  1918. * Load a surface from a file.
  1919. *
  1920. * Convenience macro.
  1921. *}
  1922. function SDL_LoadBMP(_file: PChar): PSDL_Surface;
  1923. {**
  1924. * Save a surface to a seekable SDL data stream (memory or file).
  1925. *
  1926. * If freedst is non-zero, the stream will be closed after being written.
  1927. *
  1928. * 0 if successful or -1 if there was an error.
  1929. *}
  1930. function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: SInt32): SInt32;
  1931. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LoadBMP_RW' {$ENDIF} {$ENDIF};
  1932. {**
  1933. * Save a surface to a file.
  1934. *
  1935. * Convenience macro.
  1936. *}
  1937. function SDL_SaveBMP(surface: PSDL_Surface; _file: PChar): SInt32;
  1938. {**
  1939. * Sets the RLE acceleration hint for a surface.
  1940. *
  1941. * 0 on success, or -1 if the surface is not valid
  1942. *
  1943. * If RLE is enabled, colorkey and alpha blending blits are much faster,
  1944. * but the surface must be locked before directly accessing the pixels.
  1945. *}
  1946. function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: SInt32): SInt32;
  1947. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetSurfaceRLE' {$ENDIF} {$ENDIF};
  1948. {**
  1949. * Sets the color key (transparent pixel) in a blittable surface.
  1950. *
  1951. * surface The surface to update
  1952. * flag Non-zero to enable colorkey and 0 to disable colorkey
  1953. * key The transparent pixel in the native surface format
  1954. *
  1955. * 0 on success, or -1 if the surface is not valid
  1956. *
  1957. * You can pass SDL_RLEACCEL to enable RLE accelerated blits.
  1958. *}
  1959. function SDL_SetColorKey(surface: PSDL_Surface; flag: SInt32; key: UInt32): SInt32;
  1960. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetColorKey' {$ENDIF} {$ENDIF};
  1961. {**
  1962. * Gets the color key (transparent pixel) in a blittable surface.
  1963. *
  1964. * surface The surface to update
  1965. * key A pointer filled in with the transparent pixel in the native
  1966. * surface format
  1967. *
  1968. * 0 on success, or -1 if the surface is not valid or colorkey is not
  1969. * enabled.
  1970. *}
  1971. function SDL_GetColorKey(surface: PSDL_Surface; key: PUInt32): SInt32;
  1972. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetColorKey' {$ENDIF} {$ENDIF};
  1973. {**
  1974. * Set an additional color value used in blit operations.
  1975. *
  1976. * surface The surface to update.
  1977. * r The red color value multiplied into blit operations.
  1978. * g The green color value multiplied into blit operations.
  1979. * b The blue color value multiplied into blit operations.
  1980. *
  1981. * 0 on success, or -1 if the surface is not valid.
  1982. *
  1983. * SDL_GetSurfaceColorMod()
  1984. *}
  1985. function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: UInt8; g: UInt8; b: UInt8): SInt32;
  1986. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetSurfaceColorMod' {$ENDIF} {$ENDIF};
  1987. {**
  1988. * Get the additional color value used in blit operations.
  1989. *
  1990. * surface The surface to query.
  1991. * r A pointer filled in with the current red color value.
  1992. * g A pointer filled in with the current green color value.
  1993. * b A pointer filled in with the current blue color value.
  1994. *
  1995. * 0 on success, or -1 if the surface is not valid.
  1996. *
  1997. * SDL_SetSurfaceColorMod()
  1998. *}
  1999. function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: PUInt8; g: PUInt8; b: PUInt8): SInt32;
  2000. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetSurfaceColorMod' {$ENDIF} {$ENDIF};
  2001. {**
  2002. * Set an additional alpha value used in blit operations.
  2003. *
  2004. * surface The surface to update.
  2005. * alpha The alpha value multiplied into blit operations.
  2006. *
  2007. * 0 on success, or -1 if the surface is not valid.
  2008. *
  2009. * SDL_GetSurfaceAlphaMod()
  2010. *}
  2011. function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: UInt8): SInt32;
  2012. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetSurfaceAlphaMod' {$ENDIF} {$ENDIF};
  2013. {**
  2014. * Get the additional alpha value used in blit operations.
  2015. *
  2016. * surface The surface to query.
  2017. * alpha A pointer filled in with the current alpha value.
  2018. *
  2019. * 0 on success, or -1 if the surface is not valid.
  2020. *
  2021. * SDL_SetSurfaceAlphaMod()
  2022. *}
  2023. function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: PUInt8): SInt32;
  2024. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetSurfaceAlphaMod' {$ENDIF} {$ENDIF};
  2025. {**
  2026. * Set the blend mode used for blit operations.
  2027. *
  2028. * surface The surface to update.
  2029. * blendMode ::SDL_BlendMode to use for blit blending.
  2030. *
  2031. * 0 on success, or -1 if the parameters are not valid.
  2032. *
  2033. * SDL_GetSurfaceBlendMode()
  2034. *}
  2035. function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMode): SInt32;
  2036. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetSurfaceBlendMode' {$ENDIF} {$ENDIF};
  2037. {**
  2038. * Get the blend mode used for blit operations.
  2039. *
  2040. * surface The surface to query.
  2041. * blendMode A pointer filled in with the current blend mode.
  2042. *
  2043. * 0 on success, or -1 if the surface is not valid.
  2044. *
  2045. * SDL_SetSurfaceBlendMode()
  2046. *}
  2047. function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMode): SInt32;
  2048. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetSurfaceBlendMode' {$ENDIF} {$ENDIF};
  2049. {**
  2050. * Sets the clipping rectangle for the destination surface in a blit.
  2051. *
  2052. * If the clip rectangle is NULL, clipping will be disabled.
  2053. *
  2054. * If the clip rectangle doesn't intersect the surface, the function will
  2055. * return SDL_FALSE and blits will be completely clipped. Otherwise the
  2056. * function returns SDL_TRUE and blits to the surface will be clipped to
  2057. * the intersection of the surface area and the clipping rectangle.
  2058. *
  2059. * Note that blits are automatically clipped to the edges of the source
  2060. * and destination surfaces.
  2061. *}
  2062. function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool;
  2063. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetClipRect' {$ENDIF} {$ENDIF};
  2064. {**
  2065. * Gets the clipping rectangle for the destination surface in a blit.
  2066. *
  2067. * rect must be a pointer to a valid rectangle which will be filled
  2068. * with the correct values.
  2069. *}
  2070. procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect);
  2071. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetClipRect' {$ENDIF} {$ENDIF};
  2072. {**
  2073. * Creates a new surface of the specified format, and then copies and maps
  2074. * the given surface to it so the blit of the converted surface will be as
  2075. * fast as possible. If this function fails, it returns NULL.
  2076. *
  2077. * The flags parameter is passed to SDL_CreateRGBSurface() and has those
  2078. * semantics. You can also pass SDL_RLEACCEL in the flags parameter and
  2079. * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
  2080. * surface.
  2081. *}
  2082. function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: UInt32): PSDL_Surface;
  2083. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ConvertSurface' {$ENDIF} {$ENDIF};
  2084. function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: UInt32; flags: UInt32): PSDL_Surface;
  2085. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ConvertSurfaceFormat' {$ENDIF} {$ENDIF};
  2086. {**
  2087. * Copy a block of pixels of one format to another format
  2088. *
  2089. * 0 on success, or -1 if there was an error
  2090. *}
  2091. function SDL_ConvertPixels(width: SInt32; height: SInt32; src_format: UInt32; const src: Pointer; src_pitch: SInt32; dst_format: UInt32; dst: Pointer; dst_pitch: SInt32): SInt32;
  2092. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ConvertPixels' {$ENDIF} {$ENDIF};
  2093. {**
  2094. * Performs a fast fill of the given rectangle with color.
  2095. *
  2096. * If rect is NULL, the whole surface will be filled with color.
  2097. *
  2098. * The color should be a pixel of the format used by the surface, and
  2099. * can be generated by the SDL_MapRGB() function.
  2100. *
  2101. * 0 on success, or -1 on error.
  2102. *}
  2103. function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: UInt32): SInt32;
  2104. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FillRect' {$ENDIF} {$ENDIF};
  2105. function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: SInt32; color: UInt32): SInt32;
  2106. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FillRects' {$ENDIF} {$ENDIF};
  2107. {**
  2108. * Performs a fast blit from the source surface to the destination surface.
  2109. *
  2110. * This assumes that the source and destination rectangles are
  2111. * the same size. If either \c srcrect or \c dstrect are NULL, the entire
  2112. * surface ( src or dst) is copied. The final blit rectangles are saved
  2113. * in srcrect and dstrect after all clipping is performed.
  2114. *
  2115. * If the blit is successful, it returns 0, otherwise it returns -1.
  2116. *
  2117. * The blit function should not be called on a locked surface.
  2118. *
  2119. * The blit semantics for surfaces with and without alpha and colorkey
  2120. * are defined as follows:
  2121. *
  2122. RGBA->RGB:
  2123. SDL_SRCALPHA set:
  2124. alpha-blend (using alpha-channel).
  2125. SDL_SRCCOLORKEY ignored.
  2126. SDL_SRCALPHA not set:
  2127. copy RGB.
  2128. if SDL_SRCCOLORKEY set, only copy the pixels matching the
  2129. RGB values of the source colour key, ignoring alpha in the
  2130. comparison.
  2131. RGB->RGBA:
  2132. SDL_SRCALPHA set:
  2133. alpha-blend (using the source per-surface alpha value);
  2134. set destination alpha to opaque.
  2135. SDL_SRCALPHA not set:
  2136. copy RGB, set destination alpha to source per-surface alpha value.
  2137. both:
  2138. if SDL_SRCCOLORKEY set, only copy the pixels matching the
  2139. source colour key.
  2140. RGBA->RGBA:
  2141. SDL_SRCALPHA set:
  2142. alpha-blend (using the source alpha channel) the RGB values;
  2143. leave destination alpha untouched. [Note: is this correct?]
  2144. SDL_SRCCOLORKEY ignored.
  2145. SDL_SRCALPHA not set:
  2146. copy all of RGBA to the destination.
  2147. if SDL_SRCCOLORKEY set, only copy the pixels matching the
  2148. RGB values of the source colour key, ignoring alpha in the
  2149. comparison.
  2150. RGB->RGB:
  2151. SDL_SRCALPHA set:
  2152. alpha-blend (using the source per-surface alpha value).
  2153. SDL_SRCALPHA not set:
  2154. copy RGB.
  2155. both:
  2156. if SDL_SRCCOLORKEY set, only copy the pixels matching the
  2157. source colour key.r
  2158. *
  2159. * You should call SDL_BlitSurface() unless you know exactly how SDL
  2160. * blitting works internally and how to use the other blit functions.
  2161. *}
  2162. {**
  2163. * This is the public blit function, SDL_BlitSurface(), and it performs
  2164. * rectangle validation and clipping before passing it to SDL_LowerBlit()
  2165. *}
  2166. function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32;
  2167. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UpperBlit' {$ENDIF} {$ENDIF};
  2168. //SDL_BlitSurface = SDL_UpperBlit;
  2169. {**
  2170. * This is a semi-private blit function and it performs low-level surface
  2171. * blitting only.
  2172. *}
  2173. function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32;
  2174. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LowerBlit' {$ENDIF} {$ENDIF};
  2175. {**
  2176. * Perform a fast, low quality, stretch blit between two surfaces of the
  2177. * same pixel format.
  2178. *
  2179. * This function uses a static buffer, and is not thread-safe.
  2180. *}
  2181. function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): SInt32;
  2182. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SoftStretch' {$ENDIF} {$ENDIF};
  2183. //SDL_BlitScaled = SDL_UpperBlitScaled;
  2184. {**
  2185. * This is the public scaled blit function, SDL_BlitScaled(), and it performs
  2186. * rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
  2187. *}
  2188. function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32;
  2189. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UpperBlitScaled' {$ENDIF} {$ENDIF};
  2190. {**
  2191. * This is a semi-private blit function and it performs low-level surface
  2192. * scaled blitting only.
  2193. *}
  2194. function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32;
  2195. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LowerBlitScaled' {$ENDIF} {$ENDIF};
  2196. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  2197. ////////////////////// SDL_shape.h ////////////////////////////////////////////////////
  2198. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  2199. {** SDL_shape.h
  2200. *
  2201. * Header file for the shaped window API.
  2202. *}
  2203. const
  2204. SDL_NONSHAPEABLE_WINDOW = -1;
  2205. SDL_INVALID_SHAPE_ARGUMENT = -2;
  2206. SDL_WINDOW_LACKS_SHAPE = -3;
  2207. type
  2208. PPSDL_Window = ^PSDL_Window;
  2209. PSDL_Window = ^TSDL_Window;
  2210. {** An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. *}
  2211. TWindowShapeMode = ({** The default mode, a binarized alpha cutoff of 1. *}
  2212. ShapeModeDefault,
  2213. {** A binarized alpha cutoff with a given integer value. *}
  2214. ShapeModeBinarizeAlpha,
  2215. {** A binarized alpha cutoff with a given integer value, but with the opposite comparison. *}
  2216. ShapeModeReverseBinarizeAlpha,
  2217. {** A color key is applied. *}
  2218. ShapeModeColorKey);
  2219. //#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
  2220. {** A union containing parameters for shaped windows. *}
  2221. TSDL_WindowShapeParams = record
  2222. case Integer of
  2223. {** a cutoff alpha value for binarization of the window shape's alpha channel. *}
  2224. 0: (binarizationCutoff: UInt8;);
  2225. 1: (colorKey: TSDL_Color;);
  2226. end;
  2227. {** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. *}
  2228. PSDL_WindowShapeMode = ^TSDL_WindowShapeMode;
  2229. TSDL_WindowShapeMode = record
  2230. {** The mode of these window-shape parameters. *}
  2231. mode: TWindowShapeMode;
  2232. {** Window-shape parameters. *}
  2233. parameters: TSDL_WindowShapeParams;
  2234. end;
  2235. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  2236. ////////////////////// SDL_video.h ////////////////////////////////////////////////////
  2237. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  2238. {**
  2239. * The structure that defines a display mode
  2240. *
  2241. * SDL_GetNumDisplayModes()
  2242. * SDL_GetDisplayMode()
  2243. * SDL_GetDesktopDisplayMode()
  2244. * SDL_GetCurrentDisplayMode()
  2245. * SDL_GetClosestDisplayMode()
  2246. * SDL_SetWindowDisplayMode()
  2247. * SDL_GetWindowDisplayMode()
  2248. *}
  2249. PSDL_DisplayMode = ^TSDL_DisplayMode;
  2250. TSDL_DisplayMode = record
  2251. format: UInt32; {**< pixel format *}
  2252. w: SInt32; {**< width *}
  2253. h: SInt32; {**< height *}
  2254. refresh_rate: SInt32; {**< refresh rate (or zero for unspecified) *}
  2255. driverdata: Pointer; {**< driver-specific data, initialize to 0 *}
  2256. end;
  2257. {* Define the SDL window-shaper structure *}
  2258. PSDL_WindowShaper = ^TSDL_WindowShaper;
  2259. TSDL_WindowShaper = record
  2260. {* The window associated with the shaper *}
  2261. window: PSDL_Window;
  2262. {* The user's specified coordinates for the window, for once we give it a shape. *}
  2263. userx,usery: UInt32;
  2264. {* The parameters for shape calculation. *}
  2265. mode: TSDL_WindowShapeMode;
  2266. {* Has this window been assigned a shape? *}
  2267. hasshape: TSDL_Bool;
  2268. driverdata: Pointer;
  2269. end;
  2270. PSDL_WindowUserData = ^TSDL_WindowUserData;
  2271. TSDL_WindowUserData = record
  2272. name: PChar;
  2273. data: Pointer;
  2274. next: PSDL_WindowUserData;
  2275. end;
  2276. {* Define the SDL window structure, corresponding to toplevel windows *}
  2277. TSDL_Window = record
  2278. magic: Pointer;
  2279. id: UInt32;
  2280. title: PChar;
  2281. fin_UTF8_title: SInt32; // esta variable está puesta porque la última versión SDL2.dll devuelve un caracter de más en el title y se desplazan todos los otros campos
  2282. x,y: SInt32;
  2283. w,h: SInt32;
  2284. min_w, min_h: SInt32;
  2285. max_w, max_h: SInt32;
  2286. flags: UInt32;
  2287. {* Stored position and size for windowed mode * }
  2288. windowed: TSDL_Rect;
  2289. fullscreen_mode: TSDL_DisplayMode;
  2290. brightness: Float;
  2291. gamma: PUInt16;
  2292. saved_gamma: PUInt16; {* (just offset into gamma) *}
  2293. surface: PSDL_Surface;
  2294. surface_valid: TSDL_Bool;
  2295. shaper: PSDL_WindowShaper;
  2296. data: PSDL_WindowUserData;
  2297. driverdata: Pointer;
  2298. prev: PSDL_Window;
  2299. next: PSDL_Window;
  2300. end;
  2301. {**
  2302. * Get the shape parameters of a shaped window.
  2303. *
  2304. * window The shaped window whose parameters should be retrieved.
  2305. * shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
  2306. *
  2307. * 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
  2308. * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
  2309. * the SDL_Window* given is a shapeable window currently lacking a shape.
  2310. *
  2311. * SDL_WindowShapeMode
  2312. * SDL_SetWindowShape
  2313. *}
  2314. function SDL_GetShapedWindowMode(window: PSDL_Window; shape_mode: TSDL_WindowShapeMode): SInt32;
  2315. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetShapedWindowMode' {$ENDIF} {$ENDIF};
  2316. {**
  2317. * Set the shape and parameters of a shaped window.
  2318. *
  2319. * window The shaped window whose parameters should be set.
  2320. * shape A surface encoding the desired shape for the window.
  2321. * shape_mode The parameters to set for the shaped window.
  2322. *
  2323. * 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
  2324. * if the SDL_Window* given does not reference a valid shaped window.
  2325. *
  2326. * SDL_WindowShapeMode
  2327. * SDL_GetShapedWindowMode.
  2328. *}
  2329. function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): SInt32;
  2330. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowShape' {$ENDIF} {$ENDIF};
  2331. {**
  2332. * Create a window that can be shaped with the specified position, dimensions, and flags.
  2333. *
  2334. * title The title of the window, in UTF-8 encoding.
  2335. * x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
  2336. * ::SDL_WINDOWPOS_UNDEFINED.
  2337. * y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
  2338. * ::SDL_WINDOWPOS_UNDEFINED.
  2339. * w The width of the window.
  2340. * h The height of the window.
  2341. * flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
  2342. * SDL_WINDOW_OPENGL, SDL_WINDOW_INPUT_GRABBED,
  2343. * SDL_WINDOW_SHOWN, SDL_WINDOW_RESIZABLE,
  2344. * SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED,
  2345. * SDL_WINDOW_BORDERLESS is always set, and SDL_WINDOW_FULLSCREEN is always unset.
  2346. *
  2347. * The window created, or NULL if window creation failed.
  2348. *
  2349. * SDL_DestroyWindow()
  2350. *}
  2351. function SDL_CreateShapedWindow(title: PChar; x: UInt32; y: UInt32; w: UInt32; h: UInt32; flags: UInt32): PSDL_Window;
  2352. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateShapedWindow' {$ENDIF} {$ENDIF};
  2353. {**
  2354. * Return whether the given window is a shaped window.
  2355. *
  2356. * window The window to query for being shaped.
  2357. *
  2358. * SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
  2359. * SDL_CreateShapedWindow
  2360. *}
  2361. function SDL_IsShapedWindow(window: PSDL_Window): TSDL_Bool;
  2362. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_IsShapedWindow' {$ENDIF} {$ENDIF};
  2363. {**
  2364. * The type used to identify a window
  2365. *
  2366. * SDL_CreateWindow()
  2367. * SDL_CreateWindowFrom()
  2368. * SDL_DestroyWindow()
  2369. * SDL_GetWindowData()
  2370. * SDL_GetWindowFlags()
  2371. * SDL_GetWindowGrab()
  2372. * SDL_GetWindowPosition()
  2373. * SDL_GetWindowSize()
  2374. * SDL_GetWindowTitle()
  2375. * SDL_HideWindow()
  2376. * SDL_MaximizeWindow()
  2377. * SDL_MinimizeWindow()
  2378. * SDL_RaiseWindow()
  2379. * SDL_RestoreWindow()
  2380. * SDL_SetWindowData()
  2381. * SDL_SetWindowFullscreen()
  2382. * SDL_SetWindowGrab()
  2383. * SDL_SetWindowIcon()
  2384. * SDL_SetWindowPosition()
  2385. * SDL_SetWindowSize()
  2386. * SDL_SetWindowBordered()
  2387. * SDL_SetWindowTitle()
  2388. * SDL_ShowWindow()
  2389. *}
  2390. const
  2391. {**
  2392. * The flags on a window
  2393. *
  2394. * SDL_GetWindowFlags()
  2395. *}
  2396. SDL_WINDOW_FULLSCREEN = $00000001; {**< fullscreen window *}
  2397. SDL_WINDOW_OPENGL = $00000002; {**< window usable with OpenGL context *}
  2398. SDL_WINDOW_SHOWN = $00000004; {**< window is visible *}
  2399. SDL_WINDOW_HIDDEN = $00000008; {**< window is not visible *}
  2400. SDL_WINDOW_BORDERLESS = $00000010; {**< no window decoration *}
  2401. SDL_WINDOW_RESIZABLE = $00000020; {**< window can be resized *}
  2402. SDL_WINDOW_MINIMIZED = $00000040; {**< window is minimized *}
  2403. SDL_WINDOW_MAXIMIZED = $00000080; {**< window is maximized *}
  2404. SDL_WINDOW_INPUT_GRABBED = $00000100; {**< window has grabbed input focus *}
  2405. SDL_WINDOW_INPUT_FOCUS = $00000200; {**< window has input focus *}
  2406. SDL_WINDOW_MOUSE_FOCUS = $00000400; {**< window has mouse focus *}
  2407. SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN or $00001000;
  2408. SDL_WINDOW_FOREIGN = $00000800; {**< window not created by SDL *}
  2409. type
  2410. TSDL_WindowFlags = DWord;
  2411. function SDL_WindowPos_IsUndefined(X: Variant): Variant;
  2412. function SDL_WindowPos_IsCentered(X: Variant): Variant;
  2413. const
  2414. {**
  2415. * Used to indicate that you don't care what the window position is.
  2416. *}
  2417. SDL_WINDOWPOS_UNDEFINED_MASK = $1FFF0000;
  2418. SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_MASK or 0;
  2419. {**
  2420. * Used to indicate that the window position should be centered.
  2421. *}
  2422. SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000;
  2423. SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_MASK or 0;
  2424. {**
  2425. * Event subtype for window events
  2426. *}
  2427. SDL_WINDOWEVENT_NONE = 0; {**< Never used *}
  2428. SDL_WINDOWEVENT_SHOWN = 1; {**< Window has been shown *}
  2429. SDL_WINDOWEVENT_HIDDEN = 2; {**< Window has been hidden *}
  2430. SDL_WINDOWEVENT_EXPOSED = 3; {**< Window has been exposed and should be redrawn *}
  2431. SDL_WINDOWEVENT_MOVED = 4; {**< Window has been moved to data1; data2 *}
  2432. SDL_WINDOWEVENT_RESIZED = 5; {**< Window has been resized to data1xdata2 *}
  2433. SDL_WINDOWEVENT_SIZE_CHANGED = 6; {**< The window size has changed; either as a result of an API call or through the system or user changing the window size. *}
  2434. SDL_WINDOWEVENT_MINIMIZED = 7; {**< Window has been minimized *}
  2435. SDL_WINDOWEVENT_MAXIMIZED = 8; {**< Window has been maximized *}
  2436. SDL_WINDOWEVENT_RESTORED = 9; {**< Window has been restored to normal size and position *}
  2437. SDL_WINDOWEVENT_ENTER = 10; {**< Window has gained mouse focus *}
  2438. SDL_WINDOWEVENT_LEAVE = 11; {**< Window has lost mouse focus *}
  2439. SDL_WINDOWEVENT_FOCUS_GAINED = 12; {**< Window has gained keyboard focus *}
  2440. SDL_WINDOWEVENT_FOCUS_LOST = 13; {**< Window has lost keyboard focus *}
  2441. SDL_WINDOWEVENT_CLOSE = 14; {**< The window manager requests that the window be closed *}
  2442. type
  2443. TSDL_WindowEventID = DWord;
  2444. {**
  2445. * An opaque handle to an OpenGL context.
  2446. *}
  2447. TSDL_GLContext = Pointer;
  2448. {**
  2449. * OpenGL configuration attributes
  2450. *}
  2451. const
  2452. SDL_GL_RED_SIZE = 0;
  2453. SDL_GL_GREEN_SIZE = 1;
  2454. SDL_GL_BLUE_SIZE = 2;
  2455. SDL_GL_ALPHA_SIZE = 3;
  2456. SDL_GL_BUFFER_SIZE = 4;
  2457. SDL_GL_DOUBLEBUFFER = 5;
  2458. SDL_GL_DEPTH_SIZE = 6;
  2459. SDL_GL_STENCIL_SIZE = 7;
  2460. SDL_GL_ACCUM_RED_SIZE = 8;
  2461. SDL_GL_ACCUM_GREEN_SIZE = 9;
  2462. SDL_GL_ACCUM_BLUE_SIZE = 10;
  2463. SDL_GL_ACCUM_ALPHA_SIZE = 11;
  2464. SDL_GL_STEREO = 12;
  2465. SDL_GL_MULTISAMPLEBUFFERS = 13;
  2466. SDL_GL_MULTISAMPLESAMPLES = 14;
  2467. SDL_GL_ACCELERATED_VISUAL = 15;
  2468. SDL_GL_RETAINED_BACKING = 16;
  2469. SDL_GL_CONTEXT_MAJOR_VERSION = 17;
  2470. SDL_GL_CONTEXT_MINOR_VERSION = 18;
  2471. SDL_GL_CONTEXT_EGL = 19;
  2472. SDL_GL_CONTEXT_FLAGS = 20;
  2473. SDL_GL_CONTEXT_PROFILE_MASK = 21;
  2474. SDL_GL_SHARE_WITH_CURRENT_CONTEXT = 22;
  2475. type
  2476. TSDL_GLattr = DWord;
  2477. const
  2478. SDL_GL_CONTEXT_PROFILE_CORE = $0001;
  2479. SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = $0002;
  2480. SDL_GL_CONTEXT_PROFILE_ES = $0004;
  2481. type
  2482. TSDL_GLprofile = DWord;
  2483. const
  2484. SDL_GL_CONTEXT_DEBUG_FLAG = $0001;
  2485. SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = $0002;
  2486. SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = $0004;
  2487. SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = $0008;
  2488. type
  2489. TSDL_GLcontextFlag = DWord;
  2490. {* Function prototypes *}
  2491. {**
  2492. * Get the number of video drivers compiled into SDL
  2493. *
  2494. * SDL_GetVideoDriver()
  2495. *}
  2496. function SDL_GetNumVideoDrivers(): SInt32;
  2497. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetNumVideoDrivers' {$ENDIF} {$ENDIF};
  2498. {**
  2499. * Get the name of a built in video driver.
  2500. *
  2501. * The video drivers are presented in the order in which they are
  2502. * normally checked during initialization.
  2503. *
  2504. * SDL_GetNumVideoDrivers()
  2505. *}
  2506. function SDL_GetVideoDriver(index: SInt32): PChar;
  2507. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetVideoDriver' {$ENDIF} {$ENDIF};
  2508. {**
  2509. * Initialize the video subsystem, optionally specifying a video driver.
  2510. *
  2511. * driver_name Initialize a specific driver by name, or nil for the
  2512. * default video driver.
  2513. *
  2514. * 0 on success, -1 on error
  2515. *
  2516. * This function initializes the video subsystem; setting up a connection
  2517. * to the window manager, etc, and determines the available display modes
  2518. * and pixel formats, but does not initialize a window or graphics mode.
  2519. *
  2520. * SDL_VideoQuit()
  2521. *}
  2522. function SDL_VideoInit(const driver_name: PChar): SInt32;
  2523. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_VideoInit' {$ENDIF} {$ENDIF};
  2524. {**
  2525. * Shuts down the video subsystem.
  2526. *
  2527. * function closes all windows, and restores the original video mode.
  2528. *
  2529. * SDL_VideoInit()
  2530. *}
  2531. procedure SDL_VideoQuit();
  2532. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_VideoQuit' {$ENDIF} {$ENDIF};
  2533. {**
  2534. * Returns the name of the currently initialized video driver.
  2535. *
  2536. * The name of the current video driver or nil if no driver
  2537. * has been initialized
  2538. *
  2539. * SDL_GetNumVideoDrivers()
  2540. * SDL_GetVideoDriver()
  2541. *}
  2542. function SDL_GetCurrentVideoDriver(): PChar;
  2543. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetCurrentVideoDriver' {$ENDIF} {$ENDIF};
  2544. {**
  2545. * Returns the number of available video displays.
  2546. *
  2547. * SDL_GetDisplayBounds()
  2548. *}
  2549. function SDL_GetNumVideoDisplays(): SInt32;
  2550. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetNumVideoDisplays' {$ENDIF} {$ENDIF};
  2551. {**
  2552. * Get the name of a display in UTF-8 encoding
  2553. *
  2554. * The name of a display, or nil for an invalid display index.
  2555. *
  2556. * SDL_GetNumVideoDisplays()
  2557. *}
  2558. function SDL_GetDisplayName(displayIndex: SInt32): PChar;
  2559. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetDisplayName' {$ENDIF} {$ENDIF};
  2560. {**
  2561. * Get the desktop area represented by a display, with the primary
  2562. * display located at 0,0
  2563. *
  2564. * 0 on success, or -1 if the index is out of range.
  2565. *
  2566. * SDL_GetNumVideoDisplays()
  2567. *}
  2568. function SDL_GetDisplayBounds(displayIndex: SInt32; rect: PSDL_Rect): SInt32;
  2569. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetDisplayBounds' {$ENDIF} {$ENDIF};
  2570. {**
  2571. * Returns the number of available display modes.
  2572. *
  2573. * SDL_GetDisplayMode()
  2574. *}
  2575. function SDL_GetNumDisplayModes(displayIndex: SInt32): SInt32;
  2576. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetNumDisplayModes' {$ENDIF} {$ENDIF};
  2577. {**
  2578. * Fill in information about a specific display mode.
  2579. *
  2580. * The display modes are sorted in this priority:
  2581. * bits per pixel -> more colors to fewer colors
  2582. * width -> largest to smallest
  2583. * height -> largest to smallest
  2584. * refresh rate -> highest to lowest
  2585. *
  2586. * SDL_GetNumDisplayModes()
  2587. *}
  2588. function SDL_GetDisplayMode(displayIndex: SInt32; modeIndex: SInt32; mode: PSDL_DisplayMode): SInt32;
  2589. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetDisplayMode' {$ENDIF} {$ENDIF};
  2590. {**
  2591. * Fill in information about the desktop display mode.
  2592. *}
  2593. function SDL_GetDesktopDisplayMode(displayIndex: SInt32; mode: PSDL_DisplayMode): SInt32;
  2594. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetDesktopDisplayMode' {$ENDIF} {$ENDIF};
  2595. {**
  2596. * Fill in information about the current display mode.
  2597. *}
  2598. function SDL_GetCurrentDisplayMode(displayIndex: SInt32; mode: PSDL_DisplayMode): SInt32;
  2599. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetCurrentDisplayIndex' {$ENDIF} {$ENDIF};
  2600. {**
  2601. * Get the closest match to the requested display mode.
  2602. *
  2603. * mode The desired display mode
  2604. * closest A pointer to a display mode to be filled in with the closest
  2605. * match of the available display modes.
  2606. *
  2607. * The passed in value closest, or nil if no matching video mode
  2608. * was available.
  2609. *
  2610. * The available display modes are scanned, and closest is filled in with the
  2611. * closest mode matching the requested mode and returned. The mode format and
  2612. * refresh_rate default to the desktop mode if they are 0. The modes are
  2613. * scanned with size being first priority, format being second priority, and
  2614. * finally checking the refresh_rate. If all the available modes are too
  2615. * small, then nil is returned.
  2616. *
  2617. * SDL_GetNumDisplayModes()
  2618. * SDL_GetDisplayMode()
  2619. *}
  2620. function SDL_GetClosestDisplayMode(displayIndex: SInt32; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode;
  2621. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetClosestDisplayMode' {$ENDIF} {$ENDIF};
  2622. {**
  2623. * Get the display index associated with a window.
  2624. *
  2625. * the display index of the display containing the center of the
  2626. * window, or -1 on error.
  2627. *}
  2628. function SDL_GetWindowDisplayIndex(window: PSDL_Window): SInt32;
  2629. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowDisplayIndex' {$ENDIF} {$ENDIF};
  2630. {**
  2631. * Set the display mode used when a fullscreen window is visible.
  2632. *
  2633. * By default the window's dimensions and the desktop format and refresh rate
  2634. * are used.
  2635. *
  2636. * mode The mode to use, or nil for the default mode.
  2637. *
  2638. * 0 on success, or -1 if setting the display mode failed.
  2639. *
  2640. * SDL_GetWindowDisplayMode()
  2641. * SDL_SetWindowFullscreen()
  2642. *}
  2643. function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayMode): SInt32;
  2644. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowDisplayMode' {$ENDIF} {$ENDIF};
  2645. {**
  2646. * Fill in information about the display mode used when a fullscreen
  2647. * window is visible.
  2648. *
  2649. * SDL_SetWindowDisplayMode()
  2650. * SDL_SetWindowFullscreen()
  2651. *}
  2652. function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): SInt32;
  2653. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowDisplayMode' {$ENDIF} {$ENDIF};
  2654. {**
  2655. * Get the pixel format associated with the window.
  2656. *}
  2657. function SDL_GetWindowPixelFormat(window: PSDL_Window): UInt32;
  2658. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowPixelFormat' {$ENDIF} {$ENDIF};
  2659. {**
  2660. * Create a window with the specified position, dimensions, and flags.
  2661. *
  2662. * title The title of the window, in UTF-8 encoding.
  2663. * x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
  2664. * ::SDL_WINDOWPOS_UNDEFINED.
  2665. * y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
  2666. * ::SDL_WINDOWPOS_UNDEFINED.
  2667. * w The width of the window.
  2668. * h The height of the window.
  2669. * flags The flags for the window, a mask of any of the following:
  2670. * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
  2671. * ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS,
  2672. * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
  2673. * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED.
  2674. *
  2675. * The id of the window created, or zero if window creation failed.
  2676. *
  2677. * SDL_DestroyWindow()
  2678. *}
  2679. function SDL_CreateWindow(const title: PChar; x: SInt32; y: SInt32; w: SInt32; h: SInt32; flags: UInt32): PSDL_Window;
  2680. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateWindow' {$ENDIF} {$ENDIF};
  2681. {**
  2682. * Create an SDL window from an existing native window.
  2683. *
  2684. * data A pointer to driver-dependent window creation data
  2685. *
  2686. * The id of the window created, or zero if window creation failed.
  2687. *
  2688. * SDL_DestroyWindow()
  2689. *}
  2690. function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window;
  2691. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateWindowFrom' {$ENDIF} {$ENDIF};
  2692. {**
  2693. * Get the numeric ID of a window, for logging purposes.
  2694. *}
  2695. function SDL_GetWindowID(window: PSDL_Window): UInt32;
  2696. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowID' {$ENDIF} {$ENDIF};
  2697. {**
  2698. * Get a window from a stored ID, or nil if it doesn't exist.
  2699. *}
  2700. function SDL_GetWindowFromID(id: UInt32): PSDL_Window;
  2701. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowFromID' {$ENDIF} {$ENDIF};
  2702. {**
  2703. * Get the window flags.
  2704. *}
  2705. function SDL_GetWindowFlags(window: PSDL_Window): UInt32;
  2706. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowFlags' {$ENDIF} {$ENDIF};
  2707. {**
  2708. * Set the title of a window, in UTF-8 format.
  2709. *
  2710. * SDL_GetWindowTitle()
  2711. *}
  2712. procedure SDL_SetWindowTitle(window: PSDL_Window; const title: PChar);
  2713. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF};
  2714. {**
  2715. * Get the title of a window, in UTF-8 format.
  2716. *
  2717. * SDL_SetWindowTitle()
  2718. *}
  2719. function SDL_GetWindowTitle(window: PSDL_Window): PChar;
  2720. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF};
  2721. {**
  2722. * Set the icon for a window.
  2723. *
  2724. * icon The icon for the window.
  2725. *}
  2726. procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface);
  2727. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowIcon' {$ENDIF} {$ENDIF};
  2728. {**
  2729. * Associate an arbitrary named pointer with a window.
  2730. *
  2731. * window The window to associate with the pointer.
  2732. * name The name of the pointer.
  2733. * userdata The associated pointer.
  2734. *
  2735. * The previous value associated with 'name'
  2736. *
  2737. * The name is case-sensitive.
  2738. *
  2739. * SDL_GetWindowData()
  2740. *}
  2741. function SDL_SetWindowData(window: PSDL_Window; const name: PChar; userdata: Pointer): Pointer;
  2742. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowData' {$ENDIF} {$ENDIF};
  2743. {**
  2744. * Retrieve the data pointer associated with a window.
  2745. *
  2746. * window The window to query.
  2747. * name The name of the pointer.
  2748. *
  2749. * The value associated with 'name'
  2750. *
  2751. * SDL_SetWindowData()
  2752. *}
  2753. function SDL_GetWindowData(window: PSDL_Window; const name: PChar): Pointer;
  2754. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowData' {$ENDIF} {$ENDIF};
  2755. {**
  2756. * Set the position of a window.
  2757. *
  2758. * window The window to reposition.
  2759. * x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or
  2760. * SDL_WINDOWPOS_UNDEFINED.
  2761. * y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or
  2762. * SDL_WINDOWPOS_UNDEFINED.
  2763. *
  2764. * The window coordinate origin is the upper left of the display.
  2765. *
  2766. * SDL_GetWindowPosition()
  2767. *}
  2768. procedure SDL_SetWindowPosition(window: PSDL_Window; x: SInt32; y: SInt32);
  2769. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowPosition' {$ENDIF} {$ENDIF};
  2770. {**
  2771. * Get the position of a window.
  2772. *
  2773. * x Pointer to variable for storing the x position, may be nil
  2774. * y Pointer to variable for storing the y position, may be nil
  2775. *
  2776. * SDL_SetWindowPosition()
  2777. *}
  2778. procedure SDL_GetWindowPosition(window: PSDL_Window; x: PInt; y: PInt);
  2779. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowPosition' {$ENDIF} {$ENDIF};
  2780. {**
  2781. * Set the size of a window's client area.
  2782. *
  2783. * w The width of the window, must be >0
  2784. * h The height of the window, must be >0
  2785. *
  2786. * You can't change the size of a fullscreen window, it automatically
  2787. * matches the size of the display mode.
  2788. *
  2789. * SDL_GetWindowSize()
  2790. *}
  2791. procedure SDL_SetWindowSize(window: PSDL_Window; w: SInt32; h: SInt32);
  2792. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowSize' {$ENDIF} {$ENDIF};
  2793. {**
  2794. * Get the size of a window's client area.
  2795. *
  2796. * w Pointer to variable for storing the width, may be nil
  2797. * h Pointer to variable for storing the height, may be nil
  2798. *
  2799. * SDL_SetWindowSize()
  2800. *}
  2801. procedure SDL_GetWindowSize(window: PSDL_Window; w: PInt; h: PInt);
  2802. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowSize' {$ENDIF} {$ENDIF};
  2803. {**
  2804. * Set the minimum size of a window's client area.
  2805. *
  2806. * min_w The minimum width of the window, must be >0
  2807. * min_h The minimum height of the window, must be >0
  2808. *
  2809. * You can't change the minimum size of a fullscreen window, it
  2810. * automatically matches the size of the display mode.
  2811. *
  2812. * SDL_GetWindowMinimumSize()
  2813. * SDL_SetWindowMaximumSize()
  2814. *}
  2815. procedure SDL_SetWindowMinimumSize(window: PSDL_Window; min_w: SInt32; min_h: SInt32);
  2816. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowMinimumSize' {$ENDIF} {$ENDIF};
  2817. {**
  2818. * Get the minimum size of a window's client area.
  2819. *
  2820. * w Pointer to variable for storing the minimum width, may be nil
  2821. * h Pointer to variable for storing the minimum height, may be nil
  2822. *
  2823. * SDL_GetWindowMaximumSize()
  2824. * SDL_SetWindowMinimumSize()
  2825. *}
  2826. procedure SDL_GetWindowMinimumSize(window: PSDL_Window; w: PInt; h: PInt);
  2827. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowMinimumSize' {$ENDIF} {$ENDIF};
  2828. {**
  2829. * Set the maximum size of a window's client area.
  2830. *
  2831. * max_w The maximum width of the window, must be >0
  2832. * max_h The maximum height of the window, must be >0
  2833. *
  2834. * You can't change the maximum size of a fullscreen window, it
  2835. * automatically matches the size of the display mode.
  2836. *
  2837. * SDL_GetWindowMaximumSize()
  2838. * SDL_SetWindowMinimumSize()
  2839. *}
  2840. procedure SDL_SetWindowMaximumSize(window: PSDL_Window; max_w: SInt32; max_h: SInt32);
  2841. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowMaximumSize' {$ENDIF} {$ENDIF};
  2842. {**
  2843. * Get the maximum size of a window's client area.
  2844. *
  2845. * w Pointer to variable for storing the maximum width, may be nil
  2846. * h Pointer to variable for storing the maximum height, may be nil
  2847. *
  2848. * SDL_GetWindowMinimumSize()
  2849. * SDL_SetWindowMaximumSize()
  2850. *}
  2851. procedure SDL_GetWindowMaximumSize(window: PSDL_Window; w: PInt; h: PInt);
  2852. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowMaximumSize' {$ENDIF} {$ENDIF};
  2853. {**
  2854. * Set the border state of a window.
  2855. *
  2856. * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
  2857. * add or remove the border from the actual window. This is a no-op if the
  2858. * window's border already matches the requested state.
  2859. *
  2860. * window The window of which to change the border state.
  2861. * bordered SDL_FALSE to remove border, SDL_TRUE to add border.
  2862. *
  2863. * You can't change the border state of a fullscreen window.
  2864. *
  2865. * SDL_GetWindowFlags()
  2866. *}
  2867. procedure SDL_SetWindowBordered(window: PSDL_Window; bordered: TSDL_Bool);
  2868. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowBordered' {$ENDIF} {$ENDIF};
  2869. {**
  2870. * Show a window.
  2871. *
  2872. * SDL_HideWindow()
  2873. *}
  2874. procedure SDL_ShowWindow(window: PSDL_Window);
  2875. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ShowWindow' {$ENDIF} {$ENDIF};
  2876. {**
  2877. * Hide a window.
  2878. *
  2879. * SDL_ShowWindow()
  2880. *}
  2881. procedure SDL_HideWindow(window: PSDL_Window);
  2882. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HideWindow' {$ENDIF} {$ENDIF};
  2883. {**
  2884. * Raise a window above other windows and set the input focus.
  2885. *}
  2886. procedure SDL_RaiseWindow(window: PSDL_Window);
  2887. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RaiseWindow' {$ENDIF} {$ENDIF};
  2888. {**
  2889. * Make a window as large as possible.
  2890. *
  2891. * SDL_RestoreWindow()
  2892. *}
  2893. procedure SDL_MaximizeWindow(window: PSDL_Window);
  2894. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_MaximizeWindow' {$ENDIF} {$ENDIF};
  2895. {**
  2896. * Minimize a window to an iconic representation.
  2897. *
  2898. * SDL_RestoreWindow()
  2899. *}
  2900. procedure SDL_MinimizeWindow(window: PSDL_Window);
  2901. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_MinimizeWindow' {$ENDIF} {$ENDIF};
  2902. {**
  2903. * Restore the size and position of a minimized or maximized window.
  2904. *
  2905. * SDL_MaximizeWindow()
  2906. * SDL_MinimizeWindow()
  2907. *}
  2908. procedure SDL_RestoreWindow(window: PSDL_Window);
  2909. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RestoreWindow' {$ENDIF} {$ENDIF};
  2910. {**
  2911. * Set a window's fullscreen state.
  2912. *
  2913. * 0 on success, or -1 if setting the display mode failed.
  2914. *
  2915. * SDL_SetWindowDisplayMode()
  2916. * SDL_GetWindowDisplayMode()
  2917. *}
  2918. function SDL_SetWindowFullscreen(window: PSDL_Window; flags: UInt32): SInt32;
  2919. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowFullscreen' {$ENDIF} {$ENDIF};
  2920. {**
  2921. * Get the SDL surface associated with the window.
  2922. *
  2923. * The window's framebuffer surface, or nil on error.
  2924. *
  2925. * A new surface will be created with the optimal format for the window,
  2926. * if necessary. This surface will be freed when the window is destroyed.
  2927. *
  2928. * You may not combine this with 3D or the rendering API on this window.
  2929. *
  2930. * SDL_UpdateWindowSurface()
  2931. * SDL_UpdateWindowSurfaceRects()
  2932. *}
  2933. function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface;
  2934. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowSurface' {$ENDIF} {$ENDIF};
  2935. {**
  2936. * Copy the window surface to the screen.
  2937. *
  2938. * 0 on success, or -1 on error.
  2939. *
  2940. * SDL_GetWindowSurface()
  2941. * SDL_UpdateWindowSurfaceRects()
  2942. *}
  2943. function SDL_UpdateWindowSurface(window: PSDL_Window): SInt32;
  2944. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UpdateWindowSurface' {$ENDIF} {$ENDIF};
  2945. {**
  2946. * Copy a number of rectangles on the window surface to the screen.
  2947. *
  2948. * 0 on success, or -1 on error.
  2949. *
  2950. * SDL_GetWindowSurface()
  2951. * SDL_UpdateWindowSurfaceRect()
  2952. *}
  2953. function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; numrects: SInt32): SInt32;
  2954. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UpdateWindowSurfaceRects' {$ENDIF} {$ENDIF};
  2955. {**
  2956. * Set a window's input grab mode.
  2957. *
  2958. * grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
  2959. *
  2960. * SDL_GetWindowGrab()
  2961. *}
  2962. procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: TSDL_Bool);
  2963. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowGrab' {$ENDIF} {$ENDIF};
  2964. {**
  2965. * Get a window's input grab mode.
  2966. *
  2967. * This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
  2968. *
  2969. * SDL_SetWindowGrab()
  2970. *}
  2971. function SDL_GetWindowGrab(window: PSDL_Window): TSDL_Bool;
  2972. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowGrab' {$ENDIF} {$ENDIF};
  2973. {**
  2974. * Set the brightness (gamma correction) for a window.
  2975. *
  2976. * 0 on success, or -1 if setting the brightness isn't supported.
  2977. *
  2978. * SDL_GetWindowBrightness()
  2979. * SDL_SetWindowGammaRamp()
  2980. *}
  2981. function SDL_SetWindowBrightness(window: PSDL_Window; brightness: Float): SInt32;
  2982. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowBrightness' {$ENDIF} {$ENDIF};
  2983. {**
  2984. * Get the brightness (gamma correction) for a window.
  2985. *
  2986. * The last brightness value passed to SDL_SetWindowBrightness()
  2987. *
  2988. * SDL_SetWindowBrightness()
  2989. *}
  2990. function SDL_GetWindowBrightness(window: PSDL_Window): Float;
  2991. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowBrightness' {$ENDIF} {$ENDIF};
  2992. {**
  2993. * Set the gamma ramp for a window.
  2994. *
  2995. * red The translation table for the red channel, or nil.
  2996. * green The translation table for the green channel, or nil.
  2997. * blue The translation table for the blue channel, or nil.
  2998. *
  2999. * 0 on success, or -1 if gamma ramps are unsupported.
  3000. *
  3001. * Set the gamma translation table for the red, green, and blue channels
  3002. * of the video hardware. Each table is an array of 256 16-bit quantities,
  3003. * representing a mapping between the input and output for that channel.
  3004. * The input is the index into the array, and the output is the 16-bit
  3005. * gamma value at that index, scaled to the output color precision.
  3006. *
  3007. * SDL_GetWindowGammaRamp()
  3008. *}
  3009. function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: PUInt16; const green: PUInt16; const blue: PUInt16): SInt32;
  3010. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetWindowGammaRamp' {$ENDIF} {$ENDIF};
  3011. {**
  3012. * Get the gamma ramp for a window.
  3013. *
  3014. * red A pointer to a 256 element array of 16-bit quantities to hold
  3015. * the translation table for the red channel, or nil.
  3016. * green A pointer to a 256 element array of 16-bit quantities to hold
  3017. * the translation table for the green channel, or nil.
  3018. * blue A pointer to a 256 element array of 16-bit quantities to hold
  3019. * the translation table for the blue channel, or nil.
  3020. *
  3021. * 0 on success, or -1 if gamma ramps are unsupported.
  3022. *
  3023. * SDL_SetWindowGammaRamp()
  3024. *}
  3025. function SDL_GetWindowGammaRamp(window: PSDL_Window; red: PUInt16; green: PUInt16; blue: PUInt16): SInt32;
  3026. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetWindowGammaRamp' {$ENDIF} {$ENDIF};
  3027. {**
  3028. * Destroy a window.
  3029. *}
  3030. procedure SDL_DestroyWindow(window: PSDL_Window);
  3031. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DestroyWindow' {$ENDIF} {$ENDIF};
  3032. {**
  3033. * Returns whether the screensaver is currently enabled (default on).
  3034. *
  3035. * SDL_EnableScreenSaver()
  3036. * SDL_DisableScreenSaver()
  3037. *}
  3038. function SDL_IsScreenSaverEnabled: TSDL_Bool;
  3039. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_IsScreenSaverEnabled' {$ENDIF} {$ENDIF};
  3040. {**
  3041. * Allow the screen to be blanked by a screensaver
  3042. *
  3043. * SDL_IsScreenSaverEnabled()
  3044. * SDL_DisableScreenSaver()
  3045. *}
  3046. procedure SDL_EnableScreenSaver();
  3047. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_EnableScreenSaver' {$ENDIF} {$ENDIF};
  3048. {**
  3049. * Prevent the screen from being blanked by a screensaver
  3050. *
  3051. * SDL_IsScreenSaverEnabled()
  3052. * SDL_EnableScreenSaver()
  3053. *}
  3054. procedure SDL_DisableScreenSaver();
  3055. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DisableScreenSaver' {$ENDIF} {$ENDIF};
  3056. {**
  3057. * OpenGL support functions
  3058. *}
  3059. {**
  3060. * Dynamically load an OpenGL library.
  3061. *
  3062. * path The platform dependent OpenGL library name, or nil to open the
  3063. * default OpenGL library.
  3064. *
  3065. * 0 on success, or -1 if the library couldn't be loaded.
  3066. *
  3067. * This should be done after initializing the video driver, but before
  3068. * creating any OpenGL windows. If no OpenGL library is loaded, the default
  3069. * library will be loaded upon creation of the first OpenGL window.
  3070. *
  3071. * If you do this, you need to retrieve all of the GL functions used in
  3072. * your program from the dynamic library using SDL_GL_GetProcAddress().
  3073. *
  3074. * SDL_GL_GetProcAddress()
  3075. * SDL_GL_UnloadLibrary()
  3076. *}
  3077. function SDL_GL_LoadLibrary(const path: PChar): SInt32;
  3078. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_LoadLibrary' {$ENDIF} {$ENDIF};
  3079. {**
  3080. * Get the address of an OpenGL function.
  3081. *}
  3082. function SDL_GL_GetProcAddress(const proc: PChar): Pointer;
  3083. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_GetProcAddress' {$ENDIF} {$ENDIF};
  3084. {**
  3085. * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
  3086. *
  3087. * SDL_GL_LoadLibrary()
  3088. *}
  3089. procedure SDL_GL_UnloadLibrary();
  3090. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_UnloadLibrary' {$ENDIF} {$ENDIF};
  3091. {**
  3092. * Return true if an OpenGL extension is supported for the current
  3093. * context.
  3094. *}
  3095. function SDL_GL_ExtensionSupported(const extension: PChar): TSDL_Bool;
  3096. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_ExtensionSupported' {$ENDIF} {$ENDIF};
  3097. {**
  3098. * Set an OpenGL window attribute before window creation.
  3099. *}
  3100. function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: SInt32): SInt32;
  3101. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_SetAttribute' {$ENDIF} {$ENDIF};
  3102. {**
  3103. * Get the actual value for an attribute from the current context.
  3104. *}
  3105. function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: PInt): SInt32;
  3106. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_GetAttribute' {$ENDIF} {$ENDIF};
  3107. {**
  3108. * Create an OpenGL context for use with an OpenGL window, and make it
  3109. * current.
  3110. *
  3111. * SDL_GL_DeleteContext()
  3112. *}
  3113. function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext;
  3114. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_CreateContext' {$ENDIF} {$ENDIF};
  3115. {**
  3116. * Set up an OpenGL context for rendering into an OpenGL window.
  3117. *
  3118. * The context must have been created with a compatible window.
  3119. *}
  3120. function SDL_GL_MakeCurrent(window: PSDL_Window; context: TSDL_GLContext): SInt32;
  3121. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_MakeCurrent' {$ENDIF} {$ENDIF};
  3122. {**
  3123. * Get the currently active OpenGL window.
  3124. *}
  3125. function SDL_GL_GetCurrentWindow(): PSDL_Window;
  3126. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_GetCurrentWindow' {$ENDIF} {$ENDIF};
  3127. {**
  3128. * Get the currently active OpenGL context.
  3129. *}
  3130. function SDL_GL_GetCurrentContext(): TSDL_GLContext;
  3131. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_GetCurrentContext' {$ENDIF} {$ENDIF};
  3132. {**
  3133. * Set the swap interval for the current OpenGL context.
  3134. *
  3135. * interval 0 for immediate updates, 1 for updates synchronized with the
  3136. * vertical retrace. If the system supports it, you may
  3137. * specify -1 to allow late swaps to happen immediately
  3138. * instead of waiting for the next retrace.
  3139. *
  3140. * 0 on success, or -1 if setting the swap interval is not supported.
  3141. *
  3142. * SDL_GL_GetSwapInterval()
  3143. *}
  3144. function SDL_GL_SetSwapInterval(interval: SInt32): SInt32;
  3145. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_SetSwapInterval' {$ENDIF} {$ENDIF};
  3146. {**
  3147. * Get the swap interval for the current OpenGL context.
  3148. *
  3149. * 0 if there is no vertical retrace synchronization, 1 if the buffer
  3150. * swap is synchronized with the vertical retrace, and -1 if late
  3151. * swaps happen immediately instead of waiting for the next retrace.
  3152. * If the system can't determine the swap interval, or there isn't a
  3153. * valid current context, this will return 0 as a safe default.
  3154. *
  3155. * SDL_GL_SetSwapInterval()
  3156. *}
  3157. function SDL_GL_GetSwapInterval(): SInt32;
  3158. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_GetSwapInterval' {$ENDIF} {$ENDIF};
  3159. {**
  3160. * Swap the OpenGL buffers for a window, if double-buffering is
  3161. * supported.
  3162. *}
  3163. procedure SDL_GL_SwapWindow(window: PSDL_Window);
  3164. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_SwapWindow' {$ENDIF} {$ENDIF};
  3165. {**
  3166. * Delete an OpenGL context.
  3167. *
  3168. * SDL_GL_CreateContext()
  3169. *}
  3170. procedure SDL_GL_DeleteContext(context: TSDL_GLContext);
  3171. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_DeleteContext' {$ENDIF} {$ENDIF};
  3172. {*OpenGL support functions*}
  3173. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  3174. ////////////////////// SDL_renderer.h ///////////////////////////////////////////////////
  3175. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  3176. {**
  3177. * Flags used when creating a rendering context
  3178. *}
  3179. const
  3180. SDL_RENDERER_SOFTWARE = $00000001; {**< The renderer is a software fallback *}
  3181. SDL_RENDERER_ACCELERATED = $00000002; {**< The renderer uses hardware
  3182. acceleration *}
  3183. SDL_RENDERER_PRESENTVSYNC = $00000004; {**< Present is synchronized
  3184. with the refresh rate *}
  3185. SDL_RENDERER_TARGETTEXTURE = $00000008; {**< The renderer supports
  3186. rendering to texture *}
  3187. type
  3188. PSDL_RendererFlags = ^TSDL_RendererFlags;
  3189. TSDL_RendererFlags = Word;
  3190. {**
  3191. * Information on the capabilities of a render driver or context.
  3192. *}
  3193. PSDL_RendererInfo = ^TSDL_RendererInfo;
  3194. TSDL_RendererInfo = record
  3195. name: PChar; {**< The name of the renderer *}
  3196. flags: UInt32; {**< Supported ::SDL_RendererFlags *}
  3197. num_texture_formats: UInt32; {**< The number of available texture formats *}
  3198. texture_formats: array[0..15] of UInt32; {**< The available texture formats *}
  3199. max_texture_width: SInt32; {**< The maximimum texture width *}
  3200. max_texture_height: SInt32; {**< The maximimum texture height *}
  3201. end;
  3202. {**
  3203. * The access pattern allowed for a texture.
  3204. *}
  3205. type
  3206. PSDL_TextureAccess = ^TSDL_TextureAccess;
  3207. TSDL_TextureAccess = (
  3208. SDL_TEXTUREACCESS_STATIC, {**< Changes rarely, not lockable *}
  3209. SDL_TEXTUREACCESS_STREAMING, {**< Changes frequently, lockable *}
  3210. SDL_TEXTUREACCESS_TARGET {**< Texture can be used as a render target *}
  3211. );
  3212. {**
  3213. * The texture channel modulation used in SDL_RenderCopy().
  3214. *}
  3215. PSDL_TextureModulate = ^TSDL_TextureModulate;
  3216. TSDL_TextureModulate = (
  3217. SDL_TEXTUREMODULATE_NONE, {**< No modulation *}
  3218. SDL_TEXTUREMODULATE_COLOR, {**< srcC = srcC * color *}
  3219. SDL_TEXTUREMODULATE_ALPHA {**< srcA = srcA * alpha *}
  3220. );
  3221. {**
  3222. * Flip constants for SDL_RenderCopyEx
  3223. *}
  3224. type
  3225. PSDL_RendererFlip = ^TSDL_RendererFlip;
  3226. TSDL_RendererFlip = (SDL_FLIP_NONE, {**< Do not flip *}
  3227. SDL_FLIP_HORIZONTAL, {**< flip horizontally *}
  3228. SDL_FLIP_VERTICAL {**< flip vertically *}
  3229. );
  3230. {**
  3231. * A structure representing rendering state
  3232. *}
  3233. PPSDL_Renderer = ^PSDL_Renderer;
  3234. PSDL_Renderer = Pointer; //todo!
  3235. {**
  3236. * An efficient driver-specific representation of pixel data
  3237. *}
  3238. PSDL_Texture = Pointer; //todo!
  3239. {* Function prototypes *}
  3240. {**
  3241. * Get the number of 2D rendering drivers available for the current
  3242. * display.
  3243. *
  3244. * A render driver is a set of code that handles rendering and texture
  3245. * management on a particular display. Normally there is only one, but
  3246. * some drivers may have several available with different capabilities.
  3247. *
  3248. * SDL_GetRenderDriverInfo()
  3249. * SDL_CreateRenderer()
  3250. *}
  3251. function SDL_GetNumRenderDrivers(): SInt32;
  3252. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetNumRenderDrivers' {$ENDIF} {$ENDIF};
  3253. {**
  3254. * Get information about a specific 2D rendering driver for the current
  3255. * display.
  3256. *
  3257. * index The index of the driver to query information about.
  3258. * info A pointer to an SDL_RendererInfo struct to be filled with
  3259. * information on the rendering driver.
  3260. *
  3261. * 0 on success, -1 if the index was out of range.
  3262. *
  3263. * SDL_CreateRenderer()
  3264. *}
  3265. function SDL_GetRenderDriverInfo(index: SInt32; info: PSDL_RendererInfo): SInt32;
  3266. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRenderDriverInfo' {$ENDIF} {$ENDIF};
  3267. {**
  3268. * Create a window and default renderer
  3269. *
  3270. * width The width of the window
  3271. * height The height of the window
  3272. * window_flags The flags used to create the window
  3273. * window A pointer filled with the window, or NULL on error
  3274. * renderer A pointer filled with the renderer, or NULL on error
  3275. *
  3276. * 0 on success, or -1 on error
  3277. *}
  3278. function SDL_CreateWindowAndRenderer(width: SInt32; height: SInt32; window_flags: UInt32; window: PPSDL_Window; renderer: PPSDL_Renderer): SInt32;
  3279. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF};
  3280. {**
  3281. * Create a 2D rendering context for a window.
  3282. *
  3283. * window The window where rendering is displayed.
  3284. * index The index of the rendering driver to initialize, or -1 to
  3285. * initialize the first one supporting the requested flags.
  3286. * flags ::SDL_RendererFlags.
  3287. *
  3288. * A valid rendering context or NULL if there was an error.
  3289. *
  3290. * SDL_CreateSoftwareRenderer()
  3291. * SDL_GetRendererInfo()
  3292. * SDL_DestroyRenderer()
  3293. *}
  3294. function SDL_CreateRenderer(window: PSDL_Window; index: SInt32; flags: UInt32): PSDL_Renderer;
  3295. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateRenderer' {$ENDIF} {$ENDIF};
  3296. {**
  3297. * Create a 2D software rendering context for a surface.
  3298. *
  3299. * surface The surface where rendering is done.
  3300. *
  3301. * A valid rendering context or NULL if there was an error.
  3302. *
  3303. * SDL_CreateRenderer()
  3304. * SDL_DestroyRenderer()
  3305. *}
  3306. function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer;
  3307. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF} {$ENDIF};
  3308. {**
  3309. * Get the renderer associated with a window.
  3310. *}
  3311. function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer;
  3312. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRenderer' {$ENDIF} {$ENDIF};
  3313. {**
  3314. * Get information about a rendering context.
  3315. *}
  3316. function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): SInt32;
  3317. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRendererInfo' {$ENDIF} {$ENDIF};
  3318. {**
  3319. * Get the output size of a rendering context.
  3320. *}
  3321. function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: PInt; h: PInt): SInt32;
  3322. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRendererOutputSize' {$ENDIF} {$ENDIF};
  3323. {**
  3324. * Create a texture for a rendering context.
  3325. *
  3326. * renderer The renderer.
  3327. * format The format of the texture.
  3328. * access One of the enumerated values in ::SDL_TextureAccess.
  3329. * w The width of the texture in pixels.
  3330. * h The height of the texture in pixels.
  3331. *
  3332. * The created texture is returned, or 0 if no rendering context was
  3333. * active, the format was unsupported, or the width or height were out
  3334. * of range.
  3335. *
  3336. * SDL_QueryTexture()
  3337. * SDL_UpdateTexture()
  3338. * SDL_DestroyTexture()
  3339. *}
  3340. function SDL_CreateTexture(renderer: PSDL_Renderer; format: UInt32; access: SInt32; w: SInt32; h: SInt32): PSDL_Texture;
  3341. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateTexture' {$ENDIF} {$ENDIF};
  3342. {**
  3343. * Create a texture from an existing surface.
  3344. *
  3345. * renderer The renderer.
  3346. * surface The surface containing pixel data used to fill the texture.
  3347. *
  3348. * The created texture is returned, or 0 on error.
  3349. *
  3350. * The surface is not modified or freed by this function.
  3351. *
  3352. * SDL_QueryTexture()
  3353. * SDL_DestroyTexture()
  3354. *}
  3355. function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture;
  3356. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateTextureFromSurface' {$ENDIF} {$ENDIF};
  3357. {**
  3358. * Query the attributes of a texture
  3359. *
  3360. * texture A texture to be queried.
  3361. * format A pointer filled in with the raw format of the texture. The
  3362. * actual format may differ, but pixel transfers will use this
  3363. * format.
  3364. * access A pointer filled in with the actual access to the texture.
  3365. * w A pointer filled in with the width of the texture in pixels.
  3366. * h A pointer filled in with the height of the texture in pixels.
  3367. *
  3368. * 0 on success, or -1 if the texture is not valid.
  3369. *}
  3370. function SDL_QueryTexture(texture: PSDL_Texture; format: PUInt32; access: PInt; w: PInt; h: PInt): SInt32;
  3371. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_QueryTexture' {$ENDIF} {$ENDIF};
  3372. {**
  3373. * Set an additional color value used in render copy operations.
  3374. *
  3375. * texture The texture to update.
  3376. * r The red color value multiplied into copy operations.
  3377. * g The green color value multiplied into copy operations.
  3378. * b The blue color value multiplied into copy operations.
  3379. *
  3380. * 0 on success, or -1 if the texture is not valid or color modulation
  3381. * is not supported.
  3382. *
  3383. * SDL_GetTextureColorMod()
  3384. *}
  3385. function SDL_SetTextureColorMod(texture: PSDL_Texture; r: UInt8; g: UInt8; b: UInt8): SInt32;
  3386. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetTextureColorMod' {$ENDIF} {$ENDIF};
  3387. {**
  3388. * Get the additional color value used in render copy operations.
  3389. *
  3390. * texture The texture to query.
  3391. * r A pointer filled in with the current red color value.
  3392. * g A pointer filled in with the current green color value.
  3393. * b A pointer filled in with the current blue color value.
  3394. *
  3395. * 0 on success, or -1 if the texture is not valid.
  3396. *
  3397. * SDL_SetTextureColorMod()
  3398. *}
  3399. function SDL_GetTextureColorMod(texture: PSDL_Texture; r: PUInt8; g: PUInt8; b: PUInt8): SInt32;
  3400. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetTextureColorMod' {$ENDIF} {$ENDIF};
  3401. {**
  3402. * Set an additional alpha value used in render copy operations.
  3403. *
  3404. * texture The texture to update.
  3405. * alpha The alpha value multiplied into copy operations.
  3406. *
  3407. * 0 on success, or -1 if the texture is not valid or alpha modulation
  3408. * is not supported.
  3409. *
  3410. * SDL_GetTextureAlphaMod()
  3411. *}
  3412. function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: UInt8): SInt32;
  3413. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetTextureAlphaMod' {$ENDIF} {$ENDIF};
  3414. {**
  3415. * Get the additional alpha value used in render copy operations.
  3416. *
  3417. * texture The texture to query.
  3418. * alpha A pointer filled in with the current alpha value.
  3419. *
  3420. * 0 on success, or -1 if the texture is not valid.
  3421. *
  3422. * SDL_SetTextureAlphaMod()
  3423. *}
  3424. function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: PUInt8): SInt32;
  3425. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetTextureAlphaMod' {$ENDIF} {$ENDIF};
  3426. {**
  3427. * Set the blend mode used for texture copy operations.
  3428. *
  3429. * texture The texture to update.
  3430. * blendMode ::SDL_BlendMode to use for texture blending.
  3431. *
  3432. * 0 on success, or -1 if the texture is not valid or the blend mode is
  3433. * not supported.
  3434. *
  3435. * If the blend mode is not supported, the closest supported mode is
  3436. * chosen.
  3437. *
  3438. * SDL_GetTextureBlendMode()
  3439. *}
  3440. function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): SInt32;
  3441. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetTextureBlendMode' {$ENDIF} {$ENDIF};
  3442. {**
  3443. * Get the blend mode used for texture copy operations.
  3444. *
  3445. * texture The texture to query.
  3446. * blendMode A pointer filled in with the current blend mode.
  3447. *
  3448. * 0 on success, or -1 if the texture is not valid.
  3449. *
  3450. * SDL_SetTextureBlendMode()
  3451. *}
  3452. function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): SInt32;
  3453. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetTextureBlendMode' {$ENDIF} {$ENDIF};
  3454. {**
  3455. * Update the given texture rectangle with new pixel data.
  3456. *
  3457. * texture The texture to update
  3458. * rect A pointer to the rectangle of pixels to update, or NULL to
  3459. * update the entire texture.
  3460. * pixels The raw pixel data.
  3461. * pitch The number of bytes between rows of pixel data.
  3462. *
  3463. * 0 on success, or -1 if the texture is not valid.
  3464. *
  3465. * This is a fairly slow function.
  3466. *}
  3467. function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: SInt32): SInt32;
  3468. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UpdateTexture' {$ENDIF} {$ENDIF};
  3469. {**
  3470. * Lock a portion of the texture for write-only pixel access.
  3471. *
  3472. * texture The texture to lock for access, which was created with
  3473. * SDL_TEXTUREACCESS_STREAMING.
  3474. * rect A pointer to the rectangle to lock for access. If the rect
  3475. * is NULL, the entire texture will be locked.
  3476. * pixels This is filled in with a pointer to the locked pixels,
  3477. * appropriately offset by the locked area.
  3478. * pitch This is filled in with the pitch of the locked pixels.
  3479. *
  3480. * 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
  3481. *
  3482. * SDL_UnlockTexture()
  3483. *}
  3484. function SDL_LockTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: PPointer; pitch: PInt): SInt32;
  3485. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF};
  3486. {**
  3487. * Unlock a texture, uploading the changes to video memory, if needed.
  3488. *
  3489. * SDL_LockTexture()
  3490. *}
  3491. procedure SDL_UnlockTexture(texture: PSDL_Texture);
  3492. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF};
  3493. {**
  3494. * Determines whether a window supports the use of render targets
  3495. *
  3496. * renderer The renderer that will be checked
  3497. *
  3498. * SDL_TRUE if supported, SDL_FALSE if not.
  3499. *}
  3500. function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean;
  3501. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderTargetSupported' {$ENDIF} {$ENDIF};
  3502. {**
  3503. * Set a texture as the current rendering target.
  3504. *
  3505. * renderer The renderer.
  3506. * texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
  3507. *
  3508. * 0 on success, or -1 on error
  3509. *
  3510. * SDL_GetRenderTarget()
  3511. *}
  3512. function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): SInt32;
  3513. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetRenderTarget' {$ENDIF} {$ENDIF};
  3514. {**
  3515. * Get the current render target or NULL for the default render target.
  3516. *
  3517. * The current render target
  3518. *
  3519. * SDL_SetRenderTarget()
  3520. *}
  3521. function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture;
  3522. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRenderTarget' {$ENDIF} {$ENDIF};
  3523. {**
  3524. * Set device independent resolution for rendering
  3525. *
  3526. * renderer The renderer for which resolution should be set.
  3527. * w The width of the logical resolution
  3528. * h The height of the logical resolution
  3529. *
  3530. * This function uses the viewport and scaling functionality to allow a fixed logical
  3531. * resolution for rendering, regardless of the actual output resolution. If the actual
  3532. * output resolution doesn't have the same aspect ratio the output rendering will be
  3533. * centered within the output display.
  3534. *
  3535. * If the output display is a window, mouse events in the window will be filtered
  3536. * and scaled so they seem to arrive within the logical resolution.
  3537. *
  3538. * If this function results in scaling or subpixel drawing by the
  3539. * rendering backend, it will be handled using the appropriate
  3540. * quality hints.
  3541. *
  3542. * SDL_RenderGetLogicalSize()
  3543. * SDL_RenderSetScale()
  3544. * SDL_RenderSetViewport()
  3545. *}
  3546. function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: SInt32; h: SInt32): SInt32;
  3547. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderSetLogicalSize' {$ENDIF} {$ENDIF};
  3548. {**
  3549. * Get device independent resolution for rendering
  3550. *
  3551. * renderer The renderer from which resolution should be queried.
  3552. * w A pointer filled with the width of the logical resolution
  3553. * h A pointer filled with the height of the logical resolution
  3554. *
  3555. * SDL_RenderSetLogicalSize()
  3556. *}
  3557. procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: PInt; h: PInt);
  3558. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderGetLogicalSize' {$ENDIF} {$ENDIF};
  3559. {**
  3560. * Set the drawing area for rendering on the current target.
  3561. *
  3562. * renderer The renderer for which the drawing area should be set.
  3563. * rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
  3564. *
  3565. * The x,y of the viewport rect represents the origin for rendering.
  3566. *
  3567. * 0 on success, or -1 on error
  3568. *
  3569. * If the window associated with the renderer is resized, the viewport is automatically reset.
  3570. *
  3571. * SDL_RenderGetViewport()
  3572. * SDL_RenderSetLogicalSize()
  3573. *}
  3574. function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): SInt32;
  3575. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderSetViewport' {$ENDIF} {$ENDIF};
  3576. {**
  3577. * Get the drawing area for the current target.
  3578. *
  3579. * SDL_RenderSetViewport()
  3580. *}
  3581. procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect);
  3582. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderGetViewport' {$ENDIF} {$ENDIF};
  3583. {**
  3584. * Set the clip rectangle for the current target.
  3585. *
  3586. * renderer The renderer for which clip rectangle should be set.
  3587. * rect A pointer to the rectangle to set as the clip rectangle, or
  3588. * NULL to disable clipping.
  3589. *
  3590. * 0 on success, or -1 on error
  3591. *
  3592. * SDL_RenderGetClipRect()
  3593. *}
  3594. function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32;
  3595. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderSetClipRect' {$ENDIF} {$ENDIF};
  3596. {**
  3597. * Get the clip rectangle for the current target.
  3598. *
  3599. * renderer The renderer from which clip rectangle should be queried.
  3600. * rect A pointer filled in with the current clip rectangle, or
  3601. * an empty rectangle if clipping is disabled.
  3602. *
  3603. * SDL_RenderSetClipRect()
  3604. *}
  3605. procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect);
  3606. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderGetClipRect' {$ENDIF} {$ENDIF};
  3607. {**
  3608. * Set the drawing scale for rendering on the current target.
  3609. *
  3610. * renderer The renderer for which the drawing scale should be set.
  3611. * scaleX The horizontal scaling factor
  3612. * scaleY The vertical scaling factor
  3613. *
  3614. * The drawing coordinates are scaled by the x/y scaling factors
  3615. * before they are used by the renderer. This allows resolution
  3616. * independent drawing with a single coordinate system.
  3617. *
  3618. * If this results in scaling or subpixel drawing by the
  3619. * rendering backend, it will be handled using the appropriate
  3620. * quality hints. For best results use integer scaling factors.
  3621. *
  3622. * SDL_RenderGetScale()
  3623. * SDL_RenderSetLogicalSize()
  3624. *}
  3625. function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: Float; scaleY: Float): SInt32;
  3626. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderSetScale' {$ENDIF} {$ENDIF};
  3627. {**
  3628. * Get the drawing scale for the current target.
  3629. *
  3630. * renderer The renderer from which drawing scale should be queried.
  3631. * scaleX A pointer filled in with the horizontal scaling factor
  3632. * scaleY A pointer filled in with the vertical scaling factor
  3633. *
  3634. * SDL_RenderSetScale()
  3635. *}
  3636. procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: PFloat; scaleY: PFloat);
  3637. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderGetScale' {$ENDIF} {$ENDIF};
  3638. {**
  3639. * Set the color used for drawing operations (Rect, Line and Clear).
  3640. *
  3641. * renderer The renderer for which drawing color should be set.
  3642. * r The red value used to draw on the rendering target.
  3643. * g The green value used to draw on the rendering target.
  3644. * b The blue value used to draw on the rendering target.
  3645. * a The alpha value used to draw on the rendering target, usually
  3646. * SDL_ALPHA_OPAQUE (255).
  3647. *
  3648. * 0 on success, or -1 on error
  3649. *}
  3650. function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: UInt8; g: UInt8; b: UInt8; a: UInt8): SInt32;
  3651. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetRenderDrawColor' {$ENDIF} {$ENDIF};
  3652. {**
  3653. * Get the color used for drawing operations (Rect, Line and Clear).
  3654. *
  3655. * renderer The renderer from which drawing color should be queried.
  3656. * r A pointer to the red value used to draw on the rendering target.
  3657. * g A pointer to the green value used to draw on the rendering target.
  3658. * b A pointer to the blue value used to draw on the rendering target.
  3659. * a A pointer to the alpha value used to draw on the rendering target,
  3660. * usually SDL_ALPHA_OPAQUE (255).
  3661. *
  3662. * 0 on success, or -1 on error
  3663. *}
  3664. function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: PUInt8; g: PUInt8; b: PUInt8; a: PUInt8): SInt32;
  3665. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRenderDrawColor' {$ENDIF} {$ENDIF};
  3666. {**
  3667. * Set the blend mode used for drawing operations (Fill and Line).
  3668. *
  3669. * renderer The renderer for which blend mode should be set.
  3670. * blendMode SDL_BlendMode to use for blending.
  3671. *
  3672. * 0 on success, or -1 on error
  3673. *
  3674. * If the blend mode is not supported, the closest supported mode is
  3675. * chosen.
  3676. *
  3677. * SDL_GetRenderDrawBlendMode()
  3678. *}
  3679. function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): SInt32;
  3680. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF} {$ENDIF};
  3681. {**
  3682. * Get the blend mode used for drawing operations.
  3683. *
  3684. * renderer The renderer from which blend mode should be queried.
  3685. * blendMode A pointer filled in with the current blend mode.
  3686. *
  3687. * 0 on success, or -1 on error
  3688. *
  3689. * SDL_SetRenderDrawBlendMode()
  3690. *}
  3691. function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): SInt32;
  3692. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF} {$ENDIF};
  3693. {**
  3694. * Clear the current rendering target with the drawing color
  3695. *
  3696. * This function clears the entire rendering target, ignoring the viewport.
  3697. *
  3698. * 0 on success, or -1 on error
  3699. *}
  3700. function SDL_RenderClear(renderer: PSDL_Renderer): SInt32;
  3701. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderClear' {$ENDIF} {$ENDIF};
  3702. {**
  3703. * Draw a point on the current rendering target.
  3704. *
  3705. * renderer The renderer which should draw a point.
  3706. * x The x coordinate of the point.
  3707. * y The y coordinate of the point.
  3708. *
  3709. * 0 on success, or -1 on error
  3710. *}
  3711. function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: SInt32; y: SInt32): SInt32;
  3712. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF};
  3713. {**
  3714. * Draw multiple points on the current rendering target.
  3715. *
  3716. * renderer The renderer which should draw multiple points.
  3717. * points The points to draw
  3718. * count The number of points to draw
  3719. *
  3720. * 0 on success, or -1 on error
  3721. *}
  3722. function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: SInt32): SInt32;
  3723. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF};
  3724. {**
  3725. * Draw a line on the current rendering target.
  3726. *
  3727. * renderer The renderer which should draw a line.
  3728. * x1 The x coordinate of the start point.
  3729. * y1 The y coordinate of the start point.
  3730. * x2 The x coordinate of the end point.
  3731. * y2 The y coordinate of the end point.
  3732. *
  3733. * 0 on success, or -1 on error
  3734. *}
  3735. function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: SInt32; y1: SInt32; x2: SInt32; y2: SInt32): SInt32;
  3736. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF};
  3737. {**
  3738. * \brief Draw a series of connected lines on the current rendering target.
  3739. *
  3740. * \param renderer The renderer which should draw multiple lines.
  3741. * \param points The points along the lines
  3742. * \param count The number of points, drawing count-1 lines
  3743. *
  3744. * \return 0 on success, or -1 on error
  3745. *}
  3746. function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: SInt32): SInt32;
  3747. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF};
  3748. {**
  3749. * Draw a rectangle on the current rendering target.
  3750. *
  3751. * renderer The renderer which should draw a rectangle.
  3752. * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
  3753. *
  3754. * 0 on success, or -1 on error
  3755. *}
  3756. function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32;
  3757. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF};
  3758. {**
  3759. * Draw some number of rectangles on the current rendering target.
  3760. *
  3761. * renderer The renderer which should draw multiple rectangles.
  3762. * rects A pointer to an array of destination rectangles.
  3763. * count The number of rectangles.
  3764. *
  3765. * 0 on success, or -1 on error
  3766. *}
  3767. function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: SInt32): SInt32;
  3768. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF};
  3769. {**
  3770. * Fill a rectangle on the current rendering target with the drawing color.
  3771. *
  3772. * renderer The renderer which should fill a rectangle.
  3773. * rect A pointer to the destination rectangle, or NULL for the entire
  3774. * rendering target.
  3775. *
  3776. * 0 on success, or -1 on error
  3777. *}
  3778. function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32;
  3779. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF};
  3780. {**
  3781. * Fill some number of rectangles on the current rendering target with the drawing color.
  3782. *
  3783. * renderer The renderer which should fill multiple rectangles.
  3784. * rects A pointer to an array of destination rectangles.
  3785. * count The number of rectangles.
  3786. *
  3787. * 0 on success, or -1 on error
  3788. *}
  3789. function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: SInt32): SInt32;
  3790. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF};
  3791. {**
  3792. * Copy a portion of the texture to the current rendering target.
  3793. *
  3794. * renderer The renderer which should copy parts of a texture.
  3795. * texture The source texture.
  3796. * srcrect A pointer to the source rectangle, or NULL for the entire
  3797. * texture.
  3798. * dstrect A pointer to the destination rectangle, or NULL for the
  3799. * entire rendering target.
  3800. *
  3801. * 0 on success, or -1 on error
  3802. *}
  3803. function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): SInt32;
  3804. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF};
  3805. {**
  3806. * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
  3807. *
  3808. * renderer The renderer which should copy parts of a texture.
  3809. * texture The source texture.
  3810. * srcrect A pointer to the source rectangle, or NULL for the entire
  3811. * texture.
  3812. * dstrect A pointer to the destination rectangle, or NULL for the
  3813. * entire rendering target.
  3814. * angle An angle in degrees that indicates the rotation that will be applied to dstrect
  3815. * center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2)
  3816. * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
  3817. *
  3818. * 0 on success, or -1 on error
  3819. *}
  3820. function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: Double; center: PSDL_Point; flip: PSDL_RendererFlip): SInt32;
  3821. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderCopyEx' {$ENDIF} {$ENDIF};
  3822. {**
  3823. * Read pixels from the current rendering target.
  3824. *
  3825. * renderer The renderer from which pixels should be read.
  3826. * rect A pointer to the rectangle to read, or NULL for the entire
  3827. * render target.
  3828. * format The desired format of the pixel data, or 0 to use the format
  3829. * of the rendering target
  3830. * pixels A pointer to be filled in with the pixel data
  3831. * pitch The pitch of the pixels parameter.
  3832. *
  3833. * 0 on success, or -1 if pixel reading is not supported.
  3834. *
  3835. * This is a very slow operation, and should not be used frequently.
  3836. *}
  3837. function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: UInt32; pixels: Pointer; pitch: SInt32): SInt32;
  3838. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderReadPixels' {$ENDIF} {$ENDIF};
  3839. {**
  3840. * Update the screen with rendering performed.
  3841. *}
  3842. procedure SDL_RenderPresent(renderer: PSDL_Renderer);
  3843. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RenderPresent' {$ENDIF} {$ENDIF};
  3844. {**
  3845. * Destroy the specified texture.
  3846. *
  3847. * SDL_CreateTexture()
  3848. * SDL_CreateTextureFromSurface()
  3849. *}
  3850. procedure SDL_DestroyTexture(texture: PSDL_Texture);
  3851. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DestroyTexture' {$ENDIF} {$ENDIF};
  3852. {**
  3853. * Destroy the rendering context for a window and free associated
  3854. * textures.
  3855. *
  3856. * SDL_CreateRenderer()
  3857. *}
  3858. procedure SDL_DestroyRenderer(renderer: PSDL_Renderer);
  3859. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DestroyRenderer' {$ENDIF} {$ENDIF};
  3860. {**
  3861. * Bind the texture to the current OpenGL/ES/ES2 context for use with
  3862. * OpenGL instructions.
  3863. *
  3864. * texture The SDL texture to bind
  3865. * texw A pointer to a float that will be filled with the texture width
  3866. * texh A pointer to a float that will be filled with the texture height
  3867. *
  3868. * 0 on success, or -1 if the operation is not supported
  3869. *}
  3870. function SDL_GL_BindTexture(texture: PSDL_Texture; texw: PFloat; texh: PFloat): SInt32;
  3871. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_BindTexture' {$ENDIF} {$ENDIF};
  3872. {**
  3873. * Unbind a texture from the current OpenGL/ES/ES2 context.
  3874. *
  3875. * texture The SDL texture to unbind
  3876. *
  3877. * 0 on success, or -1 if the operation is not supported
  3878. *}
  3879. function SDL_GL_UnbindTexture(texture: PSDL_Texture): SInt32;
  3880. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF};
  3881. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  3882. ////////////////////// SDL_scancode.h ////////////////////////////////////////////////////
  3883. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  3884. {**
  3885. * The SDL keyboard scancode representation.
  3886. *
  3887. * Values of this type are used to represent keyboard keys, among other places
  3888. * in the SDL_Keysym.scancode key.keysym.scancode \endlink field of the
  3889. * SDL_Event structure.
  3890. *
  3891. * The values in this enumeration are based on the USB usage page standard:
  3892. * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
  3893. *}
  3894. const
  3895. SDL_SCANCODE_UNKNOWN = 0;
  3896. {**
  3897. * Usage page $07
  3898. *
  3899. * These values are from usage page $07 (USB keyboard page).
  3900. *}
  3901. SDL_SCANCODE_A = 4;
  3902. SDL_SCANCODE_B = 5;
  3903. SDL_SCANCODE_C = 6;
  3904. SDL_SCANCODE_D = 7;
  3905. SDL_SCANCODE_E = 8;
  3906. SDL_SCANCODE_F = 9;
  3907. SDL_SCANCODE_G = 10;
  3908. SDL_SCANCODE_H = 11;
  3909. SDL_SCANCODE_I = 12;
  3910. SDL_SCANCODE_J = 13;
  3911. SDL_SCANCODE_K = 14;
  3912. SDL_SCANCODE_L = 15;
  3913. SDL_SCANCODE_M = 16;
  3914. SDL_SCANCODE_N = 17;
  3915. SDL_SCANCODE_O = 18;
  3916. SDL_SCANCODE_P = 19;
  3917. SDL_SCANCODE_Q = 20;
  3918. SDL_SCANCODE_R = 21;
  3919. SDL_SCANCODE_S = 22;
  3920. SDL_SCANCODE_T = 23;
  3921. SDL_SCANCODE_U = 24;
  3922. SDL_SCANCODE_V = 25;
  3923. SDL_SCANCODE_W = 26;
  3924. SDL_SCANCODE_X = 27;
  3925. SDL_SCANCODE_Y = 28;
  3926. SDL_SCANCODE_Z = 29;
  3927. SDL_SCANCODE_1 = 30;
  3928. SDL_SCANCODE_2 = 31;
  3929. SDL_SCANCODE_3 = 32;
  3930. SDL_SCANCODE_4 = 33;
  3931. SDL_SCANCODE_5 = 34;
  3932. SDL_SCANCODE_6 = 35;
  3933. SDL_SCANCODE_7 = 36;
  3934. SDL_SCANCODE_8 = 37;
  3935. SDL_SCANCODE_9 = 38;
  3936. SDL_SCANCODE_0 = 39;
  3937. SDL_SCANCODE_RETURN = 40;
  3938. SDL_SCANCODE_ESCAPE = 41;
  3939. SDL_SCANCODE_BACKSPACE = 42;
  3940. SDL_SCANCODE_TAB = 43;
  3941. SDL_SCANCODE_SPACE = 44;
  3942. SDL_SCANCODE_MINUS = 45;
  3943. SDL_SCANCODE_EQUALS = 46;
  3944. SDL_SCANCODE_LEFTBRACKET = 47;
  3945. SDL_SCANCODE_RIGHTBRACKET = 48;
  3946. SDL_SCANCODE_BACKSLASH = 49; {**< Located at the lower left of the return
  3947. * key on ISO keyboards and at the right end
  3948. * of the QWERTY row on ANSI keyboards.
  3949. * Produces REVERSE SOLIDUS (backslash) and
  3950. * VERTICAL LINE in a US layout; REVERSE
  3951. * SOLIDUS and VERTICAL LINE in a UK Mac
  3952. * layout; NUMBER SIGN and TILDE in a UK
  3953. * Windows layout; DOLLAR SIGN and POUND SIGN
  3954. * in a Swiss German layout; NUMBER SIGN and
  3955. * APOSTROPHE in a German layout; GRAVE
  3956. * ACCENT and POUND SIGN in a French Mac
  3957. * layout; and ASTERISK and MICRO SIGN in a
  3958. * French Windows layout.
  3959. *}
  3960. SDL_SCANCODE_NONUSHASH = 50; {**< ISO USB keyboards actually use this code
  3961. * instead of 49 for the same key; but all
  3962. * OSes I've seen treat the two codes
  3963. * identically. So; as an implementor; unless
  3964. * your keyboard generates both of those
  3965. * codes and your OS treats them differently;
  3966. * you should generate SDL_SCANCODE_BACKSLASH
  3967. * instead of this code. As a user; you
  3968. * should not rely on this code because SDL
  3969. * will never generate it with most (all?)
  3970. * keyboards.
  3971. *}
  3972. SDL_SCANCODE_SEMICOLON = 51;
  3973. SDL_SCANCODE_APOSTROPHE = 52;
  3974. SDL_SCANCODE_GRAVE = 53; {**< Located in the top left corner (on both ANSI
  3975. * and ISO keyboards). Produces GRAVE ACCENT and
  3976. * TILDE in a US Windows layout and in US and UK
  3977. * Mac layouts on ANSI keyboards; GRAVE ACCENT
  3978. * and NOT SIGN in a UK Windows layout; SECTION
  3979. * SIGN and PLUS-MINUS SIGN in US and UK Mac
  3980. * layouts on ISO keyboards; SECTION SIGN and
  3981. * DEGREE SIGN in a Swiss German layout (Mac:
  3982. * only on ISO keyboards); CIRCUMFLEX ACCENT and
  3983. * DEGREE SIGN in a German layout (Mac: only on
  3984. * ISO keyboards); SUPERSCRIPT TWO and TILDE in a
  3985. * French Windows layout; COMMERCIAL AT and
  3986. * NUMBER SIGN in a French Mac layout on ISO
  3987. * keyboards; and LESS-THAN SIGN and GREATER-THAN
  3988. * SIGN in a Swiss German; German; or French Mac
  3989. * layout on ANSI keyboards.
  3990. *}
  3991. SDL_SCANCODE_COMMA = 54;
  3992. SDL_SCANCODE_PERIOD = 55;
  3993. SDL_SCANCODE_SLASH = 56;
  3994. SDL_SCANCODE_CAPSLOCK = 57;
  3995. SDL_SCANCODE_F1 = 58;
  3996. SDL_SCANCODE_F2 = 59;
  3997. SDL_SCANCODE_F3 = 60;
  3998. SDL_SCANCODE_F4 = 61;
  3999. SDL_SCANCODE_F5 = 62;
  4000. SDL_SCANCODE_F6 = 63;
  4001. SDL_SCANCODE_F7 = 64;
  4002. SDL_SCANCODE_F8 = 65;
  4003. SDL_SCANCODE_F9 = 66;
  4004. SDL_SCANCODE_F10 = 67;
  4005. SDL_SCANCODE_F11 = 68;
  4006. SDL_SCANCODE_F12 = 69;
  4007. SDL_SCANCODE_PRINTSCREEN = 70;
  4008. SDL_SCANCODE_SCROLLLOCK = 71;
  4009. SDL_SCANCODE_PAUSE = 72;
  4010. SDL_SCANCODE_INSERT = 73; {**< insert on PC; help on some Mac keyboards (but
  4011. does send code 73; not 117) *}
  4012. SDL_SCANCODE_HOME = 74;
  4013. SDL_SCANCODE_PAGEUP = 75;
  4014. SDL_SCANCODE_DELETE = 76;
  4015. SDL_SCANCODE_END = 77;
  4016. SDL_SCANCODE_PAGEDOWN = 78;
  4017. SDL_SCANCODE_RIGHT = 79;
  4018. SDL_SCANCODE_LEFT = 80;
  4019. SDL_SCANCODE_DOWN = 81;
  4020. SDL_SCANCODE_UP = 82;
  4021. SDL_SCANCODE_NUMLOCKCLEAR = 83; {**< num lock on PC; clear on Mac keyboards
  4022. *}
  4023. SDL_SCANCODE_KP_DIVIDE = 84;
  4024. SDL_SCANCODE_KP_MULTIPLY = 85;
  4025. SDL_SCANCODE_KP_MINUS = 86;
  4026. SDL_SCANCODE_KP_PLUS = 87;
  4027. SDL_SCANCODE_KP_ENTER = 88;
  4028. SDL_SCANCODE_KP_1 = 89;
  4029. SDL_SCANCODE_KP_2 = 90;
  4030. SDL_SCANCODE_KP_3 = 91;
  4031. SDL_SCANCODE_KP_4 = 92;
  4032. SDL_SCANCODE_KP_5 = 93;
  4033. SDL_SCANCODE_KP_6 = 94;
  4034. SDL_SCANCODE_KP_7 = 95;
  4035. SDL_SCANCODE_KP_8 = 96;
  4036. SDL_SCANCODE_KP_9 = 97;
  4037. SDL_SCANCODE_KP_0 = 98;
  4038. SDL_SCANCODE_KP_PERIOD = 99;
  4039. SDL_SCANCODE_NONUSBACKSLASH = 100; {**< This is the additional key that ISO
  4040. * keyboards have over ANSI ones;
  4041. * located between left shift and Y.
  4042. * Produces GRAVE ACCENT and TILDE in a
  4043. * US or UK Mac layout; REVERSE SOLIDUS
  4044. * (backslash) and VERTICAL LINE in a
  4045. * US or UK Windows layout; and
  4046. * LESS-THAN SIGN and GREATER-THAN SIGN
  4047. * in a Swiss German; German; or French
  4048. * layout. *}
  4049. SDL_SCANCODE_APPLICATION = 101; {**< windows contextual menu; compose *}
  4050. SDL_SCANCODE_POWER = 102; {**< The USB document says this is a status flag;
  4051. * not a physical key - but some Mac keyboards
  4052. * do have a power key. *}
  4053. SDL_SCANCODE_KP_EQUALS = 103;
  4054. SDL_SCANCODE_F13 = 104;
  4055. SDL_SCANCODE_F14 = 105;
  4056. SDL_SCANCODE_F15 = 106;
  4057. SDL_SCANCODE_F16 = 107;
  4058. SDL_SCANCODE_F17 = 108;
  4059. SDL_SCANCODE_F18 = 109;
  4060. SDL_SCANCODE_F19 = 110;
  4061. SDL_SCANCODE_F20 = 111;
  4062. SDL_SCANCODE_F21 = 112;
  4063. SDL_SCANCODE_F22 = 113;
  4064. SDL_SCANCODE_F23 = 114;
  4065. SDL_SCANCODE_F24 = 115;
  4066. SDL_SCANCODE_EXECUTE = 116;
  4067. SDL_SCANCODE_HELP = 117;
  4068. SDL_SCANCODE_MENU = 118;
  4069. SDL_SCANCODE_SELECT = 119;
  4070. SDL_SCANCODE_STOP = 120;
  4071. SDL_SCANCODE_AGAIN = 121; {**< redo *}
  4072. SDL_SCANCODE_UNDO = 122;
  4073. SDL_SCANCODE_CUT = 123;
  4074. SDL_SCANCODE_COPY = 124;
  4075. SDL_SCANCODE_PASTE = 125;
  4076. SDL_SCANCODE_FIND = 126;
  4077. SDL_SCANCODE_MUTE = 127;
  4078. SDL_SCANCODE_VOLUMEUP = 128;
  4079. SDL_SCANCODE_VOLUMEDOWN = 129;
  4080. {* not sure whether there's a reason to enable these *}
  4081. {* SDL_SCANCODE_LOCKINGCAPSLOCK = 130; *}
  4082. {* SDL_SCANCODE_LOCKINGNUMLOCK = 131; *}
  4083. {* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132; *}
  4084. SDL_SCANCODE_KP_COMMA = 133;
  4085. SDL_SCANCODE_KP_EQUALSAS400 = 134;
  4086. SDL_SCANCODE_INTERNATIONAL1 = 135; {**< used on Asian keyboards; see footnotes in USB doc *}
  4087. SDL_SCANCODE_INTERNATIONAL2 = 136;
  4088. SDL_SCANCODE_INTERNATIONAL3 = 137; {**< Yen *}
  4089. SDL_SCANCODE_INTERNATIONAL4 = 138;
  4090. SDL_SCANCODE_INTERNATIONAL5 = 139;
  4091. SDL_SCANCODE_INTERNATIONAL6 = 140;
  4092. SDL_SCANCODE_INTERNATIONAL7 = 141;
  4093. SDL_SCANCODE_INTERNATIONAL8 = 142;
  4094. SDL_SCANCODE_INTERNATIONAL9 = 143;
  4095. SDL_SCANCODE_LANG1 = 144; {**< Hangul{English toggle *}
  4096. SDL_SCANCODE_LANG2 = 145; {**< Hanja conversion *}
  4097. SDL_SCANCODE_LANG3 = 146; {**< Katakana *}
  4098. SDL_SCANCODE_LANG4 = 147; {**< Hiragana *}
  4099. SDL_SCANCODE_LANG5 = 148; {**< Zenkaku{Hankaku *}
  4100. SDL_SCANCODE_LANG6 = 149; {**< reserved *}
  4101. SDL_SCANCODE_LANG7 = 150; {**< reserved *}
  4102. SDL_SCANCODE_LANG8 = 151; {**< reserved *}
  4103. SDL_SCANCODE_LANG9 = 152; {**< reserved *}
  4104. SDL_SCANCODE_ALTERASE = 153; {**< Erase-Eaze *}
  4105. SDL_SCANCODE_SYSREQ = 154;
  4106. SDL_SCANCODE_CANCEL = 155;
  4107. SDL_SCANCODE_CLEAR = 156;
  4108. SDL_SCANCODE_PRIOR = 157;
  4109. SDL_SCANCODE_RETURN2 = 158;
  4110. SDL_SCANCODE_SEPARATOR = 159;
  4111. SDL_SCANCODE_OUT = 160;
  4112. SDL_SCANCODE_OPER = 161;
  4113. SDL_SCANCODE_CLEARAGAIN = 162;
  4114. SDL_SCANCODE_CRSEL = 163;
  4115. SDL_SCANCODE_EXSEL = 164;
  4116. SDL_SCANCODE_KP_00 = 176;
  4117. SDL_SCANCODE_KP_000 = 177;
  4118. SDL_SCANCODE_THOUSANDSSEPARATOR = 178;
  4119. SDL_SCANCODE_DECIMALSEPARATOR = 179;
  4120. SDL_SCANCODE_CURRENCYUNIT = 180;
  4121. SDL_SCANCODE_CURRENCYSUBUNIT = 181;
  4122. SDL_SCANCODE_KP_LEFTPAREN = 182;
  4123. SDL_SCANCODE_KP_RIGHTPAREN = 183;
  4124. SDL_SCANCODE_KP_LEFTBRACE = 184;
  4125. SDL_SCANCODE_KP_RIGHTBRACE = 185;
  4126. SDL_SCANCODE_KP_TAB = 186;
  4127. SDL_SCANCODE_KP_BACKSPACE = 187;
  4128. SDL_SCANCODE_KP_A = 188;
  4129. SDL_SCANCODE_KP_B = 189;
  4130. SDL_SCANCODE_KP_C = 190;
  4131. SDL_SCANCODE_KP_D = 191;
  4132. SDL_SCANCODE_KP_E = 192;
  4133. SDL_SCANCODE_KP_F = 193;
  4134. SDL_SCANCODE_KP_XOR = 194;
  4135. SDL_SCANCODE_KP_POWER = 195;
  4136. SDL_SCANCODE_KP_PERCENT = 196;
  4137. SDL_SCANCODE_KP_LESS = 197;
  4138. SDL_SCANCODE_KP_GREATER = 198;
  4139. SDL_SCANCODE_KP_AMPERSAND = 199;
  4140. SDL_SCANCODE_KP_DBLAMPERSAND = 200;
  4141. SDL_SCANCODE_KP_VERTICALBAR = 201;
  4142. SDL_SCANCODE_KP_DBLVERTICALBAR = 202;
  4143. SDL_SCANCODE_KP_COLON = 203;
  4144. SDL_SCANCODE_KP_HASH = 204;
  4145. SDL_SCANCODE_KP_SPACE = 205;
  4146. SDL_SCANCODE_KP_AT = 206;
  4147. SDL_SCANCODE_KP_EXCLAM = 207;
  4148. SDL_SCANCODE_KP_MEMSTORE = 208;
  4149. SDL_SCANCODE_KP_MEMRECALL = 209;
  4150. SDL_SCANCODE_KP_MEMCLEAR = 210;
  4151. SDL_SCANCODE_KP_MEMADD = 211;
  4152. SDL_SCANCODE_KP_MEMSUBTRACT = 212;
  4153. SDL_SCANCODE_KP_MEMMULTIPLY = 213;
  4154. SDL_SCANCODE_KP_MEMDIVIDE = 214;
  4155. SDL_SCANCODE_KP_PLUSMINUS = 215;
  4156. SDL_SCANCODE_KP_CLEAR = 216;
  4157. SDL_SCANCODE_KP_CLEARENTRY = 217;
  4158. SDL_SCANCODE_KP_BINARY = 218;
  4159. SDL_SCANCODE_KP_OCTAL = 219;
  4160. SDL_SCANCODE_KP_DECIMAL = 220;
  4161. SDL_SCANCODE_KP_HEXADECIMAL = 221;
  4162. SDL_SCANCODE_LCTRL = 224;
  4163. SDL_SCANCODE_LSHIFT = 225;
  4164. SDL_SCANCODE_LALT = 226; {**< alt; option *}
  4165. SDL_SCANCODE_LGUI = 227; {**< windows; command (apple); meta *}
  4166. SDL_SCANCODE_RCTRL = 228;
  4167. SDL_SCANCODE_RSHIFT = 229;
  4168. SDL_SCANCODE_RALT = 230; {**< alt gr; option *}
  4169. SDL_SCANCODE_RGUI = 231; {**< windows; command (apple); meta *}
  4170. SDL_SCANCODE_MODE = 257; {**< I'm not sure if this is really not covered
  4171. * by any of the above; but since there's a
  4172. * special KMOD_MODE for it I'm adding it here
  4173. *}
  4174. {*Usage page $07*}
  4175. {**
  4176. * Usage page $0C
  4177. *
  4178. * These values are mapped from usage page $0C (USB consumer page).
  4179. *}
  4180. SDL_SCANCODE_AUDIONEXT = 258;
  4181. SDL_SCANCODE_AUDIOPREV = 259;
  4182. SDL_SCANCODE_AUDIOSTOP = 260;
  4183. SDL_SCANCODE_AUDIOPLAY = 261;
  4184. SDL_SCANCODE_AUDIOMUTE = 262;
  4185. SDL_SCANCODE_MEDIASELECT = 263;
  4186. SDL_SCANCODE_WWW = 264;
  4187. SDL_SCANCODE_MAIL = 265;
  4188. SDL_SCANCODE_CALCULATOR = 266;
  4189. SDL_SCANCODE_COMPUTER = 267;
  4190. SDL_SCANCODE_AC_SEARCH = 268;
  4191. SDL_SCANCODE_AC_HOME = 269;
  4192. SDL_SCANCODE_AC_BACK = 270;
  4193. SDL_SCANCODE_AC_FORWARD = 271;
  4194. SDL_SCANCODE_AC_STOP = 272;
  4195. SDL_SCANCODE_AC_REFRESH = 273;
  4196. SDL_SCANCODE_AC_BOOKMARKS = 274;
  4197. {*Usage page $0C*}
  4198. {**
  4199. * Walther keys
  4200. *
  4201. * These are values that Christian Walther added (for mac keyboard?).
  4202. *}
  4203. SDL_SCANCODE_BRIGHTNESSDOWN = 275;
  4204. SDL_SCANCODE_BRIGHTNESSUP = 276;
  4205. SDL_SCANCODE_DISPLAYSWITCH = 277; {**< display mirroring{dual display
  4206. switch; video mode switch *}
  4207. SDL_SCANCODE_KBDILLUMTOGGLE = 278;
  4208. SDL_SCANCODE_KBDILLUMDOWN = 279;
  4209. SDL_SCANCODE_KBDILLUMUP = 280;
  4210. SDL_SCANCODE_EJECT = 281;
  4211. SDL_SCANCODE_SLEEP = 282;
  4212. SDL_SCANCODE_APP1 = 283;
  4213. SDL_SCANCODE_APP2 = 284;
  4214. {*Walther keys*}
  4215. {* Add any other keys here. *}
  4216. SDL_NUM_SCANCODES = 512; {**< not a key, just marks the number of scancodes
  4217. for array bounds *}
  4218. type
  4219. PSDL_ScanCode = ^TSDL_ScanCode;
  4220. TSDL_ScanCode = DWord;
  4221. //from "sdl_keycode.h"
  4222. {**
  4223. * The SDL virtual key representation.
  4224. *
  4225. * Values of this type are used to represent keyboard keys using the current
  4226. * layout of the keyboard. These values include Unicode values representing
  4227. * the unmodified character that would be generated by pressing the key, or
  4228. * an SDLK_* constant for those keys that do not generate characters.
  4229. *}
  4230. PSDL_KeyCode = ^TSDL_KeyCode;
  4231. TSDL_KeyCode = SInt32;
  4232. const
  4233. SDLK_SCANCODE_MASK = 1 shl 30;
  4234. SDLK_UNKNOWN = 0;
  4235. SDLK_RETURN = '\r';
  4236. SDLK_ESCAPE = '\033';
  4237. SDLK_BACKSPACE = '\b';
  4238. SDLK_TAB = '\t';
  4239. SDLK_SPACE = ' ';
  4240. SDLK_EXCLAIM = '!';
  4241. SDLK_QUOTEDBL = '"';
  4242. SDLK_HASH = '#';
  4243. SDLK_PERCENT = '%';
  4244. SDLK_DOLLAR = '$';
  4245. SDLK_AMPERSAND = '&';
  4246. SDLK_QUOTE = '\';
  4247. SDLK_LEFTPAREN = '(';
  4248. SDLK_RIGHTPAREN = ')';
  4249. SDLK_ASTERISK = '*';
  4250. SDLK_PLUS = '+';
  4251. SDLK_COMMA = ';';
  4252. SDLK_MINUS = '-';
  4253. SDLK_PERIOD = '.';
  4254. SDLK_SLASH = '/';
  4255. SDLK_0 = '0';
  4256. SDLK_1 = '1';
  4257. SDLK_2 = '2';
  4258. SDLK_3 = '3';
  4259. SDLK_4 = '4';
  4260. SDLK_5 = '5';
  4261. SDLK_6 = '6';
  4262. SDLK_7 = '7';
  4263. SDLK_8 = '8';
  4264. SDLK_9 = '9';
  4265. SDLK_COLON = ':';
  4266. SDLK_SEMICOLON = ';';
  4267. SDLK_LESS = '<';
  4268. SDLK_EQUALS = '=';
  4269. SDLK_GREATER = '>';
  4270. SDLK_QUESTION = '?';
  4271. SDLK_AT = '@';
  4272. {*
  4273. Skip uppercase letters
  4274. *}
  4275. SDLK_LEFTBRACKET = '[';
  4276. SDLK_BACKSLASH = '\\';
  4277. SDLK_RIGHTBRACKET = ']';
  4278. SDLK_CARET = '^';
  4279. SDLK_UNDERSCORE = '_';
  4280. SDLK_BACKQUOTE = '`';
  4281. SDLK_a = 'a';
  4282. SDLK_b = 'b';
  4283. SDLK_c = 'c';
  4284. SDLK_d = 'd';
  4285. SDLK_e = 'e';
  4286. SDLK_f = 'f';
  4287. SDLK_g = 'g';
  4288. SDLK_h = 'h';
  4289. SDLK_i = 'i';
  4290. SDLK_j = 'j';
  4291. SDLK_k = 'k';
  4292. SDLK_l = 'l';
  4293. SDLK_m = 'm';
  4294. SDLK_n = 'n';
  4295. SDLK_o = 'o';
  4296. SDLK_p = 'p';
  4297. SDLK_q = 'q';
  4298. SDLK_r = 'r';
  4299. SDLK_s = 's';
  4300. SDLK_t = 't';
  4301. SDLK_u = 'u';
  4302. SDLK_v = 'v';
  4303. SDLK_w = 'w';
  4304. SDLK_x = 'x';
  4305. SDLK_y = 'y';
  4306. SDLK_z = 'z';
  4307. SDLK_CAPSLOCK = SDL_SCANCODE_CAPSLOCK or SDLK_SCANCODE_MASK;
  4308. SDLK_F1 = SDL_SCANCODE_F1 or SDLK_SCANCODE_MASK;
  4309. SDLK_F2 = SDL_SCANCODE_F2 or SDLK_SCANCODE_MASK;
  4310. SDLK_F3 = SDL_SCANCODE_F3 or SDLK_SCANCODE_MASK;
  4311. SDLK_F4 = SDL_SCANCODE_F4 or SDLK_SCANCODE_MASK;
  4312. SDLK_F5 = SDL_SCANCODE_F5 or SDLK_SCANCODE_MASK;
  4313. SDLK_F6 = SDL_SCANCODE_F6 or SDLK_SCANCODE_MASK;
  4314. SDLK_F7 = SDL_SCANCODE_F7 or SDLK_SCANCODE_MASK;
  4315. SDLK_F8 = SDL_SCANCODE_F8 or SDLK_SCANCODE_MASK;
  4316. SDLK_F9 = SDL_SCANCODE_F9 or SDLK_SCANCODE_MASK;
  4317. SDLK_F10 = SDL_SCANCODE_F10 or SDLK_SCANCODE_MASK;
  4318. SDLK_F11 = SDL_SCANCODE_F11 or SDLK_SCANCODE_MASK;
  4319. SDLK_F12 = SDL_SCANCODE_F12 or SDLK_SCANCODE_MASK;
  4320. SDLK_PRINTSCREEN = SDL_SCANCODE_PRINTSCREEN or SDLK_SCANCODE_MASK;
  4321. SDLK_SCROLLLOCK = SDL_SCANCODE_SCROLLLOCK or SDLK_SCANCODE_MASK;
  4322. SDLK_PAUSE = SDL_SCANCODE_PAUSE or SDLK_SCANCODE_MASK;
  4323. SDLK_INSERT = SDL_SCANCODE_INSERT or SDLK_SCANCODE_MASK;
  4324. SDLK_HOME = SDL_SCANCODE_HOME or SDLK_SCANCODE_MASK;
  4325. SDLK_PAGEUP = SDL_SCANCODE_PAGEUP or SDLK_SCANCODE_MASK;
  4326. SDLK_DELETE = '\177';
  4327. SDLK_END = SDL_SCANCODE_END or SDLK_SCANCODE_MASK;
  4328. SDLK_PAGEDOWN = SDL_SCANCODE_PAGEDOWN or SDLK_SCANCODE_MASK;
  4329. SDLK_RIGHT = SDL_SCANCODE_RIGHT or SDLK_SCANCODE_MASK;
  4330. SDLK_LEFT = SDL_SCANCODE_LEFT or SDLK_SCANCODE_MASK;
  4331. SDLK_DOWN = SDL_SCANCODE_DOWN or SDLK_SCANCODE_MASK;
  4332. SDLK_UP = SDL_SCANCODE_UP or SDLK_SCANCODE_MASK;
  4333. SDLK_NUMLOCKCLEAR = SDL_SCANCODE_NUMLOCKCLEAR or SDLK_SCANCODE_MASK;
  4334. SDLK_KP_DIVIDE = SDL_SCANCODE_KP_DIVIDE or SDLK_SCANCODE_MASK;
  4335. SDLK_KP_MULTIPLY = SDL_SCANCODE_KP_MULTIPLY or SDLK_SCANCODE_MASK;
  4336. SDLK_KP_MINUS = SDL_SCANCODE_KP_MINUS or SDLK_SCANCODE_MASK;
  4337. SDLK_KP_PLUS = SDL_SCANCODE_KP_PLUS or SDLK_SCANCODE_MASK;
  4338. SDLK_KP_ENTER = SDL_SCANCODE_KP_ENTER or SDLK_SCANCODE_MASK;
  4339. SDLK_KP_1 = SDL_SCANCODE_KP_1 or SDLK_SCANCODE_MASK;
  4340. SDLK_KP_2 = SDL_SCANCODE_KP_2 or SDLK_SCANCODE_MASK;
  4341. SDLK_KP_3 = SDL_SCANCODE_KP_3 or SDLK_SCANCODE_MASK;
  4342. SDLK_KP_4 = SDL_SCANCODE_KP_4 or SDLK_SCANCODE_MASK;
  4343. SDLK_KP_5 = SDL_SCANCODE_KP_5 or SDLK_SCANCODE_MASK;
  4344. SDLK_KP_6 = SDL_SCANCODE_KP_6 or SDLK_SCANCODE_MASK;
  4345. SDLK_KP_7 = SDL_SCANCODE_KP_7 or SDLK_SCANCODE_MASK;
  4346. SDLK_KP_8 = SDL_SCANCODE_KP_8 or SDLK_SCANCODE_MASK;
  4347. SDLK_KP_9 = SDL_SCANCODE_KP_9 or SDLK_SCANCODE_MASK;
  4348. SDLK_KP_0 = SDL_SCANCODE_KP_0 or SDLK_SCANCODE_MASK;
  4349. SDLK_KP_PERIOD = SDL_SCANCODE_KP_PERIOD or SDLK_SCANCODE_MASK;
  4350. SDLK_APPLICATION = SDL_SCANCODE_APPLICATION or SDLK_SCANCODE_MASK;
  4351. SDLK_POWER = SDL_SCANCODE_POWER or SDLK_SCANCODE_MASK;
  4352. SDLK_KP_EQUALS = SDL_SCANCODE_KP_EQUALS or SDLK_SCANCODE_MASK;
  4353. SDLK_F13 = SDL_SCANCODE_F13 or SDLK_SCANCODE_MASK;
  4354. SDLK_F14 = SDL_SCANCODE_F14 or SDLK_SCANCODE_MASK;
  4355. SDLK_F15 = SDL_SCANCODE_F15 or SDLK_SCANCODE_MASK;
  4356. SDLK_F16 = SDL_SCANCODE_F16 or SDLK_SCANCODE_MASK;
  4357. SDLK_F17 = SDL_SCANCODE_F17 or SDLK_SCANCODE_MASK;
  4358. SDLK_F18 = SDL_SCANCODE_F18 or SDLK_SCANCODE_MASK;
  4359. SDLK_F19 = SDL_SCANCODE_F19 or SDLK_SCANCODE_MASK;
  4360. SDLK_F20 = SDL_SCANCODE_F20 or SDLK_SCANCODE_MASK;
  4361. SDLK_F21 = SDL_SCANCODE_F21 or SDLK_SCANCODE_MASK;
  4362. SDLK_F22 = SDL_SCANCODE_F22 or SDLK_SCANCODE_MASK;
  4363. SDLK_F23 = SDL_SCANCODE_F23 or SDLK_SCANCODE_MASK;
  4364. SDLK_F24 = SDL_SCANCODE_F24 or SDLK_SCANCODE_MASK;
  4365. SDLK_EXECUTE = SDL_SCANCODE_EXECUTE or SDLK_SCANCODE_MASK;
  4366. SDLK_HELP = SDL_SCANCODE_HELP or SDLK_SCANCODE_MASK;
  4367. SDLK_MENU = SDL_SCANCODE_MENU or SDLK_SCANCODE_MASK;
  4368. SDLK_SELECT = SDL_SCANCODE_SELECT or SDLK_SCANCODE_MASK;
  4369. SDLK_STOP = SDL_SCANCODE_STOP or SDLK_SCANCODE_MASK;
  4370. SDLK_AGAIN = SDL_SCANCODE_AGAIN or SDLK_SCANCODE_MASK;
  4371. SDLK_UNDO = SDL_SCANCODE_UNDO or SDLK_SCANCODE_MASK;
  4372. SDLK_CUT = SDL_SCANCODE_CUT or SDLK_SCANCODE_MASK;
  4373. SDLK_COPY = SDL_SCANCODE_COPY or SDLK_SCANCODE_MASK;
  4374. SDLK_PASTE = SDL_SCANCODE_PASTE or SDLK_SCANCODE_MASK;
  4375. SDLK_FIND = SDL_SCANCODE_FIND or SDLK_SCANCODE_MASK;
  4376. SDLK_MUTE = SDL_SCANCODE_MUTE or SDLK_SCANCODE_MASK;
  4377. SDLK_VOLUMEUP = SDL_SCANCODE_VOLUMEUP or SDLK_SCANCODE_MASK;
  4378. SDLK_VOLUMEDOWN = SDL_SCANCODE_VOLUMEDOWN or SDLK_SCANCODE_MASK;
  4379. SDLK_KP_COMMA = SDL_SCANCODE_KP_COMMA or SDLK_SCANCODE_MASK;
  4380. SDLK_KP_EQUALSAS400 = SDL_SCANCODE_KP_EQUALSAS400 or SDLK_SCANCODE_MASK;
  4381. SDLK_ALTERASE = SDL_SCANCODE_ALTERASE or SDLK_SCANCODE_MASK;
  4382. SDLK_SYSREQ = SDL_SCANCODE_SYSREQ or SDLK_SCANCODE_MASK;
  4383. SDLK_CANCEL = SDL_SCANCODE_CANCEL or SDLK_SCANCODE_MASK;
  4384. SDLK_CLEAR = SDL_SCANCODE_CLEAR or SDLK_SCANCODE_MASK;
  4385. SDLK_PRIOR = SDL_SCANCODE_PRIOR or SDLK_SCANCODE_MASK;
  4386. SDLK_RETURN2 = SDL_SCANCODE_RETURN2 or SDLK_SCANCODE_MASK;
  4387. SDLK_SEPARATOR = SDL_SCANCODE_SEPARATOR or SDLK_SCANCODE_MASK;
  4388. SDLK_OUT = SDL_SCANCODE_OUT or SDLK_SCANCODE_MASK;
  4389. SDLK_OPER = SDL_SCANCODE_OPER or SDLK_SCANCODE_MASK;
  4390. SDLK_CLEARAGAIN = SDL_SCANCODE_CLEARAGAIN or SDLK_SCANCODE_MASK;
  4391. SDLK_CRSEL = SDL_SCANCODE_CRSEL or SDLK_SCANCODE_MASK;
  4392. SDLK_EXSEL = SDL_SCANCODE_EXSEL or SDLK_SCANCODE_MASK;
  4393. SDLK_KP_00 = SDL_SCANCODE_KP_00 or SDLK_SCANCODE_MASK;
  4394. SDLK_KP_000 = SDL_SCANCODE_KP_000 or SDLK_SCANCODE_MASK;
  4395. SDLK_THOUSANDSSEPARATOR = SDL_SCANCODE_THOUSANDSSEPARATOR or SDLK_SCANCODE_MASK;
  4396. SDLK_DECIMALSEPARATOR = SDL_SCANCODE_DECIMALSEPARATOR or SDLK_SCANCODE_MASK;
  4397. SDLK_CURRENCYUNIT = SDL_SCANCODE_CURRENCYUNIT or SDLK_SCANCODE_MASK;
  4398. SDLK_CURRENCYSUBUNIT = SDL_SCANCODE_CURRENCYSUBUNIT or SDLK_SCANCODE_MASK;
  4399. SDLK_KP_LEFTPAREN = SDL_SCANCODE_KP_LEFTPAREN or SDLK_SCANCODE_MASK;
  4400. SDLK_KP_RIGHTPAREN = SDL_SCANCODE_KP_RIGHTPAREN or SDLK_SCANCODE_MASK;
  4401. SDLK_KP_LEFTBRACE = SDL_SCANCODE_KP_LEFTBRACE or SDLK_SCANCODE_MASK;
  4402. SDLK_KP_RIGHTBRACE = SDL_SCANCODE_KP_RIGHTBRACE or SDLK_SCANCODE_MASK;
  4403. SDLK_KP_TAB = SDL_SCANCODE_KP_TAB or SDLK_SCANCODE_MASK;
  4404. SDLK_KP_BACKSPACE = SDL_SCANCODE_KP_BACKSPACE or SDLK_SCANCODE_MASK;
  4405. SDLK_KP_A = SDL_SCANCODE_KP_A or SDLK_SCANCODE_MASK;
  4406. SDLK_KP_B = SDL_SCANCODE_KP_B or SDLK_SCANCODE_MASK;
  4407. SDLK_KP_C = SDL_SCANCODE_KP_C or SDLK_SCANCODE_MASK;
  4408. SDLK_KP_D = SDL_SCANCODE_KP_D or SDLK_SCANCODE_MASK;
  4409. SDLK_KP_E = SDL_SCANCODE_KP_E or SDLK_SCANCODE_MASK;
  4410. SDLK_KP_F = SDL_SCANCODE_KP_F or SDLK_SCANCODE_MASK;
  4411. SDLK_KP_XOR = SDL_SCANCODE_KP_XOR or SDLK_SCANCODE_MASK;
  4412. SDLK_KP_POWER = SDL_SCANCODE_KP_POWER or SDLK_SCANCODE_MASK;
  4413. SDLK_KP_PERCENT = SDL_SCANCODE_KP_PERCENT or SDLK_SCANCODE_MASK;
  4414. SDLK_KP_LESS = SDL_SCANCODE_KP_LESS or SDLK_SCANCODE_MASK;
  4415. SDLK_KP_GREATER = SDL_SCANCODE_KP_GREATER or SDLK_SCANCODE_MASK;
  4416. SDLK_KP_AMPERSAND = SDL_SCANCODE_KP_AMPERSAND or SDLK_SCANCODE_MASK;
  4417. SDLK_KP_DBLAMPERSAND = SDL_SCANCODE_KP_DBLAMPERSAND or SDLK_SCANCODE_MASK;
  4418. SDLK_KP_VERTICALBAR = SDL_SCANCODE_KP_VERTICALBAR or SDLK_SCANCODE_MASK;
  4419. SDLK_KP_DBLVERTICALBAR = SDL_SCANCODE_KP_DBLVERTICALBAR or SDLK_SCANCODE_MASK;
  4420. SDLK_KP_COLON = SDL_SCANCODE_KP_COLON or SDLK_SCANCODE_MASK;
  4421. SDLK_KP_HASH = SDL_SCANCODE_KP_HASH or SDLK_SCANCODE_MASK;
  4422. SDLK_KP_SPACE = SDL_SCANCODE_KP_SPACE or SDLK_SCANCODE_MASK;
  4423. SDLK_KP_AT = SDL_SCANCODE_KP_AT or SDLK_SCANCODE_MASK;
  4424. SDLK_KP_EXCLAM = SDL_SCANCODE_KP_EXCLAM or SDLK_SCANCODE_MASK;
  4425. SDLK_KP_MEMSTORE = SDL_SCANCODE_KP_MEMSTORE or SDLK_SCANCODE_MASK;
  4426. SDLK_KP_MEMRECALL = SDL_SCANCODE_KP_MEMRECALL or SDLK_SCANCODE_MASK;
  4427. SDLK_KP_MEMCLEAR = SDL_SCANCODE_KP_MEMCLEAR or SDLK_SCANCODE_MASK;
  4428. SDLK_KP_MEMADD = SDL_SCANCODE_KP_MEMADD or SDLK_SCANCODE_MASK;
  4429. SDLK_KP_MEMSUBTRACT = SDL_SCANCODE_KP_MEMSUBTRACT or SDLK_SCANCODE_MASK;
  4430. SDLK_KP_MEMMULTIPLY = SDL_SCANCODE_KP_MEMMULTIPLY or SDLK_SCANCODE_MASK;
  4431. SDLK_KP_MEMDIVIDE = SDL_SCANCODE_KP_MEMDIVIDE or SDLK_SCANCODE_MASK;
  4432. SDLK_KP_PLUSMINUS = SDL_SCANCODE_KP_PLUSMINUS or SDLK_SCANCODE_MASK;
  4433. SDLK_KP_CLEAR = SDL_SCANCODE_KP_CLEAR or SDLK_SCANCODE_MASK;
  4434. SDLK_KP_CLEARENTRY = SDL_SCANCODE_KP_CLEARENTRY or SDLK_SCANCODE_MASK;
  4435. SDLK_KP_BINARY = SDL_SCANCODE_KP_BINARY or SDLK_SCANCODE_MASK;
  4436. SDLK_KP_OCTAL = SDL_SCANCODE_KP_OCTAL or SDLK_SCANCODE_MASK;
  4437. SDLK_KP_DECIMAL = SDL_SCANCODE_KP_DECIMAL or SDLK_SCANCODE_MASK;
  4438. SDLK_KP_HEXADECIMAL = SDL_SCANCODE_KP_HEXADECIMAL or SDLK_SCANCODE_MASK;
  4439. SDLK_LCTRL = SDL_SCANCODE_LCTRL or SDLK_SCANCODE_MASK;
  4440. SDLK_LSHIFT = SDL_SCANCODE_LSHIFT or SDLK_SCANCODE_MASK;
  4441. SDLK_LALT = SDL_SCANCODE_LALT or SDLK_SCANCODE_MASK;
  4442. SDLK_LGUI = SDL_SCANCODE_LGUI or SDLK_SCANCODE_MASK;
  4443. SDLK_RCTRL = SDL_SCANCODE_RCTRL or SDLK_SCANCODE_MASK;
  4444. SDLK_RSHIFT = SDL_SCANCODE_RSHIFT or SDLK_SCANCODE_MASK;
  4445. SDLK_RALT = SDL_SCANCODE_RALT or SDLK_SCANCODE_MASK;
  4446. SDLK_RGUI = SDL_SCANCODE_RGUI or SDLK_SCANCODE_MASK;
  4447. SDLK_MODE = SDL_SCANCODE_MODE or SDLK_SCANCODE_MASK;
  4448. SDLK_AUDIONEXT = SDL_SCANCODE_AUDIONEXT or SDLK_SCANCODE_MASK;
  4449. SDLK_AUDIOPREV = SDL_SCANCODE_AUDIOPREV or SDLK_SCANCODE_MASK;
  4450. SDLK_AUDIOSTOP = SDL_SCANCODE_AUDIOSTOP or SDLK_SCANCODE_MASK;
  4451. SDLK_AUDIOPLAY = SDL_SCANCODE_AUDIOPLAY or SDLK_SCANCODE_MASK;
  4452. SDLK_AUDIOMUTE = SDL_SCANCODE_AUDIOMUTE or SDLK_SCANCODE_MASK;
  4453. SDLK_MEDIASELECT = SDL_SCANCODE_MEDIASELECT or SDLK_SCANCODE_MASK;
  4454. SDLK_WWW = SDL_SCANCODE_WWW or SDLK_SCANCODE_MASK;
  4455. SDLK_MAIL = SDL_SCANCODE_MAIL or SDLK_SCANCODE_MASK;
  4456. SDLK_CALCULATOR = SDL_SCANCODE_CALCULATOR or SDLK_SCANCODE_MASK;
  4457. SDLK_COMPUTER = SDL_SCANCODE_COMPUTER or SDLK_SCANCODE_MASK;
  4458. SDLK_AC_SEARCH = SDL_SCANCODE_AC_SEARCH or SDLK_SCANCODE_MASK;
  4459. SDLK_AC_HOME = SDL_SCANCODE_AC_HOME or SDLK_SCANCODE_MASK;
  4460. SDLK_AC_BACK = SDL_SCANCODE_AC_BACK or SDLK_SCANCODE_MASK;
  4461. SDLK_AC_FORWARD = SDL_SCANCODE_AC_FORWARD or SDLK_SCANCODE_MASK;
  4462. SDLK_AC_STOP = SDL_SCANCODE_AC_STOP or SDLK_SCANCODE_MASK;
  4463. SDLK_AC_REFRESH = SDL_SCANCODE_AC_REFRESH or SDLK_SCANCODE_MASK;
  4464. SDLK_AC_BOOKMARKS = SDL_SCANCODE_AC_BOOKMARKS or SDLK_SCANCODE_MASK;
  4465. SDLK_BRIGHTNESSDOWN = SDL_SCANCODE_BRIGHTNESSDOWN or SDLK_SCANCODE_MASK;
  4466. SDLK_BRIGHTNESSUP = SDL_SCANCODE_BRIGHTNESSUP or SDLK_SCANCODE_MASK;
  4467. SDLK_DISPLAYSWITCH = SDL_SCANCODE_DISPLAYSWITCH or SDLK_SCANCODE_MASK;
  4468. SDLK_KBDILLUMTOGGLE = SDL_SCANCODE_KBDILLUMTOGGLE or SDLK_SCANCODE_MASK;
  4469. SDLK_KBDILLUMDOWN = SDL_SCANCODE_KBDILLUMDOWN or SDLK_SCANCODE_MASK;
  4470. SDLK_KBDILLUMUP = SDL_SCANCODE_KBDILLUMUP or SDLK_SCANCODE_MASK;
  4471. SDLK_EJECT = SDL_SCANCODE_EJECT or SDLK_SCANCODE_MASK;
  4472. SDLK_SLEEP = SDL_SCANCODE_SLEEP or SDLK_SCANCODE_MASK;
  4473. {**
  4474. * Enumeration of valid key mods (possibly OR'd together).
  4475. *}
  4476. KMOD_NONE = $0000;
  4477. KMOD_LSHIFT = $0001;
  4478. KMOD_RSHIFT = $0002;
  4479. KMOD_LCTRL = $0040;
  4480. KMOD_RCTRL = $0080;
  4481. KMOD_LALT = $0100;
  4482. KMOD_RALT = $0200;
  4483. KMOD_LGUI = $0400;
  4484. KMOD_RGUI = $0800;
  4485. KMOD_NUM = $1000;
  4486. KMOD_CAPS = $2000;
  4487. KMOD_MODE = $4000;
  4488. KMOD_RESERVED = $8000;
  4489. type
  4490. PSDL_KeyMod = ^TSDL_KeyMod;
  4491. TSDL_KeyMod = Word;
  4492. const
  4493. KMOD_CTRL = KMOD_LCTRL or KMOD_RCTRL;
  4494. KMOD_SHIFT = KMOD_LSHIFT or KMOD_RSHIFT;
  4495. KMOD_ALT = KMOD_LALT or KMOD_RALT;
  4496. KMOD_GUI = KMOD_LGUI or KMOD_RGUI;
  4497. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  4498. ////////////////////// SDL_keyboard.h ////////////////////////////////////////////////////
  4499. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  4500. type
  4501. {**
  4502. * The SDL keysym structure, used in key events.
  4503. *}
  4504. PSDL_Keysym = ^TSDL_Keysym;
  4505. TSDL_Keysym = record
  4506. scancode: TSDL_ScanCode; // SDL physical key code - see SDL_Scancode for details
  4507. sym: TSDL_KeyCode; // SDL virtual key code - see SDL_Keycode for details
  4508. _mod: UInt16; // current key modifiers
  4509. unicode: UInt32; // (deprecated) use SDL_TextInputEvent instead
  4510. end;
  4511. {**
  4512. * Get the window which currently has keyboard focus.
  4513. *}
  4514. function SDL_GetKeyboardFocus(): PSDL_Window;
  4515. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetKeyboardFocus' {$ENDIF} {$ENDIF};
  4516. {**
  4517. * Get a snapshot of the current state of the keyboard.
  4518. *
  4519. * numkeys if non-nil, receives the length of the returned array.
  4520. *
  4521. * An array of key states. Indexes into this array are obtained by using SDL_Scancode values.
  4522. *
  4523. *}
  4524. function SDL_GetKeyboardState(numkeys: PInt): PUInt8;
  4525. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetKeyboardState' {$ENDIF} {$ENDIF};
  4526. {**
  4527. * Get the current key modifier state for the keyboard.
  4528. *}
  4529. function SDL_GetModState(): TSDL_KeyMod;
  4530. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetModState' {$ENDIF} {$ENDIF};
  4531. {**
  4532. * Set the current key modifier state for the keyboard.
  4533. *
  4534. * This does not change the keyboard state, only the key modifier flags.
  4535. *}
  4536. procedure SDL_SetModState(modstate: TSDL_KeyMod);
  4537. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetModState' {$ENDIF} {$ENDIF};
  4538. {**
  4539. * Get the key code corresponding to the given scancode according
  4540. * to the current keyboard layout.
  4541. *
  4542. * See SDL_Keycode for details.
  4543. *
  4544. * SDL_GetKeyName()
  4545. *}
  4546. function SDL_GetKeyFromScancode(scancode: TSDL_ScanCode): TSDL_KeyCode;
  4547. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetKeyFromScancode' {$ENDIF} {$ENDIF};
  4548. {**
  4549. * Get the scancode corresponding to the given key code according to the
  4550. * current keyboard layout.
  4551. *
  4552. * See SDL_Scancode for details.
  4553. *
  4554. * SDL_GetScancodeName()
  4555. *}
  4556. function SDL_GetScancodeFromKey(key: TSDL_KeyCode): TSDL_ScanCode;
  4557. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetScancodeFromKey' {$ENDIF} {$ENDIF};
  4558. {**
  4559. * Get a human-readable name for a scancode.
  4560. *
  4561. * A pointer to the name for the scancode.
  4562. *
  4563. * If the scancode doesn't have a name, this function returns
  4564. * an empty string ("").
  4565. *
  4566. *}
  4567. function SDL_GetScancodeName(scancode: TSDL_ScanCode): PChar;
  4568. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetScancodeName' {$ENDIF} {$ENDIF};
  4569. {**
  4570. * Get a scancode from a human-readable name
  4571. *
  4572. * scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
  4573. *
  4574. * SDL_Scancode
  4575. *}
  4576. function SDL_GetScancodeFromName(const name: PChar): TSDL_ScanCode;
  4577. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetScancodeFromName' {$ENDIF} {$ENDIF};
  4578. {**
  4579. * Get a human-readable name for a key.
  4580. *
  4581. * A pointer to a UTF-8 string that stays valid at least until the next
  4582. * call to this function. If you need it around any longer, you must
  4583. * copy it. If the key doesn't have a name, this function returns an
  4584. * empty string ("").
  4585. *
  4586. * SDL_Key
  4587. *}
  4588. function SDL_GetKeyName(key: TSDL_ScanCode): PChar;
  4589. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetKeyName' {$ENDIF} {$ENDIF};
  4590. {**
  4591. * Get a key code from a human-readable name
  4592. *
  4593. * key code, or SDLK_UNKNOWN if the name wasn't recognized
  4594. *
  4595. * SDL_Keycode
  4596. *}
  4597. function SDL_GetKeyFromName(const name: PChar): TSDL_KeyCode;
  4598. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetKeyFromName' {$ENDIF} {$ENDIF};
  4599. {**
  4600. * Start accepting Unicode text input events.
  4601. * This function will show the on-screen keyboard if supported.
  4602. *
  4603. * SDL_StopTextInput()
  4604. * SDL_SetTextInputRect()
  4605. * SDL_HasScreenKeyboardSupport()
  4606. *}
  4607. procedure SDL_StartTextInput();
  4608. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_StartTextInput' {$ENDIF} {$ENDIF};
  4609. {**
  4610. * Return whether or not Unicode text input events are enabled.
  4611. *
  4612. * SDL_StartTextInput()
  4613. * SDL_StopTextInput()
  4614. *}
  4615. function SDL_IsTextInputActive(): TSDL_Bool;
  4616. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_IsTextInputActive' {$ENDIF} {$ENDIF};
  4617. {**
  4618. * Stop receiving any text input events.
  4619. * This function will hide the on-screen keyboard if supported.
  4620. *
  4621. * SDL_StartTextInput()
  4622. * SDL_HasScreenKeyboardSupport()
  4623. *}
  4624. procedure SDL_StopTextInput();
  4625. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_StopTextInput' {$ENDIF} {$ENDIF};
  4626. {**
  4627. * Set the rectangle used to type Unicode text inputs.
  4628. * This is used as a hint for IME and on-screen keyboard placement.
  4629. *
  4630. * SDL_StartTextInput()
  4631. *}
  4632. procedure SDL_SetTextInputRect(rect: PSDL_Rect);
  4633. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetTextInputRect' {$ENDIF} {$ENDIF};
  4634. {**
  4635. * Returns whether the platform has some screen keyboard support.
  4636. *
  4637. * SDL_TRUE if some keyboard support is available else SDL_FALSE.
  4638. *
  4639. * Not all screen keyboard functions are supported on all platforms.
  4640. *
  4641. * SDL_IsScreenKeyboardShown()
  4642. *}
  4643. function SDL_HasScreenKeyboardSupport(): TSDL_Bool;
  4644. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF} {$ENDIF};
  4645. {**
  4646. * Returns whether the screen keyboard is shown for given window.
  4647. *
  4648. * window The window for which screen keyboard should be queried.
  4649. *
  4650. * Result - SDL_TRUE if screen keyboard is shown else SDL_FALSE.
  4651. *
  4652. * SDL_HasScreenKeyboardSupport()
  4653. *}
  4654. function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_Bool;
  4655. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF} {$ENDIF};
  4656. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  4657. ////////////////////// SDL_mouse.h ////////////////////////////////////////////////////
  4658. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  4659. type
  4660. PSDL_Cursor = Pointer;
  4661. const
  4662. {**
  4663. * Cursor types for SDL_CreateSystemCursor.
  4664. *}
  4665. SDL_SYSTEM_CURSOR_ARROW = 0; // Arrow
  4666. SDL_SYSTEM_CURSOR_IBEAM = 1; // I-beam
  4667. SDL_SYSTEM_CURSOR_WAIT = 2; // Wait
  4668. SDL_SYSTEM_CURSOR_CROSSHAIR = 3; // Crosshair
  4669. SDL_SYSTEM_CURSOR_WAITARROW = 4; // Small wait cursor (or Wait if not available)
  4670. SDL_SYSTEM_CURSOR_SIZENWSE = 5; // Double arrow pointing northwest and southeast
  4671. SDL_SYSTEM_CURSOR_SIZENESW = 6; // Double arrow pointing northeast and southwest
  4672. SDL_SYSTEM_CURSOR_SIZEWE = 7; // Double arrow pointing west and east
  4673. SDL_SYSTEM_CURSOR_SIZENS = 8; // Double arrow pointing north and south
  4674. SDL_SYSTEM_CURSOR_SIZEALL = 9; // Four pointed arrow pointing north, south, east, and west
  4675. SDL_SYSTEM_CURSOR_NO = 10; // Slashed circle or crossbones
  4676. SDL_SYSTEM_CURSOR_HAND = 11; // Hand
  4677. SDL_NUM_SYSTEM_CURSORS = 12;
  4678. type
  4679. PSDL_SystemCursor = ^TSDL_SystemCursor;
  4680. TSDL_SystemCursor = Word;
  4681. {* Function prototypes *}
  4682. {**
  4683. * Get the window which currently has mouse focus.
  4684. *}
  4685. function SDL_GetMouseFocus(): PSDL_Window;
  4686. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetMouseFocus' {$ENDIF} {$ENDIF};
  4687. {**
  4688. * Retrieve the current state of the mouse.
  4689. *
  4690. * The current button state is returned as a button bitmask, which can
  4691. * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
  4692. * mouse cursor position relative to the focus window for the currently
  4693. * selected mouse. You can pass nil for either x or y.
  4694. *
  4695. * SDL_Button = 1 shl ((X)-1)
  4696. *}
  4697. function SDL_GetMouseState(x: PInt; y: PInt): UInt32;
  4698. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetMouseState' {$ENDIF} {$ENDIF};
  4699. {**
  4700. * Retrieve the relative state of the mouse.
  4701. *
  4702. * The current button state is returned as a button bitmask, which can
  4703. * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
  4704. * mouse deltas since the last call to SDL_GetRelativeMouseState().
  4705. *}
  4706. function SDL_GetRelativeMouseState(x: PInt; y: PInt): UInt32;
  4707. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRelativeMouseState' {$ENDIF} {$ENDIF};
  4708. {**
  4709. * Moves the mouse to the given position within the window.
  4710. *
  4711. * window The window to move the mouse into, or nil for the current mouse focus
  4712. * x The x coordinate within the window
  4713. * y The y coordinate within the window
  4714. *
  4715. * This function generates a mouse motion event
  4716. *}
  4717. procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: SInt32; y: SInt32);
  4718. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WarpMouseInWindow' {$ENDIF} {$ENDIF};
  4719. {**
  4720. * Set relative mouse mode.
  4721. *
  4722. * enabled Whether or not to enable relative mode
  4723. *
  4724. * 0 on success, or -1 if relative mode is not supported.
  4725. *
  4726. * While the mouse is in relative mode, the cursor is hidden, and the
  4727. * driver will try to report continuous motion in the current window.
  4728. * Only relative motion events will be delivered, the mouse position
  4729. * will not change.
  4730. *
  4731. * This function will flush any pending mouse motion.
  4732. *
  4733. * SDL_GetRelativeMouseMode()
  4734. *}
  4735. function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): SInt32;
  4736. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetRelativeMouseMode' {$ENDIF} {$ENDIF};
  4737. {**
  4738. * Query whether relative mouse mode is enabled.
  4739. *
  4740. * SDL_SetRelativeMouseMode()
  4741. *}
  4742. function SDL_GetRelativeMouseMode(): TSDL_Bool;
  4743. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetRelativeMouseMode' {$ENDIF} {$ENDIF};
  4744. {**
  4745. * Create a cursor, using the specified bitmap data and
  4746. * mask (in MSB format).
  4747. *
  4748. * The cursor width must be a multiple of 8 bits.
  4749. *
  4750. * The cursor is created in black and white according to the following:
  4751. * <table>
  4752. * <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
  4753. * <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
  4754. * <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
  4755. * <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
  4756. * <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
  4757. * if not. </td></tr>
  4758. * </table>
  4759. *
  4760. * SDL_FreeCursor()
  4761. *}
  4762. function SDL_CreateCursor(const data: PUInt8; const mask: PUInt8; w: SInt32; h: SInt32; hot_x: SInt32; hot_y: SInt32): PSDL_Cursor;
  4763. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateCursor' {$ENDIF} {$ENDIF};
  4764. {**
  4765. * Create a color cursor.
  4766. *
  4767. * SDL_FreeCursor()
  4768. *}
  4769. function SDL_CreateColorCursor(surface: PSDL_Surface; hot_x: SInt32; hot_y: SInt32): PSDL_Cursor;
  4770. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateColorCursor' {$ENDIF} {$ENDIF};
  4771. {**
  4772. * Create a system cursor.
  4773. *
  4774. * SDL_FreeCursor()
  4775. *}
  4776. function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor;
  4777. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_CreateSystemCursor' {$ENDIF} {$ENDIF};
  4778. {**
  4779. * Set the active cursor.
  4780. *}
  4781. procedure SDL_SetCursor(cursor: PSDL_Cursor);
  4782. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetCursor' {$ENDIF} {$ENDIF};
  4783. {**
  4784. * Return the active cursor.
  4785. *}
  4786. function SDL_GetCursor(): PSDL_Cursor;
  4787. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetCursor' {$ENDIF} {$ENDIF};
  4788. {**
  4789. * Frees a cursor created with SDL_CreateCursor().
  4790. *
  4791. * SDL_CreateCursor()
  4792. *}
  4793. procedure SDL_FreeCursor(cursor: PSDL_Cursor);
  4794. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FreeCursor' {$ENDIF} {$ENDIF};
  4795. {**
  4796. * Toggle whether or not the cursor is shown.
  4797. *
  4798. * toggle 1 to show the cursor, 0 to hide it, -1 to query the current
  4799. * state.
  4800. *
  4801. * 1 if the cursor is shown, or 0 if the cursor is hidden.
  4802. *}
  4803. function SDL_ShowCursor(toggle: SInt32): SInt32;
  4804. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ShowCursor' {$ENDIF} {$ENDIF};
  4805. const
  4806. {**
  4807. * Used as a mask when testing buttons in buttonstate.
  4808. * - Button 1: Left mouse button
  4809. * - Button 2: Middle mouse button
  4810. * - Button 3: Right mouse button
  4811. *}
  4812. SDL_BUTTON_LEFT = 1;
  4813. SDL_BUTTON_MIDDLE = 2;
  4814. SDL_BUTTON_RIGHT = 3;
  4815. SDL_BUTTON_X1 = 4;
  4816. SDL_BUTTON_X2 = 5;
  4817. SDL_BUTTON_LMASK = 1 shl ((SDL_BUTTON_LEFT) - 1);
  4818. SDL_BUTTON_MMASK = 1 shl ((SDL_BUTTON_MIDDLE) - 1);
  4819. SDL_BUTTON_RMASK = 1 shl ((SDL_BUTTON_RIGHT) - 1);
  4820. SDL_BUTTON_X1MASK = 1 shl ((SDL_BUTTON_X1) - 1);
  4821. SDL_BUTTON_X2MASK = 1 shl ((SDL_BUTTON_X2) - 1);
  4822. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  4823. ////////////////////// SDL_joystick.h ////////////////////////////////////////////////////
  4824. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  4825. {**
  4826. * SDL_joystick.h
  4827. *
  4828. * In order to use these functions, SDL_Init() must have been called
  4829. * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
  4830. * for joysticks, and load appropriate drivers.
  4831. *}
  4832. type
  4833. {* The joystick structure used to identify an SDL joystick *}
  4834. PSDL_Joystick = Pointer; // todo!!
  4835. {* A structure that encodes the stable unique id for a joystick device *}
  4836. TSDL_JoystickGUID = record
  4837. data: array[0..15] of UInt8;
  4838. end;
  4839. TSDL_JoystickID = SInt32;
  4840. {* Function prototypes *}
  4841. {**
  4842. * Count the number of joysticks attached to the system right now
  4843. *}
  4844. function SDL_NumJoysticks(): SInt32;
  4845. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_NumJoysticks' {$ENDIF} {$ENDIF};
  4846. {**
  4847. * Get the implementation dependent name of a joystick.
  4848. * This can be called before any joysticks are opened.
  4849. * If no name can be found, this function returns NULL.
  4850. *}
  4851. function SDL_JoystickNameForIndex(device_index: SInt32): PChar;
  4852. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickNameForIndex' {$ENDIF} {$ENDIF};
  4853. {**
  4854. * Open a joystick for use.
  4855. * The index passed as an argument refers tothe N'th joystick on the system.
  4856. * This index is the value which will identify this joystick in future joystick
  4857. * events.
  4858. *
  4859. * A joystick identifier, or NULL if an error occurred.
  4860. *}
  4861. function SDL_JoystickOpen(device_index: SInt32): PSDL_Joystick;
  4862. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickOpen' {$ENDIF} {$ENDIF};
  4863. {**
  4864. * Return the name for this currently opened joystick.
  4865. * If no name can be found, this function returns NULL.
  4866. *}
  4867. function SDL_JoystickName(joystick: PSDL_Joystick): PChar;
  4868. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickName' {$ENDIF} {$ENDIF};
  4869. {**
  4870. * Return the GUID for the joystick at this index
  4871. *}
  4872. function SDL_JoystickGetDeviceGUID(device_index: SInt32): TSDL_JoystickGUID;
  4873. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetDeviceGUID' {$ENDIF} {$ENDIF};
  4874. {**
  4875. * Return the GUID for this opened joystick
  4876. *}
  4877. function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID;
  4878. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetGUID' {$ENDIF} {$ENDIF};
  4879. {**
  4880. * Return a string representation for this guid. pszGUID must point to at least 33 bytes
  4881. * (32 for the string plus a NULL terminator).
  4882. *}
  4883. procedure SDL_JoystickGetGUIDString(guid: TSDL_JoystickGUId; pszGUID: PChar; cbGUID: SInt32);
  4884. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetGUIDString' {$ENDIF} {$ENDIF};
  4885. {**
  4886. * convert a string into a joystick formatted guid
  4887. *}
  4888. function SDL_JoystickGetGUIDFromString(const pchGUID: PChar): TSDL_JoystickGUID;
  4889. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetGUIDFromString' {$ENDIF} {$ENDIF};
  4890. {**
  4891. * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
  4892. *}
  4893. function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool;
  4894. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetAttached' {$ENDIF} {$ENDIF};
  4895. {**
  4896. * Get the instance ID of an opened joystick or -1 if the joystick is invalid.
  4897. *}
  4898. function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID;
  4899. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickInstanceID' {$ENDIF} {$ENDIF};
  4900. {**
  4901. * Get the number of general axis controls on a joystick.
  4902. *}
  4903. function SDL_JoystickNumAxes(joystick: PSDL_Joystick): SInt32;
  4904. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickNumAxes' {$ENDIF} {$ENDIF};
  4905. {**
  4906. * Get the number of trackballs on a joystick.
  4907. *
  4908. * Joystick trackballs have only relative motion events associated
  4909. * with them and their state cannot be polled.
  4910. *}
  4911. function SDL_JoystickNumBalls(joystick: PSDL_Joystick): SInt32;
  4912. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickNumBalls' {$ENDIF} {$ENDIF};
  4913. {**
  4914. * Get the number of POV hats on a joystick.
  4915. *}
  4916. function SDL_JoystickNumHats(joystick: PSDL_Joystick): SInt32;
  4917. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickNumHats' {$ENDIF} {$ENDIF};
  4918. {**
  4919. * Get the number of buttons on a joystick.
  4920. *}
  4921. function SDL_JoystickNumButtons(joystick: PSDL_Joystick): SInt32;
  4922. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickNumButtons' {$ENDIF} {$ENDIF};
  4923. {**
  4924. * Update the current state of the open joysticks.
  4925. *
  4926. * This is called automatically by the event loop if any joystick
  4927. * events are enabled.
  4928. *}
  4929. procedure SDL_JoystickUpdate();
  4930. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickUpdate' {$ENDIF} {$ENDIF};
  4931. {**
  4932. * Enable/disable joystick event polling.
  4933. *
  4934. * If joystick events are disabled, you must call SDL_JoystickUpdate()
  4935. * yourself and check the state of the joystick when you want joystick
  4936. * information.
  4937. *
  4938. * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
  4939. *}
  4940. function SDL_JoystickEventState(state: SInt32): SInt32;
  4941. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickEventState' {$ENDIF} {$ENDIF};
  4942. {**
  4943. * Get the current state of an axis control on a joystick.
  4944. *
  4945. * The state is a value ranging from -32768 to 32767.
  4946. *
  4947. * The axis indices start at index 0.
  4948. *}
  4949. function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: SInt32): SInt16;
  4950. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetAxis' {$ENDIF} {$ENDIF};
  4951. {**
  4952. * Hat positions
  4953. *}
  4954. const
  4955. SDL_HAT_CENTERED = $00;
  4956. SDL_HAT_UP = $01;
  4957. SDL_HAT_RIGHT = $02;
  4958. SDL_HAT_DOWN = $04;
  4959. SDL_HAT_LEFT = $08;
  4960. SDL_HAT_RIGHTUP = SDL_HAT_RIGHT or SDL_HAT_UP;
  4961. SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT or SDL_HAT_DOWN;
  4962. SDL_HAT_LEFTUP = SDL_HAT_LEFT or SDL_HAT_UP;
  4963. SDL_HAT_LEFTDOWN = SDL_HAT_LEFT or SDL_HAT_DOWN;
  4964. {**
  4965. * Get the current state of a POV hat on a joystick.
  4966. *
  4967. * The hat indices start at index 0.
  4968. *
  4969. * The return value is one of the following positions:
  4970. * - SDL_HAT_CENTERED
  4971. * - SDL_HAT_UP
  4972. * - SDL_HAT_RIGHT
  4973. * - SDL_HAT_DOWN
  4974. * - SDL_HAT_LEFT
  4975. * - SDL_HAT_RIGHTUP
  4976. * - SDL_HAT_RIGHTDOWN
  4977. * - SDL_HAT_LEFTUP
  4978. * - SDL_HAT_LEFTDOWN
  4979. *}
  4980. function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: SInt32): UInt8;
  4981. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetHat' {$ENDIF} {$ENDIF};
  4982. {**
  4983. * Get the ball axis change since the last poll.
  4984. *
  4985. * 0, or -1 if you passed it invalid parameters.
  4986. *
  4987. * The ball indices start at index 0.
  4988. *}
  4989. function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: SInt32; dx: PInt; dy: PInt): SInt32;
  4990. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetBall' {$ENDIF} {$ENDIF};
  4991. {**
  4992. * Get the current state of a button on a joystick.
  4993. *
  4994. * The button indices start at index 0.
  4995. *}
  4996. function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: SInt32): UInt8;
  4997. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickGetButton' {$ENDIF} {$ENDIF};
  4998. {**
  4999. * Close a joystick previously opened with SDL_JoystickOpen().
  5000. *}
  5001. procedure SDL_JoystickClose(joystick: PSDL_Joystick);
  5002. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickClose' {$ENDIF} {$ENDIF};
  5003. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  5004. ////////////////////// SDL_gamecontroller.h ////////////////////////////////////////////////////
  5005. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  5006. {**
  5007. * SDL_gamecontroller.h
  5008. *
  5009. * In order to use these functions, SDL_Init() must have been called
  5010. * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
  5011. * for game controllers, and load appropriate drivers.
  5012. *
  5013. * If you would like to receive controller updates while the application
  5014. * is in the background, you should set the following hint before calling
  5015. * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
  5016. *}
  5017. {* The gamecontroller structure used to identify an SDL game controller *}
  5018. type
  5019. PSDL_GameController = ^TSDL_GameController;
  5020. TSDL_GameController = Pointer; //todo
  5021. TSDL_GameControllerBindType = (SDL_CONTROLLER_BINDTYPE_NONE,
  5022. SDL_CONTROLLER_BINDTYPE_BUTTON,
  5023. SDL_CONTROLLER_BINDTYPE_AXIS,
  5024. SDL_CONTROLLER_BINDTYPE_HAT);
  5025. {**
  5026. * Get the SDL joystick layer binding for this controller button/axis mapping
  5027. *}
  5028. THat = record
  5029. hat: Integer;
  5030. hat_mask: Integer;
  5031. end;
  5032. TSDL_GameControllerButtonBind = record
  5033. bindType: TSDL_GameControllerBindType;
  5034. case Integer of
  5035. 0: ( button: Integer; );
  5036. 1: ( axis: Integer; );
  5037. 2: ( hat: THat; );
  5038. end;
  5039. {**
  5040. * To count the number of game controllers in the system for the following:
  5041. * int nJoysticks = SDL_NumJoysticks();
  5042. * int nGameControllers = 0;
  5043. * for ( int i = 0; i < nJoysticks; i++ ) {
  5044. * if ( SDL_IsGameController(i) ) {
  5045. * nGameControllers++;
  5046. *
  5047. *
  5048. *
  5049. * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
  5050. * guid,name,mappings
  5051. *
  5052. * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
  5053. * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
  5054. * The mapping format for joystick is:
  5055. * bX - a joystick button, index X
  5056. * hX.Y - hat X with value Y
  5057. * aX - axis X of the joystick
  5058. * Buttons can be used as a controller axis and vice versa.
  5059. *
  5060. * This string shows an example of a valid mapping for a controller
  5061. * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
  5062. *
  5063. *}
  5064. {**
  5065. * Add or update an existing mapping configuration
  5066. *
  5067. * 1 if mapping is added, 0 if updated, -1 on error
  5068. *}
  5069. function SDL_GameControllerAddMapping( mappingString: PChar ): Integer;
  5070. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerAddMapping' {$ENDIF} {$ENDIF};
  5071. {**
  5072. * Get a mapping string for a GUID
  5073. *
  5074. * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
  5075. *}
  5076. function SDL_GameControllerMappingForGUID( guid: TSDL_JoystickGUID ): PChar;
  5077. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerMappingForGUID' {$ENDIF} {$ENDIF};
  5078. {**
  5079. * Get a mapping string for an open GameController
  5080. *
  5081. * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
  5082. *}
  5083. function SDL_GameControllerMapping( gamecontroller: PSDL_GameController ): PChar;
  5084. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerMapping' {$ENDIF} {$ENDIF};
  5085. {**
  5086. * Is the joystick on this index supported by the game controller interface?
  5087. *}
  5088. function SDL_IsGameController(joystick_index: Integer): TSDL_Bool;
  5089. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_IsGameController' {$ENDIF} {$ENDIF};
  5090. {**
  5091. * Get the implementation dependent name of a game controller.
  5092. * This can be called before any controllers are opened.
  5093. * If no name can be found, this function returns NULL.
  5094. *}
  5095. function SDL_GameControllerNameForIndex(joystick_index: Integer): PChar;
  5096. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS}name '_SDL_GameControllerNameForIndex' {$ENDIF} {$ENDIF};
  5097. {**
  5098. * Open a game controller for use.
  5099. * The index passed as an argument refers to the N'th game controller on the system.
  5100. * This index is the value which will identify this controller in future controller
  5101. * events.
  5102. *
  5103. * A controller identifier, or NULL if an error occurred.
  5104. *}
  5105. function SDL_GameControllerOpen(joystick_index: Integer): PSDL_GameController;
  5106. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerOpen' {$ENDIF} {$ENDIF};
  5107. {**
  5108. * Return the name for this currently opened controller
  5109. *}
  5110. function SDL_GameControllerName(gamecontroller: PSDL_GameController): PChar;
  5111. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerName' {$ENDIF} {$ENDIF};
  5112. {**
  5113. * Returns SDL_TRUE if the controller has been opened and currently connected,
  5114. * or SDL_FALSE if it has not.
  5115. *}
  5116. function SDL_GameControllerGetAttached(gamecontroller: PSDL_GameController): TSDL_Bool;
  5117. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetAttached' {$ENDIF} {$ENDIF};
  5118. {**
  5119. * Get the underlying joystick object used by a controller
  5120. *}
  5121. function SDL_GameControllerGetJoystick(gamecontroller: PSDL_GameController): PSDL_Joystick;
  5122. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetJoystick' {$ENDIF} {$ENDIF};
  5123. {**
  5124. * Enable/disable controller event polling.
  5125. *
  5126. * If controller events are disabled, you must call SDL_GameControllerUpdate()
  5127. * yourself and check the state of the controller when you want controller
  5128. * information.
  5129. *
  5130. * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
  5131. *}
  5132. function SDL_GameControllerEventState(state: Integer): Integer;
  5133. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerEventState' {$ENDIF} {$ENDIF};
  5134. {**
  5135. * Update the current state of the open game controllers.
  5136. *
  5137. * This is called automatically by the event loop if any game controller
  5138. * events are enabled.
  5139. *}
  5140. procedure SDL_GameControllerUpdate();
  5141. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerUpdate' {$ENDIF} {$ENDIF};
  5142. {**
  5143. * The list of axes available from a controller
  5144. *}
  5145. const
  5146. SDL_CONTROLLER_AXIS_INVALID = -1;
  5147. SDL_CONTROLLER_AXIS_LEFTX = 0;
  5148. SDL_CONTROLLER_AXIS_LEFTY = 1;
  5149. SDL_CONTROLLER_AXIS_RIGHTX = 2;
  5150. SDL_CONTROLLER_AXIS_RIGHTY = 3;
  5151. SDL_CONTROLLER_AXIS_TRIGGERLEFT = 4;
  5152. SDL_CONTROLLER_AXIS_TRIGGERRIGHT = 5;
  5153. SDL_CONTROLLER_AXIS_MAX = 6;
  5154. type
  5155. TSDL_GameControllerAxis = Byte;
  5156. {**
  5157. * turn this string into a axis mapping
  5158. *}
  5159. function SDL_GameControllerGetAxisFromString(pchString: PChar): TSDL_GameControllerAxis;
  5160. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetAxisFromString' {$ENDIF} {$ENDIF};
  5161. {**
  5162. * turn this axis enum into a string mapping
  5163. *}
  5164. function SDL_GameControllerGetStringForAxis(axis: TSDL_GameControllerAxis): PChar;
  5165. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS}name '_SDL_GameControllerGetStringForAxis' {$ENDIF} {$ENDIF};
  5166. {**
  5167. * Get the SDL joystick layer binding for this controller button mapping
  5168. *}
  5169. function SDL_GameControllerGetBindForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_GameControllerButtonBind;
  5170. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetBindForAxis' {$ENDIF} {$ENDIF};
  5171. {**
  5172. * Get the current state of an axis control on a game controller.
  5173. *
  5174. * The state is a value ranging from -32768 to 32767.
  5175. *
  5176. * The axis indices start at index 0.
  5177. *}
  5178. function SDL_GameControllerGetAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): SInt16;
  5179. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetAxis' {$ENDIF} {$ENDIF};
  5180. {**
  5181. * The list of buttons available from a controller
  5182. *}
  5183. const
  5184. SDL_CONTROLLER_BUTTON_INVALID = -1;
  5185. SDL_CONTROLLER_BUTTON_A = 0;
  5186. SDL_CONTROLLER_BUTTON_B = 1;
  5187. SDL_CONTROLLER_BUTTON_X = 2;
  5188. SDL_CONTROLLER_BUTTON_Y = 3;
  5189. SDL_CONTROLLER_BUTTON_BACK = 4;
  5190. SDL_CONTROLLER_BUTTON_GUIDE = 5;
  5191. SDL_CONTROLLER_BUTTON_START = 6;
  5192. SDL_CONTROLLER_BUTTON_LEFTSTICK = 7;
  5193. SDL_CONTROLLER_BUTTON_RIGHTSTICK = 8;
  5194. SDL_CONTROLLER_BUTTON_LEFTSHOULDER = 9;
  5195. SDL_CONTROLLER_BUTTON_RIGHTSHOULDER = 10;
  5196. SDL_CONTROLLER_BUTTON_DPAD_UP = 11;
  5197. SDL_CONTROLLER_BUTTON_DPAD_DOWN = 12;
  5198. SDL_CONTROLLER_BUTTON_DPAD_LEFT = 13;
  5199. SDL_CONTROLLER_BUTTON_DPAD_RIGHT = 14;
  5200. SDL_CONTROLLER_BUTTON_MAX = 15;
  5201. type
  5202. TSDL_GameControllerButton = Byte;
  5203. {**
  5204. * turn this string into a button mapping
  5205. *}
  5206. function SDL_GameControllerGetButtonFromString(pchString: PChar): TSDL_GameControllerButton;
  5207. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetButtonFromString' {$ENDIF} {$ENDIF};
  5208. {**
  5209. * turn this button enum into a string mapping
  5210. *}
  5211. function SDL_GameControllerGetStringForButton(button: TSDL_GameControllerButton): PChar;
  5212. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetStringForButton' {$ENDIF} {$ENDIF};
  5213. {**
  5214. * Get the SDL joystick layer binding for this controller button mapping
  5215. *}
  5216. function SDL_GameControllerGetBindForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_GameControllerButtonBind;
  5217. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetBindForButton' {$ENDIF} {$ENDIF};
  5218. {**
  5219. * Get the current state of a button on a game controller.
  5220. *
  5221. * The button indices start at index 0.
  5222. *}
  5223. function SDL_GameControllerGetButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): UInt8;
  5224. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerGetButton' {$ENDIF} {$ENDIF};
  5225. {**
  5226. * Close a controller previously opened with SDL_GameControllerOpen().
  5227. *}
  5228. procedure SDL_GameControllerClose(gamecontroller: PSDL_GameController);
  5229. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GameControllerClose' {$ENDIF} {$ENDIF};
  5230. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  5231. ////////////////////// SDL_haptic.h ////////////////////////////////////////////////////
  5232. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  5233. {**
  5234. *
  5235. * The SDL Haptic subsystem allows you to control haptic (force feedback)
  5236. * devices.
  5237. *
  5238. * The basic usage is as follows:
  5239. * - Initialize the Subsystem (::SDL_INIT_HAPTIC).
  5240. * - Open a Haptic Device.
  5241. * - SDL_HapticOpen() to open from index.
  5242. * - SDL_HapticOpenFromJoystick() to open from an existing joystick.
  5243. * - Create an effect (::SDL_HapticEffect).
  5244. * - Upload the effect with SDL_HapticNewEffect().
  5245. * - Run the effect with SDL_HapticRunEffect().
  5246. * - (optional) Free the effect with SDL_HapticDestroyEffect().
  5247. * - Close the haptic device with SDL_HapticClose().
  5248. *
  5249. * Simple rumble example:
  5250. *
  5251. * SDL_Haptic *haptic;
  5252. *
  5253. * // Open the device
  5254. * haptic = SDL_HapticOpen( 0 );
  5255. * if (haptic == NULL)
  5256. * return -1;
  5257. *
  5258. * // Initialize simple rumble
  5259. * if (SDL_HapticRumbleInit( haptic ) != 0)
  5260. * return -1;
  5261. *
  5262. * // Play effect at 50% strength for 2 seconds
  5263. * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
  5264. * return -1;
  5265. * SDL_Delay( 2000 );
  5266. *
  5267. * // Clean up
  5268. * SDL_HapticClose( haptic );
  5269. *
  5270. *
  5271. * Complete example:
  5272. *
  5273. * int test_haptic( SDL_Joystick * joystick )
  5274. * SDL_Haptic *haptic;
  5275. * SDL_HapticEffect effect;
  5276. * int effect_id;
  5277. *
  5278. * // Open the device
  5279. * haptic = SDL_HapticOpenFromJoystick( joystick );
  5280. * if (haptic == NULL) return -1; // Most likely joystick isn't haptic
  5281. *
  5282. * // See if it can do sine waves
  5283. * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0)
  5284. * SDL_HapticClose(haptic); // No sine effect
  5285. * return -1;
  5286. *
  5287. *
  5288. * // Create the effect
  5289. * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
  5290. * effect.type = SDL_HAPTIC_SINE;
  5291. * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
  5292. * effect.periodic.direction.dir[0] = 18000; // Force comes from south
  5293. * effect.periodic.period = 1000; // 1000 ms
  5294. * effect.periodic.magnitude = 20000; // 20000/32767 strength
  5295. * effect.periodic.length = 5000; // 5 seconds long
  5296. * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
  5297. * effect.periodic.fade_length = 1000; // Takes 1 second to fade away
  5298. *
  5299. * // Upload the effect
  5300. * effect_id = SDL_HapticNewEffect( haptic, &effect );
  5301. *
  5302. * // Test the effect
  5303. * SDL_HapticRunEffect( haptic, effect_id, 1 );
  5304. * SDL_Delay( 5000); // Wait for the effect to finish
  5305. *
  5306. * // We destroy the effect, although closing the device also does this
  5307. * SDL_HapticDestroyEffect( haptic, effect_id );
  5308. *
  5309. * // Close the device
  5310. * SDL_HapticClose(haptic);
  5311. *
  5312. * return 0; // Success
  5313. *
  5314. *
  5315. *
  5316. * You can also find out more information on my blog:
  5317. * http://bobbens.dyndns.org/journal/2010/sdl_haptic/
  5318. *
  5319. * Edgar Simo Serra
  5320. *}
  5321. {**
  5322. * SDL_Haptic
  5323. *
  5324. * The haptic structure used to identify an SDL haptic.
  5325. *
  5326. * SDL_HapticOpen
  5327. * SDL_HapticOpenFromJoystick
  5328. * SDL_HapticClose
  5329. *}
  5330. type
  5331. PSDL_Haptic = ^TSDL_Haptic;
  5332. TSDL_Haptic = record end;
  5333. {**
  5334. * Haptic features
  5335. *
  5336. * Different haptic features a device can have.
  5337. *}
  5338. {**
  5339. * Haptic effects
  5340. *}
  5341. {**
  5342. * Constant effect supported.
  5343. *
  5344. * Constant haptic effect.
  5345. *
  5346. * SDL_HapticCondition
  5347. *}
  5348. const
  5349. SDL_HAPTIC_CONSTANT = (1 shl 0);
  5350. {**
  5351. * Sine wave effect supported.
  5352. *
  5353. * Periodic haptic effect that simulates sine waves.
  5354. *
  5355. * SDL_HapticPeriodic
  5356. *}
  5357. const
  5358. SDL_HAPTIC_SINE = (1 shl 1);
  5359. {**
  5360. * Square wave effect supported.
  5361. *
  5362. * Periodic haptic effect that simulates square waves.
  5363. *
  5364. * SDL_HapticPeriodic
  5365. *}
  5366. const
  5367. SDL_HAPTIC_SQUARE = (1 shl 2);
  5368. {**
  5369. * Triangle wave effect supported.
  5370. *
  5371. * Periodic haptic effect that simulates triangular waves.
  5372. *
  5373. * SDL_HapticPeriodic
  5374. *}
  5375. const
  5376. SDL_HAPTIC_TRIANGLE = (1 shl 3);
  5377. {**
  5378. * Sawtoothup wave effect supported.
  5379. *
  5380. * Periodic haptic effect that simulates saw tooth up waves.
  5381. *
  5382. * SDL_HapticPeriodic
  5383. *}
  5384. const
  5385. SDL_HAPTIC_SAWTOOTHUP = (1 shl 4);
  5386. {**
  5387. * Sawtoothdown wave effect supported.
  5388. *
  5389. * Periodic haptic effect that simulates saw tooth down waves.
  5390. *
  5391. * SDL_HapticPeriodic
  5392. *}
  5393. const
  5394. SDL_HAPTIC_SAWTOOTHDOWN = (1 shl 5);
  5395. {**
  5396. * Ramp effect supported.
  5397. *
  5398. * Ramp haptic effect.
  5399. *
  5400. * SDL_HapticRamp
  5401. *}
  5402. const
  5403. SDL_HAPTIC_RAMP = (1 shl 6);
  5404. {**
  5405. * Spring effect supported - uses axes position.
  5406. *
  5407. * Condition haptic effect that simulates a spring. Effect is based on the
  5408. * axes position.
  5409. *
  5410. * SDL_HapticCondition
  5411. *}
  5412. const
  5413. SDL_HAPTIC_SPRING = (1 shl 7);
  5414. {**
  5415. * Damper effect supported - uses axes velocity.
  5416. *
  5417. * Condition haptic effect that simulates dampening. Effect is based on the
  5418. * axes velocity.
  5419. *
  5420. * SDL_HapticCondition
  5421. *}
  5422. const
  5423. SDL_HAPTIC_DAMPER = (1 shl 8);
  5424. {**
  5425. * Inertia effect supported - uses axes acceleration.
  5426. *
  5427. * Condition haptic effect that simulates inertia. Effect is based on the axes
  5428. * acceleration.
  5429. *
  5430. * SDL_HapticCondition
  5431. *}
  5432. const
  5433. SDL_HAPTIC_INERTIA = (1 shl 9);
  5434. {**
  5435. * Friction effect supported - uses axes movement.
  5436. *
  5437. * Condition haptic effect that simulates friction. Effect is based on the
  5438. * axes movement.
  5439. *
  5440. * SDL_HapticCondition
  5441. *}
  5442. const
  5443. SDL_HAPTIC_FRICTION = (1 shl 10);
  5444. {**
  5445. * Custom effect is supported.
  5446. *
  5447. * User defined custom haptic effect.
  5448. *}
  5449. const
  5450. SDL_HAPTIC_CUSTOM = (1 shl 11);
  5451. {*Haptic effects*}
  5452. {* These last few are features the device has, not effects *}
  5453. {**
  5454. * Device can set global gain.
  5455. *
  5456. * Device supports setting the global gain.
  5457. *
  5458. * SDL_HapticSetGain
  5459. *}
  5460. const
  5461. SDL_HAPTIC_GAIN = (1 shl 12);
  5462. {**
  5463. * Device can set autocenter.
  5464. *
  5465. * Device supports setting autocenter.
  5466. *
  5467. * SDL_HapticSetAutocenter
  5468. *}
  5469. const
  5470. SDL_HAPTIC_AUTOCENTER = (1 shl 13);
  5471. {**
  5472. * Device can be queried for effect status.
  5473. *
  5474. * Device can be queried for effect status.
  5475. *
  5476. * SDL_HapticGetEffectStatus
  5477. *}
  5478. const
  5479. SDL_HAPTIC_STATUS = (1 shl 14);
  5480. {**
  5481. * Device can be paused.
  5482. *
  5483. * SDL_HapticPause
  5484. * SDL_HapticUnpause
  5485. *}
  5486. const
  5487. SDL_HAPTIC_PAUSE = (1 shl 15);
  5488. {**
  5489. * Direction encodings
  5490. *}
  5491. {**
  5492. * Uses polar coordinates for the direction.
  5493. *
  5494. * SDL_HapticDirection
  5495. *}
  5496. const
  5497. SDL_HAPTIC_POLAR = 0;
  5498. {**
  5499. * Uses cartesian coordinates for the direction.
  5500. *
  5501. * SDL_HapticDirection
  5502. *}
  5503. const
  5504. SDL_HAPTIC_CARTESIAN = 1;
  5505. {**
  5506. * Uses spherical coordinates for the direction.
  5507. *
  5508. * SDL_HapticDirection
  5509. *}
  5510. const
  5511. SDL_HAPTIC_SPHERICAL = 2;
  5512. {*Direction encodings*}
  5513. {*Haptic features*}
  5514. {*
  5515. * Misc defines.
  5516. *}
  5517. {**
  5518. * Used to play a device an infinite number of times.
  5519. *
  5520. * SDL_HapticRunEffect
  5521. *}
  5522. const
  5523. //SDL_HAPTIC_INFINITY = 4294967295U;
  5524. SDL_HAPTIC_INFINITY = 4294967295; //right?!
  5525. {**
  5526. * Structure that represents a haptic direction.
  5527. *
  5528. * Directions can be specified by:
  5529. * - SDL_HAPTIC_POLAR : Specified by polar coordinates.
  5530. * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
  5531. * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
  5532. *
  5533. * Cardinal directions of the haptic device are relative to the positioning
  5534. * of the device. North is considered to be away from the user.
  5535. *
  5536. * The following diagram represents the cardinal directions:
  5537. *
  5538. .--.
  5539. |__| .-------.
  5540. |=.| |.-----.|
  5541. |--| || ||
  5542. | | |'-----'|
  5543. |__|~')_____('
  5544. [ COMPUTER ]
  5545. North (0,-1)
  5546. ^
  5547. |
  5548. |
  5549. (1,0) West <----[ HAPTIC ]----> East (-1,0)
  5550. |
  5551. |
  5552. v
  5553. South (0,1)
  5554. [ USER ]
  5555. \|||/
  5556. (o o)
  5557. ---ooO-(_)-Ooo---
  5558. *
  5559. * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
  5560. * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses
  5561. * the first dir parameter. The cardinal directions would be:
  5562. * - North: 0 (0 degrees)
  5563. * - East: 9000 (90 degrees)
  5564. * - South: 18000 (180 degrees)
  5565. * - West: 27000 (270 degrees)
  5566. *
  5567. * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
  5568. * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
  5569. * the first three dir parameters. The cardinal directions would be:
  5570. * - North: 0,-1, 0
  5571. * - East: -1, 0, 0
  5572. * - South: 0, 1, 0
  5573. * - West: 1, 0, 0
  5574. *
  5575. * The Z axis represents the height of the effect if supported, otherwise
  5576. * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
  5577. * can use any multiple you want, only the direction matters.
  5578. *
  5579. * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
  5580. * The first two dir parameters are used. The dir parameters are as
  5581. * follows (all values are in hundredths of degrees):
  5582. * - Degrees from (1, 0) rotated towards (0, 1).
  5583. * - Degrees towards (0, 0, 1) (device needs at least 3 axes).
  5584. *
  5585. *
  5586. * Example of force coming from the south with all encodings (force coming
  5587. * from the south means the user will have to pull the stick to counteract):
  5588. *
  5589. * SDL_HapticDirection direction;
  5590. *
  5591. * // Cartesian directions
  5592. * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
  5593. * direction.dir[0] = 0; // X position
  5594. * direction.dir[1] = 1; // Y position
  5595. * // Assuming the device has 2 axes, we don't need to specify third parameter.
  5596. *
  5597. * // Polar directions
  5598. * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
  5599. * direction.dir[0] = 18000; // Polar only uses first parameter
  5600. *
  5601. * // Spherical coordinates
  5602. * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
  5603. * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
  5604. *
  5605. *
  5606. * SDL_HAPTIC_POLAR
  5607. * SDL_HAPTIC_CARTESIAN
  5608. * SDL_HAPTIC_SPHERICAL
  5609. * SDL_HapticEffect
  5610. * SDL_HapticNumAxes
  5611. *}
  5612. type
  5613. TSDL_HapticDirection = record
  5614. _type: UInt8; {**< The type of encoding. *}
  5615. dir: array[0..2] of SInt32; {**< The encoded direction. *}
  5616. end;
  5617. {**
  5618. * A structure containing a template for a Constant effect.
  5619. *
  5620. * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
  5621. *
  5622. * A constant effect applies a constant force in the specified direction
  5623. * to the joystick.
  5624. *
  5625. * SDL_HAPTIC_CONSTANT
  5626. * SDL_HapticEffect
  5627. *}
  5628. type
  5629. TSDL_HapticConstant = record
  5630. {* Header *}
  5631. _type: UInt16; {**< SDL_HAPTIC_CONSTANT *}
  5632. direction: TSDL_HapticDirection; {**< Direction of the effect. *}
  5633. {* Replay *}
  5634. length: UInt32; {**< Duration of the effect. *}
  5635. delay: UInt16; {**< Delay before starting the effect. *}
  5636. {* Trigger *}
  5637. button: UInt16; {**< Button that triggers the effect. *}
  5638. interval: UInt16; {**< How soon it can be triggered again after button. *}
  5639. {* Constant *}
  5640. level: SInt16; {**< Strength of the constant effect. *}
  5641. {* Envelope *}
  5642. attack_length: UInt16; {**< Duration of the attack. *}
  5643. attack_level: UInt16; {**< Level at the start of the attack. *}
  5644. fade_length: UInt16; {**< Duration of the fade. *}
  5645. fade_level: UInt16; {**< Level at the end of the fade. *}
  5646. end;
  5647. {**
  5648. * A structure containing a template for a Periodic effect.
  5649. *
  5650. * The struct handles the following effects:
  5651. * - SDL_HAPTIC_SINE
  5652. * - SDL_HAPTIC_SQUARE
  5653. * - SDL_HAPTIC_TRIANGLE
  5654. * - SDL_HAPTIC_SAWTOOTHUP
  5655. * - SDL_HAPTIC_SAWTOOTHDOWN
  5656. *
  5657. * A periodic effect consists in a wave-shaped effect that repeats itself
  5658. * over time. The type determines the shape of the wave and the parameters
  5659. * determine the dimensions of the wave.
  5660. *
  5661. * Phase is given by hundredth of a cycle meaning that giving the phase a value
  5662. * of 9000 will displace it 25% of its period. Here are sample values:
  5663. * - 0: No phase displacement.
  5664. * - 9000: Displaced 25% of its period.
  5665. * - 18000: Displaced 50% of its period.
  5666. * - 27000: Displaced 75% of its period.
  5667. * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
  5668. *
  5669. * Examples:
  5670. *
  5671. SDL_HAPTIC_SINE
  5672. __ __ __ __
  5673. / \ / \ / \ /
  5674. / \__/ \__/ \__/
  5675. SDL_HAPTIC_SQUARE
  5676. __ __ __ __ __
  5677. | | | | | | | | | |
  5678. | |__| |__| |__| |__| |
  5679. SDL_HAPTIC_TRIANGLE
  5680. /\ /\ /\ /\ /\
  5681. / \ / \ / \ / \ /
  5682. / \/ \/ \/ \/
  5683. SDL_HAPTIC_SAWTOOTHUP
  5684. /| /| /| /| /| /| /|
  5685. / | / | / | / | / | / | / |
  5686. / |/ |/ |/ |/ |/ |/ |
  5687. SDL_HAPTIC_SAWTOOTHDOWN
  5688. \ |\ |\ |\ |\ |\ |\ |
  5689. \ | \ | \ | \ | \ | \ | \ |
  5690. \| \| \| \| \| \| \|
  5691. *
  5692. * SDL_HAPTIC_SINE
  5693. * SDL_HAPTIC_SQUARE
  5694. * SDL_HAPTIC_TRIANGLE
  5695. * SDL_HAPTIC_SAWTOOTHUP
  5696. * SDL_HAPTIC_SAWTOOTHDOWN
  5697. * SDL_HapticEffect
  5698. *}
  5699. type
  5700. TSDL_HapticPeriodic = record
  5701. { Header *}
  5702. _type: UInt16; {**< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE,
  5703. SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or
  5704. SDL_HAPTIC_SAWTOOTHDOWN *}
  5705. direction: TSDL_HapticDirection; {**< Direction of the effect. *}
  5706. {* Replay *}
  5707. length: UInt32; {**< Duration of the effect. *}
  5708. delay: UInt16; {**< Delay before starting the effect. *}
  5709. {* Trigger *}
  5710. button: UInt16; {**< Button that triggers the effect. *}
  5711. interval: UInt16; {**< How soon it can be triggered again after button. *}
  5712. {* Periodic *}
  5713. period: UInt16; {**< Period of the wave. *}
  5714. magnitude: SInt16; {**< Peak value. *}
  5715. offset: SInt16; {**< Mean value of the wave. *}
  5716. phase: UInt16; {**< Horizontal shift given by hundredth of a cycle. *}
  5717. {* Envelope *}
  5718. attack_length: UInt16; {**< Duration of the attack. *}
  5719. attack_level: UInt16; {**< Level at the start of the attack. *}
  5720. fade_length: UInt16; {**< Duration of the fade. *}
  5721. fade_level: UInt16; {**< Level at the end of the fade. *}
  5722. end;
  5723. {**
  5724. * A structure containing a template for a Condition effect.
  5725. *
  5726. * The struct handles the following effects:
  5727. * - SDL_HAPTIC_SPRING: Effect based on axes position.
  5728. * - SDL_HAPTIC_DAMPER: Effect based on axes velocity.
  5729. * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
  5730. * - SDL_HAPTIC_FRICTION: Effect based on axes movement.
  5731. *
  5732. * Direction is handled by condition internals instead of a direction member.
  5733. * The condition effect specific members have three parameters. The first
  5734. * refers to the X axis, the second refers to the Y axis and the third
  5735. * refers to the Z axis. The right terms refer to the positive side of the
  5736. * axis and the left terms refer to the negative side of the axis. Please
  5737. * refer to the ::SDL_HapticDirection diagram for which side is positive and
  5738. * which is negative.
  5739. *
  5740. * SDL_HapticDirection
  5741. * SDL_HAPTIC_SPRING
  5742. * SDL_HAPTIC_DAMPER
  5743. * SDL_HAPTIC_INERTIA
  5744. * SDL_HAPTIC_FRICTION
  5745. * SDL_HapticEffect
  5746. *}
  5747. type
  5748. TSDL_HapticCondition = record
  5749. {* Header *}
  5750. _type: UInt16; {**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER,
  5751. SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION *}
  5752. direction: TSDL_HapticDirection; {**< Direction of the effect - Not used ATM. *}
  5753. {* Replay *}
  5754. length: UInt32; {**< Duration of the effect. *}
  5755. delay: UInt16; {**< Delay before starting the effect. *}
  5756. {* Trigger *}
  5757. button: UInt16; {**< Button that triggers the effect. *}
  5758. interval: UInt16; {**< How soon it can be triggered again after button. *}
  5759. {* Condition *}
  5760. right_sat: array[0..2] of UInt16; {**< Level when joystick is to the positive side. *}
  5761. left_sat: array[0..2] of UInt16; {**< Level when joystick is to the negative side. *}
  5762. right_coeff: array[0..2] of SInt16; {**< How fast to increase the force towards the positive side. *}
  5763. left_coeff: array[0..2] of SInt16; {**< How fast to increase the force towards the negative side. *}
  5764. deadband: array[0..2] of UInt16; {**< Size of the dead zone. *}
  5765. center: array[0..2] of SInt16; {**< Position of the dead zone. *}
  5766. end;
  5767. {**
  5768. * A structure containing a template for a Ramp effect.
  5769. *
  5770. * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
  5771. *
  5772. * The ramp effect starts at start strength and ends at end strength.
  5773. * It augments in linear fashion. If you use attack and fade with a ramp
  5774. * the effects get added to the ramp effect making the effect become
  5775. * quadratic instead of linear.
  5776. *
  5777. * SDL_HAPTIC_RAMP
  5778. * SDL_HapticEffect
  5779. *}
  5780. type
  5781. TSDL_HapticRamp = record
  5782. {* Header *}
  5783. _type: UInt16; {**< SDL_HAPTIC_RAMP *}
  5784. direction: TSDL_HapticDirection; {**< Direction of the effect. *}
  5785. {* Replay *}
  5786. length: UInt32; {**< Duration of the effect. *}
  5787. delay: UInt16; {**< Delay before starting the effect. *}
  5788. {* Trigger *}
  5789. button: UInt16; {**< Button that triggers the effect. *}
  5790. interval: UInt16; {**< How soon it can be triggered again after button. *}
  5791. {* Ramp *}
  5792. start: SInt16; {**< Beginning strength level. *}
  5793. _end: SInt16; {**< Ending strength level. *}
  5794. {* Envelope *}
  5795. attack_length: UInt16; {**< Duration of the attack. *}
  5796. attack_level: UInt16; {**< Level at the start of the attack. *}
  5797. fade_length: UInt16; {**< Duration of the fade. *}
  5798. fade_level: UInt16; {**< Level at the end of the fade. *}
  5799. end;
  5800. {**
  5801. * A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
  5802. *
  5803. * A custom force feedback effect is much like a periodic effect, where the
  5804. * application can define its exact shape. You will have to allocate the
  5805. * data yourself. Data should consist of channels * samples Uint16 samples.
  5806. *
  5807. * If channels is one, the effect is rotated using the defined direction.
  5808. * Otherwise it uses the samples in data for the different axes.
  5809. *
  5810. * SDL_HAPTIC_CUSTOM
  5811. * SDL_HapticEffect
  5812. *}
  5813. type
  5814. TSDL_HapticCustom = record
  5815. {* Header *}
  5816. _type: UInt16; {**< SDL_HAPTIC_CUSTOM *}
  5817. direction: TSDL_HapticDirection; {**< Direction of the effect. *}
  5818. {* Replay *}
  5819. length: UInt32; {**< Duration of the effect. *}
  5820. delay: UInt16; {**< Delay before starting the effect. *}
  5821. {* Trigger *}
  5822. button: UInt16; {**< Button that triggers the effect. *}
  5823. interval: UInt16; {**< How soon it can be triggered again after button. *}
  5824. {* Custom *}
  5825. channels: UInt8; {**< Axes to use, minimum of one. *}
  5826. period: UInt16; {**< Sample periods. *}
  5827. samples: UInt16; {**< Amount of samples. *}
  5828. data: PUInt16; {**< Should contain channels*samples items. *}
  5829. {* Envelope *}
  5830. attack_length: UInt16; {**< Duration of the attack. *}
  5831. attack_level: UInt16; {**< Level at the start of the attack. *}
  5832. fade_length: UInt16; {**< Duration of the fade. *}
  5833. fade_level: UInt16; {**< Level at the end of the fade. *}
  5834. end;
  5835. {**
  5836. * The generic template for any haptic effect.
  5837. *
  5838. * All values max at 32767 (0x7FFF). Signed values also can be negative.
  5839. * Time values unless specified otherwise are in milliseconds.
  5840. *
  5841. * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767
  5842. * value. Neither delay, interval, attack_length nor fade_length support
  5843. * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
  5844. *
  5845. * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of
  5846. * SDL_HAPTIC_INFINITY.
  5847. *
  5848. * Button triggers may not be supported on all devices, it is advised to not
  5849. * use them if possible. Buttons start at index 1 instead of index 0 like
  5850. * the joystick.
  5851. *
  5852. * If both attack_length and fade_level are 0, the envelope is not used,
  5853. * otherwise both values are used.
  5854. *
  5855. * Common parts:
  5856. *
  5857. * // Replay - All effects have this
  5858. * Uint32 length; // Duration of effect (ms).
  5859. * Uint16 delay; // Delay before starting effect.
  5860. *
  5861. * // Trigger - All effects have this
  5862. * Uint16 button; // Button that triggers effect.
  5863. * Uint16 interval; // How soon before effect can be triggered again.
  5864. *
  5865. * // Envelope - All effects except condition effects have this
  5866. * Uint16 attack_length; // Duration of the attack (ms).
  5867. * Uint16 attack_level; // Level at the start of the attack.
  5868. * Uint16 fade_length; // Duration of the fade out (ms).
  5869. * Uint16 fade_level; // Level at the end of the fade.
  5870. *
  5871. *
  5872. *
  5873. * Here we have an example of a constant effect evolution in time:
  5874. *
  5875. Strength
  5876. ^
  5877. |
  5878. | effect level --> _________________
  5879. | / \
  5880. | / \
  5881. | / \
  5882. | / \
  5883. | attack_level --> | \
  5884. | | | <--- fade_level
  5885. |
  5886. +--------------------------------------------------> Time
  5887. [--] [---]
  5888. attack_length fade_length
  5889. [------------------][-----------------------]
  5890. delay length
  5891. *
  5892. * Note either the attack_level or the fade_level may be above the actual
  5893. * effect level.
  5894. *
  5895. * SDL_HapticConstant
  5896. * SDL_HapticPeriodic
  5897. * SDL_HapticCondition
  5898. * SDL_HapticRamp
  5899. * SDL_HapticCustom
  5900. *}
  5901. type
  5902. PSDL_HapticEffect = ^TSDL_HapticEffect;
  5903. TSDL_HapticEffect = record
  5904. {* Common for all force feedback effects *}
  5905. _type: UInt16; {**< Effect type. *}
  5906. case UInt16 of
  5907. 0: (constant: TSDL_HapticConstant;); {**< Constant effect. *}
  5908. 1: (periodic: TSDL_HapticPeriodic;); {**< Periodic effect. *}
  5909. 2: (condition: TSDL_HapticCondition;); {**< Condition effect. *}
  5910. 3: (ramp: TSDL_HapticRamp;); {**< Ramp effect. *}
  5911. 4: (custom: TSDL_HapticCustom;); {**< Custom effect. *}
  5912. end;
  5913. {* Function prototypes *}
  5914. {**
  5915. * Count the number of haptic devices attached to the system.
  5916. *
  5917. * Number of haptic devices detected on the system.
  5918. *}
  5919. function SDL_NumHaptics(): Integer;
  5920. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_NumHaptics' {$ENDIF} {$ENDIF};
  5921. {**
  5922. * Get the implementation dependent name of a Haptic device.
  5923. *
  5924. * This can be called before any joysticks are opened.
  5925. * If no name can be found, this function returns NULL.
  5926. *
  5927. * device_index Index of the device to get its name.
  5928. * Name of the device or NULL on error.
  5929. *
  5930. * SDL_NumHaptics
  5931. *}
  5932. function SDL_HapticName(device_index: Integer): PChar;
  5933. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticName' {$ENDIF} {$ENDIF};
  5934. {**
  5935. * Opens a Haptic device for usage.
  5936. *
  5937. * The index passed as an argument refers to the N'th Haptic device on this
  5938. * system.
  5939. *
  5940. * When opening a haptic device, its gain will be set to maximum and
  5941. * autocenter will be disabled. To modify these values use
  5942. * SDL_HapticSetGain() and SDL_HapticSetAutocenter().
  5943. *
  5944. * device_index Index of the device to open.
  5945. * Device identifier or NULL on error.
  5946. *
  5947. * SDL_HapticIndex
  5948. * SDL_HapticOpenFromMouse
  5949. * SDL_HapticOpenFromJoystick
  5950. * SDL_HapticClose
  5951. * SDL_HapticSetGain
  5952. * SDL_HapticSetAutocenter
  5953. * SDL_HapticPause
  5954. * SDL_HapticStopAll
  5955. *}
  5956. function SDL_HapticOpen(device_index: Integer): PSDL_Haptic;
  5957. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticOpen' {$ENDIF} {$ENDIF};
  5958. {**
  5959. * Checks if the haptic device at index has been opened.
  5960. *
  5961. * device_index Index to check to see if it has been opened.
  5962. * 1 if it has been opened or 0 if it hasn't.
  5963. *
  5964. * SDL_HapticOpen
  5965. * SDL_HapticIndex
  5966. *}
  5967. function SDL_HapticOpened(device_index: Integer): Integer;
  5968. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticOpened' {$ENDIF} {$ENDIF};
  5969. {**
  5970. * Gets the index of a haptic device.
  5971. *
  5972. * haptic Haptic device to get the index of.
  5973. * The index of the haptic device or -1 on error.
  5974. *
  5975. * SDL_HapticOpen
  5976. * SDL_HapticOpened
  5977. *}
  5978. function SDL_HapticIndex(haptic: PSDL_Haptic): Integer;
  5979. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticIndex' {$ENDIF} {$ENDIF};
  5980. {**
  5981. * Gets whether or not the current mouse has haptic capabilities.
  5982. *
  5983. * SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
  5984. *
  5985. * SDL_HapticOpenFromMouse
  5986. *}
  5987. function SDL_MouseIsHaptic() : Integer;
  5988. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_MouseInHaptic' {$ENDIF} {$ENDIF};
  5989. {**
  5990. * Tries to open a haptic device from the current mouse.
  5991. *
  5992. * The haptic device identifier or NULL on error.
  5993. *
  5994. * SDL_MouseIsHaptic
  5995. * SDL_HapticOpen
  5996. *}
  5997. function SDL_HapticOpenFromMouse() : PSDL_Haptic;
  5998. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticOpenFromMouse' {$ENDIF} {$ENDIF};
  5999. {**
  6000. * Checks to see if a joystick has haptic features.
  6001. *
  6002. * joystick Joystick to test for haptic capabilities.
  6003. * 1 if the joystick is haptic, 0 if it isn't
  6004. * or -1 if an error ocurred.
  6005. *
  6006. * SDL_HapticOpenFromJoystick
  6007. *}
  6008. function SDL_JoystickIsHaptic(joystick: PSDL_Joystick): Integer;
  6009. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_JoystickIsHaptic' {$ENDIF} {$ENDIF};
  6010. {**
  6011. * Opens a Haptic device for usage from a Joystick device.
  6012. *
  6013. * You must still close the haptic device seperately. It will not be closed
  6014. * with the joystick.
  6015. *
  6016. * When opening from a joystick you should first close the haptic device before
  6017. * closing the joystick device. If not, on some implementations the haptic
  6018. * device will also get unallocated and you'll be unable to use force feedback
  6019. * on that device.
  6020. *
  6021. * joystick Joystick to create a haptic device from.
  6022. * A valid haptic device identifier on success or NULL on error.
  6023. *
  6024. * SDL_HapticOpen
  6025. * SDL_HapticClose
  6026. *}
  6027. function SDL_HapticOpenFromJoystick(joystick: PSDL_Joystick): PSDL_Haptic;
  6028. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticOpenFromJoystick' {$ENDIF} {$ENDIF};
  6029. {**
  6030. * Closes a Haptic device previously opened with SDL_HapticOpen().
  6031. *
  6032. * haptic Haptic device to close.
  6033. *}
  6034. procedure SDL_HapticClose(haptic: PSDL_Haptic);
  6035. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticClose' {$ENDIF} {$ENDIF};
  6036. {**
  6037. * Returns the number of effects a haptic device can store.
  6038. *
  6039. * On some platforms this isn't fully supported, and therefore is an
  6040. * approximation. Always check to see if your created effect was actually
  6041. * created and do not rely solely on SDL_HapticNumEffects().
  6042. *
  6043. * haptic The haptic device to query effect max.
  6044. * The number of effects the haptic device can store or
  6045. * -1 on error.
  6046. *
  6047. * SDL_HapticNumEffectsPlaying
  6048. * SDL_HapticQuery
  6049. *}
  6050. function SDL_HapticNumEffects(haptic: PSDL_Haptic): Integer;
  6051. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticNumEffects' {$ENDIF} {$ENDIF};
  6052. {**
  6053. * Returns the number of effects a haptic device can play at the same
  6054. * time.
  6055. *
  6056. * This is not supported on all platforms, but will always return a value.
  6057. * Added here for the sake of completeness.
  6058. *
  6059. * haptic The haptic device to query maximum playing effects.
  6060. * The number of effects the haptic device can play at the same time
  6061. * or -1 on error.
  6062. *
  6063. * SDL_HapticNumEffects
  6064. * SDL_HapticQuery
  6065. *}
  6066. function SDL_HapticNumEffectsPlaying(haptic: PSDL_Haptic): Integer;
  6067. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticNumEffectsPlaying' {$ENDIF} {$ENDIF};
  6068. {**
  6069. * Gets the haptic devices supported features in bitwise matter.
  6070. *
  6071. * Example:
  6072. *
  6073. * if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT)
  6074. * printf("We have constant haptic effect!");
  6075. *
  6076. *
  6077. *
  6078. * haptic The haptic device to query.
  6079. * Haptic features in bitwise manner (OR'd).
  6080. *
  6081. * SDL_HapticNumEffects
  6082. * SDL_HapticEffectSupported
  6083. *}
  6084. function SDL_HapticQuery(haptic: PSDL_Haptic): UInt32;
  6085. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticQuery' {$ENDIF} {$ENDIF};
  6086. {**
  6087. * Gets the number of haptic axes the device has.
  6088. *
  6089. * SDL_HapticDirection
  6090. *}
  6091. function SDL_HapticNumAxes(haptic: PSDL_Haptic): Integer;
  6092. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticNumAxes' {$ENDIF} {$ENDIF};
  6093. {**
  6094. * Checks to see if effect is supported by haptic.
  6095. *
  6096. * haptic Haptic device to check on.
  6097. * effect Effect to check to see if it is supported.
  6098. * SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
  6099. *
  6100. * SDL_HapticQuery
  6101. * SDL_HapticNewEffect
  6102. *}
  6103. function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): Integer;
  6104. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticEffectSupported' {$ENDIF} {$ENDIF};
  6105. {**
  6106. * Creates a new haptic effect on the device.
  6107. *
  6108. * haptic Haptic device to create the effect on.
  6109. * effect Properties of the effect to create.
  6110. * The id of the effect on success or -1 on error.
  6111. *
  6112. * SDL_HapticUpdateEffect
  6113. * SDL_HapticRunEffect
  6114. * SDL_HapticDestroyEffect
  6115. *}
  6116. function SDL_HapticNewEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): Integer;
  6117. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticNewEffect' {$ENDIF} {$ENDIF};
  6118. {**
  6119. * Updates the properties of an effect.
  6120. *
  6121. * Can be used dynamically, although behaviour when dynamically changing
  6122. * direction may be strange. Specifically the effect may reupload itself
  6123. * and start playing from the start. You cannot change the type either when
  6124. * running SDL_HapticUpdateEffect().
  6125. *
  6126. * haptic Haptic device that has the effect.
  6127. * effect Effect to update.
  6128. * data New effect properties to use.
  6129. * The id of the effect on success or -1 on error.
  6130. *
  6131. * SDL_HapticNewEffect
  6132. * SDL_HapticRunEffect
  6133. * SDL_HapticDestroyEffect
  6134. *}
  6135. function SDL_HapticUpdateEffect(haptic: PSDL_Haptic; effect: Integer; data: PSDL_HapticEffect): Integer;
  6136. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticUpdateEffect' {$ENDIF} {$ENDIF};
  6137. {**
  6138. * Runs the haptic effect on its associated haptic device.
  6139. *
  6140. * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
  6141. * repeating the envelope (attack and fade) every time. If you only want the
  6142. * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
  6143. * parameter.
  6144. *
  6145. * haptic Haptic device to run the effect on.
  6146. * effect Identifier of the haptic effect to run.
  6147. * iterations Number of iterations to run the effect. Use
  6148. * SDL_HAPTIC_INFINITY for infinity.
  6149. * 0 on success or -1 on error.
  6150. *
  6151. * SDL_HapticStopEffect
  6152. * SDL_HapticDestroyEffect
  6153. * SDL_HapticGetEffectStatus
  6154. *}
  6155. function SDL_HapticRunEffect(haptic: PSDL_Haptic; effect: Integer; iterations: UInt32): Integer;
  6156. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticRunEffect' {$ENDIF} {$ENDIF};
  6157. {**
  6158. * Stops the haptic effect on its associated haptic device.
  6159. *
  6160. * haptic Haptic device to stop the effect on.
  6161. * effect Identifier of the effect to stop.
  6162. * 0 on success or -1 on error.
  6163. *
  6164. * SDL_HapticRunEffect
  6165. * SDL_HapticDestroyEffect
  6166. *}
  6167. function SDL_HapticStopEffect(haptic: PSDL_Haptic; effect: Integer): Integer;
  6168. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticStopEffect' {$ENDIF} {$ENDIF};
  6169. {**
  6170. * Destroys a haptic effect on the device.
  6171. *
  6172. * This will stop the effect if it's running. Effects are automatically
  6173. * destroyed when the device is closed.
  6174. *
  6175. * haptic Device to destroy the effect on.
  6176. * effect Identifier of the effect to destroy.
  6177. *
  6178. * SDL_HapticNewEffect
  6179. *}
  6180. procedure SDL_HapticDestroyEffect(haptic: PSDL_Haptic; effect: Integer);
  6181. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticDestroyEffect' {$ENDIF} {$ENDIF};
  6182. {**
  6183. * Gets the status of the current effect on the haptic device.
  6184. *
  6185. * Device must support the ::SDL_HAPTIC_STATUS feature.
  6186. *
  6187. * haptic Haptic device to query the effect status on.
  6188. * effect Identifier of the effect to query its status.
  6189. * 0 if it isn't playing, 1 if it is playing or -1 on error.
  6190. *
  6191. * SDL_HapticRunEffect
  6192. * SDL_HapticStopEffect
  6193. *}
  6194. function SDL_HapticGetEffectStatus(haptic: PSDL_Haptic; effect: Integer): Integer;
  6195. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticGetEffectStatus' {$ENDIF} {$ENDIF};
  6196. {**
  6197. * Sets the global gain of the device.
  6198. *
  6199. * Device must support the SDL_HAPTIC_GAIN feature.
  6200. *
  6201. * The user may specify the maximum gain by setting the environment variable
  6202. * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to
  6203. * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the
  6204. * maximum.
  6205. *
  6206. * haptic Haptic device to set the gain on.
  6207. * gain Value to set the gain to, should be between 0 and 100.
  6208. * 0 on success or -1 on error.
  6209. *
  6210. * SDL_HapticQuery
  6211. *}
  6212. function SDL_HapticSetGain(haptic: PSDL_Haptic; gain: Integer): Integer;
  6213. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticSetGain' {$ENDIF} {$ENDIF};
  6214. {**
  6215. * Sets the global autocenter of the device.
  6216. *
  6217. * Autocenter should be between 0 and 100. Setting it to 0 will disable
  6218. * autocentering.
  6219. *
  6220. * Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
  6221. *
  6222. * haptic Haptic device to set autocentering on.
  6223. * autocenter Value to set autocenter to, 0 disables autocentering.
  6224. * 0 on success or -1 on error.
  6225. *
  6226. * SDL_HapticQuery
  6227. *}
  6228. function SDL_HapticSetAutocenter(haptic: PSDL_Haptic; autocenter: Integer): Integer;
  6229. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticSetAutocenter' {$ENDIF} {$ENDIF};
  6230. {**
  6231. * Pauses a haptic device.
  6232. *
  6233. * Device must support the SDL_HAPTIC_PAUSE feature. Call
  6234. * SDL_HapticUnpause() to resume playback.
  6235. *
  6236. * Do not modify the effects nor add new ones while the device is paused.
  6237. * That can cause all sorts of weird errors.
  6238. *
  6239. * haptic Haptic device to pause.
  6240. * 0 on success or -1 on error.
  6241. *
  6242. * SDL_HapticUnpause
  6243. *}
  6244. function SDL_HapticPause(haptic: PSDL_Haptic): Integer;
  6245. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticPause' {$ENDIF} {$ENDIF};
  6246. {**
  6247. * Unpauses a haptic device.
  6248. *
  6249. * Call to unpause after SDL_HapticPause().
  6250. *
  6251. * haptic Haptic device to pause.
  6252. * 0 on success or -1 on error.
  6253. *
  6254. * SDL_HapticPause
  6255. *}
  6256. function SDL_HapticUnpause(haptic: PSDL_Haptic): Integer;
  6257. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticUnPause' {$ENDIF} {$ENDIF};
  6258. {**
  6259. * Stops all the currently playing effects on a haptic device.
  6260. *
  6261. * haptic Haptic device to stop.
  6262. * 0 on success or -1 on error.
  6263. *}
  6264. function SDL_HapticStopAll(haptic: PSDL_Haptic): Integer;
  6265. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticStopAll' {$ENDIF} {$ENDIF};
  6266. {**
  6267. * Checks to see if rumble is supported on a haptic device..
  6268. *
  6269. * haptic Haptic device to check to see if it supports rumble.
  6270. * SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
  6271. *
  6272. * SDL_HapticRumbleInit
  6273. * SDL_HapticRumblePlay
  6274. * SDL_HapticRumbleStop
  6275. *}
  6276. function SDL_HapticRumbleSupported(haptic: PSDL_Haptic): Integer;
  6277. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticRumbleSupported' {$ENDIF} {$ENDIF};
  6278. {**
  6279. * Initializes the haptic device for simple rumble playback.
  6280. *
  6281. * haptic Haptic device to initialize for simple rumble playback.
  6282. * 0 on success or -1 on error.
  6283. *
  6284. * SDL_HapticOpen
  6285. * SDL_HapticRumbleSupported
  6286. * SDL_HapticRumblePlay
  6287. * SDL_HapticRumbleStop
  6288. *}
  6289. function SDL_HapticRumbleInit(haptic: PSDL_Haptic): Integer;
  6290. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticRumbleInit' {$ENDIF} {$ENDIF};
  6291. {**
  6292. * Runs simple rumble on a haptic device
  6293. *
  6294. * haptic Haptic device to play rumble effect on.
  6295. * strength Strength of the rumble to play as a 0-1 float value.
  6296. * length Length of the rumble to play in milliseconds.
  6297. * 0 on success or -1 on error.
  6298. *
  6299. * SDL_HapticRumbleSupported
  6300. * SDL_HapticRumbleInit
  6301. * SDL_HapticRumbleStop
  6302. *}
  6303. function SDL_HapticRumblePlay(haptic: PSDL_Haptic; strength: Float; length: UInt32): Integer;
  6304. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticRumblePlay' {$ENDIF} {$ENDIF};
  6305. {**
  6306. * Stops the simple rumble on a haptic device.
  6307. *
  6308. * haptic Haptic to stop the rumble on.
  6309. * 0 on success or -1 on error.
  6310. *
  6311. * SDL_HapticRumbleSupported
  6312. * SDL_HapticRumbleInit
  6313. * SDL_HapticRumblePlay
  6314. *}
  6315. function SDL_HapticRumbleStop(haptic: PSDL_Haptic): Integer;
  6316. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HapticRumbleStop' {$ENDIF} {$ENDIF};
  6317. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  6318. ////////////////////// SDL_touch.h ////////////////////////////////////////////////////
  6319. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  6320. type
  6321. PSDL_TouchID = ^TSDL_TouchID;
  6322. TSDL_TouchID = SInt64;
  6323. PSDL_FingerID = ^TSDL_FingerID;
  6324. TSDL_FingerID = SInt64;
  6325. PSDL_Finger = ^TSDL_Finger;
  6326. TSDL_Finger = record
  6327. id: TSDL_FingerID;
  6328. x: Float;
  6329. y: Float;
  6330. pressure: Float;
  6331. end;
  6332. {* Used as the device ID for mouse events simulated with touch input *}
  6333. const
  6334. SDL_TOUCH_MOUSEID = UInt32(-1);
  6335. {* Function prototypes *}
  6336. {**
  6337. * Get the number of registered touch devices.
  6338. *}
  6339. function SDL_GetNumTouchDevices(): SInt32;
  6340. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetNumTouchDevices' {$ENDIF} {$ENDIF};
  6341. {**
  6342. * Get the touch ID with the given index, or 0 if the index is invalid.
  6343. *}
  6344. function SDL_GetTouchDevice(index: SInt32): TSDL_TouchID;
  6345. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetTouchDevice' {$ENDIF} {$ENDIF};
  6346. {**
  6347. * Get the number of active fingers for a given touch device.
  6348. *}
  6349. function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): SInt32;
  6350. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetNumTouchFingers' {$ENDIF} {$ENDIF};
  6351. {**
  6352. * Get the finger object of the given touch, with the given index.
  6353. *}
  6354. function SDL_GetTouchFinger(touchID: TSDL_TouchID; index: SInt32): PSDL_Finger;
  6355. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetTouchFinger' {$ENDIF} {$ENDIF};
  6356. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  6357. ////////////////////// SDL_gesture.h ////////////////////////////////////////////////////
  6358. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  6359. type
  6360. TSDL_GestureID = SInt64;
  6361. {* Function prototypes *}
  6362. {**
  6363. * Begin Recording a gesture on the specified touch, or all touches (-1)
  6364. *
  6365. *
  6366. *}
  6367. function SDL_RecordGesture(touchId: TSDL_TouchID): SInt32;
  6368. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RecordGesture' {$ENDIF} {$ENDIF};
  6369. {**
  6370. * Save all currently loaded Dollar Gesture templates
  6371. *
  6372. *
  6373. *}
  6374. function SDL_SaveAllDollarTemplates(src: PSDL_RWops): SInt32;
  6375. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SaveAllDollarTemplates' {$ENDIF} {$ENDIF};
  6376. {**
  6377. * Save a currently loaded Dollar Gesture template
  6378. *
  6379. *
  6380. *}
  6381. function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; src: PSDL_RWops): SInt32;
  6382. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SaveDollarTemplate' {$ENDIF} {$ENDIF};
  6383. {**
  6384. * Load Dollar Gesture templates from a file
  6385. *
  6386. *
  6387. *}
  6388. function SDL_LoadDollarTemplates(touchId: TSDL_TouchID; src: PSDL_RWops): SInt32;
  6389. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LoadDollarTemplates' {$ENDIF} {$ENDIF};
  6390. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  6391. ////////////////////// SDL_events.h ////////////////////////////////////////////////////
  6392. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  6393. {**
  6394. * The types of events that can be delivered.
  6395. *}
  6396. const
  6397. SDL_FIRSTEVENT = 0; // Unused (do not remove) (needed in pascal?)
  6398. SDL_COMMONEVENT = 1; //added for pascal-compatibility
  6399. { Application events }
  6400. SDL_QUITEV = $100; // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT)
  6401. {* These application events have special meaning on iOS, see README.iOS for details *}
  6402. SDL_APP_TERMINATING = $101; {**< The application is being terminated by the OS
  6403. Called on iOS in applicationWillTerminate()
  6404. Called on Android in onDestroy()
  6405. *}
  6406. SDL_APP_LOWMEMORY = $102; {**< The application is low on memory, free memory if possible.
  6407. Called on iOS in applicationDidReceiveMemoryWarning()
  6408. Called on Android in onLowMemory()
  6409. *}
  6410. SDL_APP_WILLENTERBACKGROUND = $103; {**< The application is about to enter the background
  6411. Called on iOS in applicationWillResignActive()
  6412. Called on Android in onPause()
  6413. *}
  6414. SDL_APP_DIDENTERBACKGROUND = $104; {**< The application did enter the background and may not get CPU for some time
  6415. Called on iOS in applicationDidEnterBackground()
  6416. Called on Android in onPause()
  6417. *}
  6418. SDL_APP_WILLENTERFOREGROUND = $105; {**< The application is about to enter the foreground
  6419. Called on iOS in applicationWillEnterForeground()
  6420. Called on Android in onResume()
  6421. *}
  6422. SDL_APP_DIDENTERFOREGROUND = $106; {**< The application is now interactive
  6423. Called on iOS in applicationDidBecomeActive()
  6424. Called on Android in onResume()
  6425. *}
  6426. { Window events }
  6427. SDL_WINDOWEVENT = $200; // Window state change
  6428. SDL_SYSWMEVENT = $201; // System specific event
  6429. { Keyboard events }
  6430. SDL_KEYDOWN = $300; // Key pressed
  6431. SDL_KEYUP = $301; // Key released
  6432. SDL_TEXTEDITING = $302; // Keyboard text editing (composition)
  6433. SDL_TEXTINPUT = $303; // Keyboard text input
  6434. { Mouse events }
  6435. SDL_MOUSEMOTION = $400; // Mouse moved
  6436. SDL_MOUSEBUTTONDOWN = $401; // Mouse button pressed
  6437. SDL_MOUSEBUTTONUP = $402; // Mouse button released
  6438. SDL_MOUSEWHEEL = $403; // Mouse wheel motion
  6439. { Joystick events }
  6440. SDL_JOYAXISMOTION = $600; // Joystick axis motion
  6441. SDL_JOYBALLMOTION = $601; // Joystick trackball motion
  6442. SDL_JOYHATMOTION = $602; // Joystick hat position change
  6443. SDL_JOYBUTTONDOWN = $603; // Joystick button pressed
  6444. SDL_JOYBUTTONUP = $604; // Joystick button released
  6445. SDL_JOYDEVICEADDED = $605; // A new joystick has been inserted into the system
  6446. SDL_JOYDEVICEREMOVED = $606; // An opened joystick has been removed
  6447. { Game controller events }
  6448. SDL_CONTROLLERAXISMOTION = $650; // Game controller axis motion
  6449. SDL_CONTROLLERBUTTONDOWN = $651; // Game controller button pressed
  6450. SDL_CONTROLLERBUTTONUP = $652; // Game controller button released
  6451. SDL_CONTROLLERDEVICEADDED = $653; // A new Game controller has been inserted into the system
  6452. SDL_CONTROLLERDEVICEREMOVED = $654; // An opened Game controller has been removed
  6453. SDL_CONTROLLERDEVICEREMAPPED = $655; // The controller mapping was updated
  6454. { Touch events }
  6455. SDL_FINGERDOWN = $700;
  6456. SDL_FINGERUP = $701;
  6457. SDL_FINGERMOTION = $702;
  6458. { Gesture events }
  6459. SDL_DOLLARGESTURE = $800;
  6460. SDL_DOLLARRECORD = $801;
  6461. SDL_MULTIGESTURE = $802;
  6462. { Clipboard events }
  6463. SDL_CLIPBOARDUPDATE = $900; // The clipboard changed
  6464. { Drag and drop events }
  6465. SDL_DROPFILE = $1000; // The system requests a file open
  6466. {** Events SDL_USEREVENT through SDL_LASTEVENT are for your use,
  6467. * and should be allocated with SDL_RegisterEvents()
  6468. *}
  6469. SDL_USEREVENT = $8000;
  6470. {**
  6471. * This last event is only for bounding internal arrays (needed in pascal ??)
  6472. *}
  6473. SDL_LASTEVENT = $FFFF;
  6474. type
  6475. TSDL_EventType = Word;
  6476. {**
  6477. * Fields shared by every event
  6478. *}
  6479. TSDL_CommonEvent = record
  6480. type_: UInt32;
  6481. timestamp: UInt32;
  6482. end;
  6483. {**
  6484. * Window state change event data (event.window.*)
  6485. *}
  6486. TSDL_WindowEvent = record
  6487. type_: UInt32; // SDL_WINDOWEVENT
  6488. timestamp: UInt32;
  6489. windowID: UInt32; // The associated window
  6490. event: UInt8; // SDL_WindowEventID
  6491. padding1: UInt8;
  6492. padding2: UInt8;
  6493. padding3: UInt8;
  6494. data1: SInt32; // event dependent data
  6495. data2: SInt32; // event dependent data
  6496. end;
  6497. {**
  6498. * Keyboard button event structure (event.key.*)
  6499. *}
  6500. TSDL_KeyboardEvent = record
  6501. type_: UInt32; // SDL_KEYDOWN or SDL_KEYUP
  6502. timestamp: UInt32;
  6503. windowID: UInt32; // The window with keyboard focus, if any
  6504. state: UInt8; // SDL_PRESSED or SDL_RELEASED
  6505. _repeat: UInt8; // Non-zero if this is a key repeat
  6506. padding2: UInt8;
  6507. padding3: UInt8;
  6508. keysym: TSDL_KeySym; // The key that was pressed or released
  6509. end;
  6510. const
  6511. SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32;
  6512. type
  6513. {**
  6514. * Keyboard text editing event structure (event.edit.*)
  6515. *}
  6516. TSDL_TextEditingEvent = record
  6517. type_: UInt32; // SDL_TEXTEDITING
  6518. timestamp: UInt32;
  6519. windowID: UInt32; // The window with keyboard focus, if any
  6520. text: array[0..SDL_TEXTEDITINGEVENT_TEXT_SIZE] of Char; // The editing text
  6521. start: SInt32; // The start cursor of selected editing text
  6522. length: SInt32; // The length of selected editing text
  6523. end;
  6524. const
  6525. SDL_TEXTINPUTEVENT_TEXT_SIZE = 32;
  6526. type
  6527. {**
  6528. * Keyboard text input event structure (event.text.*)
  6529. *}
  6530. TSDL_TextInputEvent = record
  6531. type_: UInt32; // SDL_TEXTINPUT
  6532. timestamp: UInt32;
  6533. windowID: UInt32; // The window with keyboard focus, if any
  6534. text: array[0..SDL_TEXTINPUTEVENT_TEXT_SIZE] of Char; // The input text
  6535. end;
  6536. {**
  6537. * Mouse motion event structure (event.motion.*)
  6538. *}
  6539. TSDL_MouseMotionEvent = record
  6540. type_: UInt32; // SDL_MOUSEMOTION
  6541. timestamp: UInt32;
  6542. windowID: UInt32; // The window with mouse focus, if any
  6543. which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
  6544. state: UInt8; // The current button state
  6545. padding1: UInt8;
  6546. padding2: UInt8;
  6547. padding3: UInt8;
  6548. x: SInt32; // X coordinate, relative to window
  6549. y: SInt32; // Y coordinate, relative to window
  6550. xrel: SInt32; // The relative motion in the X direction
  6551. yrel: SInt32; // The relative motion in the Y direction
  6552. end;
  6553. {**
  6554. * Mouse button event structure (event.button.*)
  6555. *}
  6556. TSDL_MouseButtonEvent = record
  6557. type_: UInt32; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
  6558. timestamp: UInt32;
  6559. windowID: UInt32; // The window with mouse focus, if any
  6560. which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
  6561. button: UInt8; // The mouse button index
  6562. state: UInt8; // SDL_PRESSED or SDL_RELEASED
  6563. padding1: UInt8;
  6564. padding2: UInt8;
  6565. x: SInt32; // X coordinate, relative to window
  6566. y: SInt32; // Y coordinate, relative to window
  6567. end;
  6568. {**
  6569. * Mouse wheel event structure (event.wheel.*)
  6570. *}
  6571. TSDL_MouseWheelEvent = record
  6572. type_: UInt32; // SDL_MOUSEWHEEL
  6573. timestamp: UInt32;
  6574. windowID: UInt32; // The window with mouse focus, if any
  6575. which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
  6576. x: SInt32; // The amount scrolled horizontally
  6577. y: SInt32; // The amount scrolled vertically
  6578. end;
  6579. {**
  6580. * Joystick axis motion event structure (event.jaxis.*)
  6581. *}
  6582. TSDL_JoyAxisEvent = record
  6583. type_: UInt32; // SDL_JOYAXISMOTION
  6584. timestamp: UInt32;
  6585. which: TSDL_JoystickID; // The joystick instance id
  6586. axis: UInt8; // The joystick axis index
  6587. padding1: UInt8;
  6588. padding2: UInt8;
  6589. padding3: UInt8;
  6590. value: SInt16; // The axis value (range: -32768 to 32767)
  6591. padding4: UInt16;
  6592. end;
  6593. {**
  6594. * Joystick trackball motion event structure (event.jball.*)
  6595. *}
  6596. TSDL_JoyBallEvent = record
  6597. type_: UInt32; // SDL_JOYBALLMOTION
  6598. timestamp: UInt32;
  6599. which: TSDL_JoystickID; // The joystick instance id
  6600. ball: UInt8; // The joystick trackball index
  6601. padding1: UInt8;
  6602. padding2: UInt8;
  6603. padding3: UInt8;
  6604. xrel: SInt16; // The relative motion in the X direction
  6605. yrel: SInt16; // The relative motion in the Y direction
  6606. end;
  6607. {**
  6608. * Joystick hat position change event structure (event.jhat.*)
  6609. *}
  6610. TSDL_JoyHatEvent = record
  6611. type_: UInt32; // SDL_JOYHATMOTION
  6612. timestamp: UInt32;
  6613. which: TSDL_JoystickID; // The joystick instance id
  6614. hat: UInt8; // The joystick hat index
  6615. value: UInt8; {* The hat position value.
  6616. * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
  6617. * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
  6618. * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
  6619. *
  6620. * Note that zero means the POV is centered.
  6621. *}
  6622. padding1: UInt8;
  6623. padding2: UInt8;
  6624. end;
  6625. {**
  6626. * Joystick button event structure (event.jbutton.*)
  6627. *}
  6628. TSDL_JoyButtonEvent = record
  6629. type_: UInt32; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP
  6630. timestamp: UInt32;
  6631. which: TSDL_JoystickID; // The joystick instance id
  6632. button: UInt8; // The joystick button index
  6633. state: UInt8; // SDL_PRESSED or SDL_RELEASED
  6634. padding1: UInt8;
  6635. padding2: UInt8;
  6636. end;
  6637. {**
  6638. * Joystick device event structure (event.jdevice.*)
  6639. *}
  6640. TSDL_JoyDeviceEvent = record
  6641. type_: UInt32; // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED
  6642. timestamp: UInt32;
  6643. which: SInt32; // The joystick device index for the ADDED event, instance id for the REMOVED event
  6644. end;
  6645. {**
  6646. * Game controller axis motion event structure (event.caxis.*)
  6647. *}
  6648. TSDL_ControllerAxisEvent = record
  6649. type_: UInt32; // SDL_CONTROLLERAXISMOTION
  6650. timestamp: UInt32;
  6651. which: TSDL_JoystickID; // The joystick instance id
  6652. axis: UInt8; // The controller axis (SDL_GameControllerAxis)
  6653. padding1: UInt8;
  6654. padding2: UInt8;
  6655. padding3: UInt8;
  6656. value: SInt16; // The axis value (range: -32768 to 32767)
  6657. padding4: UInt16;
  6658. end;
  6659. {**
  6660. * Game controller button event structure (event.cbutton.*)
  6661. *}
  6662. TSDL_ControllerButtonEvent = record
  6663. type_: UInt32; // SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP
  6664. timestamp: UInt32;
  6665. which: TSDL_JoystickID; // The joystick instance id
  6666. button: UInt8; // The controller button (SDL_GameControllerButton)
  6667. state: UInt8; // SDL_PRESSED or SDL_RELEASED
  6668. padding1: UInt8;
  6669. padding2: UInt8;
  6670. end;
  6671. {**
  6672. * Controller device event structure (event.cdevice.*)
  6673. *}
  6674. TSDL_ControllerDeviceEvent = record
  6675. type_: UInt32; // SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, or SDL_CONTROLLERDEVICEREMAPPED
  6676. timestamp: UInt32;
  6677. which: SInt32; // The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event
  6678. end;
  6679. {**
  6680. * Touch finger event structure (event.tfinger.*)
  6681. *}
  6682. TSDL_TouchFingerEvent = record
  6683. type_: UInt32; // SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP
  6684. timestamp: UInt32;
  6685. touchId: TSDL_TouchID; // The touch device id
  6686. fingerId: TSDL_FingerID;
  6687. x: Float; // Normalized in the range 0...1
  6688. y: Float; // Normalized in the range 0...1
  6689. dx: Float; // Normalized in the range 0...1
  6690. dy: Float; // Normalized in the range 0...1
  6691. pressure: Float; // Normalized in the range 0...1
  6692. end;
  6693. {**
  6694. * Multiple Finger Gesture Event (event.mgesture.*)
  6695. *}
  6696. TSDL_MultiGestureEvent = record
  6697. type_: UInt32; // SDL_MULTIGESTURE
  6698. timestamp: UInt32;
  6699. touchId: TSDL_TouchID; // The touch device index
  6700. dTheta: Float;
  6701. dDist: Float;
  6702. x: Float;
  6703. y: Float;
  6704. numFingers: UInt16;
  6705. padding: UInt16;
  6706. end;
  6707. {* (event.dgesture.*) *}
  6708. TSDL_DollarGestureEvent = record
  6709. type_: UInt32; // SDL_DOLLARGESTURE
  6710. timestamp: UInt32;
  6711. touchId: TSDL_TouchID; // The touch device id
  6712. gestureId: TSDL_GestureID;
  6713. numFingers: UInt32;
  6714. error: Float;
  6715. x: Float; // Normalized center of gesture
  6716. y: Float; // Normalized center of gesture
  6717. end;
  6718. {**
  6719. * An event used to request a file open by the system (event.drop.*)
  6720. * This event is disabled by default, you can enable it with SDL_EventState()
  6721. * If you enable this event, you must free the filename in the event.
  6722. *}
  6723. TSDL_DropEvent = record
  6724. type_: UInt32; // SDL_DROPFILE
  6725. timestamp: UInt32;
  6726. _file: PChar; // The file name, which should be freed with SDL_free()
  6727. end;
  6728. {**
  6729. * The "quit requested" event
  6730. *}
  6731. TSDL_QuitEvent = record
  6732. type_: UInt32; // SDL_QUIT
  6733. timestamp: UInt32;
  6734. end;
  6735. {**
  6736. * A user-defined event type (event.user.*)
  6737. *}
  6738. TSDL_UserEvent = record
  6739. type_: UInt32; // SDL_USEREVENT through SDL_NUMEVENTS-1
  6740. timestamp: UInt32;
  6741. windowID: UInt32; // The associated window if any
  6742. code: SInt32; // User defined event code
  6743. data1: Pointer; // User defined data pointer
  6744. data2: Pointer; // User defined data pointer
  6745. end;
  6746. {$IFDEF Unix}
  6747. //These are the various supported subsystems under UNIX
  6748. TSDL_SysWm = ( SDL_SYSWM_X11 ) ;
  6749. {$ENDIF}
  6750. // The windows custom event structure
  6751. {$IFDEF MSWINDOWS}
  6752. PSDL_SysWMmsg = ^TSDL_SysWMmsg;
  6753. TSDL_SysWMmsg = record
  6754. version: TSDL_Version;
  6755. h_wnd: HWND; // The window for the message
  6756. msg: UInt32; // The type of message
  6757. w_Param: WPARAM; // WORD message parameter
  6758. lParam: LPARAM; // LONG message parameter
  6759. end;
  6760. {$ELSE}
  6761. {$IFDEF Unix}
  6762. { The Linux custom event structure }
  6763. PSDL_SysWMmsg = ^TSDL_SysWMmsg;
  6764. TSDL_SysWMmsg = record
  6765. version : TSDL_Version;
  6766. subsystem : TSDL_SysWm;
  6767. {$IFDEF FPC}
  6768. {$IFNDEF DARWIN}
  6769. event : TXEvent;
  6770. {$ENDIF}
  6771. {$ELSE}
  6772. event : XEvent;
  6773. {$ENDIF}
  6774. end;
  6775. {$ELSE}
  6776. { The generic custom event structure }
  6777. PSDL_SysWMmsg = ^TSDL_SysWMmsg;
  6778. TSDL_SysWMmsg = record
  6779. version: TSDL_Version;
  6780. data: Integer;
  6781. end;
  6782. {$ENDIF}
  6783. {$ENDIF}
  6784. // The Windows custom window manager information structure
  6785. {$IFDEF MSWINDOWS}
  6786. PSDL_SysWMinfo = ^TSDL_SysWMinfo;
  6787. TSDL_SysWMinfo = record
  6788. version : TSDL_Version;
  6789. window : HWnd; // The display window
  6790. end;
  6791. {$ELSE}
  6792. // The Linux custom window manager information structure
  6793. {$IFDEF Unix}
  6794. {$IFNDEF DARWIN}
  6795. TX11 = record
  6796. display : PDisplay; // The X11 display
  6797. window : TWindow; // The X11 display window */
  6798. {* These locking functions should be called around
  6799. any X11 functions using the display variable.
  6800. They lock the event thread, so should not be
  6801. called around event functions or from event filters.
  6802. *}
  6803. lock_func : Pointer;
  6804. unlock_func : Pointer;
  6805. // Introduced in SDL 1.0.2
  6806. fswindow : TWindow; // The X11 fullscreen window */
  6807. wmwindow : TWindow; // The X11 managed input window */
  6808. end;
  6809. {$ENDIF}
  6810. PSDL_SysWMinfo = ^TSDL_SysWMinfo;
  6811. TSDL_SysWMinfo = record
  6812. version : TSDL_Version;
  6813. subsystem : TSDL_SysWm;
  6814. {$IFNDEF DARWIN}
  6815. X11 : TX11;
  6816. {$ENDIF}
  6817. end;
  6818. {$ELSE}
  6819. // The generic custom window manager information structure
  6820. PSDL_SysWMinfo = ^TSDL_SysWMinfo;
  6821. TSDL_SysWMinfo = record
  6822. version : TSDL_Version;
  6823. data : integer;
  6824. end;
  6825. {$ENDIF}
  6826. {$ENDIF}
  6827. {**
  6828. * A video driver dependent system event (event.syswm.*)
  6829. * This event is disabled by default, you can enable it with SDL_EventState()
  6830. *
  6831. * If you want to use this event, you should include SDL_syswm.h.
  6832. *}
  6833. PSDL_SysWMEvent = ^TSDL_SysWMEvent;
  6834. TSDL_SysWMEvent = record
  6835. type_: UInt32; // SDL_SYSWMEVENT
  6836. timestamp: UInt32;
  6837. msg: PSDL_SysWMmsg; // driver dependent data (defined in SDL_syswm.h)
  6838. end;
  6839. {**
  6840. * General event structure
  6841. *}
  6842. PSDL_Event = ^TSDL_Event;
  6843. TSDL_Event = record
  6844. case Integer of
  6845. 0: (type_: UInt32);
  6846. SDL_COMMONEVENT: (common: TSDL_CommonEvent);
  6847. SDL_WINDOWEVENT: (window: TSDL_WindowEvent);
  6848. SDL_KEYUP,
  6849. SDL_KEYDOWN: (key: TSDL_KeyboardEvent);
  6850. SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent);
  6851. SDL_TEXTINPUT: (text: TSDL_TextInputEvent);
  6852. SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
  6853. SDL_MOUSEBUTTONUP,
  6854. SDL_MOUSEBUTTONDOWN: (button: TSDL_MouseButtonEvent);
  6855. SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent);
  6856. SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent);
  6857. SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent);
  6858. SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent);
  6859. SDL_JOYBUTTONDOWN,
  6860. SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent);
  6861. SDL_JOYDEVICEADDED,
  6862. SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent);
  6863. SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent);
  6864. SDL_CONTROLLERBUTTONUP,
  6865. SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent);
  6866. SDL_CONTROLLERDEVICEADDED,
  6867. SDL_CONTROLLERDEVICEREMOVED,
  6868. SDL_CONTROLLERDEVICEREMAPPED: (cdevice: TSDL_ControllerDeviceEvent);
  6869. SDL_QUITEV: (quit: TSDL_QuitEvent);
  6870. SDL_USEREVENT: (user: TSDL_UserEvent);
  6871. SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent);
  6872. SDL_FINGERDOWN,
  6873. SDL_FINGERUP,
  6874. SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent);
  6875. SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent);
  6876. SDL_DOLLARGESTURE,SDL_DOLLARRECORD: (dgesture: TSDL_DollarGestureEvent);
  6877. SDL_DROPFILE: (drop: TSDL_DropEvent);
  6878. end;
  6879. {* Function prototypes *}
  6880. {**
  6881. * Pumps the event loop, gathering events from the input devices.
  6882. *
  6883. * This function updates the event queue and internal input device state.
  6884. *
  6885. * This should only be run in the thread that sets the video mode.
  6886. *}
  6887. procedure SDL_PumpEvents();
  6888. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF};
  6889. const
  6890. SDL_ADDEVENT = 0;
  6891. SDL_PEEKEVENT = 1;
  6892. SDL_GETEVENT = 2;
  6893. type
  6894. TSDL_EventAction = Word;
  6895. {**
  6896. * Checks the event queue for messages and optionally returns them.
  6897. *
  6898. * If action is SDL_ADDEVENT, up to numevents events will be added to
  6899. * the back of the event queue.
  6900. *
  6901. * If action is SDL_PEEKEVENT, up to numevents events at the front
  6902. * of the event queue, within the specified minimum and maximum type,
  6903. * will be returned and will not be removed from the queue.
  6904. *
  6905. * If action is SDL_GETEVENT, up to numevents events at the front
  6906. * of the event queue, within the specified minimum and maximum type,
  6907. * will be returned and will be removed from the queue.
  6908. *
  6909. * Result: The number of events actually stored, or -1 if there was an error.
  6910. *
  6911. * This function is thread-safe.
  6912. *}
  6913. function SDL_PeepEvents(events: PSDL_Event; numevents: SInt32; action: TSDL_EventAction; minType: UInt32; maxType: UInt32): SInt32;
  6914. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_PeepEvents' {$ENDIF} {$ENDIF};
  6915. {**
  6916. * Checks to see if certain event types are in the event queue.
  6917. *}
  6918. function SDL_HasEvent(type_: UInt32): TSDL_Bool;
  6919. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF};
  6920. function SDL_HasEvents(minType: UInt32; maxType: UInt32): TSDL_Bool;
  6921. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF};
  6922. {**
  6923. * This function clears events from the event queue
  6924. *}
  6925. procedure SDL_FlushEvent(type_: UInt32);
  6926. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF};
  6927. procedure SDL_FlushEvents(minType: UInt32; maxType: UInt32);
  6928. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF};
  6929. {**
  6930. * Polls for currently pending events.
  6931. *
  6932. * 1 if there are any pending events, or 0 if there are none available.
  6933. *
  6934. * event - If not nil, the next event is removed from the queue and
  6935. * stored in that area.
  6936. *}
  6937. function SDL_PollEvent(event: PSDL_Event): SInt32;
  6938. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF};
  6939. {**
  6940. * Waits indefinitely for the next available event.
  6941. *
  6942. * 1, or 0 if there was an error while waiting for events.
  6943. *
  6944. * event - If not nil, the next event is removed from the queue and
  6945. * stored in that area.
  6946. *}
  6947. function SDL_WaitEvent(event: PSDL_Event): SInt32;
  6948. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WaitEvent' {$ENDIF} {$ENDIF};
  6949. {**
  6950. * Waits until the specified timeout (in milliseconds) for the next
  6951. * available event.
  6952. *
  6953. * 1, or 0 if there was an error while waiting for events.
  6954. *
  6955. * event - If not nil, the next event is removed from the queue and
  6956. * stored in that area.
  6957. *}
  6958. function SDL_WaitEventTimeout(event: PSDL_Event; timeout: SInt32): SInt32;
  6959. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WaitEventTimeout' {$ENDIF} {$ENDIF};
  6960. {**
  6961. * Add an event to the event queue.
  6962. *
  6963. * 1 on success, 0 if the event was filtered, or -1 if the event queue
  6964. * was full or there was some other error.
  6965. *}
  6966. function SDL_PushEvent(event: PSDL_Event): SInt32;
  6967. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF};
  6968. type
  6969. PSDL_EventFilter = ^TSDL_EventFilter;
  6970. TSDL_EventFilter = function( event: PSDL_Event ): Integer; cdecl;
  6971. {**
  6972. * Sets up a filter to process all events before they change internal state and
  6973. * are posted to the internal event queue.
  6974. *
  6975. * If the filter returns 1, then the event will be added to the internal queue.
  6976. * If it returns 0, then the event will be dropped from the queue, but the
  6977. * internal state will still be updated. This allows selective filtering of
  6978. * dynamically arriving events.
  6979. *
  6980. * Be very careful of what you do in the event filter function, as
  6981. * it may run in a different thread!
  6982. *
  6983. * There is one caveat when dealing with the SDL_QUITEVENT event type. The
  6984. * event filter is only called when the window manager desires to close the
  6985. * application window. If the event filter returns 1, then the window will
  6986. * be closed, otherwise the window will remain open if possible.
  6987. *
  6988. * If the quit event is generated by an interrupt signal, it will bypass the
  6989. * internal queue and be delivered to the application at the next event poll.
  6990. *}
  6991. procedure SDL_SetEventFilter(filter: TSDL_EventFilter; userdata: Pointer);
  6992. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetEventFilter' {$ENDIF} {$ENDIF};
  6993. {**
  6994. * Return the current event filter - can be used to "chain" filters.
  6995. * If there is no event filter set, this function returns SDL_FALSE.
  6996. *}
  6997. function SDL_GetEventFilter(filter: PSDL_EventFilter; userdata: Pointer): TSDL_Bool;
  6998. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetEventFilter' {$ENDIF} {$ENDIF};
  6999. {**
  7000. * Add a function which is called when an event is added to the queue.
  7001. *}
  7002. procedure SDL_AddEventWatch(filter: TSDL_EventFilter; userdata: Pointer);
  7003. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AddEventWatch' {$ENDIF} {$ENDIF};
  7004. {**
  7005. * Remove an event watch function added with SDL_AddEventWatch()
  7006. *}
  7007. procedure SDL_DelEventWatch(filter: TSDL_EventFilter; userdata: Pointer);
  7008. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DelEventWatch' {$ENDIF} {$ENDIF};
  7009. {**
  7010. * Run the filter function on the current event queue, removing any
  7011. * events for which the filter returns 0.
  7012. *}
  7013. procedure SDL_FilterEvents(filter: TSDL_EventFilter; userdata: Pointer);
  7014. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_FilterEvents' {$ENDIF} {$ENDIF};
  7015. const
  7016. SDL_QUERY = -1;
  7017. SDL_IGNORE = 0;
  7018. SDL_DISABLE = 0;
  7019. SDL_ENABLE = 1;
  7020. {**
  7021. * This function allows you to set the state of processing certain events.
  7022. * - If state is set to SDL_IGNORE, that event will be automatically
  7023. * dropped from the event queue and will not event be filtered.
  7024. * - If state is set to SDL_ENABLE, that event will be processed
  7025. * normally.
  7026. * - If state is set to SDL_QUERY, SDL_EventState() will return the
  7027. * current processing state of the specified event.
  7028. *}
  7029. function SDL_EventState(type_: UInt32; state: SInt32): UInt8;
  7030. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_EventState' {$ENDIF} {$ENDIF};
  7031. function SDL_GetEventState(type_: UInt32): UInt8;
  7032. {**
  7033. * This function allocates a set of user-defined events, and returns
  7034. * the beginning event number for that set of events.
  7035. *
  7036. * If there aren't enough user-defined events left, this function
  7037. * returns (Uint32)-1
  7038. *}
  7039. function SDL_RegisterEvents(numevents: SInt32): UInt32;
  7040. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_RegisterEvents' {$ENDIF} {$ENDIF};
  7041. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7042. ////////////////////// SDL.h ////////////////////////////////////////////////////
  7043. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7044. const
  7045. SDL_INIT_TIMER = $00000001;
  7046. {$EXTERNALSYM SDL_INIT_TIMER}
  7047. SDL_INIT_AUDIO = $00000010;
  7048. {$EXTERNALSYM SDL_INIT_AUDIO}
  7049. SDL_INIT_VIDEO = $00000020;
  7050. {$EXTERNALSYM SDL_INIT_VIDEO}
  7051. SDL_INIT_JOYSTICK = $00000200;
  7052. {$EXTERNALSYM SDL_INIT_JOYSTICK}
  7053. SDL_INIT_HAPTIC = $00001000;
  7054. {$EXTERNALSYM SDL_INIT_HAPTIC}
  7055. SDL_INIT_GAMECONTROLLER = $00002000; //turn on game controller also implicitly does JOYSTICK
  7056. {$EXTERNALSYM SDL_INIT_GAMECONTROLLER}
  7057. SDL_INIT_NOPARACHUTE = $00100000; //Don't catch fatal signals
  7058. {$EXTERNALSYM SDL_INIT_NOPARACHUTE}
  7059. SDL_INIT_EVERYTHING = SDL_INIT_TIMER or
  7060. SDL_INIT_AUDIO or
  7061. SDL_INIT_VIDEO or
  7062. SDL_INIT_JOYSTICK or
  7063. SDL_INIT_HAPTIC or
  7064. SDL_INIT_GAMECONTROLLER;
  7065. {$EXTERNALSYM SDL_INIT_EVERYTHING}
  7066. {**
  7067. * This function initializes the subsystems specified by flags
  7068. * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
  7069. * signal handlers for some commonly ignored fatal signals (like SIGSEGV).
  7070. *}
  7071. function SDL_Init(flags: UInt32): SInt32;
  7072. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_Init' {$ENDIF} {$ENDIF};
  7073. {**
  7074. * This function initializes specific SDL subsystems
  7075. *}
  7076. function SDL_InitSubSystem(flags: UInt32): SInt32;
  7077. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_InitSubSystem' {$ENDIF} {$ENDIF};
  7078. {**
  7079. * This function cleans up specific SDL subsystems
  7080. *}
  7081. procedure SDL_QuitSubSystem(flags: UInt32);
  7082. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_QuitSubSystem' {$ENDIF} {$ENDIF};
  7083. {**
  7084. * This function returns a mask of the specified subsystems which have
  7085. * previously been initialized.
  7086. *
  7087. * If flags is 0, it returns a mask of all initialized subsystems.
  7088. *}
  7089. function SDL_WasInit(flags: UInt32): UInt32;
  7090. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_WasInit' {$ENDIF} {$ENDIF};
  7091. {**
  7092. * This function cleans up all initialized subsystems. You should
  7093. * call it upon all exit conditions.
  7094. *}
  7095. procedure SDL_Quit();
  7096. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_Quit' {$ENDIF} {$ENDIF};
  7097. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7098. ////////////////////// SDL_loadso.h ////////////////////////////////////////////////////
  7099. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7100. {**
  7101. * This function dynamically loads a shared object and returns a pointer
  7102. * to the object handle (or NULL if there was an error).
  7103. * The 'sofile' parameter is a system dependent name of the object file.
  7104. *}
  7105. function SDL_LoadObject(sofile: PChar): Pointer;
  7106. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LoadObject' {$ENDIF} {$ENDIF};
  7107. {**
  7108. * Given an object handle, this function looks up the address of the
  7109. * named function in the shared object and returns it. This address
  7110. * is no longer valid after calling SDL_UnloadObject().
  7111. *}
  7112. function SDL_LoadFunction(handle: Pointer; name: PChar): Pointer;
  7113. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_LoadFunction' {$ENDIF} {$ENDIF};
  7114. {**
  7115. * Unload a shared object from memory.
  7116. *}
  7117. procedure SDL_UnloadObject(handle: Pointer);
  7118. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_UnloadObject' {$ENDIF} {$ENDIF};
  7119. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7120. ////////////////////// SDL_platform.h ////////////////////////////////////////////////////
  7121. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7122. {**
  7123. * Gets the name of the platform.
  7124. *}
  7125. function SDL_GetPlatform(): PChar;
  7126. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetPlatform' {$ENDIF} {$ENDIF};
  7127. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7128. ////////////////////// SDL_hints.h ////////////////////////////////////////////////////
  7129. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7130. {/**
  7131. * \file SDL_hints.h
  7132. *
  7133. * Official documentation for SDL configuration variables
  7134. *
  7135. * This file contains functions to set and get configuration hints,
  7136. * as well as listing each of them alphabetically.
  7137. *
  7138. * The convention for naming hints is SDL_HINT_X, where "SDL_X" is
  7139. * the environment variable that can be used to override the default.
  7140. *
  7141. * In general these hints are just that - they may or may not be
  7142. * supported or applicable on any given platform, but they provide
  7143. * a way for an application or user to give the library a hint as
  7144. * to how they would like the library to work.
  7145. */
  7146. }
  7147. const
  7148. (**
  7149. * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
  7150. *
  7151. * SDL can try to accelerate the SDL screen surface by using streaming
  7152. * textures with a 3D rendering engine. This variable controls whether and
  7153. * how this is done.
  7154. *
  7155. * This variable can be set to the following values:
  7156. * "0" - Disable 3D acceleration
  7157. * "1" - Enable 3D acceleration, using the default renderer.
  7158. * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
  7159. *
  7160. * By default SDL tries to make a best guess for each platform whether
  7161. * to use acceleration or not.
  7162. *)
  7163. SDL_HINT_FRAMEBUFFER_ACCELERATION = 'SDL_FRAMEBUFFER_ACCELERATION';
  7164. {/**
  7165. * \brief A variable specifying which render driver to use.
  7166. *
  7167. * If the application doesn't pick a specific renderer to use, this variable
  7168. * specifies the name of the preferred renderer. If the preferred renderer
  7169. * can't be initialized, the normal default renderer is used.
  7170. *
  7171. * This variable is case insensitive and can be set to the following values:
  7172. * "direct3d"
  7173. * "opengl"
  7174. * "opengles2"
  7175. * "opengles"
  7176. * "software"
  7177. *
  7178. * The default varies by platform, but it's the first one in the list that
  7179. * is available on the current platform.
  7180. */}
  7181. SDL_HINT_RENDER_DRIVER = 'SDL_RENDER_DRIVER';
  7182. {/**
  7183. * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
  7184. *
  7185. * This variable can be set to the following values:
  7186. * "0" - Disable shaders
  7187. * "1" - Enable shaders
  7188. *
  7189. * By default shaders are used if OpenGL supports them.
  7190. */}
  7191. SDL_HINT_RENDER_OPENGL_SHADERS = 'SDL_RENDER_OPENGL_SHADERS';
  7192. {/**
  7193. * \brief A variable controlling the scaling quality
  7194. *
  7195. * This variable can be set to the following values:
  7196. * "0" or "nearest" - Nearest pixel sampling
  7197. * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
  7198. * "2" or "best" - Currently this is the same as "linear"
  7199. *
  7200. * By default nearest pixel sampling is used
  7201. */}
  7202. SDL_HINT_RENDER_SCALE_QUALITY = 'SDL_RENDER_SCALE_QUALITY';
  7203. {/**
  7204. * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
  7205. *
  7206. * This variable can be set to the following values:
  7207. * "0" - Disable vsync
  7208. * "1" - Enable vsync
  7209. *
  7210. * By default SDL does not sync screen surface updates with vertical refresh.
  7211. */}
  7212. SDL_HINT_RENDER_VSYNC = 'SDL_RENDER_VSYNC';
  7213. {/**
  7214. * \brief A variable controlling whether the X11 VidMode extension should be used.
  7215. *
  7216. * This variable can be set to the following values:
  7217. * "0" - Disable XVidMode
  7218. * "1" - Enable XVidMode
  7219. *
  7220. * By default SDL will use XVidMode if it is available.
  7221. */}
  7222. SDL_HINT_VIDEO_X11_XVIDMODE = 'SDL_VIDEO_X11_XVIDMODE';
  7223. {/**
  7224. * \brief A variable controlling whether the X11 Xinerama extension should be used.
  7225. *
  7226. * This variable can be set to the following values:
  7227. * "0" - Disable Xinerama
  7228. * "1" - Enable Xinerama
  7229. *
  7230. * By default SDL will use Xinerama if it is available.
  7231. */}
  7232. SDL_HINT_VIDEO_X11_XINERAMA = 'SDL_VIDEO_X11_XINERAMA';
  7233. {/**
  7234. * \brief A variable controlling whether the X11 XRandR extension should be used.
  7235. *
  7236. * This variable can be set to the following values:
  7237. * "0" - Disable XRandR
  7238. * "1" - Enable XRandR
  7239. *
  7240. * By default SDL will not use XRandR because of window manager issues.
  7241. */}
  7242. SDL_HINT_VIDEO_X11_XRANDR = 'SDL_VIDEO_X11_XRANDR';
  7243. {/**
  7244. * \brief A variable controlling whether grabbing input grabs the keyboard
  7245. *
  7246. * This variable can be set to the following values:
  7247. * "0" - Grab will affect only the mouse
  7248. * "1" - Grab will affect mouse and keyboard
  7249. *
  7250. * By default SDL will not grab the keyboard so system shortcuts still work.
  7251. */}
  7252. SDL_HINT_GRAB_KEYBOARD = 'SDL_GRAB_KEYBOARD';
  7253. {/**
  7254. * \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true.
  7255. *
  7256. */}
  7257. SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = 'SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS';
  7258. {/**
  7259. * \brief A variable controlling whether the idle timer is disabled on iOS.
  7260. *
  7261. * When an iOS app does not receive touches for some time, the screen is
  7262. * dimmed automatically. For games where the accelerometer is the only input
  7263. * this is problematic. This functionality can be disabled by setting this
  7264. * hint.
  7265. *
  7266. * This variable can be set to the following values:
  7267. * "0" - Enable idle timer
  7268. * "1" - Disable idle timer
  7269. */}
  7270. SDL_HINT_IDLE_TIMER_DISABLED = 'SDL_IOS_IDLE_TIMER_DISABLED';
  7271. {/**
  7272. * \brief A variable controlling which orientations are allowed on iOS.
  7273. *
  7274. * In some circumstances it is necessary to be able to explicitly control
  7275. * which UI orientations are allowed.
  7276. *
  7277. * This variable is a space delimited list of the following values:
  7278. * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
  7279. */}
  7280. SDL_HINT_ORIENTATIONS = 'SDL_IOS_ORIENTATIONS';
  7281. {/**
  7282. * \brief A variable that lets you disable the detection and use of Xinput gamepad devices
  7283. *
  7284. * The variable can be set to the following values:
  7285. * "0" - Disable XInput timer (only uses direct input)
  7286. * "1" - Enable XInput timer (the default)
  7287. */}
  7288. SDL_HINT_XINPUT_ENABLED = 'SDL_XINPUT_ENABLED';
  7289. {/**
  7290. * \brief A variable that lets you manually hint extra gamecontroller db entries
  7291. *
  7292. * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
  7293. *
  7294. * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
  7295. * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
  7296. */}
  7297. SDL_HINT_GAMECONTROLLERCONFIG = 'SDL_GAMECONTROLLERCONFIG';
  7298. {/**
  7299. * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
  7300. *
  7301. * The variable can be set to the following values:
  7302. * "0" - Disable joystick & gamecontroller input events when the
  7303. * application is in the background.
  7304. * "1" - Enable joystick & gamecontroller input events when the
  7305. * application is in the backgroumd.
  7306. *
  7307. * The default value is "0". This hint may be set at any time.
  7308. */}
  7309. SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = 'SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS';
  7310. {/**
  7311. * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it.
  7312. * This is a debugging aid for developers and not expected to be used by end users. The default is "1"
  7313. *
  7314. * This variable can be set to the following values:
  7315. * "0" - don't allow topmost
  7316. * "1" - allow topmost
  7317. */}
  7318. SDL_HINT_ALLOW_TOPMOST = 'SDL_ALLOW_TOPMOST';
  7319. {/**
  7320. * \brief A variable that controls the timer resolution, in milliseconds.
  7321. *
  7322. * The higher resolution the timer, the more frequently the CPU services
  7323. * timer interrupts, and the more precise delays are, but this takes up
  7324. * power and CPU time. This hint is only used on Windows 7 and earlier.
  7325. *
  7326. * See this blog post for more information:
  7327. * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
  7328. *
  7329. * If this variable is set to "0", the system timer resolution is not set.
  7330. *
  7331. * The default value is "1". This hint may be set at any time.
  7332. */}
  7333. SDL_HINT_TIMER_RESOLUTION = 'SDL_TIMER_RESOLUTION';
  7334. {/**
  7335. * \brief A hint that specifies whether the Direct3D device is initialized for thread-safe operations.
  7336. *
  7337. * By default the Direct3D device is created with thread-safety disabled.
  7338. *
  7339. * This variable can be set to the following values:
  7340. * "0" - disable thread-safety (faster)
  7341. * "1" - enable thread-safety (slower)
  7342. */}
  7343. SDL_HINT_RENDER_DIRECT3D_THREADSAFE = 'SDL_RENDER_DIRECT3D_THREADSAFE';
  7344. {/**
  7345. * \brief An enumeration of hint priorities
  7346. */}
  7347. type
  7348. SDL_HintPriority = (SDL_HINT_DEFAULT, SDL_HINT_NORMAL, SDL_HINT_OVERRIDE);
  7349. {/**
  7350. * \brief Set a hint with a specific priority
  7351. *
  7352. * The priority controls the behavior when setting a hint that already
  7353. * has a value. Hints will replace existing hints of their priority and
  7354. * lower. Environment variables are considered to have override priority.
  7355. *
  7356. * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
  7357. */}
  7358. function SDL_SetHintWithPriority( const name: PChar; const value: PChar; priority: SDL_HintPriority) : boolean;
  7359. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetHintWithPriority' {$ENDIF} {$ENDIF};
  7360. {/**
  7361. * \brief Set a hint with normal priority
  7362. *
  7363. * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
  7364. */}
  7365. function SDL_SetHint( const name: PChar; const value: PChar) : boolean;
  7366. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_SetHint' {$ENDIF} {$ENDIF};
  7367. {/**
  7368. * \brief Get a hint
  7369. *
  7370. * \return The string value of a hint variable.
  7371. */}
  7372. function SDL_GetHint( const name: PChar): PChar;
  7373. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_GetHint' {$ENDIF} {$ENDIF};
  7374. {/**
  7375. * \brief Add a function to watch a particular hint
  7376. *
  7377. * \param name The hint to watch
  7378. * \param callback The function to call when the hint value changes
  7379. * \param userdata A pointer to pass to the callback function
  7380. */}
  7381. type
  7382. TSDL_HintCallback = procedure(userdata: Pointer; const name: PChar; const oldValue: PChar; const newValue: PChar);
  7383. procedure SDL_AddHintCallback(const name: PChar; callback: TSDL_HintCallback; userdata: Pointer);
  7384. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_AddHintCallback' {$ENDIF} {$ENDIF};
  7385. {/**
  7386. * \brief Remove a function watching a particular hint
  7387. *
  7388. * \param name The hint being watched
  7389. * \param callback The function being called when the hint value changes
  7390. * \param userdata A pointer being passed to the callback function
  7391. */}
  7392. procedure SDL_DelHintCallback(const name: PChar; callback: TSDL_HintCallback; userdata: Pointer);
  7393. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_DelHintCallback' {$ENDIF} {$ENDIF};
  7394. {/**
  7395. * \brief Clear all hints
  7396. *
  7397. * This function is called during SDL_Quit() to free stored hints.
  7398. */}
  7399. procedure SDL_ClearHints();
  7400. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ClearHints' {$ENDIF} {$ENDIF};
  7401. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7402. ////////////////////// SDL_byteorder.h ////////////////////////////////////////////////
  7403. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7404. const
  7405. // SDL_byteorder.h constants
  7406. // The two types of endianness
  7407. SDL_LIL_ENDIAN = 1234;
  7408. SDL_BIG_ENDIAN = 4321;
  7409. SDL_BYTEORDER = SDL_LIL_ENDIAN;
  7410. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7411. ////////////////////// SDL_messagebox.h ////////////////////////////////////////////////////
  7412. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7413. {**
  7414. * SDL_MessageBox flags. If supported will display warning icon, etc.
  7415. *}
  7416. const
  7417. SDL_MESSAGEBOX_ERROR = $00000010; {**< error dialog *}
  7418. SDL_MESSAGEBOX_WARNING = $00000020; {**< warning dialog *}
  7419. SDL_MESSAGEBOX_INFORMATION = $00000040; {**< informational dialog *}
  7420. type
  7421. TSDL_MessageBoxFlags = Byte;
  7422. {**
  7423. * Flags for SDL_MessageBoxButtonData.
  7424. *}
  7425. const
  7426. SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = $00000001; {**< Marks the default button when return is hit *}
  7427. SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = $00000002; {**< Marks the default button when escape is hit *}
  7428. type
  7429. TSDL_MessageBoxButtonFlags = Byte;
  7430. {**
  7431. * Individual button data.
  7432. *}
  7433. type
  7434. PSDL_MessageBoxButtonData = ^TSDL_MessageBoxButtonData;
  7435. TSDL_MessageBoxButtonData = record
  7436. flags: UInt32; {**< ::SDL_MessageBoxButtonFlags *}
  7437. buttonid: Integer; {**< User defined button id (value returned via SDL_ShowMessageBox) *}
  7438. text: PChar; {**< The UTF-8 button text *}
  7439. end;
  7440. {**
  7441. * RGB value used in a message box color scheme
  7442. *}
  7443. type
  7444. PSDL_MessageBoxColor = ^TSDL_MessageBoxColor;
  7445. TSDL_MessageBoxColor = record
  7446. r, g, b: UInt8;
  7447. end;
  7448. PSDL_MessageBoxColorType = ^TSDL_MessageBoxColorType;
  7449. TSDL_MessageBoxColorType = (SDL_MESSAGEBOX_COLOR_BACKGROUND,
  7450. SDL_MESSAGEBOX_COLOR_TEXT,
  7451. SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
  7452. SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
  7453. SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
  7454. SDL_MESSAGEBOX_COLOR_MAX);
  7455. {**
  7456. * A set of colors to use for message box dialogs
  7457. *}
  7458. type
  7459. PSDL_MessageBoxColorScheme = ^TSDL_MessageBoxColorScheme;
  7460. TSDL_MessageBoxColorScheme = record
  7461. //colors: array[0..SDL_MESSAGEBOX_COLOR_MAX-1] of TSDL_MessageBoxColor;
  7462. colors: array[0..4] of TSDL_MessageBoxColor; //right?!
  7463. end;
  7464. {**
  7465. * MessageBox structure containing title, text, window, etc.
  7466. *}
  7467. type
  7468. PSDL_MessageBoxData = ^TSDL_MessageBoxData;
  7469. TSDL_MessageBoxData = record
  7470. flags: UInt32; {**< SDL_MessageBoxFlags *}
  7471. window: PSDL_Window; {**< Parent window, can be NULL *}
  7472. title: PChar; {**< UTF-8 title *}
  7473. _message: PChar; {**< UTF-8 message text *}
  7474. numbuttons: Integer;
  7475. buttons: PSDL_MessageBoxButtonData;
  7476. colorScheme: PSDL_MessageBoxColorScheme; {**< SDL_MessageBoxColorScheme, can be NULL to use system settings *}
  7477. end;
  7478. {**
  7479. * Create a modal message box.
  7480. *
  7481. * messageboxdata The SDL_MessageBoxData structure with title, text, etc.
  7482. * buttonid The pointer to which user id of hit button should be copied.
  7483. *
  7484. * -1 on error, otherwise 0 and buttonid contains user id of button
  7485. * hit or -1 if dialog was closed.
  7486. *
  7487. * This function should be called on the thread that created the parent
  7488. * window, or on the main thread if the messagebox has no parent. It will
  7489. * block execution of that thread until the user clicks a button or
  7490. * closes the messagebox.
  7491. *}
  7492. function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: PInt): Integer;
  7493. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ShowMessageBox' {$ENDIF} {$ENDIF};
  7494. {**
  7495. * Create a simple modal message box
  7496. *
  7497. * flags SDL_MessageBoxFlags
  7498. * title UTF-8 title text
  7499. * message UTF-8 message text
  7500. * window The parent window, or NULL for no parent
  7501. *
  7502. * 0 on success, -1 on error
  7503. *
  7504. * SDL_ShowMessageBox
  7505. *}
  7506. function SDL_ShowSimpleMessageBox(flags: UInt32; title: PChar; _message: PChar; window: PSDL_Window): Integer;
  7507. cdecl; external SDL_LibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDL_ShowSimpleMessageBox' {$ENDIF} {$ENDIF};
  7508. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7509. ////////////////////// *** KTI *** ////////////////////////////////////////////////
  7510. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7511. type
  7512. // SDLPantalla contiene la ventana SDL el Render donde se pinta y el zoom de los ejes X e Y
  7513. PSDLPantalla = ^TSDLPantalla;
  7514. TSDLPantalla = record
  7515. Window : PSDL_Window;
  7516. Renderer : PSDL_Renderer;
  7517. rx : Integer; // X donde empieza el render (para los ClipRect y el ratón) expresado en resolución lógica
  7518. ry : Integer; // Y donde empieza el render (para los ClipRect y el ratón)
  7519. lw : Integer; // ancho de la ventana en resolución lógica
  7520. lh : Integer; // alto de la ventana en resolución lógica
  7521. sx : Float; // multiplicador para pasar de resolución lógica a resolución real
  7522. sy : Float; // multiplicador para pasar de resolución lógica a resolución real
  7523. max_texture_width : SInt32; // ancho máximo de las texturas
  7524. max_texture_height : SInt32; // alto máximo de las texturas
  7525. hardware : Boolean; // indica si usamos aceleración hardware
  7526. render_name : String; // nombre de la VGA utilizada
  7527. end;
  7528. function SDL_Swap32(D: Uint32): Uint32;
  7529. function SDLStreamSetup( stream : TStream ) : PSDL_RWops;
  7530. function LoadSDLBMPFromStream( Stream : TStream ) : PSDL_Surface;
  7531. procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream );
  7532. procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops );
  7533. //******************************************************************************
  7534. //******************************************************************************
  7535. //******************************************************************************
  7536. //******************************************************************************
  7537. //******************************************************************************
  7538. implementation
  7539. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7540. ////////////////////// SDL_version.h ////////////////////////////////////////////////////
  7541. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7542. procedure SDL_VERSION(x: PSDL_Version);
  7543. begin
  7544. x.major := SDL_MAJOR_VERSION;
  7545. x.minor := SDL_MINOR_VERSION;
  7546. x.patch := SDL_PATCHLEVEL;
  7547. end;
  7548. //******************************************************************************
  7549. function SDL_VERSIONNUM(X,Y,Z: UInt32): Cardinal;
  7550. begin
  7551. Result := X*1000 + Y*100 + Z;
  7552. end;
  7553. //******************************************************************************
  7554. function SDL_COMPILEDVERSION(): Cardinal;
  7555. begin
  7556. Result := SDL_VERSIONNUM(SDL_MAJOR_VERSION,
  7557. SDL_MINOR_VERSION,
  7558. SDL_PATCHLEVEL);
  7559. end;
  7560. //******************************************************************************
  7561. function SDL_VERSION_ATLEAST(X,Y,Z: Cardinal): Boolean;
  7562. begin
  7563. Result := SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X,Y,Z);
  7564. end;
  7565. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7566. ////////////////////// SDL_thread .h ////////////////////////////////////////////////////
  7567. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7568. {$IFDEF MSWINDOWS}
  7569. function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PChar; data: Pointer): PSDL_Thread; overload;
  7570. begin
  7571. Result := SDL_CreateThread(fn,name,data,nil,nil);
  7572. end;
  7573. {$ENDIF}
  7574. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7575. ////////////////////// SDL_rect.h ////////////////////////////////////////////////////
  7576. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7577. function SDL_RectEmpty(X: TSDL_Rect): Boolean;
  7578. begin
  7579. Result := (X.w <= 0) or (X.h <= 0);
  7580. end;
  7581. //******************************************************************************
  7582. function SDL_RectEquals(A: TSDL_Rect; B: TSDL_Rect): Boolean;
  7583. begin
  7584. Result := (A.x = B.x) and (A.y = B.y) and (A.w = B.w) and (A.h = B.h);
  7585. end;
  7586. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7587. ////////////////////// SDL_rwops.h ////////////////////////////////////////////////////
  7588. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7589. function SDL_RWsize(ctx: PSDL_RWops): SInt64;
  7590. begin
  7591. Result := ctx^.size(ctx);
  7592. end;
  7593. //******************************************************************************
  7594. function SDL_RWseek(ctx: PSDL_RWops; offset: SInt64; whence: SInt32): SInt64;
  7595. begin
  7596. Result := ctx^.seek(ctx,offset,whence);
  7597. end;
  7598. //******************************************************************************
  7599. function SDL_RWtell(ctx: PSDL_RWops): SInt64;
  7600. begin
  7601. Result := ctx^.seek(ctx, 0, RW_SEEK_CUR);
  7602. end;
  7603. //******************************************************************************
  7604. function SDL_RWread(ctx: PSDL_RWops; ptr: Pointer; size: size_t; n: size_t): size_t;
  7605. begin
  7606. Result := ctx^.read(ctx, ptr, size, n);
  7607. end;
  7608. //******************************************************************************
  7609. function SDL_RWwrite(ctx: PSDL_RWops; ptr: Pointer; size: size_t; n: size_t): size_t;
  7610. begin
  7611. Result := ctx^.write(ctx, ptr, size, n);
  7612. end;
  7613. //******************************************************************************
  7614. function SDL_RWclose(ctx: PSDL_RWops): SInt32;
  7615. begin
  7616. Result := ctx^.close(ctx);
  7617. end;
  7618. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7619. ////////////////////// SDL_audio.h ///////////////////////////////////////////////////
  7620. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7621. function SDL_LoadWAV(_file: PChar; spec: PSDL_AudioSpec; audio_buf: PPUInt8; audio_len: PUInt32): PSDL_AudioSpec;
  7622. begin
  7623. Result := SDL_LoadWAV_RW(SDL_RWFromFile(_file, 'rb'), 1, spec, audio_buf, audio_len);
  7624. end;
  7625. //******************************************************************************
  7626. function SDL_AUDIO_BITSIZE(x: Cardinal): Cardinal;
  7627. begin
  7628. Result := x and SDL_AUDIO_MASK_BITSIZE;
  7629. end;
  7630. //******************************************************************************
  7631. function SDL_AUDIO_ISFLOAT(x: Cardinal): Cardinal;
  7632. begin
  7633. Result := x and SDL_AUDIO_MASK_DATATYPE;
  7634. end;
  7635. //******************************************************************************
  7636. function SDL_AUDIO_ISBIGENDIAN(x: Cardinal): Cardinal;
  7637. begin
  7638. Result := x and SDL_AUDIO_MASK_ENDIAN;
  7639. end;
  7640. //******************************************************************************
  7641. function SDL_AUDIO_ISSIGNED(x: Cardinal): Cardinal;
  7642. begin
  7643. Result := x and SDL_AUDIO_MASK_SIGNED;
  7644. end;
  7645. //******************************************************************************
  7646. function SDL_AUDIO_ISINT(x: Cardinal): Cardinal;
  7647. begin
  7648. Result := not SDL_AUDIO_ISFLOAT(x);
  7649. end;
  7650. //******************************************************************************
  7651. function SDL_AUDIO_ISLITTLEENDIAN(x: Cardinal): Cardinal;
  7652. begin
  7653. Result := not SDL_AUDIO_ISLITTLEENDIAN(x);
  7654. end;
  7655. //******************************************************************************
  7656. function SDL_AUDIO_ISUNSIGNED(x: Cardinal): Cardinal;
  7657. begin
  7658. Result := not SDL_AUDIO_ISSIGNED(x);
  7659. end;
  7660. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7661. ////////////////////// SDL_pixels.h ///////////////////////////////////////////////////
  7662. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7663. function SDL_PIXELFLAG(X: Cardinal): Boolean;
  7664. begin
  7665. Result := (X shr 28) = $0F;
  7666. end;
  7667. //******************************************************************************
  7668. function SDL_PIXELTYPE(X: Cardinal): Boolean;
  7669. begin
  7670. Result := (X shr 24) = $0F;
  7671. end;
  7672. //******************************************************************************
  7673. function SDL_PIXELORDER(X: Cardinal): Boolean;
  7674. begin
  7675. Result := (X shr 20) = $0F;
  7676. end;
  7677. //******************************************************************************
  7678. function SDL_PIXELLAYOUT(X: Cardinal): Boolean;
  7679. begin
  7680. Result := (X shr 16) = $0F;
  7681. end;
  7682. //******************************************************************************
  7683. function SDL_BITSPERPIXEL(X: Cardinal): Boolean;
  7684. begin
  7685. Result := (X shr 8) = $FF;
  7686. end;
  7687. //******************************************************************************
  7688. function SDL_IsPixelFormat_FOURCC(format: Variant): Boolean;
  7689. begin
  7690. {* The flag is set to 1 because 0x1? is not in the printable ASCII range *}
  7691. Result := format and SDL_PIXELFLAG(format) <> 1;
  7692. end;
  7693. function SDL_BYTESPERPIXEL(X: Integer): Integer;
  7694. begin
  7695. if SDL_ISPIXELFORMAT_FOURCC(X) then
  7696. begin
  7697. if (X = SDL_PIXELFORMAT_YUY2) or (X = SDL_PIXELFORMAT_UYVY) or (X = SDL_PIXELFORMAT_YVYU) then
  7698. Result := 2
  7699. else
  7700. Result := 1;
  7701. end
  7702. else
  7703. Result := X and $FF;
  7704. end;
  7705. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7706. ////////////////////// SDL_surface.h //////////////////////////////////////////////////
  7707. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7708. function SDL_LoadBMP(_file: PChar): PSDL_Surface;
  7709. begin
  7710. Result := SDL_LoadBMP_RW(SDL_RWFromFile(_file, 'rb'), 1);
  7711. end;
  7712. //******************************************************************************
  7713. function SDL_SaveBMP(surface: PSDL_Surface; _file: PChar): SInt32;
  7714. begin
  7715. Result := SDL_SaveBMP_RW(surface, SDL_RWFromFile(_file, 'wb'), 1);
  7716. end;
  7717. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7718. ////////////////////// SDL_video.h ////////////////////////////////////////////////////
  7719. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7720. function SDL_WindowPos_IsUndefined(X: Variant): Variant;
  7721. begin
  7722. Result := (X and $FFFF0000) = SDL_WINDOWPOS_UNDEFINED_MASK;
  7723. end;
  7724. //******************************************************************************
  7725. function SDL_WindowPos_IsCentered(X: Variant): Variant;
  7726. begin
  7727. Result := (X and $FFFF0000) = SDL_WINDOWPOS_CENTERED_MASK;
  7728. end;
  7729. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7730. ////////////////////// SDL_events.h ////////////////////////////////////////////////////
  7731. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7732. function SDL_GetEventState(type_: UInt32): UInt8;
  7733. begin
  7734. Result := SDL_EventState(type_, SDL_QUERY);
  7735. end;
  7736. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7737. ////////////////////// *** KTI *** ////////////////////////////////////////////////
  7738. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  7739. function SDL_Swap32(D: Uint32): Uint32;
  7740. begin
  7741. Result := ((D shl 24) or ((D shl 8) and $00FF0000) or ((D shr 8) and $0000FF00) or (D shr 24));
  7742. end;
  7743. //******************************************************************************
  7744. function SdlStreamSeek( context : PSDL_RWops; offset : SInt64; whence : SInt32 ) : SInt64; cdecl;
  7745. var
  7746. stream : TStream;
  7747. origin : Word;
  7748. begin
  7749. stream := TStream( context.unknown );
  7750. if ( stream = nil ) then
  7751. raise EInvalidContainer.Create( 'SDLStreamSeek on nil' );
  7752. case whence of
  7753. 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0.
  7754. 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset.
  7755. 2 : origin := soFromEnd;
  7756. else
  7757. origin := soFromBeginning; // just in case
  7758. end;
  7759. Result := stream.Seek( offset, origin );
  7760. end;
  7761. //******************************************************************************
  7762. function SDLStreamWrite( context : PSDL_RWops; const Ptr : Pointer; size : size_t; num : size_t ) : size_t; cdecl;
  7763. var
  7764. stream : TStream;
  7765. begin
  7766. stream := TStream( context.unknown );
  7767. if ( stream = nil ) then
  7768. raise EInvalidContainer.Create( 'SDLStreamWrite on nil' );
  7769. try
  7770. Result := stream.Write( Ptr^, Size * num ) div size;
  7771. except
  7772. Result := 0;
  7773. end;
  7774. end;
  7775. //******************************************************************************
  7776. function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : size_t; maxnum : size_t ) : size_t; cdecl;
  7777. var
  7778. stream : TStream;
  7779. begin
  7780. stream := TStream( context.unknown );
  7781. if ( stream = nil ) then
  7782. raise EInvalidContainer.Create( 'SDLStreamRead on nil' );
  7783. try
  7784. Result := stream.read( Ptr^, Size * maxnum ) div size;
  7785. except
  7786. Result := 0;
  7787. end;
  7788. end;
  7789. //******************************************************************************
  7790. function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl;
  7791. var
  7792. stream : TStream;
  7793. begin
  7794. stream := TStream( context.unknown );
  7795. if ( stream = nil ) then
  7796. raise EInvalidContainer.Create( 'SDLStreamClose on nil' );
  7797. stream.Free;
  7798. Result := 1;
  7799. end;
  7800. //******************************************************************************
  7801. function SDLStreamSetup( stream : TStream ) : PSDL_RWops;
  7802. begin
  7803. result := SDL_AllocRW;
  7804. if ( result = nil ) then
  7805. raise EInvalidContainer.Create( 'could not create SDLStream on nil' );
  7806. result.unknown := TUnknown( stream );
  7807. result.seek := SDLStreamSeek;
  7808. result.read := SDLStreamRead;
  7809. result.write := SDLStreamWrite;
  7810. result.close := SDLStreamClose;
  7811. Result._type := 2; // TUnknown
  7812. end;
  7813. //******************************************************************************
  7814. procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops );
  7815. begin
  7816. // this only closes the SDL part of the stream, not the context
  7817. SDL_FreeRW( SDL_RWops );
  7818. end;
  7819. //******************************************************************************
  7820. function LoadSDLBMPFromStream( stream : TStream ) : PSDL_Surface;
  7821. var
  7822. SDL_RWops : PSDL_RWops;
  7823. begin
  7824. SDL_RWops := SDLStreamSetup( stream );
  7825. result := SDL_LoadBMP_RW( SDL_RWops, 0 );
  7826. SDLStreamCloseRWops( SDL_RWops );
  7827. end;
  7828. //******************************************************************************
  7829. procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream );
  7830. var
  7831. SDL_RWops : PSDL_RWops;
  7832. begin
  7833. SDL_RWops := SDLStreamSetup( stream );
  7834. SDL_SaveBMP_RW( SDL_Surface, SDL_RWops, 0 );
  7835. SDLStreamCloseRWops( SDL_RWops );
  7836. stream.Position := 0;
  7837. end;
  7838. end.