Compare commits

..

173 commits

Author SHA1 Message Date
f19bce1a57 Remove ECSEmscripten as Emscripten version is now supported in LDC (+fix compile scripts) 2025-05-14 13:26:10 +02:00
d77317c816 Make it possible to use custom runtime (such as numem) 2025-04-10 14:30:07 +02:00
76a23aa4ed Fix typo 2025-04-10 14:00:20 +02:00
9b75772039 Add missing export visibility attributes 2025-04-10 13:59:21 +02:00
50fa2ce19c Merge branch '2-empty-entity-crash' into 'master'
Fix crash in commit() when all components were removed from entity

Closes #2

See merge request Mergul/bubel-ecs!27
2023-04-27 10:30:22 +00:00
8ac9fa5dbd Fix crash in commit() when all components were removed from entity
Fix crash from issue #2 and add unittest case for it. Also implements general "empty" entity support
2023-04-24 23:46:16 +02:00
beb1837c43 Merge branch 'fixes' into 'master'
Fix unregisterSystem function

See merge request Mergul/bubel-ecs!26
2023-03-09 11:02:53 +00:00
0702b007d1 Fix unregisterSystem function
and add function to get m_system_pointer from System
2023-03-09 11:04:12 +01:00
9bf6f84d45 Update README
Add information about how to use library with DUB package manager
2023-01-18 15:09:25 +01:00
65c6ea4489 Fix demos compilation (using Meson) 2023-01-18 14:53:26 +01:00
ed0603a675 Update copyright notice 2023-01-18 14:40:59 +01:00
6bf8837e8f Update codecov token 2022-11-12 11:41:08 +00:00
6af3028070 Merge branch 'unregister_system' into 'master'
Add unregisterSystem functionality

See merge request Mergul/bubel-ecs!25
2022-11-12 11:15:31 +00:00
c2ba4c632a Fixes
-Assert if callEntitiesFunction is called for system which is not alive
-cleanup and formatting
2022-11-12 12:10:09 +01:00
5f4ba90b3e Add unregisterSystem functionality 2022-11-10 10:54:23 +01:00
881d6d113b Merge branch 'export_id' into 'master'
Export id generated by becsID

See merge request Mergul/bubel-ecs!24
2022-11-10 09:28:34 +00:00
7a614686c8 Export id generated by becsID 2022-11-08 22:05:57 +01:00
6c4109d86c Merge branch 'improve_component_init' into 'master'
Syntax '*ptr = Structure.init' requires opAssign operator, get rid of this...

See merge request Mergul/bubel-ecs!23
2022-10-31 18:35:26 +00:00
c0246ce2af Syntax '*ptr = Structure.init' requires opAssign operator, get rid of this requirement by using malloc.
This is useful when component is defined in another shared library and we use '-fvisibility=hidden', in that case opAssign is hidden and we will get 'undefined symbol'
2022-10-27 23:29:50 +02:00
a8d48f1218 Merge branch 'wasm_fixes' into 'master'
Don't use ForeachType as it don't work if foreach type is not copyable.

See merge request Mergul/bubel-ecs!22
2022-10-06 17:01:50 +00:00
ce47bfc65a Fix wasm compilation 2022-10-05 18:39:07 +02:00
56ce8c3f9c Don't use ForeachType as it don't work if foreach type is not copyable.
This fixes compilation error:
include/d/std/traits.d:8024: Error: Generating an `inout` copy constructor for `struct game.graphic.manager.Graphic` failed, therefore instances of it are uncopyable
2022-10-04 22:18:45 +02:00
bd2afce19a Merge branch 'small-fixes' into 'master'
Small fixes

See merge request Mergul/bubel-ecs!21
2022-07-09 20:27:01 +00:00
24a07a05e5 Small fixes 2022-07-09 20:27:01 +00:00
014e9cee8d Merge branch 'improve_meson' into 'master'
Allow simpler use of ecs from parent project

See merge request Mergul/bubel-ecs!20
2022-06-25 08:42:11 +00:00
d01ebd960a Allow simpler use of ecs from parent project
This allows parent project to find subproject by simple:
decs_dep = dependency('decs')
2022-06-19 14:31:49 +02:00
4f416c7557 Merge branch 'small-fixes' into 'master'
Fixed bug with addComponents template

See merge request Mergul/bubel-ecs!19
2021-11-17 14:32:43 +00:00
85e1f8a76e Fixed bug with addComponents template
-deprecated Comonent.ref_ function
-remover Comonent.ref_ usage from addComponents template
-updated dub.json
2021-11-17 15:03:25 +01:00
54b210346d Merge branch 'fixes' into 'master'
Minor fixes

See merge request Mergul/bubel-ecs!18
2021-05-09 16:46:11 +00:00
cc097dddf0 Minor fixes 2021-05-09 16:46:11 +00:00
bcd9ee4aa0 Merge branch 'beta-release' into 'master'
Changes for beta release

See merge request Mergul/bubel-ecs!17
2021-03-06 22:51:11 +00:00
21b657a84b Merge branch 'windows-fixes' of https://gitlab.com/Mergul/bubel-ecs.git into beta-release 2021-03-06 23:40:03 +01:00
2107f3908c -fixed sp,e demos issues and crashes 2021-03-06 23:39:43 +01:00
fa0c196c60 -code cleanup
-some documentation improvements
-README update
2021-03-06 22:02:49 +01:00
37d15f97d6 -fixed some meson issues on windows (becs and tests compilation works. Demos not yet)
-now tests compile proper files
-added setjmp bindings for Windows. It doesn't work on LDC build (singal API could works)
2021-03-06 22:00:08 +01:00
180f2ed336 Merge branch 'Demos' into 'master'
Code cleanup and fixes

See merge request Mergul/bubel-ecs!16
2021-03-03 17:07:22 +00:00
dd7af91180 -change .gitlab-ci.yml 2021-03-03 16:20:27 +01:00
20ac07af7f -fixed dub.json for new docker 2021-03-03 13:31:41 +01:00
18b5942b99 -removed BECS imports from thread pool
-make JobUpdater selfcontaining (dependes only on BECS and ThreadPool)
2021-03-03 13:13:57 +01:00
a3b33a4935 -fixed LDC demos compilation
-clean ThreadPool code
-fixed betterC demos compilation
2021-03-03 12:29:59 +01:00
1387011b04 -clear ThreadPool code 2021-03-03 10:34:07 +01:00
001f6851ee Update .gitlab-ci.yml 2021-03-03 09:15:14 +00:00
9b3602b6ab Update .gitlab-ci.yml 2021-03-03 08:19:37 +00:00
83cf803d0b Update .gitlab-ci.yml 2021-03-02 20:52:10 +00:00
e7bb51b704 Merge branch 'Demos' into 'master'
Documentation, standarization, etc.

See merge request Mergul/bubel-ecs!15
2021-03-02 20:42:28 +00:00
34a1066cfb -fixed README formating 2021-03-02 21:35:25 +01:00
efd3d64eac -fixed CI typo 2021-03-02 21:26:22 +01:00
c69d58ed69 -deploy only on master commit 2021-03-02 21:23:06 +01:00
27154c809e -removed launcher.manager (gEntityManager used instead)
-removed somee comments, unneded code
-added some comments/documentation
2021-03-02 21:05:05 +01:00
3b954b732b -update README code example (to one that compile)
-remove Entity.instance and gEM, global manager is now gEntityManager
2021-03-02 19:44:18 +01:00
7d090d5627 Merge branch 'Demos' into 'master'
Demos

See merge request Mergul/bubel-ecs!13
2021-03-01 12:12:05 +00:00
d1c48e4c5f -added missing ';' in shader 2021-03-01 12:58:57 +01:00
997f6181c8 -change target name for unittests to "ecs" 2021-03-01 12:35:31 +01:00
9c402140bd -fixed BrickBreaker issue with self collision 2021-03-01 12:25:52 +01:00
56f870bac6 -updated README.md
-fixed shaders for GL2
-added Entity selection tool
-throw out tools from "Demo" window to "Tools" window
-change ComboBox to Tabs for Tools
-Added more verbose tips
-Improved and fixed BrickBreaker collisions
-fixed simple DUB issue
2021-03-01 12:16:02 +01:00
1acd0df0ef Merge branch 'master' of https://gitlab.com/Mergul/bubel-ecs.git into Demos 2021-02-27 17:43:05 +01:00
73458f586d Merge branch 'remove_structure_top_mixin' into 'master'
Removed structure top mixins requirement

See merge request Mergul/bubel-ecs!12
2021-02-27 16:42:50 +00:00
8b2793fc57 Merge branch 'master' of https://gitlab.com/Mergul/bubel-ecs.git into remove_structure_top_mixin
# Conflicts:
#	tests/basic.d
2021-02-27 17:30:31 +01:00
a6d92cb21b -change ecsID to becsID
-change component_id/system_id to becsID in demos
2021-02-27 17:25:13 +01:00
f7591916eb Merge branch 'meson' into 'Demos'
Improve meson build.

See merge request Mergul/bubel-ecs!10
2021-02-26 09:50:33 +00:00
073f91fc4a Update meson_options.txt 2021-02-25 18:49:39 +00:00
66b5807368 Improve meson build.
-Add all required packages as wrap dependencies
-Move source lsitnings to separate files
-Proper dependencies declarations
-Set global D compiler arguments
-Add few asserts
-Add test exe
-Other small improvements

Tested with dmd with betterC, demos executable has to be run from 'demos' directory to properly load assets.
2021-02-21 20:44:58 +01:00
00386ed529 -added missing meson.build files 2021-02-21 17:38:03 +01:00
3f01b96b76 Merge branch 'Demos' into 'master'
Demos

See merge request Mergul/bubel-ecs!8
2021-01-09 14:36:27 +00:00
9cef882faf -change targetName to "ecs" in order to fix CI guild (need to be renamed in CI in future) 2021-01-09 15:13:53 +01:00
edaa2286f4 -fix some memory leaks in unittests
-change name in dub.json ecs->bubel_ecs
-add dependeny in meson.build
2021-01-09 14:30:56 +01:00
84ba5f9eb5 -fixed emscripten compilation 2021-01-03 13:08:29 +01:00
3c1c67efd0 -added filterEntity callback (used to filter EntityInfos for system, better control than simply @optional)
-removed some redundant code (two times same code)
-added some common functions
2021-01-03 13:05:48 +01:00
a926b79223 -add ecsID template function (get Component/System/Event ID, passes tests)
-removed some ECS mixins code
2020-09-29 18:41:31 +02:00
13c82acad4 -removed some unused code 2020-09-25 10:50:11 +02:00
8960423935 ECS fixes
-fixed bug with addEntityCopy (on create was called for bad entity, and incorrect block was added to update)
-added function to retrieve Component pointer from Entity (not  template function)
-fixed thread_pool bug
2020-08-22 11:37:23 +02:00
64dc099e0a Demos big update
-Added some more math functions
-fixed many memory leaks
-added AABB and BVHTree support to collision.d
 *BVHTree has only incrementally adding entities implemented by now (and bad BottomUp algorithm)
 *ECS Systems use two trees, one for static and one for dynamic entities, dynamic BVH is builded every frame from scratch by now
-BrickBreaker now uses BVHTree to collision detection
 *balls only use tree for checks (they aren't adding to tree)
-fixed bug leading to crash
2020-07-17 13:38:41 +02:00
96bbcb9956 Fixed issues and bugs
-moved system destroy functionality to System structure "destroy()" function
-now arrays are properly destroyed (with destructor calling (__xdtor))
-fixed bug which makes BlockAllocator crashing after freeing it's memory
-fixed many smaller memory leaks
2020-07-17 13:34:08 +02:00
74179b4fc8 Demo update
-added 'dot' function to vector math
-fixed Circle tool rendering
-fixed some potentiall memory leaks
-added 'collision' module which now separates ShootGrid from SpaceInvaders demo
-separate some systems from demos to 'basic' module to better demos functionality sharing
-slow down snake
-added new graphics
-BrickBreaker demo now works (without blocks breaking and with bugged collision detection)

-some bug fixes
2020-07-08 22:09:10 +02:00
a0efa4e67d Fixed unittests and betterC compilation (after adding fullyQualifiedName instead of simple stringof)
-added new trait to get full name of structure (witho module and package, not tested on more nested packages)
-some small improvements (like adding const to function which need it)
2020-07-08 22:04:13 +02:00
b0b64b965f Demos update
-added some new types to gui manager + some fixes
-TexCoordsManager now working (probably)
-added CRenderDefault components which makes entities without texcoords possible to draw
-makes better way of binding demos to launcher
-moved some registration related to rendering to one function (basic components + draw system)
-added Sandbox demo (demo which takes all demos to one demo)
-extends ParticlesDemo play area
-added BirckBreaker demo (WIP)
-added special material to additive particles
-added whole bunch of rendering code to rendering module
-added ability to show filtered entities (blinking)
2020-07-01 19:45:53 +02:00
ef4faf2755 Changed Components/System/Events names to full name (with module) and fixed bug with flag 2020-07-01 19:26:47 +02:00
ffc19d4723 Better multithread jobs generation tests 2020-06-15 22:28:55 +02:00
3e7575c4b2 Bug fixes
-fix: UnittestRunner don't catch RangeError
-fix: sometimes onUpdate was called with empty array of entities
2020-06-15 17:21:29 +02:00
d733bb514c Make common draw system, moved some components to basic components and fixed bug with GUI for signed short integers 2020-06-12 20:51:05 +02:00
3a7a5b2a21 Slightly changed rendering code
-renderer draw function now takes struct instead of multiple parameters
2020-06-12 14:53:59 +02:00
8cba2626be Added entity filering support and fixed minor bug 2020-06-10 15:35:42 +02:00
5018464a41 Demo GUI fixes and improvements plus some shortcuts
-added option to override components (by remove them before adding)
-added shortcuts for tools
-fixed mouse scroll on WASM
-addding entity filtering option (WIP)
-added some tooltips
-remove Components duplicates in ComponentManipulator menu
-fixed ImGUI controls IDs
-added possibility to change values of component to add
2020-06-10 14:13:01 +02:00
e76c5ccdb2 Huge demos update
-moved C stdlib function definitions to ecs_utils.utils
-added function to calculate mix(linear interpolation) and rsqrt(fast inverse sqrt)
-added some math to vec2 (length, normalize...)
-improved renderer with possibility to use multiple materials (one per block, not perfect solution for parallel compute, but works with some requirements)
-added blending support for material (opaque, additive, mixed)
-added Android support
-added gprahical representation for mouse tools (tool_circle.d)
-added initial support for editing template components variables
-better Component and Templates listing
-added possibility to add/removes components using mouse
-move CLocation to game_core.basic and reuse in every test
-moved tools code from demos to App (now code is fully separated from demos!)
-some improvement and fixes in Snake demo, with additional systems to handle adding and removing entities
-added new demo: Particles. By now demo has several particles to spawn and support for attractors and vortexes (calculation is made as every attractor with every entity)
-fixed bug with window hover and tools
-improved tool behaviour
-added new material
-now window is always opened as maximized windowed mode
-some minor fixes and improvements
2020-06-06 22:46:29 +02:00
13e6ed8fd5 ECS core imprevement
-Adedd function to resize array to Mallocator
-significant speed up for first time ID allocation by using resizeArray instead of makeArray
-fix: onUpdate called with zero length arrays
-call updateBlocks before updateEvents (it's more accurate behaviour)
-some minore fixes
-fixed meson.build for GDC
2020-06-06 22:26:59 +02:00
66860b9042 Android update and small improvements
-fixed code do cross compiling to android
-fixed build with GCC (workaround)
-added little benchmark
-several small fixes
-updated meson build (demos building, working with GCC, LDC and DMD)
-added some meson options
-added ImGUI bind for OpenGL3
2020-06-01 11:24:50 +02:00
86edfa4a57 Merge branch 'master' of https://gitlab.com/Mergul/bubel-ecs.git into Demos 2020-05-28 18:51:07 +02:00
eb15a8ac7f Merge branch 'Demos' into 'master'
Demos

See merge request Mergul/bubel-ecs!7
2020-05-28 16:48:43 +00:00
024356df9b Common update:
-added multiple new function to allocate template and add entity
-updated README.md (complete initial version)
-empty components now don't take memory
-fixedd small bug with TestRunner
-added many new tests (HashMap, Vector, EntityMeta, ...)
-added default hashing function to HashMap
-fixed critical bug with adding entities
-fixed small bug with adding entity with remplacement components
-added asserts into code to better bug detection
-small performance improvement for events
-added ComponentRef structure which contain data pointer and componentID
-remove EntityID from Event structure
-now events are handled before removing entiteis
-fixed GDC compilation
-fixed rendering of rotated sprites
-added weapons as separate entities to space ship and others
-added Tower enemy to SpaceInvaders demo
-added Boss to SpaceInvaders demo (boss has four tower attached to it)
-Boss towers shoot multiple bullets upon death
-fixed critical bug with demos switching
-fixed critical bug related to adding/removing entities form inside onAdd/onRemove entity callback
-added animation support
-added particles sypport and particles for firing and explostions, and more
-multithreaded rendering now has same rendering order as singlethreaded
-application automaticallu detect host CPU threads count
-added upgrades to SPaceInvaders demo
-fixed texture memory freeing
-improved documentation
-improved multithreaded performance
-improve shader code
-fixed registration issue
-some additional performance improvements
-added depth and colors to rendering parameters
-jobs now has names corresponding to their systems
-change execute() -> willExecute()
-added EntityMeta structure to speedup getting fetching components form entity
-improved multithreading rendering
-added possibility tio change number of threads runtime
-added bullets collision detection in SpaceInvaders demo
-some CI changes
-added VBO batch rendering (current default, no render mode switch yet)
-fixed camera positioning calculation
-fixed buffer issue with WebGL
-added viewport scalling (at least 300 pixels height). Pixels are scalled if screen is bigger.
-center demos gameplay area
-added fullpage html template for Emscripten build
-added many new sprites to atlas
-fixed critical bug with CPU usage in multithreaded mode
-snake render tile coresponding to body part
-snake is destroyed after collision and emit some particles
-added some functionality to vectors
-fixed documentation issue in Manager.d
-more minor code changes and cleanup
2020-05-28 16:48:42 +00:00
2ad238841b Fixed .gitlab-ci.yml emscripten build 2020-05-28 16:41:58 +02:00
9af1cee60b SpaceShip demo update
-added wave shooted upon death of boss tower
-cleanup code a little bit
-moved to new entityAdding method
-fixed bug with changeing demos
2020-05-28 16:11:27 +02:00
7a0ddf7494 Bugfix update
-fixed critical bug with adding entities
-fixed small bug with adding entity with replacement components which entity hasn't
-added multiple asserts to faster bug detection in future
2020-05-28 15:53:05 +02:00
3719cdaee0 Some small fixes 2020-05-28 09:39:17 +02:00
f964d7bf85 Added more tests
-added Vector test
-added HashMap test
-added EntityMeta test
-added default hashing function to hashmap
2020-05-27 19:46:11 +02:00
2f827a94db Fixed betterC compilation 2020-05-27 18:22:55 +02:00
6929f5a748 Mostly bugfix update + empty components support and remove EntityID from Event structure
-empty components now take no memory, so flag components is now far better
-added test for critical bug
-fixed critical bug with adding/removing entities form inside events
-fixed small bug with TestRunner
-improve basic tests
-fixed betterC compilation on DMD
-remove EntityID form Event structure
-added "return" attribute to some functions
-moved some code from Tempalte side to actual implementation
-fixed bug with EntityTemplate copying
-commented out some possibliy unused code
-use code formatter
2020-05-27 17:03:44 +02:00
15cd57dbcb Basic update, multithreading emplate support, fixed
-Added possibility to add entity form template + components to replace template data
-basic tests for new functionality
-small performance improvement for events
-added ComponentRef structure which contain data pointer and component ID
-now events are called before entities removing
2020-05-24 21:57:48 +02:00
3d98b0ee5e Demos update
-fixed critical bug with demos switching
-change multithreaded rendering method (now draw order is keeped even witch multithreading there is no popping)
-added particle emitter components and systems (WIP)
-bullets (laser) now sending EBullet event insead of EDamage which gives possibility to not destroy bullet if shooted entity is already killed
2020-05-23 10:55:31 +02:00
233f4abd47 Added job_id parameter to EntitiesData (index of currently executing job) 2020-05-23 10:53:36 +02:00
bfc0da47e4 SpaceShip demo updage
-Update sprites texture atlas
-added support for separate collider and graphical scale
-weapon now can be located on specific sprite relative position
-SpaceShip has two lasers which are separate entities
-added following parent system
-added Boss
-parent destroy children after being destroyed
-added towers (Tower consist of 3 entities, parent take damage and one is weapon)
- added targeting system which rotate entity to target
2020-05-22 15:58:35 +02:00
43f8755a39 Fixed ECS bug related to adding/removing entities inside onAdd/onRemove entity callback
Now whole committing process is called in specific order:
 - UpdateBlocks
 - ChangeEntities
 - RemoveEntities
 - HandleEvents
Whole process is repeated until there will be no more changes to commit
2020-05-22 15:44:31 +02:00
d89df28f85 Fixed rendering of rotated entities 2020-05-22 15:41:28 +02:00
abc4d0c509 Modified codecov.yml 2020-05-22 15:40:53 +02:00
0b924ae77c Demos update (SpaceInvaders demo)
-added new sprites
-added new functions to vectors
-fixed rendering rotated sprites
-small performance improvement and some bug fixes
-added animations support
-bullets get initial velocity from parent
-added partiles for fire from gun and explosion of enemies
2020-05-19 20:27:18 +02:00
6c3c803d1e SpaceShip demo update
-fixed issue with firing lasers in multithreaded mode
-fix: enies can't grab upgrade anymore
-there is a change that enemy drop bonus upon death
2020-05-14 22:20:41 +02:00
9589a5cb2d FIxed GDC compilation (basic betterC WIP) and some improvements
-fixed issue with adding/removing entities inside events handling
-fixed EntityMeta.getComponent() (added check if component_id is valid)
-added function hasComponent to entity to check if component exists
2020-05-14 22:18:57 +02:00
f731b4cedb Added Upgrade bonuses to SpaceInvaders demo 2020-05-13 21:51:38 +02:00
d26c940b80 Fixed shader compilation on GLES 2020-05-13 21:30:56 +02:00
c29ace661b Added laser collision response to SpaceInvaders 2020-05-13 21:27:09 +02:00
d257a6c9f8 Updated codecov.yml 2020-05-13 16:24:32 +02:00
3647fa4b86 Demos update
-added functionality to detect host CPU threads count
-fixed some memory leaks
-now textures free memory corectly
-added support for up to 32 threads
2020-05-13 15:34:24 +02:00
dd491302af Fixed system reregistration issue and added funtion to allocate EntityTEmplate as copy of different teamplte 2020-05-13 15:31:26 +02:00
9580ee9af9 Add bullets collision system to SpaceInvaders demo 2020-05-12 18:21:25 +02:00
1b925b7ab1 Change component name from "modified" to "writable" 2020-05-12 17:30:57 +02:00
5e884352ba Add support for external depencencies 2020-05-12 17:28:31 +02:00
b19fbb1528 Fixed shader compilation on WebAssembly 2020-05-12 12:30:21 +02:00
c94510a487 Improved Demo and multithreading rendering:
-added support for multithreaded rendering (fast)
-improved shaders
-added support for rendering depth
-added rendering color support
-improved DeptThreadPool (dynamics setting number of tryWait counts before TryWait. Low cpu usage with high responivity)
-added possibility to change number of threads
2020-05-09 19:41:00 +02:00
f6e7af1014 Some preformance tests and added EntityMeta structure 2020-05-07 21:58:34 +02:00
4bd5a37b5d Demo update and start counting tests times
-Fixed performance issue with multithreading and rendering
-start making better shaders (by using many macros)
-speed up rendeing when maximum objects count was reached
-remove map rendering form Snake demo, and render entities by themself
-start adding depth and color rendering parameters
-added properly names to jobs (for debugging purpses)
-starts adding multithreaded rendering
-added some math to vectors
-changes execute() to willExecute(). Probably should have different name.
2020-05-07 14:07:07 +02:00
46aba822d0 Improved documentation and removed some old code 2020-05-06 10:55:40 +02:00
5411e97cb1 Move ECS to Bubel module 2020-05-05 16:56:51 +02:00
a7a63f6a20 Merge branch 'Demos' of https://gitlab.com/Mergul/bubel-ecs.git into Demos 2020-05-04 16:17:54 +02:00
167ad5437a CI changes 2020-05-04 16:17:40 +02:00
109775af87 Update README.md 2020-05-04 10:33:54 +00:00
7bc07666d0 Initial release README.md 2020-05-02 21:11:22 +00:00
b21e2b0109 Merge branch 'master' of https://gitlab.com/Mergul/bubel-ecs.git into Demos
# Conflicts:
#	demos/compile_wasm.py
#	source/ecs/manager.d
2020-05-01 21:36:21 +02:00
2ddb97e9ce Merge branch 'ci-update' into 'master'
Ci update

See merge request Mergul/bubel-ecs!6
2020-05-01 19:26:21 +00:00
54a6d5dec2 CI and common update:
-added webpage deploymnet stage
-added separate build stage which build all binaries and generate documentation
-added Emscripten build stage for merge to master only
-added VBO batch rendering (current default, no render mode switch yet)
-fixed camera positioning calculation
-fixed buffer issue with WebGL
-added viewport scalling (at least 300 pixels height). Pixels are scalled if screen is bigger.
-center demos gameplay area
-added fullpage html template for Emscripten build
2020-05-01 19:26:21 +00:00
50715fbc40 Demos update:
-modified texture atlas
-fixed bug with high CPU usage (use pthread instead of builtin D multithreading)
-added new graphics
-snake now render tile coresponding to body part
-snake is destroyed after collision and emit some particles
-added some functionality to vectors
-fixed documentation issue in Manager.d
2020-04-28 14:13:55 +02:00
f67eb452cc Merge branch 'ci-update' into 'master'
CI update

See merge request Mergul/bubel-ecs!5
2020-04-25 11:09:35 +00:00
b434d851ed CIUpdate
- added build test
 - probably fixed some trash
- coverage test should only wait for test_dmd_debug
2020-04-25 11:09:35 +00:00
d47a5c3e5c Merge branch 'TestRunner' into 'master'
Test runner

See merge request Mergul/bubel-ecs!4
2020-04-25 08:19:16 +00:00
c609b45a3d Merge branch 'master' of https://gitlab.com/Mergul/bubel-ecs.git into TestRunner 2020-04-25 10:13:53 +02:00
d68eecf272 Add LICENSE 2020-04-24 20:10:23 +00:00
8381ac166b Common update:
-added VBo batch rendering (current default, no render mode switch yet)
-fixed camera positioning calculation
-fixed buffer issue with WebGL
-added viewport scalling (at least 300 pixels height). Pixels are scalled if screen is bigger.
-center demos gameplay area
-added fullpage html template for Emscripten build
2020-04-24 20:55:25 +02:00
7c263d3ed4 SimpleVector test improvement 2020-04-24 20:47:42 +02:00
f7a1e9bd05 More test and fixes:
-added test for addEntityCopy
-test order of onAddEntity, onRemoveEntity, onChangeEntity callbacks calls
-testing onAddEntity, onRemoveEntity, onChangeEntity callback
-test callEntityFunction call
-fixed bug with crashing ECS (setting callers for entity change callbacks)
-commented debug asserts conering duplicated components ids (to further consideration)
2020-04-22 16:23:42 +02:00
cb9eaad123 More tests:
-removed some unused code
-fixed bug with struct destructors (Mallocator called __dtor instead of __xdtor)
-added unittests for events
-addded _d_eh_personality null implementation as LDC betterC bug workaround
2020-04-18 19:16:45 +02:00
d0b7138f9f More tests:
-fixed bug in EntityManger.addComponents
-added many new tests
2020-04-17 17:17:37 +02:00
84e04191c8 Unittests and demos update
-fixed bug in EntityManager
-added better support for non-betterC unittests
-added many new unittests
-slightly improved JUnit xml output
-fixed WASM compile script
-added new textures
-fixed model texture coordinaes in demos
-some minor bug fixes in demo
TODO: demos cpu usage in non-betterC mode
2020-04-16 22:16:20 +02:00
72617bc2a5 Added pipeline status indicator to README.md 2020-04-14 18:37:00 +00:00
46530ff45b Merge branch 'WebAssembly' into 'master'
Web assembly

See merge request Mergul/bubel-ecs!3
2020-04-14 15:44:26 +00:00
14839b3765 Better assertion infos and formatted code 2020-04-14 17:39:52 +02:00
0670aed506 BetterC improvement
-fixed some bugs
-non betterC code has better assertion messages
-fixed limited count of components in system
-small dub.json fix
2020-04-14 17:29:49 +02:00
2aef76d75a Unitests update
-unittest runner works for non betterC build
-working unittest coverage generation
-unittest runner support for named tests. Simple regex is supported (* as any substring) and two list of expressions are used, one for include regex and one for exclude regex
2020-04-14 13:41:39 +02:00
998240f7be Template allocation update and some tests
-test runner support before/after everty test callback funcion
-added some basic tests for template allocation
-added function to allocate new template from different template and list of addition and removed components
2020-04-09 22:14:51 +02:00
8f5f2f3baf Removed unused code and failure test 2020-04-05 21:23:12 +02:00
7b053a6abc Added better formating 2020-04-05 21:16:11 +02:00
d485824ab5 -better JUnit generation
-testing unittest failure
2020-04-05 21:11:38 +02:00
09633d1056 -removed not used code and testing (failure) unittest 2020-04-04 22:20:08 +02:00
c63f3a9727 -added some tests
-improved test runner
2020-04-04 22:11:52 +02:00
19687b9f88 -fixed critical bug with adding components
-some fixes
-minor optimization
-added debug assert test
2020-04-04 13:58:31 +02:00
913cf1aef8 Merge branch 'WebAssembly' of https://gitlab.com/Mergul/bubel-ecs.git into WebAssembly 2020-03-28 22:42:19 +01:00
a080a6d415 -fixed bug with adding components
-optimize adding and removing components
2020-03-28 22:34:11 +01:00
3c4f2be9c6 Update .gitlab-ci.yml 2020-03-21 22:18:38 +00:00
dcc48116c5 Merge branch 'WebAssembly' of https://gitlab.com/Mergul/bubel-ecs.git into WebAssembly 2020-03-21 23:14:39 +01:00
67a785f2dc Add betterC test runner 2020-03-21 23:13:08 +01:00
7fcf0462db Merge branch 'mmcomando-master-patch-70881' into 'WebAssembly'
Update .gitlab-ci.yml

See merge request Mergul/bubel-ecs!1
2020-03-21 19:07:09 +00:00
3eb124ae46 Add GitLab CI script 2020-03-21 19:07:09 +00:00
845f468d59 -added more documentation
-remove update() function from entity
-currently max supported components count is 64 per type
2020-03-21 13:27:14 +01:00
546b73c567 -fixed events bug with calls for unsupported systems
-now empty systems can't handle events and listeners
2020-03-07 13:21:29 +01:00
d6b53425dd -added EmptySystem supprort (called once per frame, sholud be once per jobs)
-EntitiesData can contain "thread_id" which is filled with ID of current thread
2020-03-06 14:01:46 +01:00
5399b584dd -IDManager reserve EntityID(0) as empty
-fixed bug with events called on destroyed entities (crash)
-don't call event on system for unsupported entity
-added "entity_id" property to EntitiesData
2020-03-06 10:12:52 +01:00
87e9a31d7f -PageSize and PagesInBlock values can be adjust in runtime (at initialization time)
-added support for calling custon delegate function for all entities supported by selected system
2020-02-09 21:53:17 +01:00
1f78f2506c -Events system update order is now choosen according to system priority
-added mixin for adding exluded components using it's type
-demos:
 *added GUI for selecting templates and choosing tools
 *change SpaceInvades SideMove system to not using events for better performance and multithreading
 *added Entites spawning support
 *fixed some Snake demo bugs
 *GUI work's better now
2020-02-09 15:24:26 +01:00
19fc440ed6 -updated meson.build 2019-11-25 21:15:44 +00:00
946fbf2934 -updated tests:
*updated build scripts
 *removed tls variables from code (needed to support WebAssembly)
 *some mmutils tweaks
 *some fixes
 *pthread TLS thread ID implementation
-added Atomic file (reimplementation of atomics templates for emscripten)
-added emscripten support to ecs.std
2019-11-25 20:06:16 +00:00
46de0f6adb -builded demos on linux
-small gitingore fix
2019-11-20 16:43:53 +00:00
5894e76540 -updated wasm build scripts
-multitheaded wasm tests
-updated dub.json
-fixed thread pool assert issue
-added windows libraries
-added demos:
 *launcher
 *simple
 *snake
 *space invaders (WIP)
 *statistics window
 *changable gui styles
 *tips window
 *profile window
 *demo window with automatic generation
 *multithreaded job updater
2019-11-19 10:37:34 +01:00
cb7609dcaa -Demos:
*added ImGUI styles
 *added new assets (fonts, shaders)
 *added cimgui.dll
 *added imports for bindbc-sdl (for WASM)
 *added simple demo
 *added demo launcher
 *added snake demo
 *impoved demo utils
 *added cimgui.bc library for WASM
-improved wasm build script
-small change in vector
2019-11-12 20:33:31 +01:00
73f2aa6861 -improved WASM compilation scripts
-added external bindbc.sdl import for WASM
-working on demos (WIP, working simple demo with ECS and SDL2)
-small change in ecs.std
2019-11-06 20:38:46 +01:00
a8c74d5045 -make tests working on web
-WebAssembly now is compiled with emscripten use (stdc functions bindings only)
-added python script to build WASM version
2019-11-05 09:21:02 +01:00
015783bf5c -remove '-defaultlib' from dub.json
-start working with WebAssembly
-modified .gitignore
-added meson build file (WIP)
2019-11-02 18:51:03 +01:00
185 changed files with 41508 additions and 4206 deletions

12
.gitignore vendored
View file

@ -1,7 +1,15 @@
*
!*/
!source/**
!tests/**
!README.md
!./dub.json
!dub.json
!.gitignore
!codecov.yml
!skeleton.html
!**/meson.build
!**/*.wrap
!meson_options.txt
!compile_wasm.py
!compile_android.py
!.gitlab-ci.yml
!LICENSE

107
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,107 @@
default:
artifacts:
expire_in: 1 day
stages:
- build
- test
- testcov
- build_wasm
- build_emscripten
- deploy
build_code:
stage: build
image: "registry.gitlab.com/mergul/bubel-ecs:latest"
script:
- /bin/bash /compile_ecs.sh
artifacts:
expire_in: 1h
paths:
- binaries
allow_failure: true
test_dmd_debug:
stage: test
image: debian:buster-slim
script:
- binaries/dmd_debug_unittest
artifacts:
reports:
junit: test_report.xml
test_dmd:
stage: test
image: debian:buster-slim
script:
- binaries/dmd_release_unittest
artifacts:
reports:
junit: test_report.xml
test_dmd_betterC:
stage: test
image: debian:buster-slim
script:
- binaries/dmd_debug_unittest_bc
artifacts:
reports:
junit: test_report.xml
coverage_test_dmd:
stage: testcov
image: "registry.gitlab.com/mergul/bubel-ecs/curl:latest"
needs: ["test_dmd_debug", "build_code"]
dependencies:
- build_code
script:
- mkdir reports
- binaries/dmd_unittest_cov
after_script:
- bash <(curl -s https://codecov.io/bash) -s reports -t df87b1d8-85f4-4584-96e3-1315d27ec2c5
wasm:
stage: build_wasm
image: "registry.gitlab.com/mergul/bubel-ecs:latest"
script:
- /bin/bash /compile_wasm.sh
- /bin/bash /gen_doc.sh
artifacts:
expire_in: 1h
paths:
- build
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_COMMIT_BRANCH == "master"'
when: always
allow_failure: true
emscripten:
stage: build_emscripten
image: "registry.gitlab.com/mergul/bubel-ecs/emscripten:latest"
dependencies:
- wasm
script:
- /bin/bash /build.sh
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_COMMIT_BRANCH == "master"'
when: always
artifacts:
expire_in: 1h
paths:
- wasm
pages:
stage: deploy
image: frolvlad/alpine-glibc
dependencies:
- wasm
- emscripten
script:
- mkdir public
- cp -r wasm/* public/
- cp -r build/public/* public/
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: always
artifacts:
expire_in: 1h
paths:
- public

29
LICENSE Normal file
View file

@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2020, Dawid Masiukiewicz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

212
README.md
View file

@ -1,3 +1,211 @@
# Dynamic Entity Component System
# Bubel Entity Component System
[![pipeline status](https://gitlab.com/Mergul/bubel-ecs/badges/master/pipeline.svg)](https://gitlab.com/Mergul/bubel-ecs/-/commits/master)
[![codecov](https://codecov.io/gl/Mergul/bubel-ecs/branch/master/graph/badge.svg?token=Unm0TJhFoW)](https://codecov.io/gl/Mergul/bubel-ecs)
Entity-Component-System implementation in D language.
**Bubel ECS** is Entity-Component-System architectural pattern implementation in D language.
Library aims to delivery fast and flexible architecture for developing games. Library is **@nogc** and **betterC** compatible. WASM is supported thorugh Emscripten.
Project haven't any external dependencies.
Bubel ECS was tested on Linux, Windows, Android and WASM.
**Currently library is in beta stage so some significant API changes can appear.**
Package is available on [DUB package repository](https://code.dlang.org/packages/bubel-ecs). Usage:
```
"dependencies": {
"bubel-ecs": "~>0.1.1"
}
```
## Design
For core information about Entity-Component-System architectural pattern please read definition described at [Wikipedia](https://en.wikipedia.org/wiki/Entity_component_system).
Main design principles are:
* **Data oriented design** - components memory is packed into tight blocks so iterating over entity components is cache friendly
* **Fast and safe EntityID** - every entity is referenced by its unique ID. Accessing by ID is safe even if entity doesn't exists. Accessing by ID is constant time operation.
* **Multithreading support** - whole library was developed with multithreading in mind. Adding components is thread-friendly so you get usable EntityID as early as possible. Operations like adding or removing components are deferred to end of frame. Dependencies between systems parallel execution are generated automatically.
* **Good logic separation** - system needs information only about components which it uses, there is no relation between systems. Systems can be compiled as multiple separate libraries and used together.
* **Flexible execution model** - system iterate over entities which meet specified conditions. Components can be marked as required, optional or excluded. Systems are exectued in specific order determined by system priority.
* **Builtin events handling** - library has builtin support for event handlig to makes easier communication between different entities.
* **Hot-reload** - hot-reloading for systems should be as easy as possible. In other words library should give functionality to support hot-reload of systems and components with minimal work. **(WIP!)**.
There are some assumptions that should be considered when developing application:
* Iterating over components throught system ```onUpdate()``` callback is fastest way of access data so it's should be main way of making calculations.
* Using direct access and events should be used very wisely and minimized.
* Direct component access is faster than events, because events must buffer memory and call multiple system handler callbacks.
* Components can be used to marking entities, assingment to systems and changing logic of entity in runtime. Using too much component based marking can lead to memory fragmentation and performence drop.
* Systems give great opporunity to separate game logic. Systems can be enabled and disabled easly in runtime. It's can be used to enabling some debug systems if needed. Additionaly this concept makes game logic changes easier to deal with. If you develop your application wisely it should be trivial to change some core logic by changing only several systems or adding some new. Every entity can easily takes some behaviour from different entity type by adding several components.
### Features
* ECS architectural pattern
* Data oriented design
* Safe identifiers (EntityID)
* EntityTemplates
* Basic events handling
* Easy systems ordering
* Runtime and fast components adding and removing
* Listeners for adding and removing entity components inside systems
* Update passes
* Calling custom callbacks for system entity groups
* betterC compatibility
* Emscripten compatibility
* Automatic multithreaded jobs generation
* External dependencies - ability to provide dependencies between systems which aren't related to components
* Compatibility with all big compilers: DMD, LDC, GDC.
### Planned
* Worlds - every world works as separate environment. Entities don't interact with entities from different world. Systems and components should be registered for every world separately.
* Hot-reload support - currently only reloading systems (their functions) works. There is possibility to serialize every entity and system, but it's should be provided by library itself with special callbacks and helpers. Additionaly planned is system which helps with taking new EntityID from serialized identifiers.
* Static components - this components will have different memory model and can be accessed only directly. It will be slower to access but won't trigger memory copy when component is added. It should fix problem with big components which isn't needed by systems iteration callbacks or is required rarely.
* Better EventManager - there are several optimization and improvements that can be added in the future (e.g. multithreading).
* More demos and examples - demo appliaction is very basic now, but in future more minigames and sanbox mode (opportunity to mix many components and systems) are planned.
* C API - it's highly depends on amount of work required. Makes it possible to use library from different languages.
* More smaller improvements...
For more information about design and usage feel free to read [documentation](https://mergul.gitlab.io/bubel-ecs/ecs.html) and [WIKI](https://gitlab.com/Mergul/bubel-ecs/-/wikis/home)**(WIP)**.
## Build Instructions
To build library you needs recent D compiler and optionally Emscripten (with python) to build web version. Currenlty tested are: LDC, DMD and GDC. \
Supported build systems are DUB and Meson.
##### DUB
```shell
#available configurations: library, dynlib, library-betterC, dynlib-betterC, unittest-runner, unittest-runner-betterC
dub build -c library -b release
```
##### Meson
```shell
#use '-DbetterC=true ' to build betterC code
meson build . #add '--buildtype=release' to build release code
cd build
ninja
```
##### Emscripten
```shell
python compile_wasm.py -opt
```
##### Documentation
```shell
adrdox -i source/bubel/ecs/ -o docs/ -s skeleton.html
```
## Demos
Repository contain demo application. You can check demo [online](https://mergul.gitlab.io/bubel-ecs/ecs_demo.html) or build it form source code using Meson. \
Online demo support multithreading and page tries to check if client support WASM multithreading or not and loads proper JS and WASM code. It was tested on Chrome, Firefox, Opera, Brave on Linux, Windows and Android. On firefox there is problem with multithreaded version so if demo doesn't work please try to disable shared_memory in browser flags.
Demos uses these libraries: SDL2, SDL2_Image, bindbc-loader, bindbc-sdl, cimgui, glad, mmutils. \
C++ compiler is required for building dependencies.
Meson is preferred way of building demos. It will download and compile dependencies automatically. DUB version is used only for library development. Build instructions:
```shell
#use '-DbetterC=true ' to build betterC code
meson build . -DBuildDemos=true #add '--buildtype=release' to build release code
cd build
ninja
```
## Code example
```d
import bubel.ecs.core;
import bubel.ecs.manager;
import bubel.ecs.attributes;
import std.array : staticArray;
struct Position
{
float x;
float y;
}
struct Velocity
{
//default values works
float x = 0.1;
float y = 1;
}
struct StaticFlag
{
}
struct UpdateSystem
{
mixin ECS.System; //makes struct system
mixin ECS.ExcludedComponents!(StaticFlag); //prevents static entities from update
struct EntitiesData
{
int length; //entities count
@readonly Entity[] entities; //entities arrays, entity contain ID only
Position[] positions; //positions array, by default components are considered to has write access (used for multithreading dependencies)
@readonly Velocity[] velocities; //veocities array, readonly (Multithreading tag)
}
void onUpdate(EntitiesData data) //update callback, called multiple times per frame for every entities types
{
foreach(i; 0..data.length) //iterate over entities
{
data.positions[i].x += data.velocities[i].x;
data.positions[i].y += data.velocities[i].y;
}
}
}
void main()
{
//initialize ECS
EntityManager.initialize();
//begin registering process
gEntityManager.beginRegister();
//register components
gEntityManager.registerComponent!Position;
gEntityManager.registerComponent!Velocity;
gEntityManager.registerComponent!StaticFlag;
//register system with priority 0
gEntityManager.registerSystem!UpdateSystem(0);
//end registering process
gEntityManager.endRegister();
//allocate template
EntityTemplate* tmpl = gEntityManager.allocateTemplate([becsID!Velocity, becsID!Position].staticArray);
scope (exit) gEntityManager.freeTemplate(tmpl);
//gets pointer to template component data
Position* position = tmpl.getComponent!Position;
foreach(i; 0 .. 100)
{
position.x = i % 10;
position.y = i / 10;
gEntityManager.addEntity(tmpl);
}
gEntityManager.begin(); //start frame, inside system onBegin callbacks are called
gEntityManager.update(); //update all systems, there onUpdate callbacks are called
gEntityManager.end(); //end frame, inside system onEnd callbacks are called*/
//free ECS data
EntityManager.destroy();
}
```
## Links
Documentation: https://mergul.gitlab.io/bubel-ecs/ecs.html \
Wiki: https://gitlab.com/Mergul/bubel-ecs/-/wikis/home \
Online demo: https://mergul.gitlab.io/bubel-ecs/ecs_demo.html

10
codecov.yml Normal file
View file

@ -0,0 +1,10 @@
ignore:
- "tests/*"
- "**/traits*"
coverage:
status:
project:
default:
threshold: 5
patch: off

78
compile_android.py Normal file
View file

@ -0,0 +1,78 @@
import os
import ntpath
import sys
def compile(sources, output):
files = []
# r=root, d=directories, f = files
for path in sources:
for r, d, f in os.walk(path):
for file in f:
if ntpath.basename(file) != 'win_dll.d':
filename, file_extension = os.path.splitext(file)
if file_extension == '.d' and filename != 'package':
files.append(os.path.join(r, file))
ldc_path = 'ldc'
if 'LDC' in os.environ:
ldc_path = os.environ['LDC']
ldc_cmd = ldc_path + ' ' + ldc_flags + '-lib -mtriple=armv7-none-linux-androideabi -fvisibility=hidden -betterC -oq -od=obj/ --singleobj --of=' + output + ' '
for path in sources:
ldc_cmd += '-I' + path + ' '
for path in import_paths:
ldc_cmd += '-I' + path + ' '
for f in files:
ldc_cmd += f + ' '
print(ldc_cmd)
if os.system(ldc_cmd):
exit(0)
print()
clean = 0
ldc_flags = ''
import_paths = ['source','tests']
build_tests = 0
for arg in sys.argv[1:]:
if(arg == '-release'):
ldc_flags += '-release '
elif(arg == '-enable-inlining'):
ldc_flags += '-enable-inlining '
elif(arg == '-O3'):
ldc_flags += '-O3 '
elif(arg == '-O2'):
ldc_flags += '-O2 '
elif(arg == '-O1'):
ldc_flags += '-O1 '
elif(arg == '-O0'):
ldc_flags += '-O0 '
elif(arg == '-Os'):
ldc_flags += '-Os '
elif(arg == '-Oz'):
ldc_flags += '-Oz '
elif(arg == '-g'):
ldc_flags += '-g '
elif(arg == '-opt'):
ldc_flags += '-release -enable-inlining -O3 '
else:
print('unknown argument: ' + arg)
exit()
compile(['source'], 'ecs.a')
#export LDC_LIBS=/path/to/your/ldc-build-runtime.tmp/lib/
CC = os.environ['NDK'] + '/toolchains/llvm/prebuilt/linux-x86_64/bin/clang'
TOOLCHAIN = os.environ['NDK'] + '/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64'
SYSROOT = os.environ['NDK'] + '/platforms/android-21/arch-arm'
LDC_LIBS = ''#os.environ['LDC_LIBS'] + '/libphobos2-ldc.a ' + os.environ['LDC_LIBS'] + '/libdruntime-ldc.a'
os.system(CC + ' -Wl,-soname,libecs.so -shared --sysroot=' + SYSROOT + ' obj/*.o ' + LDC_LIBS + ' -lgcc -gcc-toolchain ' + TOOLCHAIN +
' -no-canonical-prefixes -fuse-ld=bfd -target armv7-none-linux-androideabi -fvisibility=hidden \
-Wl,--gc-sections -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro \
-Wl,-z,now -mthumb -o libecs.so')

93
compile_wasm.py Normal file
View file

@ -0,0 +1,93 @@
import os
import ntpath
import sys
def compile(sources, output):
files = []
# r=root, d=directories, f = files
for path in sources:
for r, d, f in os.walk(path):
for file in f:
if ntpath.basename(file) != 'win_dll.d':
filename, file_extension = os.path.splitext(file)
if file_extension == '.d' and filename != 'package':
files.append(os.path.join(r, file))
ldc_cmd = 'ldc2 ' + shared_flags + ldc_flags + '-oq -mtriple=wasm32-unknown-emscripten -betterC --output-bc --od=.bc --singleobj --checkaction=C --of=' + output + ' '
for path in sources:
ldc_cmd += '-I' + path + ' '
for path in import_paths:
ldc_cmd += '-I' + path + ' '
for f in files:
ldc_cmd += f + ' '
print(ldc_cmd)
if os.system(ldc_cmd):
exit(0)
print()
shared_flags = ''
clean = 0
emc_flags = ''
ldc_flags = ''
import_paths = ['source','tests']
build_tests = 0
for arg in sys.argv[1:]:
if(arg == '-release'):
ldc_flags += '-release '
elif(arg == '-enable-inlining'):
ldc_flags += '-enable-inlining '
elif(arg == '-O3'):
shared_flags += '-O3 '
elif(arg == '-O2'):
shared_flags += '-O2 '
elif(arg == '-O1'):
shared_flags += '-O1 '
elif(arg == '-O0'):
shared_flags += '-O0 '
elif(arg == '-Os'):
shared_flags += '-Os '
elif(arg == '-Oz'):
shared_flags += '-Oz '
elif(arg == '-g'):
shared_flags += '-g '
elif(arg == '-g4'):
ldc_flags += '-g '
emc_flags += '-g4 '
elif(arg == '--build-tests'):
build_tests = 1
elif(arg == '--llvm-lto'):
emc_flags += '--llvm-lto 3 '
elif(arg == '--simd'):
emc_flags += '-s SIMD=1 '
elif(arg == '-opt'):
shared_flags += '-O3 '
ldc_flags += '-release -enable-inlining '
emc_flags += '--llvm-lto 3 -s SIMD=1 '
elif(arg == '-pthread'):
emc_flags += '-s PTHREAD_POOL_SIZE=16 -s USE_PTHREADS=1 '
else:
print('unknown argument: ' + arg)
exit()
compile(['source'], 'ecs.bc')
if build_tests == 0:
exit(0)
compile(['tests'], 'tests.bc')
emcc_cmd = 'emcc -v ' + shared_flags + emc_flags + '-s ALLOW_MEMORY_GROWTH=1 -s WASM_MEM_MAX=1024MB -s MALLOC=dlmalloc -s WASM=1 -o index.html '
#-s ALLOW_MEMORY_GROWTH=1
emcc_cmd += 'ecs.bc tests.bc'
#emcc_cmd += 'tests.bc'
print(emcc_cmd)
os.system(emcc_cmd)

20
demos/.gitignore vendored Normal file
View file

@ -0,0 +1,20 @@
*
!*/
!**/dub.json
!libs/
!*.dll
!libs/**
!utils/**/*.d
!source/**/*.d
!launcher/**/*.d
!assets/**
!external/**/*.d
!.gitignore
!compile_wasm.py
!cimgui.bc
!emscripten_shell.html
!emscripten_multi_shell.html
!compile_android.py
!**/meson.build
.dub
Android

BIN
demos/SDL2.dll Normal file

Binary file not shown.

BIN
demos/SDL2_image.dll Normal file

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,54 @@
#ifdef GLES
precision mediump int;
precision mediump float;
precision lowp sampler2D;
precision lowp samplerCube;
#define TEX(x,y) texture2D(x,y)
#if __VERSION__ >290
#define M_IN in mediump
#define L_IN in lowp
#else
#define M_IN varying mediump
#define L_IN varying lowp
#endif
#else
#define TEX(x,y) texture(x,y)
#if __VERSION__ > 320
#define M_IN in
#define L_IN in
#else
#define M_IN varying
#define L_IN varying
#endif
#endif
M_IN vec2 uv;
M_IN vec4 color;
/*
#ifdef GLES
#if __VERSION__ >290
in mediump vec2 uv;
#else
varying mediump vec2 uv;
#endif
#else
#if __VERSION__ > 320
in vec2 uv;
#else
varying vec2 uv;
#endif
#endif*/
//layout(binding = 0)uniform sampler2D tex;
uniform sampler2D tex;
//layout(location = 0) out vec4 outColor;
void main()
{
gl_FragColor = /*TEX(tex,uv) **/ color;
if(gl_FragColor.a < 0.01)discard;
}

View file

@ -0,0 +1,107 @@
#ifdef GLES
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
#if __VERSION__ >290
#define LOC(x) layout(location = x)
#define ATT in
#define M_OUT out mediump
#define L_OUT out lowp
#else
#define LOC(x)
#define ATT attribute
#define M_OUT varying mediump
#define L_OUT varying lowp
#endif
#else
#if __VERSION__ > 320
#define LOC(x) layout(location = x)
#define ATT in
#define M_OUT out
#define L_OUT out
#else
#define LOC(x)
#define ATT attribute
#define M_OUT varying
#define L_OUT varying
#endif
#endif
/*
#ifdef GLES
#if __VERSION__ >290
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
layout(location = 0) in vec2 positions;
layout(location = 1) in vec2 tex_coords;
out mediump vec2 uv;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
attribute vec2 positions;
attribute vec2 tex_coords;
varying mediump vec2 uv;
#endif
#else
#if __VERSION__ > 320
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
layout(location = 0) in vec2 positions;
layout(location = 1) in vec2 tex_coords;
out vec2 uv;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
attribute vec2 positions;
attribute vec2 tex_coords;
varying vec2 uv;
#endif
#endif*/
#define VBO_BATCH 1
M_OUT vec2 uv;
L_OUT vec4 color;
LOC(0) ATT vec2 positions;
LOC(1) ATT vec2 tex_coords;
#ifdef VBO_BATCH
LOC(2) ATT float depth;
LOC(3) ATT vec4 vcolor;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
uniform vec4 vcolor;
float depth = matrix_2.z;
#endif
void main() {
#ifdef VBO_BATCH
vec3 position = vec3(positions*4.0,1.0);
uv = tex_coords;
#else
vec3 position = mat3(matrix_1.x,matrix_1.y,0,matrix_1.z,matrix_1.w,0,matrix_2.xy,1.0) * vec3(positions,1.0);
uv = tex_coords * uv_transform.zw + uv_transform.xy;
#endif
color = vcolor;
gl_Position = vec4(position.xy,depth,1.0);
}

View file

@ -0,0 +1,55 @@
#ifdef GLES
precision mediump int;
precision mediump float;
precision lowp sampler2D;
precision lowp samplerCube;
#define TEX(x,y) texture2D(x,y)
#if __VERSION__ >290
#define M_IN in mediump
#define L_IN in lowp
#else
#define M_IN varying mediump
#define L_IN varying lowp
#endif
#else
#if __VERSION__ > 320
#define TEX(x,y) texture(x,y)
#define M_IN in
#define L_IN in
#else
#define TEX(x,y) texture2D(x,y)
#define M_IN varying
#define L_IN varying
#endif
#endif
M_IN vec2 uv;
M_IN vec4 color;
/*
#ifdef GLES
#if __VERSION__ >290
in mediump vec2 uv;
#else
varying mediump vec2 uv;
#endif
#else
#if __VERSION__ > 320
in vec2 uv;
#else
varying vec2 uv;
#endif
#endif*/
//layout(binding = 0)uniform sampler2D tex;
uniform sampler2D tex;
//layout(location = 0) out vec4 outColor;
void main()
{
gl_FragColor = TEX(tex,uv) * color;
if(gl_FragColor.a < 0.01)discard;
}

View file

@ -0,0 +1,107 @@
#ifdef GLES
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
#if __VERSION__ >290
#define LOC(x) layout(location = x)
#define ATT in
#define M_OUT out mediump
#define L_OUT out lowp
#else
#define LOC(x)
#define ATT attribute
#define M_OUT varying mediump
#define L_OUT varying lowp
#endif
#else
#if __VERSION__ > 320
#define LOC(x) layout(location = x)
#define ATT in
#define M_OUT out
#define L_OUT out
#else
#define LOC(x)
#define ATT attribute
#define M_OUT varying
#define L_OUT varying
#endif
#endif
/*
#ifdef GLES
#if __VERSION__ >290
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
layout(location = 0) in vec2 positions;
layout(location = 1) in vec2 tex_coords;
out mediump vec2 uv;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
attribute vec2 positions;
attribute vec2 tex_coords;
varying mediump vec2 uv;
#endif
#else
#if __VERSION__ > 320
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
layout(location = 0) in vec2 positions;
layout(location = 1) in vec2 tex_coords;
out vec2 uv;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
attribute vec2 positions;
attribute vec2 tex_coords;
varying vec2 uv;
#endif
#endif*/
#define VBO_BATCH 1
M_OUT vec2 uv;
L_OUT vec4 color;
LOC(0) ATT vec2 positions;
LOC(1) ATT vec2 tex_coords;
#ifdef VBO_BATCH
LOC(2) ATT float depth;
LOC(3) ATT vec4 vcolor;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
uniform vec4 vcolor;
float depth = matrix_2.z;
#endif
void main() {
#ifdef VBO_BATCH
vec3 position = vec3(positions*4.0,1.0);
uv = tex_coords;
#else
vec3 position = mat3(matrix_1.x,matrix_1.y,0,matrix_1.z,matrix_1.w,0,matrix_2.xy,1.0) * vec3(positions,1.0);
uv = tex_coords * uv_transform.zw + uv_transform.xy;
#endif
color = vcolor * 2.0;
gl_Position = vec4(position.xy,depth,1.0);
}

View file

@ -0,0 +1,63 @@
#ifdef GLES
precision mediump int;
precision mediump float;
precision lowp sampler2D;
precision lowp samplerCube;
#define TEX(x,y) texture2D(x,y)
#if __VERSION__ >290
#define M_IN in mediump
#define L_IN in lowp
#else
#define M_IN varying mediump
#define L_IN varying lowp
#endif
#else
#define TEX(x,y) texture(x,y)
#if __VERSION__ > 320
#define M_IN in
#define L_IN in
#else
#define M_IN varying
#define L_IN varying
#endif
#endif
M_IN vec2 pos;
M_IN float edge;
//flat M_IN vec2 fpos;
//M_IN vec2 uv;
//M_IN vec4 color;
/*
#ifdef GLES
#if __VERSION__ >290
in mediump vec2 uv;
#else
varying mediump vec2 uv;
#endif
#else
#if __VERSION__ > 320
in vec2 uv;
#else
varying vec2 uv;
#endif
#endif*/
//layout(binding = 0)uniform sampler2D tex;
//uniform sampler2D tex;
//layout(location = 0) out vec4 outColor;
void main()
{
float len2 = dot(pos,pos);
if(len2 > 1.0)discard;
if(len2 > edge)gl_FragColor = vec4(0.4,0.8,1.0,0.8);//TEX(tex,uv) * color;
else gl_FragColor = vec4(0,0.6,1.0,0.35);//TEX(tex,uv) * color;
//gl_FragColor = vec4(pos,0,1);
//if(gl_FragColor.a < 0.01)discard;
}

View file

@ -0,0 +1,115 @@
#ifdef GLES
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
#if __VERSION__ >290
#define LOC(x) layout(location = x)
#define ATT in
#define M_OUT out mediump
#define L_OUT out lowp
#else
#define LOC(x)
#define ATT attribute
#define M_OUT varying mediump
#define L_OUT varying lowp
#endif
#else
#if __VERSION__ > 320
#define LOC(x) layout(location = x)
#define ATT in
#define M_OUT out
#define L_OUT out
#else
#define LOC(x)
#define ATT attribute
#define M_OUT varying
#define L_OUT varying
#endif
#endif
/*
#ifdef GLES
#if __VERSION__ >290
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
layout(location = 0) in vec2 positions;
layout(location = 1) in vec2 tex_coords;
out mediump vec2 uv;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
attribute vec2 positions;
attribute vec2 tex_coords;
varying mediump vec2 uv;
#endif
#else
#if __VERSION__ > 320
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
layout(location = 0) in vec2 positions;
layout(location = 1) in vec2 tex_coords;
out vec2 uv;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
uniform vec4 uv_transform;
attribute vec2 positions;
attribute vec2 tex_coords;
varying vec2 uv;
#endif
#endif*/
//#define VBO_BATCH 1
//M_OUT vec2 uv;
//L_OUT vec4 color;
M_OUT vec2 pos;
M_OUT float edge;
//flat M_OUT vec2 fpos;
LOC(0) ATT vec2 positions;
//LOC(1) ATT vec2 tex_coords;
#ifdef VBO_BATCH
LOC(2) ATT float depth;
LOC(3) ATT vec4 vcolor;
#else
uniform vec4 matrix_1;
uniform vec4 matrix_2;
//uniform vec4 uv_transform;
//uniform vec4 vcolor;
//float depth = matrix_2.z;
#endif
void main() {
//#ifdef VBO_BATCH
// vec3 position = vec3(positions*4.0,1.0);
// uv = tex_coords;
//#else
//edge = mix(0.1, 0.96, (matrix_2.z / 256));
edge = (matrix_1.w - matrix_2.z) / matrix_1.w;//matrix_2.z;//clamp((matrix_2,0.0,1.0);
edge *= edge;
pos = positions * 2.0;// / matrix_2.zw * 2;
//fpos = positions * matrix_2.xy;
vec3 position = mat3(matrix_1.x,matrix_1.y,0,matrix_1.z,matrix_1.w,0,matrix_2.xy,1.0) * vec3(positions,1.0);
// uv = tex_coords * uv_transform.zw + uv_transform.xy;
//#endif
//color = vcolor * 2.0;
gl_Position = vec4(position.xy,0,1.0);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
demos/cimgui.bc Normal file

Binary file not shown.

BIN
demos/cimgui.dll Normal file

Binary file not shown.

91
demos/compile_android.py Normal file
View file

@ -0,0 +1,91 @@
import os
import ntpath
import sys
def compile(sources, output):
files = []
# r=root, d=directories, f = files
for path in sources:
for r, d, f in os.walk(path):
for file in f:
if ntpath.basename(file) != 'win_dll.d':
filename, file_extension = os.path.splitext(file)
if file_extension == '.d':
files.append(os.path.join(r, file))
ldc_path = 'ldc'
if 'LDC' in os.environ:
ldc_path = os.environ['LDC']
ldc_cmd = ldc_path + ' ' + ldc_flags + '-lib -mtriple=armv7-none-linux-androideabi -fvisibility=hidden -betterC -oq -od=obj/ --singleobj --of=' + output + ' '
for path in sources:
ldc_cmd += '-I' + path + ' '
for path in import_paths:
ldc_cmd += '-I' + path + ' '
for f in files:
ldc_cmd += f + ' '
print(ldc_cmd)
if os.system(ldc_cmd):
print('some kind of error')
exit(0)
print()
clean = 0
ldc_flags = '--d-version=SDL_209 --d-version=BindSDL_Image --d-version=MM_USE_POSIX_THREADS '
#import_paths = ['source','tests']
import_paths = ['external/android','external/sources', 'external/imports', 'external/wasm_imports', '../source', 'utils/source', 'simple/source']
build_tests = 0
for arg in sys.argv[1:]:
if(arg == '-release'):
ldc_flags += '-release '
elif(arg == '-enable-inlining'):
ldc_flags += '-enable-inlining '
elif(arg == '-O3'):
ldc_flags += '-O3 '
elif(arg == '-O2'):
ldc_flags += '-O2 '
elif(arg == '-O1'):
ldc_flags += '-O1 '
elif(arg == '-O0'):
ldc_flags += '-O0 '
elif(arg == '-Os'):
ldc_flags += '-Os '
elif(arg == '-Oz'):
ldc_flags += '-Oz '
elif(arg == '-g'):
ldc_flags += '-g '
elif(arg == '-opt'):
ldc_flags += '-release -enable-inlining -O3 '
else:
print('unknown argument: ' + arg)
exit()
#compile(['source'], 'ecs.a')
compile(['external/wasm_imports/bindbc/sdl'], 'build/bindbc-sdl.a')
compile(['utils/source'], 'build/utils.a')
compile(['external/sources/mmutils'], 'build/mmutils.a')
compile(['external/sources/glad'], 'build/glad.a')
compile(['external/android/bindbc'], 'build/bindbc.a')
compile(['source'], 'build/demo.a')
#compile(['external/wasm_imports/bindbc/sdl','utils/source','external/sources/mmutils','external/sources/glad'], 'build/asd.a')
#export LDC_LIBS=/path/to/your/ldc-build-runtime.tmp/lib/
CC = os.environ['NDK'] + '/toolchains/llvm/prebuilt/linux-x86_64/bin/clang'
TOOLCHAIN = os.environ['NDK'] + '/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64'
SYSROOT = os.environ['NDK'] + '/platforms/android-21/arch-arm'
#LDC_LIBS = os.environ['LDC_LIBS'] + '/libphobos2-ldc.a ' + os.environ['LDC_LIBS'] + '/libdruntime-ldc.a'
LDC_LIBS = ''
LIBS = '-L/platforms/android-21/arch-arm/usr/lib'
os.system(CC + ' -Wl,-soname,libdemos.so -shared --sysroot=' + SYSROOT + ' ../obj/*.o obj/*.o ' + LDC_LIBS + ' -lgcc -gcc-toolchain ' + TOOLCHAIN +
' -no-canonical-prefixes -fuse-ld=bfd -target armv7-none-linux-androideabi -fvisibility=hidden \
-Wl,--gc-sections -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro \
-Wl,-z,now -mthumb -lm -lc -Llibs/armeabi-v7a -lcimgui -o libdemos.so')

142
demos/compile_wasm.py Normal file
View file

@ -0,0 +1,142 @@
import os
import ntpath
import sys
def compile(sources, output):
files = []
# r=root, d=directories, f = files
for path in sources:
for r, d, f in os.walk(path):
for file in f:
if ntpath.basename(file) != 'win_dll.d':
filename, file_extension = os.path.splitext(file)
if file_extension == '.d' and filename != 'package':
files.append(os.path.join(r, file))
ldc_cmd = compiler + shared_flags + ldc_flags + '-oq -mtriple=wasm32-unknown-emscripten -betterC --output-bc --od=.bc --singleobj --checkaction=C --of=' + output + ' '
for path in sources:
ldc_cmd += '-I' + path + ' '
for path in import_paths:
ldc_cmd += '-I' + path + ' '
for f in files:
ldc_cmd += f + ' '
print(ldc_cmd)
if os.system(ldc_cmd):
exit(0)
print()
compiler = 'ldc2 '
#compiler = 'ldmd2 -vtls '
shared_flags = ''
clean = 0
demo = 0
only_bc = 0
multi = 0
sources = ['tests', 'source']
emc_flags = '-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="[\'png\']" '
ldc_flags = '--d-version=SDL_209 --d-version=BindSDL_Static --d-version=BindSDL_Image --d-version=MM_USE_POSIX_THREADS '
import_paths = ['external/sources', 'external/imports', 'external/wasm_imports', '../source', 'utils/source', 'simple/source']
for arg in sys.argv[1:]:
if(arg == '-release'):
ldc_flags += '-release '
elif(arg == '-enable-inlining'):
ldc_flags += '-enable-inlining '
elif(arg == '-O3'):
shared_flags += '-O3 '
elif(arg == '-O2'):
shared_flags += '-O2 '
elif(arg == '-O1'):
shared_flags += '-O1 '
elif(arg == '-O0'):
shared_flags += '-O0 '
elif(arg == '-Os'):
shared_flags += '-Os '
elif(arg == '-Oz'):
shared_flags += '-Oz '
elif(arg == '-g'):
shared_flags += '-g '
elif(arg == '--multi'):
multi = 1
elif(arg == '-g4'):
ldc_flags += '-g '
emc_flags += '-g4 --source-map-base ./ '
elif(arg == '--llvm-lto'):
emc_flags += '--llvm-lto 3 '
elif(arg == '--simd'):
emc_flags += '-s SIMD=1 '
elif(arg == '-opt'):
shared_flags += '-O3 '
ldc_flags += '-release -enable-inlining '
emc_flags += '--llvm-lto 3 -s SIMD=1 '
elif(arg == '-quiet'):
emc_flags += "-Wl,--no-check-features "
elif(arg == '--clean'):
clean = 1
elif(arg == '-pthread'):
emc_flags += '-s USE_PTHREADS=1 '
elif(arg == '--demo=simple'):
demo = 0
elif(arg == '--only-bc'):
only_bc = 1
else:
print('unknown argument: ' + arg)
exit()
compile(['external/wasm_imports/bindbc/sdl'], 'bindbc-sdl.bc')
compile(['utils/source'], 'utils.bc')
compile(['external/sources/mmutils'], 'mmutils.bc')
compile(['external/sources/glad'], 'glad.bc')
compile(['source'], 'demo.bc')
if clean or os.path.exists('../ecs.bc') == 0 or os.path.isfile('../ecs.bc') == 0:
compile(['../source'], '../ecs.bc')
if only_bc:
exit()
if multi:
emcc_cmd = 'emcc ' + shared_flags + emc_flags + '--pre-js build/assets.js -s FORCE_FILESYSTEM=1 -s MAX_WEBGL_VERSION=2 --emrun -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s ALLOW_MEMORY_GROWTH=1 -s WASM_MEM_MAX=2048MB -s MALLOC=dlmalloc -s WASM=1 {0} -o {1} --shell-file emscripten_multi_shell.html '
else:
emcc_cmd = 'emcc ' + shared_flags + emc_flags + '--pre-js build/assets.js -s FORCE_FILESYSTEM=1 -s MAX_WEBGL_VERSION=2 --emrun -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s ALLOW_MEMORY_GROWTH=1 -s WASM_MEM_MAX=2048MB -s MALLOC=dlmalloc -s WASM=1 -o build/ecs_demo.html --shell-file emscripten_shell.html '
#emcc_cmd = 'emcc -v ' + shared_flags + emc_flags + '-s MAX_WEBGL_VERSION=2 --emrun -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s ALLOW_MEMORY_GROWTH=1 -s WASM_MEM_MAX=2048MB -s MALLOC=dlmalloc -s WASM=1 -o build/ecs_demo.html --shell-file emscripten_shell.html '
#-s ALLOW_MEMORY_GROWTH=1 -s PROXY_TO_PTHREAD=1 -Wl,--no-check-features -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=512MB
#-s MAX_WEBGL_VERSION=2
emcc_cmd += '../ecs.bc '
emcc_cmd += 'utils.bc '
emcc_cmd += 'bindbc-sdl.bc '
emcc_cmd += 'glad.bc '
emcc_cmd += 'cimgui.bc '
emcc_cmd += 'mmutils.bc '
emcc_cmd += 'demo.bc '
os.system("mkdir build")
# emscripten = imp.load_source('', os.path.expanduser("~") + '/.emscripten')
# pack_cmd = emscripten.EMSCRIPTEN_ROOT + '/tools/file_packager.py build/assets.data --preload assets --js-output=build/assets.js'
pack_cmd = os.path.expandvars('$EMSDK/upstream/emscripten') + '/tools/file_packager.py build/assets.data --preload assets --js-output=build/assets.js'
print('Packafing files: ' + pack_cmd)
os.system(pack_cmd)
if multi:
final_cmd = emcc_cmd.format('','build/ecs_demo.html')
print(final_cmd)
os.system(final_cmd)
final_cmd = emcc_cmd.format('-s USE_PTHREADS=1','build/ecs_demo_mt.js')
print(final_cmd)
os.system(final_cmd)
else:
print(emcc_cmd)
os.system(emcc_cmd)
os.system('rm build/assets.js')

45
demos/dub.json Normal file
View file

@ -0,0 +1,45 @@
{
"name": "demo",
"authors": [
"Michał Masiukiewicz", "Dawid Masiukiewicz"
],
"description": "Dynamic Entity Component System simple example",
"copyright": "Copyright © 2018-2019, Michał Masiukiewicz, Dawid Masiukiewicz",
"license": "BSD 3-clause",
"dependencies": {
"ecs_utils":{"path":"utils/"}
},
"sourcePaths": [
"source"
],
"importPaths": [
"source"
],
"libs-windows-x86_64": ["libs/windows/x64/SDL2","libs/windows/x64/SDL2_Image","libs/windows/x64/cimgui"],
"libs-linux-x86_64": ["cimgui","SDL2","SDL2_image"],
"lflags-linux-x86_64": ["-rpath=libs/linux/x64/","-Llibs/linux/x64/"],
"dflags-ldc" : [
"--ffast-math"
],
"configurations" : [
{
"name" : "default",
"targetType" : "executable",
"subConfigurations":
{
"ecs_utils":"default"
}
},
{
"name" : "betterC",
"targetType" : "executable",
"dflags": [
"-betterC"
],
"subConfigurations":
{
"ecs_utils":"betterC"
}
}
]
}

View file

@ -0,0 +1,170 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ECS Demo</title>
<style>
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
textarea.emscripten { font-family: monospace; width: 80%; }
div.emscripten { text-align: center; }
div.emscripten_border { border: 1px solid black; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { position: absolute;top: 0px;left: 0px;margin: 0px; border: 0px none; background-color: black; width: 100%; height: 100%; overflow: hidden;}
.spinner {
height: 50px;
width: 50px;
margin: 0px auto;
-webkit-animation: rotation .8s linear infinite;
-moz-animation: rotation .8s linear infinite;
-o-animation: rotation .8s linear infinite;
animation: rotation 0.8s linear infinite;
border-left: 10px solid rgb(0,150,240);
border-right: 10px solid rgb(0,150,240);
border-bottom: 10px solid rgb(0,150,240);
border-top: 10px solid rgb(100,0,200);
border-radius: 100%;
background-color: rgb(200,100,250);
}
@-webkit-keyframes rotation {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(360deg);}
}
@-moz-keyframes rotation {
from {-moz-transform: rotate(0deg);}
to {-moz-transform: rotate(360deg);}
}
@-o-keyframes rotation {
from {-o-transform: rotate(0deg);}
to {-o-transform: rotate(360deg);}
}
@keyframes rotation {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
</style>
</head>
<body>
<!--<hr/>-->
<figure style="overflow:visible;" id="spinner"><div class="spinner"></div><center style="margin-top:0.5em"><strong>emscripten</strong></center></figure>
<div class="emscripten" id="status">Downloading...</div>
<div class="emscripten">
<progress value="0" max="100" id="progress" hidden=1></progress>
</div>
<div class="emscripten_border">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
</div>
<!--<hr/>
<div class="emscripten">
<input type="checkbox" id="resize">Resize canvas
<input type="checkbox" id="pointerLock" checked>Lock/hide mouse pointer
&nbsp;&nbsp;&nbsp;
<input type="button" value="Fullscreen" onclick="Module.requestFullscreen(document.getElementById('pointerLock').checked,
document.getElementById('resize').checked)">
</div>-->
<hr/>
<textarea class="emscripten" id="output" rows="8"></textarea>
<hr>
<script type='text/javascript'>
var statusElement = document.getElementById('status');
var progressElement = document.getElementById('progress');
var spinnerElement = document.getElementById('spinner');
var canvasElement = document.getElementById('canvas');
canvasElement.style.display = "none";
var Module = {
preRun: [],
postRun: [],
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
//text = text.replace(/>/g, "&gt;");
//text = text.replace('\n', '<br>', 'g');
console.log(text);
if (element) {
element.value += text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
setStatus: function(text) {
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
if (text === Module.setStatus.last.text) return;
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var now = Date.now();
if (m && now - Module.setStatus.last.time < 30) return; // if this is a progress update, skip it if too soon
Module.setStatus.last.time = now;
Module.setStatus.last.text = text;
if (m) {
text = m[1];
progressElement.value = parseInt(m[2])*100;
progressElement.max = parseInt(m[4])*100;
progressElement.hidden = false;
spinnerElement.hidden = false;
} else {
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
if (!text) spinnerElement.hidden = true;
}
statusElement.innerHTML = text;
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
if (!left) canvasElement.style.display = "block";
}
};
Module.setStatus('Downloading...');
window.onerror = function() {
canvasElement.style.display = "none";
Module.setStatus('Exception thrown, see JavaScript console');
spinnerElement.style.display = 'none';
Module.setStatus = function(text) {
if (text) Module.printErr('[post-exception status] ' + text);
};
};
(function() {
if(typeof SharedArrayBuffer !== "undefined")
{
memory_test = new WebAssembly.Memory({
"initial": 1,
"maximum": 1,
"shared": true
});
if (!(memory_test.buffer instanceof SharedArrayBuffer))src = "ecs_demo.js";
else src = "ecs_demo_mt.js";
delete memory_test;
}
else src = "ecs_demo.js";
document.write('<script async type="text/javascript" src="' + src + '"><\/script>');
})();
</script>
<!--{{{ SCRIPT }}}-->
</body>
</html>

154
demos/emscripten_shell.html Normal file
View file

@ -0,0 +1,154 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ECS Demo</title>
<style>
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
textarea.emscripten { font-family: monospace; width: 80%; }
div.emscripten { text-align: center; }
div.emscripten_border { border: 1px solid black; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { position: absolute;top: 0px;left: 0px;margin: 0px; border: 0px none; background-color: black; width: 100%; height: 100%; overflow: hidden;}
.spinner {
height: 50px;
width: 50px;
margin: 0px auto;
-webkit-animation: rotation .8s linear infinite;
-moz-animation: rotation .8s linear infinite;
-o-animation: rotation .8s linear infinite;
animation: rotation 0.8s linear infinite;
border-left: 10px solid rgb(0,150,240);
border-right: 10px solid rgb(0,150,240);
border-bottom: 10px solid rgb(0,150,240);
border-top: 10px solid rgb(100,0,200);
border-radius: 100%;
background-color: rgb(200,100,250);
}
@-webkit-keyframes rotation {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(360deg);}
}
@-moz-keyframes rotation {
from {-moz-transform: rotate(0deg);}
to {-moz-transform: rotate(360deg);}
}
@-o-keyframes rotation {
from {-o-transform: rotate(0deg);}
to {-o-transform: rotate(360deg);}
}
@keyframes rotation {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
</style>
</head>
<body>
<!--<hr/>-->
<figure style="overflow:visible;" id="spinner"><div class="spinner"></div><center style="margin-top:0.5em"><strong>emscripten</strong></center></figure>
<div class="emscripten" id="status">Downloading...</div>
<div class="emscripten">
<progress value="0" max="100" id="progress" hidden=1></progress>
</div>
<div class="emscripten_border">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
</div>
<!--<hr/>
<div class="emscripten">
<input type="checkbox" id="resize">Resize canvas
<input type="checkbox" id="pointerLock" checked>Lock/hide mouse pointer
&nbsp;&nbsp;&nbsp;
<input type="button" value="Fullscreen" onclick="Module.requestFullscreen(document.getElementById('pointerLock').checked,
document.getElementById('resize').checked)">
</div>-->
<hr/>
<textarea class="emscripten" id="output" rows="8"></textarea>
<hr>
<script type='text/javascript'>
var statusElement = document.getElementById('status');
var progressElement = document.getElementById('progress');
var spinnerElement = document.getElementById('spinner');
var canvasElement = document.getElementById('canvas');
canvasElement.style.display = "none";
var Module = {
preRun: [],
postRun: [],
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
//text = text.replace(/>/g, "&gt;");
//text = text.replace('\n', '<br>', 'g');
console.log(text);
if (element) {
element.value += text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
setStatus: function(text) {
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
if (text === Module.setStatus.last.text) return;
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var now = Date.now();
if (m && now - Module.setStatus.last.time < 30) return; // if this is a progress update, skip it if too soon
Module.setStatus.last.time = now;
Module.setStatus.last.text = text;
if (m) {
text = m[1];
progressElement.value = parseInt(m[2])*100;
progressElement.max = parseInt(m[4])*100;
progressElement.hidden = false;
spinnerElement.hidden = false;
} else {
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
if (!text) spinnerElement.hidden = true;
}
statusElement.innerHTML = text;
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
if (!left) canvasElement.style.display = "block";
}
};
Module.setStatus('Downloading...');
window.onerror = function() {
canvasElement.style.display = "none";
Module.setStatus('Exception thrown, see JavaScript console');
spinnerElement.style.display = 'none';
Module.setStatus = function(text) {
if (text) Module.printErr('[post-exception status] ' + text);
};
};
</script>
{{{ SCRIPT }}}
</body>
</html>

View file

@ -0,0 +1,11 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.loader;
public
import bindbc.loader.sharedlib,
bindbc.loader.system;

View file

@ -0,0 +1,282 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.loader.sharedlib;
import core.stdc.stdlib;
import core.stdc.string;
/// Handle to a shared library
struct SharedLib {
private void* _handle;
}
/// Indicates an uninitialized or unassigned handle.
enum invalidHandle = SharedLib.init;
// Contains information about shared library and symbol load failures.
struct ErrorInfo {
private:
char[32] _error;
char[96] _message;
public @nogc nothrow @property:
/**
Returns the string "Missing Symbol" to indicate a symbol load failure, and
the name of a library to indicate a library load failure.
*/
const(char)* error() const { return _error.ptr; }
/**
Returns a symbol name for symbol load failures, and a system-specific error
message for library load failures.
*/
const(char)* message() const { return _message.ptr; }
}
private {
__gshared ErrorInfo[] _errors;
__gshared size_t _errorCount;
}
@nogc nothrow:
/**
Returns an slice containing all errors that have been accumulated by the
`load` and `bindSymbol` functions since the last call to `resetErrors`.
*/
const(ErrorInfo)[] errors()
{
return _errors[0 .. _errorCount];
}
/**
Returns the total number of errors that have been accumulated by the
`load` and `bindSymbol` functions since the last call to `resetErrors`.
*/
size_t errorCount()
{
return _errorCount;
}
/**
Sets the error count to 0 and erases all accumulated errors. This function
does not release any memory allocated for the error list.
*/
void resetErrors()
{
_errorCount = 0;
memset(_errors.ptr, 0, _errors.length * ErrorInfo.sizeof);
}
/*
void freeErrors()
{
free(_errors.ptr);
_errors.length = _errorCount = 0;
}
*/
/**
Loads a symbol from a shared library and assigns it to a caller-supplied pointer.
Params:
lib = a valid handle to a shared library loaded via the `load` function.
ptr = a pointer to a function or variable pointer whose declaration is
appropriate for the symbol being bound (it is up to the caller to
verify the types match).
symbolName = the name of the symbol to bind.
*/
void bindSymbol(SharedLib lib, void** ptr, const(char)* symbolName)
{
// Without this, DMD can hang in release builds
pragma(inline, false);
assert(lib._handle);
auto sym = loadSymbol(lib._handle, symbolName);
if(sym) {
*ptr = sym;
}
else {
addErr("Missing Symbol", symbolName);
}
}
/**
Formats a symbol using the Windows stdcall mangling if necessary before passing it on to
bindSymbol.
Params:
lib = a valid handle to a shared library loaded via the `load` function.
ptr = a pointer to a function or variable pointer whose declaration is
appropriate for the symbol being bound (it is up to the caller to
verify the types match).
symbolName = the name of the symbol to bind.
*/
void bindSymbol_stdcall(Func)(SharedLib lib, ref Func f, const(char)* symbolName)
{
import bindbc.loader.system : bindWindows, bind32;
static if(bindWindows && bind32) {
import core.stdc.stdio : snprintf;
import std.traits : ParameterTypeTuple;
uint paramSize(A...)(A args)
{
size_t sum = 0;
foreach(arg; args) {
sum += arg.sizeof;
// Align on 32-bit stack
if((sum & 3) != 0) {
sum += 4 - (sum & 3);
}
}
return sum;
}
ParameterTypeTuple!f params;
char[128] mangled;
snprintf(mangled.ptr, mangled.length, "_%s@%d", symbolName, paramSize(params));
symbolName = mangled.ptr;
}
bindSymbol(lib, cast(void**)&f, symbolName);
}
/**
Loads a shared library from disk, using the system-specific API and search rules.
libName = the name of the library to load. May include the full or relative
path for the file.
*/
SharedLib load(const(char)* libName)
{
auto handle = loadLib(libName);
if(handle) return SharedLib(handle);
else {
addErr(libName, null);
return invalidHandle;
}
}
/**
Unloads a shared library from process memory.
Generally, it is not necessary to call this function at program exit, as the system will ensure
any shared libraries loaded by the process will be unloaded then. However, any loaded shared
libraries that are no longer needed by the program during runtime, such as those that are part
of a "hot swap" mechanism, should be unloaded to free up resources.
*/
void unload(ref SharedLib lib) {
if(lib._handle) {
unloadLib(lib._handle);
lib = invalidHandle;
}
}
private:
void allocErrs() {
size_t newSize = _errorCount == 0 ? 16 : _errors.length * 2;
auto errs = cast(ErrorInfo*)malloc(ErrorInfo.sizeof * newSize);
if(!errs) exit(EXIT_FAILURE);
if(_errorCount > 0) {
memcpy(errs, _errors.ptr, ErrorInfo.sizeof * _errors.length);
free(_errors.ptr);
}
_errors = errs[0 .. newSize];
}
void addErr(const(char)* errstr, const(char)* message)
{
if(_errors.length == 0 || _errorCount >= _errors.length) {
allocErrs();
}
auto pinfo = &_errors[_errorCount];
strcpy(pinfo._error.ptr, errstr);
if(message) {
strncpy(pinfo._message.ptr, message, pinfo._message.length);
pinfo._message[pinfo._message.length - 1] = 0;
}
else {
sysError(pinfo._message.ptr, pinfo._message.length);
}
++_errorCount;
}
version(Windows)
{
import core.sys.windows.windows;
void* loadLib(const(char)* name)
{
return LoadLibraryA(name);
}
void unloadLib(void* lib)
{
FreeLibrary(lib);
}
void* loadSymbol(void* lib, const(char)* symbolName)
{
return GetProcAddress(lib, symbolName);
}
void sysError(char* buf, size_t len)
{
char* msgBuf;
enum uint langID = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
null,
GetLastError(),
langID,
cast(char*)&msgBuf,
0,
null
);
if(msgBuf) {
strncpy(buf, msgBuf, len);
buf[len - 1] = 0;
LocalFree(msgBuf);
}
else strncpy(buf, "Unknown Error\0", len);
}
}
else version(Posix) {
import core.sys.posix.dlfcn;
void* loadLib(const(char)* name)
{
return dlopen(name, RTLD_NOW);
}
void unloadLib(void* lib)
{
dlclose(lib);
}
void* loadSymbol(void* lib, const(char)* symbolName)
{
return dlsym(lib, symbolName);
}
void sysError(char* buf, size_t len)
{
const (char)* msg = dlerror();
strncpy(buf, msg != null ? msg : "Unknown Error", len);
buf[len - 1] = 0;
}
}
else static assert(0, "bindbc-loader is not implemented on this platform.");

View file

@ -0,0 +1,55 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.loader.system;
static if((void*).sizeof == 8) {
enum bind64 = true;
enum bind32 = false;
}
else {
enum bind64 = false;
enum bind32 = true;
}
version(Windows) enum bindWindows = true;
else enum bindWindows = false;
version(OSX) enum bindMac = true;
else enum bindMac = false;
version(linux) enum bindLinux = true;
else enum bindLinux = false;
version(Posix) enum bindPosix = true;
else enum bindPosix = false;
version(Android) enum bindAndroid = true;
else enum bindAndroid = false;
enum bindIOS = false;
enum bindWinRT = false;
version(FreeBSD) {
enum bindBSD = true;
enum bindFreeBSD = true;
enum bindOpenBSD = false;
}
else version(OpenBSD) {
enum bindBSD = true;
enum bindFreeBSD = false;
enum bindOpenBSD = true;
}
else version(BSD) {
enum bindBSD = true;
enum bindFreeBSD = false;
enum bindOpenBSD = false;
}
else {
enum bindBSD = false;
enum bindFreeBSD = false;
enum bindOpenBSD = false;
}

12
demos/external/meson.build vendored Normal file
View file

@ -0,0 +1,12 @@
demos_src += files(
'sources/cimgui/cimgui.d',
'sources/glad/gl/all.d',
'sources/glad/gl/enums.d',
'sources/glad/gl/ext.d',
'sources/glad/gl/funcs.d',
'sources/glad/gl/gl.d',
'sources/glad/gl/gles2.d',
'sources/glad/gl/loader.d',
'sources/glad/gl/types.d',
'sources/mmutils/thread_pool.d',
)

1998
demos/external/sources/cimgui/cimgui.d vendored Normal file

File diff suppressed because it is too large Load diff

28
demos/external/sources/glad/gl/all.d vendored Normal file
View file

@ -0,0 +1,28 @@
/*
OpenGL, OpenGL ES loader generated by glad 0.1.33 on Fri Nov 8 17:14:30 2019.
Language/Generator: D
Specification: gl
APIs: gl=3.3, gles2=3.0
Profile: compatibility
Extensions:
Loader: True
Local files: False
Omit khrplatform: False
Reproducible: False
Commandline:
--profile="compatibility" --api="gl=3.3,gles2=3.0" --generator="d" --spec="gl" --extensions=""
Online:
https://glad.dav1d.de/#profile=compatibility&language=d&specification=gl&loader=on&api=gl%3D3.3&api=gles2%3D3.0
*/
module glad.gl.all;
public import glad.gl.funcs;
public import glad.gl.ext;
public import glad.gl.enums;
public import glad.gl.types;

1302
demos/external/sources/glad/gl/enums.d vendored Normal file

File diff suppressed because it is too large Load diff

10
demos/external/sources/glad/gl/ext.d vendored Normal file
View file

@ -0,0 +1,10 @@
module glad.gl.ext;
private import glad.gl.types;
private import glad.gl.enums;
private import glad.gl.funcs;
nothrow @nogc extern(System) {
}
__gshared {
}

1508
demos/external/sources/glad/gl/funcs.d vendored Normal file

File diff suppressed because it is too large Load diff

404
demos/external/sources/glad/gl/gl.d vendored Normal file
View file

@ -0,0 +1,404 @@
module glad.gl.gl;
public import glad.gl.types;
public import glad.gl.funcs :
glCopyTexImage1D, glVertexAttribI3ui, glWindowPos2s, glWindowPos2i, glWindowPos2f,
glWindowPos2d, glVertex2fv, glColor4ub, glIndexi, glFramebufferRenderbuffer,
glRectdv, glCompressedTexSubImage3D, glEvalCoord2d, glEvalCoord2f, glIndexd,
glVertexAttrib1sv, glIndexf, glBindSampler, glLineWidth, glColorP3uiv,
glGetIntegeri_v, glGetMapfv, glIndexs, glCompileShader, glGetTransformFeedbackVarying,
glVertex3sv, glIndexfv, glFogiv, glStencilMaskSeparate, glRasterPos2fv,
glLightModeliv, glRectd, glSecondaryColor3fv, glMultiTexCoordP3ui, glFogfv,
glVertexP4ui, glEnablei, glVertex4iv, glEvalCoord1fv, glWindowPos2sv,
glVertexAttribP4ui, glCreateShader, glIsBuffer, glGetMultisamplefv, glGenRenderbuffers,
glCopyTexSubImage2D, glCompressedTexImage2D, glVertexAttrib1f, glBlendFuncSeparate, glVertex4fv,
glDrawBuffers, glVertexAttrib1s, glTexCoord2fv, glSampleMaski, glVertexP2ui,
glTexCoord1i, glTexCoord4fv, glUniformMatrix3x2fv, glPointSize, glVertexAttrib2dv,
glDeleteProgram, glColor4bv, glRasterPos2f, glRasterPos2d, glLoadIdentity,
glRasterPos2i, glUniformMatrix4x3fv, glColor3b, glClearBufferfv, glEdgeFlag,
glFogCoordf, glVertex3d, glVertex3f, glVertex3i, glColor3i,
glUniform3f, glVertexAttrib4ubv, glColor3s, glVertex3s, glTexCoordP2ui,
glColorMaski, glEnableClientState, glClearBufferfi, glTexCoord1iv, glMultiTexCoord1iv,
glMultiTexCoordP2ui, glGetSamplerParameterIiv, glGetFragDataIndex, glRasterPos4i, glVertex2iv,
glColor3sv, glGetVertexAttribdv, glUniformMatrix3x4fv, glNormalPointer, glTexCoordP3uiv,
glVertex4sv, glPassThrough, glMultiTexCoordP4ui, glFogi, glBegin,
glEvalCoord2dv, glColor3ubv, glVertexPointer, glScaled, glDeleteFramebuffers,
glDrawArrays, glUniform1ui, glMultiTexCoord1d, glMultiTexCoord1f, glLightfv,
glClear, glMultiTexCoord1i, glGetActiveUniformName, glMultiTexCoord1s, glStencilOp,
glTexCoord1s, glFramebufferTexture2D, glGetFramebufferAttachmentParameteriv, glTranslatef, glVertexAttrib4Nub,
glTranslated, glTexCoord3sv, glGetFragDataLocation, glTexImage1D, glTexParameteriv,
glCopyPixels, glSecondaryColor3bv, glGetMaterialfv, glGetTexImage, glFogCoordfv,
glVertexAttrib4iv, glPixelMapuiv, glColor4ubv, glGetQueryObjecti64v, glGenFramebuffers,
glIndexsv, glGetAttachedShaders, glIsRenderbuffer, glVertex3iv, glBitmap,
glMateriali, glIsVertexArray, glDisableVertexAttribArray, glGetQueryiv, glTexCoord4f,
glTexCoord4d, glGetSamplerParameterfv, glTexCoord4i, glMaterialf, glTexCoord4s,
glGetUniformIndices, glIsShader, glFeedbackBuffer, glVertexAttribI4ubv, glVertex3dv,
glPointParameteriv, glDisable, glEnable, glGetActiveUniformsiv, glColor4fv,
glTexCoord1fv, glTexCoord2sv, glVertexAttrib4dv, glMultiTexCoord1dv, glGetMapiv,
glTexCoord3fv, glSecondaryColor3usv, glMultiTexCoordP3uiv, glVertexAttribP3ui, glGetPointerv,
glPolygonOffset, glGetUniformuiv, glNormal3fv, glDepthRange, glFrustum,
glMultiTexCoord2f, glDrawBuffer, glPushMatrix, glRasterPos3fv, glOrtho,
glDrawElementsInstanced, glWindowPos3sv, glVertexAttrib4d, glClearIndex, glMap1d,
glMap1f, glFlush, glGetRenderbufferParameteriv, glIndexiv, glRasterPos3sv,
glGetVertexAttribPointerv, glPixelZoom, glDeleteBuffers, glFenceSync, glDeleteVertexArrays,
glColorP3ui, glVertexAttrib3sv, glVertexAttrib4s, glGetTexLevelParameteriv, glLighti,
glMultiTexCoordP4uiv, glLightf, glGetAttribLocation, glStencilFuncSeparate, glGenSamplers,
glClampColor, glUniform4iv, glClearStencil, glVertexAttrib2sv, glMultiTexCoord3fv,
glGetPixelMapuiv, glGenTextures, glTexCoord4iv, glGetTexParameterIuiv, glIndexPointer,
glVertexAttrib4Nbv, glGetQueryObjectiv, glIsSync, glVertex2f, glVertex2d,
glDeleteRenderbuffers, glUniform2i, glMapGrid2d, glMapGrid2f, glShaderSource,
glVertex2i, glVertexAttribPointer, glFramebufferTextureLayer, glVertex2s, glNormal3bv,
glFlushMappedBufferRange, glSecondaryColor3sv, glPointParameteri, glWindowPos2iv, glGenQueries,
glGetPixelMapfv, glTexEnvf, glVertexAttribP1ui, glTexSubImage3D, glGetInteger64i_v,
glFogCoordd, glDeleteSamplers, glCopyTexImage2D, glTexEnvi, glBlitFramebuffer,
glIsEnabledi, glSecondaryColorP3ui, glBindFragDataLocationIndexed, glMultiTexCoord2dv, glUniform2iv,
glUniform4uiv, glMatrixMode, glMultiTexCoord2s, glColor3uiv, glMultiTexCoord2i,
glFramebufferTexture1D, glGetShaderiv, glMultiTexCoord2d, glMultiTexCoord4sv, glBindFragDataLocation,
glPrioritizeTextures, glCallList, glSecondaryColor3ubv, glGetDoublev, glMultiTexCoord3iv,
glVertexAttrib1d, glLightModelf, glVertexAttrib1fv, glVertex2sv, glLightModeli,
glBindBufferRange, glWindowPos3iv, glMultiTexCoordP1uiv, glUniform3fv, glCallLists,
glMapBuffer, glSecondaryColor3d, glTexCoord3i, glMultiTexCoord4fv, glRasterPos3i,
glSecondaryColor3b, glRasterPos3d, glRasterPos3f, glCompressedTexImage3D, glTexCoord3f,
glDeleteSync, glMultiTexCoordP1ui, glGetVertexAttribiv, glSecondaryColor3s, glVertexAttrib3fv,
glTexCoord3s, glUniform3iv, glRasterPos3s, glPolygonMode, glGetActiveUniformBlockiv,
glAreTexturesResident, glIsList, glRasterPos4sv, glCopyTexSubImage3D, glColor4s,
glUseProgram, glLineStipple, glSamplerParameterIuiv, glMultiTexCoord1sv, glGetProgramInfoLog,
glMultiTexCoord2iv, glTexCoord1sv, glBindVertexArray, glColor4b, glSecondaryColor3f,
glColor4f, glColor4d, glColor4i, glMultiDrawElementsBaseVertex, glUniform4fv,
glRasterPos3iv, glVertex2dv, glTexCoord4sv, glUniform2uiv, glCompressedTexSubImage1D,
glFinish, glClipPlane, glDeleteShader, glRasterPos2s, glGetMapdv,
glVertexAttrib4Nsv, glTexGendv, glViewport, glBindBufferBase, glVertexP3uiv,
glTransformFeedbackVaryings, glIndexdv, glTexCoord3d, glTexCoord3iv, glVertexAttribI3i,
glClearDepth, glVertexAttribI4usv, glTexParameterf, glTexParameteri, glGetShaderSource,
glTexBuffer, glPixelStorei, glValidateProgram, glPixelStoref, glSecondaryColor3iv,
glRasterPos4fv, glEvalCoord1dv, glMultiTexCoordP2uiv, glRecti, glMultiDrawElements,
glRectf, glColor4ui, glNormal3sv, glGetFloatv, glColor4us,
glVertexAttribP1uiv, glLinkProgram, glTexSubImage1D, glBindTexture, glRects,
glTexCoord2dv, glRasterPos4iv, glGetString, glVertexAttribP2uiv, glEdgeFlagv,
glDetachShader, glScalef, glEndQuery, glSecondaryColor3uiv, glEdgeFlagPointer,
glVertexAttrib4Nuiv, glVertexAttribI2ui, glPopAttrib, glDeleteTextures, glStencilOpSeparate,
glDeleteQueries, glNormalP3uiv, glVertexAttrib4f, glRenderbufferStorage, glInitNames,
glColor3dv, glPixelMapfv, glGetTexParameteriv, glWaitSync, glBeginConditionalRender,
glDrawElementsBaseVertex, glSampleCoverage, glSamplerParameteri, glSamplerParameterf, glUniform1f,
glGetVertexAttribfv, glRenderMode, glGetCompressedTexImage, glWindowPos2dv, glUniform1i,
glGetActiveAttrib, glUniform3i, glPixelTransferi, glTexSubImage2D, glGetUniformiv,
glLogicOp, glEvalPoint2, glPixelTransferf, glUniform4ui, glColor3f,
glBindFramebuffer, glGetTexEnvfv, glRectfv, glCullFace, glGetLightfv,
glTexGenf, glTexGend, glTexGeni, glMultiTexCoord3s, glVertexAttribI2uiv,
glMultiTexCoord3i, glMultiTexCoord3f, glMultiTexCoord3d, glAttachShader, glFogCoorddv,
glGetTexGenfv, glQueryCounter, glFogCoordPointer, glProvokingVertex, glRasterPos4dv,
glTexGeniv, glDrawElements, glColorMaterial, glSecondaryColor3dv, glClientActiveTexture,
glVertexAttribI4sv, glTexCoord2iv, glUniform1iv, glGetBufferParameteriv, glReadBuffer,
glTexParameterIuiv, glDrawArraysInstanced, glGenerateMipmap, glWindowPos3fv, glLightModelfv,
glSamplerParameteriv, glDeleteLists, glGetClipPlane, glVertexAttrib3f, glTexCoord2d,
glVertexAttrib3d, glTexCoord2f, glRasterPos2dv, glIndexubv, glUnmapBuffer,
glTexCoord2i, glRasterPos4d, glRasterPos4f, glVertexAttrib3s, glTexCoord2s,
glBindRenderbuffer, glVertex3fv, glTexCoord4dv, glMaterialiv, glVertexAttribP4uiv,
glIsProgram, glPointParameterfv, glVertex4s, glPopMatrix, glVertexAttrib4fv,
glNormal3dv, glUniform4i, glActiveTexture, glEnableVertexAttribArray, glRotated,
glRotatef, glVertex4i, glArrayElement, glReadPixels, glVertexAttribI3iv,
glStencilMask, glUniform4f, glRenderbufferStorageMultisample, glColor3d, glGenVertexArrays,
glShadeModel, glMapGrid1d, glGetUniformfv, glMapGrid1f, glDrawPixels,
glDisableClientState, glMultiTexCoord3sv, glDrawElementsInstancedBaseVertex, glSecondaryColorPointer, glAlphaFunc,
glMultiTexCoord4iv, glTexEnvfv, glStencilFunc, glTexCoord3dv, glUniformBlockBinding,
glColor4uiv, glRectiv, glColorP4ui, glRasterPos3dv, glEvalMesh2,
glEvalMesh1, glTexCoordPointer, glLoadMatrixf, glVertexAttribI4iv, glEvalCoord2fv,
glGetShaderInfoLog, glLoadTransposeMatrixd, glLoadTransposeMatrixf, glVertexAttribI4i, glRasterPos2iv,
glGetBufferSubData, glTexEnviv, glBlendEquationSeparate, glVertexAttribI1ui, glGenBuffers,
glSelectBuffer, glTexCoordP1uiv, glPushAttrib, glVertexAttribIPointer, glBlendFunc,
glCreateProgram, glTexImage3D, glIsFramebuffer, glLightiv, glPrimitiveRestartIndex,
glTexGenfv, glTexCoord1dv, glEnd, glGetInteger64v, glScissor,
glTexCoordP4uiv, glGetBooleanv, glPushName, glMaterialfv, glIndexub,
glVertexP2uiv, glUniform3uiv, glMultTransposeMatrixf, glMultTransposeMatrixd, glClearColor,
glVertexAttrib4uiv, glPolygonStipple, glVertexAttrib4Niv, glClearBufferiv, glGetBufferParameteri64v,
glColorP4uiv, glBlendColor, glWindowPos3d, glGetStringi, glColor4iv,
glUniform3ui, glSecondaryColor3us, glVertexAttribI4uiv, glVertexAttrib4bv, glUniform2fv,
glSecondaryColor3ub, glSecondaryColor3ui, glMultiTexCoord1fv, glGetSamplerParameterIuiv, glNormal3i,
glTexCoordP3ui, glNormal3iv, glWindowPos3s, glPointParameterf, glColor3us,
glWindowPos3i, glUniformMatrix2x3fv, glWindowPos3f, glGetVertexAttribIuiv, glMultiTexCoord4s,
glVertexAttrib4Nusv, glGetLightiv, glDepthFunc, glCompressedTexSubImage2D, glListBase,
glMultiTexCoord4f, glColor3ub, glMultiTexCoord4d, glVertexAttribI4bv, glGetTexParameterfv,
glColor3ui, glMultiTexCoord4i, glGetPolygonStipple, glClientWaitSync, glVertexAttribI4ui,
glPixelMapusv, glColorMask, glTexParameterIiv, glBlendEquation, glGetUniformLocation,
glGetTexGeniv, glRasterPos4s, glEndTransformFeedback, glVertexAttrib4usv, glTexImage2DMultisample,
glColor4sv, glPopClientAttrib, glColor4dv, glBeginTransformFeedback, glFogf,
glVertexAttribI1iv, glIsSampler, glVertexP3ui, glVertexAttribDivisor, glColor3iv,
glCompressedTexImage1D, glCopyTexSubImage1D, glDrawRangeElementsBaseVertex, glCheckFramebufferStatus, glTexCoord1d,
glTexCoord1f, glEndConditionalRender, glUniform1uiv, glBindAttribLocation, glUniformMatrix4x2fv,
glMultiTexCoord2sv, glVertexAttrib1dv, glDrawRangeElements, glGetQueryObjectuiv, glSamplerParameterIiv,
glBufferSubData, glVertexAttribI2i, glGenLists, glColor3bv, glMapBufferRange,
glFramebufferTexture, glGetTexGendv, glMultiDrawArrays, glEndList, glVertexP4uiv,
glUniform2ui, glVertexAttribI2iv, glColor3usv, glWindowPos2fv, glDisablei,
glIndexMask, glPushClientAttrib, glVertex4dv, glTexCoordP4ui, glGetActiveUniformBlockName,
glVertexAttribI3uiv, glClearAccum, glGetSynciv, glTexCoordP2uiv, glUniform2f,
glBeginQuery, glUniformMatrix4fv, glBindBuffer, glMap2d, glMap2f,
glRasterPos2sv, glUniformMatrix2fv, glUniformMatrix2x4fv, glBufferData, glEvalPoint1,
glGetTexParameterIiv, glIsEnabled, glTexCoordP1ui, glGetError, glGetTexEnviv,
glGetProgramiv, glVertexAttribP2ui, glNewList, glSecondaryColor3i, glMultiTexCoord2fv,
glNormalP3ui, glEvalCoord1d, glGetTexLevelParameterfv, glEvalCoord1f, glVertexAttribI1i,
glVertex4d, glVertexAttribP3uiv, glGetPixelMapusv, glSecondaryColorP3uiv, glGetIntegerv,
glAccum, glGetBufferPointerv, glGetVertexAttribIiv, glFramebufferTexture3D, glVertexAttrib2fv,
glIsQuery, glVertexAttrib4sv, glWindowPos3dv, glTexImage2D, glLoadName,
glSamplerParameterfv, glMultMatrixd, glMultMatrixf, glIsTexture, glGetMaterialiv,
glUniform1fv, glVertexAttrib4Nubv, glLoadMatrixd, glTexParameterfv, glUniformMatrix3fv,
glVertex4f, glRectsv, glColor4usv, glNormal3s, glInterleavedArrays,
glHint, glNormal3f, glNormal3d, glNormal3b, glMultiTexCoord4dv,
glGetSamplerParameteriv, glPopName, glCopyBufferSubData, glVertexAttribI1uiv, glVertexAttrib2d,
glVertexAttrib2f, glVertexAttrib3dv, glGetQueryObjectui64v, glDepthMask, glVertexAttrib2s,
glColor3fv, glTexImage3DMultisample, glGetUniformBlockIndex, glMultiTexCoord3dv, glGetActiveUniform,
glColorPointer, glFrontFace, glGetBooleani_v, glClearBufferuiv;
public import glad.gl.enums :
GL_INDEX_CLEAR_VALUE, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, GL_FOG_INDEX, GL_ALPHA_TEST_FUNC,
GL_SOURCE1_ALPHA, GL_NORMAL_MAP, GL_DITHER, GL_QUERY_RESULT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
GL_R16_SNORM, GL_FOG_COORD_ARRAY, GL_FLOAT, GL_PROXY_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD,
GL_RGB16_SNORM, GL_SAMPLER_2D_RECT, GL_RGB9_E5, GL_MAX_VERTEX_UNIFORM_BLOCKS, GL_TEXTURE_COMPRESSED,
GL_T2F_C4UB_V3F, GL_EDGE_FLAG_ARRAY_POINTER, GL_PROXY_TEXTURE_3D, GL_MAX_LIST_NESTING, GL_COLOR_ATTACHMENT22,
GL_SOURCE0_ALPHA, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_BYTE, GL_TIMEOUT_IGNORED,
GL_COLOR_ARRAY, GL_ZOOM_Y, GL_ZOOM_X, GL_RENDERBUFFER_SAMPLES, GL_HINT_BIT,
GL_COLOR_CLEAR_VALUE, GL_LINEAR_MIPMAP_LINEAR, GL_DEPTH_WRITEMASK, GL_TEXTURE_GEN_MODE, GL_3D_COLOR_TEXTURE,
GL_COLOR_ARRAY_POINTER, GL_TEXTURE_DEPTH_SIZE, GL_FLOAT_MAT3x2, GL_PIXEL_MAP_G_TO_G, GL_RENDER,
GL_MAX_TEXTURE_COORDS, GL_FLOAT_MAT3x4, GL_COLOR_ATTACHMENT28, GL_TEXTURE_BINDING_2D_MULTISAMPLE, GL_COLOR_ATTACHMENT24,
GL_COLOR_ATTACHMENT25, GL_COLOR_ATTACHMENT26, GL_COLOR_ATTACHMENT27, GL_COLOR_ATTACHMENT20, GL_COLOR_ATTACHMENT21,
GL_COMPRESSED_RGBA, GL_COLOR_ATTACHMENT23, GL_CLIENT_ATTRIB_STACK_DEPTH, GL_UNSIGNED_SHORT_5_5_5_1, GL_TEXTURE_COMPONENTS,
GL_QUERY_NO_WAIT, GL_PROVOKING_VERTEX, GL_SIGNED_NORMALIZED, GL_CURRENT_RASTER_TEXTURE_COORDS, GL_EXP,
GL_LINE_STRIP_ADJACENCY, GL_POINT_SIZE, GL_TEXTURE_COMPARE_FUNC, GL_TRANSFORM_FEEDBACK_BUFFER_MODE, GL_BITMAP_TOKEN,
GL_RGB10, GL_RGB16, GL_POLYGON_OFFSET_FILL, GL_LINE_TOKEN, GL_DOUBLEBUFFER,
GL_MAX_CLIP_PLANES, GL_FOG_COORDINATE_ARRAY_STRIDE, GL_RGB_INTEGER, GL_COMPILE_AND_EXECUTE, GL_MULT,
GL_STENCIL_CLEAR_VALUE, GL_GREEN_BITS, GL_SHADING_LANGUAGE_VERSION, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_SRC2_RGB,
GL_FRAGMENT_SHADER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_INDEX_ARRAY_TYPE, GL_FRAGMENT_SHADER_DERIVATIVE_HINT, GL_TEXTURE_DEPTH,
GL_VIEWPORT, GL_DRAW_BUFFER6, GL_DRAW_BUFFER7, GL_DRAW_BUFFER4, GL_DRAW_BUFFER5,
GL_DRAW_BUFFER2, GL_DRAW_BUFFER3, GL_DRAW_BUFFER0, GL_DRAW_BUFFER1, GL_LIGHT1,
GL_LIGHT0, GL_LIGHT3, GL_LIGHT2, GL_COPY, GL_LIGHT4,
GL_BLEND_SRC, GL_LIGHT6, GL_MAP_STENCIL, GL_QUADRATIC_ATTENUATION, GL_TEXTURE_CUBE_MAP_SEAMLESS,
GL_TEXTURE_RECTANGLE, GL_FILL, GL_SRC_COLOR, GL_SAMPLER_BINDING, GL_DEPTH24_STENCIL8,
GL_SAMPLE_BUFFERS, GL_RGBA_INTEGER, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, GL_COLOR_INDEX, GL_EXTENSIONS,
GL_MAP2_NORMAL, GL_BUFFER_SIZE, GL_PASS_THROUGH_TOKEN, GL_MAX_EVAL_ORDER, GL_UPPER_LEFT,
GL_TEXTURE_COMPARE_MODE, GL_ANY_SAMPLES_PASSED, GL_LAST_VERTEX_CONVENTION, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, GL_DEPTH_BUFFER_BIT,
GL_STENCIL_BACK_PASS_DEPTH_FAIL, GL_UNSIGNALED, GL_UNIFORM_BUFFER, GL_MAP_WRITE_BIT, GL_SHADE_MODEL,
GL_COMPRESSED_SLUMINANCE, GL_CCW, GL_RGB32I, GL_DEPTH_COMPONENT24, GL_INDEX_SHIFT,
GL_VERTEX_ATTRIB_ARRAY_INTEGER, GL_LIST_BIT, GL_ONE_MINUS_SRC1_COLOR, GL_STREAM_READ, GL_LINEAR,
GL_R32F, GL_VERTEX_ARRAY, GL_OR_REVERSE, GL_LUMINANCE12_ALPHA4, GL_LOGIC_OP,
GL_VERTEX_ARRAY_BUFFER_BINDING, GL_PIXEL_MAP_R_TO_R, GL_FOG_COORDINATE_SOURCE, GL_UNSIGNED_SHORT_5_6_5_REV, GL_TEXTURE_BORDER,
GL_GREATER, GL_MAX_GEOMETRY_UNIFORM_COMPONENTS, GL_VERTEX_ATTRIB_ARRAY_ENABLED, GL_MAX_TEXTURE_IMAGE_UNITS, GL_RGB32F,
GL_FLOAT_MAT2, GL_FLOAT_MAT3, GL_FRONT_FACE, GL_DEPTH, GL_REPLACE,
GL_VERTEX_ATTRIB_ARRAY_STRIDE, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, GL_OPERAND1_RGB, GL_RGBA32UI, GL_RG8I,
GL_RGBA8I, GL_TEXTURE_FILTER_CONTROL, GL_ACCUM_CLEAR_VALUE, GL_SRC1_ALPHA, GL_RG32F,
GL_R3_G3_B2, GL_ALPHA_BIAS, GL_RENDERBUFFER_BINDING, GL_TEXTURE_STACK_DEPTH, GL_TEXTURE_LUMINANCE_SIZE,
GL_TEXTURE_MIN_LOD, GL_FOG_COORDINATE_ARRAY, GL_BLEND, GL_FEEDBACK_BUFFER_TYPE, GL_MAP1_TEXTURE_COORD_3,
GL_R16UI, GL_MAP1_TEXTURE_COORD_1, GL_UNSIGNED_SHORT, GL_MIN, GL_MAP1_TEXTURE_COORD_4,
GL_COMPRESSED_SRGB_ALPHA, GL_ONE_MINUS_SRC_COLOR, GL_TEXTURE, GL_INTENSITY12, GL_MAX_PROJECTION_STACK_DEPTH,
GL_RGB_SCALE, GL_MAX_CLIP_DISTANCES, GL_PERSPECTIVE_CORRECTION_HINT, GL_LIST_MODE, GL_TIMESTAMP,
GL_ACTIVE_UNIFORMS, GL_VERTEX_PROGRAM_POINT_SIZE, GL_MAX_COLOR_ATTACHMENTS, GL_TEXTURE_BINDING_CUBE_MAP, GL_OPERAND2_RGB,
GL_R, GL_SRGB_ALPHA, GL_S, GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_PACK_SKIP_ROWS,
GL_T, GL_MAX_TEXTURE_UNITS, GL_SLUMINANCE8, GL_MAX_TEXTURE_BUFFER_SIZE, GL_MAP1_COLOR_4,
GL_GEOMETRY_SHADER, GL_R8I, GL_TEXTURE_MAX_LEVEL, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_BLEND_COLOR,
GL_ALPHA_BITS, GL_LINE_STIPPLE, GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, GL_ONE_MINUS_CONSTANT_ALPHA, GL_NEAREST_MIPMAP_LINEAR,
GL_ALPHA8, GL_BLEND_EQUATION, GL_SRC2_ALPHA, GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, GL_ALPHA4,
GL_MAX_GEOMETRY_OUTPUT_COMPONENTS, GL_FOG_END, GL_SAMPLER_1D, GL_LINE, GL_STENCIL_BITS,
GL_FOG_COORDINATE_ARRAY_TYPE, GL_SAMPLES_PASSED, GL_RENDERBUFFER_RED_SIZE, GL_COMPRESSED_SLUMINANCE_ALPHA, GL_BLUE_INTEGER,
GL_DYNAMIC_COPY, GL_CURRENT_FOG_COORD, GL_SYNC_FLAGS, GL_RG32I, GL_UNSIGNED_BYTE_2_3_3_REV,
GL_RENDERBUFFER_INTERNAL_FORMAT, GL_CLIENT_ACTIVE_TEXTURE, GL_TEXTURE_HEIGHT, GL_RGBA16I, GL_RGBA16F,
GL_OPERAND2_ALPHA, GL_SAMPLE_ALPHA_TO_COVERAGE, GL_FOG_DENSITY, GL_TEXTURE_FIXED_SAMPLE_LOCATIONS, GL_CONSTANT_ATTENUATION,
GL_RED, GL_DEPTH_BIAS, GL_EQUIV, GL_POLYGON_OFFSET_LINE, GL_FUNC_REVERSE_SUBTRACT,
GL_GREEN, GL_INVALID_OPERATION, GL_CLAMP_READ_COLOR, GL_RED_INTEGER, GL_TEXTURE_BINDING_BUFFER,
GL_COLOR_ATTACHMENT5, GL_COLOR_ATTACHMENT4, GL_MAP2_TEXTURE_COORD_2, GL_COLOR_ATTACHMENT6, GL_MAP2_TEXTURE_COORD_4,
GL_COLOR_ATTACHMENT0, GL_4_BYTES, GL_COLOR_ATTACHMENT2, GL_MAX_MODELVIEW_STACK_DEPTH, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS,
GL_COLOR_ATTACHMENT9, GL_COLOR_ATTACHMENT8, GL_PACK_IMAGE_HEIGHT, GL_PIXEL_MAP_B_TO_B_SIZE, GL_BUFFER_USAGE,
GL_CULL_FACE_MODE, GL_UNSIGNED_INT_8_8_8_8_REV, GL_BOOL, GL_MAX_COMBINED_UNIFORM_BLOCKS, GL_3D_COLOR,
GL_GREEN_INTEGER, GL_DST_COLOR, GL_T2F_V3F, GL_UNSIGNED_INT, GL_OPERAND0_ALPHA,
GL_ALWAYS, GL_NOOP, GL_V3F, GL_POINT_SPRITE_COORD_ORIGIN, GL_POINT_SIZE_RANGE,
GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, GL_LUMINANCE16, GL_GREEN_BIAS, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, GL_LUMINANCE12,
GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_SHADER_TYPE, GL_RG16_SNORM, GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, GL_COLOR_ARRAY_TYPE,
GL_QUERY_COUNTER_BITS, GL_MODULATE, GL_RG_INTEGER, GL_DRAW_BUFFER10, GL_FOG_COORD_ARRAY_BUFFER_BINDING,
GL_TEXTURE_LUMINANCE_TYPE, GL_RENDERBUFFER_HEIGHT, GL_RG16UI, GL_INTERLEAVED_ATTRIBS, GL_TEXTURE_ALPHA_TYPE,
GL_COLOR_ATTACHMENT29, GL_MAP2_TEXTURE_COORD_1, GL_DRAW_BUFFER14, GL_FOG_COORD_ARRAY_STRIDE, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS,
GL_MAP2_TEXTURE_COORD_3, GL_TEXTURE_BLUE_TYPE, GL_COLOR_ATTACHMENT1, GL_C4F_N3F_V3F, GL_COMBINE_RGB,
GL_STEREO, GL_ALREADY_SIGNALED, GL_T4F_V4F, GL_STREAM_COPY, GL_LIGHT_MODEL_LOCAL_VIEWER,
GL_SOURCE0_RGB, GL_EYE_PLANE, GL_TEXTURE_CUBE_MAP, GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
GL_CLIP_PLANE1, GL_CLIP_PLANE0, GL_CLIP_PLANE3, GL_CLIP_PLANE2, GL_CLIP_PLANE5,
GL_CLIP_PLANE4, GL_ORDER, GL_NORMAL_ARRAY_TYPE, GL_TEXTURE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER,
GL_LINE_STIPPLE_REPEAT, GL_POINTS, GL_LIGHTING_BIT, GL_SYNC_STATUS, GL_RENDERBUFFER_BLUE_SIZE,
GL_UNIFORM_NAME_LENGTH, GL_FASTEST, GL_LUMINANCE8, GL_LUMINANCE4, GL_POLYGON,
GL_NAND, GL_MAP1_INDEX, GL_LINE_WIDTH_GRANULARITY, GL_ADD_SIGNED, GL_MAX_3D_TEXTURE_SIZE,
GL_CLIENT_PIXEL_STORE_BIT, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, GL_DONT_CARE,
GL_POLYGON_BIT, GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING, GL_QUERY_WAIT, GL_MAP_FLUSH_EXPLICIT_BIT, GL_TEXTURE_COORD_ARRAY_SIZE,
GL_RED_SCALE, GL_SRGB8, GL_CURRENT_NORMAL, GL_COMPRESSED_SIGNED_RED_RGTC1, GL_FRAGMENT_DEPTH,
GL_UNIFORM_BLOCK_BINDING, GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, GL_SRC0_ALPHA, GL_LEQUAL, GL_PIXEL_MAP_A_TO_A_SIZE,
GL_TEXTURE_WIDTH, GL_ONE_MINUS_SRC1_ALPHA, GL_MAP_COLOR, GL_UNIFORM_SIZE, GL_POINT_SPRITE,
GL_FLOAT_MAT4x2, GL_SHADER_SOURCE_LENGTH, GL_DOT3_RGBA, GL_COMPRESSED_RG, GL_UNPACK_SWAP_BYTES,
GL_CURRENT_VERTEX_ATTRIB, GL_POLYGON_OFFSET_UNITS, GL_LUMINANCE6_ALPHA2, GL_MAX_COLOR_TEXTURE_SAMPLES, GL_COLOR_ATTACHMENT7,
GL_PRIMARY_COLOR, GL_C3F_V3F, GL_OUT_OF_MEMORY, GL_AUX_BUFFERS, GL_NORMAL_ARRAY_STRIDE,
GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_SMOOTH, GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, GL_GEOMETRY_OUTPUT_TYPE, GL_RASTERIZER_DISCARD,
GL_MAX_TEXTURE_LOD_BIAS, GL_CURRENT_TEXTURE_COORDS, GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GL_FRONT_RIGHT,
GL_EDGE_FLAG_ARRAY, GL_INT_SAMPLER_2D_MULTISAMPLE, GL_RETURN, GL_STENCIL_TEST, GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION,
GL_R11F_G11F_B10F, GL_LUMINANCE_ALPHA, GL_PIXEL_UNPACK_BUFFER_BINDING, GL_INVERT, GL_PROXY_TEXTURE_1D,
GL_COMPRESSED_INTENSITY, GL_TRANSFORM_FEEDBACK_VARYINGS, GL_DEPTH_COMPONENT32F, GL_TRIANGLE_FAN, GL_LIST_BASE,
GL_MAX_ELEMENTS_VERTICES, GL_CURRENT_COLOR, GL_INVALID_FRAMEBUFFER_OPERATION, GL_RGB12, GL_UNIFORM_BUFFER_SIZE,
GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING, GL_DEPTH32F_STENCIL8, GL_MAX_ARRAY_TEXTURE_LAYERS, GL_RED_BITS, GL_MAX_SERVER_WAIT_TIMEOUT,
GL_NOR, GL_FLAT, GL_PACK_ALIGNMENT, GL_PIXEL_MAP_S_TO_S, GL_UNPACK_LSB_FIRST,
GL_BGRA, GL_ACTIVE_UNIFORM_BLOCKS, GL_SOURCE1_RGB, GL_UNPACK_SKIP_IMAGES, GL_RGB16I,
GL_ACTIVE_TEXTURE, GL_TEXTURE_BASE_LEVEL, GL_RGB16F, GL_SMOOTH_LINE_WIDTH_RANGE, GL_ALPHA_INTEGER,
GL_GREEN_SCALE, GL_CLIP_DISTANCE7, GL_FOG_BIT, GL_TRANSPOSE_TEXTURE_MATRIX, GL_UNSIGNED_INT_SAMPLER_3D,
GL_SAMPLE_MASK, GL_INT_VEC4, GL_INT_VEC3, GL_INT_VEC2, GL_STENCIL_FAIL,
GL_CURRENT_FOG_COORDINATE, GL_CONDITION_SATISFIED, GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, GL_FRAMEBUFFER_UNSUPPORTED, GL_RED_BIAS,
GL_DST_ALPHA, GL_SECONDARY_COLOR_ARRAY_POINTER, GL_R8, GL_RENDER_MODE, GL_EDGE_FLAG_ARRAY_BUFFER_BINDING,
GL_MAX_CUBE_MAP_TEXTURE_SIZE, GL_TEXTURE_1D_ARRAY, GL_RENDERBUFFER_WIDTH, GL_READ_FRAMEBUFFER_BINDING, GL_FRAMEBUFFER_ATTACHMENT_LAYERED,
GL_TEXTURE_BLUE_SIZE, GL_COORD_REPLACE, GL_RGBA2, GL_RGBA4, GL_MULTISAMPLE_BIT,
GL_FOG_COLOR, GL_DRAW_BUFFER11, GL_DRAW_BUFFER12, GL_DRAW_BUFFER13, GL_UNSIGNED_INT_10_10_10_2,
GL_DRAW_BUFFER15, GL_INFO_LOG_LENGTH, GL_R16F, GL_RENDERBUFFER_STENCIL_SIZE, GL_CONSTANT_ALPHA,
GL_RESCALE_NORMAL, GL_R16I, GL_POINT_SIZE_GRANULARITY, GL_STATIC_READ, GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER,
GL_COMPARE_R_TO_TEXTURE, GL_PREVIOUS, GL_MAP_READ_BIT, GL_SPOT_DIRECTION, GL_DEPTH_SCALE,
GL_STENCIL, GL_SAMPLE_MASK_VALUE, GL_LINE_BIT, GL_DIFFUSE, GL_MAX_RENDERBUFFER_SIZE,
GL_T2F_N3F_V3F, GL_TRANSFORM_BIT, GL_COLOR_ATTACHMENT30, GL_STENCIL_PASS_DEPTH_PASS, GL_INCR_WRAP,
GL_SOURCE2_RGB, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_R, GL_TEXTURE_GEN_Q,
GL_RENDERBUFFER_ALPHA_SIZE, GL_ALPHA12, GL_LIGHT_MODEL_TWO_SIDE, GL_ALPHA16, GL_DECR_WRAP,
GL_POLYGON_SMOOTH, GL_COMPILE, GL_SAMPLE_POSITION, GL_TRANSPOSE_MODELVIEW_MATRIX, GL_INCR,
GL_POINT_SIZE_MIN, GL_MAX_RECTANGLE_TEXTURE_SIZE, GL_RGBA12, GL_GENERATE_MIPMAP_HINT, GL_ALPHA_TEST_REF,
GL_RGBA16, GL_UNPACK_SKIP_ROWS, GL_MAP1_NORMAL, GL_SOURCE2_ALPHA, GL_DEPTH_CLAMP,
GL_POLYGON_STIPPLE_BIT, GL_BLEND_DST_ALPHA, GL_INT_SAMPLER_CUBE, GL_CURRENT_QUERY, GL_RGB5_A1,
GL_EXP2, GL_UNPACK_SKIP_PIXELS, GL_RGB16UI, GL_COPY_INVERTED, GL_TEXTURE_PRIORITY,
GL_MAX_GEOMETRY_INPUT_COMPONENTS, GL_LOWER_LEFT, GL_FOG_HINT, GL_TEXTURE_BINDING_1D, GL_PROJECTION_MATRIX,
GL_AUX0, GL_PIXEL_UNPACK_BUFFER, GL_LINEAR_MIPMAP_NEAREST, GL_POINT_DISTANCE_ATTENUATION, GL_TEXTURE_BUFFER_DATA_STORE_BINDING,
GL_RGB10_A2, GL_AMBIENT_AND_DIFFUSE, GL_ZERO, GL_ELEMENT_ARRAY_BUFFER, GL_CONTEXT_CORE_PROFILE_BIT,
GL_SCISSOR_BIT, GL_READ_ONLY, GL_MAX_FRAGMENT_INPUT_COMPONENTS, GL_MAP1_GRID_DOMAIN, GL_PIXEL_MAP_I_TO_A_SIZE,
GL_UNSIGNED_NORMALIZED, GL_SMOOTH_POINT_SIZE_GRANULARITY, GL_CLAMP_VERTEX_COLOR, GL_MAP2_INDEX, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
GL_PIXEL_MAP_I_TO_R_SIZE, GL_NOTEQUAL, GL_TEXTURE_COORD_ARRAY, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_MAP2_GRID_DOMAIN,
GL_COMPRESSED_RED, GL_INT_SAMPLER_1D_ARRAY, GL_DRAW_PIXEL_TOKEN, GL_MAX_LIGHTS, GL_RGBA16_SNORM,
GL_OBJECT_LINEAR, GL_LIST_INDEX, GL_TEXTURE_BORDER_COLOR, GL_LUMINANCE16_ALPHA16, GL_TEXTURE_SHARED_SIZE,
GL_COMPILE_STATUS, GL_LOGIC_OP_MODE, GL_LUMINANCE8_ALPHA8, GL_RENDERBUFFER_DEPTH_SIZE, GL_MAX_FRAGMENT_UNIFORM_BLOCKS,
GL_SLUMINANCE_ALPHA, GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, GL_FEEDBACK_BUFFER_POINTER, GL_SPOT_EXPONENT, GL_SHORT,
GL_BLUE, GL_CW, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_BYTE, GL_MAX_VERTEX_UNIFORM_COMPONENTS,
GL_QUADS, GL_DEPTH_TEXTURE_MODE, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_R16, GL_PIXEL_PACK_BUFFER,
GL_PACK_LSB_FIRST, GL_RENDERBUFFER, GL_UNSIGNED_BYTE_3_3_2, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, GL_RGB8I,
GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, GL_DRAW_BUFFER, GL_STENCIL_INDEX1, GL_STENCIL_INDEX4, GL_SAMPLER_3D,
GL_TEXTURE_GREEN_TYPE, GL_STENCIL_INDEX8, GL_DEPTH_BITS, GL_OR_INVERTED, GL_RGB8UI,
GL_STENCIL_INDEX16, GL_STENCIL_BACK_REF, GL_SELECT, GL_INTENSITY4, GL_BLEND_DST_RGB,
GL_INTENSITY8, GL_LIGHT5, GL_LINE_RESET_TOKEN, GL_MAP1_VERTEX_3, GL_TEXTURE_BINDING_2D_ARRAY,
GL_VERTEX_ATTRIB_ARRAY_DIVISOR, GL_CLEAR, GL_DRAW_BUFFER8, GL_CURRENT_RASTER_POSITION_VALID, GL_FOG_COORD_SRC,
GL_DRAW_BUFFER9, GL_SRC0_RGB, GL_PIXEL_PACK_BUFFER_BINDING, GL_DECAL, GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
GL_2D, GL_SELECTION_BUFFER_POINTER, GL_SELECTION_BUFFER_SIZE, GL_SAMPLES, GL_UNSIGNED_INT_VEC2,
GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT_VEC4, GL_UNSIGNED_SHORT_5_6_5, GL_CURRENT_RASTER_POSITION, GL_VERTEX_ATTRIB_ARRAY_SIZE,
GL_VERTEX_SHADER, GL_RGBA_MODE, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4,
GL_COEFF, GL_RGB32UI, GL_BUFFER_MAP_OFFSET, GL_MIN_PROGRAM_TEXEL_OFFSET, GL_PROXY_TEXTURE_RECTANGLE,
GL_UNSIGNED_INT_SAMPLER_BUFFER, GL_UNIFORM_BUFFER_START, GL_MAX_TEXTURE_STACK_DEPTH, GL_UNSIGNED_INT_SAMPLER_2D, GL_TEXTURE8,
GL_INT_SAMPLER_2D_RECT, GL_TEXTURE_COORD_ARRAY_STRIDE, GL_TEXTURE4, GL_TEXTURE5, GL_TEXTURE6,
GL_TEXTURE7, GL_TEXTURE0, GL_CONTEXT_PROFILE_MASK, GL_TEXTURE2, GL_TEXTURE3,
GL_BOOL_VEC4, GL_DOUBLE, GL_RG8_SNORM, GL_BOOL_VEC3, GL_BOOL_VEC2,
GL_COLOR_MATERIAL_PARAMETER, GL_DOT3_RGB, GL_ONE, GL_SRC_ALPHA_SATURATE, GL_MAX_SAMPLES,
GL_UNPACK_IMAGE_HEIGHT, GL_TRIANGLE_STRIP, GL_N3F_V3F, GL_CONTEXT_FLAGS, GL_FRONT_LEFT,
GL_CLAMP, GL_POINT_SMOOTH_HINT, GL_INDEX_OFFSET, GL_INTENSITY, GL_POINT_SIZE_MAX,
GL_MODELVIEW_MATRIX, GL_VERTEX_ARRAY_BINDING, GL_INDEX_BITS, GL_TIMEOUT_EXPIRED, GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,
GL_STENCIL_FUNC, GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING, GL_TEXTURE_ENV, GL_ALIASED_LINE_WIDTH_RANGE, GL_DECR,
GL_BACK, GL_VIEWPORT_BIT, GL_INT, GL_CLIP_DISTANCE1, GL_CLIP_DISTANCE0,
GL_CLIP_DISTANCE3, GL_CLIP_DISTANCE2, GL_CLIP_DISTANCE5, GL_CLIP_DISTANCE4, GL_MINOR_VERSION,
GL_PIXEL_MAP_G_TO_G_SIZE, GL_FRONT_AND_BACK, GL_POINT, GL_COMPRESSED_RG_RGTC2, GL_POLYGON_TOKEN,
GL_SMOOTH_LINE_WIDTH_GRANULARITY, GL_SRGB, GL_NORMAL_ARRAY_POINTER, GL_SYNC_FENCE, GL_ONE_MINUS_CONSTANT_COLOR,
GL_UNSIGNED_INT_8_8_8_8, GL_RGB8_SNORM, GL_TEXTURE_ALPHA_SIZE, GL_UNSIGNED_INT_SAMPLER_2D_RECT, GL_CONSTANT_COLOR,
GL_UNSIGNED_SHORT_4_4_4_4, GL_NO_ERROR, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, GL_BLEND_SRC_ALPHA, GL_CURRENT_SECONDARY_COLOR,
GL_RGBA16UI, GL_AND_REVERSE, GL_MAX_INTEGER_SAMPLES, GL_CLAMP_FRAGMENT_COLOR, GL_QUERY_RESULT_AVAILABLE,
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, GL_MAX_DRAW_BUFFERS, GL_ONE_MINUS_DST_ALPHA, GL_FOG_MODE, GL_R32UI,
GL_RGBA8_SNORM, GL_C4UB_V2F, GL_INT_SAMPLER_3D, GL_CURRENT_INDEX, GL_AND,
GL_INDEX_MODE, GL_ACCUM_GREEN_BITS, GL_MAJOR_VERSION, GL_STATIC_COPY, GL_REFLECTION_MAP,
GL_BGR_INTEGER, GL_3_BYTES, GL_UNIFORM_BUFFER_BINDING, GL_UNIFORM_TYPE, GL_DELETE_STATUS,
GL_POINT_BIT, GL_SYNC_GPU_COMMANDS_COMPLETE, GL_SMOOTH_POINT_SIZE_RANGE, GL_ALIASED_POINT_SIZE_RANGE, GL_3D,
GL_MAP_INVALIDATE_BUFFER_BIT, GL_UNSIGNED_INT_5_9_9_9_REV, GL_DEPTH_TEST, GL_BUFFER_MAP_LENGTH, GL_VERTEX_ATTRIB_ARRAY_POINTER,
GL_MULTISAMPLE, GL_MAX_GEOMETRY_OUTPUT_VERTICES, GL_TEXTURE_RED_TYPE, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_FUNC_SUBTRACT,
GL_VERTEX_PROGRAM_TWO_SIDE, GL_SAMPLER_BUFFER, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, GL_TEXTURE_COORD_ARRAY_TYPE, GL_CLAMP_TO_BORDER,
GL_COLOR_ATTACHMENT15, GL_COLOR_ATTACHMENT14, GL_COLOR_ATTACHMENT17, GL_DEPTH_RANGE, GL_COLOR_ATTACHMENT11,
GL_COLOR_ATTACHMENT10, GL_COLOR_ATTACHMENT13, GL_COLOR_ATTACHMENT12, GL_NEAREST, GL_COMPRESSED_TEXTURE_FORMATS,
GL_COLOR_ATTACHMENT19, GL_COLOR_ATTACHMENT18, GL_RENDERBUFFER_GREEN_SIZE, GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, GL_PIXEL_MAP_S_TO_S_SIZE,
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, GL_RGBA8, GL_T2F_C3F_V3F, GL_SAMPLER_2D_RECT_SHADOW, GL_ALL_ATTRIB_BITS,
GL_POINT_TOKEN, GL_T4F_C4F_N3F_V4F, GL_TEXTURE30, GL_TEXTURE31, GL_UNSIGNED_INT_SAMPLER_1D,
GL_POINT_SMOOTH, GL_DEPTH_CLEAR_VALUE, GL_GEOMETRY_INPUT_TYPE, GL_BACK_LEFT, GL_TEXTURE_ENV_COLOR,
GL_BUFFER_MAP_POINTER, GL_LINE_SMOOTH, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_STENCIL_REF, GL_CURRENT_BIT,
GL_FOG_COORDINATE, GL_COPY_WRITE_BUFFER, GL_MAX_VARYING_FLOATS, GL_PRIMITIVE_RESTART_INDEX, GL_OPERAND0_RGB,
GL_LIGHT_MODEL_COLOR_CONTROL, GL_FEEDBACK, GL_ONE_MINUS_DST_COLOR, GL_MAX_ATTRIB_STACK_DEPTH, GL_FOG_COORD_ARRAY_TYPE,
GL_PROXY_TEXTURE_1D_ARRAY, GL_ACCUM_ALPHA_BITS, GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B, GL_PIXEL_MAP_I_TO_A,
GL_COLOR_BUFFER_BIT, GL_PIXEL_MAP_I_TO_I, GL_SPOT_CUTOFF, GL_PIXEL_MAP_I_TO_R, GL_LINEAR_ATTENUATION,
GL_SAMPLER_2D, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, GL_NEAREST_MIPMAP_NEAREST, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, GL_EDGE_FLAG_ARRAY_STRIDE,
GL_TEXTURE_MAG_FILTER, GL_COLOR_MATERIAL_FACE, GL_CONTEXT_COMPATIBILITY_PROFILE_BIT, GL_SINGLE_COLOR, GL_R32I,
GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY, GL_SAMPLER_CUBE, GL_INT_2_10_10_10_REV, GL_SAMPLER_CUBE_SHADOW, GL_LEFT,
GL_AND_INVERTED, GL_ACCUM_BLUE_BITS, GL_FRAMEBUFFER_SRGB, GL_SECONDARY_COLOR_ARRAY_TYPE, GL_POLYGON_OFFSET_POINT,
GL_BGR, GL_MAX_TEXTURE_SIZE, GL_COMBINE_ALPHA, GL_RIGHT, GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,
GL_ARRAY_BUFFER, GL_COMPRESSED_ALPHA, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT16, GL_MAX_SAMPLE_MASK_WORDS,
GL_TEXTURE_COMPRESSED_IMAGE_SIZE, GL_TEXTURE_RED_SIZE, GL_TEXTURE_1D, GL_MAX_VARYING_COMPONENTS, GL_NAME_STACK_DEPTH,
GL_BLEND_SRC_RGB, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, GL_BGRA_INTEGER, GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, GL_FALSE,
GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, GL_ONE_MINUS_SRC_ALPHA, GL_SAMPLE_ALPHA_TO_ONE, GL_WEIGHT_ARRAY_BUFFER_BINDING, GL_COLOR_ATTACHMENT3,
GL_PIXEL_MAP_I_TO_G_SIZE, GL_MAP2_GRID_SEGMENTS, GL_PROGRAM_POINT_SIZE, GL_COLOR_ATTACHMENT16, GL_MAX_VIEWPORT_DIMS,
GL_DEPTH_ATTACHMENT, GL_INT_SAMPLER_2D, GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, GL_STENCIL_PASS_DEPTH_FAIL, GL_PIXEL_MAP_A_TO_A,
GL_TEXTURE_COORD_ARRAY_POINTER, GL_MAP1_GRID_SEGMENTS, GL_MAX_GEOMETRY_UNIFORM_BLOCKS, GL_ATTRIB_STACK_DEPTH, GL_LINE_WIDTH,
GL_FEEDBACK_BUFFER_SIZE, GL_BLUE_BIAS, GL_FIXED_ONLY, GL_NONE, GL_FRAMEBUFFER_DEFAULT,
GL_POLYGON_MODE, GL_HALF_FLOAT, GL_UNIFORM_BLOCK_NAME_LENGTH, GL_V2F, GL_TEXTURE_BINDING_RECTANGLE,
GL_LINE_SMOOTH_HINT, GL_CLAMP_TO_EDGE, GL_FRONT, GL_SCISSOR_BOX, GL_UNIFORM_BLOCK_DATA_SIZE,
GL_AMBIENT, GL_NUM_EXTENSIONS, GL_UNIFORM_IS_ROW_MAJOR, GL_MAX_UNIFORM_BLOCK_SIZE, GL_INDEX_ARRAY,
GL_FRAMEBUFFER_BINDING, GL_NORMAL_ARRAY_BUFFER_BINDING, GL_ALPHA, GL_SET, GL_COLOR_WRITEMASK,
GL_DEPTH_FUNC, GL_TEXTURE_WRAP_R, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_TEXTURE9,
GL_INVALID_ENUM, GL_EVAL_BIT, GL_INT_SAMPLER_2D_ARRAY, GL_COMPRESSED_RGB, GL_LIGHT_MODEL_AMBIENT,
GL_DEPTH_COMPONENT, GL_SRC1_COLOR, GL_FOG_START, GL_WAIT_FAILED, GL_COMPARE_REF_TO_TEXTURE,
GL_PROJECTION_STACK_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, GL_TRUE, GL_TEXTURE_MIN_FILTER, GL_FLOAT_MAT4,
GL_BLUE_BITS, GL_STACK_UNDERFLOW, GL_AUX1, GL_TEXTURE_SWIZZLE_R, GL_AUX3,
GL_AUX2, GL_PACK_SWAP_BYTES, GL_FIRST_VERTEX_CONVENTION, GL_EQUAL, GL_TEXTURE_SWIZZLE_G,
GL_DEPTH_STENCIL_ATTACHMENT, GL_TRIANGLE_STRIP_ADJACENCY, GL_ADD, GL_TEXTURE_BINDING_1D_ARRAY, GL_TEXTURE_SWIZZLE_B,
GL_TEXTURE_SWIZZLE_A, GL_FUNC_ADD, GL_MODELVIEW_STACK_DEPTH, GL_FLOAT_MAT4x3, GL_POINT_FADE_THRESHOLD_SIZE,
GL_INT_SAMPLER_BUFFER, GL_UNPACK_ALIGNMENT, GL_LINE_STRIP, GL_PACK_ROW_LENGTH, GL_COLOR_MATERIAL,
GL_MAX_PIXEL_MAP_TABLE, GL_COLOR, GL_POLYGON_STIPPLE, GL_BITMAP, GL_DYNAMIC_READ,
GL_COMPRESSED_LUMINANCE, GL_LUMINANCE12_ALPHA12, GL_DEPTH_STENCIL, GL_RG8UI, GL_MAX_VERTEX_OUTPUT_COMPONENTS,
GL_KEEP, GL_TEXTURE_INTENSITY_SIZE, GL_PROXY_TEXTURE_2D, GL_SYNC_CONDITION, GL_ACTIVE_UNIFORM_MAX_LENGTH,
GL_OR, GL_MAP_INVALIDATE_RANGE_BIT, GL_TEXTURE23, GL_TEXTURE22, GL_TEXTURE21,
GL_TEXTURE20, GL_TEXTURE27, GL_TEXTURE26, GL_TEXTURE25, GL_TEXTURE24,
GL_R8_SNORM, GL_TEXTURE29, GL_TEXTURE28, GL_SAMPLER_1D_ARRAY, GL_ELEMENT_ARRAY_BUFFER_BINDING,
GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER, GL_TRIANGLES_ADJACENCY, GL_PIXEL_MODE_BIT, GL_LINE_LOOP, GL_ALPHA_SCALE,
GL_READ_BUFFER, GL_PACK_SKIP_PIXELS, GL_BACK_RIGHT, GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, GL_SUBPIXEL_BITS,
GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS, GL_GEQUAL, GL_ALPHA_TEST, GL_SLUMINANCE8_ALPHA8, GL_SAMPLER_2D_MULTISAMPLE,
GL_LUMINANCE4_ALPHA4, GL_RGBA8UI, GL_UNIFORM_OFFSET, GL_TEXTURE1, GL_OBJECT_PLANE,
GL_UNSIGNED_INT_SAMPLER_CUBE, GL_SUBTRACT, GL_TIME_ELAPSED, GL_SECONDARY_COLOR_ARRAY_SIZE, GL_COMPRESSED_RED_RGTC1,
GL_READ_WRITE, GL_BUFFER_ACCESS, GL_LINES_ADJACENCY, GL_ARRAY_BUFFER_BINDING, GL_INDEX_WRITEMASK,
GL_TEXTURE_2D, GL_VERTEX_ARRAY_STRIDE, GL_DYNAMIC_DRAW, GL_4D_COLOR_TEXTURE, GL_NICEST,
GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, GL_UNPACK_ROW_LENGTH, GL_CURRENT_PROGRAM, GL_BUFFER_MAPPED, GL_EYE_LINEAR,
GL_STREAM_DRAW, GL_POLYGON_SMOOTH_HINT, GL_INDEX, GL_MAX_UNIFORM_BUFFER_BINDINGS, GL_SIGNALED,
GL_FRAMEBUFFER, GL_SPECULAR, GL_TEXTURE_BINDING_2D, GL_GENERATE_MIPMAP, GL_DOMAIN,
GL_COLOR_ARRAY_SIZE, GL_STENCIL_BACK_FAIL, GL_POLYGON_OFFSET_FACTOR, GL_R8UI, GL_SYNC_FLUSH_COMMANDS_BIT,
GL_DRAW_FRAMEBUFFER_BINDING, GL_STATIC_DRAW, GL_MODELVIEW, GL_PIXEL_MAP_I_TO_B_SIZE, GL_TRIANGLES,
GL_SAMPLER_2D_ARRAY_SHADOW, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, GL_UNIFORM_MATRIX_STRIDE, GL_MAX_DEPTH_TEXTURE_SAMPLES, GL_QUERY_BY_REGION_WAIT,
GL_TEXTURE_RESIDENT, GL_SLUMINANCE, GL_SRGB8_ALPHA8, GL_FOG, GL_FOG_COORD,
GL_SAMPLER_2D_ARRAY, GL_POSITION, GL_RENDERER, GL_MIRRORED_REPEAT, GL_RG,
GL_PIXEL_MAP_B_TO_B, GL_LINE_STIPPLE_PATTERN, GL_STENCIL_BACK_FUNC, GL_PIXEL_MAP_R_TO_R_SIZE, GL_MAP1_TEXTURE_COORD_2,
GL_TEXTURE_BINDING_3D, GL_COLOR_LOGIC_OP, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, GL_UNIFORM_BLOCK_INDEX, GL_ENABLE_BIT,
GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, GL_MAX_VERTEX_ATTRIBS, GL_SPHERE_MAP, GL_CONSTANT, GL_LINE_WIDTH_RANGE,
GL_XOR, GL_PROJECTION, GL_LESS, GL_COPY_PIXEL_TOKEN, GL_FRAMEBUFFER_UNDEFINED,
GL_2_BYTES, GL_TEXTURE_STENCIL_SIZE, GL_CURRENT_RASTER_INDEX, GL_EMISSION, GL_COMPRESSED_SRGB,
GL_TEXTURE_DEPTH_TYPE, GL_TEXTURE_ENV_MODE, GL_COMPRESSED_LUMINANCE_ALPHA, GL_INT_SAMPLER_1D, GL_CURRENT_RASTER_COLOR,
GL_PROXY_TEXTURE_2D_ARRAY, GL_QUAD_STRIP, GL_REPEAT, GL_ACCUM, GL_T2F_C4F_N3F_V3F,
GL_TEXTURE_INTENSITY_TYPE, GL_INTENSITY16, GL_VERTEX_ARRAY_TYPE, GL_VERTEX_ARRAY_SIZE, GL_TEXTURE_GREEN_SIZE,
GL_CLIENT_ALL_ATTRIB_BITS, GL_VALIDATE_STATUS, GL_RG16, GL_LIGHT7, GL_STENCIL_BACK_VALUE_MASK,
GL_SCISSOR_TEST, GL_STENCIL_BUFFER_BIT, GL_TEXTURE_2D_MULTISAMPLE, GL_SAMPLER_1D_ARRAY_SHADOW, GL_SRC1_RGB,
GL_BLEND_EQUATION_ALPHA, GL_ACTIVE_ATTRIBUTES, GL_COLOR_ATTACHMENT31, GL_LIGHTING, GL_CURRENT_RASTER_DISTANCE,
GL_VERTEX_ARRAY_POINTER, GL_ATTACHED_SHADERS, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_QUERY_BY_REGION_NO_WAIT, GL_SAMPLE_COVERAGE_INVERT,
GL_LINES, GL_TEXTURE18, GL_TEXTURE19, GL_TEXTURE16, GL_TEXTURE17,
GL_TEXTURE14, GL_TEXTURE15, GL_TEXTURE12, GL_TEXTURE13, GL_TEXTURE10,
GL_TEXTURE11, GL_RGB, GL_SEPARATE_SPECULAR_COLOR, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, GL_TRANSFORM_FEEDBACK_BUFFER_START,
GL_MAX_PROGRAM_TEXEL_OFFSET, GL_STACK_OVERFLOW, GL_MAP1_VERTEX_4, GL_TEXTURE_COMPRESSION_HINT, GL_RGBA32F,
GL_RGBA32I, GL_COLOR_ARRAY_BUFFER_BINDING, GL_VERTEX_ATTRIB_ARRAY_TYPE, GL_TRANSPOSE_COLOR_MATRIX, GL_STENCIL_WRITEMASK,
GL_RG8, GL_FOG_COORDINATE_ARRAY_POINTER, GL_STENCIL_BACK_PASS_DEPTH_PASS, GL_INVALID_VALUE, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE,
GL_VERSION, GL_MAP_UNSYNCHRONIZED_BIT, GL_PRIMITIVE_RESTART, GL_COLOR_ARRAY_STRIDE, GL_MAX_ELEMENTS_INDICES,
GL_SRC_ALPHA, GL_TEXTURE_3D, GL_GEOMETRY_VERTICES_OUT, GL_RGB8, GL_INDEX_ARRAY_POINTER,
GL_MATRIX_MODE, GL_UNIFORM_ARRAY_STRIDE, GL_TEXTURE_SAMPLES, GL_RGB4, GL_RGB5,
GL_CULL_FACE, GL_PIXEL_MAP_I_TO_I_SIZE, GL_SAMPLE_COVERAGE_VALUE, GL_PROXY_TEXTURE_CUBE_MAP, GL_SECONDARY_COLOR_ARRAY_STRIDE,
GL_COMPRESSED_SIGNED_RG_RGTC2, GL_COLOR_INDEXES, GL_RG32UI, GL_OPERAND1_ALPHA, GL_NORMALIZE,
GL_NEVER, GL_STENCIL_VALUE_MASK, GL_BLEND_DST, GL_STENCIL_BACK_WRITEMASK, GL_BLUE_SCALE,
GL_TEXTURE_INTERNAL_FORMAT, GL_LOAD, GL_FRAMEBUFFER_COMPLETE, GL_COPY_READ_BUFFER, GL_INDEX_ARRAY_STRIDE,
GL_FOG_COORD_ARRAY_POINTER, GL_MAP2_VERTEX_3, GL_TEXTURE_SWIZZLE_RGBA, GL_DEPTH_COMPONENT32, GL_RGBA,
GL_READ_FRAMEBUFFER, GL_NORMAL_ARRAY, GL_COLOR_SUM, GL_BLEND_EQUATION_RGB, GL_MAP2_COLOR_4,
GL_VENDOR, GL_TEXTURE_2D_ARRAY, GL_ACCUM_BUFFER_BIT, GL_EDGE_FLAG, GL_OBJECT_TYPE,
GL_C4UB_V3F, GL_INTERPOLATE, GL_BUFFER_ACCESS_FLAGS, GL_LINK_STATUS, GL_PACK_SKIP_IMAGES,
GL_FLOAT_MAT2x3, GL_COMBINE, GL_FLOAT_MAT2x4, GL_Q, GL_SECONDARY_COLOR_ARRAY,
GL_INDEX_LOGIC_OP, GL_SEPARATE_ATTRIBS, GL_PRIMITIVES_GENERATED, GL_MAX, GL_LUMINANCE,
GL_INVALID_INDEX, GL_MAP2_VERTEX_4, GL_AUTO_NORMAL, GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, GL_CURRENT_RASTER_SECONDARY_COLOR,
GL_SAMPLER_1D_SHADOW, GL_ACCUM_RED_BITS, GL_SAMPLER_2D_SHADOW, GL_TEXTURE_MATRIX, GL_TRANSPOSE_PROJECTION_MATRIX,
GL_CLIP_DISTANCE6, GL_RG16F, GL_MAX_NAME_STACK_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, GL_TEXTURE_BIT,
GL_RG16I, GL_WRITE_ONLY, GL_STENCIL_ATTACHMENT, GL_CLIENT_VERTEX_ARRAY_BIT, GL_SAMPLE_COVERAGE,
GL_INDEX_ARRAY_BUFFER_BINDING, GL_SHININESS, GL_DRAW_FRAMEBUFFER, GL_TEXTURE_LOD_BIAS, GL_RGB10_A2UI
;

183
demos/external/sources/glad/gl/gles2.d vendored Normal file
View file

@ -0,0 +1,183 @@
module glad.gl.gles2;
public import glad.gl.types;
public import glad.gl.funcs :
glUniformMatrix2fv, glBeginTransformFeedback, glFlush, glGetRenderbufferParameteriv, glClearColor,
glClearBufferiv, glStencilMaskSeparate, glGetVertexAttribPointerv, glLinkProgram, glBindTexture,
glGetStringi, glFenceSync, glUniform3ui, glFramebufferRenderbuffer, glGetString,
glCompressedTexSubImage3D, glDetachShader, glVertexAttribI4uiv, glEndQuery, glBindSampler,
glLineWidth, glUniform2fv, glGetIntegeri_v, glCompileShader, glGetTransformFeedbackVarying,
glDeleteTextures, glStencilOpSeparate, glStencilFuncSeparate, glBindBufferRange, glVertexAttrib4f,
glUniform2f, glRenderbufferStorage, glDeleteShader, glGetBufferParameteri64v, glDepthRangef,
glUniform4iv, glGetTexParameteriv, glClearStencil, glUniformMatrix2x3fv, glGetUniformiv,
glGenTransformFeedbacks, glGetVertexAttribIuiv, glSampleCoverage, glSamplerParameteri, glGenTextures,
glSamplerParameterf, glDepthFunc, glCompressedTexSubImage2D, glUniform1f, glGetVertexAttribfv,
glProgramBinary, glGetTexParameterfv, glCreateShader, glIsBuffer, glUniform1i,
glGenRenderbuffers, glCopyTexSubImage2D, glCompressedTexImage2D, glDisable, glUniform2i,
glBlendFuncSeparate, glGetProgramiv, glColorMask, glHint, glFramebufferTextureLayer,
glBlendEquation, glGetUniformLocation, glBindFramebuffer, glEndTransformFeedback, glCullFace,
glUniformMatrix3x2fv, glTexStorage2D, glUniform4fv, glGetInternalformativ, glDeleteProgram,
glIsSampler, glVertexAttribDivisor, glGenQueries, glWaitSync, glAttachShader,
glUniformMatrix4x3fv, glUniform3i, glClearBufferfv, glDeleteTransformFeedbacks, glShaderBinary,
glCheckFramebufferStatus, glTexSubImage3D, glGetInteger64i_v, glDeleteSamplers, glCopyTexImage2D,
glUniform3f, glBlitFramebuffer, glBindAttribLocation, glUniformMatrix4x2fv, glBlendEquationSeparate,
glDrawElements, glGetShaderSource, glUniform2iv, glGetQueryObjectuiv, glGenVertexArrays,
glBindBufferBase, glBufferSubData, glUniform1iv, glGetBufferParameteriv, glMapBufferRange,
glReadBuffer, glTexStorage3D, glClientWaitSync, glDrawArraysInstanced, glViewport,
glGenerateMipmap, glGetShaderiv, glUniformMatrix3x4fv, glUniform2ui, glVertexAttrib3f,
glGetActiveAttrib, glBlendColor, glGetShaderPrecisionFormat, glResumeTransformFeedback, glUnmapBuffer,
glGetUniformfv, glDisableVertexAttribArray, glShaderSource, glBindRenderbuffer, glDeleteRenderbuffers,
glIsSync, glReleaseShaderCompiler, glDeleteFramebuffers, glDrawArrays, glUniform1ui,
glIsProgram, glTexSubImage2D, glGetSynciv, glVertexAttrib1fv, glClear,
glVertexAttrib4fv, glProgramParameteri, glIsTransformFeedback, glUniform4i, glActiveTexture,
glEnableVertexAttribArray, glDrawRangeElements, glBindBuffer, glIsEnabled, glStencilOp,
glReadPixels, glStencilMask, glUniform4f, glFramebufferTexture2D, glGetFramebufferAttachmentParameteriv,
glUniformMatrix2x4fv, glUniform3fv, glBufferData, glCompressedTexImage3D, glDeleteSync,
glPauseTransformFeedback, glGetError, glGetActiveUniformBlockName, glGetVertexAttribiv, glTexParameteriv,
glGetProgramBinary, glVertexAttrib3fv, glGetFloatv, glUniform3iv, glVertexAttrib2fv,
glGetShaderInfoLog, glGenFramebuffers, glDrawBuffers, glGetActiveUniformBlockiv, glStencilFunc,
glGetIntegerv, glGetAttachedShaders, glUniformBlockBinding, glIsRenderbuffer, glGetBufferPointerv,
glDeleteVertexArrays, glIsShader, glRenderbufferStorageMultisample, glUniform4uiv, glIsQuery,
glIsVertexArray, glUseProgram, glVertexAttribI4iv, glGetQueryiv, glTexImage2D,
glGetProgramInfoLog, glGetSamplerParameterfv, glBindTransformFeedback, glUniform4ui, glSamplerParameterfv,
glClearBufferuiv, glBindVertexArray, glIsTexture, glGetUniformIndices, glUniform1fv,
glGetInteger64v, glVertexAttribPointer, glTexParameterfv, glInvalidateSubFramebuffer, glUniformMatrix3fv,
glScissor, glEnable, glGetActiveUniformsiv, glVertexAttribI4i, glVertexAttribI4ui,
glGetFragDataLocation, glUniform2uiv, glGenBuffers, glFinish, glGetAttribLocation,
glBeginQuery, glVertexAttribIPointer, glBlendFunc, glCreateProgram, glTexImage3D,
glGenSamplers, glGetSamplerParameteriv, glIsFramebuffer, glFlushMappedBufferRange, glUniformMatrix4fv,
glCopyBufferSubData, glInvalidateFramebuffer, glUniform1uiv, glTransformFeedbackVaryings, glVertexAttrib2f,
glVertexAttrib1f, glCopyTexSubImage3D, glDepthMask, glGetUniformuiv, glGetUniformBlockIndex,
glGetVertexAttribIiv, glGetActiveUniform, glTexParameterf, glClearBufferfi, glTexParameteri,
glFrontFace, glClearDepthf, glDeleteBuffers, glSamplerParameteriv, glDrawElementsInstanced,
glGetBooleanv, glPixelStorei, glValidateProgram, glPolygonOffset, glDeleteQueries,
glUniform3uiv;
public import glad.gl.enums :
GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, GL_UNSIGNED_INT_VEC2, GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT_VEC4, GL_UNSIGNED_SHORT_5_6_5,
GL_VERTEX_ATTRIB_ARRAY_SIZE, GL_DEPTH_ATTACHMENT, GL_DITHER, GL_TRANSFORM_FEEDBACK_PAUSED, GL_RGB16UI,
GL_QUERY_RESULT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4,
GL_FLOAT, GL_RGB32UI, GL_TEXTURE_MAX_LOD, GL_BUFFER_MAP_OFFSET, GL_BUFFER_SIZE,
GL_RGB9_E5, GL_UNIFORM_BUFFER_START, GL_COMPRESSED_R11_EAC, GL_RGBA32UI, GL_UNSIGNED_INT_SAMPLER_2D,
GL_TEXTURE_MIN_LOD, GL_TEXTURE8, GL_TEXTURE9, GL_TEXTURE4, GL_TEXTURE5,
GL_TEXTURE6, GL_TEXTURE7, GL_TEXTURE0, GL_LINEAR_MIPMAP_LINEAR, GL_TEXTURE2,
GL_TEXTURE3, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_BLEND_EQUATION, GL_BYTE,
GL_BOOL_VEC3, GL_BOOL_VEC2, GL_TIMEOUT_IGNORED, GL_MAX_VARYING_VECTORS, GL_RENDERBUFFER_SAMPLES,
GL_ONE, GL_RG, GL_COLOR_CLEAR_VALUE, GL_MAX_SAMPLES, GL_BUFFER_USAGE,
GL_UNPACK_IMAGE_HEIGHT, GL_FLOAT_MAT3x2, GL_TRIANGLE_STRIP, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRANSFORM_FEEDBACK_BUFFER_BINDING,
GL_FLOAT_MAT3x4, GL_COLOR_ATTACHMENT28, GL_COLOR_ATTACHMENT29, GL_COLOR_ATTACHMENT24, GL_COLOR_ATTACHMENT25,
GL_COLOR_ATTACHMENT26, GL_COLOR_ATTACHMENT27, GL_COLOR_ATTACHMENT20, GL_COLOR_ATTACHMENT21, GL_COLOR_ATTACHMENT22,
GL_COLOR_ATTACHMENT23, GL_TRANSFORM_FEEDBACK_BUFFER, GL_VERTEX_ARRAY_BINDING, GL_UNSIGNED_SHORT_5_5_5_1, GL_TIMEOUT_EXPIRED,
GL_COMPRESSED_RGB8_ETC2, GL_SIGNED_NORMALIZED, GL_STENCIL_FUNC, GL_MAX_TEXTURE_LOD_BIAS, GL_ALIASED_LINE_WIDTH_RANGE,
GL_DECR, GL_BACK, GL_TEXTURE_COMPARE_FUNC, GL_TRANSFORM_FEEDBACK_BUFFER_MODE, GL_INT,
GL_COMPRESSED_SIGNED_RG11_EAC, GL_POLYGON_OFFSET_FILL, GL_MINOR_VERSION, GL_FRONT_AND_BACK, GL_R8,
GL_RGB_INTEGER, GL_STENCIL_CLEAR_VALUE, GL_SRGB, GL_GREEN_BITS, GL_SYNC_FENCE,
GL_ONE_MINUS_CONSTANT_COLOR, GL_SHADING_LANGUAGE_VERSION, GL_RGB8_SNORM, GL_UNPACK_SKIP_PIXELS, GL_TEXTURE_IMMUTABLE_LEVELS,
GL_FRAGMENT_SHADER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_SHORT_4_4_4_4, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, GL_FRAGMENT_SHADER_DERIVATIVE_HINT,
GL_NO_ERROR, GL_VIEWPORT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, GL_BLEND_SRC_ALPHA, GL_DRAW_BUFFER6,
GL_DRAW_BUFFER7, GL_DRAW_BUFFER4, GL_DRAW_BUFFER5, GL_DRAW_BUFFER2, GL_DRAW_BUFFER3,
GL_DRAW_BUFFER0, GL_DRAW_BUFFER1, GL_COMPRESSED_SRGB8_ETC2, GL_QUERY_RESULT_AVAILABLE, GL_DRAW_BUFFER8,
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, GL_MAX_DRAW_BUFFERS, GL_KEEP, GL_DELETE_STATUS, GL_R32UI,
GL_RGBA8_SNORM, GL_INT_SAMPLER_3D, GL_SRC_COLOR, GL_SAMPLER_BINDING, GL_DEPTH24_STENCIL8,
GL_SAMPLE_BUFFERS, GL_MAJOR_VERSION, GL_STATIC_COPY, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, GL_EXTENSIONS,
GL_UNIFORM_BUFFER_BINDING, GL_UNIFORM_TYPE, GL_COPY_READ_BUFFER_BINDING, GL_TEXTURE_COMPARE_MODE, GL_ANY_SAMPLES_PASSED,
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BACK_PASS_DEPTH_FAIL, GL_UNIFORM_BUFFER, GL_MAP_WRITE_BIT,
GL_VERTEX_ATTRIB_ARRAY_POINTER, GL_ALIASED_POINT_SIZE_RANGE, GL_CCW, GL_MAP_INVALIDATE_BUFFER_BIT, GL_DEPTH_COMPONENT24,
GL_UNSIGNED_INT_5_9_9_9_REV, GL_DEPTH_TEST, GL_SYNC_GPU_COMMANDS_COMPLETE, GL_VERTEX_ATTRIB_ARRAY_INTEGER, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
GL_MAX_VERTEX_UNIFORM_BLOCKS, GL_STREAM_READ, GL_LINEAR, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_FUNC_SUBTRACT,
GL_R32F, GL_MAX_VARYING_COMPONENTS, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, GL_IMPLEMENTATION_COLOR_READ_FORMAT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING,
GL_MAX_ELEMENT_INDEX, GL_COLOR_ATTACHMENT15, GL_COLOR_ATTACHMENT14, GL_HIGH_FLOAT, GL_DEPTH_RANGE,
GL_GREATER, GL_CLAMP_TO_EDGE, GL_COLOR_ATTACHMENT13, GL_COLOR_ATTACHMENT12, GL_NEAREST,
GL_VERTEX_ATTRIB_ARRAY_ENABLED, GL_COLOR_ATTACHMENT19, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, GL_MAX_TEXTURE_IMAGE_UNITS, GL_RGB32F,
GL_FLOAT_MAT2, GL_FLOAT_MAT3, GL_FRONT_FACE, GL_DEPTH, GL_FLOAT_MAT4,
GL_RENDERBUFFER_GREEN_SIZE, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, GL_TEXTURE30, GL_TEXTURE31,
GL_RG8I, GL_RGBA8I, GL_RG8UI, GL_DEPTH_CLEAR_VALUE, GL_BUFFER_MAP_POINTER,
GL_RENDERBUFFER_BINDING, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_STENCIL_REF, GL_MAX_3D_TEXTURE_SIZE, GL_COPY_WRITE_BUFFER_BINDING,
GL_COPY_WRITE_BUFFER, GL_BLEND, GL_MIRRORED_REPEAT, GL_R16UI, GL_TEXTURE_BINDING_3D,
GL_UNSIGNED_SHORT, GL_MIN, GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_TEXTURE,
GL_COLOR_BUFFER_BIT, GL_DONT_CARE, GL_ACTIVE_UNIFORMS, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_MAX_VERTEX_UNIFORM_VECTORS,
GL_TEXTURE_BINDING_CUBE_MAP, GL_SAMPLER_2D, GL_INVALID_VALUE, GL_DRAW_BUFFER12, GL_NEAREST_MIPMAP_NEAREST,
GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_PACK_SKIP_ROWS, GL_TEXTURE_MAG_FILTER, GL_TEXTURE1, GL_BLEND_EQUATION_RGB,
GL_LINK_STATUS, GL_TEXTURE_MAX_LEVEL, GL_R32I, GL_BLEND_COLOR, GL_ALPHA_BITS,
GL_BOOL_VEC4, GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, GL_ONE_MINUS_CONSTANT_ALPHA, GL_NEAREST_MIPMAP_LINEAR, GL_INT_2_10_10_10_REV,
GL_SAMPLER_CUBE_SHADOW, GL_WAIT_FAILED, GL_MAX_TEXTURE_SIZE, GL_RG32F, GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,
GL_ARRAY_BUFFER, GL_DEPTH_COMPONENT16, GL_UNSIGNALED, GL_RGB32I, GL_BLEND_SRC_RGB,
GL_FRAMEBUFFER_UNDEFINED, GL_SYNC_FLAGS, GL_FALSE, GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, GL_ONE_MINUS_SRC_ALPHA,
GL_RG32I, GL_RENDERBUFFER_INTERNAL_FORMAT, GL_NUM_SHADER_BINARY_FORMATS, GL_RGBA16I, GL_R8I,
GL_SAMPLE_ALPHA_TO_COVERAGE, GL_INT_SAMPLER_2D, GL_STENCIL_BITS, GL_STENCIL_PASS_DEPTH_FAIL, GL_RED,
GL_FUNC_REVERSE_SUBTRACT, GL_RGBA8UI, GL_GREEN, GL_INVALID_OPERATION, GL_RED_INTEGER,
GL_NONE, GL_STENCIL_BACK_PASS_DEPTH_PASS, GL_COLOR_ATTACHMENT5, GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS, GL_COLOR_ATTACHMENT7,
GL_UNIFORM_BLOCK_NAME_LENGTH, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT3, GL_COLOR_ATTACHMENT2,
GL_UNIFORM_BLOCK_INDEX, GL_FRAMEBUFFER_DEFAULT, GL_RGBA16UI, GL_COLOR_ATTACHMENT9, GL_COLOR_ATTACHMENT8,
GL_COLOR_ATTACHMENT10, GL_FRONT, GL_SCISSOR_BOX, GL_UNIFORM_BLOCK_DATA_SIZE, GL_DEPTH_WRITEMASK,
GL_CULL_FACE_MODE, GL_MAX_FRAGMENT_UNIFORM_VECTORS, GL_NUM_EXTENSIONS, GL_UNIFORM_IS_ROW_MAJOR, GL_MAX_UNIFORM_BLOCK_SIZE,
GL_BOOL, GL_MAX_COMBINED_UNIFORM_BLOCKS, GL_FRAMEBUFFER_BINDING, GL_UNSIGNED_INT_24_8, GL_COMPRESSED_TEXTURE_FORMATS,
GL_ALPHA, GL_COLOR_WRITEMASK, GL_DST_COLOR, GL_UNSIGNED_INT, GL_DEPTH_FUNC,
GL_ALWAYS, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_INVALID_ENUM, GL_PROGRAM_BINARY_LENGTH,
GL_STENCIL_BACK_VALUE_MASK, GL_INT_SAMPLER_2D_ARRAY, GL_DEPTH_COMPONENT, GL_SCISSOR_TEST, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES,
GL_SHADER_TYPE, GL_COMPARE_REF_TO_TEXTURE, GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, GL_TRUE,
GL_TEXTURE_MIN_FILTER, GL_REPLACE, GL_BLUE_BITS, GL_RG_INTEGER, GL_TEXTURE_SWIZZLE_R,
GL_VERTEX_ATTRIB_ARRAY_STRIDE, GL_EQUAL, GL_TEXTURE_SWIZZLE_G, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER_HEIGHT,
GL_RG16UI, GL_INTERLEAVED_ATTRIBS, GL_TEXTURE_SWIZZLE_A, GL_POLYGON_OFFSET_UNITS, GL_LOW_FLOAT,
GL_HALF_FLOAT, GL_FLOAT_MAT4x3, GL_DYNAMIC_COPY, GL_COLOR_ATTACHMENT6, GL_UNPACK_ALIGNMENT,
GL_ALREADY_SIGNALED, GL_LINE_STRIP, GL_STREAM_COPY, GL_PACK_ROW_LENGTH, GL_NUM_SAMPLE_COUNTS,
GL_MEDIUM_INT, GL_TEXTURE_CUBE_MAP, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, GL_COLOR, GL_RENDERBUFFER_DEPTH_SIZE,
GL_DYNAMIC_READ, GL_PROGRAM_BINARY_FORMATS, GL_LOW_INT, GL_DEPTH_STENCIL, GL_VERTEX_ATTRIB_ARRAY_DIVISOR,
GL_MAX_VERTEX_OUTPUT_COMPONENTS, GL_POINTS, GL_COMPRESSED_RG11_EAC, GL_RENDERBUFFER_BLUE_SIZE, GL_UNIFORM_NAME_LENGTH,
GL_FASTEST, GL_SYNC_CONDITION, GL_ACTIVE_UNIFORM_MAX_LENGTH, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, GL_MAP_INVALIDATE_RANGE_BIT,
GL_TEXTURE23, GL_TEXTURE22, GL_TEXTURE21, GL_TEXTURE20, GL_TEXTURE27,
GL_TEXTURE26, GL_TEXTURE25, GL_TEXTURE24, GL_R8_SNORM, GL_TEXTURE29,
GL_TEXTURE28, GL_ELEMENT_ARRAY_BUFFER_BINDING, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
GL_LINE_LOOP, GL_READ_BUFFER, GL_MAP_FLUSH_EXPLICIT_BIT, GL_PACK_SKIP_PIXELS, GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS,
GL_SUBPIXEL_BITS, GL_R16F, GL_GEQUAL, GL_READ_FRAMEBUFFER, GL_UNIFORM_BLOCK_BINDING,
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, GL_LINE_WIDTH, GL_UNIFORM_OFFSET, GL_LEQUAL, GL_TRANSFORM_FEEDBACK,
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_UNSIGNED_INT_SAMPLER_CUBE, GL_COLOR_ATTACHMENT4, GL_UNIFORM_SIZE, GL_FUNC_ADD,
GL_FLOAT_MAT4x2, GL_SHADER_SOURCE_LENGTH, GL_CURRENT_VERTEX_ATTRIB, GL_ARRAY_BUFFER_BINDING, GL_TEXTURE_2D,
GL_DYNAMIC_DRAW, GL_OUT_OF_MEMORY, GL_NICEST, GL_IMPLEMENTATION_COLOR_READ_TYPE, GL_UNPACK_ROW_LENGTH,
GL_CURRENT_PROGRAM, GL_BUFFER_MAPPED, GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, GL_RASTERIZER_DISCARD, GL_NUM_PROGRAM_BINARY_FORMATS,
GL_STREAM_DRAW, GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, GL_MAX_UNIFORM_BUFFER_BINDINGS, GL_SIGNALED, GL_FRAMEBUFFER,
GL_UNPACK_SKIP_ROWS, GL_MEDIUM_FLOAT, GL_STENCIL_TEST, GL_R11F_G11F_B10F, GL_SRGB8,
GL_LUMINANCE_ALPHA, GL_PIXEL_UNPACK_BUFFER_BINDING, GL_INVERT, GL_STENCIL_BACK_FAIL, GL_POLYGON_OFFSET_FACTOR,
GL_TRANSFORM_FEEDBACK_VARYINGS, GL_DEPTH_COMPONENT32F, GL_TRIANGLE_FAN, GL_SYNC_FLUSH_COMMANDS_BIT, GL_ONE_MINUS_DST_ALPHA,
GL_DRAW_FRAMEBUFFER_BINDING, GL_MAX_ELEMENTS_VERTICES, GL_STENCIL_BACK_WRITEMASK, GL_INVALID_FRAMEBUFFER_OPERATION, GL_BUFFER_ACCESS_FLAGS,
GL_COMPRESSED_RGBA8_ETC2_EAC, GL_UNIFORM_BUFFER_SIZE, GL_TRIANGLES, GL_SAMPLER_2D_ARRAY_SHADOW, GL_DEPTH32F_STENCIL8,
GL_MAX_ARRAY_TEXTURE_LAYERS, GL_RED_BITS, GL_UNIFORM_MATRIX_STRIDE, GL_MAX_SERVER_WAIT_TIMEOUT, GL_SRGB8_ALPHA8,
GL_RGBA16F, GL_PACK_ALIGNMENT, GL_SAMPLER_2D_ARRAY, GL_RENDERER, GL_MAX_COLOR_ATTACHMENTS,
GL_ACTIVE_UNIFORM_BLOCKS, GL_UNPACK_SKIP_IMAGES, GL_STENCIL_BACK_FUNC, GL_RGB16I, GL_ACTIVE_TEXTURE,
GL_TEXTURE_BASE_LEVEL, GL_RGB16F, GL_COMPRESSED_SIGNED_R11_EAC, GL_UNSIGNED_INT_SAMPLER_3D, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH,
GL_TEXTURE_WRAP_R, GL_INT_VEC4, GL_INT_VEC3, GL_INT_VEC2, GL_STENCIL_FAIL,
GL_MAX_VERTEX_ATTRIBS, GL_CONDITION_SATISFIED, GL_TEXTURE_IMMUTABLE_FORMAT, GL_FRAMEBUFFER_UNSUPPORTED, GL_DST_ALPHA,
GL_LESS, GL_MAX_CUBE_MAP_TEXTURE_SIZE, GL_RGB565, GL_TRANSFORM_FEEDBACK_BINDING, GL_RENDERBUFFER_WIDTH,
GL_READ_FRAMEBUFFER_BINDING, GL_RGBA4, GL_DRAW_BUFFER10, GL_DRAW_BUFFER11, GL_RGBA8,
GL_DRAW_BUFFER13, GL_DRAW_BUFFER14, GL_DRAW_BUFFER15, GL_INFO_LOG_LENGTH, GL_PRIMITIVE_RESTART_FIXED_INDEX,
GL_SRC_ALPHA_SATURATE, GL_RENDERBUFFER_STENCIL_SIZE, GL_REPEAT, GL_R16I, GL_RG8_SNORM,
GL_PIXEL_PACK_BUFFER, GL_STATIC_READ, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, GL_VALIDATE_STATUS,
GL_MAP_READ_BIT, GL_STENCIL, GL_STENCIL_BUFFER_BIT, GL_TEXTURE_SWIZZLE_B, GL_COLOR_ATTACHMENT17,
GL_BLEND_EQUATION_ALPHA, GL_RGBA_INTEGER, GL_ACTIVE_ATTRIBUTES, GL_MAX_RENDERBUFFER_SIZE, GL_COLOR_ATTACHMENT31,
GL_COLOR_ATTACHMENT30, GL_STENCIL_PASS_DEPTH_PASS, GL_INCR_WRAP, GL_RENDERBUFFER_ALPHA_SIZE, GL_HIGH_INT,
GL_COLOR_ATTACHMENT16, GL_DECR_WRAP, GL_ATTACHED_SHADERS, GL_MAX_FRAGMENT_INPUT_COMPONENTS, GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
GL_LINES, GL_TEXTURE18, GL_TEXTURE19, GL_TEXTURE16, GL_TEXTURE17,
GL_TEXTURE14, GL_GENERATE_MIPMAP_HINT, GL_TEXTURE12, GL_COLOR_ATTACHMENT11, GL_TEXTURE10,
GL_MAX_FRAGMENT_UNIFORM_BLOCKS, GL_BLEND_DST_ALPHA, GL_RGB, GL_INT_SAMPLER_CUBE, GL_CURRENT_QUERY,
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, GL_RGB5_A1, GL_VERTEX_SHADER, GL_TRANSFORM_FEEDBACK_BUFFER_START, GL_MAX_PROGRAM_TEXEL_OFFSET,
GL_SHADER_BINARY_FORMATS, GL_CONSTANT_COLOR, GL_RGBA32F, GL_RGBA32I, GL_VERTEX_ATTRIB_ARRAY_TYPE,
GL_PIXEL_UNPACK_BUFFER, GL_LINEAR_MIPMAP_NEAREST, GL_STENCIL_WRITEMASK, GL_RG8, GL_RGB10_A2,
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, GL_VERSION, GL_MAP_UNSYNCHRONIZED_BIT, GL_ZERO, GL_ELEMENT_ARRAY_BUFFER,
GL_SYNC_STATUS, GL_BUFFER_MAP_LENGTH, GL_MAX_ELEMENTS_INDICES, GL_UNSIGNED_NORMALIZED, GL_CONSTANT_ALPHA,
GL_SRC_ALPHA, GL_TEXTURE_3D, GL_FIXED, GL_RGB8, GL_SAMPLE_COVERAGE_INVERT,
GL_NOTEQUAL, GL_UNIFORM_ARRAY_STRIDE, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_INCR, GL_CULL_FACE,
GL_SAMPLE_COVERAGE_VALUE, GL_RENDERBUFFER_RED_SIZE, GL_MAX_VIEWPORT_DIMS, GL_RG32UI, GL_NEVER,
GL_TEXTURE15, GL_STENCIL_VALUE_MASK, GL_TEXTURE13, GL_DRAW_BUFFER9, GL_COMPILE_STATUS,
GL_FRAMEBUFFER_COMPLETE, GL_TEXTURE11, GL_COPY_READ_BUFFER, GL_SHADER_COMPILER, GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, GL_LUMINANCE, GL_RGBA, GL_SHORT, GL_BLUE,
GL_CW, GL_MIN_PROGRAM_TEXEL_OFFSET, GL_UNSIGNED_BYTE, GL_MAX_VERTEX_UNIFORM_COMPONENTS, GL_VENDOR,
GL_TEXTURE_2D_ARRAY, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_TEXTURE_BINDING_2D, GL_OBJECT_TYPE, GL_R8UI,
GL_STATIC_DRAW, GL_RENDERBUFFER, GL_FLOAT_MAT2x3, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, GL_FLOAT_MAT2x4,
GL_RGB8I, GL_COLOR_ATTACHMENT18, GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, GL_TRANSFORM_FEEDBACK_ACTIVE, GL_SEPARATE_ATTRIBS,
GL_SAMPLER_3D, GL_MAX, GL_STENCIL_INDEX8, GL_DEPTH_BITS, GL_RGB8UI,
GL_STENCIL_BACK_REF, GL_INVALID_INDEX, GL_BLEND_DST_RGB, GL_SAMPLER_2D_SHADOW, GL_TEXTURE_BINDING_2D_ARRAY,
GL_RG16F, GL_SAMPLER_CUBE, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, GL_RG16I,
GL_PIXEL_PACK_BUFFER_BINDING, GL_STENCIL_ATTACHMENT, GL_SAMPLE_COVERAGE, GL_ANY_SAMPLES_PASSED_CONSERVATIVE, GL_DRAW_FRAMEBUFFER,
GL_RGB10_A2UI, GL_SAMPLES;

1323
demos/external/sources/glad/gl/loader.d vendored Normal file

File diff suppressed because it is too large Load diff

46
demos/external/sources/glad/gl/types.d vendored Normal file
View file

@ -0,0 +1,46 @@
module glad.gl.types;
alias GLvoid = void;
alias GLintptr = ptrdiff_t;
alias GLsizei = int;
alias GLchar = char;
alias GLcharARB = byte;
alias GLushort = ushort;
alias GLint64EXT = long;
alias GLshort = short;
alias GLuint64 = ulong;
alias GLhalfARB = ushort;
alias GLubyte = ubyte;
alias GLdouble = double;
alias GLhandleARB = uint;
alias GLint64 = long;
alias GLenum = uint;
alias GLeglImageOES = void*;
alias GLintptrARB = ptrdiff_t;
alias GLsizeiptr = ptrdiff_t;
alias GLint = int;
alias GLboolean = ubyte;
alias GLbitfield = uint;
alias GLsizeiptrARB = ptrdiff_t;
alias GLfloat = float;
alias GLuint64EXT = ulong;
alias GLclampf = float;
alias GLbyte = byte;
alias GLclampd = double;
alias GLuint = uint;
alias GLvdpauSurfaceNV = ptrdiff_t;
alias GLfixed = int;
alias GLhalf = ushort;
alias GLclampx = int;
alias GLhalfNV = ushort;
struct ___GLsync; alias __GLsync = ___GLsync*;
alias GLsync = __GLsync*;
struct __cl_context; alias _cl_context = __cl_context*;
struct __cl_event; alias _cl_event = __cl_event*;
extern(System) {
alias GLDEBUGPROC = void function(GLenum, GLenum, GLuint, GLenum, GLsizei, in GLchar*, GLvoid*);
alias GLDEBUGPROCARB = GLDEBUGPROC;
alias GLDEBUGPROCKHR = GLDEBUGPROC;
alias GLDEBUGPROCAMD = void function(GLuint, GLenum, GLenum, GLsizei, in GLchar*, GLvoid*);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,46 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind;
public
import bindbc.sdl.bind.sdl,
bindbc.sdl.bind.sdlassert,
bindbc.sdl.bind.sdlaudio,
bindbc.sdl.bind.sdlblendmode,
bindbc.sdl.bind.sdlclipboard,
bindbc.sdl.bind.sdlcpuinfo,
bindbc.sdl.bind.sdlerror,
bindbc.sdl.bind.sdlevents,
bindbc.sdl.bind.sdlfilesystem,
bindbc.sdl.bind.sdlgamecontroller,
bindbc.sdl.bind.sdlgesture,
bindbc.sdl.bind.sdlhaptic,
bindbc.sdl.bind.sdlhints,
bindbc.sdl.bind.sdljoystick,
bindbc.sdl.bind.sdlkeyboard,
bindbc.sdl.bind.sdlkeycode,
bindbc.sdl.bind.sdlloadso,
bindbc.sdl.bind.sdllog,
bindbc.sdl.bind.sdlmessagebox,
bindbc.sdl.bind.sdlmouse,
bindbc.sdl.bind.sdlpixels,
bindbc.sdl.bind.sdlplatform,
bindbc.sdl.bind.sdlpower,
bindbc.sdl.bind.sdlrect,
bindbc.sdl.bind.sdlrender,
bindbc.sdl.bind.sdlrwops,
bindbc.sdl.bind.sdlscancode,
bindbc.sdl.bind.sdlshape,
bindbc.sdl.bind.sdlstdinc,
bindbc.sdl.bind.sdlsurface,
bindbc.sdl.bind.sdlsystem,
bindbc.sdl.bind.sdlsyswm,
bindbc.sdl.bind.sdltimer,
bindbc.sdl.bind.sdltouch,
bindbc.sdl.bind.sdlversion,
bindbc.sdl.bind.sdlvideo,
bindbc.sdl.bind.sdlvulkan;

View file

@ -0,0 +1,69 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdl;
import bindbc.sdl.config;
static if(sdlSupport >= SDLSupport.sdl209) {
enum : uint {
SDL_INIT_TIMER = 0x00000001,
SDL_INIT_AUDIO = 0x00000010,
SDL_INIT_VIDEO = 0x00000020,
SDL_INIT_JOYSTICK = 0x00000200,
SDL_INIT_HAPTIC = 0x00001000,
SDL_INIT_GAMECONTROLLER = 0x00002000,
SDL_INIT_EVENTS = 0x00004000,
SDL_INIT_SENSOR = 0x00008000,
SDL_INIT_NOPARACHUTE = 0x00100000,
SDL_INIT_EVERYTHING =
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO |
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER |
SDL_INIT_EVENTS | SDL_INIT_SENSOR
}
} else {
enum : uint {
SDL_INIT_TIMER = 0x00000001,
SDL_INIT_AUDIO = 0x00000010,
SDL_INIT_VIDEO = 0x00000020,
SDL_INIT_JOYSTICK = 0x00000200,
SDL_INIT_HAPTIC = 0x00001000,
SDL_INIT_GAMECONTROLLER = 0x00002000,
SDL_INIT_EVENTS = 0x00004000,
SDL_INIT_NOPARACHUTE = 0x00100000,
SDL_INIT_EVERYTHING =
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO |
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER |
SDL_INIT_EVENTS
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_Init(uint);
int SDL_InitSubSystem(uint);
void SDL_QuitSubSystem(uint);
uint SDL_WasInit(uint);
void SDL_Quit();
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_Init = int function(uint);
alias pSDL_InitSubSystem = int function(uint);
alias pSDL_QuitSubSystem = void function(uint);
alias pSDL_WasInit = uint function(uint);
alias pSDL_Quit = void function();
}
__gshared {
pSDL_Init SDL_Init;
pSDL_InitSubSystem SDL_InitSubSystem;
pSDL_QuitSubSystem SDL_QuitSubSystem;
pSDL_WasInit SDL_WasInit;
pSDL_Quit SDL_Quit;
}
}

View file

@ -0,0 +1,70 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlassert;
import bindbc.sdl.config;
enum SDL_assert_state : uint {
SDL_ASSERTION_RETRY = 0,
SDL_ASSERTION_BREAK = 1,
SDL_ASSERTION_ABORT = 2,
SDL_ASSERTION_IGNORE = 3,
SDL_ASSERTION_ALWAYS_IGNORE = 4
}
alias SDL_AssertState = SDL_assert_state;
mixin(expandEnum!SDL_AssertState);
struct SDL_assert_data {
int always_ignore;
uint trigger_count;
const(char) *condition;
const(char) *filename;
int linenum;
const(char) *function_;
const(SDL_assert_data) *next;
}
alias SDL_AssertData = SDL_assert_data;
extern(C) nothrow alias SDL_AssertionHandler = SDL_AssertState function(const(SDL_AssertData)* data, void* userdata);
version(BindSDL_Static) {
extern(C) @nogc nothrow {
void SDL_SetAssertionHandler(SDL_AssertionHandler,void*);
const(SDL_assert_data)* SDL_GetAssertionReport();
void SDL_ResetAssertionReport();
static if(sdlSupport >= SDLSupport.sdl202) {
SDL_AssertionHandler SDL_GetAssertionHandler(void**);
SDL_AssertionHandler SDL_GetDefaultAssertionHandler();
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_SetAssertionHandler = void function(SDL_AssertionHandler,void*);
alias pSDL_GetAssertionReport = const(SDL_assert_data)* function();
alias pSDL_ResetAssertionReport = void function();
}
__gshared {
pSDL_SetAssertionHandler SDL_SetAssertionHandler;
pSDL_GetAssertionReport SDL_GetAssertionReport;
pSDL_ResetAssertionReport SDL_ResetAssertionReport;
}
static if(sdlSupport >= SDLSupport.sdl202) {
extern(C) @nogc nothrow {
alias pSDL_GetAssertionHandler = SDL_AssertionHandler function(void**);
alias pSDL_GetDefaultAssertionHandler = SDL_AssertionHandler function();
}
__gshared {
pSDL_GetAssertionHandler SDL_GetAssertionHandler;
pSDL_GetDefaultAssertionHandler SDL_GetDefaultAssertionHandler;
}
}
}

View file

@ -0,0 +1,283 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlaudio;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlrwops;
enum : ushort {
SDL_AUDIO_MASK_BITSIZE = 0xFF,
SDL_AUDIO_MASK_DATATYPE = 1<<8,
SDL_AUDIO_MASK_ENDIAN = 1<<12,
SDL_AUDIO_MASK_SIGNED = 1<<15,
}
enum SDL_AudioFormat : ushort {
AUDIO_U8 = 0x0008,
AUDIO_S8 = 0x8008,
AUDIO_U16LSB = 0x0010,
AUDIO_S16LSB = 0x8010,
AUDIO_U16MSB = 0x1010,
AUDIO_S16MSB = 0x9010,
AUDIO_U16 = AUDIO_U16LSB,
AUDIO_S16 = AUDIO_S16LSB,
AUDIO_S32LSB = 0x8020,
AUDIO_S32MSB = 0x9020,
AUDIO_S32 = AUDIO_S32LSB,
AUDIO_F32LSB = 0x8120,
AUDIO_F32MSB = 0x9120,
AUDIO_F32 = AUDIO_F32LSB,
}
mixin(expandEnum!SDL_AudioFormat);
version(LittleEndian) {
alias AUDIO_U16SYS = AUDIO_U16LSB;
alias AUDIO_S16SYS = AUDIO_S16LSB;
alias AUDIO_S32SYS = AUDIO_S32LSB;
alias AUDIO_F32SYS = AUDIO_F32LSB;
} else {
alias AUDIO_U16SYS = AUDIO_U16MSB;
alias AUDIO_S16SYS = AUDIO_S16MSB;
alias AUDIO_S32SYS = AUDIO_S32MSB;
alias AUDIO_F32SYS = AUDIO_F32MSB;
}
enum SDL_AUDIO_BITSIZE(SDL_AudioFormat x) = x & SDL_AUDIO_MASK_BITSIZE;
enum SDL_AUDIO_ISFLOAT(SDL_AudioFormat x) = x & SDL_AUDIO_MASK_DATATYPE;
enum SDL_AUDIO_ISBIGENDIAN(SDL_AudioFormat x) = x & SDL_AUDIO_MASK_ENDIAN;
enum SDL_AUDIO_ISSIGNED(SDL_AudioFormat x) = x & SDL_AUDIO_MASK_SIGNED;
enum SDL_AUDIO_ISINT(SDL_AudioFormat x) = !SDL_AUDIO_ISFLOAT!x;
enum SDL_AUDIO_ISLITTLEENDIAN(SDL_AudioFormat x) = !SDL_AUDIO_ISBIGENDIAN!x;
enum SDL_AUDIO_ISUNSIGNED(SDL_AudioFormat x) = !SDL_AUDIO_ISSIGNED!x;
static if(sdlSupport >= SDLSupport.sdl209) {
enum {
SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001,
SDL_AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002,
SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004,
SDL_AUDIO_ALLOW_SAMPLES_CHANGE = 0x00000008,
SDL_AUDIO_ALLOW_ANY_CHANGE = SDL_AUDIO_ALLOW_FREQUENCY_CHANGE |
SDL_AUDIO_ALLOW_FORMAT_CHANGE |
SDL_AUDIO_ALLOW_CHANNELS_CHANGE |
SDL_AUDIO_ALLOW_SAMPLES_CHANGE,
}
}
else {
enum {
SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001,
SDL_AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002,
SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004,
SDL_AUDIO_ALLOW_ANY_CHANGE = SDL_AUDIO_ALLOW_FREQUENCY_CHANGE |
SDL_AUDIO_ALLOW_FORMAT_CHANGE |
SDL_AUDIO_ALLOW_CHANNELS_CHANGE,
}
}
extern(C) nothrow alias SDL_AudioCallback = void function(void* userdata, ubyte* stream, int len);
struct SDL_AudioSpec {
int freq;
SDL_AudioFormat format;
ubyte channels;
ubyte silence;
ushort samples;
ushort padding;
uint size;
SDL_AudioCallback callback;
void* userdata;
}
// Declared in 2.0.6, but doesn't hurt to use here
enum SDL_AUDIOCVT_MAX_FILTERS = 9;
extern(C) nothrow alias SDL_AudioFilter = void function(SDL_AudioCVT* cvt, SDL_AudioFormat format);
struct SDL_AudioCVT {
int needed;
SDL_AudioFormat src_format;
SDL_AudioFormat dst_format;
double rate_incr;
ubyte* buf;
int len;
int len_cvt;
int len_mult;
double len_ratio;
SDL_AudioFilter[SDL_AUDIOCVT_MAX_FILTERS + 1] filters;
int filter_index;
}
alias SDL_AudioDeviceID = uint;
enum SDL_AudioStatus {
SDL_AUDIO_STOPPED = 0,
SDL_AUDIO_PLAYING,
SDL_AUDIO_PAUSED,
}
mixin(expandEnum!SDL_AudioStatus);
enum SDL_MIX_MAXVOLUME = 128;
static if(sdlSupport >= SDLSupport.sdl207) {
struct SDL_AudioStream;
}
@nogc nothrow
SDL_AudioSpec* SDL_LoadWAV(const(char)* file, SDL_AudioSpec* spec, ubyte** audio_buf, uint* len) {
pragma(inline, true);
return SDL_LoadWAV_RW(SDL_RWFromFile(file,"rb"),1,spec,audio_buf,len);
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_GetNumAudioDrivers();
const(char)* SDL_GetAudioDriver(int);
int SDL_AudioInit(const(char)*);
void SDL_AudioQuit();
const(char)* SDL_GetCurrentAudioDriver();
int SDL_OpenAudio(SDL_AudioSpec*,SDL_AudioSpec*);
int SDL_GetNumAudioDevices(int);
const(char)* SDL_GetAudioDeviceName(int,int);
SDL_AudioDeviceID SDL_OpenAudioDevice(const(char)*,int,const(SDL_AudioSpec)*,SDL_AudioSpec*,int);
SDL_AudioStatus SDL_GetAudioStatus();
SDL_AudioStatus SDL_GetAudioDeviceStatus(SDL_AudioDeviceID);
void SDL_PauseAudio(int);
void SDL_PauseAudioDevice(SDL_AudioDeviceID,int);
SDL_AudioSpec* SDL_LoadWAV_RW(SDL_RWops*,int,SDL_AudioSpec*,ubyte**,uint*);
void SDL_FreeWAV(ubyte*);
int SDL_BuildAudioCVT(SDL_AudioCVT*,SDL_AudioFormat,ubyte,int,SDL_AudioFormat,ubyte,int);
int SDL_ConvertAudio(SDL_AudioCVT*);
void SDL_MixAudio(ubyte*,const(ubyte)*,uint,int);
void SDL_MixAudioFormat(ubyte*,const(ubyte)*,SDL_AudioFormat,uint,int);
void SDL_LockAudio();
void SDL_LockAudioDevice(SDL_AudioDeviceID);
void SDL_UnlockAudio();
void SDL_UnlockAudioDevice(SDL_AudioDeviceID);
void SDL_CloseAudio();
void SDL_CloseAudioDevice(SDL_AudioDeviceID);
static if(sdlSupport >= SDLSupport.sdl204) {
int SDL_ClearQueuedAudio(SDL_AudioDeviceID);
int SDL_GetQueuedAudioSize(SDL_AudioDeviceID);
int SDL_QueueAudio(SDL_AudioDeviceID,const (void)*,uint);
}
static if(sdlSupport >= SDLSupport.sdl205) {
uint SDL_DequeueAudio(SDL_AudioDeviceID,void*,uint);
}
static if(sdlSupport >= SDLSupport.sdl207) {
SDL_AudioStream* SDL_NewAudioStream(const(SDL_AudioFormat),const(ubyte),const(int),const(SDL_AudioFormat),const(ubyte),const(int));
int SDL_AudioStreamPut(SDL_AudioStream*,const(void)*,int);
int SDL_AudioStreamGet(SDL_AudioStream*,void*,int);
int SDL_AudioStreamAvailable(SDL_AudioStream*);
int SDL_AudioStreamFlush(SDL_AudioStream*);
void SDL_AudioStreamClear(SDL_AudioStream*);
void SDL_FreeAudioStream(SDL_AudioStream*);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetNumAudioDrivers = int function();
alias pSDL_GetAudioDriver = const(char)* function(int);
alias pSDL_AudioInit = int function(const(char)*);
alias pSDL_AudioQuit = void function();
alias pSDL_GetCurrentAudioDriver = const(char)* function();
alias pSDL_OpenAudio = int function(SDL_AudioSpec*,SDL_AudioSpec*);
alias pSDL_GetNumAudioDevices = int function(int);
alias pSDL_GetAudioDeviceName = const(char)* function(int,int);
alias pSDL_OpenAudioDevice = SDL_AudioDeviceID function(const(char)*,int,const(SDL_AudioSpec)*,SDL_AudioSpec*,int);
alias pSDL_GetAudioStatus = SDL_AudioStatus function();
alias pSDL_GetAudioDeviceStatus = SDL_AudioStatus function(SDL_AudioDeviceID);
alias pSDL_PauseAudio = void function(int);
alias pSDL_PauseAudioDevice = void function(SDL_AudioDeviceID,int);
alias pSDL_LoadWAV_RW = SDL_AudioSpec* function(SDL_RWops*,int,SDL_AudioSpec*,ubyte**,uint*);
alias pSDL_FreeWAV = void function(ubyte*);
alias pSDL_BuildAudioCVT = int function(SDL_AudioCVT*,SDL_AudioFormat,ubyte,int,SDL_AudioFormat,ubyte,int);
alias pSDL_ConvertAudio = int function(SDL_AudioCVT*);
alias pSDL_MixAudio = void function(ubyte*,const(ubyte)*,uint,int);
alias pSDL_MixAudioFormat = void function(ubyte*,const(ubyte)*,SDL_AudioFormat,uint,int);
alias pSDL_LockAudio = void function();
alias pSDL_LockAudioDevice = void function(SDL_AudioDeviceID);
alias pSDL_UnlockAudio = void function();
alias pSDL_UnlockAudioDevice = void function(SDL_AudioDeviceID);
alias pSDL_CloseAudio = void function();
alias pSDL_CloseAudioDevice = void function(SDL_AudioDeviceID);
}
__gshared {
pSDL_GetNumAudioDrivers SDL_GetNumAudioDrivers;
pSDL_GetAudioDriver SDL_GetAudioDriver;
pSDL_AudioInit SDL_AudioInit;
pSDL_AudioQuit SDL_AudioQuit;
pSDL_GetCurrentAudioDriver SDL_GetCurrentAudioDriver;
pSDL_OpenAudio SDL_OpenAudio;
pSDL_GetNumAudioDevices SDL_GetNumAudioDevices;
pSDL_GetAudioDeviceName SDL_GetAudioDeviceName;
pSDL_OpenAudioDevice SDL_OpenAudioDevice;
pSDL_GetAudioStatus SDL_GetAudioStatus;
pSDL_GetAudioDeviceStatus SDL_GetAudioDeviceStatus;
pSDL_PauseAudio SDL_PauseAudio;
pSDL_PauseAudioDevice SDL_PauseAudioDevice;
pSDL_LoadWAV_RW SDL_LoadWAV_RW;
pSDL_FreeWAV SDL_FreeWAV;
pSDL_BuildAudioCVT SDL_BuildAudioCVT;
pSDL_ConvertAudio SDL_ConvertAudio;
pSDL_MixAudio SDL_MixAudio;
pSDL_MixAudioFormat SDL_MixAudioFormat;
pSDL_LockAudio SDL_LockAudio;
pSDL_LockAudioDevice SDL_LockAudioDevice;
pSDL_UnlockAudio SDL_UnlockAudio;
pSDL_UnlockAudioDevice SDL_UnlockAudioDevice;
pSDL_CloseAudio SDL_CloseAudio;
pSDL_CloseAudioDevice SDL_CloseAudioDevice;
}
static if(sdlSupport >= SDLSupport.sdl204) {
extern(C) @nogc nothrow {
alias pSDL_ClearQueuedAudio = int function(SDL_AudioDeviceID);
alias pSDL_GetQueuedAudioSize = int function(SDL_AudioDeviceID);
alias pSDL_QueueAudio = int function(SDL_AudioDeviceID,const (void)*,uint);
}
__gshared {
pSDL_ClearQueuedAudio SDL_ClearQueuedAudio;
pSDL_GetQueuedAudioSize SDL_GetQueuedAudioSize;
pSDL_QueueAudio SDL_QueueAudio;
}
}
static if(sdlSupport >= SDLSupport.sdl205) {
extern(C) @nogc nothrow {
alias pSDL_DequeueAudio = uint function(SDL_AudioDeviceID,void*,uint);
}
__gshared {
pSDL_DequeueAudio SDL_DequeueAudio;
}
}
static if(sdlSupport >= SDLSupport.sdl207) {
extern(C) @nogc nothrow {
alias pSDL_NewAudioStream = SDL_AudioStream* function(const(SDL_AudioFormat),const(ubyte),const(int),const(SDL_AudioFormat),const(ubyte),const(int));
alias pSDL_AudioStreamPut = int function(SDL_AudioStream*,const(void)*,int);
alias pSDL_AudioStreamGet = int function(SDL_AudioStream*,void*,int);
alias pSDL_AudioStreamAvailable = int function(SDL_AudioStream*);
alias pSDL_AudioStreamFlush = int function(SDL_AudioStream*);
alias pSDL_AudioStreamClear = void function(SDL_AudioStream*);
alias pSDL_FreeAudioStream = void function(SDL_AudioStream*);
}
__gshared {
pSDL_NewAudioStream SDL_NewAudioStream;
pSDL_AudioStreamPut SDL_AudioStreamPut;
pSDL_AudioStreamGet SDL_AudioStreamGet;
pSDL_AudioStreamAvailable SDL_AudioStreamAvailable;
pSDL_AudioStreamFlush SDL_AudioStreamFlush;
pSDL_AudioStreamClear SDL_AudioStreamClear;
pSDL_FreeAudioStream SDL_FreeAudioStream;
}
}
}

View file

@ -0,0 +1,71 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlblendmode;
import bindbc.sdl.config;
static if(sdlSupport >= SDLSupport.sdl206) {
enum SDL_BlendMode {
SDL_BLENDMODE_NONE = 0x00000000,
SDL_BLENDMODE_BLEND = 0x00000001,
SDL_BLENDMODE_ADD = 0x00000002,
SDL_BLENDMODE_MOD = 0x00000004,
SDL_BLENDMODE_INVALID = 0x7FFFFFFF,
}
mixin(expandEnum!SDL_BlendMode);
enum SDL_BlendOperation {
SDL_BLENDOPERATION_ADD = 0x1,
SDL_BLENDOPERATION_SUBTRACT = 0x2,
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3,
SDL_BLENDOPERATION_MINIMUM = 0x4,
SDL_BLENDOPERATION_MAXIMUM = 0x5,
}
mixin(expandEnum!SDL_BlendOperation);
enum SDL_BlendFactor {
SDL_BLENDFACTOR_ZERO = 0x1,
SDL_BLENDFACTOR_ONE = 0x2,
SDL_BLENDFACTOR_SRC_COLOR = 0x3,
SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4,
SDL_BLENDFACTOR_SRC_ALPHA = 0x5,
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6,
SDL_BLENDFACTOR_DST_COLOR = 0x7,
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8,
SDL_BLENDFACTOR_DST_ALPHA = 0x9,
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA,
}
mixin(expandEnum!SDL_BlendFactor);
}
else {
enum SDL_BlendMode {
SDL_BLENDMODE_NONE = 0x00000000,
SDL_BLENDMODE_BLEND = 0x00000001,
SDL_BLENDMODE_ADD = 0x00000002,
SDL_BLENDMODE_MOD = 0x00000004,
}
mixin(expandEnum!SDL_BlendMode);
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
static if(sdlSupport >= SDLSupport.sdl206) {
SDL_BlendMode SDL_ComposeCustomBlendMode(SDL_BlendFactor,SDL_BlendFactor,SDL_BlendOperation,SDL_BlendFactor,SDL_BlendFactor,SDL_BlendOperation);
}
}
}
else {
static if(sdlSupport >= SDLSupport.sdl206) {
extern(C) @nogc nothrow {
alias pSDL_ComposeCustomBlendMode = SDL_BlendMode function(SDL_BlendFactor,SDL_BlendFactor,SDL_BlendOperation,SDL_BlendFactor,SDL_BlendFactor,SDL_BlendOperation);
}
__gshared {
pSDL_ComposeCustomBlendMode SDL_ComposeCustomBlendMode;
}
}
}

View file

@ -0,0 +1,31 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlclipboard;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_SetClipboardText(const(char)*);
char* SDL_GetClipboardText();
SDL_bool SDL_HasClipboardText();
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_SetClipboardText = int function(const(char)*);
alias pSDL_GetClipboardText = char* function();
alias pSDL_HasClipboardText = SDL_bool function();
}
__gshared {
pSDL_SetClipboardText SDL_SetClipboardText;
pSDL_GetClipboardText SDL_GetClipboardText;
pSDL_HasClipboardText SDL_HasClipboardText;
}
}

View file

@ -0,0 +1,130 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlcpuinfo;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
enum SDL_CACHELINE_SIZE = 128;
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_GetCPUCount();
int SDL_GetCPUCacheLineSize();
SDL_bool SDL_HasRDTSC();
SDL_bool SDL_HasAltiVec();
SDL_bool SDL_HasMMX();
SDL_bool SDL_Has3DNow();
SDL_bool SDL_HasSSE();
SDL_bool SDL_HasSSE2();
SDL_bool SDL_HasSSE3();
SDL_bool SDL_HasSSE41();
SDL_bool SDL_HasSSE42();
static if(sdlSupport >= SDLSupport.sdl201) {
int SDL_GetSystemRAM();
}
static if(sdlSupport >= SDLSupport.sdl202) {
SDL_bool SDL_HasAVX();
}
static if(sdlSupport >= SDLSupport.sdl204) {
SDL_bool SDL_HasAVX2();
}
static if(sdlSupport >= SDLSupport.sdl206) {
SDL_bool SDL_HasNEON();
}
static if(sdlSupport >= SDLSupport.sdl209) {
SDL_bool SDL_HasAVX512F();
}
static if(sdlSupport >= SDLSupport.sdl2010) {
size_t SDL_SIMDGetAlignment();
void* SDL_SIMDAlloc(const(size_t));
void SDL_SIMDFree(void*);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetCPUCount = int function();
alias pSDL_GetCPUCacheLineSize = int function();
alias pSDL_HasRDTSC = SDL_bool function();
alias pSDL_HasAltiVec = SDL_bool function();
alias pSDL_HasMMX = SDL_bool function();
alias pSDL_Has3DNow = SDL_bool function();
alias pSDL_HasSSE = SDL_bool function();
alias pSDL_HasSSE2 = SDL_bool function();
alias pSDL_HasSSE3 = SDL_bool function();
alias pSDL_HasSSE41 = SDL_bool function();
alias pSDL_HasSSE42 = SDL_bool function();
}
__gshared {
pSDL_GetCPUCount SDL_GetCPUCount;
pSDL_GetCPUCacheLineSize SDL_GetCPUCacheLineSize;
pSDL_HasRDTSC SDL_HasRDTSC;
pSDL_HasAltiVec SDL_HasAltiVec;
pSDL_HasMMX SDL_HasMMX;
pSDL_Has3DNow SDL_Has3DNow;
pSDL_HasSSE SDL_HasSSE;
pSDL_HasSSE2 SDL_HasSSE2;
pSDL_HasSSE3 SDL_HasSSE3;
pSDL_HasSSE41 SDL_HasSSE41;
pSDL_HasSSE42 SDL_HasSSE42;
}
static if(sdlSupport >= SDLSupport.sdl201) {
extern(C) @nogc nothrow {
alias pSDL_GetSystemRAM = int function();
}
__gshared {
pSDL_GetSystemRAM SDL_GetSystemRAM;
}
}
static if(sdlSupport >= SDLSupport.sdl202) {
extern(C) @nogc nothrow {
alias pSDL_HasAVX = SDL_bool function();
}
__gshared {
pSDL_HasAVX SDL_HasAVX;
}
}
static if(sdlSupport >= SDLSupport.sdl204) {
extern(C) @nogc nothrow {
alias pSDL_HasAVX2 = SDL_bool function();
}
__gshared {
pSDL_HasAVX2 SDL_HasAVX2;
}
}
static if(sdlSupport >= SDLSupport.sdl206) {
extern(C) @nogc nothrow {
alias pSDL_HasNEON = SDL_bool function();
}
__gshared {
pSDL_HasNEON SDL_HasNEON;
}
}
static if(sdlSupport >= SDLSupport.sdl209) {
extern(C) @nogc nothrow {
alias pSDL_HasAVX512F = SDL_bool function();
}
__gshared {
pSDL_HasAVX512F SDL_HasAVX512F;
}
}
static if(sdlSupport >= SDLSupport.sdl2010) {
extern(C) @nogc nothrow {
alias pSDL_SIMDGetAlignment = size_t function();
alias pSDL_SIMDAlloc = void* function(const(size_t));
alias pSDL_SIMDFree = void function(void*);
}
__gshared {
pSDL_SIMDGetAlignment SDL_SIMDGetAlignment;
pSDL_SIMDAlloc SDL_SIMDAlloc;
pSDL_SIMDFree SDL_SIMDFree;
}
}
}

View file

@ -0,0 +1,28 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlerror;
version(BindSDL_Static) {
extern(C) @nogc nothrow {
void SDL_SetError(const(char)*,...);
const(char)* SDL_GetError();
void SDL_ClearError();
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_SetError = void function(const(char)*,...);
alias pSDL_GetError = const(char)* function();
alias pSDL_ClearError = void function();
}
__gshared {
pSDL_SetError SDL_SetError;
pSDL_GetError SDL_GetError;
pSDL_ClearError SDL_ClearError;
}
}

View file

@ -0,0 +1,674 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlevents;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlgesture,
bindbc.sdl.bind.sdljoystick,
bindbc.sdl.bind.sdlkeyboard,
bindbc.sdl.bind.sdlkeycode,
bindbc.sdl.bind.sdlstdinc,
bindbc.sdl.bind.sdlsyswm,
bindbc.sdl.bind.sdltouch,
bindbc.sdl.bind.sdlvideo;
enum {
SDL_RELEASED = 0,
SDL_PRESSED = 1,
}
static if(sdlSupport >= SDLSupport.sdl209) {
enum SDL_EventType {
SDL_FIRSTEVENT = 0,
SDL_QUIT = 0x100,
SDL_APP_TERMINATING,
SDL_APP_LOWMEMORY,
SDL_APP_WILLENTERBACKGROUND,
SDL_APP_DIDENTERBACKGROUND,
SDL_APP_WILLENTERFOREGROUND,
SDL_APP_DIDENTERFOREGROUND,
SDL_DISPLAYEVENT = 0x150,
SDL_WINDOWEVENT = 0x200,
SDL_SYSWMEVENT,
SDL_KEYDOWN = 0x300,
SDL_KEYUP,
SDL_TEXTEDITING,
SDL_TEXTINPUT,
SDL_KEYMAPCHANGED,
SDL_MOUSEMOTION = 0x400,
SDL_MOUSEBUTTONDOWN,
SDL_MOUSEBUTTONUP,
SDL_MOUSEWHEEL,
SDL_JOYAXISMOTION = 0x600,
SDL_JOYBALLMOTION,
SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN,
SDL_JOYBUTTONUP,
SDL_JOYDEVICEADDED,
SDL_JOYDEVICEREMOVED,
SDL_CONTROLLERAXISMOTION = 0x650,
SDL_CONTROLLERBUTTONDOWN,
SDL_CONTROLLERBUTTONUP,
SDL_CONTROLLERDEVICEADDED,
SDL_CONTROLLERDEVICEREMOVED,
SDL_CONTROLLERDEVICEREMAPPED,
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_DOLLARGESTURE = 0x800,
SDL_DOLLARRECORD,
SDL_MULTIGESTURE,
SDL_CLIPBOARDUPDATE = 0x900,
SDL_DROPFILE = 0x1000,
SDL_DROPTEXT,
SDL_DROPBEGIN,
SDL_DROPCOMPLETE,
SDL_AUDIODEVICEADDED = 0x1100,
SDL_AUDIODEVICEREMOVED,
SDL_SENSORUPDATE = 0x1200,
SDL_RENDER_TARGETS_RESET = 0x2000,
SDL_RENDER_DEVICE_RESET,
SDL_USEREVENT = 0x8000,
SDL_LASTEVENT = 0xFFFF
}
}
else static if(sdlSupport >= SDLSupport.sdl205) {
enum SDL_EventType {
SDL_FIRSTEVENT = 0,
SDL_QUIT = 0x100,
SDL_APP_TERMINATING,
SDL_APP_LOWMEMORY,
SDL_APP_WILLENTERBACKGROUND,
SDL_APP_DIDENTERBACKGROUND,
SDL_APP_WILLENTERFOREGROUND,
SDL_APP_DIDENTERFOREGROUND,
SDL_WINDOWEVENT = 0x200,
SDL_SYSWMEVENT,
SDL_KEYDOWN = 0x300,
SDL_KEYUP,
SDL_TEXTEDITING,
SDL_TEXTINPUT,
SDL_KEYMAPCHANGED,
SDL_MOUSEMOTION = 0x400,
SDL_MOUSEBUTTONDOWN,
SDL_MOUSEBUTTONUP,
SDL_MOUSEWHEEL,
SDL_JOYAXISMOTION = 0x600,
SDL_JOYBALLMOTION,
SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN,
SDL_JOYBUTTONUP,
SDL_JOYDEVICEADDED,
SDL_JOYDEVICEREMOVED,
SDL_CONTROLLERAXISMOTION = 0x650,
SDL_CONTROLLERBUTTONDOWN,
SDL_CONTROLLERBUTTONUP,
SDL_CONTROLLERDEVICEADDED,
SDL_CONTROLLERDEVICEREMOVED,
SDL_CONTROLLERDEVICEREMAPPED,
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_DOLLARGESTURE = 0x800,
SDL_DOLLARRECORD,
SDL_MULTIGESTURE,
SDL_CLIPBOARDUPDATE = 0x900,
SDL_DROPFILE = 0x1000,
SDL_DROPTEXT,
SDL_DROPBEGIN,
SDL_DROPCOMPLETE,
SDL_AUDIODEVICEADDED = 0x1100,
SDL_AUDIODEVICEREMOVED,
SDL_RENDER_TARGETS_RESET = 0x2000,
SDL_RENDER_DEVICE_RESET,
SDL_USEREVENT = 0x8000,
SDL_LASTEVENT = 0xFFFF
}
}
else static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_EventType {
SDL_FIRSTEVENT = 0,
SDL_QUIT = 0x100,
SDL_APP_TERMINATING,
SDL_APP_LOWMEMORY,
SDL_APP_WILLENTERBACKGROUND,
SDL_APP_DIDENTERBACKGROUND,
SDL_APP_WILLENTERFOREGROUND,
SDL_APP_DIDENTERFOREGROUND,
SDL_WINDOWEVENT = 0x200,
SDL_SYSWMEVENT,
SDL_KEYDOWN = 0x300,
SDL_KEYUP,
SDL_TEXTEDITING,
SDL_TEXTINPUT,
SDL_KEYMAPCHANGED,
SDL_MOUSEMOTION = 0x400,
SDL_MOUSEBUTTONDOWN,
SDL_MOUSEBUTTONUP,
SDL_MOUSEWHEEL,
SDL_JOYAXISMOTION = 0x600,
SDL_JOYBALLMOTION,
SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN,
SDL_JOYBUTTONUP,
SDL_JOYDEVICEADDED,
SDL_JOYDEVICEREMOVED,
SDL_CONTROLLERAXISMOTION = 0x650,
SDL_CONTROLLERBUTTONDOWN,
SDL_CONTROLLERBUTTONUP,
SDL_CONTROLLERDEVICEADDED,
SDL_CONTROLLERDEVICEREMOVED,
SDL_CONTROLLERDEVICEREMAPPED,
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_DOLLARGESTURE = 0x800,
SDL_DOLLARRECORD,
SDL_MULTIGESTURE,
SDL_CLIPBOARDUPDATE = 0x900,
SDL_DROPFILE = 0x1000,
SDL_AUDIODEVICEADDED = 0x1100,
SDL_AUDIODEVICEREMOVED,
SDL_RENDER_TARGETS_RESET = 0x2000,
SDL_RENDER_DEVICE_RESET,
SDL_USEREVENT = 0x8000,
SDL_LASTEVENT = 0xFFFF
}
}
else static if(sdlSupport >= SDLSupport.sdl201) {
enum SDL_EventType {
SDL_FIRSTEVENT = 0,
SDL_QUIT = 0x100,
SDL_APP_TERMINATING,
SDL_APP_LOWMEMORY,
SDL_APP_WILLENTERBACKGROUND,
SDL_APP_DIDENTERBACKGROUND,
SDL_APP_WILLENTERFOREGROUND,
SDL_APP_DIDENTERFOREGROUND,
SDL_WINDOWEVENT = 0x200,
SDL_SYSWMEVENT,
SDL_KEYDOWN = 0x300,
SDL_KEYUP,
SDL_TEXTEDITING,
SDL_TEXTINPUT,
SDL_MOUSEMOTION = 0x400,
SDL_MOUSEBUTTONDOWN,
SDL_MOUSEBUTTONUP,
SDL_MOUSEWHEEL,
SDL_JOYAXISMOTION = 0x600,
SDL_JOYBALLMOTION,
SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN,
SDL_JOYBUTTONUP,
SDL_JOYDEVICEADDED,
SDL_JOYDEVICEREMOVED,
SDL_CONTROLLERAXISMOTION = 0x650,
SDL_CONTROLLERBUTTONDOWN,
SDL_CONTROLLERBUTTONUP,
SDL_CONTROLLERDEVICEADDED,
SDL_CONTROLLERDEVICEREMOVED,
SDL_CONTROLLERDEVICEREMAPPED,
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_DOLLARGESTURE = 0x800,
SDL_DOLLARRECORD,
SDL_MULTIGESTURE,
SDL_CLIPBOARDUPDATE = 0x900,
SDL_DROPFILE = 0x1000,
SDL_RENDER_TARGETS_RESET = 0x2000,
SDL_USEREVENT = 0x8000,
SDL_LASTEVENT = 0xFFFF
}
}
else {
enum SDL_EventType {
SDL_FIRSTEVENT = 0,
SDL_QUIT = 0x100,
SDL_APP_TERMINATING,
SDL_APP_LOWMEMORY,
SDL_APP_WILLENTERBACKGROUND,
SDL_APP_DIDENTERBACKGROUND,
SDL_APP_WILLENTERFOREGROUND,
SDL_APP_DIDENTERFOREGROUND,
SDL_WINDOWEVENT = 0x200,
SDL_SYSWMEVENT,
SDL_KEYDOWN = 0x300,
SDL_KEYUP,
SDL_TEXTEDITING,
SDL_TEXTINPUT,
SDL_MOUSEMOTION = 0x400,
SDL_MOUSEBUTTONDOWN,
SDL_MOUSEBUTTONUP,
SDL_MOUSEWHEEL,
SDL_JOYAXISMOTION = 0x600,
SDL_JOYBALLMOTION,
SDL_JOYHATMOTION,
SDL_JOYBUTTONDOWN,
SDL_JOYBUTTONUP,
SDL_JOYDEVICEADDED,
SDL_JOYDEVICEREMOVED,
SDL_CONTROLLERAXISMOTION = 0x650,
SDL_CONTROLLERBUTTONDOWN,
SDL_CONTROLLERBUTTONUP,
SDL_CONTROLLERDEVICEADDED,
SDL_CONTROLLERDEVICEREMOVED,
SDL_CONTROLLERDEVICEREMAPPED,
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_DOLLARGESTURE = 0x800,
SDL_DOLLARRECORD,
SDL_MULTIGESTURE,
SDL_CLIPBOARDUPDATE = 0x900,
SDL_DROPFILE = 0x1000,
SDL_USEREVENT = 0x8000,
SDL_LASTEVENT = 0xFFFF
}
}
mixin(expandEnum!SDL_EventType);
struct SDL_CommonEvent {
SDL_EventType type;
uint timestamp;
}
static if(sdlSupport >= SDLSupport.sdl209) {
struct SDL_DisplayEvent {
SDL_EventType type;
uint timestamp;
uint display;
ubyte event;
ubyte padding1;
ubyte padding2;
ubyte padding3;
int data1;
}
}
struct SDL_WindowEvent {
SDL_EventType type;
uint timestamp;
uint windowID;
SDL_WindowEventID event;
ubyte padding1;
ubyte padding2;
ubyte padding3;
int data1;
int data2;
}
struct SDL_KeyboardEvent {
SDL_EventType type;
uint timestamp;
uint windowID;
ubyte state;
ubyte repeat;
ubyte padding2;
ubyte padding3;
SDL_Keysym keysym;
}
enum SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32;
struct SDL_TextEditingEvent {
SDL_EventType type;
uint timestamp;
uint windowID;
char[SDL_TEXTEDITINGEVENT_TEXT_SIZE] text;
int start;
int length;
}
enum SDL_TEXTINPUTEVENT_TEXT_SIZE = 32;
struct SDL_TextInputEvent {
SDL_EventType type;
uint timestamp;
uint windowID;
char[SDL_TEXTINPUTEVENT_TEXT_SIZE] text;
}
struct SDL_MouseMotionEvent {
SDL_EventType type;
uint timestamp;
uint windowID;
uint which;
uint state;
int x;
int y;
int xrel;
int yrel;
}
struct SDL_MouseButtonEvent {
SDL_EventType type;
uint timestamp;
uint windowID;
uint which;
ubyte button;
ubyte state;
static if(sdlSupport == SDLSupport.sdl200) {
ubyte padding1;
ubyte padding2;
}
else {
ubyte clicks;
ubyte padding1;
}
int x;
int y;
}
struct SDL_MouseWheelEvent {
SDL_EventType type;
uint timestamp;
uint windowID;
uint which;
int x;
int y;
static if(sdlSupport >= SDLSupport.sdl204) {
uint direction;
}
}
struct SDL_JoyAxisEvent {
SDL_EventType type;
uint timestamp;
SDL_JoystickID which;
ubyte axis;
ubyte padding1;
ubyte padding2;
ubyte padding3;
short value;
ushort padding4;
}
struct SDL_JoyBallEvent {
SDL_EventType type;
uint timestamp;
SDL_JoystickID which;
ubyte ball;
ubyte padding1;
ubyte padding2;
ubyte padding3;
short xrel;
short yrel;
}
struct SDL_JoyHatEvent {
SDL_EventType type;
uint timestamp;
SDL_JoystickID which;
ubyte hat;
ubyte value;
ubyte padding1;
ubyte padding2;
}
struct SDL_JoyButtonEvent {
SDL_EventType type;
uint timestamp;
SDL_JoystickID which;
ubyte button;
ubyte state;
ubyte padding1;
ubyte padding2;
}
struct SDL_JoyDeviceEvent {
SDL_EventType type;
uint timestamp;
int which;
}
struct SDL_ControllerAxisEvent {
SDL_EventType type;
uint timestamp;
SDL_JoystickID which;
ubyte axis;
ubyte padding1;
ubyte padding2;
ubyte padding3;
short value;
ushort padding4;
}
struct SDL_ControllerButtonEvent {
SDL_EventType type;
uint timestamp;
SDL_JoystickID which;
ubyte button;
ubyte state;
ubyte padding1;
ubyte padding2;
}
struct SDL_ControllerDeviceEvent {
SDL_EventType type;
uint timestamp;
int which;
}
static if(sdlSupport >= SDLSupport.sdl204) {
struct SDL_AudioDeviceEvent {
uint type;
uint timestamp;
uint which;
ubyte iscapture;
ubyte padding1;
ubyte padding2;
ubyte padding3;
}
}
struct SDL_TouchFingerEvent {
SDL_EventType type;
uint timestamp;
SDL_TouchID touchId;
SDL_FingerID fingerId;
float x;
float y;
float dx;
float dy;
float pressure;
}
struct SDL_MultiGestureEvent {
SDL_EventType type;
uint timestamp;
SDL_TouchID touchId;
float dTheta;
float dDist;
float x;
float y;
ushort numFingers;
ushort padding;
}
struct SDL_DollarGestureEvent {
SDL_EventType type;
uint timestamp;
SDL_TouchID touchId;
SDL_GestureID gestureId;
uint numFingers;
float error;
float x;
float y;
}
struct SDL_DropEvent {
SDL_EventType type;
uint timestamp;
char* file;
static if(sdlSupport >= SDLSupport.sdl205) {
uint windowID;
}
}
struct SDL_SensorEvent {
SDL_EventType type;
uint timestamp;
int which;
float[6] data;
}
struct SDL_QuitEvent {
SDL_EventType type;
uint timestamp;
}
struct SDL_OSEvent {
SDL_EventType type;
uint timestamp;
}
struct SDL_UserEvent {
SDL_EventType type;
uint timestamp;
uint windowID;
int code;
void* data1;
void* data2;
}
struct SDL_SysWMEvent {
SDL_EventType type;
uint timestamp;
SDL_SysWMmsg* msg;
}
union SDL_Event {
SDL_EventType type;
SDL_CommonEvent common;
static if(sdlSupport >= SDLSupport.sdl209) {
SDL_DisplayEvent display;
}
SDL_WindowEvent window;
SDL_KeyboardEvent key;
SDL_TextEditingEvent edit;
SDL_TextInputEvent text;
SDL_MouseMotionEvent motion;
SDL_MouseButtonEvent button;
SDL_MouseWheelEvent wheel;
SDL_JoyAxisEvent jaxis;
SDL_JoyBallEvent jball;
SDL_JoyHatEvent jhat;
SDL_JoyButtonEvent jbutton;
SDL_JoyDeviceEvent jdevice;
SDL_ControllerAxisEvent caxis;
SDL_ControllerButtonEvent cbutton;
SDL_ControllerDeviceEvent cdevice;
static if(sdlSupport >= SDLSupport.sdl204) {
SDL_AudioDeviceEvent adevice;
}
static if(sdlSupport >= SDLSupport.sdl209) {
SDL_SensorEvent sensor;
}
SDL_QuitEvent quit;
SDL_UserEvent user;
SDL_SysWMEvent syswm;
SDL_TouchFingerEvent tfinger;
SDL_MultiGestureEvent mgesture;
SDL_DollarGestureEvent dgesture;
SDL_DropEvent drop;
ubyte[56] padding;
}
enum SDL_eventaction {
SDL_ADDEVENT,
SDL_PEEKEVENT,
SDL_GETEVENT
}
alias SDL_EventAction = SDL_eventaction;
mixin(expandEnum!SDL_EventAction);
extern(C) nothrow alias SDL_EventFilter = int function(void* userdata, SDL_Event* event);
enum {
SDL_QUERY = -1,
SDL_IGNORE = 0,
SDL_DISABLE = 0,
SDL_ENABLE = 1,
}
@nogc nothrow {
int SDL_GetEventState(SDL_EventType type) {
pragma(inline, true);
return SDL_EventState(type, SDL_QUERY);
}
// This is implemented in SDL_quit.h, but works better here.
bool SDL_QuitRequested() {
pragma(inline, true);
SDL_PumpEvents();
return SDL_PeepEvents(null,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0;
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
void SDL_PumpEvents();
int SDL_PeepEvents(SDL_Event*,int,SDL_eventaction,uint,uint);
SDL_bool SDL_HasEvent(uint);
SDL_bool SDL_HasEvents(uint,uint);
void SDL_FlushEvent(uint);
void SDL_FlushEvents(uint,uint);
int SDL_PollEvent(SDL_Event*);
int SDL_WaitEvent(SDL_Event*);
int SDL_WaitEventTimeout(SDL_Event*,int);
int SDL_PushEvent(SDL_Event*);
void SDL_SetEventFilter(SDL_EventFilter,void*);
SDL_bool SDL_GetEventFilter(SDL_EventFilter*,void**);
void SDL_AddEventWatch(SDL_EventFilter,void*);
void SDL_DelEventWatch(SDL_EventFilter,void*);
void SDL_FilterEvents(SDL_EventFilter,void*);
ubyte SDL_EventState(uint,int);
uint SDL_RegisterEvents(int);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_PumpEvents = void function();
alias pSDL_PeepEvents = int function(SDL_Event*,int,SDL_eventaction,uint,uint);
alias pSDL_HasEvent = SDL_bool function(uint);
alias pSDL_HasEvents = SDL_bool function(uint,uint);
alias pSDL_FlushEvent = void function(uint);
alias pSDL_FlushEvents = void function(uint,uint);
alias pSDL_PollEvent = int function(SDL_Event*);
alias pSDL_WaitEvent = int function(SDL_Event*);
alias pSDL_WaitEventTimeout = int function(SDL_Event*,int);
alias pSDL_PushEvent = int function(SDL_Event*);
alias pSDL_SetEventFilter = void function(SDL_EventFilter,void*);
alias pSDL_GetEventFilter = SDL_bool function(SDL_EventFilter*,void**);
alias pSDL_AddEventWatch = void function(SDL_EventFilter,void*);
alias pSDL_DelEventWatch = void function(SDL_EventFilter,void*);
alias pSDL_FilterEvents = void function(SDL_EventFilter,void*);
alias pSDL_EventState = ubyte function(uint,int);
alias pSDL_RegisterEvents = uint function(int);
}
__gshared {
pSDL_PumpEvents SDL_PumpEvents;
pSDL_PeepEvents SDL_PeepEvents;
pSDL_HasEvent SDL_HasEvent;
pSDL_HasEvents SDL_HasEvents;
pSDL_FlushEvent SDL_FlushEvent;
pSDL_FlushEvents SDL_FlushEvents;
pSDL_PollEvent SDL_PollEvent;
pSDL_WaitEvent SDL_WaitEvent;
pSDL_WaitEventTimeout SDL_WaitEventTimeout;
pSDL_PushEvent SDL_PushEvent;
pSDL_SetEventFilter SDL_SetEventFilter;
pSDL_GetEventFilter SDL_GetEventFilter;
pSDL_AddEventWatch SDL_AddEventWatch;
pSDL_DelEventWatch SDL_DelEventWatch;
pSDL_FilterEvents SDL_FilterEvents;
pSDL_EventState SDL_EventState;
pSDL_RegisterEvents SDL_RegisterEvents;
}
}

View file

@ -0,0 +1,31 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlfilesystem;
import bindbc.sdl.config;
version(BindSDL_Static){
extern(C) @nogc nothrow {
static if(sdlSupport >= SDLSupport.sdl201) {
char* SDL_GetBasePath();
char* SDL_GetPrefPath(const(char)* org,const(char)* app);
}
}
}
else {
static if(sdlSupport >= SDLSupport.sdl201) {
extern(C) @nogc nothrow {
alias pSDL_GetBasePath = char* function();
alias pSDL_GetPrefPath = char* function(const(char)* org,const(char)* app);
}
__gshared {
pSDL_GetBasePath SDL_GetBasePath;
pSDL_GetPrefPath SDL_GetPrefPath;
}
}
}

View file

@ -0,0 +1,225 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlgamecontroller;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdljoystick,
bindbc.sdl.bind.sdlrwops;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
struct SDL_GameController;
enum SDL_GameControllerBindType {
SDL_CONTROLLER_BINDTYPE_NONE = 0,
SDL_CONTROLLER_BINDTYPE_BUTTON,
SDL_CONTROLLER_BINDTYPE_AXIS,
SDL_CONTROLLER_BINDTYPE_HAT,
}
mixin(expandEnum!SDL_GameControllerBindType);
struct SDL_GameControllerButtonBind {
SDL_GameControllerBindType bindType;
union value {
int button;
int axis;
struct hat {
int hat;
int hat_mask;
}
}
alias button = value.button;
alias axis = value.axis;
alias hat = value.hat;
}
enum SDL_GameControllerAxis {
SDL_CONTROLLER_AXIS_INVALID = -1,
SDL_CONTROLLER_AXIS_LEFTX,
SDL_CONTROLLER_AXIS_LEFTY,
SDL_CONTROLLER_AXIS_RIGHTX,
SDL_CONTROLLER_AXIS_RIGHTY,
SDL_CONTROLLER_AXIS_TRIGGERLEFT,
SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
SDL_CONTROLLER_AXIS_MAX
}
mixin(expandEnum!SDL_GameControllerAxis);
enum SDL_GameControllerButton {
SDL_CONTROLLER_BUTTON_INVALID = -1,
SDL_CONTROLLER_BUTTON_A,
SDL_CONTROLLER_BUTTON_B,
SDL_CONTROLLER_BUTTON_X,
SDL_CONTROLLER_BUTTON_Y,
SDL_CONTROLLER_BUTTON_BACK,
SDL_CONTROLLER_BUTTON_GUIDE,
SDL_CONTROLLER_BUTTON_START,
SDL_CONTROLLER_BUTTON_LEFTSTICK,
SDL_CONTROLLER_BUTTON_RIGHTSTICK,
SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
SDL_CONTROLLER_BUTTON_DPAD_UP,
SDL_CONTROLLER_BUTTON_DPAD_DOWN,
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
SDL_CONTROLLER_BUTTON_MAX
}
mixin(expandEnum!SDL_GameControllerButton);
static if(sdlSupport >= SDLSupport.sdl202) {
@nogc nothrow
int SDL_GameControllerAddMappingsFromFile(const(char)* file) {
pragma(inline, true);
return SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file,"rb"),1);
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_GameControllerAddMapping(const(char)*);
char* SDL_GameControllerMappingForGUID(SDL_JoystickGUID);
char* SDL_GameControllerMapping(SDL_GameController*);
SDL_bool SDL_IsGameController(int);
const(char)* SDL_GameControllerNameForIndex(int);
SDL_GameController* SDL_GameControllerOpen(int);
const(char)* SDL_GameControllerName(SDL_GameController*);
SDL_bool SDL_GameControllerGetAttached(SDL_GameController*);
SDL_Joystick* SDL_GameControllerGetJoystick(SDL_GameController*);
int SDL_GameControllerEventState(int);
void SDL_GameControllerUpdate();
SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const(char)*);
const(char)* SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis);
SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController*,SDL_GameControllerAxis);
short SDL_GameControllerGetAxis(SDL_GameController*,SDL_GameControllerAxis);
SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const(char*));
const(char)* SDL_GameControllerGetStringForButton(SDL_GameControllerButton);
SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController*,SDL_GameControllerButton);
ubyte SDL_GameControllerGetButton(SDL_GameController*,SDL_GameControllerButton);
void SDL_GameControllerClose(SDL_GameController*);
static if(sdlSupport >= SDLSupport.sdl202) {
int SDL_GameControllerAddMappingsFromRW(SDL_RWops*,int);
}
static if(sdlSupport >= SDLSupport.sdl204) {
SDL_GameController* SDL_GameControllerFromInstanceID(SDL_JoystickID);
}
static if(sdlSupport >= SDLSupport.sdl206) {
ushort SDL_GameControllerGetProduct(SDL_GameController*);
ushort SDL_GameControllerGetProductVersion(SDL_GameController*);
ushort SDL_GameControllerGetVendor(SDL_GameController*);
char* SDL_GameControllerMappingForIndex(int);
int SDL_GameControllerNumMappings();
}
static if(sdlSupport >= SDLSupport.sdl209) {
char* SDL_GameControllerMappingForDeviceIndex(int);
int SDL_GameControllerRumble(SDL_GameController*,ushort,ushort,uint);
}
static if(sdlSupport >= SDLSupport.sdl2010) {
int SDL_GameControllerGetPlayerIndex(SDL_GameController*);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GameControllerAddMapping = int function(const(char)*);
alias pSDL_GameControllerMappingForGUID = char* function(SDL_JoystickGUID);
alias pSDL_GameControllerMapping = char* function(SDL_GameController*);
alias pSDL_IsGameController = SDL_bool function(int);
alias pSDL_GameControllerNameForIndex = const(char)* function(int);
alias pSDL_GameControllerOpen = SDL_GameController* function(int);
alias pSDL_GameControllerName = const(char)* function(SDL_GameController*);
alias pSDL_GameControllerGetAttached = SDL_bool function(SDL_GameController*);
alias pSDL_GameControllerGetJoystick = SDL_Joystick* function(SDL_GameController*);
alias pSDL_GameControllerEventState = int function(int);
alias pSDL_GameControllerUpdate = void function();
alias pSDL_GameControllerGetAxisFromString = SDL_GameControllerAxis function(const(char)*);
alias pSDL_GameControllerGetStringForAxis = const(char)* function(SDL_GameControllerAxis);
alias pSDL_GameControllerGetBindForAxis = SDL_GameControllerButtonBind function(SDL_GameController*,SDL_GameControllerAxis);
alias pSDL_GameControllerGetAxis = short function(SDL_GameController*,SDL_GameControllerAxis);
alias pSDL_GameControllerGetButtonFromString = SDL_GameControllerButton function(const(char*));
alias pSDL_GameControllerGetStringForButton = const(char)* function(SDL_GameControllerButton);
alias pSDL_GameControllerGetBindForButton = SDL_GameControllerButtonBind function(SDL_GameController*,SDL_GameControllerButton);
alias pSDL_GameControllerGetButton = ubyte function(SDL_GameController*,SDL_GameControllerButton);
alias pSDL_GameControllerClose = void function(SDL_GameController*);
}
__gshared {
pSDL_GameControllerAddMapping SDL_GameControllerAddMapping;
pSDL_GameControllerMappingForGUID SDL_GameControllerMappingForGUID;
pSDL_GameControllerMapping SDL_GameControllerMapping;
pSDL_IsGameController SDL_IsGameController;
pSDL_GameControllerNameForIndex SDL_GameControllerNameForIndex;
pSDL_GameControllerOpen SDL_GameControllerOpen;
pSDL_GameControllerName SDL_GameControllerName;
pSDL_GameControllerGetAttached SDL_GameControllerGetAttached;
pSDL_GameControllerGetJoystick SDL_GameControllerGetJoystick;
pSDL_GameControllerEventState SDL_GameControllerEventState;
pSDL_GameControllerUpdate SDL_GameControllerUpdate;
pSDL_GameControllerGetAxisFromString SDL_GameControllerGetAxisFromString;
pSDL_GameControllerGetStringForAxis SDL_GameControllerGetStringForAxis;
pSDL_GameControllerGetBindForAxis SDL_GameControllerGetBindForAxis;
pSDL_GameControllerGetAxis SDL_GameControllerGetAxis;
pSDL_GameControllerGetButtonFromString SDL_GameControllerGetButtonFromString;
pSDL_GameControllerGetStringForButton SDL_GameControllerGetStringForButton;
pSDL_GameControllerGetBindForButton SDL_GameControllerGetBindForButton;
pSDL_GameControllerGetButton SDL_GameControllerGetButton;
pSDL_GameControllerClose SDL_GameControllerClose;
}
static if(sdlSupport >= SDLSupport.sdl202) {
extern(C) @nogc nothrow {
alias pSDL_GameControllerAddMappingsFromRW = int function(SDL_RWops*,int);
}
__gshared {
pSDL_GameControllerAddMappingsFromRW SDL_GameControllerAddMappingsFromRW;
}
}
static if(sdlSupport >= SDLSupport.sdl204) {
extern(C) @nogc nothrow {
alias pSDL_GameControllerFromInstanceID = SDL_GameController* function(SDL_JoystickID);
}
__gshared {
pSDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID;
}
}
static if(sdlSupport >= SDLSupport.sdl206) {
extern(C) @nogc nothrow {
alias pSDL_GameControllerGetProduct = ushort function(SDL_GameController*);
alias pSDL_GameControllerGetProductVersion = ushort function(SDL_GameController*);
alias pSDL_GameControllerGetVendor = ushort function(SDL_GameController*);
alias pSDL_GameControllerMappingForIndex = char* function(int);
alias pSDL_GameControllerNumMappings = int function();
}
__gshared {
pSDL_GameControllerGetProduct SDL_GameControllerGetProduct;
pSDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion;
pSDL_GameControllerGetVendor SDL_GameControllerGetVendor;
pSDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex;
pSDL_GameControllerNumMappings SDL_GameControllerNumMappings;
}
}
static if(sdlSupport >= SDLSupport.sdl209) {
extern(C) @nogc nothrow {
alias pSDL_GameControllerMappingForDeviceIndex = char* function(int);
alias pSDL_GameControllerRumble = int function(SDL_GameController*,ushort,ushort,uint);
}
__gshared {
pSDL_GameControllerMappingForDeviceIndex SDL_GameControllerMappingForDeviceIndex;
pSDL_GameControllerRumble SDL_GameControllerRumble;
}
}
static if(sdlSupport >= SDLSupport.sdl2010) {
extern(C) @nogc nothrow {
alias pSDL_GameControllerGetPlayerIndex = int function(SDL_GameController*);
}
__gshared {
pSDL_GameControllerGetPlayerIndex SDL_GameControllerGetPlayerIndex;
}
}
}

View file

@ -0,0 +1,36 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlgesture;
import bindbc.sdl.bind.sdltouch : SDL_TouchID;
import bindbc.sdl.bind.sdlrwops : SDL_RWops;
alias SDL_GestureID = long;
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_RecordGesture(SDL_TouchID);
int SDL_SaveAllDollarTemplates(SDL_RWops*);
int SDL_SaveDollarTemplate(SDL_GestureID,SDL_RWops*);
int SDL_LoadDollarTemplates(SDL_TouchID,SDL_RWops*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_RecordGesture = int function(SDL_TouchID);
alias pSDL_SaveAllDollarTemplates = int function(SDL_RWops*);
alias pSDL_SaveDollarTemplate = int function(SDL_GestureID,SDL_RWops*);
alias pSDL_LoadDollarTemplates = int function(SDL_TouchID,SDL_RWops*);
}
__gshared {
pSDL_RecordGesture SDL_RecordGesture;
pSDL_SaveAllDollarTemplates SDL_SaveAllDollarTemplates;
pSDL_SaveDollarTemplate SDL_SaveDollarTemplate;
pSDL_LoadDollarTemplates SDL_LoadDollarTemplates;
}
}

View file

@ -0,0 +1,240 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlhaptic;
import bindbc.sdl.bind.sdljoystick : SDL_Joystick;
struct SDL_Haptic;
enum : ushort {
SDL_HAPTIC_CONSTANT = 1u<<0,
SDL_HAPTIC_SINE = 1u<<1,
SDL_HAPTIC_LEFTRIGHT = 1u<<2,
SDL_HAPTIC_TRIANGLE = 1u<<3,
SDL_HAPTIC_SAWTOOTHUP = 1u<<4,
SDL_HAPTIC_SAWTOOTHDOWN = 1u<<5,
SDL_HAPTIC_RAMP = 1u<<6,
SDL_HAPTIC_SPRING = 1u<<7,
SDL_HAPTIC_DAMPER = 1u<<8,
SDL_HAPTIC_INERTIA = 1u<<9,
SDL_HAPTIC_FRICTION = 1u<<10,
SDL_HAPTIC_CUSTOM = 1u<<11,
SDL_HAPTIC_GAIN = 1u<<12,
SDL_HAPTIC_AUTOCENTER = 1u<<13,
SDL_HAPTIC_STATUS = 1u<<14,
SDL_HAPTIC_PAUSE = 1u<<15,
}
enum {
SDL_HAPTIC_POLAR = 0,
SDL_HAPTIC_CARTESIAN = 1,
SDL_HAPTIC_SPHERICAL = 2,
}
enum SDL_HAPTIC_INFINITY = 4294967295U;
struct SDL_HapticDirection {
ubyte type;
int[3] dir;
}
struct SDL_HapticConstant {
ushort type;
SDL_HapticDirection direction;
uint length;
ushort delay;
ushort button;
ushort interval;
short level;
ushort attack_length;
ushort attack_level;
ushort fade_length;
ushort fade_level;
}
struct SDL_HapticPeriodic {
ushort type;
SDL_HapticDirection direction;
uint length;
uint delay;
ushort button;
ushort interval;
ushort period;
short magnitude;
short offset;
ushort phase;
ushort attack_length;
ushort attack_level;
ushort fade_length;
ushort fade_level;
}
struct SDL_HapticCondition {
ushort type;
SDL_HapticDirection direciton;
uint length;
ushort delay;
ushort button;
ushort interval;
ushort[3] right_sat;
ushort[3] left_sat;
short[3] right_coeff;
short[3] left_coeff;
ushort[3] deadband;
ushort[3] center;
}
struct SDL_HapticRamp {
ushort type;
SDL_HapticDirection direction;
uint length;
ushort delay;
ushort button;
ushort interval;
short start;
short end;
ushort attack_length;
ushort attack_level;
ushort fade_length;
ushort fade_level;
}
struct SDL_HapticLeftRight {
ushort type;
uint length;
ushort large_magnitude;
ushort small_magnitude;
}
struct SDL_HapticCustom {
ushort type;
SDL_HapticDirection direction;
uint length;
ushort delay;
ushort button;
ushort interval;
ubyte channels;
ushort period;
ushort samples;
ushort* data;
ushort attack_length;
ushort attack_level;
ushort fade_length;
ushort fade_level;
}
union SDL_HapticEffect {
ushort type;
SDL_HapticConstant constant;
SDL_HapticPeriodic periodic;
SDL_HapticCondition condition;
SDL_HapticRamp ramp;
SDL_HapticLeftRight leftright;
SDL_HapticCustom custom;
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_NumHaptics();
const(char)* SDL_HapticName(int);
SDL_Haptic* SDL_HapticOpen(int);
int SDL_HapticOpened(int);
int SDL_HapticIndex(SDL_Haptic*);
int SDL_MouseIsHaptic();
SDL_Haptic* SDL_HapticOpenFromMouse();
int SDL_JoystickIsHaptic(SDL_Joystick*);
SDL_Haptic* SDL_HapticOpenFromJoystick(SDL_Joystick*);
int SDL_HapticClose(SDL_Haptic*);
int SDL_HapticNumEffects(SDL_Haptic*);
int SDL_HapticNumEffectsPlaying(SDL_Haptic*);
uint SDL_HapticQuery(SDL_Haptic*);
int SDL_HapticNumAxes(SDL_Haptic*);
int SDL_HapticEffectSupported(SDL_Haptic*,SDL_HapticEffect*);
int SDL_HapticNewEffect(SDL_Haptic*,SDL_HapticEffect*);
int SDL_HapticUpdateEffect(SDL_Haptic*,int,SDL_HapticEffect*);
int SDL_HapticRunEffect(SDL_Haptic*,int,uint);
int SDL_HapticStopEffect(SDL_Haptic*,int);
int SDL_HapticDestroyEffect(SDL_Haptic*,int);
int SDL_HapticGetEffectStatus(SDL_Haptic*,int);
int SDL_HapticSetGain(SDL_Haptic*,int);
int SDL_HapticSetAutocenter(SDL_Haptic*,int);
int SDL_HapticPause(SDL_Haptic*);
int SDL_HapticUnpause(SDL_Haptic*);
int SDL_HapticStopAll(SDL_Haptic*);
int SDL_HapticRumbleSupported(SDL_Haptic*);
int SDL_HapticRumbleInit(SDL_Haptic*);
int SDL_HapticRumblePlay(SDL_Haptic*,float,uint);
int SDL_HapticRumbleStop(SDL_Haptic*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_NumHaptics = int function();
alias pSDL_HapticName = const(char)* function(int);
alias pSDL_HapticOpen = SDL_Haptic* function(int);
alias pSDL_HapticOpened = int function(int);
alias pSDL_HapticIndex = int function(SDL_Haptic*);
alias pSDL_MouseIsHaptic = int function();
alias pSDL_HapticOpenFromMouse = SDL_Haptic* function();
alias pSDL_JoystickIsHaptic = int function(SDL_Joystick*);
alias pSDL_HapticOpenFromJoystick = SDL_Haptic* function(SDL_Joystick*);
alias pSDL_HapticClose = int function(SDL_Haptic*);
alias pSDL_HapticNumEffects = int function(SDL_Haptic*);
alias pSDL_HapticNumEffectsPlaying = int function(SDL_Haptic*);
alias pSDL_HapticQuery = uint function(SDL_Haptic*);
alias pSDL_HapticNumAxes = int function(SDL_Haptic*);
alias pSDL_HapticEffectSupported = int function(SDL_Haptic*,SDL_HapticEffect*);
alias pSDL_HapticNewEffect = int function(SDL_Haptic*,SDL_HapticEffect*);
alias pSDL_HapticUpdateEffect = int function(SDL_Haptic*,int,SDL_HapticEffect*);
alias pSDL_HapticRunEffect = int function(SDL_Haptic*,int,uint);
alias pSDL_HapticStopEffect = int function(SDL_Haptic*,int);
alias pSDL_HapticDestroyEffect = int function(SDL_Haptic*,int);
alias pSDL_HapticGetEffectStatus = int function(SDL_Haptic*,int);
alias pSDL_HapticSetGain = int function(SDL_Haptic*,int);
alias pSDL_HapticSetAutocenter = int function(SDL_Haptic*,int);
alias pSDL_HapticPause = int function(SDL_Haptic*);
alias pSDL_HapticUnpause = int function(SDL_Haptic*);
alias pSDL_HapticStopAll = int function(SDL_Haptic*);
alias pSDL_HapticRumbleSupported = int function(SDL_Haptic*);
alias pSDL_HapticRumbleInit = int function(SDL_Haptic*);
alias pSDL_HapticRumblePlay = int function(SDL_Haptic*,float,uint);
alias pSDL_HapticRumbleStop = int function(SDL_Haptic*);
}
__gshared {
pSDL_NumHaptics SDL_NumHaptics;
pSDL_HapticName SDL_HapticName;
pSDL_HapticOpen SDL_HapticOpen;
pSDL_HapticOpened SDL_HapticOpened;
pSDL_HapticIndex SDL_HapticIndex;
pSDL_MouseIsHaptic SDL_MouseIsHaptic;
pSDL_HapticOpenFromMouse SDL_HapticOpenFromMouse;
pSDL_JoystickIsHaptic SDL_JoystickIsHaptic;
pSDL_HapticOpenFromJoystick SDL_HapticOpenFromJoystick;
pSDL_HapticClose SDL_HapticClose;
pSDL_HapticNumEffects SDL_HapticNumEffects;
pSDL_HapticNumEffectsPlaying SDL_HapticNumEffectsPlaying;
pSDL_HapticQuery SDL_HapticQuery;
pSDL_HapticNumAxes SDL_HapticNumAxes;
pSDL_HapticEffectSupported SDL_HapticEffectSupported;
pSDL_HapticNewEffect SDL_HapticNewEffect;
pSDL_HapticUpdateEffect SDL_HapticUpdateEffect;
pSDL_HapticRunEffect SDL_HapticRunEffect;
pSDL_HapticStopEffect SDL_HapticStopEffect;
pSDL_HapticDestroyEffect SDL_HapticDestroyEffect;
pSDL_HapticGetEffectStatus SDL_HapticGetEffectStatus;
pSDL_HapticSetGain SDL_HapticSetGain;
pSDL_HapticSetAutocenter SDL_HapticSetAutocenter;
pSDL_HapticPause SDL_HapticPause;
pSDL_HapticUnpause SDL_HapticUnpause;
pSDL_HapticStopAll SDL_HapticStopAll;
pSDL_HapticRumbleSupported SDL_HapticRumbleSupported;
pSDL_HapticRumbleInit SDL_HapticRumbleInit;
pSDL_HapticRumblePlay SDL_HapticRumblePlay;
pSDL_HapticRumbleStop SDL_HapticRumbleStop;
}
}

View file

@ -0,0 +1,186 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlhints;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
enum SDL_HINT_FRAMEBUFFER_ACCELERATION = "SDL_FRAMEBUFFER_ACCELERATION";
enum SDL_HINT_RENDER_DRIVER = "SDL_RENDER_DRIVER";
enum SDL_HINT_RENDER_OPENGL_SHADERS = "SDL_RENDER_OPENGL_SHADERS";
enum SDL_HINT_RENDER_SCALE_QUALITY = "SDL_RENDER_SCALE_QUALITY";
enum SDL_HINT_RENDER_VSYNC = "SDL_RENDER_VSYNC";
enum SDL_HINT_VIDEO_X11_XVIDMODE = "SDL_VIDEO_X11_XVIDMODE";
enum SDL_HINT_VIDEO_X11_XINERAMA = "SDL_VIDEO_X11_XINERAMA";
enum SDL_HINT_VIDEO_X11_XRANDR = "SDL_VIDEO_X11_XRANDR";
enum SDL_HINT_GRAB_KEYBOARD = "SDL_GRAB_KEYBOARD";
enum SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS";
enum SDL_HINT_IDLE_TIMER_DISABLED = "SDL_IOS_IDLE_TIMER_DISABLED";
enum SDL_HINT_ORIENTATIONS = "SDL_IOS_ORIENTATIONS";
enum SDL_HINT_XINPUT_ENABLED = "SDL_XINPUT_ENABLED";
enum SDL_HINT_GAMECONTROLLERCONFIG = "SDL_GAMECONTROLLERCONFIG";
enum SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS";
enum SDL_HINT_ALLOW_TOPMOST = "SDL_ALLOW_TOPMOST";
enum SDL_HINT_TIMER_RESOLUTION = "SDL_TIMER_RESOLUTION";
static if(sdlSupport >= SDLSupport.sdl201) {
enum SDL_HINT_RENDER_DIRECT3D_THREADSAFE = "SDL_RENDER_DIRECT3D_THREADSAFE";
enum SDL_HINT_VIDEO_HIGHDPI_DISABLED = "SDL_VIDEO_HIGHDPI_DISABLED";
}
static if(sdlSupport >= SDLSupport.sdl202) {
enum SDL_HINT_VIDEO_ALLOW_SCREENSAVER = "SDL_VIDEO_ALLOW_SCREENSAVER";
enum SDL_HINT_MOUSE_RELATIVE_MODE_WARP = "SDL_MOUSE_RELATIVE_MODE_WARP";
enum SDL_HINT_ACCELEROMETER_AS_JOYSTICK = "SDL_ACCELEROMETER_AS_JOYSTICK";
enum SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK";
enum SDL_HINT_VIDEO_WIN_D3DCOMPILER = "SDL_VIDEO_WIN_D3DCOMPILER";
enum SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT";
enum SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES = "SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES";
}
// This is *intended* to be == and not >=. The values for all of these changed in 2.0.4.
static if(sdlSupport == SDLSupport.sdl203) {
enum SDL_HINT_RENDER_DIRECT3D11_DEBUG = "SDL_HINT_RENDER_DIRECT3D11_DEBUG";
enum SDL_HINT_WINRT_PRIVACY_POLICY_URL = "SDL_HINT_WINRT_PRIVACY_POLICY_URL";
enum SDL_HINT_WINRT_PRIVACY_POLICY_LABEL = "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL";
enum SDL_HINT_WINRT_HANDLE_BACK_BUTTON = "SDL_HINT_WINRT_HANDLE_BACK_BUTTON";
}
static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_HINT_VIDEO_X11_NET_WM_PING = "SDL_VIDEO_X11_NET_WM_PING";
enum SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN";
enum SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP = "SDL_WINDOWS_ENABLE_MESSAGELOOP";
enum SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING";
enum SDL_HINT_THREAD_STACK_SIZE = "SDL_THREAD_STACK_SIZE";
enum SDL_HINT_MAC_BACKGROUND_APP = "SDL_MAC_BACKGROUND_APP";
enum SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION = "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION";
enum SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION";
enum SDL_HINT_IME_INTERNAL_EDITING = "SDL_IME_INTERNAL_EDITING";
enum SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT";
enum SDL_HINT_NO_SIGNAL_HANDLERS = "SDL_NO_SIGNAL_HANDLERS";
enum SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 = "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4";
// Changed values from those introduced in 2.0.3
enum SDL_HINT_RENDER_DIRECT3D11_DEBUG = "SDL_RENDER_DIRECT3D11_DEBUG";
enum SDL_HINT_WINRT_PRIVACY_POLICY_URL = "SDL_WINRT_PRIVACY_POLICY_URL";
enum SDL_HINT_WINRT_PRIVACY_POLICY_LABEL = "SDL_WINRT_PRIVACY_POLICY_LABEL";
enum SDL_HINT_WINRT_HANDLE_BACK_BUTTON = "SDL_WINRT_HANDLE_BACK_BUTTON";
}
static if(sdlSupport >= SDLSupport.sdl205) {
enum SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH = "SDL_MOUSE_FOCUS_CLICKTHROUGH";
enum SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS = "SDL_APPLE_TV_CONTROLLER_UI_EVENTS";
enum SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION = "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION";
enum SDL_HINT_BMP_SAVE_LEGACY_FORMAT = "SDL_BMP_SAVE_LEGACY_FORMAT";
enum SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING = "SDL_WINDOWS_DISABLE_THREAD_NAMING";
enum SDL_HINT_RPI_VIDEO_LAYER = "SDL_RPI_VIDEO_LAYER";
}
static if(sdlSupport >= SDLSupport.sdl206) {
enum SDL_HINT_RENDER_LOGICAL_SIZE_MODE = "SDL_RENDER_LOGICAL_SIZE_MODE";
enum SDL_HINT_WINDOWS_INTRESOURCE_ICON = "SDL_WINDOWS_INTRESOURCE_ICON";
enum SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL = "SDL_WINDOWS_INTRESOURCE_ICON_SMALL";
enum SDL_HINT_MOUSE_NORMAL_SPEED_SCALE = "SDL_MOUSE_NORMAL_SPEED_SCALE";
enum SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE = "SDL_MOUSE_RELATIVE_SPEED_SCALE";
enum SDL_HINT_TOUCH_MOUSE_EVENTS = "SDL_TOUCH_MOUSE_EVENTS";
enum SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES = "SDL_GAMECONTROLLER_IGNORE_DEVICES";
enum SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT = "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT";
enum SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION = "SDL_QTWAYLAND_CONTENT_ORIENTATION";
enum SDL_HINT_QTWAYLAND_WINDOW_FLAGS = "SDL_QTWAYLAND_WINDOW_FLAGS";
enum SDL_HINT_OPENGL_ES_DRIVER = "SDL_OPENGL_ES_DRIVER";
enum SDL_HINT_AUDIO_RESAMPLING_MODE = "SDL_AUDIO_RESAMPLING_MODE";
enum SDL_HINT_AUDIO_CATEGORY = "SDL_AUDIO_CATEGORY";
}
static if(sdlSupport >= SDLSupport.sdl208) {
enum SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR = "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR";
enum SDL_HINT_IOS_HIDE_HOME_INDICATOR = "SDL_IOS_HIDE_HOME_INDICATOR";
enum SDL_HINT_TV_REMOTE_AS_JOYSTICK = "SDL_TV_REMOTE_AS_JOYSTICK";
enum SDL_HINT_RETURN_KEY_HIDES_IME = "SDL_RETURN_KEY_HIDES_IME";
enum SDL_HINT_VIDEO_DOUBLE_BUFFER = "SDL_VIDEO_DOUBLE_BUFFER";
}
static if(sdlSupport >= SDLSupport.sdl209) {
enum SDL_HINT_MOUSE_DOUBLE_CLICK_TIME = "SDL_MOUSE_DOUBLE_CLICK_TIME";
enum SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS = "SDL_MOUSE_DOUBLE_CLICK_RADIUS";
enum SDL_HINT_JOYSTICK_HIDAPI = "SDL_JOYSTICK_HIDAPI";
enum SDL_HINT_JOYSTICK_HIDAPI_PS4 = "SDL_JOYSTICK_HIDAPI_PS4";
enum SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE = "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE";
enum SDL_HINT_JOYSTICK_HIDAPI_STEAM = "SDL_JOYSTICK_HIDAPI_STEAM";
enum SDL_HINT_JOYSTICK_HIDAPI_SWITCH = "SDL_JOYSTICK_HIDAPI_SWITCH";
enum SDL_HINT_JOYSTICK_HIDAPI_XBOX = "SDL_JOYSTICK_HIDAPI_XBOX";
enum SDL_HINT_ENABLE_STEAM_CONTROLLERS = "SDL_ENABLE_STEAM_CONTROLLERS";
enum SDL_HINT_ANDROID_TRAP_BACK_BUTTON = "SDL_ANDROID_TRAP_BACK_BUTTON";
}
static if(sdlSupport >= SDLSupport.sdl2010) {
enum SDL_HINT_MOUSE_TOUCH_EVENTS = "SDL_MOUSE_TOUCH_EVENTS";
enum SDL_HINT_GAMECONTROLLERCONFIG_FILE = "SDL_GAMECONTROLLERCONFIG_FILE";
enum SDL_HINT_ANDROID_BLOCK_ON_PAUSE = "SDL_ANDROID_BLOCK_ON_PAUSE";
enum SDL_HINT_RENDER_BATCHING = "SDL_RENDER_BATCHING";
enum SDL_HINT_EVENT_LOGGING = "SDL_EVENT_LOGGING";
enum SDL_HINT_WAVE_RIFF_CHUNK_SIZE = "SDL_WAVE_RIFF_CHUNK_SIZE";
enum SDL_HINT_WAVE_TRUNCATION = "SDL_WAVE_TRUNCATION";
enum SDL_HINT_WAVE_FACT_CHUNK = "SDL_WAVE_FACT_CHUNK";
}
else static if(sdlSupport >= SDLSupport.sdl204) {
// Added in 2.0.4, removed in 2.0.10.
enum SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH = "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH";
}
enum SDL_HintPriority {
SDL_HINT_DEFAULT,
SDL_HINT_NORMAL,
SDL_HINT_OVERRIDE,
}
mixin(expandEnum!SDL_HintPriority);
extern(C) nothrow alias SDL_HintCallback = void function(void*, const(char)*, const(char)*);
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_bool SDL_SetHintWithPriority(const(char)*,const(char)*,SDL_HintPriority);
SDL_bool SDL_SetHint(const(char)*,const(char)*);
const(char)* SDL_GetHint(const(char)*);
void SDL_AddHintCallback(const(char)*,SDL_HintCallback,void*);
void SDL_DelHintCallback(const(char)*,SDL_HintCallback,void*);
void SDL_ClearHints();
static if(sdlSupport >= SDLSupport.sdl205) {
SDL_bool SDL_GetHintBoolean(const(char)*,SDL_bool);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_SetHintWithPriority = SDL_bool function(const(char)*,const(char)*,SDL_HintPriority);
alias pSDL_SetHint = SDL_bool function(const(char)*,const(char)*);
alias pSDL_GetHint = const(char)* function(const(char)*);
alias pSDL_AddHintCallback = void function(const(char)*,SDL_HintCallback,void*);
alias pSDL_DelHintCallback = void function(const(char)*,SDL_HintCallback,void*);
alias pSDL_ClearHints = void function();
}
__gshared {
pSDL_SetHintWithPriority SDL_SetHintWithPriority;
pSDL_SetHint SDL_SetHint;
pSDL_GetHint SDL_GetHint;
pSDL_AddHintCallback SDL_AddHintCallback;
pSDL_DelHintCallback SDL_DelHintCallback;
pSDL_ClearHints SDL_ClearHints;
}
static if(sdlSupport >= SDLSupport.sdl205) {
extern(C) @nogc nothrow {
alias pSDL_GetHintBoolean = SDL_bool function(const(char)*,SDL_bool);
}
__gshared {
pSDL_GetHintBoolean SDL_GetHintBoolean;
}
}
}

View file

@ -0,0 +1,231 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdljoystick;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
struct SDL_Joystick;
struct SDL_JoystickGUID {
ubyte[16] data;
}
alias SDL_JoystickID = int;
enum : ubyte {
SDL_HAT_CENTERED = 0x00,
SDL_HAT_UP = 0x01,
SDL_HAT_RIGHT = 0x02,
SDL_HAT_DOWN = 0x04,
SDL_HAT_LEFT = 0x08,
SDL_HAT_RIGHTUP = (SDL_HAT_RIGHT|SDL_HAT_UP),
SDL_HAT_RIGHTDOWN = (SDL_HAT_RIGHT|SDL_HAT_DOWN),
SDL_HAT_LEFTUP = (SDL_HAT_LEFT|SDL_HAT_UP),
SDL_HAT_LEFTDOWN = (SDL_HAT_LEFT|SDL_HAT_DOWN),
}
static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_JoystickPowerLevel {
SDL_JOYSTICK_POWER_UNKNOWN = -1,
SDL_JOYSTICK_POWER_EMPTY,
SDL_JOYSTICK_POWER_LOW,
SDL_JOYSTICK_POWER_MEDIUM,
SDL_JOYSTICK_POWER_FULL,
SDL_JOYSTICK_POWER_WIRED,
SDL_JOYSTICK_POWER_MAX
}
mixin(expandEnum!SDL_JoystickPowerLevel);
}
static if(sdlSupport >= SDLSupport.sdl206) {
enum SDL_JoystickType {
SDL_JOYSTICK_TYPE_UNKNOWN,
SDL_JOYSTICK_TYPE_GAMECONTROLLER,
SDL_JOYSTICK_TYPE_WHEEL,
SDL_JOYSTICK_TYPE_ARCADE_STICK,
SDL_JOYSTICK_TYPE_FLIGHT_STICK,
SDL_JOYSTICK_TYPE_DANCE_PAD,
SDL_JOYSTICK_TYPE_GUITAR,
SDL_JOYSTICK_TYPE_DRUM_KIT,
SDL_JOYSTICK_TYPE_ARCADE_PAD,
SDL_JOYSTICK_TYPE_THROTTLE,
}
mixin(expandEnum!SDL_JoystickType);
enum {
SDL_JOYSTICK_AXIS_MAX = 32767,
SDL_JOYSTICK_AXIS_MIN = -32768,
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_NumJoysticks();
const(char)* SDL_JoystickNameForIndex(int);
SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int);
SDL_Joystick* SDL_JoystickOpen(int);
const(char)* SDL_JoystickName(SDL_Joystick*);
SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick*);
char* SDL_JoystickGetGUIDString(SDL_JoystickGUID);
SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const(char)*);
SDL_bool SDL_JoystickGetAttached(SDL_Joystick*);
SDL_JoystickID SDL_JoystickInstanceID(SDL_Joystick*);
int SDL_JoystickNumAxes(SDL_Joystick*);
int SDL_JoystickNumBalls(SDL_Joystick*);
int SDL_JoystickNumHats(SDL_Joystick*);
int SDL_JoystickNumButtons(SDL_Joystick*);
void SDL_JoystickUpdate();
int SDL_JoystickEventState(int);
short SDL_JoystickGetAxis(SDL_Joystick*,int);
ubyte SDL_JoystickGetHat(SDL_Joystick*,int);
int SDL_JoystickGetBall(SDL_Joystick*,int,int*,int*);
ubyte SDL_JoystickGetButton(SDL_Joystick*,int);
void SDL_JoystickClose(SDL_Joystick*);
static if(sdlSupport >= SDLSupport.sdl204) {
SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick*);
SDL_Joystick* SDL_JoystickFromInstanceID(SDL_JoystickID);
}
static if(sdlSupport >= SDLSupport.sdl206) {
SDL_bool SDL_JoystickGetAxisInitialState(SDL_Joystick*,int,short*);
SDL_JoystickType SDL_JoystickGetDeviceInstanceID(int);
ushort SDL_JoystickGetDeviceProduct(int);
ushort SDL_JoystickGetDeviceProductVersion(int);
SDL_JoystickType SDL_JoystickGetDeviceType(int);
ushort SDL_JoystickGetDeviceVendor(int);
ushort SDL_JoystickGetProduct(SDL_Joystick*);
ushort SDL_JoystickGetProductVersion(SDL_Joystick*);
SDL_JoystickType SDL_JoystickGetType(SDL_Joystick*);
ushort SDL_JoystickGetVendor(SDL_Joystick*);
}
static if(sdlSupport >= SDLSupport.sdl207) {
void SDL_LockJoysticks();
void SDL_UnlockJoysticks();
}
static if(sdlSupport >= SDLSupport.sdl209) {
int SDL_JoystickRumble(SDL_Joystick*,ushort,ushort,uint);
}
static if(sdlSupport >= SDLSupport.sdl2010) {
int SDL_JoystickGetDevicePlayerIndex(int);
int SDL_JoystickGetPlayerIndex(SDL_Joystick*);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_NumJoysticks = int function();
alias pSDL_JoystickNameForIndex = const(char)* function(int);
alias pSDL_JoystickGetDeviceGUID = SDL_JoystickGUID function(int);
alias pSDL_JoystickOpen = SDL_Joystick* function(int);
alias pSDL_JoystickName = const(char)* function(SDL_Joystick*);
alias pSDL_JoystickGetGUID = SDL_JoystickGUID function(SDL_Joystick*);
alias pSDL_JoystickGetGUIDString = char* function(SDL_JoystickGUID);
alias pSDL_JoystickGetGUIDFromString = SDL_JoystickGUID function(const(char)*);
alias pSDL_JoystickGetAttached = SDL_bool function(SDL_Joystick*);
alias pSDL_JoystickInstanceID = SDL_JoystickID function(SDL_Joystick*);
alias pSDL_JoystickNumAxes = int function(SDL_Joystick*);
alias pSDL_JoystickNumBalls = int function(SDL_Joystick*);
alias pSDL_JoystickNumHats = int function(SDL_Joystick*);
alias pSDL_JoystickNumButtons = int function(SDL_Joystick*);
alias pSDL_JoystickUpdate = void function();
alias pSDL_JoystickEventState = int function(int);
alias pSDL_JoystickGetAxis = short function(SDL_Joystick*,int);
alias pSDL_JoystickGetHat = ubyte function(SDL_Joystick*,int);
alias pSDL_JoystickGetBall = int function(SDL_Joystick*,int,int*,int*);
alias pSDL_JoystickGetButton = ubyte function(SDL_Joystick*,int);
alias pSDL_JoystickClose = void function(SDL_Joystick*);
}
__gshared {
pSDL_NumJoysticks SDL_NumJoysticks;
pSDL_JoystickNameForIndex SDL_JoystickNameForIndex;
pSDL_JoystickGetDeviceGUID SDL_JoystickGetDeviceGUID;
pSDL_JoystickOpen SDL_JoystickOpen;
pSDL_JoystickName SDL_JoystickName;
pSDL_JoystickGetGUID SDL_JoystickGetGUID;
pSDL_JoystickGetGUIDString SDL_JoystickGetGUIDString;
pSDL_JoystickGetGUIDFromString SDL_JoystickGetGUIDFromString;
pSDL_JoystickGetAttached SDL_JoystickGetAttached;
pSDL_JoystickInstanceID SDL_JoystickInstanceID;
pSDL_JoystickNumAxes SDL_JoystickNumAxes;
pSDL_JoystickNumBalls SDL_JoystickNumBalls;
pSDL_JoystickNumHats SDL_JoystickNumHats;
pSDL_JoystickNumButtons SDL_JoystickNumButtons;
pSDL_JoystickUpdate SDL_JoystickUpdate;
pSDL_JoystickEventState SDL_JoystickEventState;
pSDL_JoystickGetAxis SDL_JoystickGetAxis;
pSDL_JoystickGetHat SDL_JoystickGetHat;
pSDL_JoystickGetBall SDL_JoystickGetBall;
pSDL_JoystickGetButton SDL_JoystickGetButton;
pSDL_JoystickClose SDL_JoystickClose;
}
static if(sdlSupport >= SDLSupport.sdl204) {
extern(C) @nogc nothrow {
alias pSDL_JoystickCurrentPowerLevel = SDL_JoystickPowerLevel function(SDL_Joystick*);
alias pSDL_JoystickFromInstanceID = SDL_Joystick* function(SDL_JoystickID);
}
__gshared {
pSDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel;
pSDL_JoystickFromInstanceID SDL_JoystickFromInstanceID;
}
}
static if(sdlSupport >= SDLSupport.sdl206) {
extern(C) @nogc nothrow {
alias pSDL_JoystickGetAxisInitialState = SDL_bool function(SDL_Joystick*,int,short*);
alias pSDL_JoystickGetDeviceInstanceID = SDL_JoystickType function(int);
alias pSDL_JoystickGetDeviceProduct = ushort function(int);
alias pSDL_JoystickGetDeviceProductVersion = ushort function(int);
alias pSDL_JoystickGetDeviceType = SDL_JoystickType function(int);
alias pSDL_JoystickGetDeviceVendor = ushort function(int);
alias pSDL_JoystickGetProduct = ushort function(SDL_Joystick*);
alias pSDL_JoystickGetProductVersion = ushort function(SDL_Joystick*);
alias pSDL_JoystickGetType = SDL_JoystickType function(SDL_Joystick*);
alias pSDL_JoystickGetVendor = ushort function(SDL_Joystick*);
}
__gshared {
pSDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState;
pSDL_JoystickGetDeviceInstanceID SDL_JoystickGetDeviceInstanceID;
pSDL_JoystickGetDeviceProduct SDL_JoystickGetDeviceProduct;
pSDL_JoystickGetDeviceProductVersion SDL_JoystickGetDeviceProductVersion;
pSDL_JoystickGetDeviceType SDL_JoystickGetDeviceType;
pSDL_JoystickGetDeviceVendor SDL_JoystickGetDeviceVendor;
pSDL_JoystickGetProduct SDL_JoystickGetProduct;
pSDL_JoystickGetProductVersion SDL_JoystickGetProductVersion;
pSDL_JoystickGetType SDL_JoystickGetType;
pSDL_JoystickGetVendor SDL_JoystickGetVendor;
}
}
static if(sdlSupport >= SDLSupport.sdl207) {
extern(C) @nogc nothrow {
alias pSDL_LockJoysticks = void function();
alias pSDL_UnlockJoysticks = void function();
}
__gshared {
pSDL_LockJoysticks SDL_LockJoysticks;
pSDL_UnlockJoysticks SDL_UnlockJoysticks;
}
}
static if(sdlSupport >= SDLSupport.sdl209) {
extern(C) @nogc nothrow {
alias pSDL_JoystickRumble = int function(SDL_Joystick*,ushort,ushort,uint);
}
__gshared {
pSDL_JoystickRumble SDL_JoystickRumble;
}
}
static if(sdlSupport >= SDLSupport.sdl2010) {
extern(C) @nogc nothrow {
alias pSDL_JoystickGetDevicePlayerIndex = int function(int);
alias pSDL_JoystickGetPlayerIndex = int function(SDL_Joystick*);
}
__gshared {
pSDL_JoystickGetDevicePlayerIndex SDL_JoystickGetDevicePlayerIndex;
pSDL_JoystickGetPlayerIndex SDL_JoystickGetPlayerIndex;
}
}
}

View file

@ -0,0 +1,80 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlkeyboard;
import bindbc.sdl.bind.sdlkeycode : SDL_Keycode, SDL_Keymod;
import bindbc.sdl.bind.sdlrect : SDL_Rect;
import bindbc.sdl.bind.sdlscancode : SDL_Scancode;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
import bindbc.sdl.bind.sdlvideo : SDL_Window;
struct SDL_Keysym {
SDL_Scancode scancode;
SDL_Keycode sym;
ushort mod;
uint unused;
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_Window* SDL_GetKeyboardFocus();
ubyte* SDL_GetKeyboardState(int*);
SDL_Keymod SDL_GetModState();
void SDL_SetModState(SDL_Keymod);
SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode);
SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode);
const(char)* SDL_GetScancodeName(SDL_Scancode);
SDL_Scancode SDL_GetScancodeFromName(const(char)*);
const(char)* SDL_GetKeyName(SDL_Keycode);
SDL_Keycode SDL_GetKeyFromName(const(char)*);
void SDL_StartTextInput();
SDL_bool SDL_IsTextInputActive();
void SDL_StopTextInput();
void SDL_SetTextInputRect(SDL_Rect*);
SDL_bool SDL_HasScreenKeyboardSupport();
SDL_bool SDL_IsScreenKeyboardShown(SDL_Window*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetKeyboardFocus = SDL_Window* function();
alias pSDL_GetKeyboardState = ubyte* function(int*);
alias pSDL_GetModState = SDL_Keymod function();
alias pSDL_SetModState = void function(SDL_Keymod);
alias pSDL_GetKeyFromScancode = SDL_Keycode function(SDL_Scancode);
alias pSDL_GetScancodeFromKey = SDL_Scancode function(SDL_Keycode);
alias pSDL_GetScancodeName = const(char)* function(SDL_Scancode);
alias pSDL_GetScancodeFromName = SDL_Scancode function(const(char)*);
alias pSDL_GetKeyName = const(char)* function(SDL_Keycode);
alias pSDL_GetKeyFromName = SDL_Keycode function(const(char)*);
alias pSDL_StartTextInput = void function();
alias pSDL_IsTextInputActive = SDL_bool function();
alias pSDL_StopTextInput = void function();
alias pSDL_SetTextInputRect = void function(SDL_Rect*);
alias pSDL_HasScreenKeyboardSupport = SDL_bool function();
alias pSDL_IsScreenKeyboardShown = SDL_bool function(SDL_Window*);
}
__gshared {
pSDL_GetKeyboardFocus SDL_GetKeyboardFocus;
pSDL_GetKeyboardState SDL_GetKeyboardState;
pSDL_GetModState SDL_GetModState;
pSDL_SetModState SDL_SetModState;
pSDL_GetKeyFromScancode SDL_GetKeyFromScancode;
pSDL_GetScancodeFromKey SDL_GetScancodeFromKey;
pSDL_GetScancodeName SDL_GetScancodeName;
pSDL_GetScancodeFromName SDL_GetScancodeFromName;
pSDL_GetKeyName SDL_GetKeyName;
pSDL_GetKeyFromName SDL_GetKeyFromName;
pSDL_StartTextInput SDL_StartTextInput;
pSDL_IsTextInputActive SDL_IsTextInputActive;
pSDL_StopTextInput SDL_StopTextInput;
pSDL_SetTextInputRect SDL_SetTextInputRect;
pSDL_HasScreenKeyboardSupport SDL_HasScreenKeyboardSupport;
pSDL_IsScreenKeyboardShown SDL_IsScreenKeyboardShown;
}
}

View file

@ -0,0 +1,288 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlkeycode;
import bindbc.sdl.config,
bindbc.sdl.bind.sdlscancode;
enum SDLK_SCANCODE_MASK = 1<<30;
enum SDL_SCANCODE_TO_KEYCODE(SDL_Scancode x) = x | SDLK_SCANCODE_MASK;
enum SDL_Keycode {
SDLK_UNKNOWN = 0,
SDLK_RETURN = '\r',
SDLK_ESCAPE = '\033',
SDLK_BACKSPACE = '\b',
SDLK_TAB = '\t',
SDLK_SPACE = ' ',
SDLK_EXCLAIM = '!',
SDLK_QUOTEDBL = '"',
SDLK_HASH = '#',
SDLK_PERCENT = '%',
SDLK_DOLLAR = '$',
SDLK_AMPERSAND = '&',
SDLK_QUOTE = '\'',
SDLK_LEFTPAREN = '(',
SDLK_RIGHTPAREN = ')',
SDLK_ASTERISK = '*',
SDLK_PLUS = '+',
SDLK_COMMA = ',',
SDLK_MINUS = '-',
SDLK_PERIOD = '.',
SDLK_SLASH = '/',
SDLK_0 = '0',
SDLK_1 = '1',
SDLK_2 = '2',
SDLK_3 = '3',
SDLK_4 = '4',
SDLK_5 = '5',
SDLK_6 = '6',
SDLK_7 = '7',
SDLK_8 = '8',
SDLK_9 = '9',
SDLK_COLON = ':',
SDLK_SEMICOLON = ';',
SDLK_LESS = '<',
SDLK_EQUALS = '=',
SDLK_GREATER = '>',
SDLK_QUESTION = '?',
SDLK_AT = '@',
SDLK_LEFTBRACKET = '[',
SDLK_BACKSLASH = '\\',
SDLK_RIGHTBRACKET = ']',
SDLK_CARET = '^',
SDLK_UNDERSCORE = '_',
SDLK_BACKQUOTE = '`',
SDLK_a = 'a',
SDLK_b = 'b',
SDLK_c = 'c',
SDLK_d = 'd',
SDLK_e = 'e',
SDLK_f = 'f',
SDLK_g = 'g',
SDLK_h = 'h',
SDLK_i = 'i',
SDLK_j = 'j',
SDLK_k = 'k',
SDLK_l = 'l',
SDLK_m = 'm',
SDLK_n = 'n',
SDLK_o = 'o',
SDLK_p = 'p',
SDLK_q = 'q',
SDLK_r = 'r',
SDLK_s = 's',
SDLK_t = 't',
SDLK_u = 'u',
SDLK_v = 'v',
SDLK_w = 'w',
SDLK_x = 'x',
SDLK_y = 'y',
SDLK_z = 'z',
SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CAPSLOCK),
SDLK_F1 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F1),
SDLK_F2 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F2),
SDLK_F3 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F3),
SDLK_F4 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F4),
SDLK_F5 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F5),
SDLK_F6 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F6),
SDLK_F7 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F7),
SDLK_F8 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F8),
SDLK_F9 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F9),
SDLK_F10 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F10),
SDLK_F11 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F11),
SDLK_F12 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F12),
SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_PRINTSCREEN),
SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_SCROLLLOCK),
SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_PAUSE),
SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_INSERT),
SDLK_HOME = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_HOME),
SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_PAGEUP),
SDLK_DELETE = '\177',
SDLK_END = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_END),
SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_PAGEDOWN),
SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_RIGHT),
SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_LEFT),
SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_DOWN),
SDLK_UP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_UP),
SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_NUMLOCKCLEAR),
SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_DIVIDE),
SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MULTIPLY),
SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MINUS),
SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_PLUS),
SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_ENTER),
SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_1),
SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_2),
SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_3),
SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_4),
SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_5),
SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_6),
SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_7),
SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_8),
SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_9),
SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_0),
SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_PERIOD),
SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_APPLICATION),
SDLK_POWER = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_POWER),
SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_EQUALS),
SDLK_F13 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F13),
SDLK_F14 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F14),
SDLK_F15 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F15),
SDLK_F16 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F16),
SDLK_F17 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F17),
SDLK_F18 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F18),
SDLK_F19 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F19),
SDLK_F20 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F20),
SDLK_F21 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F21),
SDLK_F22 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F22),
SDLK_F23 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F23),
SDLK_F24 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_F24),
SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_EXECUTE),
SDLK_HELP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_HELP),
SDLK_MENU = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_MENU),
SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_SELECT),
SDLK_STOP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_STOP),
SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AGAIN),
SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_UNDO),
SDLK_CUT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CUT),
SDLK_COPY = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_COPY),
SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_PASTE),
SDLK_FIND = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_FIND),
SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_MUTE),
SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_VOLUMEUP),
SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_VOLUMEDOWN),
SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_COMMA),
SDLK_KP_EQUALSAS400 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_EQUALSAS400),
SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_ALTERASE),
SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_SYSREQ),
SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CANCEL),
SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CLEAR),
SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_PRIOR),
SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_RETURN2),
SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_SEPARATOR),
SDLK_OUT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_OUT),
SDLK_OPER = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_OPER),
SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CLEARAGAIN),
SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CRSEL),
SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_EXSEL),
SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_00),
SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_000),
SDLK_THOUSANDSSEPARATOR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_THOUSANDSSEPARATOR),
SDLK_DECIMALSEPARATOR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_DECIMALSEPARATOR),
SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CURRENCYUNIT),
SDLK_CURRENCYSUBUNIT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CURRENCYSUBUNIT),
SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_LEFTPAREN),
SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_RIGHTPAREN),
SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_LEFTBRACE),
SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_RIGHTBRACE),
SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_TAB),
SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_BACKSPACE),
SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_A),
SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_B),
SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_C),
SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_D),
SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_E),
SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_F),
SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_XOR),
SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_POWER),
SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_PERCENT),
SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_LESS),
SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_GREATER),
SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_AMPERSAND),
SDLK_KP_DBLAMPERSAND = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_DBLAMPERSAND),
SDLK_KP_VERTICALBAR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_VERTICALBAR),
SDLK_KP_DBLVERTICALBAR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_DBLVERTICALBAR),
SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_COLON),
SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_HASH),
SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_SPACE),
SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_AT),
SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_EXCLAM),
SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MEMSTORE),
SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MEMRECALL),
SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MEMCLEAR),
SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MEMADD),
SDLK_KP_MEMSUBTRACT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MEMSUBTRACT),
SDLK_KP_MEMMULTIPLY = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MEMMULTIPLY),
SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_MEMDIVIDE),
SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_PLUSMINUS),
SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_CLEAR),
SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_CLEARENTRY),
SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_BINARY),
SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_OCTAL),
SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_DECIMAL),
SDLK_KP_HEXADECIMAL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KP_HEXADECIMAL),
SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_LCTRL),
SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_LSHIFT),
SDLK_LALT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_LALT),
SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_LGUI),
SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_RCTRL),
SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_RSHIFT),
SDLK_RALT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_RALT),
SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_RGUI),
SDLK_MODE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_MODE),
SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AUDIONEXT),
SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AUDIOPREV),
SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AUDIOSTOP),
SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AUDIOPLAY),
SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AUDIOMUTE),
SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_MEDIASELECT),
SDLK_WWW = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_WWW),
SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_MAIL),
SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_CALCULATOR),
SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_COMPUTER),
SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AC_SEARCH),
SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AC_HOME),
SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AC_BACK),
SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AC_FORWARD),
SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AC_STOP),
SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AC_REFRESH),
SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_AC_BOOKMARKS),
SDLK_BRIGHTNESSDOWN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_BRIGHTNESSDOWN),
SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_BRIGHTNESSUP),
SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_DISPLAYSWITCH),
SDLK_KBDILLUMTOGGLE = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KBDILLUMTOGGLE),
SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KBDILLUMDOWN),
SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_KBDILLUMUP),
SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_EJECT),
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE!(SDL_Scancode.SDL_SCANCODE_SLEEP),
}
mixin(expandEnum!SDL_Keycode);
enum SDL_Keymod {
KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001,
KMOD_RSHIFT = 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LGUI = 0x0400,
KMOD_RGUI = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_RESERVED = 0x8000,
KMOD_CTRL = (KMOD_LCTRL|KMOD_RCTRL),
KMOD_SHIFT = (KMOD_LSHIFT|KMOD_RSHIFT),
KMOD_ALT = (KMOD_LALT|KMOD_RALT),
KMOD_GUI = (KMOD_LGUI|KMOD_RGUI),
}
mixin(expandEnum!SDL_Keymod);

View file

@ -0,0 +1,28 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlloadso;
version(BindSDL_Static){
extern(C) @nogc nothrow {
void* SDL_LoadObject(const(char)*);
void* SDL_LoadFunction(void*,const(char*));
void SDL_UnloadObject(void*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_LoadObject = void* function(const(char)*);
alias pSDL_LoadFunction = void* function(void*,const(char*));
alias pSDL_UnloadObject = void function(void*);
}
__gshared {
pSDL_LoadObject SDL_LoadObject;
pSDL_LoadFunction SDL_LoadFunction;
pSDL_UnloadObject SDL_UnloadObject;
}
}

View file

@ -0,0 +1,111 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdllog;
version(WebAssembly)
{
alias va_list = char*;
}
else import core.stdc.stdarg : va_list;
import bindbc.sdl.config;
enum SDL_MAX_LOG_MESSAGE = 4096;
enum {
SDL_LOG_CATEGORY_APPLICATION,
SDL_LOG_CATEGORY_ERROR,
SDL_LOG_CATEGORY_ASSERT,
SDL_LOG_CATEGORY_SYSTEM,
SDL_LOG_CATEGORY_AUDIO,
SDL_LOG_CATEGORY_VIDEO,
SDL_LOG_CATEGORY_RENDER,
SDL_LOG_CATEGORY_INPUT,
SDL_LOG_CATEGORY_TEST,
SDL_LOG_CATEGORY_RESERVED1,
SDL_LOG_CATEGORY_RESERVED2,
SDL_LOG_CATEGORY_RESERVED3,
SDL_LOG_CATEGORY_RESERVED4,
SDL_LOG_CATEGORY_RESERVED5,
SDL_LOG_CATEGORY_RESERVED6,
SDL_LOG_CATEGORY_RESERVED7,
SDL_LOG_CATEGORY_RESERVED8,
SDL_LOG_CATEGORY_RESERVED9,
SDL_LOG_CATEGORY_RESERVED10,
SDL_LOG_CATEGORY_CUSTOM
}
enum SDL_LogPriority {
SDL_LOG_PRIORITY_VERBOSE = 1,
SDL_LOG_PRIORITY_DEBUG,
SDL_LOG_PRIORITY_INFO,
SDL_LOG_PRIORITY_WARN,
SDL_LOG_PRIORITY_ERROR,
SDL_LOG_PRIORITY_CRITICAL,
SDL_NUM_LOG_PRIORITIES
}
mixin(expandEnum!SDL_LogPriority);
extern(C) nothrow alias SDL_LogOutputFunction = void function(void*, int, SDL_LogPriority, const(char)*);
version(BindSDL_Static) {
extern(C) @nogc nothrow {
void SDL_LogSetAllPriority(SDL_LogPriority);
void SDL_LogSetPriority(int,SDL_LogPriority);
SDL_LogPriority SDL_LogGetPriority(int);
void SDL_LogResetPriorities();
void SDL_Log(const(char)*,...);
void SDL_LogVerbose(int,const(char)*,...);
void SDL_LogDebug(int,const(char)*,...);
void SDL_LogInfo(int,const(char)*,...);
void SDL_LogWarn(int,const(char)*,...);
void SDL_LogError(int,const(char)*,...);
void SDL_LogCritical(int,const(char)*,...);
void SDL_LogMessage(int,SDL_LogPriority,const(char)*,...);
void SDL_LogMessageV(int,SDL_LogPriority,const(char)*,va_list);
void SDL_LogGetOutputFunction(SDL_LogOutputFunction,void**);
void SDL_LogSetOutputFunction(SDL_LogOutputFunction,void*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_LogSetAllPriority = void function(SDL_LogPriority);
alias pSDL_LogSetPriority = void function(int,SDL_LogPriority);
alias pSDL_LogGetPriority = SDL_LogPriority function(int);
alias pSDL_LogResetPriorities = void function();
alias pSDL_Log = void function(const(char)*,...);
alias pSDL_LogVerbose = void function(int,const(char)*,...);
alias pSDL_LogDebug = void function(int,const(char)*,...);
alias pSDL_LogInfo = void function(int,const(char)*,...);
alias pSDL_LogWarn = void function(int,const(char)*,...);
alias pSDL_LogError = void function(int,const(char)*,...);
alias pSDL_LogCritical = void function(int,const(char)*,...);
alias pSDL_LogMessage = void function(int,SDL_LogPriority,const(char)*,...);
alias pSDL_LogMessageV = void function(int,SDL_LogPriority,const(char)*,va_list);
alias pSDL_LogGetOutputFunction = void function(SDL_LogOutputFunction,void**);
alias pSDL_LogSetOutputFunction = void function(SDL_LogOutputFunction,void*);
}
__gshared {
pSDL_LogSetAllPriority SDL_LogSetAllPriority;
pSDL_LogSetPriority SDL_LogSetPriority;
pSDL_LogGetPriority SDL_LogGetPriority;
pSDL_LogResetPriorities SDL_LogResetPriorities;
pSDL_Log SDL_Log;
pSDL_LogVerbose SDL_LogVerbose;
pSDL_LogDebug SDL_LogDebug;
pSDL_LogInfo SDL_LogInfo;
pSDL_LogWarn SDL_LogWarn;
pSDL_LogError SDL_LogError;
pSDL_LogCritical SDL_LogCritical;
pSDL_LogMessage SDL_LogMessage;
pSDL_LogMessageV SDL_LogMessageV;
pSDL_LogGetOutputFunction SDL_LogGetOutputFunction;
pSDL_LogSetOutputFunction SDL_LogSetOutputFunction;
}
}

View file

@ -0,0 +1,75 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlmessagebox;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlvideo : SDL_Window;
enum SDL_MessageBoxFlags {
SDL_MESSAGEBOX_ERROR = 0x00000010,
SDL_MESSAGEBOX_WARNING = 0x00000020,
SDL_MESSAGEBOX_INFORMATION = 0x00000040,
}
mixin(expandEnum!SDL_MessageBoxFlags);
enum SDL_MessageBoxButtonFlags {
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001,
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002,
}
mixin(expandEnum!SDL_MessageBoxButtonFlags);
struct SDL_MessageBoxButtonData {
uint flags;
int buttonid;
const(char)* text;
}
struct SDL_MessageBoxColor {
ubyte r, g, b;
}
enum SDL_MessageBoxColorType {
SDL_MESSAGEBOX_COLOR_BACKGROUND,
SDL_MESSAGEBOX_COLOR_TEXT,
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
SDL_MESSAGEBOX_COLOR_MAX,
}
mixin(expandEnum!SDL_MessageBoxColorType);
struct SDL_MessageBoxColorScheme {
SDL_MessageBoxColor[SDL_MESSAGEBOX_COLOR_MAX] colors;
}
struct SDL_MessageBoxData {
uint flags;
SDL_Window* window;
const(char)* title;
const(char)* message;
int numbuttons;
const(SDL_MessageBoxButtonData)* buttons;
const(SDL_MessageBoxColorScheme)* colorScheme;
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_ShowMessageBox(const(SDL_MessageBoxData)*,int*);
int SDL_ShowSimpleMessageBox(uint,const(char)*,const(char)*,SDL_Window*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_ShowMessageBox = int function(const(SDL_MessageBoxData)*,int*);
alias pSDL_ShowSimpleMessageBox = int function(uint,const(char)*,const(char)*,SDL_Window*);
}
__gshared {
pSDL_ShowMessageBox SDL_ShowMessageBox;
pSDL_ShowSimpleMessageBox SDL_ShowSimpleMessageBox;
}
}

View file

@ -0,0 +1,140 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlmouse;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
import bindbc.sdl.bind.sdlsurface : SDL_Surface;
import bindbc.sdl.bind.sdlvideo : SDL_Window;
struct SDL_Cursor;
enum SDL_SystemCursor {
SDL_SYSTEM_CURSOR_ARROW,
SDL_SYSTEM_CURSOR_IBEAM,
SDL_SYSTEM_CURSOR_WAIT,
SDL_SYSTEM_CURSOR_CROSSHAIR,
SDL_SYSTEM_CURSOR_WAITARROW,
SDL_SYSTEM_CURSOR_SIZENWSE,
SDL_SYSTEM_CURSOR_SIZENESW,
SDL_SYSTEM_CURSOR_SIZEWE,
SDL_SYSTEM_CURSOR_SIZENS,
SDL_SYSTEM_CURSOR_SIZEALL,
SDL_SYSTEM_CURSOR_NO,
SDL_SYSTEM_CURSOR_HAND,
SDL_NUM_SYSTEM_CURSORS
}
alias SDL_SYSTEM_CURSOR_ARROW = SDL_SystemCursor.SDL_SYSTEM_CURSOR_ARROW;
alias SDL_SYSTEM_CURSOR_IBEAM = SDL_SystemCursor.SDL_SYSTEM_CURSOR_IBEAM;
alias SDL_SYSTEM_CURSOR_WAIT = SDL_SystemCursor.SDL_SYSTEM_CURSOR_WAIT;
alias SDL_SYSTEM_CURSOR_CROSSHAIR = SDL_SystemCursor.SDL_SYSTEM_CURSOR_CROSSHAIR;
alias SDL_SYSTEM_CURSOR_WAITARROW = SDL_SystemCursor.SDL_SYSTEM_CURSOR_WAITARROW;
alias SDL_SYSTEM_CURSOR_SIZENWSE = SDL_SystemCursor.SDL_SYSTEM_CURSOR_SIZENWSE;
alias SDL_SYSTEM_CURSOR_SIZENESW = SDL_SystemCursor.SDL_SYSTEM_CURSOR_SIZENESW;
alias SDL_SYSTEM_CURSOR_SIZEWE = SDL_SystemCursor.SDL_SYSTEM_CURSOR_SIZEWE;
alias SDL_SYSTEM_CURSOR_SIZENS = SDL_SystemCursor.SDL_SYSTEM_CURSOR_SIZENS;
alias SDL_SYSTEM_CURSOR_SIZEALL = SDL_SystemCursor.SDL_SYSTEM_CURSOR_SIZEALL;
alias SDL_SYSTEM_CURSOR_NO = SDL_SystemCursor.SDL_SYSTEM_CURSOR_NO;
alias SDL_SYSTEM_CURSOR_HAND = SDL_SystemCursor.SDL_SYSTEM_CURSOR_HAND;
alias SDL_NUM_SYSTEM_CURSORS = SDL_SystemCursor.SDL_NUM_SYSTEM_CURSORS;
enum SDL_BUTTON(ubyte x) = 1 << (x-1);
enum : ubyte {
SDL_BUTTON_LEFT = 1,
SDL_BUTTON_MIDDLE = 2,
SDL_BUTTON_RIGHT = 3,
SDL_BUTTON_X1 = 4,
SDL_BUTTON_X2 = 5,
SDL_BUTTON_LMASK = SDL_BUTTON!(SDL_BUTTON_LEFT),
SDL_BUTTON_MMASK = SDL_BUTTON!(SDL_BUTTON_MIDDLE),
SDL_BUTTON_RMASK = SDL_BUTTON!(SDL_BUTTON_RIGHT),
SDL_BUTTON_X1MASK = SDL_BUTTON!(SDL_BUTTON_X1),
SDL_BUTTON_X2MASK = SDL_BUTTON!(SDL_BUTTON_X2),
}
static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_MouseWheelDirection {
SDL_MOUSEWHEEL_NORMAL,
SDL_MOUSEWHEEL_FLIPPED,
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_Window* SDL_GetMouseFocus();
uint SDL_GetMouseState(int*,int*);
uint SDL_GetRelativeMouseState(int*,int*);
void SDL_WarpMouseInWindow(SDL_Window*,int,int);
int SDL_SetRelativeMouseMode(SDL_bool);
SDL_bool SDL_GetRelativeMouseMode();
SDL_Cursor* SDL_CreateCursor(const(ubyte)*,const(ubyte)*,int,int,int,int);
SDL_Cursor* SDL_CreateColorCursor(SDL_Surface*,int,int);
SDL_Cursor* SDL_CreateSystemCursor(SDL_SystemCursor);
void SDL_SetCursor(SDL_Cursor*);
SDL_Cursor* SDL_GetCursor();
SDL_Cursor* SDL_GetDefaultCursor();
void SDL_FreeCursor(SDL_Cursor*);
int SDL_ShowCursor(int);
static if(sdlSupport >= SDLSupport.sdl204) {
int SDL_CaptureMouse(SDL_bool);
uint SDL_GetGlobalMouseState(int*,int*);
void SDL_WarpMouseGlobal(int,int);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetMouseFocus = SDL_Window* function();
alias pSDL_GetMouseState = uint function(int*,int*);
alias pSDL_GetRelativeMouseState = uint function(int*,int*);
alias pSDL_WarpMouseInWindow = void function(SDL_Window*,int,int);
alias pSDL_SetRelativeMouseMode = int function(SDL_bool);
alias pSDL_GetRelativeMouseMode = SDL_bool function();
alias pSDL_CreateCursor = SDL_Cursor* function(const(ubyte)*,const(ubyte)*,int,int,int,int);
alias pSDL_CreateColorCursor = SDL_Cursor* function(SDL_Surface*,int,int);
alias pSDL_CreateSystemCursor = SDL_Cursor* function(SDL_SystemCursor);
alias pSDL_SetCursor = void function(SDL_Cursor*);
alias pSDL_GetCursor = SDL_Cursor* function();
alias pSDL_GetDefaultCursor = SDL_Cursor* function();
alias pSDL_FreeCursor = void function(SDL_Cursor*);
alias pSDL_ShowCursor = int function(int);
}
__gshared {
pSDL_GetMouseFocus SDL_GetMouseFocus;
pSDL_GetMouseState SDL_GetMouseState;
pSDL_GetRelativeMouseState SDL_GetRelativeMouseState;
pSDL_WarpMouseInWindow SDL_WarpMouseInWindow;
pSDL_SetRelativeMouseMode SDL_SetRelativeMouseMode;
pSDL_GetRelativeMouseMode SDL_GetRelativeMouseMode;
pSDL_CreateCursor SDL_CreateCursor;
pSDL_CreateColorCursor SDL_CreateColorCursor;
pSDL_CreateSystemCursor SDL_CreateSystemCursor;
pSDL_SetCursor SDL_SetCursor;
pSDL_GetCursor SDL_GetCursor;
pSDL_GetDefaultCursor SDL_GetDefaultCursor;
pSDL_FreeCursor SDL_FreeCursor;
pSDL_ShowCursor SDL_ShowCursor;
}
static if(sdlSupport >= SDLSupport.sdl204) {
extern(C) @nogc nothrow {
alias pSDL_CaptureMouse = int function(SDL_bool);
alias pSDL_GetGlobalMouseState = uint function(int*,int*);
alias pSDL_WarpMouseGlobal = void function(int,int);
}
__gshared {
pSDL_CaptureMouse SDL_CaptureMouse;
pSDL_GetGlobalMouseState SDL_GetGlobalMouseState;
pSDL_WarpMouseGlobal SDL_WarpMouseGlobal;
}
}
}

View file

@ -0,0 +1,283 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlpixels;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_FOURCC, SDL_bool;
enum SDL_ALPHA_OPAQUE = 255;
enum SDL_ALPHA_TRANSPARENT = 0;
enum {
SDL_PIXELTYPE_UNKNOWN,
SDL_PIXELTYPE_INDEX1,
SDL_PIXELTYPE_INDEX4,
SDL_PIXELTYPE_INDEX8,
SDL_PIXELTYPE_PACKED8,
SDL_PIXELTYPE_PACKED16,
SDL_PIXELTYPE_PACKED32,
SDL_PIXELTYPE_ARRAYU8,
SDL_PIXELTYPE_ARRAYU16,
SDL_PIXELTYPE_ARRAYU32,
SDL_PIXELTYPE_ARRAYF16,
SDL_PIXELTYPE_ARRAYF32
}
enum {
SDL_BITMAPORDER_NONE,
SDL_BITMAPORDER_4321,
SDL_BITMAPORDER_1234
}
enum {
SDL_PACKEDORDER_NONE,
SDL_PACKEDORDER_XRGB,
SDL_PACKEDORDER_RGBX,
SDL_PACKEDORDER_ARGB,
SDL_PACKEDORDER_RGBA,
SDL_PACKEDORDER_XBGR,
SDL_PACKEDORDER_BGRX,
SDL_PACKEDORDER_ABGR,
SDL_PACKEDORDER_BGRA
}
enum {
SDL_ARRAYORDER_NONE,
SDL_ARRAYORDER_RGB,
SDL_ARRAYORDER_RGBA,
SDL_ARRAYORDER_ARGB,
SDL_ARRAYORDER_BGR,
SDL_ARRAYORDER_BGRA,
SDL_ARRAYORDER_ABGR
}
enum {
SDL_PACKEDLAYOUT_NONE,
SDL_PACKEDLAYOUT_332,
SDL_PACKEDLAYOUT_4444,
SDL_PACKEDLAYOUT_1555,
SDL_PACKEDLAYOUT_5551,
SDL_PACKEDLAYOUT_565,
SDL_PACKEDLAYOUT_8888,
SDL_PACKEDLAYOUT_2101010,
SDL_PACKEDLAYOUT_1010102
}
alias SDL_DEFINE_PIXELFOURCC = SDL_FOURCC;
enum uint SDL_DEFINE_PIXELFORMAT(int type, int order, int layout, int bits, int bytes) =
(1 << 28) | (type << 24) | (order << 20) | (layout << 16) | (bits << 8) | (bytes << 0);
enum uint SDL_PIXELFLAG(uint x) = (x >> 28) & 0x0F;
enum uint SDL_PIXELTYPE(uint x) = (x >> 24) & 0x0F;
enum uint SDL_PIXELORDER(uint x) = (x >> 20) & 0x0F;
enum uint SDL_PIXELLAYOUT(uint x) = (x >> 16) & 0x0F;
enum uint SDL_BITSPERPIXEL(uint x) = (x >> 8) & 0xFF;
template SDL_BYTESPERPIXEL(uint x) {
static if(SDL_ISPIXELFORMAT_FOURCC!x) {
static if(x == SDL_PIXELFORMAT_YUY2 || x == SDL_PIXELFORMAT_UYVY || x == SDL_PIXELFORMAT_YVYU)
enum SDL_BYTESPERPIXEL = 2;
else enum SDL_BYTESPERPIXEL = 1;
}
else enum SDL_BYTESPERPIXEL = (x >> 0) & 0xFF;
}
template SDL_ISPIXELFORMAT_INDEXED(uint format) {
static if(SDL_ISPIXELFORMAT_FOURCC!format) {
enum SDL_ISPIXELFORMAT_INDEXED = SDL_PIXELTYPE!format == SDL_PIXELTYPE_INDEX1 || SDL_PIXELTYPE!format == SDL_PIXELTYPE_INDEX4 ||
SDL_PIXELTYPE!format == SDL_PIXELTYPE_INDEX8;
}
else enum SDL_ISPIXELFORMAT_INDEXED = false;
}
template SDL_ISPIXELFORMAT_PACKED(uint format) {
static if(SDL_ISPIXELFORMAT_FOURCC!format) {
enum SDL_ISPIXELFORMAT_PACKED = SDL_PIXELTYPE!format == SDL_PIXELTYPE_PACKED8 || SDL_PIXELTYPE!format == SDL_PIXELTYPE_PACKED16 ||
SDL_PIXELTYPE!format == SDL_PIXELTYPE_PACKED32;
}
else enum SDL_ISPIXELFORMAT_PACKED = false;
}
static if(sdlSupport >= SDLSupport.sdl204) {
template SDL_ISPIXELFORMAT_ARRAY(uint format) {
static if(SDL_ISPIXELFORMAT_FOURCC!format) {
enum SDL_ISPIXELFORMAT_ARRAY = SDL_PIXELTYPE!format == SDL_PIXELTYPE_ARRAYU8 || SDL_PIXELTYPE!format == SDL_PIXELTYPE_ARRAYU16 ||
SDL_PIXELTYPE!format == SDL_PIXELTYPE_ARRAYU32 || SDL_PIXELTYPE!format == SDL_PIXELTYPE_ARRAYF16 ||
SDL_PIXELTYPE!format == SDL_PIXELTYPE_ARRAYF32;
}
else enum SDL_ISPIXELFORMAT_ARRAY = false;
}
}
template SDL_ISPIXELFORMAT_ALPHA(uint format) {
static if(SDL_ISPIXELFORMAT_PACKED!format) {
enum SDL_ISPIXELFORMAT_ALPHA = (SDL_PIXELORDER!format == SDL_PACKEDORDER_ARGB || SDL_PIXELORDER!format == SDL_PACKEDORDER_RGBA ||
SDL_PIXELORDER!format == SDL_PACKEDORDER_ABGR || SDL_PIXELORDER!format == SDL_PACKEDORDER_BGRA);
}
else static if(sdlSupport >= SDLSupport.sdl204 && SDL_ISPIXELFORMAT_ARRAY!format) {
enum SDL_ISPIXELFORMAT_ALPHA = (SDL_PIXELORDER!format == SDL_ARRAYORDER_ARGB || SDL_PIXELORDER!format == SDL_ARRAYORDER_RGBA ||
SDL_PIXELORDER!format == SDL_ARRAYORDER_ABGR || SDL_PIXELORDER!format == SDL_ARRAYORDER_BGRA);
}
else enum SDL_ISPIXELFORMAT_ALPHA = false;
}
enum SDL_ISPIXELFORMAT_FOURCC(uint format) = format && !(format & 0x80000000);
enum SDL_PIXELFORMAT_UNKNOWN = 0;
enum SDL_PIXELFORMAT_INDEX1LSB = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, 1, 0);
enum SDL_PIXELFORMAT_INDEX1MSB = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, 1, 0);
enum SDL_PIXELFORMAT_INDEX4LSB = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, 4, 0);
enum SDL_PIXELFORMAT_INDEX4MSB = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0, 4, 0);
enum SDL_PIXELFORMAT_INDEX8 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1);
enum SDL_PIXELFORMAT_RGB332 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_332, 8, 1);
enum SDL_PIXELFORMAT_RGB444 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_4444, 12, 2);
enum SDL_PIXELFORMAT_RGB555 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_1555, 15, 2);
enum SDL_PIXELFORMAT_BGR555 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_1555, 15, 2);
enum SDL_PIXELFORMAT_ARGB4444 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_4444, 16, 2);
enum SDL_PIXELFORMAT_RGBA4444 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_4444, 16, 2);
enum SDL_PIXELFORMAT_ABGR4444 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_4444, 16, 2);
enum SDL_PIXELFORMAT_BGRA4444 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_4444, 16, 2);
enum SDL_PIXELFORMAT_ARGB1555 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_1555, 16, 2);
enum SDL_PIXELFORMAT_RGBA5551 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_5551, 16, 2);
enum SDL_PIXELFORMAT_ABGR1555 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_1555, 16, 2);
enum SDL_PIXELFORMAT_BGRA5551 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_5551, 16, 2);
enum SDL_PIXELFORMAT_RGB565 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_565, 16, 2);
enum SDL_PIXELFORMAT_BGR565 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_565, 16, 2);
enum SDL_PIXELFORMAT_RGB24 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, 24, 3);
enum SDL_PIXELFORMAT_BGR24 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0, 24, 3);
enum SDL_PIXELFORMAT_RGB888 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_8888, 24, 4);
enum SDL_PIXELFORMAT_RGBX8888 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, SDL_PACKEDLAYOUT_8888, 24, 4);
enum SDL_PIXELFORMAT_BGR888 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_8888, 24, 4);
enum SDL_PIXELFORMAT_BGRX8888 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX, SDL_PACKEDLAYOUT_8888, 24, 4);
enum SDL_PIXELFORMAT_ARGB8888 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_8888, 32, 4);
enum SDL_PIXELFORMAT_RGBA8888 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_8888, 32, 4);
enum SDL_PIXELFORMAT_ABGR8888 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_8888, 32, 4);
enum SDL_PIXELFORMAT_BGRA8888 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_8888, 32, 4);
enum SDL_PIXELFORMAT_ARGB2101010 = SDL_DEFINE_PIXELFORMAT!(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_2101010, 32, 4);
enum SDL_PIXELFORMAT_YV12 = SDL_DEFINE_PIXELFOURCC!('Y', 'V', '1', '2');
enum SDL_PIXELFORMAT_IYUV = SDL_DEFINE_PIXELFOURCC!('I', 'Y', 'U', 'V');
enum SDL_PIXELFORMAT_YUY2 = SDL_DEFINE_PIXELFOURCC!('Y', 'U', 'Y', '2');
enum SDL_PIXELFORMAT_UYVY = SDL_DEFINE_PIXELFOURCC!('U', 'Y', 'V', 'Y');
enum SDL_PIXELFORMAT_YVYU = SDL_DEFINE_PIXELFOURCC!('Y', 'V', 'Y', 'U');
static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_PIXELFORMAT_NV12 = SDL_DEFINE_PIXELFOURCC!('N', 'V', '1', '2');
enum SDL_PIXELFORMAT_NV21 = SDL_DEFINE_PIXELFOURCC!('N', 'V', '2', '1');
}
static if(sdlSupport >= SDLSupport.sdl208) {
enum SDL_PIXELFORMAT_EXTERNAL_OES = SDL_DEFINE_PIXELFOURCC!('O', 'E', 'S', ' ');
}
static assert(SDL_PIXELFORMAT_BGRX8888 == 0x16661804);
// Added in SDL 2.0.5, but doesn't hurt to make available for every version.
version(BigEndian) {
alias SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888;
alias SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888;
alias SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888;
alias SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888;
}
else {
alias SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888;
alias SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888;
alias SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888;
alias SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888;
}
struct SDL_Color {
ubyte r;
ubyte g;
ubyte b;
ubyte a;
}
alias SDL_Colour = SDL_Color;
struct SDL_Palette {
int ncolors;
SDL_Color* colors;
uint version_; // NOTE: original was named 'version'
int refcount;
}
struct SDL_PixelFormat {
uint format;
SDL_Palette *palette;
ubyte BitsPerPixel;
ubyte BytesPerPixel;
ubyte[2] padding;
uint Rmask;
uint Gmask;
uint Bmask;
uint Amask;
ubyte Rloss;
ubyte Gloss;
ubyte Bloss;
ubyte Aloss;
ubyte Rshift;
ubyte Gshift;
ubyte Bshift;
ubyte Ashift;
int refcount;
SDL_PixelFormat* next;
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
const(char)* SDL_GetPixelFormatName(uint);
SDL_bool SDL_PixelFormatEnumToMasks(uint,int*,uint*,uint*,uint*,uint*);
uint SDL_MasksToPixelFormatEnum(int,uint,uint,uint,uint);
SDL_PixelFormat* SDL_AllocFormat(uint);
void SDL_FreeFormat(SDL_PixelFormat*);
SDL_Palette* SDL_AllocPalette(int);
int SDL_SetPixelFormatPalette(SDL_PixelFormat*,SDL_Palette*);
int SDL_SetPaletteColors(SDL_Palette*,const(SDL_Color)*,int,int);
void SDL_FreePalette(SDL_Palette*);
uint SDL_MapRGB(const(SDL_PixelFormat)*,ubyte,ubyte,ubyte);
uint SDL_MapRGBA(const(SDL_PixelFormat)*,ubyte,ubyte,ubyte,ubyte);
void SDL_GetRGB(uint,const(SDL_PixelFormat)*,ubyte*,ubyte*,ubyte*);
void SDL_GetRGBA(uint,const(SDL_PixelFormat)*,ubyte*,ubyte*,ubyte*,ubyte*);
void SDL_CalculateGammaRamp(float,ushort*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetPixelFormatName = const(char)* function(uint);
alias pSDL_PixelFormatEnumToMasks = SDL_bool function(uint,int*,uint*,uint*,uint*,uint*);
alias pSDL_MasksToPixelFormatEnum = uint function(int,uint,uint,uint,uint);
alias pSDL_AllocFormat = SDL_PixelFormat* function(uint);
alias pSDL_FreeFormat = void function(SDL_PixelFormat*);
alias pSDL_AllocPalette = SDL_Palette* function(int);
alias pSDL_SetPixelFormatPalette = int function(SDL_PixelFormat*,SDL_Palette*);
alias pSDL_SetPaletteColors = int function(SDL_Palette*,const(SDL_Color)*,int,int);
alias pSDL_FreePalette = void function(SDL_Palette*);
alias pSDL_MapRGB = uint function(const(SDL_PixelFormat)*,ubyte,ubyte,ubyte);
alias pSDL_MapRGBA = uint function(const(SDL_PixelFormat)*,ubyte,ubyte,ubyte,ubyte);
alias pSDL_GetRGB = void function(uint,const(SDL_PixelFormat)*,ubyte*,ubyte*,ubyte*);
alias pSDL_GetRGBA = void function(uint,const(SDL_PixelFormat)*,ubyte*,ubyte*,ubyte*,ubyte*);
alias pSDL_CalculateGammaRamp = void function(float,ushort*);
}
__gshared {
pSDL_GetPixelFormatName SDL_GetPixelFormatName;
pSDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks;
pSDL_MasksToPixelFormatEnum SDL_MasksToPixelFormatEnum;
pSDL_AllocFormat SDL_AllocFormat;
pSDL_FreeFormat SDL_FreeFormat;
pSDL_AllocPalette SDL_AllocPalette;
pSDL_SetPixelFormatPalette SDL_SetPixelFormatPalette;
pSDL_SetPaletteColors SDL_SetPaletteColors;
pSDL_FreePalette SDL_FreePalette;
pSDL_MapRGB SDL_MapRGB;
pSDL_MapRGBA SDL_MapRGBA;
pSDL_GetRGB SDL_GetRGB;
pSDL_GetRGBA SDL_GetRGBA;
pSDL_CalculateGammaRamp SDL_CalculateGammaRamp;
}
}

View file

@ -0,0 +1,22 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlplatform;
version(BindSDL_Static) {
extern(C) @nogc nothrow {
const(char)* SDL_GetPlatform();
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetPlatform = const(char)* function();
}
__gshared {
pSDL_GetPlatform SDL_GetPlatform;
}
}

View file

@ -0,0 +1,33 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlpower;
import bindbc.sdl.config;
enum SDL_PowerState {
SDL_POWERSTATE_UNKNOWN,
SDL_POWERSTATE_ON_BATTERY,
SDL_POWERSTATE_NO_BATTERY,
SDL_POWERSTATE_CHARGING,
SDL_POWERSTATE_CHARGED
}
mixin(expandEnum!SDL_PowerState);
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_PowerState SDL_GetPowerInfo(int*,int*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetPowerInfo = SDL_PowerState function(int*,int*);
}
__gshared {
pSDL_GetPowerInfo SDL_GetPowerInfo;
}
}

View file

@ -0,0 +1,80 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlrect;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
struct SDL_Point {
int x;
int y;
}
struct SDL_Rect {
int x, y;
int w, h;
}
static if(sdlSupport >= SDLSupport.sdl2010) {
struct SDL_FPoint {
float x, y;
}
struct SDL_FRect {
float x, y;
float w, h;
}
}
@nogc nothrow pure {
// This macro was added to SDL_rect.h in 2.0.4, but hurts nothing to implement for
// all versions.
bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) {
pragma(inline, true);
return ((p.x >= r.x) && (p.x < (r.x + r.w)) &&
(p.y >= r.y) && (p.y < (r.y + r.h)));
}
bool SDL_RectEmpty(const(SDL_Rect)* X) {
pragma(inline, true);
return !X || (X.w <= 0) || (X.h <= 0);
}
bool SDL_RectEquals(const(SDL_Rect)* A, const(SDL_Rect)* B) {
pragma(inline, true);
return A && B &&
(A.x == B.x) && (A.y == B.y) &&
(A.w == B.w) && (A.h == B.h);
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_bool SDL_HasIntersection(const(SDL_Rect)*,const(SDL_Rect)*);
SDL_bool SDL_IntersectRect(const(SDL_Rect)*,const(SDL_Rect)*,SDL_Rect*);
void SDL_UnionRect(const(SDL_Rect)*,const(SDL_Rect)*,SDL_Rect*);
SDL_bool SDL_EnclosePoints(const(SDL_Point)*,int,const(SDL_Rect)*,SDL_Rect*);
SDL_bool SDL_IntersectRectAndLine(const(SDL_Rect)*,int*,int*,int*,int*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_HasIntersection = SDL_bool function(const(SDL_Rect)*,const(SDL_Rect)*);
alias pSDL_IntersectRect = SDL_bool function(const(SDL_Rect)*,const(SDL_Rect)*,SDL_Rect*);
alias pSDL_UnionRect = void function(const(SDL_Rect)*,const(SDL_Rect)*,SDL_Rect*);
alias pSDL_EnclosePoints = SDL_bool function(const(SDL_Point)*,int,const(SDL_Rect)*,SDL_Rect*);
alias pSDL_IntersectRectAndLine = SDL_bool function(const(SDL_Rect)*,int*,int*,int*,int*);
}
__gshared {
pSDL_HasIntersection SDL_HasIntersection;
pSDL_IntersectRect SDL_IntersectRect;
pSDL_UnionRect SDL_UnionRect;
pSDL_EnclosePoints SDL_EnclosePoints;
pSDL_IntersectRectAndLine SDL_IntersectRectAndLine;
}
}

View file

@ -0,0 +1,316 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlrender;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlblendmode : SDL_BlendMode;
import bindbc.sdl.bind.sdlrect;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
import bindbc.sdl.bind.sdlsurface : SDL_Surface;
import bindbc.sdl.bind.sdlvideo : SDL_Window;
enum SDL_RendererFlags : uint {
SDL_RENDERER_SOFTWARE = 0x00000001,
SDL_RENDERER_ACCELERATED = 0x00000002,
SDL_RENDERER_PRESENTVSYNC = 0x00000004,
SDL_RENDERER_TARGETTEXTURE = 0x00000008,
}
mixin(expandEnum!SDL_RendererFlags);
struct SDL_RendererInfo {
const(char)* name;
SDL_RendererFlags flags;
uint num_texture_formats;
uint[16] texture_formats;
int max_texture_width;
int max_texture_height;
}
enum SDL_TextureAccess {
SDL_TEXTUREACCESS_STATIC,
SDL_TEXTUREACCESS_STREAMING,
SDL_TEXTUREACCESS_TARGET,
}
mixin(expandEnum!SDL_TextureAccess);
enum SDL_TextureModulate {
SDL_TEXTUREMODULATE_NONE = 0x00000000,
SDL_TEXTUREMODULATE_COLOR = 0x00000001,
SDL_TEXTUREMODULATE_ALPHA = 0x00000002
}
mixin(expandEnum!SDL_TextureModulate);
enum SDL_RendererFlip {
SDL_FLIP_NONE = 0x00000000,
SDL_FLIP_HORIZONTAL = 0x00000001,
SDL_FLIP_VERTICAL = 0x00000002,
}
mixin(expandEnum!SDL_RendererFlip);
struct SDL_Renderer;
struct SDL_Texture;
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_GetNumRenderDrivers();
int SDL_GetRenderDriverInfo(int,SDL_RendererInfo*);
int SDL_CreateWindowAndRenderer(int,int,uint,SDL_Window**,SDL_Renderer**);
SDL_Renderer* SDL_CreateRenderer(SDL_Window*,int,SDL_RendererFlags);
SDL_Renderer* SDL_CreateSoftwareRenderer(SDL_Surface*);
SDL_Renderer* SDL_GetRenderer(SDL_Window*);
int SDL_GetRendererInfo(SDL_Renderer*,SDL_RendererInfo*);
int SDL_GetRendererOutputSize(SDL_Renderer*,int*,int*);
SDL_Texture* SDL_CreateTexture(SDL_Renderer*,uint,SDL_TextureAccess,int,int);
SDL_Texture* SDL_CreateTextureFromSurface(SDL_Renderer*,SDL_Surface*);
int SDL_QueryTexture(SDL_Texture*,uint*,int*,int*,int*);
int SDL_SetTextureColorMod(SDL_Texture*,ubyte,ubyte,ubyte);
int SDL_GetTextureColorMod(SDL_Texture*,ubyte*,ubyte*,ubyte*);
int SDL_SetTextureAlphaMod(SDL_Texture*,ubyte);
int SDL_GetTextureAlphaMod(SDL_Texture*,ubyte*);
int SDL_SetTextureBlendMode(SDL_Texture*,SDL_BlendMode);
int SDL_GetTextureBlendMode(SDL_Texture*,SDL_BlendMode*);
int SDL_UpdateTexture(SDL_Texture*,const(SDL_Rect)*,const(void)*,int);
int SDL_LockTexture(SDL_Texture*,const(SDL_Rect)*,void**,int*);
void SDL_UnlockTexture(SDL_Texture*);
SDL_bool SDL_RenderTargetSupported(SDL_Renderer*);
int SDL_SetRenderTarget(SDL_Renderer*,SDL_Texture*);
SDL_Texture* SDL_GetRenderTarget(SDL_Renderer*);
int SDL_RenderSetClipRect(SDL_Renderer*,const(SDL_Rect)*);
void SDL_RenderGetClipRect(SDL_Renderer* renderer,SDL_Rect*);
int SDL_RenderSetLogicalSize(SDL_Renderer*,int,int);
void SDL_RenderGetLogicalSize(SDL_Renderer*,int*,int*);
int SDL_RenderSetViewport(SDL_Renderer*,const(SDL_Rect)*);
void SDL_RenderGetViewport(SDL_Renderer*,SDL_Rect*);
int SDL_RenderSetScale(SDL_Renderer*,float,float);
int SDL_RenderGetScale(SDL_Renderer*,float*,float*);
int SDL_SetRenderDrawColor(SDL_Renderer*,ubyte,ubyte,ubyte,ubyte);
int SDL_GetRenderDrawColor(SDL_Renderer*,ubyte*,ubyte*,ubyte*,ubyte*);
int SDL_SetRenderDrawBlendMode(SDL_Renderer*,SDL_BlendMode);
int SDL_GetRenderDrawBlendMode(SDL_Renderer*,SDL_BlendMode*);
int SDL_RenderClear(SDL_Renderer*);
int SDL_RenderDrawPoint(SDL_Renderer*,int,int);
int SDL_RenderDrawPoints(SDL_Renderer*,const(SDL_Point)*,int);
int SDL_RenderDrawLine(SDL_Renderer*,int,int,int,int);
int SDL_RenderDrawLines(SDL_Renderer*,const(SDL_Point)*,int);
int SDL_RenderDrawRect(SDL_Renderer*,const(SDL_Rect)*);
int SDL_RenderDrawRects(SDL_Renderer*,const(SDL_Rect)*,int);
int SDL_RenderFillRect(SDL_Renderer*,const(SDL_Rect)*);
int SDL_RenderFillRects(SDL_Renderer*,const(SDL_Rect)*,int);
int SDL_RenderCopy(SDL_Renderer*,SDL_Texture*,const(SDL_Rect)*,const(SDL_Rect*));
int SDL_RenderCopyEx(SDL_Renderer*,SDL_Texture*,const(SDL_Rect)*,const(SDL_Rect)*,const(double),const(SDL_Point)*,const(SDL_RendererFlip));
int SDL_RenderReadPixels(SDL_Renderer*,const(SDL_Rect)*,uint,void*,int);
void SDL_RenderPresent(SDL_Renderer*);
void SDL_DestroyTexture(SDL_Texture*);
void SDL_DestroyRenderer(SDL_Renderer*);
int SDL_GL_BindTexture(SDL_Texture*,float*,float*);
int SDL_GL_UnbindTexture(SDL_Texture*);
static if(sdlSupport >= SDLSupport.sdl201) {
int SDL_UpdateYUVTexture(SDL_Texture*,const(SDL_Rect)*,const(ubyte)*,int,const(ubyte)*,int,const(ubyte)*,int);
}
static if(sdlSupport >= SDLSupport.sdl204) {
SDL_bool SDL_RenderIsClipEnabled(SDL_Renderer*);
}
static if(sdlSupport >= SDLSupport.sdl205) {
SDL_bool SDL_RenderGetIntegerScale(SDL_Renderer*);
int SDL_RenderSetIntegerScale(SDL_Renderer*,SDL_bool);
}
static if(sdlSupport >= SDLSupport.sdl208) {
void* SDL_RenderGetMetalLayer(SDL_Renderer*);
void* SDL_RenderGetMetalCommandEncoder(SDL_Renderer*);
}
static if(sdlSupport >= SDLSupport.sdl2010) {
int SDL_RenderDrawPointF(SDL_Renderer*,float,float);
int SDL_RenderDrawPointsF(SDL_Renderer*,const(SDL_FPoint)*,int);
int SDL_RenderDrawLineF(SDL_Renderer*,float,float,float,float);
int SDL_RenderDrawLinesF(SDL_Renderer*,const(SDL_FPoint)*,int);
int SDL_RenderDrawRectF(SDL_Renderer*,const(SDL_FRect)*);
int SDL_RenderDrawRectsF(SDL_Renderer*,const(SDL_FRect)*,int);
int SDL_RenderFillRectF(SDL_Renderer*,const(SDL_FRect)*);
int SDL_RenderFillRectsF(SDL_Renderer*,const(SDL_FRect)*,int);
int SDL_RenderCopyF(SDL_Renderer*,SDL_Texture*,const(SDL_FRect)*,const(SDL_FRect)*);
int SDL_RenderCopyExF(SDL_Renderer*,SDL_Texture*,const(SDL_FRect)*,const(SDL_FRect)*,const(double),const(SDL_FPoint)*,const(SDL_RendererFlip));
int SDL_RenderFlush(SDL_Renderer*);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetNumRenderDrivers = int function();
alias pSDL_GetRenderDriverInfo = int function(int,SDL_RendererInfo*);
alias pSDL_CreateWindowAndRenderer = int function(int,int,uint,SDL_Window**,SDL_Renderer**);
alias pSDL_CreateRenderer = SDL_Renderer* function(SDL_Window*,int,SDL_RendererFlags);
alias pSDL_CreateSoftwareRenderer = SDL_Renderer* function(SDL_Surface*);
alias pSDL_GetRenderer = SDL_Renderer* function(SDL_Window*);
alias pSDL_GetRendererInfo = int function(SDL_Renderer*,SDL_RendererInfo*);
alias pSDL_GetRendererOutputSize = int function(SDL_Renderer*,int*,int*);
alias pSDL_CreateTexture = SDL_Texture* function(SDL_Renderer*,uint,SDL_TextureAccess,int,int);
alias pSDL_CreateTextureFromSurface = SDL_Texture* function(SDL_Renderer*,SDL_Surface*);
alias pSDL_QueryTexture = int function(SDL_Texture*,uint*,int*,int*,int*);
alias pSDL_SetTextureColorMod = int function(SDL_Texture*,ubyte,ubyte,ubyte);
alias pSDL_GetTextureColorMod = int function(SDL_Texture*,ubyte*,ubyte*,ubyte*);
alias pSDL_SetTextureAlphaMod = int function(SDL_Texture*,ubyte);
alias pSDL_GetTextureAlphaMod = int function(SDL_Texture*,ubyte*);
alias pSDL_SetTextureBlendMode = int function(SDL_Texture*,SDL_BlendMode);
alias pSDL_GetTextureBlendMode = int function(SDL_Texture*,SDL_BlendMode*);
alias pSDL_UpdateTexture = int function(SDL_Texture*,const(SDL_Rect)*,const(void)*,int);
alias pSDL_LockTexture = int function(SDL_Texture*,const(SDL_Rect)*,void**,int*);
alias pSDL_UnlockTexture = void function(SDL_Texture*);
alias pSDL_RenderTargetSupported = SDL_bool function(SDL_Renderer*);
alias pSDL_SetRenderTarget = int function(SDL_Renderer*,SDL_Texture*);
alias pSDL_GetRenderTarget = SDL_Texture* function(SDL_Renderer*);
alias pSDL_RenderSetClipRect = int function(SDL_Renderer*,const(SDL_Rect)*);
alias pSDL_RenderGetClipRect = void function(SDL_Renderer* renderer,SDL_Rect*);
alias pSDL_RenderSetLogicalSize = int function(SDL_Renderer*,int,int);
alias pSDL_RenderGetLogicalSize = void function(SDL_Renderer*,int*,int*);
alias pSDL_RenderSetViewport = int function(SDL_Renderer*,const(SDL_Rect)*);
alias pSDL_RenderGetViewport = void function(SDL_Renderer*,SDL_Rect*);
alias pSDL_RenderSetScale = int function(SDL_Renderer*,float,float);
alias pSDL_RenderGetScale = int function(SDL_Renderer*,float*,float*);
alias pSDL_SetRenderDrawColor = int function(SDL_Renderer*,ubyte,ubyte,ubyte,ubyte);
alias pSDL_GetRenderDrawColor = int function(SDL_Renderer*,ubyte*,ubyte*,ubyte*,ubyte*);
alias pSDL_SetRenderDrawBlendMode = int function(SDL_Renderer*,SDL_BlendMode);
alias pSDL_GetRenderDrawBlendMode = int function(SDL_Renderer*,SDL_BlendMode*);
alias pSDL_RenderClear = int function(SDL_Renderer*);
alias pSDL_RenderDrawPoint = int function(SDL_Renderer*,int,int);
alias pSDL_RenderDrawPoints = int function(SDL_Renderer*,const(SDL_Point)*,int);
alias pSDL_RenderDrawLine = int function(SDL_Renderer*,int,int,int,int);
alias pSDL_RenderDrawLines = int function(SDL_Renderer*,const(SDL_Point)*,int);
alias pSDL_RenderDrawRect = int function(SDL_Renderer*,const(SDL_Rect)*);
alias pSDL_RenderDrawRects = int function(SDL_Renderer*,const(SDL_Rect)*,int);
alias pSDL_RenderFillRect = int function(SDL_Renderer*,const(SDL_Rect)*);
alias pSDL_RenderFillRects = int function(SDL_Renderer*,const(SDL_Rect)*,int);
alias pSDL_RenderCopy = int function(SDL_Renderer*,SDL_Texture*,const(SDL_Rect)*,const(SDL_Rect*));
alias pSDL_RenderCopyEx = int function(SDL_Renderer*,SDL_Texture*,const(SDL_Rect)*,const(SDL_Rect)*,const(double),const(SDL_Point)*,const(SDL_RendererFlip));
alias pSDL_RenderReadPixels = int function(SDL_Renderer*,const(SDL_Rect)*,uint,void*,int);
alias pSDL_RenderPresent = void function(SDL_Renderer*);
alias pSDL_DestroyTexture = void function(SDL_Texture*);
alias pSDL_DestroyRenderer = void function(SDL_Renderer*);
alias pSDL_GL_BindTexture = int function(SDL_Texture*,float*,float*);
alias pSDL_GL_UnbindTexture = int function(SDL_Texture*);
}
__gshared {
pSDL_GetNumRenderDrivers SDL_GetNumRenderDrivers;
pSDL_GetRenderDriverInfo SDL_GetRenderDriverInfo;
pSDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer;
pSDL_CreateRenderer SDL_CreateRenderer;
pSDL_CreateSoftwareRenderer SDL_CreateSoftwareRenderer;
pSDL_GetRenderer SDL_GetRenderer;
pSDL_GetRendererInfo SDL_GetRendererInfo;
pSDL_GetRendererOutputSize SDL_GetRendererOutputSize;
pSDL_CreateTexture SDL_CreateTexture;
pSDL_CreateTextureFromSurface SDL_CreateTextureFromSurface;
pSDL_QueryTexture SDL_QueryTexture;
pSDL_SetTextureColorMod SDL_SetTextureColorMod;
pSDL_GetTextureColorMod SDL_GetTextureColorMod;
pSDL_SetTextureAlphaMod SDL_SetTextureAlphaMod;
pSDL_GetTextureAlphaMod SDL_GetTextureAlphaMod;
pSDL_SetTextureBlendMode SDL_SetTextureBlendMode;
pSDL_GetTextureBlendMode SDL_GetTextureBlendMode;
pSDL_UpdateTexture SDL_UpdateTexture;
pSDL_LockTexture SDL_LockTexture;
pSDL_UnlockTexture SDL_UnlockTexture;
pSDL_RenderTargetSupported SDL_RenderTargetSupported;
pSDL_SetRenderTarget SDL_SetRenderTarget;
pSDL_GetRenderTarget SDL_GetRenderTarget;
pSDL_RenderSetClipRect SDL_RenderSetClipRect;
pSDL_RenderGetClipRect SDL_RenderGetClipRect;
pSDL_RenderSetLogicalSize SDL_RenderSetLogicalSize;
pSDL_RenderGetLogicalSize SDL_RenderGetLogicalSize;
pSDL_RenderSetViewport SDL_RenderSetViewport;
pSDL_RenderGetViewport SDL_RenderGetViewport;
pSDL_RenderSetScale SDL_RenderSetScale;
pSDL_RenderGetScale SDL_RenderGetScale;
pSDL_SetRenderDrawColor SDL_SetRenderDrawColor;
pSDL_GetRenderDrawColor SDL_GetRenderDrawColor;
pSDL_SetRenderDrawBlendMode SDL_SetRenderDrawBlendMode;
pSDL_GetRenderDrawBlendMode SDL_GetRenderDrawBlendMode;
pSDL_RenderClear SDL_RenderClear;
pSDL_RenderDrawPoint SDL_RenderDrawPoint;
pSDL_RenderDrawPoints SDL_RenderDrawPoints;
pSDL_RenderDrawLine SDL_RenderDrawLine;
pSDL_RenderDrawLines SDL_RenderDrawLines;
pSDL_RenderDrawRect SDL_RenderDrawRect;
pSDL_RenderDrawRects SDL_RenderDrawRects;
pSDL_RenderFillRect SDL_RenderFillRect;
pSDL_RenderFillRects SDL_RenderFillRects;
pSDL_RenderCopy SDL_RenderCopy;
pSDL_RenderCopyEx SDL_RenderCopyEx;
pSDL_RenderReadPixels SDL_RenderReadPixels;
pSDL_RenderPresent SDL_RenderPresent;
pSDL_DestroyTexture SDL_DestroyTexture;
pSDL_DestroyRenderer SDL_DestroyRenderer;
pSDL_GL_BindTexture SDL_GL_BindTexture;
pSDL_GL_UnbindTexture SDL_GL_UnbindTexture;
}
static if(sdlSupport >= SDLSupport.sdl201) {
extern(C) @nogc nothrow {
alias pSDL_UpdateYUVTexture = int function(SDL_Texture*,const(SDL_Rect)*,const(ubyte)*,int,const(ubyte)*,int,const(ubyte)*,int);
}
__gshared {
pSDL_UpdateYUVTexture SDL_UpdateYUVTexture;
}
}
static if(sdlSupport >= SDLSupport.sdl204) {
extern(C) @nogc nothrow {
alias pSDL_RenderIsClipEnabled = SDL_bool function(SDL_Renderer*);
}
__gshared {
pSDL_RenderIsClipEnabled SDL_RenderIsClipEnabled;
}
}
static if(sdlSupport >= SDLSupport.sdl205) {
extern(C) @nogc nothrow {
alias pSDL_RenderGetIntegerScale = SDL_bool function(SDL_Renderer*);
alias pSDL_RenderSetIntegerScale = int function(SDL_Renderer*,SDL_bool);
}
__gshared {
pSDL_RenderGetIntegerScale SDL_RenderGetIntegerScale;
pSDL_RenderSetIntegerScale SDL_RenderSetIntegerScale;
}
}
static if(sdlSupport >= SDLSupport.sdl208) {
extern(C) @nogc nothrow {
alias pSDL_RenderGetMetalLayer = void* function(SDL_Renderer*);
alias pSDL_RenderGetMetalCommandEncoder = void* function(SDL_Renderer*);
}
__gshared {
pSDL_RenderGetMetalLayer SDL_RenderGetMetalLayer;
pSDL_RenderGetMetalCommandEncoder SDL_RenderGetMetalCommandEncoder;
}
}
static if(sdlSupport >= SDLSupport.sdl2010) {
extern(C) @nogc nothrow {
alias pSDL_RenderDrawPointF = int function(SDL_Renderer*,float,float);
alias pSDL_RenderDrawPointsF = int function(SDL_Renderer*,const(SDL_FPoint)*,int);
alias pSDL_RenderDrawLineF = int function(SDL_Renderer*,float,float,float,float);
alias pSDL_RenderDrawLinesF = int function(SDL_Renderer*,const(SDL_FPoint)*,int);
alias pSDL_RenderDrawRectF = int function(SDL_Renderer*,const(SDL_FRect)*);
alias pSDL_RenderDrawRectsF = int function(SDL_Renderer*,const(SDL_FRect)*,int);
alias pSDL_RenderFillRectF = int function(SDL_Renderer*,const(SDL_FRect)*);
alias pSDL_RenderFillRectsF = int function(SDL_Renderer*,const(SDL_FRect)*,int);
alias pSDL_RenderCopyF = int function(SDL_Renderer*,SDL_Texture*,const(SDL_FRect)*,const(SDL_FRect)*);
alias pSDL_RenderCopyExF = int function(SDL_Renderer*,SDL_Texture*,const(SDL_FRect)*,const(SDL_FRect)*,const(double),const(SDL_FPoint)*,const(SDL_RendererFlip));
alias pSDL_RenderFlush = int function(SDL_Renderer*);
}
__gshared {
pSDL_RenderDrawPointF SDL_RenderDrawPointF;
pSDL_RenderDrawPointsF SDL_RenderDrawPointsF;
pSDL_RenderDrawLineF SDL_RenderDrawLineF;
pSDL_RenderDrawLinesF SDL_RenderDrawLinesF;
pSDL_RenderDrawRectF SDL_RenderDrawRectF;
pSDL_RenderDrawRectsF SDL_RenderDrawRectsF;
pSDL_RenderFillRectF SDL_RenderFillRectF;
pSDL_RenderFillRectsF SDL_RenderFillRectsF;
pSDL_RenderCopyF SDL_RenderCopyF;
pSDL_RenderCopyExF SDL_RenderCopyExF;
pSDL_RenderFlush SDL_RenderFlush;
}
}
}

View file

@ -0,0 +1,208 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlrwops;
//import core.stdc.stdio : FILE;
struct FILE
{
}
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
enum : uint {
SDL_RWOPS_UNKNOWN = 0,
SDL_RWOPS_WINFILE = 1,
SDL_RWOPS_STDFILE = 2,
SDL_RWOPS_JNIFILE = 3,
SDL_RWOPS_MEMORY = 4,
SDL_RWOPS_MEMORY_RO = 5,
}
struct SDL_RWops {
extern(C) @nogc nothrow {
long function(SDL_RWops*) size;
long function(SDL_RWops*, long, int) seek;
size_t function(SDL_RWops*, void*, size_t, size_t) read;
size_t function(SDL_RWops*, const(void)*, size_t, size_t) write;
int function(SDL_RWops*) close;
}
uint type;
union Hidden {
// version(Android)
version(Windows) {
struct Windowsio {
int append;
void* h;
struct Buffer {
void* data;
size_t size;
size_t left;
}
Buffer buffer;
}
Windowsio windowsio;
}
struct Stdio {
int autoclose;
FILE* fp;
}
Stdio stdio;
struct Mem {
ubyte* base;
ubyte* here;
ubyte* stop;
}
Mem mem;
struct Unknown {
void* data1;
void* data2;
}
Unknown unknown;
}
Hidden hidden;
}
enum {
RW_SEEK_SET = 0,
RW_SEEK_CUR = 1,
RW_SEEK_END = 2,
}
static if(sdlSupport < SDLSupport.sdl2010) {
@nogc nothrow {
long SDL_RWsize(SDL_RWops* ctx) { return ctx.size(ctx); }
long SDL_RWseek(SDL_RWops* ctx, long offset, int whence) { return ctx.seek(ctx, offset, whence); }
long SDL_RWtell(SDL_RWops* ctx) { return ctx.seek(ctx, 0, RW_SEEK_CUR); }
size_t SDL_RWread(SDL_RWops* ctx, void* ptr, size_t size, size_t n) { return ctx.read(ctx, ptr, size, n); }
size_t SDL_RWwrite(SDL_RWops* ctx, const(void)* ptr, size_t size, size_t n) { return ctx.write(ctx, ptr, size, n); }
int SDL_RWclose(SDL_RWops* ctx) { return ctx.close(ctx); }
}
}
static if(sdlSupport >= SDLSupport.sdl206) {
@nogc nothrow
void* SDL_LoadFile(const(char)* filename, size_t datasize) {
pragma(inline, true);
return SDL_LoadFile_RW(SDL_RWFromFile(filename, "rb"), datasize, 1);
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_RWops* SDL_RWFromFile(const(char)*,const(char)*);
SDL_RWops* SDL_RWFromFP(FILE*,SDL_bool);
SDL_RWops* SDL_RWFromMem(void*,int);
SDL_RWops* SDL_RWFromConstMem(const(void)*,int);
SDL_RWops* SDL_AllocRW();
void SDL_FreeRW(SDL_RWops*);
ubyte SDL_ReadU8(SDL_RWops*);
ushort SDL_ReadLE16(SDL_RWops*);
ushort SDL_ReadBE16(SDL_RWops*);
uint SDL_ReadLE32(SDL_RWops*);
uint SDL_ReadBE32(SDL_RWops*);
ulong SDL_ReadLE64(SDL_RWops*);
ulong SDL_ReadBE64(SDL_RWops*);
size_t SDL_WriteU8(SDL_RWops*,ubyte);
size_t SDL_WriteLE16(SDL_RWops*,ushort);
size_t SDL_WriteBE16(SDL_RWops*,ushort);
size_t SDL_WriteLE32(SDL_RWops*,uint);
size_t SDL_WriteBE32(SDL_RWops*,uint);
size_t SDL_WriteLE64(SDL_RWops*,ulong);
size_t SDL_WriteBE64(SDL_RWops*,ulong);
static if(sdlSupport >= SDLSupport.sdl206) {
void* SDL_LoadFile_RW(SDL_RWops*,size_t,int);
}
static if(sdlSupport >= SDLSupport.sdl2010) {
long SDL_RWsize(SDL_RWops*);
long SDL_RWseek(SDL_RWops*,long,int);
long SDL_RWtell(SDL_RWops*);
size_t SDL_RWread(SDL_RWops*,void*,size_t,size_t);
size_t SDL_RWwrite(SDL_RWops*,const(void)*,size_t,size_t);
int SDL_RWclose(SDL_RWops*);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_RWFromFile = SDL_RWops* function(const(char)*,const(char)*);
alias pSDL_RWFromFP = SDL_RWops* function(FILE*,SDL_bool);
alias pSDL_RWFromMem = SDL_RWops* function(void*,int);
alias pSDL_RWFromConstMem = SDL_RWops* function(const(void)*,int);
alias pSDL_AllocRW = SDL_RWops* function();
alias pSDL_FreeRW = void function(SDL_RWops*);
alias pSDL_ReadU8 = ubyte function(SDL_RWops*);
alias pSDL_ReadLE16 = ushort function(SDL_RWops*);
alias pSDL_ReadBE16 = ushort function(SDL_RWops*);
alias pSDL_ReadLE32 = uint function(SDL_RWops*);
alias pSDL_ReadBE32 = uint function(SDL_RWops*);
alias pSDL_ReadLE64 = ulong function(SDL_RWops*);
alias pSDL_ReadBE64 = ulong function(SDL_RWops*);
alias pSDL_WriteU8 = size_t function(SDL_RWops*,ubyte);
alias pSDL_WriteLE16 = size_t function(SDL_RWops*,ushort);
alias pSDL_WriteBE16 = size_t function(SDL_RWops*,ushort);
alias pSDL_WriteLE32 = size_t function(SDL_RWops*,uint);
alias pSDL_WriteBE32 = size_t function(SDL_RWops*,uint);
alias pSDL_WriteLE64 = size_t function(SDL_RWops*,ulong);
alias pSDL_WriteBE64 = size_t function(SDL_RWops*,ulong);
}
__gshared {
pSDL_RWFromFile SDL_RWFromFile;
pSDL_RWFromFP SDL_RWFromFP;
pSDL_RWFromMem SDL_RWFromMem;
pSDL_RWFromConstMem SDL_RWFromConstMem;
pSDL_AllocRW SDL_AllocRW;
pSDL_FreeRW SDL_FreeRW;
pSDL_ReadU8 SDL_ReadU8;
pSDL_ReadLE16 SDL_ReadLE16;
pSDL_ReadBE16 SDL_ReadBE16;
pSDL_ReadLE32 SDL_ReadLE32;
pSDL_ReadBE32 SDL_ReadBE32;
pSDL_ReadLE64 SDL_ReadLE64;
pSDL_ReadBE64 SDL_ReadBE64;
pSDL_WriteU8 SDL_WriteU8;
pSDL_WriteLE16 SDL_WriteLE16;
pSDL_WriteBE16 SDL_WriteBE16;
pSDL_WriteLE32 SDL_WriteLE32;
pSDL_WriteBE32 SDL_WriteBE32;
pSDL_WriteLE64 SDL_WriteLE64;
pSDL_WriteBE64 SDL_WriteBE64;
}
static if(sdlSupport >= SDLSupport.sdl206) {
extern(C) @nogc nothrow {
alias pSDL_LoadFile_RW = void* function(SDL_RWops*,size_t,int);
}
__gshared {
pSDL_LoadFile_RW SDL_LoadFile_RW;
}
}
static if(sdlSupport >= SDLSupport.sdl2010) {
extern(C) @nogc nothrow {
alias pSDL_RWsize = long function(SDL_RWops*);
alias pSDL_RWseek = long function(SDL_RWops*,long,int);
alias pSDL_RWtell = long function(SDL_RWops*);
alias pSDL_RWread = size_t function(SDL_RWops*,void*,size_t,size_t);
alias pSDL_RWwrite = size_t function(SDL_RWops*,const(void)*,size_t,size_t);
alias pSDL_RWclose = int function(SDL_RWops*);
}
__gshared {
pSDL_RWsize SDL_RWsize;
pSDL_RWseek SDL_RWseek;
pSDL_RWtell SDL_RWtell;
pSDL_RWread SDL_RWread;
pSDL_RWwrite SDL_RWwrite;
pSDL_RWclose SDL_RWclose;
}
}
}

View file

@ -0,0 +1,542 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlscancode;
import bindbc.sdl.config;
static if(sdlSupport >= SDLSupport.sdl206) {
enum SDL_Scancode {
SDL_SCANCODE_UNKNOWN = 0,
SDL_SCANCODE_A = 4,
SDL_SCANCODE_B = 5,
SDL_SCANCODE_C = 6,
SDL_SCANCODE_D = 7,
SDL_SCANCODE_E = 8,
SDL_SCANCODE_F = 9,
SDL_SCANCODE_G = 10,
SDL_SCANCODE_H = 11,
SDL_SCANCODE_I = 12,
SDL_SCANCODE_J = 13,
SDL_SCANCODE_K = 14,
SDL_SCANCODE_L = 15,
SDL_SCANCODE_M = 16,
SDL_SCANCODE_N = 17,
SDL_SCANCODE_O = 18,
SDL_SCANCODE_P = 19,
SDL_SCANCODE_Q = 20,
SDL_SCANCODE_R = 21,
SDL_SCANCODE_S = 22,
SDL_SCANCODE_T = 23,
SDL_SCANCODE_U = 24,
SDL_SCANCODE_V = 25,
SDL_SCANCODE_W = 26,
SDL_SCANCODE_X = 27,
SDL_SCANCODE_Y = 28,
SDL_SCANCODE_Z = 29,
SDL_SCANCODE_1 = 30,
SDL_SCANCODE_2 = 31,
SDL_SCANCODE_3 = 32,
SDL_SCANCODE_4 = 33,
SDL_SCANCODE_5 = 34,
SDL_SCANCODE_6 = 35,
SDL_SCANCODE_7 = 36,
SDL_SCANCODE_8 = 37,
SDL_SCANCODE_9 = 38,
SDL_SCANCODE_0 = 39,
SDL_SCANCODE_RETURN = 40,
SDL_SCANCODE_ESCAPE = 41,
SDL_SCANCODE_BACKSPACE = 42,
SDL_SCANCODE_TAB = 43,
SDL_SCANCODE_SPACE = 44,
SDL_SCANCODE_MINUS = 45,
SDL_SCANCODE_EQUALS = 46,
SDL_SCANCODE_LEFTBRACKET = 47,
SDL_SCANCODE_RIGHTBRACKET = 48,
SDL_SCANCODE_BACKSLASH = 49,
SDL_SCANCODE_NONUSHASH = 50,
SDL_SCANCODE_SEMICOLON = 51,
SDL_SCANCODE_APOSTROPHE = 52,
SDL_SCANCODE_GRAVE = 53,
SDL_SCANCODE_COMMA = 54,
SDL_SCANCODE_PERIOD = 55,
SDL_SCANCODE_SLASH = 56,
SDL_SCANCODE_CAPSLOCK = 57,
SDL_SCANCODE_F1 = 58,
SDL_SCANCODE_F2 = 59,
SDL_SCANCODE_F3 = 60,
SDL_SCANCODE_F4 = 61,
SDL_SCANCODE_F5 = 62,
SDL_SCANCODE_F6 = 63,
SDL_SCANCODE_F7 = 64,
SDL_SCANCODE_F8 = 65,
SDL_SCANCODE_F9 = 66,
SDL_SCANCODE_F10 = 67,
SDL_SCANCODE_F11 = 68,
SDL_SCANCODE_F12 = 69,
SDL_SCANCODE_PRINTSCREEN = 70,
SDL_SCANCODE_SCROLLLOCK = 71,
SDL_SCANCODE_PAUSE = 72,
SDL_SCANCODE_INSERT = 73,
SDL_SCANCODE_HOME = 74,
SDL_SCANCODE_PAGEUP = 75,
SDL_SCANCODE_DELETE = 76,
SDL_SCANCODE_END = 77,
SDL_SCANCODE_PAGEDOWN = 78,
SDL_SCANCODE_RIGHT = 79,
SDL_SCANCODE_LEFT = 80,
SDL_SCANCODE_DOWN = 81,
SDL_SCANCODE_UP = 82,
SDL_SCANCODE_NUMLOCKCLEAR = 83,
SDL_SCANCODE_KP_DIVIDE = 84,
SDL_SCANCODE_KP_MULTIPLY = 85,
SDL_SCANCODE_KP_MINUS = 86,
SDL_SCANCODE_KP_PLUS = 87,
SDL_SCANCODE_KP_ENTER = 88,
SDL_SCANCODE_KP_1 = 89,
SDL_SCANCODE_KP_2 = 90,
SDL_SCANCODE_KP_3 = 91,
SDL_SCANCODE_KP_4 = 92,
SDL_SCANCODE_KP_5 = 93,
SDL_SCANCODE_KP_6 = 94,
SDL_SCANCODE_KP_7 = 95,
SDL_SCANCODE_KP_8 = 96,
SDL_SCANCODE_KP_9 = 97,
SDL_SCANCODE_KP_0 = 98,
SDL_SCANCODE_KP_PERIOD = 99,
SDL_SCANCODE_NONUSBACKSLASH = 100,
SDL_SCANCODE_APPLICATION = 101,
SDL_SCANCODE_POWER = 102,
SDL_SCANCODE_KP_EQUALS = 103,
SDL_SCANCODE_F13 = 104,
SDL_SCANCODE_F14 = 105,
SDL_SCANCODE_F15 = 106,
SDL_SCANCODE_F16 = 107,
SDL_SCANCODE_F17 = 108,
SDL_SCANCODE_F18 = 109,
SDL_SCANCODE_F19 = 110,
SDL_SCANCODE_F20 = 111,
SDL_SCANCODE_F21 = 112,
SDL_SCANCODE_F22 = 113,
SDL_SCANCODE_F23 = 114,
SDL_SCANCODE_F24 = 115,
SDL_SCANCODE_EXECUTE = 116,
SDL_SCANCODE_HELP = 117,
SDL_SCANCODE_MENU = 118,
SDL_SCANCODE_SELECT = 119,
SDL_SCANCODE_STOP = 120,
SDL_SCANCODE_AGAIN = 121,
SDL_SCANCODE_UNDO = 122,
SDL_SCANCODE_CUT = 123,
SDL_SCANCODE_COPY = 124,
SDL_SCANCODE_PASTE = 125,
SDL_SCANCODE_FIND = 126,
SDL_SCANCODE_MUTE = 127,
SDL_SCANCODE_VOLUMEUP = 128,
SDL_SCANCODE_VOLUMEDOWN = 129,
SDL_SCANCODE_KP_COMMA = 133,
SDL_SCANCODE_KP_EQUALSAS400 = 134,
SDL_SCANCODE_INTERNATIONAL1 = 135,
SDL_SCANCODE_INTERNATIONAL2 = 136,
SDL_SCANCODE_INTERNATIONAL3 = 137,
SDL_SCANCODE_INTERNATIONAL4 = 138,
SDL_SCANCODE_INTERNATIONAL5 = 139,
SDL_SCANCODE_INTERNATIONAL6 = 140,
SDL_SCANCODE_INTERNATIONAL7 = 141,
SDL_SCANCODE_INTERNATIONAL8 = 142,
SDL_SCANCODE_INTERNATIONAL9 = 143,
SDL_SCANCODE_LANG1 = 144,
SDL_SCANCODE_LANG2 = 145,
SDL_SCANCODE_LANG3 = 146,
SDL_SCANCODE_LANG4 = 147,
SDL_SCANCODE_LANG5 = 148,
SDL_SCANCODE_LANG6 = 149,
SDL_SCANCODE_LANG7 = 150,
SDL_SCANCODE_LANG8 = 151,
SDL_SCANCODE_LANG9 = 152,
SDL_SCANCODE_ALTERASE = 153,
SDL_SCANCODE_SYSREQ = 154,
SDL_SCANCODE_CANCEL = 155,
SDL_SCANCODE_CLEAR = 156,
SDL_SCANCODE_PRIOR = 157,
SDL_SCANCODE_RETURN2 = 158,
SDL_SCANCODE_SEPARATOR = 159,
SDL_SCANCODE_OUT = 160,
SDL_SCANCODE_OPER = 161,
SDL_SCANCODE_CLEARAGAIN = 162,
SDL_SCANCODE_CRSEL = 163,
SDL_SCANCODE_EXSEL = 164,
SDL_SCANCODE_KP_00 = 176,
SDL_SCANCODE_KP_000 = 177,
SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
SDL_SCANCODE_DECIMALSEPARATOR = 179,
SDL_SCANCODE_CURRENCYUNIT = 180,
SDL_SCANCODE_CURRENCYSUBUNIT = 181,
SDL_SCANCODE_KP_LEFTPAREN = 182,
SDL_SCANCODE_KP_RIGHTPAREN = 183,
SDL_SCANCODE_KP_LEFTBRACE = 184,
SDL_SCANCODE_KP_RIGHTBRACE = 185,
SDL_SCANCODE_KP_TAB = 186,
SDL_SCANCODE_KP_BACKSPACE = 187,
SDL_SCANCODE_KP_A = 188,
SDL_SCANCODE_KP_B = 189,
SDL_SCANCODE_KP_C = 190,
SDL_SCANCODE_KP_D = 191,
SDL_SCANCODE_KP_E = 192,
SDL_SCANCODE_KP_F = 193,
SDL_SCANCODE_KP_XOR = 194,
SDL_SCANCODE_KP_POWER = 195,
SDL_SCANCODE_KP_PERCENT = 196,
SDL_SCANCODE_KP_LESS = 197,
SDL_SCANCODE_KP_GREATER = 198,
SDL_SCANCODE_KP_AMPERSAND = 199,
SDL_SCANCODE_KP_DBLAMPERSAND = 200,
SDL_SCANCODE_KP_VERTICALBAR = 201,
SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
SDL_SCANCODE_KP_COLON = 203,
SDL_SCANCODE_KP_HASH = 204,
SDL_SCANCODE_KP_SPACE = 205,
SDL_SCANCODE_KP_AT = 206,
SDL_SCANCODE_KP_EXCLAM = 207,
SDL_SCANCODE_KP_MEMSTORE = 208,
SDL_SCANCODE_KP_MEMRECALL = 209,
SDL_SCANCODE_KP_MEMCLEAR = 210,
SDL_SCANCODE_KP_MEMADD = 211,
SDL_SCANCODE_KP_MEMSUBTRACT = 212,
SDL_SCANCODE_KP_MEMMULTIPLY = 213,
SDL_SCANCODE_KP_MEMDIVIDE = 214,
SDL_SCANCODE_KP_PLUSMINUS = 215,
SDL_SCANCODE_KP_CLEAR = 216,
SDL_SCANCODE_KP_CLEARENTRY = 217,
SDL_SCANCODE_KP_BINARY = 218,
SDL_SCANCODE_KP_OCTAL = 219,
SDL_SCANCODE_KP_DECIMAL = 220,
SDL_SCANCODE_KP_HEXADECIMAL = 221,
SDL_SCANCODE_LCTRL = 224,
SDL_SCANCODE_LSHIFT = 225,
SDL_SCANCODE_LALT = 226,
SDL_SCANCODE_LGUI = 227,
SDL_SCANCODE_RCTRL = 228,
SDL_SCANCODE_RSHIFT = 229,
SDL_SCANCODE_RALT = 230,
SDL_SCANCODE_RGUI = 231,
SDL_SCANCODE_MODE = 257,
SDL_SCANCODE_AUDIONEXT = 258,
SDL_SCANCODE_AUDIOPREV = 259,
SDL_SCANCODE_AUDIOSTOP = 260,
SDL_SCANCODE_AUDIOPLAY = 261,
SDL_SCANCODE_AUDIOMUTE = 262,
SDL_SCANCODE_MEDIASELECT = 263,
SDL_SCANCODE_WWW = 264,
SDL_SCANCODE_MAIL = 265,
SDL_SCANCODE_CALCULATOR = 266,
SDL_SCANCODE_COMPUTER = 267,
SDL_SCANCODE_AC_SEARCH = 268,
SDL_SCANCODE_AC_HOME = 269,
SDL_SCANCODE_AC_BACK = 270,
SDL_SCANCODE_AC_FORWARD = 271,
SDL_SCANCODE_AC_STOP = 272,
SDL_SCANCODE_AC_REFRESH = 273,
SDL_SCANCODE_AC_BOOKMARKS = 274,
SDL_SCANCODE_BRIGHTNESSDOWN = 275,
SDL_SCANCODE_BRIGHTNESSUP = 276,
SDL_SCANCODE_DISPLAYSWITCH = 277,
SDL_SCANCODE_KBDILLUMTOGGLE = 278,
SDL_SCANCODE_KBDILLUMDOWN = 279,
SDL_SCANCODE_KBDILLUMUP = 280,
SDL_SCANCODE_EJECT = 281,
SDL_SCANCODE_SLEEP = 282,
SDL_SCANCODE_APP1 = 283,
SDL_SCANCODE_APP2 = 284,
SDL_SCANCODE_AUDIOREWIND = 285,
SDL_SCANCODE_AUDIOFASTFORWARD = 286,
SDL_NUM_SCANCODES = 512
}
}
else {
enum SDL_Scancode {
SDL_SCANCODE_UNKNOWN = 0,
SDL_SCANCODE_A = 4,
SDL_SCANCODE_B = 5,
SDL_SCANCODE_C = 6,
SDL_SCANCODE_D = 7,
SDL_SCANCODE_E = 8,
SDL_SCANCODE_F = 9,
SDL_SCANCODE_G = 10,
SDL_SCANCODE_H = 11,
SDL_SCANCODE_I = 12,
SDL_SCANCODE_J = 13,
SDL_SCANCODE_K = 14,
SDL_SCANCODE_L = 15,
SDL_SCANCODE_M = 16,
SDL_SCANCODE_N = 17,
SDL_SCANCODE_O = 18,
SDL_SCANCODE_P = 19,
SDL_SCANCODE_Q = 20,
SDL_SCANCODE_R = 21,
SDL_SCANCODE_S = 22,
SDL_SCANCODE_T = 23,
SDL_SCANCODE_U = 24,
SDL_SCANCODE_V = 25,
SDL_SCANCODE_W = 26,
SDL_SCANCODE_X = 27,
SDL_SCANCODE_Y = 28,
SDL_SCANCODE_Z = 29,
SDL_SCANCODE_1 = 30,
SDL_SCANCODE_2 = 31,
SDL_SCANCODE_3 = 32,
SDL_SCANCODE_4 = 33,
SDL_SCANCODE_5 = 34,
SDL_SCANCODE_6 = 35,
SDL_SCANCODE_7 = 36,
SDL_SCANCODE_8 = 37,
SDL_SCANCODE_9 = 38,
SDL_SCANCODE_0 = 39,
SDL_SCANCODE_RETURN = 40,
SDL_SCANCODE_ESCAPE = 41,
SDL_SCANCODE_BACKSPACE = 42,
SDL_SCANCODE_TAB = 43,
SDL_SCANCODE_SPACE = 44,
SDL_SCANCODE_MINUS = 45,
SDL_SCANCODE_EQUALS = 46,
SDL_SCANCODE_LEFTBRACKET = 47,
SDL_SCANCODE_RIGHTBRACKET = 48,
SDL_SCANCODE_BACKSLASH = 49,
SDL_SCANCODE_NONUSHASH = 50,
SDL_SCANCODE_SEMICOLON = 51,
SDL_SCANCODE_APOSTROPHE = 52,
SDL_SCANCODE_GRAVE = 53,
SDL_SCANCODE_COMMA = 54,
SDL_SCANCODE_PERIOD = 55,
SDL_SCANCODE_SLASH = 56,
SDL_SCANCODE_CAPSLOCK = 57,
SDL_SCANCODE_F1 = 58,
SDL_SCANCODE_F2 = 59,
SDL_SCANCODE_F3 = 60,
SDL_SCANCODE_F4 = 61,
SDL_SCANCODE_F5 = 62,
SDL_SCANCODE_F6 = 63,
SDL_SCANCODE_F7 = 64,
SDL_SCANCODE_F8 = 65,
SDL_SCANCODE_F9 = 66,
SDL_SCANCODE_F10 = 67,
SDL_SCANCODE_F11 = 68,
SDL_SCANCODE_F12 = 69,
SDL_SCANCODE_PRINTSCREEN = 70,
SDL_SCANCODE_SCROLLLOCK = 71,
SDL_SCANCODE_PAUSE = 72,
SDL_SCANCODE_INSERT = 73,
SDL_SCANCODE_HOME = 74,
SDL_SCANCODE_PAGEUP = 75,
SDL_SCANCODE_DELETE = 76,
SDL_SCANCODE_END = 77,
SDL_SCANCODE_PAGEDOWN = 78,
SDL_SCANCODE_RIGHT = 79,
SDL_SCANCODE_LEFT = 80,
SDL_SCANCODE_DOWN = 81,
SDL_SCANCODE_UP = 82,
SDL_SCANCODE_NUMLOCKCLEAR = 83,
SDL_SCANCODE_KP_DIVIDE = 84,
SDL_SCANCODE_KP_MULTIPLY = 85,
SDL_SCANCODE_KP_MINUS = 86,
SDL_SCANCODE_KP_PLUS = 87,
SDL_SCANCODE_KP_ENTER = 88,
SDL_SCANCODE_KP_1 = 89,
SDL_SCANCODE_KP_2 = 90,
SDL_SCANCODE_KP_3 = 91,
SDL_SCANCODE_KP_4 = 92,
SDL_SCANCODE_KP_5 = 93,
SDL_SCANCODE_KP_6 = 94,
SDL_SCANCODE_KP_7 = 95,
SDL_SCANCODE_KP_8 = 96,
SDL_SCANCODE_KP_9 = 97,
SDL_SCANCODE_KP_0 = 98,
SDL_SCANCODE_KP_PERIOD = 99,
SDL_SCANCODE_NONUSBACKSLASH = 100,
SDL_SCANCODE_APPLICATION = 101,
SDL_SCANCODE_POWER = 102,
SDL_SCANCODE_KP_EQUALS = 103,
SDL_SCANCODE_F13 = 104,
SDL_SCANCODE_F14 = 105,
SDL_SCANCODE_F15 = 106,
SDL_SCANCODE_F16 = 107,
SDL_SCANCODE_F17 = 108,
SDL_SCANCODE_F18 = 109,
SDL_SCANCODE_F19 = 110,
SDL_SCANCODE_F20 = 111,
SDL_SCANCODE_F21 = 112,
SDL_SCANCODE_F22 = 113,
SDL_SCANCODE_F23 = 114,
SDL_SCANCODE_F24 = 115,
SDL_SCANCODE_EXECUTE = 116,
SDL_SCANCODE_HELP = 117,
SDL_SCANCODE_MENU = 118,
SDL_SCANCODE_SELECT = 119,
SDL_SCANCODE_STOP = 120,
SDL_SCANCODE_AGAIN = 121,
SDL_SCANCODE_UNDO = 122,
SDL_SCANCODE_CUT = 123,
SDL_SCANCODE_COPY = 124,
SDL_SCANCODE_PASTE = 125,
SDL_SCANCODE_FIND = 126,
SDL_SCANCODE_MUTE = 127,
SDL_SCANCODE_VOLUMEUP = 128,
SDL_SCANCODE_VOLUMEDOWN = 129,
SDL_SCANCODE_KP_COMMA = 133,
SDL_SCANCODE_KP_EQUALSAS400 = 134,
SDL_SCANCODE_INTERNATIONAL1 = 135,
SDL_SCANCODE_INTERNATIONAL2 = 136,
SDL_SCANCODE_INTERNATIONAL3 = 137,
SDL_SCANCODE_INTERNATIONAL4 = 138,
SDL_SCANCODE_INTERNATIONAL5 = 139,
SDL_SCANCODE_INTERNATIONAL6 = 140,
SDL_SCANCODE_INTERNATIONAL7 = 141,
SDL_SCANCODE_INTERNATIONAL8 = 142,
SDL_SCANCODE_INTERNATIONAL9 = 143,
SDL_SCANCODE_LANG1 = 144,
SDL_SCANCODE_LANG2 = 145,
SDL_SCANCODE_LANG3 = 146,
SDL_SCANCODE_LANG4 = 147,
SDL_SCANCODE_LANG5 = 148,
SDL_SCANCODE_LANG6 = 149,
SDL_SCANCODE_LANG7 = 150,
SDL_SCANCODE_LANG8 = 151,
SDL_SCANCODE_LANG9 = 152,
SDL_SCANCODE_ALTERASE = 153,
SDL_SCANCODE_SYSREQ = 154,
SDL_SCANCODE_CANCEL = 155,
SDL_SCANCODE_CLEAR = 156,
SDL_SCANCODE_PRIOR = 157,
SDL_SCANCODE_RETURN2 = 158,
SDL_SCANCODE_SEPARATOR = 159,
SDL_SCANCODE_OUT = 160,
SDL_SCANCODE_OPER = 161,
SDL_SCANCODE_CLEARAGAIN = 162,
SDL_SCANCODE_CRSEL = 163,
SDL_SCANCODE_EXSEL = 164,
SDL_SCANCODE_KP_00 = 176,
SDL_SCANCODE_KP_000 = 177,
SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
SDL_SCANCODE_DECIMALSEPARATOR = 179,
SDL_SCANCODE_CURRENCYUNIT = 180,
SDL_SCANCODE_CURRENCYSUBUNIT = 181,
SDL_SCANCODE_KP_LEFTPAREN = 182,
SDL_SCANCODE_KP_RIGHTPAREN = 183,
SDL_SCANCODE_KP_LEFTBRACE = 184,
SDL_SCANCODE_KP_RIGHTBRACE = 185,
SDL_SCANCODE_KP_TAB = 186,
SDL_SCANCODE_KP_BACKSPACE = 187,
SDL_SCANCODE_KP_A = 188,
SDL_SCANCODE_KP_B = 189,
SDL_SCANCODE_KP_C = 190,
SDL_SCANCODE_KP_D = 191,
SDL_SCANCODE_KP_E = 192,
SDL_SCANCODE_KP_F = 193,
SDL_SCANCODE_KP_XOR = 194,
SDL_SCANCODE_KP_POWER = 195,
SDL_SCANCODE_KP_PERCENT = 196,
SDL_SCANCODE_KP_LESS = 197,
SDL_SCANCODE_KP_GREATER = 198,
SDL_SCANCODE_KP_AMPERSAND = 199,
SDL_SCANCODE_KP_DBLAMPERSAND = 200,
SDL_SCANCODE_KP_VERTICALBAR = 201,
SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
SDL_SCANCODE_KP_COLON = 203,
SDL_SCANCODE_KP_HASH = 204,
SDL_SCANCODE_KP_SPACE = 205,
SDL_SCANCODE_KP_AT = 206,
SDL_SCANCODE_KP_EXCLAM = 207,
SDL_SCANCODE_KP_MEMSTORE = 208,
SDL_SCANCODE_KP_MEMRECALL = 209,
SDL_SCANCODE_KP_MEMCLEAR = 210,
SDL_SCANCODE_KP_MEMADD = 211,
SDL_SCANCODE_KP_MEMSUBTRACT = 212,
SDL_SCANCODE_KP_MEMMULTIPLY = 213,
SDL_SCANCODE_KP_MEMDIVIDE = 214,
SDL_SCANCODE_KP_PLUSMINUS = 215,
SDL_SCANCODE_KP_CLEAR = 216,
SDL_SCANCODE_KP_CLEARENTRY = 217,
SDL_SCANCODE_KP_BINARY = 218,
SDL_SCANCODE_KP_OCTAL = 219,
SDL_SCANCODE_KP_DECIMAL = 220,
SDL_SCANCODE_KP_HEXADECIMAL = 221,
SDL_SCANCODE_LCTRL = 224,
SDL_SCANCODE_LSHIFT = 225,
SDL_SCANCODE_LALT = 226,
SDL_SCANCODE_LGUI = 227,
SDL_SCANCODE_RCTRL = 228,
SDL_SCANCODE_RSHIFT = 229,
SDL_SCANCODE_RALT = 230,
SDL_SCANCODE_RGUI = 231,
SDL_SCANCODE_MODE = 257,
SDL_SCANCODE_AUDIONEXT = 258,
SDL_SCANCODE_AUDIOPREV = 259,
SDL_SCANCODE_AUDIOSTOP = 260,
SDL_SCANCODE_AUDIOPLAY = 261,
SDL_SCANCODE_AUDIOMUTE = 262,
SDL_SCANCODE_MEDIASELECT = 263,
SDL_SCANCODE_WWW = 264,
SDL_SCANCODE_MAIL = 265,
SDL_SCANCODE_CALCULATOR = 266,
SDL_SCANCODE_COMPUTER = 267,
SDL_SCANCODE_AC_SEARCH = 268,
SDL_SCANCODE_AC_HOME = 269,
SDL_SCANCODE_AC_BACK = 270,
SDL_SCANCODE_AC_FORWARD = 271,
SDL_SCANCODE_AC_STOP = 272,
SDL_SCANCODE_AC_REFRESH = 273,
SDL_SCANCODE_AC_BOOKMARKS = 274,
SDL_SCANCODE_BRIGHTNESSDOWN = 275,
SDL_SCANCODE_BRIGHTNESSUP = 276,
SDL_SCANCODE_DISPLAYSWITCH = 277,
SDL_SCANCODE_KBDILLUMTOGGLE = 278,
SDL_SCANCODE_KBDILLUMDOWN = 279,
SDL_SCANCODE_KBDILLUMUP = 280,
SDL_SCANCODE_EJECT = 281,
SDL_SCANCODE_SLEEP = 282,
SDL_SCANCODE_APP1 = 283,
SDL_SCANCODE_APP2 = 284,
SDL_NUM_SCANCODES = 512
}
}
mixin(expandEnum!SDL_Scancode);

View file

@ -0,0 +1,63 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlshape;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlpixels : SDL_Color;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
import bindbc.sdl.bind.sdlsurface : SDL_Surface;
import bindbc.sdl.bind.sdlvideo : SDL_Window;
enum {
SDL_NONSHAPEABLE_WINDOW = -1,
SDL_INVALID_SHAPE_ARGUMENT = -2,
SDL_WINDOW_LACKS_SHAPE = -3,
}
enum WindowShapeMode {
ShapeModeDefault,
ShapeModeBinarizeAlpha,
ShapeModeReverseBinarizeAlpha,
ShapeModeColorKey
}
mixin(expandEnum!WindowShapeMode);
enum SDL_SHAPEMODEALPHA(WindowShapeMode mode) = (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha);
union SDL_WindowShapeParams {
ubyte binarizationCutoff;
SDL_Color colorKey;
}
struct SDL_WindowShapeMode {
WindowShapeMode mode;
SDL_WindowShapeParams parameters;
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_Window* SDL_CreateShapedWindow(const(char)*,uint,uint,uint,uint,uint);
SDL_bool SDL_IsShapedWindow(const(SDL_Window)*);
int SDL_SetWindowShape(SDL_Window*,SDL_Surface*,SDL_WindowShapeMode*);
int SDL_GetShapedWindowMode(SDL_Window*,SDL_WindowShapeMode*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_CreateShapedWindow = SDL_Window* function(const(char)*,uint,uint,uint,uint,uint);
alias pSDL_IsShapedWindow = SDL_bool function(const(SDL_Window)*);
alias pSDL_SetWindowShape = int function(SDL_Window*,SDL_Surface*,SDL_WindowShapeMode*);
alias pSDL_GetShapedWindowMode = int function(SDL_Window*,SDL_WindowShapeMode*);
}
__gshared {
pSDL_CreateShapedWindow SDL_CreateShapedWindow;
pSDL_IsShapedWindow SDL_IsShapedWindow;
pSDL_SetWindowShape SDL_SetWindowShape;
pSDL_GetShapedWindowMode SDL_GetShapedWindowMode;
}
}

View file

@ -0,0 +1,42 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlstdinc;
import bindbc.sdl.config;
enum SDL_bool {
SDL_FALSE = 0,
SDL_TRUE = 1
}
mixin(expandEnum!SDL_bool);
alias Sint8 = byte;
alias Uint8 = ubyte;
alias Sint16 = short;
alias Uint16 = ushort;
alias Sint32 = int;
alias Uint32 = uint;
alias Sint64 = long;
alias Uint64 = ulong;
enum SDL_FOURCC(char A, char B, char C, char D) = ((A << 0) | (B << 8) | (C << 16) | (D << 24));
version(BindSDL_Static) {
extern(C) @nogc nothrow {
void SDL_free(void* mem);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_free = void function(void* mem);
}
__gshared {
pSDL_free SDL_free;
}
}

View file

@ -0,0 +1,230 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlsurface;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlblendmode : SDL_BlendMode;
import bindbc.sdl.bind.sdlrect : SDL_Rect;
import bindbc.sdl.bind.sdlrwops;
import bindbc.sdl.bind.sdlpixels : SDL_Palette, SDL_PixelFormat;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
enum {
SDL_SWSURFACE = 0,
SDL_PREALLOC = 0x00000001,
SDL_RLEACCEL = 0x00000002,
SDL_DONTFREE = 0x00000004,
}
@nogc nothrow pure
bool SDL_MUSTLOCK(const(SDL_Surface)* S)
{
pragma(inline, true);
return (S.flags & SDL_RLEACCEL) != 0;
}
struct SDL_BlitMap;
struct SDL_Surface {
int flags;
SDL_PixelFormat* format;
int w, h;
int pitch;
void* pixels;
void* userdata;
int locked;
void* lock_data;
SDL_Rect clip_rect;
SDL_BlitMap* map;
int refcount;
}
extern(C) nothrow alias SDL_blit = int function(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect);
@nogc nothrow {
SDL_Surface* SDL_LoadBMP(const(char)* file) {
pragma(inline, true);
return SDL_LoadBMP_RW(SDL_RWFromFile(file,"rb"),1);
}
int SDL_SaveBMP(SDL_Surface* surface,const(char)* file) {
pragma(inline, true);
return SDL_SaveBMP_RW(surface,SDL_RWFromFile(file,"wb"),1);
}
}
alias SDL_BlitSurface = SDL_UpperBlit;
alias SDL_BlitScaled = SDL_UpperBlitScaled;
static if(sdlSupport >= SDLSupport.sdl208) {
enum SDL_YUV_CONVERSION_MODE {
SDL_YUV_CONVERSION_JPEG,
SDL_YUV_CONVERSION_BT601,
SDL_YUV_CONVERSION_BT709,
SDL_YUV_CONVERSION_AUTOMATIC,
}
mixin(expandEnum!SDL_YUV_CONVERSION_MODE);
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_Surface* SDL_CreateRGBSurface(uint,int,int,int,uint,uint,uint,uint);
SDL_Surface* SDL_CreateRGBSurfaceFrom(void*,int,int,int,int,uint,uint,uint,uint);
void SDL_FreeSurface(SDL_Surface*);
int SDL_SetSurfacePalette(SDL_Surface*,SDL_Palette*);
int SDL_LockSurface(SDL_Surface*);
int SDL_UnlockSurface(SDL_Surface*);
SDL_Surface* SDL_LoadBMP_RW(SDL_RWops*,int);
int SDL_SaveBMP_RW(SDL_Surface*,SDL_RWops*,int);
int SDL_SetSurfaceRLE(SDL_Surface*,int);
int SDL_SetColorKey(SDL_Surface*,int,uint);
int SDL_GetColorKey(SDL_Surface*,uint*);
int SDL_SetSurfaceColorMod(SDL_Surface*,ubyte,ubyte,ubyte);
int SDL_GetSurfaceColorMod(SDL_Surface*,ubyte*,ubyte*,ubyte*);
int SDL_SetSurfaceAlphaMod(SDL_Surface*,ubyte);
int SDL_GetSurfaceAlphaMod(SDL_Surface*,ubyte*);
int SDL_SetSurfaceBlendMode(SDL_Surface*,SDL_BlendMode);
int SDL_GetSurfaceBlendMode(SDL_Surface*,SDL_BlendMode*);
SDL_bool SDL_SetClipRect(SDL_Surface*,const(SDL_Rect)*);
void SDL_GetClipRect(SDL_Surface*,SDL_Rect*);
SDL_Surface* SDL_ConvertSurface(SDL_Surface*,const(SDL_PixelFormat)*,uint);
SDL_Surface* SDL_ConvertSurfaceFormat(SDL_Surface*,uint,uint);
int SDL_ConvertPixels(int,int,uint,const(void)*,int,uint,void*,int);
int SDL_FillRect(SDL_Surface*,const(SDL_Rect)*,uint);
int SDL_FillRects(SDL_Surface*,const(SDL_Rect)*,int,uint);
int SDL_UpperBlit(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,SDL_Rect*);
int SDL_LowerBlit(SDL_Surface*,SDL_Rect*,SDL_Surface*,SDL_Rect*);
int SDL_SoftStretch(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,const(SDL_Rect)*);
int SDL_UpperBlitScaled(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,SDL_Rect*);
int SDL_LowerBlitScaled(SDL_Surface*,SDL_Rect*,SDL_Surface*,SDL_Rect*);
static if(sdlSupport >= SDLSupport.sdl205) {
SDL_Surface* SDL_CreateRGBSurfaceWithFormat(uint,int,int,int,uint);
SDL_Surface* SDL_CreateRGBSurfaceWithFormatFrom(void*,int,int,int,int,uint);
}
static if(sdlSupport >= SDLSupport.sdl205) {
SDL_Surface* SDL_DuplicateSurface(SDL_Surface*);
}
static if(sdlSupport >= SDLSupport.sdl208) {
void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE);
SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode();
SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int,int);
}
static if(sdlSupport >= SDLSupport.sdl209) {
SDL_bool SDL_HasColorKey(SDL_Surface*);
}
}
}
else {
extern(C) @nogc nothrow {alias pSDL_CreateRGBSurface = SDL_Surface* function(uint,int,int,int,uint,uint,uint,uint);
alias pSDL_CreateRGBSurfaceFrom = SDL_Surface* function(void*,int,int,int,int,uint,uint,uint,uint);
alias pSDL_FreeSurface = void function(SDL_Surface*);
alias pSDL_SetSurfacePalette = int function(SDL_Surface*,SDL_Palette*);
alias pSDL_LockSurface = int function(SDL_Surface*);
alias pSDL_UnlockSurface = int function(SDL_Surface*);
alias pSDL_LoadBMP_RW = SDL_Surface* function(SDL_RWops*,int);
alias pSDL_SaveBMP_RW = int function(SDL_Surface*,SDL_RWops*,int);
alias pSDL_SetSurfaceRLE = int function(SDL_Surface*,int);
alias pSDL_SetColorKey = int function(SDL_Surface*,int,uint);
alias pSDL_GetColorKey = int function(SDL_Surface*,uint*);
alias pSDL_SetSurfaceColorMod = int function(SDL_Surface*,ubyte,ubyte,ubyte);
alias pSDL_GetSurfaceColorMod = int function(SDL_Surface*,ubyte*,ubyte*,ubyte*);
alias pSDL_SetSurfaceAlphaMod = int function(SDL_Surface*,ubyte);
alias pSDL_GetSurfaceAlphaMod = int function(SDL_Surface*,ubyte*);
alias pSDL_SetSurfaceBlendMode = int function(SDL_Surface*,SDL_BlendMode);
alias pSDL_GetSurfaceBlendMode = int function(SDL_Surface*,SDL_BlendMode*);
alias pSDL_SetClipRect = SDL_bool function(SDL_Surface*,const(SDL_Rect)*);
alias pSDL_GetClipRect = void function(SDL_Surface*,SDL_Rect*);
alias pSDL_ConvertSurface = SDL_Surface* function(SDL_Surface*,const(SDL_PixelFormat)*,uint);
alias pSDL_ConvertSurfaceFormat = SDL_Surface* function(SDL_Surface*,uint,uint);
alias pSDL_ConvertPixels = int function(int,int,uint,const(void)*,int,uint,void*,int);
alias pSDL_FillRect = int function(SDL_Surface*,const(SDL_Rect)*,uint);
alias pSDL_FillRects = int function(SDL_Surface*,const(SDL_Rect)*,int,uint);
alias pSDL_UpperBlit = int function(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,SDL_Rect*);
alias pSDL_LowerBlit = int function(SDL_Surface*,SDL_Rect*,SDL_Surface*,SDL_Rect*);
alias pSDL_SoftStretch = int function(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,const(SDL_Rect)*);
alias pSDL_UpperBlitScaled = int function(SDL_Surface*,const(SDL_Rect)*,SDL_Surface*,SDL_Rect*);
alias pSDL_LowerBlitScaled = int function(SDL_Surface*,SDL_Rect*,SDL_Surface*,SDL_Rect*);
}
__gshared {
pSDL_CreateRGBSurface SDL_CreateRGBSurface;
pSDL_CreateRGBSurfaceFrom SDL_CreateRGBSurfaceFrom;
pSDL_FreeSurface SDL_FreeSurface;
pSDL_SetSurfacePalette SDL_SetSurfacePalette;
pSDL_LockSurface SDL_LockSurface;
pSDL_UnlockSurface SDL_UnlockSurface;
pSDL_LoadBMP_RW SDL_LoadBMP_RW;
pSDL_SaveBMP_RW SDL_SaveBMP_RW;
pSDL_SetSurfaceRLE SDL_SetSurfaceRLE;
pSDL_SetColorKey SDL_SetColorKey;
pSDL_GetColorKey SDL_GetColorKey;
pSDL_SetSurfaceColorMod SDL_SetSurfaceColorMod;
pSDL_GetSurfaceColorMod SDL_GetSurfaceColorMod;
pSDL_SetSurfaceAlphaMod SDL_SetSurfaceAlphaMod;
pSDL_GetSurfaceAlphaMod SDL_GetSurfaceAlphaMod;
pSDL_SetSurfaceBlendMode SDL_SetSurfaceBlendMode;
pSDL_GetSurfaceBlendMode SDL_GetSurfaceBlendMode;
pSDL_SetClipRect SDL_SetClipRect;
pSDL_GetClipRect SDL_GetClipRect;
pSDL_ConvertSurface SDL_ConvertSurface;
pSDL_ConvertSurfaceFormat SDL_ConvertSurfaceFormat;
pSDL_ConvertPixels SDL_ConvertPixels;
pSDL_FillRect SDL_FillRect;
pSDL_FillRects SDL_FillRects;
pSDL_UpperBlit SDL_UpperBlit;
pSDL_LowerBlit SDL_LowerBlit;
pSDL_SoftStretch SDL_SoftStretch;
pSDL_UpperBlitScaled SDL_UpperBlitScaled;
pSDL_LowerBlitScaled SDL_LowerBlitScaled;
}
static if(sdlSupport >= SDLSupport.sdl205) {
extern(C) @nogc nothrow {
alias pSDL_CreateRGBSurfaceWithFormat = SDL_Surface* function(uint,int,int,int,uint);
alias pSDL_CreateRGBSurfaceWithFormatFrom = SDL_Surface* function(void*,int,int,int,int,uint);
}
__gshared {
pSDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat;
pSDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom;
}
}
static if(sdlSupport >= SDLSupport.sdl205) {
extern(C) @nogc nothrow {
alias pSDL_DuplicateSurface = SDL_Surface* function(SDL_Surface*);
}
__gshared {
pSDL_DuplicateSurface SDL_DuplicateSurface;
}
}
static if(sdlSupport >= SDLSupport.sdl208) {
extern(C) @nogc nothrow {
alias pSDL_SetYUVConversionMode = void function(SDL_YUV_CONVERSION_MODE);
alias pSDL_GetYUVConversionMode = SDL_YUV_CONVERSION_MODE function();
alias pSDL_GetYUVConversionModeForResolution = SDL_YUV_CONVERSION_MODE function(int,int);
}
__gshared {
pSDL_SetYUVConversionMode SDL_SetYUVConversionMode;
pSDL_GetYUVConversionMode SDL_GetYUVConversionMode;
pSDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution;
}
}
static if(sdlSupport >= SDLSupport.sdl209) {
extern(C) @nogc nothrow {
alias pSDL_HasColorKey = SDL_bool function(SDL_Surface*);
}
__gshared {
pSDL_HasColorKey SDL_HasColorKey;
}
}
}

View file

@ -0,0 +1,152 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlsystem;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlrender : SDL_Renderer;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
version(Android) {
enum int SDL_ANDROID_EXTERNAL_STORAGE_READ = 0x01;
enum int SDL_ANDROID_EXTERNAL_STORAGE_WRITE = 0x02;
}
static if(sdlSupport >= SDLSupport.sdl201) {
version(Windows) struct IDirect3DDevice9;
}
static if(sdlSupport >= SDLSupport.sdl204) {
version(Windows) {
extern(C) nothrow alias SDL_WindowsMessageHook = void function(void*,void*,uint,ulong,long);
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
version(Android) {
void* SDL_AndroidGetJNIEnv();
void* SDL_AndroidGetActivity();
const(char)* SDL_AndroidGetInternalStoragePath();
int SDL_AndroidGetInternalStorageState();
const(char)* SDL_AndroidGetExternalStoragePath();
static if(sdlSupport >= SDLSupport.sdl208) {
SDL_bool SDL_IsAndroidTV();
}
static if(sdlSupport >= SDLSupport.sdl209) {
SDL_bool SDL_IsChromebook();
SDL_bool SDL_IsDeXMode();
void SDL_AndroidBackButton();
}
}
else version(Windows) {
static if(sdlSupport >= SDLSupport.sdl201) {
int SDL_Direct3D9GetAdapterIndex(int);
IDirect3DDevice9* SDL_RenderGetD3D9Device(SDL_Renderer*);
}
static if(sdlSupport >= SDLSupport.sdl202) {
SDL_bool SDL_DXGIGetOutputInfo(int,int*,int*);
}
static if(sdlSupport >= SDLSupport.sdl204) {
void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook,void*);
}
}
else version(linux) {
static if(sdlSupport >= SDLSupport.sdl209) {
int SDL_LinuxSetThreadPriority(long,int);
}
}
}
}
else {
version(Android) {
extern(C) @nogc nothrow {
alias pSDL_AndroidGetJNIEnv = void* function();
alias pSDL_AndroidGetActivity = void* function();
alias pSDL_AndroidGetInternalStoragePath = const(char)* function();
alias pSDL_AndroidGetInternalStorageState = int function();
alias pSDL_AndroidGetExternalStoragePath = const(char)* function();
}
__gshared {
pSDL_AndroidGetJNIEnv SDL_AndroidGetJNIEnv;
pSDL_AndroidGetActivity SDL_AndroidGetActivity;
pSDL_AndroidGetInternalStoragePath SDL_AndroidGetInternalStoragePath;
pSDL_AndroidGetInternalStorageState SDL_AndroidGetInternalStorageState;
pSDL_AndroidGetExternalStoragePath SDL_AndroidGetExternalStoragePath;
}
static if(sdlSupport >= SDLSupport.sdl208) {
extern(C) @nogc nothrow {
alias pSDL_IsAndroidTV = SDL_bool function();
}
__gshared {
pSDL_IsAndroidTV SDL_IsAndroidTV;
}
}
static if(sdlSupport >= SDLSupport.sdl209) {
extern(C) @nogc nothrow {
alias pSDL_IsChromebook = SDL_bool function();
alias pSDL_IsDeXMode = SDL_bool function();
alias pSDL_AndroidBackButton = void function();
}
__gshared {
pSDL_IsChromebook SDL_IsChromebook;
pSDL_IsDeXMode SDL_IsDeXMode;
pSDL_AndroidBackButton SDL_AndroidBackButton;
}
}
}
else version(Windows) {
static if(sdlSupport >= SDLSupport.sdl201) {
extern(C) @nogc nothrow {
alias pSDL_Direct3D9GetAdapterIndex = int function(int);
alias pSDL_RenderGetD3D9Device = IDirect3DDevice9* function(SDL_Renderer*);
}
__gshared {
pSDL_Direct3D9GetAdapterIndex SDL_Direct3D9GetAdapterIndex ;
pSDL_RenderGetD3D9Device SDL_RenderGetD3D9Device;
}
}
static if(sdlSupport >= SDLSupport.sdl202) {
extern(C) @nogc nothrow {
alias pSDL_DXGIGetOutputInfo = SDL_bool function(int,int*,int*);
}
__gshared {
pSDL_DXGIGetOutputInfo SDL_DXGIGetOutputInfo;
}
}
static if(sdlSupport >= SDLSupport.sdl204) {
extern(C) @nogc nothrow {
alias pSDL_SetWindowsMessageHook = void function(SDL_WindowsMessageHook,void*);
}
__gshared {
pSDL_SetWindowsMessageHook SDL_SetWindowsMessageHook;
}
}
}
else version(linux) {
static if(sdlSupport >= SDLSupport.sdl209) {
extern(C) @nogc nothrow {
alias pSDL_LinuxSetThreadPriority = int function(long,int);
}
__gshared {
pSDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority;
}
}
}
}

View file

@ -0,0 +1,240 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlsyswm;
//import core.stdc.config : c_long;
alias int c_long;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
import bindbc.sdl.bind.sdlversion : SDL_version;
import bindbc.sdl.bind.sdlvideo : SDL_Window;
static if(sdlSupport >= SDLSupport.sdl205) {
enum SDL_SYSWM_TYPE {
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
SDL_SYSWM_MIR,
SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID,
SDL_SYSWM_VIVANTE,
SDL_SYSWM_OS2,
}
}
else static if(sdlSupport >= SDLSupport.sdl205) {
enum SDL_SYSWM_TYPE {
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
SDL_SYSWM_MIR,
SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID,
SDL_SYSWM_VIVANTE,
}
}
else static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_SYSWM_TYPE {
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
SDL_SYSWM_MIR,
SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID,
}
}
else static if(sdlSupport >= SDLSupport.sdl203) {
enum SDL_SYSWM_TYPE {
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
SDL_SYSWM_MIR,
SDL_SYSWM_WINRT,
}
}
else static if(sdlSupport >= SDLSupport.sdl202) {
enum SDL_SYSWM_TYPE {
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
SDL_SYSWM_MIR,
}
}
else {
enum SDL_SYSWM_TYPE {
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
}
}
mixin(expandEnum!SDL_SYSWM_TYPE);
version(Windows) {
// I don't want to import core.sys.windows.windows just for these
version(Win64) {
alias wparam = ulong;
alias lparam = long;
}else {
alias wparam = uint;
alias lparam = int;
}
}
struct SDL_SysWMmsg {
SDL_version version_;
SDL_SYSWM_TYPE subsystem;
union msg_ {
version(Windows) {
struct win_ {
void* hwnd;
uint msg;
wparam wParam;
lparam lParam;
}
win_ win;
}
else version(OSX) {
struct cocoa_ {
int dummy;
}
cocoa_ cocoa;
}
else version(linux) {
struct dfb_ {
void* event;
}
dfb_ dfb;
}
version(Posix) {
struct x11_ {
c_long[24] pad; // sufficient size for any X11 event
}
x11_ x11;
}
static if(sdlSupport >= SDLSupport.sdl205) {
struct vivante_ {
int dummy;
}
vivante_ vivante;
}
int dummy;
}
msg_ msg;
}
struct SDL_SysWMinfo {
SDL_version version_;
SDL_SYSWM_TYPE subsystem;
union info_ {
version(Windows) {
struct win_ {
void* window;
static if(sdlSupport >= SDLSupport.sdl204) void* hdc;
static if(sdlSupport >= SDLSupport.sdl206) void* hinstance;
}
win_ win;
}
else version(OSX) {
struct cocoa_ {
void* window;
}
cocoa_ cocoa;
struct uikit_ {
void *window;
}
uikit_ uikit;
}
else version(linux) {
struct dfb_ {
void *dfb;
void *window;
void *surface;
}
dfb_ dfb;
static if(sdlSupport >= SDLSupport.sdl202) {
struct wl_ {
void *display;
void *surface;
void *shell_surface;
}
wl_ wl;
struct mir_ {
void *connection;
void *surface;
}
mir_ mir;
}
}
version(Posix) {
struct x11_ {
void* display;
uint window;
}
x11_ x11;
}
static if(sdlSupport >= SDLSupport.sdl204) {
version(Android) {
struct android_ {
void* window;
void* surface;
}
android_ android;
}
}
static if(sdlSupport >= SDLSupport.sdl206) ubyte[64] dummy;
else int dummy;
}
info_ info;
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_bool SDL_GetWindowWMInfo(SDL_Window*,SDL_SysWMinfo*);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetWindowWMInfo = SDL_bool function(SDL_Window*,SDL_SysWMinfo*);
}
__gshared {
pSDL_GetWindowWMInfo SDL_GetWindowWMInfo;
}
}

View file

@ -0,0 +1,51 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdltimer;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
extern(C) nothrow alias SDL_TimerCallback = uint function(uint interval, void* param);
alias SDL_TimerID = int;
// This was added to SDL 2.0.1 as a macro, but it's
// useful & has no dependency on the library version,
// so it's here for 2.0.0 as well.
@nogc nothrow pure
bool SDL_TICKS_PASSED(uint A, uint B) {
pragma(inline, true);
return cast(int)(B - A) <= 0;
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
uint SDL_GetTicks();
ulong SDL_GetPerformanceCounter();
ulong SDL_GetPerformanceFrequency();
void SDL_Delay(uint);
SDL_TimerID SDL_AddTimer(uint,SDL_TimerCallback,void*);
SDL_bool SDL_RemoveTimer(SDL_TimerID);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetTicks = uint function();
alias pSDL_GetPerformanceCounter = ulong function();
alias pSDL_GetPerformanceFrequency = ulong function();
alias pSDL_Delay = void function(uint);
alias pSDL_AddTimer = SDL_TimerID function(uint,SDL_TimerCallback,void*);
alias pSDL_RemoveTimer = SDL_bool function(SDL_TimerID);
}
__gshared {
pSDL_GetTicks SDL_GetTicks;
pSDL_GetPerformanceCounter SDL_GetPerformanceCounter;
pSDL_GetPerformanceFrequency SDL_GetPerformanceFrequency;
pSDL_Delay SDL_Delay;
pSDL_AddTimer SDL_AddTimer;
pSDL_RemoveTimer SDL_RemoveTimer;
}
}

View file

@ -0,0 +1,67 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdltouch;
import bindbc.sdl.config;
alias SDL_TouchID = long;
alias SDL_FingerID = long;
struct SDL_Finger {
SDL_FingerID id;
float x;
float y;
float pressure;
}
enum DL_TOUCH_MOUSEID = cast(uint)-1;
static if(sdlSupport >= SDLSupport.sdl2010) {
enum SDL_TouchDeviceType {
SDL_TOUCH_DEVICE_INVALID = -1,
SDL_TOUCH_DEVICE_DIRECT,
SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE,
SDL_TOUCH_DEVICE_INDIRECT_RELATIVE,
}
mixin(expandEnum!SDL_TouchDeviceType);
enum SDL_MOUSE_TOUCHID = -1L;
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_GetNumTouchDevices();
SDL_TouchID SDL_GetTouchDevice(int);
int SDL_GetNumTouchFingers(SDL_TouchID);
SDL_Finger* SDL_GetTouchFinger(SDL_TouchID,int);
}
static if(sdlSupport >= SDLSupport.sdl2010) {
SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID);
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetNumTouchDevices = int function();
alias pSDL_GetTouchDevice = SDL_TouchID function(int);
alias pSDL_GetNumTouchFingers = int function(SDL_TouchID);
alias pSDL_GetTouchFinger = SDL_Finger* function(SDL_TouchID,int);
}
__gshared {
pSDL_GetNumTouchDevices SDL_GetNumTouchDevices;
pSDL_GetTouchDevice SDL_GetTouchDevice;
pSDL_GetNumTouchFingers SDL_GetNumTouchFingers;
pSDL_GetTouchFinger SDL_GetTouchFinger;
}
static if(sdlSupport >= SDLSupport.sdl2010) {
extern(C) @nogc nothrow {
alias pSDL_GetTouchDeviceType = SDL_TouchDeviceType function(SDL_TouchID);
}
__gshared {
pSDL_GetTouchDeviceType SDL_GetTouchDeviceType;
}
}
}

View file

@ -0,0 +1,83 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlversion;
struct SDL_version {
ubyte major;
ubyte minor;
ubyte patch;
}
enum SDL_MAJOR_VERSION = 2;
enum SDL_MINOR_VERSION = 0;
version(SDL_201) {
enum ubyte SDL_PATCHLEVEL = 1;
}
else version(SDL_202) {
enum ubyte SDL_PATCHLEVEL = 2;
}
else version(SDL_203) {
enum ubyte SDL_PATCHLEVEL = 3;
}
else version(SDL_204) {
enum ubyte SDL_PATCHLEVEL = 4;
}
else version(SDL_205) {
enum ubyte SDL_PATCHLEVEL = 5;
}
else version(SDL_206) {
enum ubyte SDL_PATCHLEVEL = 6;
}
else version(SDL_207) {
enum ubyte SDL_PATCHLEVEL = 7;
}
else version(SDL_208) {
enum ubyte SDL_PATCHLEVEL = 8;
}
else version(SDL_209) {
enum ubyte SDL_PATCHLEVEL = 9;
}
else version(SDL_2010) {
enum ubyte SDL_PATCHLEVEL = 10;
}
else {
enum ubyte SDL_PATCHLEVEL = 0;
}
@nogc nothrow pure
void SDL_VERSION(SDL_version* x) {
pragma(inline, true);
x.major = SDL_MAJOR_VERSION;
x.minor = SDL_MINOR_VERSION;
x.patch = SDL_PATCHLEVEL;
}
enum SDL_VERSIONNUM(ubyte X, ubyte Y, ubyte Z) = X*1000 + Y*100 + Z;
enum SDL_COMPILEDVERSION = SDL_VERSIONNUM!(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
enum SDL_VERSION_ATLEAST(ubyte X, ubyte Y, ubyte Z) = SDL_COMPILEDVERSION >= SDL_VERSIONNUM!(X, Y, Z);
version(BindSDL_Static) {
extern(C) @nogc nothrow {
void SDL_GetVersion(SDL_version*);
const(char)* SDL_GetRevision();
int SDL_GetRevisionNumber();
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetVersion = void function(SDL_version*);
alias pSDL_GetRevision = const(char)* function();
alias pSDL_GetRevisionNumber = int function();
}
__gshared {
pSDL_GetVersion SDL_GetVersion;
pSDL_GetRevision SDL_GetRevision;
pSDL_GetRevisionNumber SDL_GetRevisionNumber;
}
}

View file

@ -0,0 +1,677 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlvideo;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlrect : SDL_Rect;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
import bindbc.sdl.bind.sdlsurface : SDL_Surface;
struct SDL_DisplayMode {
uint format;
int w;
int h;
int refresh_rate;
void* driverdata;
}
struct SDL_Window;
static if(sdlSupport >= SDLSupport.sdl206) {
enum SDL_WindowFlags {
SDL_WINDOW_FULLSCREEN = 0x00000001,
SDL_WINDOW_OPENGL = 0x00000002,
SDL_WINDOW_SHOWN = 0x00000004,
SDL_WINDOW_HIDDEN = 0x00000008,
SDL_WINDOW_BORDERLESS = 0x00000010,
SDL_WINDOW_RESIZABLE = 0x00000020,
SDL_WINDOW_MINIMIZED = 0x00000040,
SDL_WINDOW_MAXIMIZED = 0x00000080,
SDL_WINDOW_INPUT_GRABBED = 0x00000100,
SDL_WINDOW_INPUT_FOCUS = 0x00000200,
SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
SDL_WINDOW_FOREIGN = 0x00000800,
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,
SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,
SDL_WINDOW_SKIP_TASKBAR = 0x00010000,
SDL_WINDOW_UTILITY = 0x00020000,
SDL_WINDOW_TOOLTIP = 0x00040000,
SDL_WINDOW_POPUP_MENU = 0x00080000,
SDL_WINDOW_VULKAN = 0x10000000,
}
}
else static if(sdlSupport >= SDLSupport.sdl205) {
enum SDL_WindowFlags {
SDL_WINDOW_FULLSCREEN = 0x00000001,
SDL_WINDOW_OPENGL = 0x00000002,
SDL_WINDOW_SHOWN = 0x00000004,
SDL_WINDOW_HIDDEN = 0x00000008,
SDL_WINDOW_BORDERLESS = 0x00000010,
SDL_WINDOW_RESIZABLE = 0x00000020,
SDL_WINDOW_MINIMIZED = 0x00000040,
SDL_WINDOW_MAXIMIZED = 0x00000080,
SDL_WINDOW_INPUT_GRABBED = 0x00000100,
SDL_WINDOW_INPUT_FOCUS = 0x00000200,
SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
SDL_WINDOW_FOREIGN = 0x00000800,
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,
SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000,
SDL_WINDOW_SKIP_TASKBAR = 0x00010000,
SDL_WINDOW_UTILITY = 0x00020000,
SDL_WINDOW_TOOLTIP = 0x00040000,
SDL_WINDOW_POPUP_MENU = 0x00080000,
}
}
else static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_WindowFlags {
SDL_WINDOW_FULLSCREEN = 0x00000001,
SDL_WINDOW_OPENGL = 0x00000002,
SDL_WINDOW_SHOWN = 0x00000004,
SDL_WINDOW_HIDDEN = 0x00000008,
SDL_WINDOW_BORDERLESS = 0x00000010,
SDL_WINDOW_RESIZABLE = 0x00000020,
SDL_WINDOW_MINIMIZED = 0x00000040,
SDL_WINDOW_MAXIMIZED = 0x00000080,
SDL_WINDOW_INPUT_GRABBED = 0x00000100,
SDL_WINDOW_INPUT_FOCUS = 0x00000200,
SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
SDL_WINDOW_FOREIGN = 0x00000800,
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,
}
}
else static if(sdlSupport >= SDLSupport.sdl201) {
enum SDL_WindowFlags {
SDL_WINDOW_FULLSCREEN = 0x00000001,
SDL_WINDOW_OPENGL = 0x00000002,
SDL_WINDOW_SHOWN = 0x00000004,
SDL_WINDOW_HIDDEN = 0x00000008,
SDL_WINDOW_BORDERLESS = 0x00000010,
SDL_WINDOW_RESIZABLE = 0x00000020,
SDL_WINDOW_MINIMIZED = 0x00000040,
SDL_WINDOW_MAXIMIZED = 0x00000080,
SDL_WINDOW_INPUT_GRABBED = 0x00000100,
SDL_WINDOW_INPUT_FOCUS = 0x00000200,
SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
SDL_WINDOW_FOREIGN = 0x00000800,
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,
}
}
else {
enum SDL_WindowFlags {
SDL_WINDOW_FULLSCREEN = 0x00000001,
SDL_WINDOW_OPENGL = 0x00000002,
SDL_WINDOW_SHOWN = 0x00000004,
SDL_WINDOW_HIDDEN = 0x00000008,
SDL_WINDOW_BORDERLESS = 0x00000010,
SDL_WINDOW_RESIZABLE = 0x00000020,
SDL_WINDOW_MINIMIZED = 0x00000040,
SDL_WINDOW_MAXIMIZED = 0x00000080,
SDL_WINDOW_INPUT_GRABBED = 0x00000100,
SDL_WINDOW_INPUT_FOCUS = 0x00000200,
SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN | 0x00001000,
SDL_WINDOW_FOREIGN = 0x00000800,
}
}
mixin(expandEnum!SDL_WindowFlags);
enum uint SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000;
enum uint SDL_WINDOWPOS_UNDEFINED_DISPLAY(uint x) = SDL_WINDOWPOS_UNDEFINED_MASK | x;
enum uint SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_DISPLAY!(0);
enum uint SDL_WINDOWPOS_ISUNDEFINED(uint x) = (x & 0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK;
enum uint SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000;
enum uint SDL_WINDOWPOS_CENTERED_DISPLAY(uint x) = SDL_WINDOWPOS_CENTERED_MASK | x;
enum uint SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_DISPLAY!(0);
enum uint SDL_WINDOWPOS_ISCENTERED(uint x) = (x & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK;
static if(sdlSupport >= SDLSupport.sdl205) {
enum SDL_WindowEventID : ubyte {
SDL_WINDOWEVENT_NONE,
SDL_WINDOWEVENT_SHOWN,
SDL_WINDOWEVENT_HIDDEN,
SDL_WINDOWEVENT_EXPOSED,
SDL_WINDOWEVENT_MOVED,
SDL_WINDOWEVENT_RESIZED,
SDL_WINDOWEVENT_SIZE_CHANGED,
SDL_WINDOWEVENT_MINIMIZED,
SDL_WINDOWEVENT_MAXIMIZED,
SDL_WINDOWEVENT_RESTORED,
SDL_WINDOWEVENT_ENTER,
SDL_WINDOWEVENT_LEAVE,
SDL_WINDOWEVENT_FOCUS_GAINED,
SDL_WINDOWEVENT_FOCUS_LOST,
SDL_WINDOWEVENT_CLOSE,
SDL_WINDOWEVENT_TAKE_FOCUS,
SDL_WINDOWEVENT_HIT_TEST,
}
}
else {
enum SDL_WindowEventID : ubyte {
SDL_WINDOWEVENT_NONE,
SDL_WINDOWEVENT_SHOWN,
SDL_WINDOWEVENT_HIDDEN,
SDL_WINDOWEVENT_EXPOSED,
SDL_WINDOWEVENT_MOVED,
SDL_WINDOWEVENT_RESIZED,
SDL_WINDOWEVENT_SIZE_CHANGED,
SDL_WINDOWEVENT_MINIMIZED,
SDL_WINDOWEVENT_MAXIMIZED,
SDL_WINDOWEVENT_RESTORED,
SDL_WINDOWEVENT_ENTER,
SDL_WINDOWEVENT_LEAVE,
SDL_WINDOWEVENT_FOCUS_GAINED,
SDL_WINDOWEVENT_FOCUS_LOST,
SDL_WINDOWEVENT_CLOSE,
}
}
mixin(expandEnum!SDL_WindowEventID);
static if(sdlSupport >= SDLSupport.sdl209) {
enum SDL_DisplayEventID {
SDL_DISPLAYEVENT_NONE,
SDL_DISPLAYEVENT_ORIENTATION,
}
mixin(expandEnum!SDL_DisplayEventID);
enum SDL_DisplayOrientation {
SDL_ORIENTATION_UNKNOWN,
SDL_ORIENTATION_LANDSCAPE,
SDL_ORIENTATION_LANDSCAPE_FLIPPED,
SDL_ORIENTATION_PORTRAIT,
SDL_ORIENTATION_PORTRAIT_FLIPPED,
}
mixin(expandEnum!SDL_DisplayOrientation);
}
alias SDL_GLContext = void*;
static if(sdlSupport >= SDLSupport.sdl206) {
enum SDL_GLattr {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_RETAINED_BACKING,
SDL_GL_CONTEXT_MAJOR_VERSION,
SDL_GL_CONTEXT_MINOR_VERSION,
SDL_GL_CONTEXT_EGL,
SDL_GL_CONTEXT_FLAGS,
SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
SDL_GL_RELEASE_BEHAVIOR,
SDL_GL_CONTEXT_RESET_NOTIFICATION,
SDL_GL_CONTEXT_NO_ERROR,
}
}
else static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_GLattr {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_RETAINED_BACKING,
SDL_GL_CONTEXT_MAJOR_VERSION,
SDL_GL_CONTEXT_MINOR_VERSION,
SDL_GL_CONTEXT_EGL,
SDL_GL_CONTEXT_FLAGS,
SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
SDL_GL_RELEASE_BEHAVIOR,
}
}
else static if(sdlSupport >= SDLSupport.sdl201) {
enum SDL_GLattr {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_RETAINED_BACKING,
SDL_GL_CONTEXT_MAJOR_VERSION,
SDL_GL_CONTEXT_MINOR_VERSION,
SDL_GL_CONTEXT_EGL,
SDL_GL_CONTEXT_FLAGS,
SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
}
}
else {
enum SDL_GLattr {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL,
SDL_GL_RETAINED_BACKING,
SDL_GL_CONTEXT_MAJOR_VERSION,
SDL_GL_CONTEXT_MINOR_VERSION,
SDL_GL_CONTEXT_EGL,
SDL_GL_CONTEXT_FLAGS,
SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
}
}
mixin(expandEnum!SDL_GLattr);
enum SDL_GLprofile {
SDL_GL_CONTEXT_PROFILE_CORE = 0x0001,
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002,
SDL_GL_CONTEXT_PROFILE_ES = 0x0004,
}
mixin(expandEnum!SDL_GLprofile);
enum SDL_GLcontextFlag {
SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001,
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002,
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004,
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008,
}
mixin(expandEnum!SDL_GLcontextFlag);
static if(sdlSupport >= SDLSupport.sdl204) {
enum SDL_GLcontextReleaseFlag {
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001,
}
mixin(expandEnum!SDL_GLcontextReleaseFlag);
enum SDL_HitTestResult {
SDL_HITTEST_NORMAL,
SDL_HITTEST_DRAGGABLE,
SDL_HITTEST_RESIZE_TOPLEFT,
SDL_HITTEST_RESIZE_TOP,
SDL_HITTEST_RESIZE_TOPRIGHT,
SDL_HITTEST_RESIZE_RIGHT,
SDL_HITTEST_RESIZE_BOTTOMRIGHT,
SDL_HITTEST_RESIZE_BOTTOM,
SDL_HITTEST_RESIZE_BOTTOMLEFT,
SDL_HITTEST_RESIZE_LEFT,
}
mixin(expandEnum!SDL_HitTestResult);
import bindbc.sdl.bind.sdlrect : SDL_Point;
extern(C) nothrow alias SDL_HitTest = SDL_HitTestResult function(SDL_Window*,const(SDL_Point)*,void*);
}
static if(sdlSupport >= SDLSupport.sdl206) {
enum SDL_GLContextResetNotification {
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000,
SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001,
}
mixin(expandEnum!SDL_GLContextResetNotification);
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int SDL_GetNumVideoDrivers();
const(char)* SDL_GetVideoDriver(int);
int SDL_VideoInit(const(char)*);
void SDL_VideoQuit();
const(char)* SDL_GetCurrentVideoDriver();
int SDL_GetNumVideoDisplays();
const(char)* SDL_GetDisplayName(int);
int SDL_GetDisplayBounds(int,SDL_Rect*);
int SDL_GetNumDisplayModes(int);
int SDL_GetDisplayMode(int,int,SDL_DisplayMode*);
int SDL_GetDesktopDisplayMode(int,SDL_DisplayMode*);
int SDL_GetCurrentDisplayMode(int,SDL_DisplayMode*);
SDL_DisplayMode* SDL_GetClosestDisplayMode(int,const(SDL_DisplayMode)*,SDL_DisplayMode*);
int SDL_GetWindowDisplayIndex(SDL_Window*);
int SDL_SetWindowDisplayMode(SDL_Window*,const(SDL_DisplayMode)*);
int SDL_GetWindowDisplayMode(SDL_Window*,SDL_DisplayMode*);
uint SDL_GetWindowPixelFormat(SDL_Window*);
SDL_Window* SDL_CreateWindow(const(char)*,int,int,int,int,SDL_WindowFlags);
SDL_Window* SDL_CreateWindowFrom(const(void)*);
uint SDL_GetWindowID(SDL_Window*);
SDL_Window* SDL_GetWindowFromID(uint);
SDL_WindowFlags SDL_GetWindowFlags(SDL_Window*);
void SDL_SetWindowTitle(SDL_Window*,const(char)*);
const(char)* SDL_GetWindowTitle(SDL_Window*);
void SDL_SetWindowIcon(SDL_Window*,SDL_Surface*);
void* SDL_SetWindowData(SDL_Window*,const(char)*,void*);
void* SDL_GetWindowData(SDL_Window*,const(char)*);
void SDL_SetWindowPosition(SDL_Window*,int,int);
void SDL_GetWindowPosition(SDL_Window*,int*,int*);
void SDL_SetWindowSize(SDL_Window*,int,int);
void SDL_GetWindowSize(SDL_Window*,int*,int*);
void SDL_SetWindowMinimumSize(SDL_Window*,int,int);
void SDL_GetWindowMinimumSize(SDL_Window*,int*,int*);
void SDL_SetWindowMaximumSize(SDL_Window*,int,int);
void SDL_GetWindowMaximumSize(SDL_Window*,int*,int*);
void SDL_SetWindowBordered(SDL_Window*,SDL_bool);
void SDL_ShowWindow(SDL_Window*);
void SDL_HideWindow(SDL_Window*);
void SDL_RaiseWindow(SDL_Window*);
void SDL_MaximizeWindow(SDL_Window*);
void SDL_MinimizeWindow(SDL_Window*);
void SDL_RestoreWindow(SDL_Window*);
int SDL_SetWindowFullscreen(SDL_Window*,uint);
SDL_Surface* SDL_GetWindowSurface(SDL_Window*);
int SDL_UpdateWindowSurface(SDL_Window*);
int SDL_UpdateWindowSurfaceRects(SDL_Window*,SDL_Rect*,int);
void SDL_SetWindowGrab(SDL_Window*,SDL_bool);
SDL_bool SDL_GetWindowGrab(SDL_Window*);
int SDL_SetWindowBrightness(SDL_Window*,float);
float SDL_GetWindowBrightness(SDL_Window*);
int SDL_SetWindowGammaRamp(SDL_Window*,const(ushort)*,const(ushort)*,const(ushort)*);
int SDL_GetWindowGammaRamp(SDL_Window*,ushort*,ushort*,ushort*);
void SDL_DestroyWindow(SDL_Window*);
SDL_bool SDL_IsScreenSaverEnabled();
void SDL_EnableScreenSaver();
void SDL_DisableScreenSaver();
int SDL_GL_LoadLibrary(const(char)*);
void* SDL_GL_GetProcAddress(const(char)*);
void SDL_GL_UnloadLibrary();
SDL_bool SDL_GL_ExtensionSupported(const(char)*);
int SDL_GL_SetAttribute(SDL_GLattr,int);
int SDL_GL_GetAttribute(SDL_GLattr,int*);
SDL_GLContext SDL_GL_CreateContext(SDL_Window*);
int SDL_GL_MakeCurrent(SDL_Window*,SDL_GLContext);
SDL_Window* SDL_GL_GetCurrentWindow();
SDL_GLContext SDL_GL_GetCurrentContext();
int SDL_GL_SetSwapInterval(int);
int SDL_GL_GetSwapInterval();
void SDL_GL_SwapWindow(SDL_Window*);
void SDL_GL_DeleteContext(SDL_GLContext);
static if(sdlSupport >= SDLSupport.sdl201) {
void SDL_GL_GetDrawableSize(SDL_Window*,int*,int*);
}
static if(sdlSupport >= SDLSupport.sdl202) {
void SDL_GL_ResetAttributes();
}
static if(sdlSupport >= SDLSupport.sdl204) {
int SDL_GetDisplayDPI(int,float*,float*,float*);
SDL_Window* SDL_GetGrabbedWindow();
int SDL_SetWindowHitTest(SDL_Window*,SDL_HitTest,void*);
}
static if(sdlSupport >= SDLSupport.sdl205) {
int SDL_GetDisplayUsableBounds(int,SDL_Rect*);
int SDL_GetWindowBordersSize(SDL_Window*,int*,int*,int*,int*);
int SDL_GetWindowOpacity(SDL_Window*,float*);
int SDL_SetWindowInputFocus(SDL_Window*);
int SDL_SetWindowModalFor(SDL_Window*,SDL_Window*);
int SDL_SetWindowOpacity(SDL_Window*,float);
void SDL_SetWindowResizable(SDL_Window*,SDL_bool);
}
static if(sdlSupport >= SDLSupport.sdl209) {
SDL_DisplayOrientation SDL_GetDisplayOrientation(int);
}
}
}
else {
extern(C) @nogc nothrow {
alias pSDL_GetNumVideoDrivers = int function();
alias pSDL_GetVideoDriver = const(char)* function(int);
alias pSDL_VideoInit = int function(const(char)*);
alias pSDL_VideoQuit = void function();
alias pSDL_GetCurrentVideoDriver = const(char)* function();
alias pSDL_GetNumVideoDisplays = int function();
alias pSDL_GetDisplayName = const(char)* function(int);
alias pSDL_GetDisplayBounds = int function(int,SDL_Rect*);
alias pSDL_GetNumDisplayModes = int function(int);
alias pSDL_GetDisplayMode = int function(int,int,SDL_DisplayMode*);
alias pSDL_GetDesktopDisplayMode = int function(int,SDL_DisplayMode*);
alias pSDL_GetCurrentDisplayMode = int function(int,SDL_DisplayMode*);
alias pSDL_GetClosestDisplayMode = SDL_DisplayMode* function(int,const(SDL_DisplayMode)*,SDL_DisplayMode*);
alias pSDL_GetWindowDisplayIndex = int function(SDL_Window*);
alias pSDL_SetWindowDisplayMode = int function(SDL_Window*,const(SDL_DisplayMode)*);
alias pSDL_GetWindowDisplayMode = int function(SDL_Window*,SDL_DisplayMode*);
alias pSDL_GetWindowPixelFormat = uint function(SDL_Window*);
alias pSDL_CreateWindow = SDL_Window* function(const(char)*,int,int,int,int,SDL_WindowFlags);
alias pSDL_CreateWindowFrom = SDL_Window* function(const(void)*);
alias pSDL_GetWindowID = uint function(SDL_Window*);
alias pSDL_GetWindowFromID = SDL_Window* function(uint);
alias pSDL_GetWindowFlags = SDL_WindowFlags function(SDL_Window*);
alias pSDL_SetWindowTitle = void function(SDL_Window*,const(char)*);
alias pSDL_GetWindowTitle = const(char)* function(SDL_Window*);
alias pSDL_SetWindowIcon = void function(SDL_Window*,SDL_Surface*);
alias pSDL_SetWindowData = void* function(SDL_Window*,const(char)*,void*);
alias pSDL_GetWindowData = void* function(SDL_Window*,const(char)*);
alias pSDL_SetWindowPosition = void function(SDL_Window*,int,int);
alias pSDL_GetWindowPosition = void function(SDL_Window*,int*,int*);
alias pSDL_SetWindowSize = void function(SDL_Window*,int,int);
alias pSDL_GetWindowSize = void function(SDL_Window*,int*,int*);
alias pSDL_SetWindowMinimumSize = void function(SDL_Window*,int,int);
alias pSDL_GetWindowMinimumSize = void function(SDL_Window*,int*,int*);
alias pSDL_SetWindowMaximumSize = void function(SDL_Window*,int,int);
alias pSDL_GetWindowMaximumSize = void function(SDL_Window*,int*,int*);
alias pSDL_SetWindowBordered = void function(SDL_Window*,SDL_bool);
alias pSDL_ShowWindow = void function(SDL_Window*);
alias pSDL_HideWindow = void function(SDL_Window*);
alias pSDL_RaiseWindow = void function(SDL_Window*);
alias pSDL_MaximizeWindow = void function(SDL_Window*);
alias pSDL_MinimizeWindow = void function(SDL_Window*);
alias pSDL_RestoreWindow = void function(SDL_Window*);
alias pSDL_SetWindowFullscreen = int function(SDL_Window*,uint);
alias pSDL_GetWindowSurface = SDL_Surface* function(SDL_Window*);
alias pSDL_UpdateWindowSurface = int function(SDL_Window*);
alias pSDL_UpdateWindowSurfaceRects = int function(SDL_Window*,SDL_Rect*,int);
alias pSDL_SetWindowGrab = void function(SDL_Window*,SDL_bool);
alias pSDL_GetWindowGrab = SDL_bool function(SDL_Window*);
alias pSDL_SetWindowBrightness = int function(SDL_Window*,float);
alias pSDL_GetWindowBrightness = float function(SDL_Window*);
alias pSDL_SetWindowGammaRamp = int function(SDL_Window*,const(ushort)*,const(ushort)*,const(ushort)*);
alias pSDL_GetWindowGammaRamp = int function(SDL_Window*,ushort*,ushort*,ushort*);
alias pSDL_DestroyWindow = void function(SDL_Window*);
alias pSDL_IsScreenSaverEnabled = SDL_bool function();
alias pSDL_EnableScreenSaver = void function();
alias pSDL_DisableScreenSaver = void function();
alias pSDL_GL_LoadLibrary = int function(const(char)*);
alias pSDL_GL_GetProcAddress = void* function(const(char)*);
alias pSDL_GL_UnloadLibrary = void function();
alias pSDL_GL_ExtensionSupported = SDL_bool function(const(char)*);
alias pSDL_GL_SetAttribute = int function(SDL_GLattr,int);
alias pSDL_GL_GetAttribute = int function(SDL_GLattr,int*);
alias pSDL_GL_CreateContext = SDL_GLContext function(SDL_Window*);
alias pSDL_GL_MakeCurrent = int function(SDL_Window*,SDL_GLContext);
alias pSDL_GL_GetCurrentWindow = SDL_Window* function();
alias pSDL_GL_GetCurrentContext = SDL_GLContext function();
alias pSDL_GL_SetSwapInterval = int function(int);
alias pSDL_GL_GetSwapInterval = int function();
alias pSDL_GL_SwapWindow = void function(SDL_Window*);
alias pSDL_GL_DeleteContext = void function(SDL_GLContext);
}
__gshared {
pSDL_GetNumVideoDrivers SDL_GetNumVideoDrivers;
pSDL_GetVideoDriver SDL_GetVideoDriver;
pSDL_VideoInit SDL_VideoInit;
pSDL_VideoQuit SDL_VideoQuit;
pSDL_GetCurrentVideoDriver SDL_GetCurrentVideoDriver;
pSDL_GetNumVideoDisplays SDL_GetNumVideoDisplays;
pSDL_GetDisplayName SDL_GetDisplayName;
pSDL_GetDisplayBounds SDL_GetDisplayBounds;
pSDL_GetNumDisplayModes SDL_GetNumDisplayModes;
pSDL_GetDisplayMode SDL_GetDisplayMode;
pSDL_GetDesktopDisplayMode SDL_GetDesktopDisplayMode;
pSDL_GetCurrentDisplayMode SDL_GetCurrentDisplayMode;
pSDL_GetClosestDisplayMode SDL_GetClosestDisplayMode;
pSDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex;
pSDL_SetWindowDisplayMode SDL_SetWindowDisplayMode;
pSDL_GetWindowDisplayMode SDL_GetWindowDisplayMode;
pSDL_GetWindowPixelFormat SDL_GetWindowPixelFormat;
pSDL_CreateWindow SDL_CreateWindow;
pSDL_CreateWindowFrom SDL_CreateWindowFrom;
pSDL_GetWindowID SDL_GetWindowID;
pSDL_GetWindowFromID SDL_GetWindowFromID;
pSDL_GetWindowFlags SDL_GetWindowFlags;
pSDL_SetWindowTitle SDL_SetWindowTitle;
pSDL_GetWindowTitle SDL_GetWindowTitle;
pSDL_SetWindowIcon SDL_SetWindowIcon;
pSDL_SetWindowData SDL_SetWindowData;
pSDL_GetWindowData SDL_GetWindowData;
pSDL_SetWindowPosition SDL_SetWindowPosition;
pSDL_GetWindowPosition SDL_GetWindowPosition;
pSDL_SetWindowSize SDL_SetWindowSize;
pSDL_GetWindowSize SDL_GetWindowSize;
pSDL_SetWindowMinimumSize SDL_SetWindowMinimumSize;
pSDL_GetWindowMinimumSize SDL_GetWindowMinimumSize;
pSDL_SetWindowMaximumSize SDL_SetWindowMaximumSize;
pSDL_GetWindowMaximumSize SDL_GetWindowMaximumSize;
pSDL_SetWindowBordered SDL_SetWindowBordered;
pSDL_ShowWindow SDL_ShowWindow;
pSDL_HideWindow SDL_HideWindow;
pSDL_RaiseWindow SDL_RaiseWindow;
pSDL_MaximizeWindow SDL_MaximizeWindow;
pSDL_MinimizeWindow SDL_MinimizeWindow;
pSDL_RestoreWindow SDL_RestoreWindow;
pSDL_SetWindowFullscreen SDL_SetWindowFullscreen;
pSDL_GetWindowSurface SDL_GetWindowSurface;
pSDL_UpdateWindowSurface SDL_UpdateWindowSurface;
pSDL_UpdateWindowSurfaceRects SDL_UpdateWindowSurfaceRects;
pSDL_SetWindowGrab SDL_SetWindowGrab;
pSDL_GetWindowGrab SDL_GetWindowGrab;
pSDL_SetWindowBrightness SDL_SetWindowBrightness;
pSDL_GetWindowBrightness SDL_GetWindowBrightness;
pSDL_SetWindowGammaRamp SDL_SetWindowGammaRamp;
pSDL_GetWindowGammaRamp SDL_GetWindowGammaRamp;
pSDL_DestroyWindow SDL_DestroyWindow;
pSDL_IsScreenSaverEnabled SDL_IsScreenSaverEnabled;
pSDL_EnableScreenSaver SDL_EnableScreenSaver;
pSDL_DisableScreenSaver SDL_DisableScreenSaver;
pSDL_GL_LoadLibrary SDL_GL_LoadLibrary;
pSDL_GL_GetProcAddress SDL_GL_GetProcAddress;
pSDL_GL_UnloadLibrary SDL_GL_UnloadLibrary;
pSDL_GL_ExtensionSupported SDL_GL_ExtensionSupported;
pSDL_GL_SetAttribute SDL_GL_SetAttribute;
pSDL_GL_GetAttribute SDL_GL_GetAttribute;
pSDL_GL_CreateContext SDL_GL_CreateContext;
pSDL_GL_MakeCurrent SDL_GL_MakeCurrent;
pSDL_GL_GetCurrentWindow SDL_GL_GetCurrentWindow;
pSDL_GL_GetCurrentContext SDL_GL_GetCurrentContext;
pSDL_GL_SetSwapInterval SDL_GL_SetSwapInterval;
pSDL_GL_GetSwapInterval SDL_GL_GetSwapInterval;
pSDL_GL_SwapWindow SDL_GL_SwapWindow;
pSDL_GL_DeleteContext SDL_GL_DeleteContext;
}
static if(sdlSupport >= SDLSupport.sdl201) {
extern(C) @nogc nothrow {
alias pSDL_GL_GetDrawableSize = void function(SDL_Window*,int*,int*);
}
__gshared {
pSDL_GL_GetDrawableSize SDL_GL_GetDrawableSize;
}
}
static if(sdlSupport >= SDLSupport.sdl202) {
extern(C) @nogc nothrow {
alias pSDL_GL_ResetAttributes = void function();
}
__gshared {
pSDL_GL_ResetAttributes SDL_GL_ResetAttributes;
}
}
static if(sdlSupport >= SDLSupport.sdl204) {
extern(C) @nogc nothrow {
alias pSDL_GetDisplayDPI = int function(int,float*,float*,float*);
alias pSDL_GetGrabbedWindow = SDL_Window* function();
alias pSDL_SetWindowHitTest = int function(SDL_Window*,SDL_HitTest,void*);
}
__gshared {
pSDL_GetDisplayDPI SDL_GetDisplayDPI;
pSDL_GetGrabbedWindow SDL_GetGrabbedWindow;
pSDL_SetWindowHitTest SDL_SetWindowHitTest;
}
}
static if(sdlSupport >= SDLSupport.sdl205) {
extern(C) @nogc nothrow {
alias pSDL_GetDisplayUsableBounds = int function(int,SDL_Rect*);
alias pSDL_GetWindowBordersSize = int function(SDL_Window*,int*,int*,int*,int*);
alias pSDL_GetWindowOpacity = int function(SDL_Window*,float*);
alias pSDL_SetWindowInputFocus = int function(SDL_Window*);
alias pSDL_SetWindowModalFor = int function(SDL_Window*,SDL_Window*);
alias pSDL_SetWindowOpacity = int function(SDL_Window*,float);
alias pSDL_SetWindowResizable = void function(SDL_Window*,SDL_bool);
}
__gshared {
pSDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds;
pSDL_GetWindowBordersSize SDL_GetWindowBordersSize;
pSDL_GetWindowOpacity SDL_GetWindowOpacity;
pSDL_SetWindowInputFocus SDL_SetWindowInputFocus;
pSDL_SetWindowModalFor SDL_SetWindowModalFor;
pSDL_SetWindowOpacity SDL_SetWindowOpacity;
pSDL_SetWindowResizable SDL_SetWindowResizable;
}
}
static if(sdlSupport >= SDLSupport.sdl209) {
extern(C) @nogc nothrow {
alias pSDL_GetDisplayOrientation = SDL_DisplayOrientation function(int);
}
__gshared {
pSDL_GetDisplayOrientation SDL_GetDisplayOrientation;
}
}
}

View file

@ -0,0 +1,45 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.bind.sdlvulkan;
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
import bindbc.sdl.bind.sdlvideo : SDL_Window;
version(BindSDL_Static) {
extern(C) @nogc nothrow {
static if(sdlSupport >= SDLSupport.sdl206) {
SDL_bool SDL_Vulkan_CreateSurface(SDL_Window*,void*,void*);
void SDL_Vulkan_GetDrawableSize(SDL_Window*,int*,int*);
SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window*,uint*,const(char)**);
void* SDL_Vulkan_GetVkGetInstanceProcAddr();
int SDL_Vulkan_LoadLibrary(const(char)*);
void SDL_Vulkan_UnloadLibrary();
}
}
}
else {
static if(sdlSupport >= SDLSupport.sdl206) {
extern(C) @nogc nothrow {
alias pSDL_Vulkan_CreateSurface = SDL_bool function(SDL_Window*,void*,void*);
alias pSDL_Vulkan_GetDrawableSize = void function(SDL_Window*,int*,int*);
alias pSDL_Vulkan_GetInstanceExtensions = SDL_bool function(SDL_Window*,uint*,const(char)**);
alias pSDL_Vulkan_GetVkGetInstanceProcAddr = void* function();
alias pSDL_Vulkan_LoadLibrary = int function(const(char)*);
alias pSDL_Vulkan_UnloadLibrary = void function();
}
__gshared {
pSDL_Vulkan_CreateSurface SDL_Vulkan_CreateSurface;
pSDL_Vulkan_GetDrawableSize SDL_Vulkan_GetDrawableSize;
pSDL_Vulkan_GetInstanceExtensions SDL_Vulkan_GetInstanceExtensions;
pSDL_Vulkan_GetVkGetInstanceProcAddr SDL_Vulkan_GetVkGetInstanceProcAddr;
pSDL_Vulkan_LoadLibrary SDL_Vulkan_LoadLibrary;
pSDL_Vulkan_UnloadLibrary SDL_Vulkan_UnloadLibrary;
}
}
}

View file

@ -0,0 +1,44 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.config;
enum SDLSupport {
noLibrary,
badLibrary,
sdl200 = 200,
sdl201 = 201,
sdl202 = 202,
sdl203 = 203,
sdl204 = 204,
sdl205 = 205,
sdl206 = 206,
sdl207 = 207,
sdl208 = 208,
sdl209 = 209,
sdl2010 = 2010,
}
version(SDL_2010) enum sdlSupport = SDLSupport.sdl2010;
else version(SDL_209) enum sdlSupport = SDLSupport.sdl209;
else version(SDL_208) enum sdlSupport = SDLSupport.sdl208;
else version(SDL_207) enum sdlSupport = SDLSupport.sdl207;
else version(SDL_206) enum sdlSupport = SDLSupport.sdl206;
else version(SDL_205) enum sdlSupport = SDLSupport.sdl205;
else version(SDL_204) enum sdlSupport = SDLSupport.sdl204;
else version(SDL_203) enum sdlSupport = SDLSupport.sdl203;
else version(SDL_202) enum sdlSupport = SDLSupport.sdl202;
else version(SDL_201) enum sdlSupport = SDLSupport.sdl201;
else enum sdlSupport = SDLSupport.sdl200;
enum expandEnum(EnumType, string fqnEnumType = EnumType.stringof) = (){
string expandEnum = "enum {";
foreach(m;__traits(allMembers, EnumType)) {
expandEnum ~= m ~ " = " ~ fqnEnumType ~ "." ~ m ~ ",";
}
expandEnum ~= "}";
return expandEnum;
}();

View file

@ -0,0 +1,712 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.dynload;
version(BindSDL_Static) {}
else:
import bindbc.loader;
import bindbc.sdl.config,
bindbc.sdl.bind;
private {
__gshared SharedLib lib;
__gshared SDLSupport loadedVersion;
}
void unloadSDL()
{
if(lib != invalidHandle) {
lib.unload();
}
}
SDLSupport loadedSDLVersion() { return loadedVersion; }
bool isSDLLoaded()
{
return lib != invalidHandle;
}
SDLSupport loadSDL()
{
// #1778 prevents me from using static arrays here :(
version(Windows) {
const(char)[][1] libNames = ["SDL2.dll"];
}
else version(OSX) {
const(char)[][7] libNames = [
"libSDL2.dylib",
"/usr/local/lib/libSDL2.dylib",
"/usr/local/lib/libSDL2/libSDL2.dylib",
"../Frameworks/SDL2.framework/SDL2",
"/Library/Frameworks/SDL2.framework/SDL2",
"/System/Library/Frameworks/SDL2.framework/SDL2",
"/opt/local/lib/libSDL2.dylib"
];
}
else version(Posix) {
const(char)[][6] libNames = [
"libSDL2.so",
"/usr/local/lib/libSDL2.so",
"libSDL2-2.0.so",
"/usr/local/lib/libSDL2-2.0.so",
"libSDL2-2.0.so.0",
"/usr/local/lib/libSDL2-2.0.so.0"
];
}
else static assert(0, "bindbc-sdl is not yet supported on this platform.");
SDLSupport ret;
foreach(name; libNames) {
ret = loadSDL(name.ptr);
if(ret != SDLSupport.noLibrary) break;
}
return ret;
}
SDLSupport loadSDL(const(char)* libName)
{
lib = load(libName);
if(lib == invalidHandle) {
return SDLSupport.noLibrary;
}
auto errCount = errorCount();
loadedVersion = SDLSupport.badLibrary;
lib.bindSymbol(cast(void**)&SDL_Init, "SDL_Init");
lib.bindSymbol(cast(void**)&SDL_InitSubSystem, "SDL_InitSubSystem");
lib.bindSymbol(cast(void**)&SDL_QuitSubSystem, "SDL_QuitSubSystem");
lib.bindSymbol(cast(void**)&SDL_WasInit, "SDL_WasInit");
lib.bindSymbol(cast(void**)&SDL_Quit, "SDL_Quit");
lib.bindSymbol(cast(void**)&SDL_SetAssertionHandler, "SDL_SetAssertionHandler");
lib.bindSymbol(cast(void**)&SDL_GetAssertionReport, "SDL_GetAssertionReport");
lib.bindSymbol(cast(void**)&SDL_ResetAssertionReport, "SDL_ResetAssertionReport");
lib.bindSymbol(cast(void**)&SDL_GetNumAudioDrivers, "SDL_GetNumAudioDrivers");
lib.bindSymbol(cast(void**)&SDL_GetAudioDriver, "SDL_GetAudioDriver");
lib.bindSymbol(cast(void**)&SDL_AudioInit, "SDL_AudioInit");
lib.bindSymbol(cast(void**)&SDL_AudioQuit, "SDL_AudioQuit");
lib.bindSymbol(cast(void**)&SDL_GetCurrentAudioDriver, "SDL_GetCurrentAudioDriver");
lib.bindSymbol(cast(void**)&SDL_OpenAudio, "SDL_OpenAudio");
lib.bindSymbol(cast(void**)&SDL_GetNumAudioDevices, "SDL_GetNumAudioDevices");
lib.bindSymbol(cast(void**)&SDL_GetAudioDeviceName, "SDL_GetAudioDeviceName");
lib.bindSymbol(cast(void**)&SDL_OpenAudioDevice, "SDL_OpenAudioDevice");
lib.bindSymbol(cast(void**)&SDL_GetAudioStatus, "SDL_GetAudioStatus");
lib.bindSymbol(cast(void**)&SDL_GetAudioDeviceStatus, "SDL_GetAudioDeviceStatus");
lib.bindSymbol(cast(void**)&SDL_PauseAudio, "SDL_PauseAudio");
lib.bindSymbol(cast(void**)&SDL_PauseAudioDevice, "SDL_PauseAudioDevice");
lib.bindSymbol(cast(void**)&SDL_LoadWAV_RW, "SDL_LoadWAV_RW");
lib.bindSymbol(cast(void**)&SDL_FreeWAV, "SDL_FreeWAV");
lib.bindSymbol(cast(void**)&SDL_BuildAudioCVT, "SDL_BuildAudioCVT");
lib.bindSymbol(cast(void**)&SDL_ConvertAudio, "SDL_ConvertAudio");
lib.bindSymbol(cast(void**)&SDL_MixAudio, "SDL_MixAudio");
lib.bindSymbol(cast(void**)&SDL_MixAudioFormat, "SDL_MixAudioFormat");
lib.bindSymbol(cast(void**)&SDL_LockAudio, "SDL_LockAudio");
lib.bindSymbol(cast(void**)&SDL_LockAudioDevice, "SDL_LockAudioDevice");
lib.bindSymbol(cast(void**)&SDL_UnlockAudio, "SDL_UnlockAudio");
lib.bindSymbol(cast(void**)&SDL_UnlockAudioDevice, "SDL_UnlockAudioDevice");
lib.bindSymbol(cast(void**)&SDL_CloseAudio, "SDL_CloseAudio");
lib.bindSymbol(cast(void**)&SDL_CloseAudioDevice, "SDL_CloseAudioDevice");
lib.bindSymbol(cast(void**)&SDL_SetClipboardText, "SDL_SetClipboardText");
lib.bindSymbol(cast(void**)&SDL_GetClipboardText, "SDL_GetClipboardText");
lib.bindSymbol(cast(void**)&SDL_HasClipboardText, "SDL_HasClipboardText");
lib.bindSymbol(cast(void**)&SDL_GetCPUCount, "SDL_GetCPUCount");
lib.bindSymbol(cast(void**)&SDL_GetCPUCacheLineSize, "SDL_GetCPUCacheLineSize");
lib.bindSymbol(cast(void**)&SDL_HasRDTSC, "SDL_HasRDTSC");
lib.bindSymbol(cast(void**)&SDL_HasAltiVec, "SDL_HasAltiVec");
lib.bindSymbol(cast(void**)&SDL_HasMMX, "SDL_HasMMX");
lib.bindSymbol(cast(void**)&SDL_Has3DNow, "SDL_Has3DNow");
lib.bindSymbol(cast(void**)&SDL_HasSSE, "SDL_HasSSE");
lib.bindSymbol(cast(void**)&SDL_HasSSE2, "SDL_HasSSE2");
lib.bindSymbol(cast(void**)&SDL_HasSSE3, "SDL_HasSSE3");
lib.bindSymbol(cast(void**)&SDL_HasSSE41, "SDL_HasSSE41");
lib.bindSymbol(cast(void**)&SDL_HasSSE42, "SDL_HasSSE42");
lib.bindSymbol(cast(void**)&SDL_SetError, "SDL_SetError");
lib.bindSymbol(cast(void**)&SDL_GetError, "SDL_GetError");
lib.bindSymbol(cast(void**)&SDL_ClearError, "SDL_ClearError");
lib.bindSymbol(cast(void**)&SDL_PumpEvents, "SDL_PumpEvents");
lib.bindSymbol(cast(void**)&SDL_PeepEvents, "SDL_PeepEvents");
lib.bindSymbol(cast(void**)&SDL_HasEvent, "SDL_HasEvent");
lib.bindSymbol(cast(void**)&SDL_HasEvents, "SDL_HasEvents");
lib.bindSymbol(cast(void**)&SDL_FlushEvent, "SDL_FlushEvent");
lib.bindSymbol(cast(void**)&SDL_FlushEvents, "SDL_FlushEvents");
lib.bindSymbol(cast(void**)&SDL_PollEvent, "SDL_PollEvent");
lib.bindSymbol(cast(void**)&SDL_WaitEvent, "SDL_WaitEvent");
lib.bindSymbol(cast(void**)&SDL_WaitEventTimeout, "SDL_WaitEventTimeout");
lib.bindSymbol(cast(void**)&SDL_PushEvent, "SDL_PushEvent");
lib.bindSymbol(cast(void**)&SDL_SetEventFilter, "SDL_SetEventFilter");
lib.bindSymbol(cast(void**)&SDL_GetEventFilter, "SDL_GetEventFilter");
lib.bindSymbol(cast(void**)&SDL_AddEventWatch, "SDL_AddEventWatch");
lib.bindSymbol(cast(void**)&SDL_DelEventWatch, "SDL_DelEventWatch");
lib.bindSymbol(cast(void**)&SDL_FilterEvents, "SDL_FilterEvents");
lib.bindSymbol(cast(void**)&SDL_EventState, "SDL_EventState");
lib.bindSymbol(cast(void**)&SDL_RegisterEvents, "SDL_RegisterEvents");
lib.bindSymbol(cast(void**)&SDL_GameControllerAddMapping, "SDL_GameControllerAddMapping");
lib.bindSymbol(cast(void**)&SDL_GameControllerMappingForGUID, "SDL_GameControllerMappingForGUID");
lib.bindSymbol(cast(void**)&SDL_GameControllerMapping, "SDL_GameControllerMapping");
lib.bindSymbol(cast(void**)&SDL_IsGameController, "SDL_IsGameController");
lib.bindSymbol(cast(void**)&SDL_GameControllerNameForIndex, "SDL_GameControllerNameForIndex");
lib.bindSymbol(cast(void**)&SDL_GameControllerOpen, "SDL_GameControllerOpen");
lib.bindSymbol(cast(void**)&SDL_GameControllerName, "SDL_GameControllerName");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetAttached, "SDL_GameControllerGetAttached");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetJoystick, "SDL_GameControllerGetJoystick");
lib.bindSymbol(cast(void**)&SDL_GameControllerEventState, "SDL_GameControllerEventState");
lib.bindSymbol(cast(void**)&SDL_GameControllerUpdate, "SDL_GameControllerUpdate");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetAxisFromString, "SDL_GameControllerGetAxisFromString");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetStringForAxis, "SDL_GameControllerGetStringForAxis");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetBindForAxis, "SDL_GameControllerGetBindForAxis");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetAxis, "SDL_GameControllerGetAxis");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetButtonFromString, "SDL_GameControllerGetButtonFromString");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetStringForButton, "SDL_GameControllerGetStringForButton");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetBindForButton, "SDL_GameControllerGetBindForButton");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetButton, "SDL_GameControllerGetButton");
lib.bindSymbol(cast(void**)&SDL_GameControllerClose, "SDL_GameControllerClose");
lib.bindSymbol(cast(void**)&SDL_RecordGesture, "SDL_RecordGesture");
lib.bindSymbol(cast(void**)&SDL_SaveAllDollarTemplates, "SDL_SaveAllDollarTemplates");
lib.bindSymbol(cast(void**)&SDL_SaveDollarTemplate, "SDL_SaveDollarTemplate");
lib.bindSymbol(cast(void**)&SDL_LoadDollarTemplates, "SDL_LoadDollarTemplates");
lib.bindSymbol(cast(void**)&SDL_NumHaptics, "SDL_NumHaptics");
lib.bindSymbol(cast(void**)&SDL_HapticName, "SDL_HapticName");
lib.bindSymbol(cast(void**)&SDL_HapticOpen, "SDL_HapticOpen");
lib.bindSymbol(cast(void**)&SDL_HapticOpened, "SDL_HapticOpened");
lib.bindSymbol(cast(void**)&SDL_HapticIndex, "SDL_HapticIndex");
lib.bindSymbol(cast(void**)&SDL_MouseIsHaptic, "SDL_MouseIsHaptic");
lib.bindSymbol(cast(void**)&SDL_HapticOpenFromMouse, "SDL_HapticOpenFromMouse");
lib.bindSymbol(cast(void**)&SDL_JoystickIsHaptic, "SDL_JoystickIsHaptic");
lib.bindSymbol(cast(void**)&SDL_HapticOpenFromJoystick, "SDL_HapticOpenFromJoystick");
lib.bindSymbol(cast(void**)&SDL_HapticClose, "SDL_HapticClose");
lib.bindSymbol(cast(void**)&SDL_HapticNumEffects, "SDL_HapticNumEffects");
lib.bindSymbol(cast(void**)&SDL_HapticNumEffectsPlaying, "SDL_HapticNumEffectsPlaying");
lib.bindSymbol(cast(void**)&SDL_HapticQuery, "SDL_HapticQuery");
lib.bindSymbol(cast(void**)&SDL_HapticNumAxes, "SDL_HapticNumAxes");
lib.bindSymbol(cast(void**)&SDL_HapticEffectSupported, "SDL_HapticEffectSupported");
lib.bindSymbol(cast(void**)&SDL_HapticNewEffect, "SDL_HapticNewEffect");
lib.bindSymbol(cast(void**)&SDL_HapticUpdateEffect, "SDL_HapticUpdateEffect");
lib.bindSymbol(cast(void**)&SDL_HapticRunEffect, "SDL_HapticRunEffect");
lib.bindSymbol(cast(void**)&SDL_HapticStopEffect, "SDL_HapticStopEffect");
lib.bindSymbol(cast(void**)&SDL_HapticDestroyEffect, "SDL_HapticDestroyEffect");
lib.bindSymbol(cast(void**)&SDL_HapticGetEffectStatus, "SDL_HapticGetEffectStatus");
lib.bindSymbol(cast(void**)&SDL_HapticSetGain, "SDL_HapticSetGain");
lib.bindSymbol(cast(void**)&SDL_HapticSetAutocenter, "SDL_HapticSetAutocenter");
lib.bindSymbol(cast(void**)&SDL_HapticPause, "SDL_HapticPause");
lib.bindSymbol(cast(void**)&SDL_HapticUnpause, "SDL_HapticUnpause");
lib.bindSymbol(cast(void**)&SDL_HapticStopAll, "SDL_HapticStopAll");
lib.bindSymbol(cast(void**)&SDL_HapticRumbleSupported, "SDL_HapticRumbleSupported");
lib.bindSymbol(cast(void**)&SDL_HapticRumbleInit, "SDL_HapticRumbleInit");
lib.bindSymbol(cast(void**)&SDL_HapticRumblePlay, "SDL_HapticRumblePlay");
lib.bindSymbol(cast(void**)&SDL_HapticRumbleStop, "SDL_HapticRumbleStop");
lib.bindSymbol(cast(void**)&SDL_SetHintWithPriority, "SDL_SetHintWithPriority");
lib.bindSymbol(cast(void**)&SDL_SetHint, "SDL_SetHint");
lib.bindSymbol(cast(void**)&SDL_GetHint, "SDL_GetHint");
lib.bindSymbol(cast(void**)&SDL_AddHintCallback, "SDL_AddHintCallback");
lib.bindSymbol(cast(void**)&SDL_DelHintCallback, "SDL_DelHintCallback");
lib.bindSymbol(cast(void**)&SDL_ClearHints, "SDL_ClearHints");
lib.bindSymbol(cast(void**)&SDL_NumJoysticks, "SDL_NumJoysticks");
lib.bindSymbol(cast(void**)&SDL_JoystickNameForIndex, "SDL_JoystickNameForIndex");
lib.bindSymbol(cast(void**)&SDL_JoystickOpen, "SDL_JoystickOpen");
lib.bindSymbol(cast(void**)&SDL_JoystickName, "SDL_JoystickName");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceGUID, "SDL_JoystickGetDeviceGUID");
lib.bindSymbol(cast(void**)&SDL_JoystickGetGUID, "SDL_JoystickGetGUID");
lib.bindSymbol(cast(void**)&SDL_JoystickGetGUIDString, "SDL_JoystickGetGUIDString");
lib.bindSymbol(cast(void**)&SDL_JoystickGetGUIDFromString, "SDL_JoystickGetGUIDFromString");
lib.bindSymbol(cast(void**)&SDL_JoystickGetAttached, "SDL_JoystickGetAttached");
lib.bindSymbol(cast(void**)&SDL_JoystickInstanceID, "SDL_JoystickInstanceID");
lib.bindSymbol(cast(void**)&SDL_JoystickNumAxes, "SDL_JoystickNumAxes");
lib.bindSymbol(cast(void**)&SDL_JoystickNumBalls, "SDL_JoystickNumBalls");
lib.bindSymbol(cast(void**)&SDL_JoystickNumHats, "SDL_JoystickNumHats");
lib.bindSymbol(cast(void**)&SDL_JoystickNumButtons, "SDL_JoystickNumButtons");
lib.bindSymbol(cast(void**)&SDL_JoystickUpdate, "SDL_JoystickUpdate");
lib.bindSymbol(cast(void**)&SDL_JoystickEventState, "SDL_JoystickEventState");
lib.bindSymbol(cast(void**)&SDL_JoystickGetAxis, "SDL_JoystickGetAxis");
lib.bindSymbol(cast(void**)&SDL_JoystickGetHat, "SDL_JoystickGetHat");
lib.bindSymbol(cast(void**)&SDL_JoystickGetBall, "SDL_JoystickGetBall");
lib.bindSymbol(cast(void**)&SDL_JoystickGetButton, "SDL_JoystickGetButton");
lib.bindSymbol(cast(void**)&SDL_JoystickClose, "SDL_JoystickClose");
lib.bindSymbol(cast(void**)&SDL_GetKeyboardFocus, "SDL_GetKeyboardFocus");
lib.bindSymbol(cast(void**)&SDL_GetKeyboardState, "SDL_GetKeyboardState");
lib.bindSymbol(cast(void**)&SDL_GetModState, "SDL_GetModState");
lib.bindSymbol(cast(void**)&SDL_SetModState, "SDL_SetModState");
lib.bindSymbol(cast(void**)&SDL_GetKeyFromScancode, "SDL_GetKeyFromScancode");
lib.bindSymbol(cast(void**)&SDL_GetScancodeFromKey, "SDL_GetScancodeFromKey");
lib.bindSymbol(cast(void**)&SDL_GetScancodeName, "SDL_GetScancodeName");
lib.bindSymbol(cast(void**)&SDL_GetScancodeFromName, "SDL_GetScancodeFromName");
lib.bindSymbol(cast(void**)&SDL_GetKeyName, "SDL_GetKeyName");
lib.bindSymbol(cast(void**)&SDL_GetKeyFromName, "SDL_GetKeyFromName");
lib.bindSymbol(cast(void**)&SDL_StartTextInput, "SDL_StartTextInput");
lib.bindSymbol(cast(void**)&SDL_IsTextInputActive, "SDL_IsTextInputActive");
lib.bindSymbol(cast(void**)&SDL_StopTextInput, "SDL_StopTextInput");
lib.bindSymbol(cast(void**)&SDL_SetTextInputRect, "SDL_SetTextInputRect");
lib.bindSymbol(cast(void**)&SDL_HasScreenKeyboardSupport, "SDL_HasScreenKeyboardSupport");
lib.bindSymbol(cast(void**)&SDL_IsScreenKeyboardShown, "SDL_IsScreenKeyboardShown");
lib.bindSymbol(cast(void**)&SDL_LoadObject, "SDL_LoadObject");
lib.bindSymbol(cast(void**)&SDL_LoadFunction, "SDL_LoadFunction");
lib.bindSymbol(cast(void**)&SDL_UnloadObject, "SDL_UnloadObject");
lib.bindSymbol(cast(void**)&SDL_LogSetAllPriority, "SDL_LogSetAllPriority");
lib.bindSymbol(cast(void**)&SDL_LogSetPriority, "SDL_LogSetPriority");
lib.bindSymbol(cast(void**)&SDL_LogGetPriority, "SDL_LogGetPriority");
lib.bindSymbol(cast(void**)&SDL_LogResetPriorities, "SDL_LogResetPriorities");
lib.bindSymbol(cast(void**)&SDL_Log, "SDL_Log");
lib.bindSymbol(cast(void**)&SDL_LogVerbose, "SDL_LogVerbose");
lib.bindSymbol(cast(void**)&SDL_LogDebug, "SDL_LogDebug");
lib.bindSymbol(cast(void**)&SDL_LogInfo, "SDL_LogInfo");
lib.bindSymbol(cast(void**)&SDL_LogWarn, "SDL_LogWarn");
lib.bindSymbol(cast(void**)&SDL_LogError, "SDL_LogError");
lib.bindSymbol(cast(void**)&SDL_LogCritical, "SDL_LogCritical");
lib.bindSymbol(cast(void**)&SDL_LogMessage, "SDL_LogMessage");
lib.bindSymbol(cast(void**)&SDL_LogMessageV, "SDL_LogMessageV");
lib.bindSymbol(cast(void**)&SDL_LogGetOutputFunction, "SDL_LogGetOutputFunction");
lib.bindSymbol(cast(void**)&SDL_LogSetOutputFunction, "SDL_LogSetOutputFunction");
lib.bindSymbol(cast(void**)&SDL_ShowMessageBox, "SDL_ShowMessageBox");
lib.bindSymbol(cast(void**)&SDL_ShowSimpleMessageBox, "SDL_ShowSimpleMessageBox");
lib.bindSymbol(cast(void**)&SDL_GetMouseFocus, "SDL_GetMouseFocus");
lib.bindSymbol(cast(void**)&SDL_GetMouseState, "SDL_GetMouseState");
lib.bindSymbol(cast(void**)&SDL_GetRelativeMouseState, "SDL_GetRelativeMouseState");
lib.bindSymbol(cast(void**)&SDL_WarpMouseInWindow, "SDL_WarpMouseInWindow");
lib.bindSymbol(cast(void**)&SDL_SetRelativeMouseMode, "SDL_SetRelativeMouseMode");
lib.bindSymbol(cast(void**)&SDL_GetRelativeMouseMode, "SDL_GetRelativeMouseMode");
lib.bindSymbol(cast(void**)&SDL_CreateCursor, "SDL_CreateCursor");
lib.bindSymbol(cast(void**)&SDL_CreateColorCursor, "SDL_CreateColorCursor");
lib.bindSymbol(cast(void**)&SDL_CreateSystemCursor, "SDL_CreateSystemCursor");
lib.bindSymbol(cast(void**)&SDL_SetCursor, "SDL_SetCursor");
lib.bindSymbol(cast(void**)&SDL_GetCursor, "SDL_GetCursor");
lib.bindSymbol(cast(void**)&SDL_GetDefaultCursor, "SDL_GetDefaultCursor");
lib.bindSymbol(cast(void**)&SDL_FreeCursor, "SDL_FreeCursor");
lib.bindSymbol(cast(void**)&SDL_ShowCursor, "SDL_ShowCursor");
lib.bindSymbol(cast(void**)&SDL_GetPixelFormatName, "SDL_GetPixelFormatName");
lib.bindSymbol(cast(void**)&SDL_PixelFormatEnumToMasks, "SDL_PixelFormatEnumToMasks");
lib.bindSymbol(cast(void**)&SDL_MasksToPixelFormatEnum, "SDL_MasksToPixelFormatEnum");
lib.bindSymbol(cast(void**)&SDL_AllocFormat, "SDL_AllocFormat");
lib.bindSymbol(cast(void**)&SDL_FreeFormat, "SDL_FreeFormat");
lib.bindSymbol(cast(void**)&SDL_AllocPalette, "SDL_AllocPalette");
lib.bindSymbol(cast(void**)&SDL_SetPixelFormatPalette, "SDL_SetPixelFormatPalette");
lib.bindSymbol(cast(void**)&SDL_SetPaletteColors, "SDL_SetPaletteColors");
lib.bindSymbol(cast(void**)&SDL_FreePalette, "SDL_FreePalette");
lib.bindSymbol(cast(void**)&SDL_MapRGB, "SDL_MapRGB");
lib.bindSymbol(cast(void**)&SDL_MapRGBA, "SDL_MapRGBA");
lib.bindSymbol(cast(void**)&SDL_GetRGB, "SDL_GetRGB");
lib.bindSymbol(cast(void**)&SDL_GetRGBA, "SDL_GetRGBA");
lib.bindSymbol(cast(void**)&SDL_CalculateGammaRamp, "SDL_CalculateGammaRamp");
lib.bindSymbol(cast(void**)&SDL_GetPlatform, "SDL_GetPlatform");
lib.bindSymbol(cast(void**)&SDL_GetPowerInfo, "SDL_GetPowerInfo");
lib.bindSymbol(cast(void**)&SDL_HasIntersection, "SDL_HasIntersection");
lib.bindSymbol(cast(void**)&SDL_IntersectRect, "SDL_IntersectRect");
lib.bindSymbol(cast(void**)&SDL_UnionRect, "SDL_UnionRect");
lib.bindSymbol(cast(void**)&SDL_EnclosePoints, "SDL_EnclosePoints");
lib.bindSymbol(cast(void**)&SDL_IntersectRectAndLine, "SDL_IntersectRectAndLine");
lib.bindSymbol(cast(void**)&SDL_GetNumRenderDrivers, "SDL_GetNumRenderDrivers");
lib.bindSymbol(cast(void**)&SDL_GetRenderDriverInfo, "SDL_GetRenderDriverInfo");
lib.bindSymbol(cast(void**)&SDL_CreateWindowAndRenderer, "SDL_CreateWindowAndRenderer");
lib.bindSymbol(cast(void**)&SDL_CreateRenderer, "SDL_CreateRenderer");
lib.bindSymbol(cast(void**)&SDL_CreateSoftwareRenderer, "SDL_CreateSoftwareRenderer");
lib.bindSymbol(cast(void**)&SDL_GetRenderer, "SDL_GetRenderer");
lib.bindSymbol(cast(void**)&SDL_GetRendererInfo, "SDL_GetRendererInfo");
lib.bindSymbol(cast(void**)&SDL_GetRendererOutputSize, "SDL_GetRendererOutputSize");
lib.bindSymbol(cast(void**)&SDL_CreateTexture, "SDL_CreateTexture");
lib.bindSymbol(cast(void**)&SDL_CreateTextureFromSurface, "SDL_CreateTextureFromSurface");
lib.bindSymbol(cast(void**)&SDL_QueryTexture, "SDL_QueryTexture");
lib.bindSymbol(cast(void**)&SDL_SetTextureColorMod, "SDL_SetTextureColorMod");
lib.bindSymbol(cast(void**)&SDL_GetTextureColorMod, "SDL_GetTextureColorMod");
lib.bindSymbol(cast(void**)&SDL_SetTextureAlphaMod, "SDL_SetTextureAlphaMod");
lib.bindSymbol(cast(void**)&SDL_GetTextureAlphaMod, "SDL_GetTextureAlphaMod");
lib.bindSymbol(cast(void**)&SDL_SetTextureBlendMode, "SDL_SetTextureBlendMode");
lib.bindSymbol(cast(void**)&SDL_GetTextureBlendMode, "SDL_GetTextureBlendMode");
lib.bindSymbol(cast(void**)&SDL_UpdateTexture, "SDL_UpdateTexture");
lib.bindSymbol(cast(void**)&SDL_LockTexture, "SDL_LockTexture");
lib.bindSymbol(cast(void**)&SDL_UnlockTexture, "SDL_UnlockTexture");
lib.bindSymbol(cast(void**)&SDL_RenderTargetSupported, "SDL_RenderTargetSupported");
lib.bindSymbol(cast(void**)&SDL_SetRenderTarget, "SDL_SetRenderTarget");
lib.bindSymbol(cast(void**)&SDL_GetRenderTarget, "SDL_GetRenderTarget");
lib.bindSymbol(cast(void**)&SDL_RenderSetClipRect, "SDL_RenderSetClipRect");
lib.bindSymbol(cast(void**)&SDL_RenderGetClipRect, "SDL_RenderGetClipRect");
lib.bindSymbol(cast(void**)&SDL_RenderSetLogicalSize, "SDL_RenderSetLogicalSize");
lib.bindSymbol(cast(void**)&SDL_RenderGetLogicalSize, "SDL_RenderGetLogicalSize");
lib.bindSymbol(cast(void**)&SDL_RenderSetViewport, "SDL_RenderSetViewport");
lib.bindSymbol(cast(void**)&SDL_RenderGetViewport, "SDL_RenderGetViewport");
lib.bindSymbol(cast(void**)&SDL_RenderSetScale, "SDL_RenderSetScale");
lib.bindSymbol(cast(void**)&SDL_RenderGetScale, "SDL_RenderGetScale");
lib.bindSymbol(cast(void**)&SDL_SetRenderDrawColor, "SDL_SetRenderDrawColor");
lib.bindSymbol(cast(void**)&SDL_GetRenderDrawColor, "SDL_GetRenderDrawColor");
lib.bindSymbol(cast(void**)&SDL_SetRenderDrawBlendMode, "SDL_SetRenderDrawBlendMode");
lib.bindSymbol(cast(void**)&SDL_GetRenderDrawBlendMode, "SDL_GetRenderDrawBlendMode");
lib.bindSymbol(cast(void**)&SDL_RenderClear, "SDL_RenderClear");
lib.bindSymbol(cast(void**)&SDL_RenderDrawPoint, "SDL_RenderDrawPoint");
lib.bindSymbol(cast(void**)&SDL_RenderDrawPoints, "SDL_RenderDrawPoints");
lib.bindSymbol(cast(void**)&SDL_RenderDrawLine, "SDL_RenderDrawLine");
lib.bindSymbol(cast(void**)&SDL_RenderDrawLines, "SDL_RenderDrawLines");
lib.bindSymbol(cast(void**)&SDL_RenderDrawRect, "SDL_RenderDrawRect");
lib.bindSymbol(cast(void**)&SDL_RenderDrawRects, "SDL_RenderDrawRects");
lib.bindSymbol(cast(void**)&SDL_RenderFillRect, "SDL_RenderFillRect");
lib.bindSymbol(cast(void**)&SDL_RenderFillRects, "SDL_RenderFillRects");
lib.bindSymbol(cast(void**)&SDL_RenderCopy, "SDL_RenderCopy");
lib.bindSymbol(cast(void**)&SDL_RenderCopyEx, "SDL_RenderCopyEx");
lib.bindSymbol(cast(void**)&SDL_RenderReadPixels, "SDL_RenderReadPixels");
lib.bindSymbol(cast(void**)&SDL_RenderPresent, "SDL_RenderPresent");
lib.bindSymbol(cast(void**)&SDL_DestroyTexture, "SDL_DestroyTexture");
lib.bindSymbol(cast(void**)&SDL_DestroyRenderer, "SDL_DestroyRenderer");
lib.bindSymbol(cast(void**)&SDL_GL_BindTexture, "SDL_GL_BindTexture");
lib.bindSymbol(cast(void**)&SDL_GL_UnbindTexture, "SDL_GL_UnbindTexture");
lib.bindSymbol(cast(void**)&SDL_RWFromFile, "SDL_RWFromFile");
lib.bindSymbol(cast(void**)&SDL_RWFromFP, "SDL_RWFromFP");
lib.bindSymbol(cast(void**)&SDL_RWFromMem, "SDL_RWFromMem");
lib.bindSymbol(cast(void**)&SDL_RWFromConstMem, "SDL_RWFromConstMem");
lib.bindSymbol(cast(void**)&SDL_AllocRW, "SDL_AllocRW");
lib.bindSymbol(cast(void**)&SDL_FreeRW, "SDL_FreeRW");
lib.bindSymbol(cast(void**)&SDL_ReadU8, "SDL_ReadU8");
lib.bindSymbol(cast(void**)&SDL_ReadLE16, "SDL_ReadLE16");
lib.bindSymbol(cast(void**)&SDL_ReadBE16, "SDL_ReadBE16");
lib.bindSymbol(cast(void**)&SDL_ReadLE32, "SDL_ReadLE32");
lib.bindSymbol(cast(void**)&SDL_ReadBE32, "SDL_ReadBE32");
lib.bindSymbol(cast(void**)&SDL_ReadLE64, "SDL_ReadLE64");
lib.bindSymbol(cast(void**)&SDL_ReadBE64, "SDL_ReadBE64");
lib.bindSymbol(cast(void**)&SDL_WriteU8, "SDL_WriteU8");
lib.bindSymbol(cast(void**)&SDL_WriteLE16, "SDL_WriteLE16");
lib.bindSymbol(cast(void**)&SDL_WriteBE16, "SDL_WriteBE16");
lib.bindSymbol(cast(void**)&SDL_WriteLE32, "SDL_WriteLE32");
lib.bindSymbol(cast(void**)&SDL_WriteBE32, "SDL_WriteBE32");
lib.bindSymbol(cast(void**)&SDL_WriteLE64, "SDL_WriteLE64");
lib.bindSymbol(cast(void**)&SDL_WriteBE64, "SDL_WriteBE64");
lib.bindSymbol(cast(void**)&SDL_CreateShapedWindow, "SDL_CreateShapedWindow");
lib.bindSymbol(cast(void**)&SDL_IsShapedWindow, "SDL_IsShapedWindow");
lib.bindSymbol(cast(void**)&SDL_SetWindowShape, "SDL_SetWindowShape");
lib.bindSymbol(cast(void**)&SDL_GetShapedWindowMode, "SDL_GetShapedWindowMode");
lib.bindSymbol(cast(void**)&SDL_free, "SDL_free");
lib.bindSymbol(cast(void**)&SDL_CreateRGBSurface, "SDL_CreateRGBSurface");
lib.bindSymbol(cast(void**)&SDL_CreateRGBSurfaceFrom, "SDL_CreateRGBSurfaceFrom");
lib.bindSymbol(cast(void**)&SDL_FreeSurface, "SDL_FreeSurface");
lib.bindSymbol(cast(void**)&SDL_SetSurfacePalette, "SDL_SetSurfacePalette");
lib.bindSymbol(cast(void**)&SDL_LockSurface, "SDL_LockSurface");
lib.bindSymbol(cast(void**)&SDL_UnlockSurface, "SDL_UnlockSurface");
lib.bindSymbol(cast(void**)&SDL_LoadBMP_RW, "SDL_LoadBMP_RW");
lib.bindSymbol(cast(void**)&SDL_SaveBMP_RW, "SDL_SaveBMP_RW");
lib.bindSymbol(cast(void**)&SDL_SetSurfaceRLE, "SDL_SetSurfaceRLE");
lib.bindSymbol(cast(void**)&SDL_SetColorKey, "SDL_SetColorKey");
lib.bindSymbol(cast(void**)&SDL_GetColorKey, "SDL_GetColorKey");
lib.bindSymbol(cast(void**)&SDL_SetSurfaceColorMod, "SDL_SetSurfaceColorMod");
lib.bindSymbol(cast(void**)&SDL_GetSurfaceColorMod, "SDL_GetSurfaceColorMod");
lib.bindSymbol(cast(void**)&SDL_SetSurfaceAlphaMod, "SDL_SetSurfaceAlphaMod");
lib.bindSymbol(cast(void**)&SDL_GetSurfaceAlphaMod, "SDL_GetSurfaceAlphaMod");
lib.bindSymbol(cast(void**)&SDL_SetSurfaceBlendMode, "SDL_SetSurfaceBlendMode");
lib.bindSymbol(cast(void**)&SDL_GetSurfaceBlendMode, "SDL_GetSurfaceBlendMode");
lib.bindSymbol(cast(void**)&SDL_SetClipRect, "SDL_SetClipRect");
lib.bindSymbol(cast(void**)&SDL_GetClipRect, "SDL_GetClipRect");
lib.bindSymbol(cast(void**)&SDL_ConvertSurface, "SDL_ConvertSurface");
lib.bindSymbol(cast(void**)&SDL_ConvertSurfaceFormat, "SDL_ConvertSurfaceFormat");
lib.bindSymbol(cast(void**)&SDL_ConvertPixels, "SDL_ConvertPixels");
lib.bindSymbol(cast(void**)&SDL_FillRect, "SDL_FillRect");
lib.bindSymbol(cast(void**)&SDL_FillRects, "SDL_FillRects");
lib.bindSymbol(cast(void**)&SDL_UpperBlit, "SDL_UpperBlit");
lib.bindSymbol(cast(void**)&SDL_LowerBlit, "SDL_LowerBlit");
lib.bindSymbol(cast(void**)&SDL_SoftStretch, "SDL_SoftStretch");
lib.bindSymbol(cast(void**)&SDL_UpperBlitScaled, "SDL_UpperBlitScaled");
lib.bindSymbol(cast(void**)&SDL_LowerBlitScaled, "SDL_LowerBlitScaled");
version(Android) {
lib.bindSymbol(cast(void**)&SDL_AndroidGetJNIEnv, "SDL_AndroidGetJNIEnv");
lib.bindSymbol(cast(void**)&SDL_AndroidGetActivity, "SDL_AndroidGetActivity");
lib.bindSymbol(cast(void**)&SDL_AndroidGetInternalStoragePath, "SDL_AndroidGetInternalStoragePath");
lib.bindSymbol(cast(void**)&SDL_AndroidGetInternalStorageState, "SDL_AndroidGetInternalStorageState");
lib.bindSymbol(cast(void**)&SDL_AndroidGetExternalStoragePath, "SDL_AndroidGetExternalStoragePath");
}
lib.bindSymbol(cast(void**)&SDL_GetWindowWMInfo, "SDL_GetWindowWMInfo");
lib.bindSymbol(cast(void**)&SDL_GetTicks, "SDL_GetTicks");
lib.bindSymbol(cast(void**)&SDL_GetPerformanceCounter, "SDL_GetPerformanceCounter");
lib.bindSymbol(cast(void**)&SDL_GetPerformanceFrequency, "SDL_GetPerformanceFrequency");
lib.bindSymbol(cast(void**)&SDL_Delay, "SDL_Delay");
lib.bindSymbol(cast(void**)&SDL_AddTimer, "SDL_AddTimer");
lib.bindSymbol(cast(void**)&SDL_RemoveTimer, "SDL_RemoveTimer");
lib.bindSymbol(cast(void**)&SDL_GetNumTouchDevices, "SDL_GetNumTouchDevices");
lib.bindSymbol(cast(void**)&SDL_GetTouchDevice, "SDL_GetTouchDevice");
lib.bindSymbol(cast(void**)&SDL_GetNumTouchFingers, "SDL_GetNumTouchFingers");
lib.bindSymbol(cast(void**)&SDL_GetTouchFinger, "SDL_GetTouchFinger");
lib.bindSymbol(cast(void**)&SDL_GetVersion, "SDL_GetVersion");
lib.bindSymbol(cast(void**)&SDL_GetRevision, "SDL_GetRevision");
lib.bindSymbol(cast(void**)&SDL_GetRevisionNumber, "SDL_GetRevisionNumber");
lib.bindSymbol(cast(void**)&SDL_GetNumVideoDrivers, "SDL_GetNumVideoDrivers");
lib.bindSymbol(cast(void**)&SDL_GetVideoDriver, "SDL_GetVideoDriver");
lib.bindSymbol(cast(void**)&SDL_VideoInit, "SDL_VideoInit");
lib.bindSymbol(cast(void**)&SDL_VideoQuit, "SDL_VideoQuit");
lib.bindSymbol(cast(void**)&SDL_GetCurrentVideoDriver, "SDL_GetCurrentVideoDriver");
lib.bindSymbol(cast(void**)&SDL_GetNumVideoDisplays, "SDL_GetNumVideoDisplays");
lib.bindSymbol(cast(void**)&SDL_GetDisplayName, "SDL_GetDisplayName");
lib.bindSymbol(cast(void**)&SDL_GetDisplayBounds, "SDL_GetDisplayBounds");
lib.bindSymbol(cast(void**)&SDL_GetNumDisplayModes, "SDL_GetNumDisplayModes");
lib.bindSymbol(cast(void**)&SDL_GetDisplayMode, "SDL_GetDisplayMode");
lib.bindSymbol(cast(void**)&SDL_GetDesktopDisplayMode, "SDL_GetDesktopDisplayMode");
lib.bindSymbol(cast(void**)&SDL_GetCurrentDisplayMode, "SDL_GetCurrentDisplayMode");
lib.bindSymbol(cast(void**)&SDL_GetClosestDisplayMode, "SDL_GetClosestDisplayMode");
lib.bindSymbol(cast(void**)&SDL_GetWindowDisplayIndex, "SDL_GetWindowDisplayIndex");
lib.bindSymbol(cast(void**)&SDL_SetWindowDisplayMode, "SDL_SetWindowDisplayMode");
lib.bindSymbol(cast(void**)&SDL_GetWindowDisplayMode, "SDL_GetWindowDisplayMode");
lib.bindSymbol(cast(void**)&SDL_GetWindowPixelFormat, "SDL_GetWindowPixelFormat");
lib.bindSymbol(cast(void**)&SDL_CreateWindow, "SDL_CreateWindow");
lib.bindSymbol(cast(void**)&SDL_CreateWindowFrom, "SDL_CreateWindowFrom");
lib.bindSymbol(cast(void**)&SDL_GetWindowID, "SDL_GetWindowID");
lib.bindSymbol(cast(void**)&SDL_GetWindowFromID, "SDL_GetWindowFromID");
lib.bindSymbol(cast(void**)&SDL_GetWindowFlags, "SDL_GetWindowFlags");
lib.bindSymbol(cast(void**)&SDL_SetWindowTitle, "SDL_SetWindowTitle");
lib.bindSymbol(cast(void**)&SDL_GetWindowTitle, "SDL_GetWindowTitle");
lib.bindSymbol(cast(void**)&SDL_SetWindowIcon, "SDL_SetWindowIcon");
lib.bindSymbol(cast(void**)&SDL_SetWindowData, "SDL_SetWindowData");
lib.bindSymbol(cast(void**)&SDL_GetWindowData, "SDL_GetWindowData");
lib.bindSymbol(cast(void**)&SDL_SetWindowPosition, "SDL_SetWindowPosition");
lib.bindSymbol(cast(void**)&SDL_GetWindowPosition, "SDL_GetWindowPosition");
lib.bindSymbol(cast(void**)&SDL_SetWindowSize, "SDL_SetWindowSize");
lib.bindSymbol(cast(void**)&SDL_GetWindowSize, "SDL_GetWindowSize");
lib.bindSymbol(cast(void**)&SDL_SetWindowMinimumSize, "SDL_SetWindowMinimumSize");
lib.bindSymbol(cast(void**)&SDL_GetWindowMinimumSize, "SDL_GetWindowMinimumSize");
lib.bindSymbol(cast(void**)&SDL_SetWindowMaximumSize, "SDL_SetWindowMaximumSize");
lib.bindSymbol(cast(void**)&SDL_GetWindowMaximumSize, "SDL_GetWindowMaximumSize");
lib.bindSymbol(cast(void**)&SDL_SetWindowBordered, "SDL_SetWindowBordered");
lib.bindSymbol(cast(void**)&SDL_ShowWindow, "SDL_ShowWindow");
lib.bindSymbol(cast(void**)&SDL_HideWindow, "SDL_HideWindow");
lib.bindSymbol(cast(void**)&SDL_RaiseWindow, "SDL_RaiseWindow");
lib.bindSymbol(cast(void**)&SDL_MaximizeWindow, "SDL_MaximizeWindow");
lib.bindSymbol(cast(void**)&SDL_MinimizeWindow, "SDL_MinimizeWindow");
lib.bindSymbol(cast(void**)&SDL_RestoreWindow, "SDL_RestoreWindow");
lib.bindSymbol(cast(void**)&SDL_SetWindowFullscreen, "SDL_SetWindowFullscreen");
lib.bindSymbol(cast(void**)&SDL_GetWindowSurface, "SDL_GetWindowSurface");
lib.bindSymbol(cast(void**)&SDL_UpdateWindowSurface, "SDL_UpdateWindowSurface");
lib.bindSymbol(cast(void**)&SDL_UpdateWindowSurfaceRects, "SDL_UpdateWindowSurfaceRects");
lib.bindSymbol(cast(void**)&SDL_SetWindowGrab, "SDL_SetWindowGrab");
lib.bindSymbol(cast(void**)&SDL_GetWindowGrab, "SDL_GetWindowGrab");
lib.bindSymbol(cast(void**)&SDL_SetWindowBrightness, "SDL_SetWindowBrightness");
lib.bindSymbol(cast(void**)&SDL_GetWindowBrightness, "SDL_GetWindowBrightness");
lib.bindSymbol(cast(void**)&SDL_SetWindowGammaRamp, "SDL_SetWindowGammaRamp");
lib.bindSymbol(cast(void**)&SDL_GetWindowGammaRamp, "SDL_GetWindowGammaRamp");
lib.bindSymbol(cast(void**)&SDL_DestroyWindow, "SDL_DestroyWindow");
lib.bindSymbol(cast(void**)&SDL_IsScreenSaverEnabled, "SDL_IsScreenSaverEnabled");
lib.bindSymbol(cast(void**)&SDL_EnableScreenSaver, "SDL_EnableScreenSaver");
lib.bindSymbol(cast(void**)&SDL_DisableScreenSaver, "SDL_DisableScreenSaver");
lib.bindSymbol(cast(void**)&SDL_GL_LoadLibrary, "SDL_GL_LoadLibrary");
lib.bindSymbol(cast(void**)&SDL_GL_GetProcAddress, "SDL_GL_GetProcAddress");
lib.bindSymbol(cast(void**)&SDL_GL_UnloadLibrary, "SDL_GL_UnloadLibrary");
lib.bindSymbol(cast(void**)&SDL_GL_ExtensionSupported, "SDL_GL_ExtensionSupported");
lib.bindSymbol(cast(void**)&SDL_GL_SetAttribute, "SDL_GL_SetAttribute");
lib.bindSymbol(cast(void**)&SDL_GL_GetAttribute, "SDL_GL_GetAttribute");
lib.bindSymbol(cast(void**)&SDL_GL_CreateContext, "SDL_GL_CreateContext");
lib.bindSymbol(cast(void**)&SDL_GL_MakeCurrent, "SDL_GL_MakeCurrent");
lib.bindSymbol(cast(void**)&SDL_GL_GetCurrentWindow, "SDL_GL_GetCurrentWindow");
lib.bindSymbol(cast(void**)&SDL_GL_GetCurrentContext, "SDL_GL_GetCurrentContext");
lib.bindSymbol(cast(void**)&SDL_GL_SetSwapInterval, "SDL_GL_SetSwapInterval");
lib.bindSymbol(cast(void**)&SDL_GL_GetSwapInterval, "SDL_GL_GetSwapInterval");
lib.bindSymbol(cast(void**)&SDL_GL_SwapWindow, "SDL_GL_SwapWindow");
lib.bindSymbol(cast(void**)&SDL_GL_DeleteContext, "SDL_GL_DeleteContext");
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl200;
static if(sdlSupport >= SDLSupport.sdl201) {
lib.bindSymbol(cast(void**)&SDL_GetSystemRAM, "SDL_GetSystemRAM");
lib.bindSymbol(cast(void**)&SDL_GetBasePath, "SDL_GetBasePath");
lib.bindSymbol(cast(void**)&SDL_GetPrefPath, "SDL_GetPrefPath");
lib.bindSymbol(cast(void**)&SDL_UpdateYUVTexture, "SDL_UpdateYUVTexture");
lib.bindSymbol(cast(void**)&SDL_GL_GetDrawableSize, "SDL_GL_GetDrawableSize");
version(Windows) {
lib.bindSymbol(cast(void**)&SDL_Direct3D9GetAdapterIndex, "SDL_Direct3D9GetAdapterIndex") ;
lib.bindSymbol(cast(void**)&SDL_RenderGetD3D9Device, "SDL_RenderGetD3D9Device");
}
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl201;
}
static if(sdlSupport >= SDLSupport.sdl202) {
lib.bindSymbol(cast(void**)&SDL_GetDefaultAssertionHandler, "SDL_GetDefaultAssertionHandler");
lib.bindSymbol(cast(void**)&SDL_GetAssertionHandler, "SDL_GetAssertionHandler");
lib.bindSymbol(cast(void**)&SDL_HasAVX, "SDL_HasAVX");
lib.bindSymbol(cast(void**)&SDL_GameControllerAddMappingsFromRW, "SDL_GameControllerAddMappingsFromRW");
lib.bindSymbol(cast(void**)&SDL_GL_ResetAttributes, "SDL_GL_ResetAttributes");
version(Windows) {
lib.bindSymbol(cast(void**)&SDL_DXGIGetOutputInfo, "SDL_DXGIGetOutputInfo");
}
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl202;
}
static if(sdlSupport >= SDLSupport.sdl203) {
loadedVersion = SDLSupport.sdl203;
}
static if(sdlSupport >= SDLSupport.sdl204) {
lib.bindSymbol(cast(void**)&SDL_ClearQueuedAudio, "SDL_ClearQueuedAudio");
lib.bindSymbol(cast(void**)&SDL_GetQueuedAudioSize, "SDL_GetQueuedAudioSize");
lib.bindSymbol(cast(void**)&SDL_QueueAudio, "SDL_QueueAudio");
lib.bindSymbol(cast(void**)&SDL_HasAVX2, "SDL_HasAVX2");
lib.bindSymbol(cast(void**)&SDL_GameControllerFromInstanceID, "SDL_GameControllerFromInstanceID");
lib.bindSymbol(cast(void**)&SDL_JoystickCurrentPowerLevel, "SDL_JoystickCurrentPowerLevel");
lib.bindSymbol(cast(void**)&SDL_JoystickFromInstanceID, "SDL_JoystickFromInstanceID");
lib.bindSymbol(cast(void**)&SDL_CaptureMouse, "SDL_CaptureMouse");
lib.bindSymbol(cast(void**)&SDL_GetGlobalMouseState, "SDL_GetGlobalMouseState");
lib.bindSymbol(cast(void**)&SDL_WarpMouseGlobal, "SDL_WarpMouseGlobal");
lib.bindSymbol(cast(void**)&SDL_RenderIsClipEnabled, "SDL_RenderIsClipEnabled");
lib.bindSymbol(cast(void**)&SDL_GetDisplayDPI, "SDL_GetDisplayDPI");
lib.bindSymbol(cast(void**)&SDL_GetGrabbedWindow, "SDL_GetGrabbedWindow");
lib.bindSymbol(cast(void**)&SDL_SetWindowHitTest, "SDL_SetWindowHitTest");
version(Windows) {
lib.bindSymbol(cast(void**)&SDL_SetWindowsMessageHook, "SDL_SetWindowsMessageHook");
}
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl204;
}
static if(sdlSupport >= SDLSupport.sdl205) {
lib.bindSymbol(cast(void**)&SDL_DequeueAudio, "SDL_DequeueAudio");
lib.bindSymbol(cast(void**)&SDL_GetHintBoolean, "SDL_GetHintBoolean");
lib.bindSymbol(cast(void**)&SDL_RenderGetIntegerScale, "SDL_RenderGetIntegerScale");
lib.bindSymbol(cast(void**)&SDL_RenderSetIntegerScale, "SDL_RenderSetIntegerScale");
lib.bindSymbol(cast(void**)&SDL_CreateRGBSurfaceWithFormat, "SDL_CreateRGBSurfaceWithFormat");
lib.bindSymbol(cast(void**)&SDL_CreateRGBSurfaceWithFormatFrom, "SDL_CreateRGBSurfaceWithFormatFrom");
lib.bindSymbol(cast(void**)&SDL_GetDisplayUsableBounds, "SDL_GetDisplayUsableBounds");
lib.bindSymbol(cast(void**)&SDL_GetWindowBordersSize, "SDL_GetWindowBordersSize");
lib.bindSymbol(cast(void**)&SDL_GetWindowOpacity, "SDL_GetWindowOpacity");
lib.bindSymbol(cast(void**)&SDL_SetWindowInputFocus, "SDL_SetWindowInputFocus");
lib.bindSymbol(cast(void**)&SDL_SetWindowModalFor, "SDL_SetWindowModalFor");
lib.bindSymbol(cast(void**)&SDL_SetWindowOpacity, "SDL_SetWindowOpacity");
lib.bindSymbol(cast(void**)&SDL_SetWindowResizable, "SDL_SetWindowResizable");
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl205;
}
static if(sdlSupport >= SDLSupport.sdl206) {
lib.bindSymbol(cast(void**)&SDL_ComposeCustomBlendMode, "SDL_ComposeCustomBlendMode");
lib.bindSymbol(cast(void**)&SDL_HasNEON, "SDL_HasNEON");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetVendor, "SDL_GameControllerGetVendor");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetProduct, "SDL_GameControllerGetProduct");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetProductVersion, "SDL_GameControllerGetProductVersion");
lib.bindSymbol(cast(void**)&SDL_GameControllerMappingForIndex, "SDL_GameControllerMappingForIndex");
lib.bindSymbol(cast(void**)&SDL_GameControllerNumMappings, "SDL_GameControllerNumMappings");
lib.bindSymbol(cast(void**)&SDL_JoystickGetAxisInitialState, "SDL_JoystickGetAxisInitialState");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceVendor, "SDL_JoystickGetDeviceVendor");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceProduct, "SDL_JoystickGetDeviceProduct");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceProductVersion, "SDL_JoystickGetDeviceProductVersion");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceInstanceID, "SDL_JoystickGetDeviceInstanceID");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceType, "SDL_JoystickGetDeviceType");
lib.bindSymbol(cast(void**)&SDL_JoystickGetProduct, "SDL_JoystickGetProduct");
lib.bindSymbol(cast(void**)&SDL_JoystickGetProductVersion, "SDL_JoystickGetProductVersion");
lib.bindSymbol(cast(void**)&SDL_JoystickGetType, "SDL_JoystickGetType");
lib.bindSymbol(cast(void**)&SDL_JoystickGetVendor, "SDL_JoystickGetVendor");
lib.bindSymbol(cast(void**)&SDL_LoadFile_RW, "SDL_LoadFile_RW");
lib.bindSymbol(cast(void**)&SDL_DuplicateSurface, "SDL_DuplicateSurface");
lib.bindSymbol(cast(void**)&SDL_Vulkan_CreateSurface, "SDL_Vulkan_CreateSurface");
lib.bindSymbol(cast(void**)&SDL_Vulkan_GetDrawableSize, "SDL_Vulkan_GetDrawableSize");
lib.bindSymbol(cast(void**)&SDL_Vulkan_GetInstanceExtensions, "SDL_Vulkan_GetInstanceExtensions");
lib.bindSymbol(cast(void**)&SDL_Vulkan_GetVkGetInstanceProcAddr, "SDL_Vulkan_GetVkGetInstanceProcAddr");
lib.bindSymbol(cast(void**)&SDL_Vulkan_LoadLibrary, "SDL_Vulkan_LoadLibrary");
lib.bindSymbol(cast(void**)&SDL_Vulkan_UnloadLibrary, "SDL_Vulkan_UnloadLibrary");
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl206;
}
static if(sdlSupport >= SDLSupport.sdl207) {
lib.bindSymbol(cast(void**)&SDL_NewAudioStream, "SDL_NewAudioStream");
lib.bindSymbol(cast(void**)&SDL_AudioStreamPut, "SDL_AudioStreamPut");
lib.bindSymbol(cast(void**)&SDL_AudioStreamGet, "SDL_AudioStreamGet");
lib.bindSymbol(cast(void**)&SDL_AudioStreamAvailable, "SDL_AudioStreamAvailable");
lib.bindSymbol(cast(void**)&SDL_AudioStreamFlush, "SDL_AudioStreamFlush");
lib.bindSymbol(cast(void**)&SDL_AudioStreamClear, "SDL_AudioStreamClear");
lib.bindSymbol(cast(void**)&SDL_FreeAudioStream, "SDL_FreeAudioStream");
lib.bindSymbol(cast(void**)&SDL_LockJoysticks, "SDL_LockJoysticks");
lib.bindSymbol(cast(void**)&SDL_UnlockJoysticks, "SDL_UnlockJoysticks");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceProduct, "SDL_JoystickGetDeviceProduct");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceProductVersion, "SDL_JoystickGetDeviceProductVersion");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceInstanceID, "SDL_JoystickGetDeviceInstanceID");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDeviceType, "SDL_JoystickGetDeviceType");
lib.bindSymbol(cast(void**)&SDL_JoystickGetProduct, "SDL_JoystickGetProduct");
lib.bindSymbol(cast(void**)&SDL_JoystickGetProductVersion, "SDL_JoystickGetProductVersion");
lib.bindSymbol(cast(void**)&SDL_JoystickGetType, "SDL_JoystickGetType");
lib.bindSymbol(cast(void**)&SDL_JoystickGetVendor, "SDL_JoystickGetVendor");
lib.bindSymbol(cast(void**)&SDL_LoadFile_RW, "SDL_LoadFile_RW");
lib.bindSymbol(cast(void**)&SDL_DuplicateSurface, "SDL_DuplicateSurface");
lib.bindSymbol(cast(void**)&SDL_Vulkan_CreateSurface, "SDL_Vulkan_CreateSurface");
lib.bindSymbol(cast(void**)&SDL_Vulkan_GetDrawableSize, "SDL_Vulkan_GetDrawableSize");
lib.bindSymbol(cast(void**)&SDL_Vulkan_GetInstanceExtensions, "SDL_Vulkan_GetInstanceExtensions");
lib.bindSymbol(cast(void**)&SDL_Vulkan_GetVkGetInstanceProcAddr, "SDL_Vulkan_GetVkGetInstanceProcAddr");
lib.bindSymbol(cast(void**)&SDL_Vulkan_LoadLibrary, "SDL_Vulkan_LoadLibrary");
lib.bindSymbol(cast(void**)&SDL_Vulkan_UnloadLibrary, "SDL_Vulkan_UnloadLibrary");
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl207;
}
static if(sdlSupport >= SDLSupport.sdl208) {
lib.bindSymbol(cast(void**)&SDL_RenderGetMetalLayer, "SDL_RenderGetMetalLayer");
lib.bindSymbol(cast(void**)&SDL_RenderGetMetalCommandEncoder, "SDL_RenderGetMetalCommandEncoder");
lib.bindSymbol(cast(void**)&SDL_SetYUVConversionMode, "SDL_SetYUVConversionMode");
lib.bindSymbol(cast(void**)&SDL_GetYUVConversionMode, "SDL_GetYUVConversionMode");
lib.bindSymbol(cast(void**)&SDL_GetYUVConversionModeForResolution, "SDL_GetYUVConversionModeForResolution");
version(Android) {
lib.bindSymbol(cast(void**)&SDL_IsAndroidTV, "SDL_IsAndroidTV");
}
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl208;
}
static if(sdlSupport >= SDLSupport.sdl209) {
lib.bindSymbol(cast(void**)&SDL_HasAVX512F, "SDL_HasAVX512F");
lib.bindSymbol(cast(void**)&SDL_GameControllerMappingForDeviceIndex, "SDL_GameControllerMappingForDeviceIndex");
lib.bindSymbol(cast(void**)&SDL_GameControllerRumble, "SDL_GameControllerRumble");
lib.bindSymbol(cast(void**)&SDL_JoystickRumble, "SDL_JoystickRumble");
lib.bindSymbol(cast(void**)&SDL_HasColorKey, "SDL_HasColorKey");
lib.bindSymbol(cast(void**)&SDL_GetDisplayOrientation, "SDL_GetDisplayOrientation");
version(Android) {
lib.bindSymbol(cast(void**)&SDL_IsChromebook, "SDL_IsChromebook");
lib.bindSymbol(cast(void**)&SDL_IsDeXMode, "SDL_IsDeXMode");
lib.bindSymbol(cast(void**)&SDL_AndroidBackButton, "SDL_AndroidBackButton");
}
else version(linux) {
lib.bindSymbol(cast(void**)&SDL_LinuxSetThreadPriority, "SDL_LinuxSetThreadPriority");
}
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl209;
}
static if(sdlSupport >= SDLSupport.sdl2010) {
lib.bindSymbol(cast(void**)&SDL_SIMDGetAlignment, "SDL_SIMDGetAlignment");
lib.bindSymbol(cast(void**)&SDL_SIMDAlloc, "SDL_SIMDAlloc");
lib.bindSymbol(cast(void**)&SDL_SIMDFree, "SDL_SIMDFree");
lib.bindSymbol(cast(void**)&SDL_GameControllerGetPlayerIndex, "SDL_GameControllerGetPlayerIndex");
lib.bindSymbol(cast(void**)&SDL_JoystickGetDevicePlayerIndex, "SDL_JoystickGetDevicePlayerIndex");
lib.bindSymbol(cast(void**)&SDL_JoystickGetPlayerIndex, "SDL_JoystickGetPlayerIndex");
lib.bindSymbol(cast(void**)&SDL_RenderDrawPointF, "SDL_RenderDrawPointF");
lib.bindSymbol(cast(void**)&SDL_RenderDrawPointsF, "SDL_RenderDrawPointsF");
lib.bindSymbol(cast(void**)&SDL_RenderDrawLineF, "SDL_RenderDrawLineF");
lib.bindSymbol(cast(void**)&SDL_RenderDrawLinesF, "SDL_RenderDrawLinesF");
lib.bindSymbol(cast(void**)&SDL_RenderDrawRectF, "SDL_RenderDrawRectF");
lib.bindSymbol(cast(void**)&SDL_RenderDrawRectsF, "SDL_RenderDrawRectsF");
lib.bindSymbol(cast(void**)&SDL_RenderFillRectF, "SDL_RenderFillRectF");
lib.bindSymbol(cast(void**)&SDL_RenderFillRectsF, "SDL_RenderFillRectsF");
lib.bindSymbol(cast(void**)&SDL_RenderCopyF, "SDL_RenderCopyF");
lib.bindSymbol(cast(void**)&SDL_RenderCopyExF, "SDL_RenderCopyExF");
lib.bindSymbol(cast(void**)&SDL_RenderFlush, "SDL_RenderFlush");lib.bindSymbol(cast(void**)&SDL_Vulkan_CreateSurface, "SDL_Vulkan_CreateSurface");
lib.bindSymbol(cast(void**)&SDL_RWsize, "SDL_RWsize");
lib.bindSymbol(cast(void**)&SDL_RWseek, "SDL_RWseek");
lib.bindSymbol(cast(void**)&SDL_RWtell, "SDL_RWtell");
lib.bindSymbol(cast(void**)&SDL_RWread, "SDL_RWread");
lib.bindSymbol(cast(void**)&SDL_RWwrite, "SDL_RWwrite");
lib.bindSymbol(cast(void**)&SDL_RWclose, "SDL_RWclose");
lib.bindSymbol(cast(void**)&SDL_GetTouchDeviceType, "SDL_GetTouchDeviceType");
if(errorCount() != errCount) return SDLSupport.badLibrary;
else loadedVersion = SDLSupport.sdl2010;
}
return loadedVersion;
}

View file

@ -0,0 +1,353 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.image;
version(BindSDL_Image):
import bindbc.sdl.bind.sdlerror : SDL_GetError, SDL_SetError;
import bindbc.sdl.bind.sdlrender : SDL_Renderer, SDL_Texture;
import bindbc.sdl.bind.sdlrwops : SDL_RWops;
import bindbc.sdl.bind.sdlsurface : SDL_Surface;
import bindbc.sdl.bind.sdlversion : SDL_version, SDL_VERSIONNUM;
alias IMG_SetError = SDL_SetError;
alias IMG_GetError = SDL_GetError;
enum SDLImageSupport {
noLibrary,
badLibrary,
sdlImage200 = 200,
sdlImage201,
sdlImage202,
}
enum ubyte SDL_IMAGE_MAJOR_VERSION = 2;
enum ubyte SDL_IMAGE_MINOR_VERSION = 0;
version(SDL_Image_202) {
enum sdlImageSupport = SDLImageSupport.sdlImage202;
enum ubyte SDL_IMAGE_PATCHLEVEL = 2;
}
else version(SDL_Image_201) {
enum sdlImageSupport = SDLImageSupport.sdlImage201;
enum ubyte SDL_IMAGE_PATCHLEVEL = 1;
}
else {
enum sdlImageSupport = SDLImageSupport.sdlImage200;
enum ubyte SDL_IMAGE_PATCHLEVEL = 0;
}
@nogc nothrow void SDL_IMAGE_VERSION(SDL_version* X)
{
X.major = SDL_IMAGE_MAJOR_VERSION;
X.minor = SDL_IMAGE_MINOR_VERSION;
X.patch = SDL_IMAGE_PATCHLEVEL;
}
// These were implemented in SDL_image 2.0.2, but are fine for all versions.
enum SDL_IMAGE_COMPILEDVERSION = SDL_VERSIONNUM!(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL);
enum SDL_IMAGE_VERSION_ATLEAST(ubyte X, ubyte Y, ubyte Z) = SDL_IMAGE_COMPILEDVERSION >= SDL_VERSIONNUM!(X, Y, Z);
enum {
IMG_INIT_JPG = 0x00000001,
IMG_INIT_PNG = 0x00000002,
IMG_INIT_TIF = 0x00000004,
IMG_INIT_WEBP = 0x00000008,
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
int IMG_Init(int);
int IMG_Quit();
const(SDL_version)* IMG_Linked_Version();
SDL_Surface* IMG_LoadTyped_RW(SDL_RWops*,int,const(char)*);
SDL_Surface* IMG_Load(const(char)*);
SDL_Surface* IMG_Load_RW(SDL_RWops*,int);
SDL_Texture* IMG_LoadTexture(SDL_Renderer*,const(char)*);
SDL_Texture* IMG_LoadTexture_RW(SDL_Renderer*,SDL_RWops*,int);
SDL_Texture* IMG_LoadTextureTyped_RW(SDL_Renderer*,SDL_RWops*,int,const(char)*);
int IMG_isICO(SDL_RWops*);
int IMG_isCUR(SDL_RWops*);
int IMG_isBMP(SDL_RWops*);
int IMG_isGIF(SDL_RWops*);
int IMG_isJPG(SDL_RWops*);
int IMG_isLBM(SDL_RWops*);
int IMG_isPCX(SDL_RWops*);
int IMG_isPNG(SDL_RWops*);
int IMG_isPNM(SDL_RWops*);
int IMG_isTIF(SDL_RWops*);
int IMG_isXCF(SDL_RWops*);
int IMG_isXPM(SDL_RWops*);
int IMG_isXV(SDL_RWops*);
int IMG_isWEBP(SDL_RWops*);
SDL_Surface* IMG_LoadICO_RW(SDL_RWops*);
SDL_Surface* IMG_LoadCUR_RW(SDL_RWops*);
SDL_Surface* IMG_LoadBMP_RW(SDL_RWops*);
SDL_Surface* IMG_LoadGIF_RW(SDL_RWops*);
SDL_Surface* IMG_LoadJPG_RW(SDL_RWops*);
SDL_Surface* IMG_LoadLBM_RW(SDL_RWops*);
SDL_Surface* IMG_LoadPCX_RW(SDL_RWops*);
SDL_Surface* IMG_LoadPNG_RW(SDL_RWops*);
SDL_Surface* IMG_LoadPNM_RW(SDL_RWops*);
SDL_Surface* IMG_LoadTGA_RW(SDL_RWops*);
SDL_Surface* IMG_LoadTIF_RW(SDL_RWops*);
SDL_Surface* IMG_LoadXCF_RW(SDL_RWops*);
SDL_Surface* IMG_LoadXPM_RW(SDL_RWops*);
SDL_Surface* IMG_LoadXV_RW(SDL_RWops*);
SDL_Surface* IMG_LoadWEBP_RW(SDL_RWops*);
SDL_Surface* IMG_ReadXPMFromArray(char**);
int IMG_SavePNG(SDL_Surface*,const(char)*);
int IMG_SavePNG_RW(SDL_Surface*,SDL_RWops*,int);
static if(sdlImageSupport >= SDLImageSupport.sdlImage202) {
int IMG_isSVG(SDL_RWops*);
SDL_Surface* IMG_LoadSVG(SDL_RWops*);
int IMG_SaveJPG(SDL_Surface*,const(char)*,int);
int IMG_SaveJPG_RW(SDL_Surface*,SDL_RWops*,int,int);
}
}
}
else {
import bindbc.loader;
extern(C) @nogc nothrow {
alias pIMG_Init = int function(int);
alias pIMG_Quit = int function();
alias pIMG_Linked_Version = const(SDL_version)* function();
alias pIMG_LoadTyped_RW = SDL_Surface* function(SDL_RWops*,int,const(char)*);
alias pIMG_Load = SDL_Surface* function(const(char)*);
alias pIMG_Load_RW = SDL_Surface* function(SDL_RWops*,int);
alias pIMG_LoadTexture = SDL_Texture* function(SDL_Renderer*,const(char)*);
alias pIMG_LoadTexture_RW = SDL_Texture* function(SDL_Renderer*,SDL_RWops*,int);
alias pIMG_LoadTextureTyped_RW = SDL_Texture* function(SDL_Renderer*,SDL_RWops*,int,const(char)*);
alias pIMG_isICO = int function(SDL_RWops*);
alias pIMG_isCUR = int function(SDL_RWops*);
alias pIMG_isBMP = int function(SDL_RWops*);
alias pIMG_isGIF = int function(SDL_RWops*);
alias pIMG_isJPG = int function(SDL_RWops*);
alias pIMG_isLBM = int function(SDL_RWops*);
alias pIMG_isPCX = int function(SDL_RWops*);
alias pIMG_isPNG = int function(SDL_RWops*);
alias pIMG_isPNM = int function(SDL_RWops*);
alias pIMG_isTIF = int function(SDL_RWops*);
alias pIMG_isXCF = int function(SDL_RWops*);
alias pIMG_isXPM = int function(SDL_RWops*);
alias pIMG_isXV = int function(SDL_RWops*);
alias pIMG_isWEBP = int function(SDL_RWops*);
alias pIMG_LoadICO_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadCUR_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadBMP_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadGIF_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadJPG_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadLBM_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadPCX_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadPNG_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadPNM_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadTGA_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadTIF_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadXCF_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadXPM_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadXV_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_LoadWEBP_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_ReadXPMFromArray = SDL_Surface* function(char**);
alias pIMG_SavePNG = int function(SDL_Surface*,const(char)*);
alias pIMG_SavePNG_RW = int function(SDL_Surface*,SDL_RWops*,int);
}
__gshared {
pIMG_Init IMG_Init;
pIMG_Quit IMG_Quit;
pIMG_Linked_Version IMG_Linked_Version;
pIMG_LoadTyped_RW IMG_LoadTyped_RW;
pIMG_Load IMG_Load;
pIMG_Load_RW IMG_Load_RW;
pIMG_LoadTexture IMG_LoadTexture;
pIMG_LoadTexture_RW IMG_LoadTexture_RW;
pIMG_LoadTextureTyped_RW IMG_LoadTextureTyped_RW;
pIMG_isICO IMG_isICO;
pIMG_isCUR IMG_isCUR;
pIMG_isBMP IMG_isBMP;
pIMG_isGIF IMG_isGIF;
pIMG_isJPG IMG_isJPG;
pIMG_isLBM IMG_isLBM;
pIMG_isPCX IMG_isPCX;
pIMG_isPNG IMG_isPNG;
pIMG_isPNM IMG_isPNM;
pIMG_isTIF IMG_isTIF;
pIMG_isXCF IMG_isXCF;
pIMG_isXPM IMG_isXPM;
pIMG_isXV IMG_isXV;
pIMG_isWEBP IMG_isWEBP;
pIMG_LoadICO_RW IMG_LoadICO_RW;
pIMG_LoadCUR_RW IMG_LoadCUR_RW;
pIMG_LoadBMP_RW IMG_LoadBMP_RW;
pIMG_LoadGIF_RW IMG_LoadGIF_RW;
pIMG_LoadJPG_RW IMG_LoadJPG_RW;
pIMG_LoadLBM_RW IMG_LoadLBM_RW;
pIMG_LoadPCX_RW IMG_LoadPCX_RW;
pIMG_LoadPNG_RW IMG_LoadPNG_RW;
pIMG_LoadPNM_RW IMG_LoadPNM_RW;
pIMG_LoadTGA_RW IMG_LoadTGA_RW;
pIMG_LoadTIF_RW IMG_LoadTIF_RW;
pIMG_LoadXCF_RW IMG_LoadXCF_RW;
pIMG_LoadXPM_RW IMG_LoadXPM_RW;
pIMG_LoadXV_RW IMG_LoadXV_RW;
pIMG_LoadWEBP_RW IMG_LoadWEBP_RW;
pIMG_ReadXPMFromArray IMG_ReadXPMFromArray;
pIMG_SavePNG IMG_SavePNG;
pIMG_SavePNG_RW IMG_SavePNG_RW;
}
static if(sdlImageSupport >= SDLImageSupport.sdlImage202) {
extern(C) @nogc nothrow {
alias pIMG_isSVG = int function(SDL_RWops*);
alias pIMG_LoadSVG_RW = SDL_Surface* function(SDL_RWops*);
alias pIMG_SaveJPG = int function(SDL_Surface*,const(char)*,int);
alias pIMG_SaveJPG_RW = int function(SDL_Surface*,SDL_RWops*,int,int);
}
__gshared {
pIMG_isSVG IMG_isSVG;
pIMG_LoadSVG_RW IMG_LoadSVG;
pIMG_SaveJPG IMG_SaveJPG;
pIMG_SaveJPG_RW IMG_SaveJPG_RW;
}
}
private {
__gshared SharedLib lib;
__gshared SDLImageSupport loadedVersion;
}
void unloadSDLImage()
{
if(lib != invalidHandle) {
lib.unload();
}
}
SDLImageSupport loadedSDLImageVersion() { return loadedVersion; }
bool isSDLImageLoaded()
{
return lib != invalidHandle;
}
SDLImageSupport loadSDLImage()
{
version(Windows) {
const(char)[][1] libNames = ["SDL2_image.dll"];
}
else version(OSX) {
const(char)[][6] libNames = [
"libSDL2_image.dylib",
"/usr/local/lib/libSDL2_image.dylib",
"../Frameworks/SDL2_image.framework/SDL2_image",
"/Library/Frameworks/SDL2_image.framework/SDL2_image",
"/System/Library/Frameworks/SDL2_image.framework/SDL2_image",
"/opt/local/lib/libSDL2_image.dylib"
];
}
else version(Posix) {
const(char)[][6] libNames = [
"libSDL2_image.so",
"/usr/local/lib/libSDL2_image.so",
"libSDL2_image-2.0.so",
"/usr/local/lib/libSDL2_image-2.0.so",
"libSDL2_image-2.0.so.0",
"/usr/local/lib/libSDL2_image-2.0.so.0"
];
}
else static assert(0, "bindbc-sdl is not yet supported on this platform.");
SDLImageSupport ret;
foreach(name; libNames) {
ret = loadSDLImage(name.ptr);
if(ret != SDLImageSupport.noLibrary) break;
}
return ret;
}
SDLImageSupport loadSDLImage(const(char)* libName)
{
lib = load(libName);
if(lib == invalidHandle) {
return SDLImageSupport.noLibrary;
}
auto errCount = errorCount();
loadedVersion = SDLImageSupport.badLibrary;
lib.bindSymbol(cast(void**)&IMG_Init,"IMG_Init");
lib.bindSymbol(cast(void**)&IMG_Quit,"IMG_Quit");
lib.bindSymbol(cast(void**)&IMG_Linked_Version,"IMG_Linked_Version");
lib.bindSymbol(cast(void**)&IMG_LoadTyped_RW,"IMG_LoadTyped_RW");
lib.bindSymbol(cast(void**)&IMG_Load,"IMG_Load");
lib.bindSymbol(cast(void**)&IMG_Load_RW,"IMG_Load_RW");
lib.bindSymbol(cast(void**)&IMG_LoadTexture,"IMG_LoadTexture");
lib.bindSymbol(cast(void**)&IMG_LoadTexture_RW,"IMG_LoadTexture_RW");
lib.bindSymbol(cast(void**)&IMG_LoadTextureTyped_RW,"IMG_LoadTextureTyped_RW");
lib.bindSymbol(cast(void**)&IMG_isICO,"IMG_isICO");
lib.bindSymbol(cast(void**)&IMG_isCUR,"IMG_isCUR");
lib.bindSymbol(cast(void**)&IMG_isBMP,"IMG_isBMP");
lib.bindSymbol(cast(void**)&IMG_isGIF,"IMG_isGIF");
lib.bindSymbol(cast(void**)&IMG_isJPG,"IMG_isJPG");
lib.bindSymbol(cast(void**)&IMG_isLBM,"IMG_isLBM");
lib.bindSymbol(cast(void**)&IMG_isPCX,"IMG_isPCX");
lib.bindSymbol(cast(void**)&IMG_isPNG,"IMG_isPNG");
lib.bindSymbol(cast(void**)&IMG_isPNM,"IMG_isPNM");
lib.bindSymbol(cast(void**)&IMG_isTIF,"IMG_isTIF");
lib.bindSymbol(cast(void**)&IMG_isXCF,"IMG_isXCF");
lib.bindSymbol(cast(void**)&IMG_isXPM,"IMG_isXPM");
lib.bindSymbol(cast(void**)&IMG_isXV,"IMG_isXV");
lib.bindSymbol(cast(void**)&IMG_isWEBP,"IMG_isWEBP");
lib.bindSymbol(cast(void**)&IMG_LoadICO_RW,"IMG_LoadICO_RW");
lib.bindSymbol(cast(void**)&IMG_LoadCUR_RW,"IMG_LoadCUR_RW");
lib.bindSymbol(cast(void**)&IMG_LoadBMP_RW,"IMG_LoadBMP_RW");
lib.bindSymbol(cast(void**)&IMG_LoadGIF_RW,"IMG_LoadGIF_RW");
lib.bindSymbol(cast(void**)&IMG_LoadJPG_RW,"IMG_LoadJPG_RW");
lib.bindSymbol(cast(void**)&IMG_LoadLBM_RW,"IMG_LoadLBM_RW");
lib.bindSymbol(cast(void**)&IMG_LoadPCX_RW,"IMG_LoadPCX_RW");
lib.bindSymbol(cast(void**)&IMG_LoadPNG_RW,"IMG_LoadPNG_RW");
lib.bindSymbol(cast(void**)&IMG_LoadPNM_RW,"IMG_LoadPNM_RW");
lib.bindSymbol(cast(void**)&IMG_LoadTGA_RW,"IMG_LoadTGA_RW");
lib.bindSymbol(cast(void**)&IMG_LoadTIF_RW,"IMG_LoadTIF_RW");
lib.bindSymbol(cast(void**)&IMG_LoadXCF_RW,"IMG_LoadXCF_RW");
lib.bindSymbol(cast(void**)&IMG_LoadXPM_RW,"IMG_LoadXPM_RW");
lib.bindSymbol(cast(void**)&IMG_LoadXV_RW,"IMG_LoadXV_RW");
lib.bindSymbol(cast(void**)&IMG_isXV,"IMG_isXV");
lib.bindSymbol(cast(void**)&IMG_LoadWEBP_RW,"IMG_LoadWEBP_RW");
lib.bindSymbol(cast(void**)&IMG_SavePNG,"IMG_SavePNG");
lib.bindSymbol(cast(void**)&IMG_SavePNG_RW,"IMG_SavePNG_RW");
if(errorCount() != errCount) return SDLImageSupport.badLibrary;
else loadedVersion = SDLImageSupport.sdlImage200;
static if(sdlImageSupport >= SDLImageSupport.sdlImage202) {
lib.bindSymbol(cast(void**)&IMG_isSVG,"IMG_isSVG");
lib.bindSymbol(cast(void**)&IMG_LoadSVG,"IMG_LoadSVG_RW");
lib.bindSymbol(cast(void**)&IMG_SaveJPG,"IMG_SaveJPG");
lib.bindSymbol(cast(void**)&IMG_SaveJPG_RW,"IMG_SaveJPG_RW");
if(errorCount() != errCount) return SDLImageSupport.badLibrary;
else loadedVersion = SDLImageSupport.sdlImage202;
}
return loadedVersion;
}
}

View file

@ -0,0 +1,569 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.mixer;
version(BindSDL_Mixer):
import bindbc.sdl.config;
import bindbc.sdl.bind.sdlaudio : AUDIO_S16LSB, SDL_MIX_MAXVOLUME;
import bindbc.sdl.bind.sdlerror : SDL_GetError, SDL_SetError, SDL_ClearError;
import bindbc.sdl.bind.sdlrwops : SDL_RWops, SDL_RWFromFile;
import bindbc.sdl.bind.sdlstdinc : SDL_bool;
import bindbc.sdl.bind.sdlversion : SDL_version, SDL_VERSIONNUM;
alias Mix_SetError = SDL_SetError;
alias Mix_GetError = SDL_GetError;
alias Mix_ClearError = SDL_ClearError;
enum SDLMixerSupport {
noLibrary,
badLibrary,
sdlMixer200 = 200,
sdlMixer201 = 201,
sdlMixer202 = 202,
}
enum ubyte SDL_MIXER_MAJOR_VERSION = 2;
enum ubyte SDL_MIXER_MINOR_VERSION = 0;
version(SDL_Mixer_202) {
enum sdlMixerSupport = SDLMixerSupport.sdlMixer202;
enum ubyte SDL_MIXER_PATCHLEVEL = 2;
}
else version(SDL_Mixer_201) {
enum sdlMixerSupport = SDLMixerSupport.sdlMixer201;
enum ubyte SDL_MIXER_PATCHLEVEL = 1;
}
else {
enum sdlMixerSupport = SDLMixerSupport.sdlMixer200;
enum ubyte SDL_MIXER_PATCHLEVEL = 0;
}
alias MIX_MAJOR_VERSION = SDL_MIXER_MAJOR_VERSION;
alias MIX_MINOR_VERSION = SDL_MIXER_MINOR_VERSION;
alias MIX_PATCH_LEVEL = SDL_MIXER_PATCHLEVEL;
@nogc nothrow void SDL_MIXER_VERSION(SDL_version* X)
{
X.major = SDL_MIXER_MAJOR_VERSION;
X.minor = SDL_MIXER_MINOR_VERSION;
X.patch = SDL_MIXER_PATCHLEVEL;
}
alias SDL_MIX_VERSION = SDL_MIX_MAXVOLUME;
// These were implemented in SDL_mixer 2.0.2, but are fine for all versions.
enum SDL_MIXER_COMPILEDVERSION = SDL_VERSIONNUM!(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL);
enum SDL_MIXER_VERSION_ATLEAST(ubyte X, ubyte Y, ubyte Z) = SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM!(X, Y, Z);
static if(sdlMixerSupport >= SDLMixerSupport.sdlMixer202) {
enum Mix_InitFlags {
MIX_INIT_FLAC = 0x00000001,
MIX_INIT_MOD = 0x00000002,
MIX_INIT_MP3 = 0x00000008,
MIX_INIT_OGG = 0x00000010,
MIX_INIT_MID = 0x00000020,
}
}
else {
enum Mix_InitFlags {
MIX_INIT_FLAC = 0x00000001,
MIX_INIT_MOD = 0x00000002,
MIX_INIT_MODPLUG = 0x00000004,
MIX_INIT_MP3 = 0x00000008,
MIX_INIT_OGG = 0x00000010,
MIX_INIT_FLUIDSYNTH = 0x00000020,
}
}
mixin(expandEnum!Mix_InitFlags);
enum {
MIX_CHANNELS = 8,
MIX_DEFAULT_FREQUENCY = 22050,
MIX_DEFAULT_CHANNELS = 2,
MIX_MAX_VOLUME = 128,
MIX_CHANNEL_POST = -2,
}
version(LittleEndian) {
enum MIX_DEFAULT_FORMAT = AUDIO_S16LSB;
} else {
enum MIX_DEFAULT_FORMAT = AUDIO_S16MSB;
}
struct Mix_Chunk {
int allocated;
ubyte* abuf;
uint alen;
ubyte volume;
}
enum Mix_Fading {
MIX_NO_FADING,
MIX_FADING_OUT,
MIX_FADING_IN
}
mixin(expandEnum!Mix_Fading);
static if(sdlMixerSupport >= SDLMixerSupport.sdlMixer202) {
enum Mix_MusicType {
MUS_NONE,
MUS_CMD,
MUS_WAV,
MUS_MOD,
MUS_MID,
MUS_OGG,
MUS_MP3,
MUS_MP3_MAD_UNUSED,
MUS_FLAC,
MUS_MODPLUG_UNUSED,
}
}
else {
enum Mix_MusicType {
MUS_NONE,
MUS_CMD,
MUS_WAV,
MUS_MOD,
MUS_MID,
MUS_OGG,
MUS_MP3,
MUS_MP3_MAD,
MUS_FLAC,
MUS_MODPLUG,
}
}
mixin(expandEnum!Mix_MusicType);
struct Mix_Music;
enum MIX_EFFECTSMAXSPEED = "MIX_EFFECTSMAXSPEED";
extern(C) nothrow {
alias Mix_EffectFunc_t = void function(int,void*,int,void*);
alias Mix_EffectDone_t = void function(int,void*);
// These aren't in SDL_mixer.h and are just here as a convenient and
// visible means to add the proper attributes these callbacks.
alias callbackI = void function(int);
alias callbackVUi8I = void function(void*,ubyte*,int);
alias callbackN = void function();
}
@nogc nothrow {
Mix_Chunk* Mix_LoadWAV(const(char)* file) {
pragma(inline, true);
return Mix_LoadWAV_RW(SDL_RWFromFile(file,"rb"),1);
}
int Mix_PlayChannel(int channel,Mix_Chunk* chunk,int loops) {
pragma(inline, true);
return Mix_PlayChannelTimed(channel,chunk,loops,-1);
}
int Mix_FadeInChannel(int channel,Mix_Chunk* chunk,int loops,int ms) {
pragma(inline, true);
return Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1);
}
}
version(BindSDL_Static) {
extern(C) @nogc nothrow {
const(SDL_version)* Mix_Linked_Version();
int Mix_Init(int);
void Mix_Quit();
int Mix_OpenAudio(int,ushort,int,int);
int Mix_AllocateChannels(int);
int Mix_QuerySpec(int*,ushort*,int*);
Mix_Chunk* Mix_LoadWAV_RW(SDL_RWops*,int);
Mix_Music* Mix_LoadMUS(const(char)*);
Mix_Music* Mix_LoadMUS_RW(SDL_RWops*,int);
Mix_Music* Mix_LoadMUSType_RW(SDL_RWops*,Mix_MusicType,int);
Mix_Chunk* Mix_QuickLoad_WAV(ubyte*);
Mix_Chunk* Mix_QuickLoad_RAW(ubyte*,uint);
void Mix_FreeChunk(Mix_Chunk*);
void Mix_FreeMusic(Mix_Music*);
int Mix_GetNumChunkDecoders();
const(char)* Mix_GetChunkDecoder(int);
int Mix_GetNumMusicDecoders();
const(char)* Mix_GetMusicDecoder(int);
Mix_MusicType Mix_GetMusicType(const(Mix_Music)*);
void Mix_SetPostMix(callbackVUi8I,void*);
void Mix_HookMusic(callbackVUi8I,void*);
void Mix_HookMusicFinished(callbackN);
void* Mix_GetMusicHookData();
void Mix_ChannelFinished(callbackI);
int Mix_RegisterEffect(int,Mix_EffectFunc_t,Mix_EffectDone_t,void*);
int Mix_UnregisterEffect(int,Mix_EffectFunc_t);
int Mix_UnregisterAllEffects(int);
int Mix_SetPanning(int,ubyte,ubyte);
int Mix_SetPosition(int,short,ubyte);
int Mix_SetDistance(int,ubyte);
int Mix_SetReverseStereo(int,int);
int Mix_ReserveChannels(int);
int Mix_GroupChannel(int,int);
int Mix_GroupChannels(int,int,int);
int Mix_GroupAvailable(int);
int Mix_GroupCount(int);
int Mix_GroupOldest(int);
int Mix_GroupNewer(int);
int Mix_PlayChannelTimed(int,Mix_Chunk*,int,int);
int Mix_PlayMusic(Mix_Music*,int);
int Mix_FadeInMusic(Mix_Music*,int,int);
int Mix_FadeInMusicPos(Mix_Music*,int,int,double);
int Mix_FadeInChannelTimed(int,Mix_Chunk*,int,int,int);
int Mix_Volume(int,int);
int Mix_VolumeChunk(Mix_Chunk*,int);
int Mix_VolumeMusic(int);
int Mix_HaltChannel(int);
int Mix_HaltGroup(int);
int Mix_HaltMusic();
int Mix_ExpireChannel(int,int);
int Mix_FadeOutChannel(int,int);
int Mix_FadeOutGroup(int,int);
int Mix_FadeOutMusic(int);
Mix_Fading Mix_FadingMusic();
Mix_Fading Mix_FadingChannel(int);
void Mix_Pause(int);
void Mix_Resume(int);
int Mix_Paused(int);
void Mix_PauseMusic();
void Mix_ResumeMusic();
void Mix_RewindMusic();
int Mix_PausedMusic();
int Mix_SetMusicPosition(double);
int Mix_Playing(int);
int Mix_PlayingMusic();
int Mix_SetMusicCMD(in char*);
int Mix_SetSynchroValue(int);
int Mix_GetSynchroValue();
Mix_Chunk* Mix_GetChunk(int);
void Mix_CloseAudio();
static if(sdlMixerSupport >= SDLMixerSupport.sdlMixer202) {
int Mix_OpenAudioDevice(int,ushort,int,int,const(char)*,int);
SDL_bool Mix_HasChunkDecoder(const(char)*);
// Declared in SDL_mixer.h, but not implemented
// SDL_bool Mix_HasMusicDecoder(const(char)*);
}
}
}
else {
import bindbc.loader;
extern(C) @nogc nothrow {
alias pMix_Linked_Version = const(SDL_version)* function();
alias pMix_Init = int function(int);
alias pMix_Quit = void function();
alias pMix_OpenAudio = int function(int,ushort,int,int);
alias pMix_AllocateChannels = int function(int);
alias pMix_QuerySpec = int function(int*,ushort*,int*);
alias pMix_LoadWAV_RW = Mix_Chunk* function(SDL_RWops*,int);
alias pMix_LoadMUS = Mix_Music* function(const(char)*);
alias pMix_LoadMUS_RW = Mix_Music* function(SDL_RWops*,int);
alias pMix_LoadMUSType_RW = Mix_Music* function(SDL_RWops*,Mix_MusicType,int);
alias pMix_QuickLoad_WAV = Mix_Chunk* function(ubyte*);
alias pMix_QuickLoad_RAW = Mix_Chunk* function(ubyte*,uint);
alias pMix_FreeChunk = void function(Mix_Chunk*);
alias pMix_FreeMusic = void function(Mix_Music*);
alias pMix_GetNumChunkDecoders = int function();
alias pMix_GetChunkDecoder = const(char)* function(int);
alias pMix_GetNumMusicDecoders = int function();
alias pMix_GetMusicDecoder = const(char)* function(int);
alias pMix_GetMusicType = Mix_MusicType function(const(Mix_Music)*);
alias pMix_SetPostMix = void function(callbackVUi8I,void*);
alias pMix_HookMusic = void function(callbackVUi8I,void*);
alias pMix_HookMusicFinished = void function(callbackN);
alias pMix_GetMusicHookData = void* function();
alias pMix_ChannelFinished = void function(callbackI);
alias pMix_RegisterEffect = int function(int,Mix_EffectFunc_t,Mix_EffectDone_t,void*);
alias pMix_UnregisterEffect = int function(int,Mix_EffectFunc_t);
alias pMix_UnregisterAllEffects = int function(int);
alias pMix_SetPanning = int function(int,ubyte,ubyte);
alias pMix_SetPosition = int function(int,short,ubyte);
alias pMix_SetDistance = int function(int,ubyte);
alias pMix_SetReverseStereo = int function(int,int);
alias pMix_ReserveChannels = int function(int);
alias pMix_GroupChannel = int function(int,int);
alias pMix_GroupChannels = int function(int,int,int);
alias pMix_GroupAvailable = int function(int);
alias pMix_GroupCount = int function(int);
alias pMix_GroupOldest = int function(int);
alias pMix_GroupNewer = int function(int);
alias pMix_PlayChannelTimed = int function(int,Mix_Chunk*,int,int);
alias pMix_PlayMusic = int function(Mix_Music*,int);
alias pMix_FadeInMusic = int function(Mix_Music*,int,int);
alias pMix_FadeInMusicPos = int function(Mix_Music*,int,int,double);
alias pMix_FadeInChannelTimed = int function(int,Mix_Chunk*,int,int,int);
alias pMix_Volume = int function(int,int);
alias pMix_VolumeChunk = int function(Mix_Chunk*,int);
alias pMix_VolumeMusic = int function(int);
alias pMix_HaltChannel = int function(int);
alias pMix_HaltGroup = int function(int);
alias pMix_HaltMusic = int function();
alias pMix_ExpireChannel = int function(int,int);
alias pMix_FadeOutChannel = int function(int,int);
alias pMix_FadeOutGroup = int function(int,int);
alias pMix_FadeOutMusic = int function(int);
alias pMix_FadingMusic = Mix_Fading function();
alias pMix_FadingChannel = Mix_Fading function(int);
alias pMix_Pause = void function(int);
alias pMix_Resume = void function(int);
alias pMix_Paused = int function(int);
alias pMix_PauseMusic = void function();
alias pMix_ResumeMusic = void function();
alias pMix_RewindMusic = void function();
alias pMix_PausedMusic = int function();
alias pMix_SetMusicPosition = int function(double);
alias pMix_Playing = int function(int);
alias pMix_PlayingMusic = int function();
alias pMix_SetMusicCMD = int function(in char*);
alias pMix_SetSynchroValue = int function(int);
alias pMix_GetSynchroValue = int function();
alias pMix_GetChunk = Mix_Chunk* function(int);
alias pMix_CloseAudio = void function();
}
__gshared {
pMix_Linked_Version Mix_Linked_Version;
pMix_Init Mix_Init;
pMix_Quit Mix_Quit;
pMix_OpenAudio Mix_OpenAudio;
pMix_AllocateChannels Mix_AllocateChannels;
pMix_QuerySpec Mix_QuerySpec;
pMix_LoadWAV_RW Mix_LoadWAV_RW;
pMix_LoadMUS Mix_LoadMUS;
pMix_LoadMUS_RW Mix_LoadMUS_RW;
pMix_LoadMUSType_RW Mix_LoadMUSType_RW;
pMix_QuickLoad_WAV Mix_QuickLoad_WAV;
pMix_QuickLoad_RAW Mix_QuickLoad_RAW;
pMix_FreeChunk Mix_FreeChunk;
pMix_FreeMusic Mix_FreeMusic;
pMix_GetNumChunkDecoders Mix_GetNumChunkDecoders;
pMix_GetChunkDecoder Mix_GetChunkDecoder;
pMix_GetNumMusicDecoders Mix_GetNumMusicDecoders;
pMix_GetMusicDecoder Mix_GetMusicDecoder;
pMix_GetMusicType Mix_GetMusicType;
pMix_SetPostMix Mix_SetPostMix;
pMix_HookMusic Mix_HookMusic;
pMix_HookMusicFinished Mix_HookMusicFinished;
pMix_GetMusicHookData Mix_GetMusicHookData;
pMix_ChannelFinished Mix_ChannelFinished;
pMix_RegisterEffect Mix_RegisterEffect;
pMix_UnregisterEffect Mix_UnregisterEffect;
pMix_UnregisterAllEffects Mix_UnregisterAllEffects;
pMix_SetPanning Mix_SetPanning;
pMix_SetPosition Mix_SetPosition;
pMix_SetDistance Mix_SetDistance;
pMix_SetReverseStereo Mix_SetReverseStereo;
pMix_ReserveChannels Mix_ReserveChannels;
pMix_GroupChannel Mix_GroupChannel;
pMix_GroupChannels Mix_GroupChannels;
pMix_GroupAvailable Mix_GroupAvailable;
pMix_GroupCount Mix_GroupCount;
pMix_GroupOldest Mix_GroupOldest;
pMix_GroupNewer Mix_GroupNewer;
pMix_PlayChannelTimed Mix_PlayChannelTimed;
pMix_PlayMusic Mix_PlayMusic;
pMix_FadeInMusic Mix_FadeInMusic;
pMix_FadeInMusicPos Mix_FadeInMusicPos;
pMix_FadeInChannelTimed Mix_FadeInChannelTimed;
pMix_Volume Mix_Volume;
pMix_VolumeChunk Mix_VolumeChunk;
pMix_VolumeMusic Mix_VolumeMusic;
pMix_HaltChannel Mix_HaltChannel;
pMix_HaltGroup Mix_HaltGroup;
pMix_HaltMusic Mix_HaltMusic;
pMix_ExpireChannel Mix_ExpireChannel;
pMix_FadeOutChannel Mix_FadeOutChannel;
pMix_FadeOutGroup Mix_FadeOutGroup;
pMix_FadeOutMusic Mix_FadeOutMusic;
pMix_FadingMusic Mix_FadingMusic;
pMix_FadingChannel Mix_FadingChannel;
pMix_Pause Mix_Pause;
pMix_Resume Mix_Resume;
pMix_Paused Mix_Paused;
pMix_PauseMusic Mix_PauseMusic;
pMix_ResumeMusic Mix_ResumeMusic;
pMix_RewindMusic Mix_RewindMusic;
pMix_PausedMusic Mix_PausedMusic;
pMix_SetMusicPosition Mix_SetMusicPosition;
pMix_Playing Mix_Playing;
pMix_PlayingMusic Mix_PlayingMusic;
pMix_SetMusicCMD Mix_SetMusicCMD;
pMix_SetSynchroValue Mix_SetSynchroValue;
pMix_GetSynchroValue Mix_GetSynchroValue;
pMix_GetChunk Mix_GetChunk;
pMix_CloseAudio Mix_CloseAudio;
}
static if(sdlMixerSupport >= SDLMixerSupport.sdlMixer202) {
extern(C) @nogc nothrow {
alias pMix_OpenAudioDevice = int function(int,ushort,int,int,const(char)*,int);
alias pMix_HasChunkDecoder = SDL_bool function(const(char)*);
// Declared in SDL_mixer.h, but not implemented
//alias pMix_HasMusicDecoder = SDL_bool function(const(char)*);
}
__gshared {
pMix_OpenAudioDevice Mix_OpenAudioDevice;
pMix_HasChunkDecoder Mix_HasChunkDecoder;
//pMix_HasMusicDecoder Mix_HasMusicDecoder;
}
}
private {
SharedLib lib;
SDLMixerSupport loadedVersion;
}
void unloadSDLMixer()
{
if(lib != invalidHandle) {
lib.unload();
}
}
SDLMixerSupport loadedSDLMixerVersion() { return loadedVersion; }
bool isSDLMixerLoaded()
{
return lib != invalidHandle;
}
SDLMixerSupport loadSDLMixer()
{
version(Windows) {
const(char)[][1] libNames = ["SDL2_mixer.dll"];
}
else version(OSX) {
const(char)[][6] libNames = [
"libSDL2_mixer.dylib",
"/usr/local/lib/libSDL2_mixer.dylib",
"../Frameworks/SDL2_mixer.framework/SDL2_mixer",
"/Library/Frameworks/SDL2_mixer.framework/SDL2_mixer",
"/System/Library/Frameworks/SDL2_mixer.framework/SDL2_mixer",
"/opt/local/lib/libSDL2_mixer.dylib"
];
}
else version(Posix) {
const(char)[][6] libNames = [
"libSDL2_mixer.so",
"/usr/local/lib/libSDL2_mixer.so",
"libSDL2-2.0_mixer.so",
"/usr/local/lib/libSDL2-2.0_mixer.so",
"libSDL2-2.0_mixer.so.0",
"/usr/local/lib/libSDL2-2.0_mixer.so.0"
];
}
else static assert(0, "bindbc-sdl is not yet supported on this platform.");
SDLMixerSupport ret;
foreach(name; libNames) {
ret = loadSDLMixer(name.ptr);
if(ret != SDLMixerSupport.noLibrary) break;
}
return ret;
}
SDLMixerSupport loadSDLMixer(const(char)* libName)
{
lib = load(libName);
if(lib == invalidHandle) {
return SDLMixerSupport.noLibrary;
}
auto errCount = errorCount();
loadedVersion = SDLMixerSupport.badLibrary;
lib.bindSymbol(cast(void**)&Mix_Linked_Version,"Mix_Linked_Version");
lib.bindSymbol(cast(void**)&Mix_Init,"Mix_Init");
lib.bindSymbol(cast(void**)&Mix_Quit,"Mix_Quit");
lib.bindSymbol(cast(void**)&Mix_OpenAudio,"Mix_OpenAudio");
lib.bindSymbol(cast(void**)&Mix_AllocateChannels,"Mix_AllocateChannels");
lib.bindSymbol(cast(void**)&Mix_QuerySpec,"Mix_QuerySpec");
lib.bindSymbol(cast(void**)&Mix_LoadWAV_RW,"Mix_LoadWAV_RW");
lib.bindSymbol(cast(void**)&Mix_LoadMUS,"Mix_LoadMUS");
lib.bindSymbol(cast(void**)&Mix_LoadMUS_RW,"Mix_LoadMUS_RW");
lib.bindSymbol(cast(void**)&Mix_LoadMUSType_RW,"Mix_LoadMUSType_RW");
lib.bindSymbol(cast(void**)&Mix_QuickLoad_WAV,"Mix_QuickLoad_WAV");
lib.bindSymbol(cast(void**)&Mix_QuickLoad_RAW,"Mix_QuickLoad_RAW");
lib.bindSymbol(cast(void**)&Mix_FreeChunk,"Mix_FreeChunk");
lib.bindSymbol(cast(void**)&Mix_FreeMusic,"Mix_FreeMusic");
lib.bindSymbol(cast(void**)&Mix_GetNumChunkDecoders,"Mix_GetNumChunkDecoders");
lib.bindSymbol(cast(void**)&Mix_GetChunkDecoder,"Mix_GetChunkDecoder");
lib.bindSymbol(cast(void**)&Mix_GetNumMusicDecoders,"Mix_GetNumMusicDecoders");
lib.bindSymbol(cast(void**)&Mix_GetMusicDecoder,"Mix_GetMusicDecoder");
lib.bindSymbol(cast(void**)&Mix_GetMusicType,"Mix_GetMusicType");
lib.bindSymbol(cast(void**)&Mix_SetPostMix,"Mix_SetPostMix");
lib.bindSymbol(cast(void**)&Mix_HookMusic,"Mix_HookMusic");
lib.bindSymbol(cast(void**)&Mix_HookMusicFinished,"Mix_HookMusicFinished");
lib.bindSymbol(cast(void**)&Mix_GetMusicHookData,"Mix_GetMusicHookData");
lib.bindSymbol(cast(void**)&Mix_ChannelFinished,"Mix_ChannelFinished");
lib.bindSymbol(cast(void**)&Mix_RegisterEffect,"Mix_RegisterEffect");
lib.bindSymbol(cast(void**)&Mix_UnregisterEffect,"Mix_UnregisterEffect");
lib.bindSymbol(cast(void**)&Mix_UnregisterAllEffects,"Mix_UnregisterAllEffects");
lib.bindSymbol(cast(void**)&Mix_SetPanning,"Mix_SetPanning");
lib.bindSymbol(cast(void**)&Mix_SetPosition,"Mix_SetPosition");
lib.bindSymbol(cast(void**)&Mix_SetDistance,"Mix_SetDistance");
lib.bindSymbol(cast(void**)&Mix_SetReverseStereo,"Mix_SetReverseStereo");
lib.bindSymbol(cast(void**)&Mix_ReserveChannels,"Mix_ReserveChannels");
lib.bindSymbol(cast(void**)&Mix_GroupChannel,"Mix_GroupChannel");
lib.bindSymbol(cast(void**)&Mix_GroupChannels,"Mix_GroupChannels");
lib.bindSymbol(cast(void**)&Mix_GroupAvailable,"Mix_GroupAvailable");
lib.bindSymbol(cast(void**)&Mix_GroupCount,"Mix_GroupCount");
lib.bindSymbol(cast(void**)&Mix_GroupOldest,"Mix_GroupOldest");
lib.bindSymbol(cast(void**)&Mix_GroupNewer,"Mix_GroupNewer");
lib.bindSymbol(cast(void**)&Mix_PlayChannelTimed,"Mix_PlayChannelTimed");
lib.bindSymbol(cast(void**)&Mix_PlayMusic,"Mix_PlayMusic");
lib.bindSymbol(cast(void**)&Mix_FadeInMusic,"Mix_FadeInMusic");
lib.bindSymbol(cast(void**)&Mix_FadeInMusicPos,"Mix_FadeInMusicPos");
lib.bindSymbol(cast(void**)&Mix_FadeInChannelTimed,"Mix_FadeInChannelTimed");
lib.bindSymbol(cast(void**)&Mix_Volume,"Mix_Volume");
lib.bindSymbol(cast(void**)&Mix_VolumeChunk,"Mix_VolumeChunk");
lib.bindSymbol(cast(void**)&Mix_VolumeMusic,"Mix_VolumeMusic");
lib.bindSymbol(cast(void**)&Mix_HaltChannel,"Mix_HaltChannel");
lib.bindSymbol(cast(void**)&Mix_HaltGroup,"Mix_HaltGroup");
lib.bindSymbol(cast(void**)&Mix_HaltMusic,"Mix_HaltMusic");
lib.bindSymbol(cast(void**)&Mix_ExpireChannel,"Mix_ExpireChannel");
lib.bindSymbol(cast(void**)&Mix_FadeOutChannel,"Mix_FadeOutChannel");
lib.bindSymbol(cast(void**)&Mix_FadeOutGroup,"Mix_FadeOutGroup");
lib.bindSymbol(cast(void**)&Mix_FadeOutMusic,"Mix_FadeOutMusic");
lib.bindSymbol(cast(void**)&Mix_FadingMusic,"Mix_FadingMusic");
lib.bindSymbol(cast(void**)&Mix_FadingChannel,"Mix_FadingChannel");
lib.bindSymbol(cast(void**)&Mix_Pause,"Mix_Pause");
lib.bindSymbol(cast(void**)&Mix_Resume,"Mix_Resume");
lib.bindSymbol(cast(void**)&Mix_Paused,"Mix_Paused");
lib.bindSymbol(cast(void**)&Mix_PauseMusic,"Mix_PauseMusic");
lib.bindSymbol(cast(void**)&Mix_ResumeMusic,"Mix_ResumeMusic");
lib.bindSymbol(cast(void**)&Mix_RewindMusic,"Mix_RewindMusic");
lib.bindSymbol(cast(void**)&Mix_PausedMusic,"Mix_PausedMusic");
lib.bindSymbol(cast(void**)&Mix_SetMusicPosition,"Mix_SetMusicPosition");
lib.bindSymbol(cast(void**)&Mix_Playing,"Mix_Playing");
lib.bindSymbol(cast(void**)&Mix_PlayingMusic,"Mix_PlayingMusic");
lib.bindSymbol(cast(void**)&Mix_SetMusicCMD,"Mix_SetMusicCMD");
lib.bindSymbol(cast(void**)&Mix_SetSynchroValue,"Mix_SetSynchroValue");
lib.bindSymbol(cast(void**)&Mix_GetSynchroValue,"Mix_GetSynchroValue");
lib.bindSymbol(cast(void**)&Mix_GetChunk,"Mix_GetChunk");
lib.bindSymbol(cast(void**)&Mix_CloseAudio,"Mix_CloseAudio");
if(errorCount() != errCount) return SDLMixerSupport.badLibrary;
else loadedVersion = SDLMixerSupport.sdlMixer200;
static if(sdlMixerSupport >= SDLMixerSupport.sdlMixer202) {
lib.bindSymbol(cast(void**)&Mix_OpenAudioDevice,"Mix_OpenAudioDevice");
lib.bindSymbol(cast(void**)&Mix_HasChunkDecoder,"Mix_HasChunkDecoder");
if(errorCount() != errCount) return SDLMixerSupport.badLibrary;
else loadedVersion = SDLMixerSupport.sdlMixer202;
}
return loadedVersion;
}
}

View file

@ -0,0 +1,18 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl;
public import bindbc.sdl.config,
bindbc.sdl.bind;
version(BindSDL_Static) {}
else public import bindbc.sdl.dynload;
version(BindSDL_Image) public import bindbc.sdl.image;
version(BindSDL_Mixer) public import bindbc.sdl.mixer;
version(BindSDL_TTF) public import bindbc.sdl.ttf;

View file

@ -0,0 +1,368 @@
// Copyright Michael D. Parker 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module bindbc.sdl.ttf;
version(BindSDL_TTF):
import core.stdc.config;
import bindbc.sdl.bind.sdlerror : SDL_GetError, SDL_SetError;
import bindbc.sdl.bind.sdlpixels : SDL_Color;
import bindbc.sdl.bind.sdlrwops : SDL_RWops;
import bindbc.sdl.bind.sdlsurface : SDL_Surface;
import bindbc.sdl.bind.sdlversion : SDL_version;
alias TTF_SetError = SDL_SetError;
alias TTF_GetError = SDL_GetError;
enum SDLTTFSupport {
noLibrary,
badLibrary,
sdlTTF2012 = 2012,
sdlTTF2013 = 2013,
sdlTTF2014 = 2014,
}
enum ubyte SDL_TTF_MAJOR_VERSION = 2;
enum ubyte SDL_TTF_MINOR_VERSION = 0;
version(SDL_TTF_2014) {
enum sdlTTFSupport = SDLTTFSupport.sdlTTF2014;
enum ubyte SDL_TTF_PATCHLEVEL = 14;
}
else version(SDL_TTF_2013) {
enum sdlTTFSupport = SDLTTFSupport.sdlTTF2013;
enum ubyte SDL_TTF_PATCHLEVEL = 13;
}
else {
enum sdlTTFSupport = SDLTTFSupport.sdlTTF2012;
enum ubyte SDL_TTF_PATCHLEVEL = 12;
}
alias TTF_MAJOR_VERSION = SDL_TTF_MAJOR_VERSION;
alias TTF_MINOR_VERSION = SDL_TTF_MINOR_VERSION;
alias TTF_PATCHLEVEL = SDL_TTF_PATCHLEVEL;
@nogc nothrow
void SDL_TTF_VERSION(SDL_version* X) {
X.major = SDL_TTF_MAJOR_VERSION;
X.minor = SDL_TTF_MINOR_VERSION;
X.patch = SDL_TTF_PATCHLEVEL;
}
alias TTF_VERSION = SDL_TTF_VERSION;
enum {
UNICODE_BOM_NATIVE = 0xFEFF,
UNICODE_BOM_SWAPPED = 0xFFFE,
TTF_STYLE_NORMAL = 0x00,
TTF_STYLE_BOLD = 0x01,
TTF_STYLE_ITALIC = 0x02,
TTF_STYLE_UNDERLINE = 0x04,
TTF_STYLE_STRIKETHROUGH = 0x08,
}
enum {
TTF_HINTING_NORMAL = 0,
TTF_HINTING_LIGHT = 1,
TTF_HINTING_MONO = 2,
TTF_HINTING_NONE = 3,
}
struct TTF_Font;
version(BindSDL_Static) {
extern(C) @nogc nothrow {
SDL_version* TTF_Linked_Version();
void TTF_ByteSwappedUNICODE(int);
int TTF_Init();
TTF_Font * TTF_OpenFont(const(char)*,int);
TTF_Font * TTF_OpenFontIndex(const(char)*,int,c_long );
TTF_Font * TTF_OpenFontRW(SDL_RWops*,int,int);
TTF_Font * TTF_OpenFontIndexRW(SDL_RWops*,int,int,c_long);
int TTF_GetFontStyle(const(TTF_Font)*);
void TTF_SetFontStyle(const(TTF_Font)*,int style);
int TTF_GetFontOutline(const(TTF_Font)*);
void TTF_SetFontOutline(TTF_Font*,int);
int TTF_GetFontHinting(const(TTF_Font)*);
void TTF_SetFontHinting(TTF_Font*,int);
int TTF_FontHeight(const(TTF_Font)*);
int TTF_FontAscent(const(TTF_Font)*);
int TTF_FontDescent(const(TTF_Font)*);
int TTF_FontLineSkip(const(TTF_Font)*);
int TTF_GetFontKerning(const(TTF_Font)*);
void TTF_SetFontKerning(TTF_Font*,int);
int TTF_FontFaces(const(TTF_Font)*);
int TTF_FontFaceIsFixedWidth(const(TTF_Font)*);
char* TTF_FontFaceFamilyName(const(TTF_Font)*);
char* TTF_FontFaceStyleName(const(TTF_Font)*);
int TTF_GlyphIsProvided(const(TTF_Font)*,ushort);
int TTF_GlyphMetrics(TTF_Font*,ushort,int*,int*,int*,int*,int*);
int TTF_SizeText(TTF_Font*,const(char)*,int*,int*);
int TTF_SizeUTF8(TTF_Font*,const(char)*,int*,int*);
int TTF_SizeUNICODE(TTF_Font*,ushort*,int*,int*);
SDL_Surface* TTF_RenderText_Solid(TTF_Font*,const(char)*,SDL_Color);
SDL_Surface* TTF_RenderUTF8_Solid(TTF_Font*,const(char)*,SDL_Color);
SDL_Surface* TTF_RenderUNICODE_Solid(TTF_Font*,const(ushort)*,SDL_Color);
SDL_Surface* TTF_RenderGlyph_Solid(TTF_Font*,ushort,SDL_Color);
SDL_Surface* TTF_RenderText_Shaded(TTF_Font*,const(char)*,SDL_Color,SDL_Color);
SDL_Surface* TTF_RenderUTF8_Shaded(TTF_Font*,const(char)*,SDL_Color,SDL_Color);
SDL_Surface* TTF_RenderUNICODE_Shaded(TTF_Font*,const(ushort)*,SDL_Color,SDL_Color);
SDL_Surface* TTF_RenderGlyph_Shaded(TTF_Font*,ushort,SDL_Color,SDL_Color);
SDL_Surface* TTF_RenderText_Blended(TTF_Font*,const(char)*,SDL_Color);
SDL_Surface* TTF_RenderUTF8_Blended(TTF_Font*,const(char)*,SDL_Color);
SDL_Surface* TTF_RenderUNICODE_Blended(TTF_Font*,const(ushort)*,SDL_Color);
SDL_Surface* TTF_RenderText_Blended_Wrapped(TTF_Font*,const(char)*,SDL_Color,uint);
SDL_Surface* TTF_RenderUTF8_Blended_Wrapped(TTF_Font*,const(char)*,SDL_Color,uint);
SDL_Surface* TTF_RenderUNICODE_Blended_Wrapped(TTF_Font*,const(ushort)*,SDL_Color,uint);
SDL_Surface* TTF_RenderGlyph_Blended(TTF_Font*,ushort,SDL_Color);
void TTF_CloseFont(TTF_Font*);
void TTF_Quit();
int TTF_WasInit();
int TTF_GetFontKerningSize(TTF_Font*,int,int);
static if(sdlTTFSupport >= SDLTTFSupport.sdlTTF2014) {
int TTF_GetFontKerningSizeGlyphs(TTF_Font*,ushort,ushort);
}
}
}
else {
import bindbc.loader;
extern(C) @nogc nothrow {
alias pTTF_Linked_Version = SDL_version* function();
alias pTTF_ByteSwappedUNICODE = void function(int);
alias pTTF_Init = int function();
alias pTTF_OpenFont = TTF_Font * function(const(char)*,int);
alias pTTF_OpenFontIndex = TTF_Font * function(const(char)*,int,c_long );
alias pTTF_OpenFontRW = TTF_Font * function(SDL_RWops*,int,int);
alias pTTF_OpenFontIndexRW = TTF_Font * function(SDL_RWops*,int,int,c_long);
alias pTTF_GetFontStyle = int function(const(TTF_Font)*);
alias pTTF_SetFontStyle = void function(const(TTF_Font)*,int style);
alias pTTF_GetFontOutline = int function(const(TTF_Font)*);
alias pTTF_SetFontOutline = void function(TTF_Font*,int);
alias pTTF_GetFontHinting = int function(const(TTF_Font)*);
alias pTTF_SetFontHinting = void function(TTF_Font*,int);
alias pTTF_FontHeight = int function(const(TTF_Font)*);
alias pTTF_FontAscent = int function(const(TTF_Font)*);
alias pTTF_FontDescent = int function(const(TTF_Font)*);
alias pTTF_FontLineSkip = int function(const(TTF_Font)*);
alias pTTF_GetFontKerning = int function(const(TTF_Font)*);
alias pTTF_SetFontKerning = void function(TTF_Font*,int);
alias pTTF_FontFaces = int function(const(TTF_Font)*);
alias pTTF_FontFaceIsFixedWidth = int function(const(TTF_Font)*);
alias pTTF_FontFaceFamilyName = char* function(const(TTF_Font)*);
alias pTTF_FontFaceStyleName = char* function(const(TTF_Font)*);
alias pTTF_GlyphIsProvided = int function(const(TTF_Font)*,ushort);
alias pTTF_GlyphMetrics = int function(TTF_Font*,ushort,int*,int*,int*,int*,int*);
alias pTTF_SizeText = int function(TTF_Font*,const(char)*,int*,int*);
alias pTTF_SizeUTF8 = int function(TTF_Font*,const(char)*,int*,int*);
alias pTTF_SizeUNICODE = int function(TTF_Font*,ushort*,int*,int*);
alias pTTF_RenderText_Solid = SDL_Surface* function(TTF_Font*,const(char)*,SDL_Color);
alias pTTF_RenderUTF8_Solid = SDL_Surface* function(TTF_Font*,const(char)*,SDL_Color);
alias pTTF_RenderUNICODE_Solid = SDL_Surface* function(TTF_Font*,const(ushort)*,SDL_Color);
alias pTTF_RenderGlyph_Solid = SDL_Surface* function(TTF_Font*,ushort,SDL_Color);
alias pTTF_RenderText_Shaded = SDL_Surface* function(TTF_Font*,const(char)*,SDL_Color,SDL_Color);
alias pTTF_RenderUTF8_Shaded = SDL_Surface* function(TTF_Font*,const(char)*,SDL_Color,SDL_Color);
alias pTTF_RenderUNICODE_Shaded = SDL_Surface* function(TTF_Font*,const(ushort)*,SDL_Color,SDL_Color);
alias pTTF_RenderGlyph_Shaded = SDL_Surface* function(TTF_Font*,ushort,SDL_Color,SDL_Color);
alias pTTF_RenderText_Blended = SDL_Surface* function(TTF_Font*,const(char)*,SDL_Color);
alias pTTF_RenderUTF8_Blended = SDL_Surface* function(TTF_Font*,const(char)*,SDL_Color);
alias pTTF_RenderUNICODE_Blended = SDL_Surface* function(TTF_Font*,const(ushort)*,SDL_Color);
alias pTTF_RenderText_Blended_Wrapped = SDL_Surface* function(TTF_Font*,const(char)*,SDL_Color,uint);
alias pTTF_RenderUTF8_Blended_Wrapped = SDL_Surface* function(TTF_Font*,const(char)*,SDL_Color,uint);
alias pTTF_RenderUNICODE_Blended_Wrapped = SDL_Surface* function(TTF_Font*,const(ushort)*,SDL_Color,uint);
alias pTTF_RenderGlyph_Blended = SDL_Surface* function(TTF_Font*,ushort,SDL_Color);
alias pTTF_CloseFont = void function(TTF_Font*);
alias pTTF_Quit = void function();
alias pTTF_WasInit = int function();
alias pTTF_GetFontKerningSize = int function(TTF_Font*,int,int);
}
__gshared {
pTTF_Linked_Version TTF_Linked_Version;
pTTF_ByteSwappedUNICODE TTF_ByteSwappedUNICODE;
pTTF_Init TTF_Init;
pTTF_OpenFont TTF_OpenFont;
pTTF_OpenFontIndex TTF_OpenFontIndex;
pTTF_OpenFontRW TTF_OpenFontRW;
pTTF_OpenFontIndexRW TTF_OpenFontIndexRW;
pTTF_GetFontStyle TTF_GetFontStyle;
pTTF_SetFontStyle TTF_SetFontStyle;
pTTF_GetFontOutline TTF_GetFontOutline;
pTTF_SetFontOutline TTF_SetFontOutline;
pTTF_GetFontHinting TTF_GetFontHinting;
pTTF_SetFontHinting TTF_SetFontHinting;
pTTF_FontHeight TTF_FontHeight;
pTTF_FontAscent TTF_FontAscent;
pTTF_FontDescent TTF_FontDescent;
pTTF_FontLineSkip TTF_FontLineSkip;
pTTF_GetFontKerning TTF_GetFontKerning;
pTTF_SetFontKerning TTF_SetFontKerning;
pTTF_FontFaces TTF_FontFaces;
pTTF_FontFaceIsFixedWidth TTF_FontFaceIsFixedWidth;
pTTF_FontFaceFamilyName TTF_FontFaceFamilyName;
pTTF_FontFaceStyleName TTF_FontFaceStyleName;
pTTF_GlyphIsProvided TTF_GlyphIsProvided;
pTTF_GlyphMetrics TTF_GlyphMetrics;
pTTF_SizeText TTF_SizeText;
pTTF_SizeUTF8 TTF_SizeUTF8;
pTTF_SizeUNICODE TTF_SizeUNICODE;
pTTF_RenderText_Solid TTF_RenderText_Solid;
pTTF_RenderUTF8_Solid TTF_RenderUTF8_Solid;
pTTF_RenderUNICODE_Solid TTF_RenderUNICODE_Solid;
pTTF_RenderGlyph_Solid TTF_RenderGlyph_Solid;
pTTF_RenderText_Shaded TTF_RenderText_Shaded;
pTTF_RenderUTF8_Shaded TTF_RenderUTF8_Shaded;
pTTF_RenderUNICODE_Shaded TTF_RenderUNICODE_Shaded;
pTTF_RenderGlyph_Shaded TTF_RenderGlyph_Shaded;
pTTF_RenderText_Blended TTF_RenderText_Blended;
pTTF_RenderUTF8_Blended TTF_RenderUTF8_Blended;
pTTF_RenderUNICODE_Blended TTF_RenderUNICODE_Blended;
pTTF_RenderText_Blended_Wrapped TTF_RenderText_Blended_Wrapped;
pTTF_RenderUTF8_Blended_Wrapped TTF_RenderUTF8_Blended_Wrapped;
pTTF_RenderUNICODE_Blended_Wrapped TTF_RenderUNICODE_Blended_Wrapped;
pTTF_RenderGlyph_Blended TTF_RenderGlyph_Blended;
pTTF_CloseFont TTF_CloseFont;
pTTF_Quit TTF_Quit;
pTTF_WasInit TTF_WasInit;
pTTF_GetFontKerningSize TTF_GetFontKerningSize;
}
static if(sdlTTFSupport >= SDLTTFSupport.sdlTTF2014) {
extern(C) @nogc nothrow {
alias pTTF_GetFontKerningSizeGlyphs = int function(TTF_Font*,ushort,ushort);
}
__gshared {
pTTF_GetFontKerningSizeGlyphs TTF_GetFontKerningSizeGlyphs;
}
}
private {
SharedLib lib;
SDLTTFSupport loadedVersion;
}
void unloadSDLTTF()
{
if(lib != invalidHandle) {
lib.unload();
}
}
SDLTTFSupport loadedSDLTTFVersion() { return loadedVersion; }
bool isSDLTTFLoaded()
{
return lib != invalidHandle;
}
SDLTTFSupport loadSDLTTF()
{
version(Windows) {
const(char)[][1] libNames = ["SDL2_ttf.dll"];
}
else version(OSX) {
const(char)[][6] libNames = [
"libSDL2_ttf.dylib",
"/usr/local/lib/libSDL2_ttf.dylib",
"../Frameworks/SDL2_ttf.framework/SDL2_ttf",
"/Library/Frameworks/SDL2_ttf.framework/SDL2_ttf",
"/System/Library/Frameworks/SDL2_ttf.framework/SDL2_ttf",
"/opt/local/lib/libSDL2_ttf.dylib"
];
}
else version(Posix) {
const(char)[][6] libNames = [
"libSDL2_ttf.so",
"/usr/local/lib/libSDL2_ttf.so",
"libSDL2-2.0_ttf.so",
"/usr/local/lib/libSDL2-2.0_ttf.so",
"libSDL2-2.0_ttf.so.0",
"/usr/local/lib/libSDL2-2.0_ttf.so.0"
];
}
else static assert(0, "bindbc-sdl is not yet supported on this platform.");
SDLTTFSupport ret;
foreach(name; libNames) {
ret = loadSDLTTF(name.ptr);
if(ret != SDLTTFSupport.noLibrary) break;
}
return ret;
}
SDLTTFSupport loadSDLTTF(const(char)* libName)
{
lib = load(libName);
if(lib == invalidHandle) {
return SDLTTFSupport.noLibrary;
}
auto errCount = errorCount();
loadedVersion = SDLTTFSupport.badLibrary;
lib.bindSymbol(cast(void**)&TTF_Linked_Version,"TTF_Linked_Version");
lib.bindSymbol(cast(void**)&TTF_ByteSwappedUNICODE,"TTF_ByteSwappedUNICODE");
lib.bindSymbol(cast(void**)&TTF_Init,"TTF_Init");
lib.bindSymbol(cast(void**)&TTF_OpenFont,"TTF_OpenFont");
lib.bindSymbol(cast(void**)&TTF_OpenFontIndex,"TTF_OpenFontIndex");
lib.bindSymbol(cast(void**)&TTF_OpenFontRW,"TTF_OpenFontRW");
lib.bindSymbol(cast(void**)&TTF_OpenFontIndexRW,"TTF_OpenFontIndexRW");
lib.bindSymbol(cast(void**)&TTF_GetFontStyle,"TTF_GetFontStyle");
lib.bindSymbol(cast(void**)&TTF_SetFontStyle,"TTF_SetFontStyle");
lib.bindSymbol(cast(void**)&TTF_GetFontOutline,"TTF_GetFontOutline");
lib.bindSymbol(cast(void**)&TTF_SetFontOutline,"TTF_SetFontOutline");
lib.bindSymbol(cast(void**)&TTF_GetFontHinting,"TTF_GetFontHinting");
lib.bindSymbol(cast(void**)&TTF_SetFontHinting,"TTF_SetFontHinting");
lib.bindSymbol(cast(void**)&TTF_FontHeight,"TTF_FontHeight");
lib.bindSymbol(cast(void**)&TTF_FontAscent,"TTF_FontAscent");
lib.bindSymbol(cast(void**)&TTF_FontDescent,"TTF_FontDescent");
lib.bindSymbol(cast(void**)&TTF_FontLineSkip,"TTF_FontLineSkip");
lib.bindSymbol(cast(void**)&TTF_GetFontKerning,"TTF_GetFontKerning");
lib.bindSymbol(cast(void**)&TTF_SetFontKerning,"TTF_SetFontKerning");
lib.bindSymbol(cast(void**)&TTF_FontFaces,"TTF_FontFaces");
lib.bindSymbol(cast(void**)&TTF_FontFaceIsFixedWidth,"TTF_FontFaceIsFixedWidth");
lib.bindSymbol(cast(void**)&TTF_FontFaceFamilyName,"TTF_FontFaceFamilyName");
lib.bindSymbol(cast(void**)&TTF_FontFaceStyleName,"TTF_FontFaceStyleName");
lib.bindSymbol(cast(void**)&TTF_GlyphIsProvided,"TTF_GlyphIsProvided");
lib.bindSymbol(cast(void**)&TTF_GlyphMetrics,"TTF_GlyphMetrics");
lib.bindSymbol(cast(void**)&TTF_SizeText,"TTF_SizeText");
lib.bindSymbol(cast(void**)&TTF_SizeUTF8,"TTF_SizeUTF8");
lib.bindSymbol(cast(void**)&TTF_SizeUNICODE,"TTF_SizeUNICODE");
lib.bindSymbol(cast(void**)&TTF_RenderText_Solid,"TTF_RenderText_Solid");
lib.bindSymbol(cast(void**)&TTF_RenderUTF8_Solid,"TTF_RenderUTF8_Solid");
lib.bindSymbol(cast(void**)&TTF_RenderUNICODE_Solid,"TTF_RenderUNICODE_Solid");
lib.bindSymbol(cast(void**)&TTF_RenderGlyph_Solid,"TTF_RenderGlyph_Solid");
lib.bindSymbol(cast(void**)&TTF_RenderText_Shaded,"TTF_RenderText_Shaded");
lib.bindSymbol(cast(void**)&TTF_RenderUTF8_Shaded,"TTF_RenderUTF8_Shaded");
lib.bindSymbol(cast(void**)&TTF_RenderUNICODE_Shaded,"TTF_RenderUNICODE_Shaded");
lib.bindSymbol(cast(void**)&TTF_RenderGlyph_Shaded,"TTF_RenderGlyph_Shaded");
lib.bindSymbol(cast(void**)&TTF_RenderText_Blended,"TTF_RenderText_Blended");
lib.bindSymbol(cast(void**)&TTF_RenderUTF8_Blended,"TTF_RenderUTF8_Blended");
lib.bindSymbol(cast(void**)&TTF_RenderUNICODE_Blended,"TTF_RenderUNICODE_Blended");
lib.bindSymbol(cast(void**)&TTF_RenderText_Blended_Wrapped,"TTF_RenderText_Blended_Wrapped");
lib.bindSymbol(cast(void**)&TTF_RenderUTF8_Blended_Wrapped,"TTF_RenderUTF8_Blended_Wrapped");
lib.bindSymbol(cast(void**)&TTF_RenderUNICODE_Blended_Wrapped,"TTF_RenderUNICODE_Blended_Wrapped");
lib.bindSymbol(cast(void**)&TTF_RenderGlyph_Blended,"TTF_RenderGlyph_Blended");
lib.bindSymbol(cast(void**)&TTF_CloseFont,"TTF_CloseFont");
lib.bindSymbol(cast(void**)&TTF_Quit,"TTF_Quit");
lib.bindSymbol(cast(void**)&TTF_WasInit,"TTF_WasInit");
lib.bindSymbol(cast(void**)&TTF_GetFontKerningSize,"TTF_GetFontKerningSize");
if(errorCount() != errCount) return SDLTTFSupport.badLibrary;
else loadedVersion = SDLTTFSupport.sdlTTF2012;
static if(sdlTTFSupport >= SDLTTFSupport.sdlTTF2014) {
lib.bindSymbol(cast(void**)&TTF_GetFontKerningSizeGlyphs,"TTF_GetFontKerningSizeGlyphs");
if(errorCount() != errCount) return SDLTTFSupport.badLibrary;
else loadedVersion = SDLTTFSupport.sdlTTF2014;
}
return loadedVersion;
}
}

BIN
demos/libpng16-16.dll Normal file

Binary file not shown.

Binary file not shown.

BIN
demos/libs/linux/x64/libcimgui.so Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

35
demos/meson.build Normal file
View file

@ -0,0 +1,35 @@
# Files
demos_src = files()
external_src = files()
subdir('source')
subdir('external')
demos_inc = include_directories('source/')
external_inc = include_directories('external/sources/')
# Argumesnts
versions = ['BindSDL_Image','SDL_208', 'BindBC_Static', 'BindSDL_Static']
# Dependencies
bindbc_loader_dep = dependency('bindbc-loader')
bindbc_sdl_dep = dependency('bindbc-sdl')
cimgui_dep = dependency('cimgui')
sdl2_dep = dependency('SDL2')
sdl2_image_dep = dependency('SDL2_image')
subdir('utils') # Utils library
executable('BubelECSDemos', [demos_src, external_src],
include_directories : [demos_inc, external_inc],
d_module_versions : versions,
link_with : [ecs_lib, ecs_utils_lib],
dependencies : [
bindbc_loader_dep,
bindbc_sdl_dep,
cimgui_dep,
bubel_ecs_dep,
ecs_utils_dep,
sdl2_dep,
sdl2_image_dep,
],
)

1453
demos/source/app.d Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,486 @@
module demos.brick_breaker;
import app;
import bindbc.sdl;
import bubel.ecs.attributes;
import bubel.ecs.core;
import bubel.ecs.entity;
import bubel.ecs.manager;
import bubel.ecs.std;
import cimgui.cimgui;
import ecs_utils.gfx.texture;
import ecs_utils.math.vector;
import ecs_utils.utils;
import game_core.basic;
import game_core.rendering;
import game_core.collision;
extern(C):
private enum float px = 1.0/512.0;
float clamp(float v, float min, float max)
{
if(v<min)return min;
else if (v>max)return max;
else return v;
}
/*#######################################################################################################################
------------------------------------------------ Components ------------------------------------------------------------------
#######################################################################################################################*/
/*struct CLocation
{
mixin ECS.Component;
alias location this;
vec2 location;
}*/
struct CBrick
{
mixin ECS.Component;
}
struct CPaddle
{
mixin ECS.Component;
}
struct CBall
{
mixin ECS.Component;
//ubyte radius;
}
struct CHitPoints
{
mixin ECS.Component;
alias value this;
short value;
}
// struct CVelocityFactor
// {
// mixin ECS.Component;
// alias value this;
// vec2 value = vec2(1);
// }
// struct CVelocity
// {
// mixin ECS.Component;
// alias value this;
// vec2 value = vec2(0);
// }
struct EDamage
{
mixin ECS.Event;
ubyte damage = 1;
}
/*#######################################################################################################################
------------------------------------------------ Systems ------------------------------------------------------------------
#######################################################################################################################*/
// struct MoveSystem
// {
// mixin ECS.System!64;
// struct EntitiesData
// {
// uint length;
// CLocation[] location;
// @readonly CVelocity[] velocity;
// @optional @readonly CVelocityFactor[] vel_factor;
// }
// void onUpdate(EntitiesData data)
// {
// if(data.vel_factor)
// {
// foreach(i; 0..data.length)
// {
// data.location[i] += data.velocity[i] * data.vel_factor[i] * launcher.delta_time;
// }
// }
// else
// {
// foreach(i; 0..data.length)
// {
// data.location[i] += data.velocity[i] * launcher.delta_time;
// }
// }
// }
// }
struct EdgeCollisionSystem
{
mixin ECS.System!64;
struct EntitiesData
{
uint length;
CLocation[] location;
CVelocity[] velocity;
//CBall[] ball_flag;
}
void onUpdate(EntitiesData data)
{
foreach(i; 0..data.length)
{
if(data.location[i].x < 0)
{
if(data.velocity[i].x < 0)data.velocity[i].x = -data.velocity[i].x;
data.location[i].x = 0;
}
else if(data.location[i].x > 400)
{
if(data.velocity[i].x > 0)data.velocity[i].x = -data.velocity[i].x;
data.location[i].x = 400;
}
if(data.location[i].y < 0)
{
if(data.velocity[i].y < 0)data.velocity[i].y = -data.velocity[i].y;
data.location[i].y = 0;
}
else if(data.location[i].y > 300)
{
if(data.velocity[i].y > 0)data.velocity[i].y = -data.velocity[i].y;
data.location[i].y = 300;
}
}
}
}
struct BallCollisionSystem
{
mixin ECS.System!64;
mixin ECS.ReadOnlyDependencies!(ShootGridDependency, BVHDependency);
struct EntitiesData
{
///variable named "length" contain entites count
uint length;
const (Entity)[] entity;
CVelocity[] velocity;
@readonly CLocation[] location;
@readonly CScale[] scale;
@readonly CBall[] ball_flag;
}
struct State
{
bool test(EntityID id)
{
if(id == data.entity[i].id)return true;
Entity* entity = gEntityManager.getEntity(id);
if(entity)
{
CLocation* location = entity.getComponent!CLocation;
CScale* scale = entity.getComponent!CScale;
if(location && scale)
{
float radius = data.scale[i].x*0.5;
vec2 rel_pos = *location - data.location[i];
vec2 half_scale = *scale * 0.5f;
vec2 nearest_point;
nearest_point.x = clamp(rel_pos.x, -half_scale.x, half_scale.x);
nearest_point.y = clamp(rel_pos.y, -half_scale.y, half_scale.y);
vec2 vector;
if(nearest_point == rel_pos)
{
vector = nearest_point;
radius = float.max;
}
else vector = nearest_point - rel_pos;
float pow_dist = dot(vector, vector);
if(dot(data.velocity[i], vector) > 0.01)return true;
if(pow_dist < radius*radius)
{
vector = vector / sqrtf(pow_dist);
data.velocity[i] = data.velocity[i] - vector * (2 * dot(vector, data.velocity[i]));
gEntityManager.sendEvent(id,EDamage(1));
return cast(bool)(hits--);
}
}
}
return true;
}
EntitiesData data;
uint i;
uint hits;
}
ShootGrid* grid;
BVHTree* tree;
BVHTree* static_tree;
bool onBegin()
{
tree = gEntityManager.getSystem!BVHBuilder().tree;
static_tree = gEntityManager.getSystem!StaticBVHBuilder().tree;
if(tree is null || static_tree is null)return false;
else return true;
}
void onUpdate(EntitiesData data)
{
State state;
state.data = data;
foreach(i; 0..data.length)
{
state.i = i;
state.hits = 1;
AABB bounding = AABB(data.location[i]-data.scale[i], data.location[i]+data.scale[i]);
tree.test(bounding, cast(bool delegate(EntityID id))&state.test);
static_tree.test(bounding, cast(bool delegate(EntityID id))&state.test);
}
}
}
struct DamageSystem
{
mixin ECS.System!64;
mixin ECS.ReadOnlyDependencies!(ShootGridDependency);
struct EntitiesData
{
///variable named "length" contain entites count
uint length;
const (Entity)[] entity;
CHitPoints[] hit_points;
}
void handleEvent(Entity* entity, EDamage event)
{
EntityMeta meta = entity.getMeta();
CHitPoints* hp = meta.getComponent!CHitPoints;
hp.value -= event.damage;
if(hp.value < 0)gEntityManager.removeEntity(entity.id);
}
}
/*#######################################################################################################################
------------------------------------------------ Functions ------------------------------------------------------------------
#######################################################################################################################*/
struct BrickBreakerDemo
{
__gshared const (char)* tips = "Brick breaker demo. It's a game about destroying evil bricks.
This demo is usnfinished yet but collision works well. Bricks can be destroyed. Spawning thousands of bricks and then thousands of balls is good way to try demo.
Bricks uses StaticBVH, ball don't collide witch each other, paddle is added to dynamic BVH and collide with balls. But nothing keeps you from adding dynamic collision for balls.
Currently dynamic collisions are pretty slow as dynamic BVH is rebuilded every frame on single thread.";
//EntityTemplate* tmpl;
Texture texture;
}
__gshared BrickBreakerDemo* demo;
void brickBreakerRegister()
{
demo = Mallocator.make!BrickBreakerDemo;
demo.texture.create();
demo.texture.load("assets/textures/atlas.png");
gEntityManager.beginRegister();
registerRenderingModule(gEntityManager);
registerCollisionModule(gEntityManager);
gEntityManager.registerComponent!CLocation;
gEntityManager.registerComponent!CRotation;
gEntityManager.registerComponent!CScale;
gEntityManager.registerComponent!CTexCoords;
gEntityManager.registerComponent!CTexCoordsIndex;
gEntityManager.registerComponent!CVelocity;
gEntityManager.registerComponent!CInput;
gEntityManager.registerComponent!CPaddle;
gEntityManager.registerComponent!CDamping;
gEntityManager.registerComponent!CVelocityFactor;
gEntityManager.registerComponent!CBall;
gEntityManager.registerComponent!CHitPoints;
gEntityManager.registerEvent!EDamage;
gEntityManager.registerSystem!MoveSystem(-100);
gEntityManager.registerSystem!EdgeCollisionSystem(-99);
gEntityManager.registerSystem!BallCollisionSystem(-79);
gEntityManager.registerSystem!InputMovementSystem(-120);
gEntityManager.registerSystem!DampingSystem(-120);
gEntityManager.registerSystem!DamageSystem(-120);
gEntityManager.endRegister();
}
void brickBreakerStart()
{
DrawSystem* draw_system = gEntityManager.getSystem!DrawSystem;
draw_system.default_data.color = 0x80808080;
draw_system.default_data.texture = demo.texture;
draw_system.default_data.size = vec2(16,16);
draw_system.default_data.coords = vec4(246,64,2,2)*px;
draw_system.default_data.material_id = 0;
EntityTemplate* brick_tmpl = gEntityManager.allocateTemplate(
[becsID!CLocation, becsID!CScale, becsID!CColor,
becsID!CTexCoordsIndex, becsID!CBVH, becsID!CHitPoints,
becsID!CAABB, becsID!CStatic].staticArray
);
brick_tmpl.getComponent!CTexCoordsIndex().value = TexCoordsManager.instance.getCoordIndex(vec4(304,40,16,8)*px);
brick_tmpl.getComponent!CColor().value = 0x80206020;
brick_tmpl.getComponent!CScale().value = vec2(16,8);
brick_tmpl.getComponent!CHitPoints().value = 2;
//brick_tmpl.getComponent!CAABB().bounding = AABB(vec2(),vec2());
EntityTemplate* big_brick_tmpl = gEntityManager.allocateTemplate(brick_tmpl);
big_brick_tmpl.getComponent!CTexCoordsIndex().value = TexCoordsManager.instance.getCoordIndex(vec4(320,32,16,16)*px);
big_brick_tmpl.getComponent!CScale().value = vec2(16,16);
EntityTemplate* paddle_tmpl = gEntityManager.allocateTemplate(
[becsID!CLocation, becsID!CScale, becsID!CInput,
becsID!CTexCoordsIndex, becsID!CPaddle, becsID!CVelocity,
becsID!CDamping, becsID!CVelocityFactor, becsID!CBVH,
becsID!CAABB].staticArray
);
paddle_tmpl.getComponent!CTexCoordsIndex().value = TexCoordsManager.instance.getCoordIndex(vec4(272,48,64,10)*px);
paddle_tmpl.getComponent!CScale().value = vec2(64,10);
paddle_tmpl.getComponent!CDamping().value = 14;
paddle_tmpl.getComponent!CVelocityFactor().value = vec2(1,0);
EntityTemplate* ball_tmpl = gEntityManager.allocateTemplate(
[becsID!CLocation, becsID!CScale, //becsID!CDamping,
becsID!CTexCoordsIndex, becsID!CBall, becsID!CVelocity].staticArray
);
ball_tmpl.getComponent!CTexCoordsIndex().value = TexCoordsManager.instance.getCoordIndex(vec4(304,32,8,8)*px);
ball_tmpl.getComponent!CScale().value = vec2(8,8);
ball_tmpl.getComponent!CVelocity().value = vec2(0.1,0.1);
// paddle_tmpl.getComponent!CDamping().value = 14;
launcher.gui_manager.addComponent(CLocation(), "Location");
launcher.gui_manager.addComponent(CRotation(), "Rotation");
launcher.gui_manager.addComponent(CScale(), "Scale");
launcher.gui_manager.addComponent(CColor(), "Color");
launcher.gui_manager.addComponent(CTexCoords(), "Tex Coords");
launcher.gui_manager.addComponent(CTexCoordsIndex(), "Tex Coords Index");
launcher.gui_manager.addComponent(CVelocity(), "Velocity");
launcher.gui_manager.addComponent(CInput(), "Input");
launcher.gui_manager.addComponent(CPaddle(), "Paddle");
launcher.gui_manager.addComponent(CDamping(), "Damping");
launcher.gui_manager.addComponent(CBall(), "Ball");
launcher.gui_manager.addComponent(CBVH(), "BVH");
launcher.gui_manager.addComponent(CAABB(), "AABB");
launcher.gui_manager.addComponent(CStatic(), "Static Flag");
launcher.gui_manager.addComponent(CVelocityFactor(), "Velocity Factor");
launcher.gui_manager.addComponent(CHitPoints(), "Hit Points");
launcher.gui_manager.addSystem(becsID!MoveSystem, "Move System");
launcher.gui_manager.addSystem(becsID!EdgeCollisionSystem, "Edge Collision System");
launcher.gui_manager.addSystem(becsID!BallCollisionSystem, "Ball Collision System");
launcher.gui_manager.addSystem(becsID!InputMovementSystem, "Input Movement System");
launcher.gui_manager.addSystem(becsID!DampingSystem, "Damping System");
launcher.gui_manager.addSystem(becsID!DamageSystem, "Damage System");
launcher.gui_manager.addTemplate(brick_tmpl, "Brick");
launcher.gui_manager.addTemplate(big_brick_tmpl, "Big Brick");
launcher.gui_manager.addTemplate(paddle_tmpl, "Paddle");
launcher.gui_manager.addTemplate(ball_tmpl, "Ball");
foreach(i;0..10)
{
CColor color;
final switch(i)
{
case 0:color = 0x80206020;break;
case 1:color = 0x80602020;break;
case 2:color = 0x80202060;break;
case 3:color = 0x80206060;break;
case 4:color = 0x80606020;break;
case 5:color = 0x80602060;break;
case 6:color = 0x80606060;break;
case 7:color = 0x80202020;break;
case 8:color = 0x80008030;break;
case 9:color = 0x80206080;break;
}
foreach (j; 0..20)
{
gEntityManager.addEntity(brick_tmpl,[CLocation(vec2(j*18,300-i*10)).ref_, color.ref_].staticArray);
}
}
gEntityManager.addEntity(paddle_tmpl,[CLocation(vec2(190,20)).ref_].staticArray);
gEntityManager.addEntity(ball_tmpl,[CLocation(vec2(190,40)).ref_].staticArray);
}
void brickBreakerEnd()
{
demo.texture.destroy();
Mallocator.dispose(demo);
}
void brickBreakerEvent(SDL_Event* event)
{
}
bool brickBreakerLoop()
{
launcher.render_position = (vec2(launcher.window_size.x,launcher.window_size.y)*launcher.scalling - vec2(400,300)) * 0.5;
gEntityManager.begin();
if(launcher.multithreading)
{
launcher.job_updater.begin();
gEntityManager.updateMT();
launcher.job_updater.call();
}
else
{
gEntityManager.update();
}
gEntityManager.end();
return true;
}
DemoCallbacks getBrickBreakerDemo()
{
DemoCallbacks demo;
demo.register = &brickBreakerRegister;
demo.initialize = &brickBreakerStart;
demo.deinitialize = &brickBreakerEnd;
demo.loop = &brickBreakerLoop;
demo.tips = .demo.tips;
return demo;
}

View file

@ -0,0 +1,19 @@
module demos.bullet_madnes;
import app;
import bindbc.sdl;
import cimgui.cimgui;
import bubel.ecs.attributes;
import bubel.ecs.core;
import bubel.ecs.entity;
import bubel.ecs.manager;
import bubel.ecs.std;
import ecs_utils.gfx.texture;
import ecs_utils.math.vector;
import ecs_utils.utils;
extern(C):

Some files were not shown because too many files have changed in this diff Show more