SDL.Import.pas 325 KB

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