Compare commits
135 Commits
911ee7a13e
...
v1.13
| Author | SHA1 | Date | |
|---|---|---|---|
| efd1227b8b | |||
| f8166787a6 | |||
| 46dc81124f | |||
| 8dcc1d282a | |||
| dc1470ec0e | |||
| 052607873b | |||
| 6faa80eef4 | |||
| 9ffd29bea8 | |||
| 7287d65ca3 | |||
| cea5492abc | |||
| cccb2359cf | |||
| b5e822c65f | |||
| c14774478c | |||
| 3c3e012386 | |||
| 44b6f6830d | |||
| 0d12591925 | |||
| 22d6ac2fbf | |||
| acaf434e5c | |||
| 5f25562d52 | |||
| fc28586940 | |||
| 273d9304dc | |||
| 3a5b16346b | |||
| 0e61b94848 | |||
| eca5a55d3c | |||
| dccd0d41e4 | |||
| 20bac58814 | |||
| a6fae7b001 | |||
| b31346830f | |||
| b6fec3eba7 | |||
| 606388227c | |||
| a2caf95005 | |||
| 0bfb535d4d | |||
| 405f2248ec | |||
| 93b1cd80b7 | |||
| b53bf87730 | |||
| 015a9cc4e1 | |||
| 3bd13b72cd | |||
| c94adf39af | |||
| 950eeffb07 | |||
| b37b62ef1e | |||
| 0c8aa5fe50 | |||
| fe520dd341 | |||
| ec9a9aff81 | |||
| f9c1c4843d | |||
| a804ad1368 | |||
| c689507982 | |||
| 417643018f | |||
| 2ed7316948 | |||
| 2228153d59 | |||
| 7315032ff2 | |||
| 3fc6795593 | |||
| 16924cf503 | |||
| 705a9fc7cd | |||
| b164c11ba7 | |||
| 1817d00881 | |||
| 8dcf473f31 | |||
| 8f191f02fa | |||
| 1077c13fd0 | |||
| d5a4caa86e | |||
| f3bad9f4ed | |||
| 32f22c99db | |||
| cd14ae22c5 | |||
| 1fdc29e9d2 | |||
| 0a740a5be2 | |||
| 9e1b2b8960 | |||
| ed3724193e | |||
| 98f01a6dde | |||
| e13a28f69a | |||
| 301e0145fb | |||
| 3b233f0e12 | |||
| fd9be2066d | |||
| 7551115912 | |||
| b986778bb4 | |||
| fd2e2f1014 | |||
| 77b844065e | |||
| 2fe79de1d8 | |||
| d6ecadfd3a | |||
| ad467847b9 | |||
| 1bb2142d19 | |||
| f5a82229fe | |||
| 145bab037f | |||
| 754ad2de49 | |||
| a9b7c3f025 | |||
| 4db92d423c | |||
| 6717c1e307 | |||
| 9282d661aa | |||
| a21f530dd4 | |||
| 7483bf63c8 | |||
| 268763f162 | |||
| 71c7b8e553 | |||
| 854a5f04b2 | |||
| ed21a47f92 | |||
| 637df23bc7 | |||
| ea421b4e17 | |||
| 3a5ff06dab | |||
| dfb0d2134f | |||
| b459e2106f | |||
| 065f66d40e | |||
| f15658a767 | |||
| 21c8d1e8ca | |||
| a06eb8c8e9 | |||
| 6b73a76d31 | |||
| 348a76090b | |||
| 02c1bf647e | |||
| a7f0a18e6d | |||
| 8355c266a6 | |||
| 7bad27d686 | |||
| d39622c7e2 | |||
| 4910d201f9 | |||
| e85800c5ed | |||
| f25ee18329 | |||
| 3712f0c8d9 | |||
| c063488e8e | |||
| deb0a8677f | |||
| c5a7c9e70d | |||
| 92453a6104 | |||
| 7aff3e2109 | |||
| 8d213e7b3e | |||
| c6d409c303 | |||
| 6914f7df93 | |||
| 1dbfff2c17 | |||
| 3493636954 | |||
| 8ff1073e4a | |||
| 6497e26202 | |||
| e0e37204d7 | |||
| 6595b28790 | |||
| 0ddb6c85e1 | |||
| f84007902e | |||
| 49ae2ae41f | |||
| c701421a8f | |||
| 1ecb427106 | |||
| c87779cc09 | |||
| 24594fa89a | |||
| 030779794e | |||
| 495c23a3d2 |
@@ -21,7 +21,7 @@ Checks:
|
|||||||
WarningsAsErrors: '*'
|
WarningsAsErrors: '*'
|
||||||
# Solo incluir archivos de tu código fuente (external tiene su propio .clang-tidy)
|
# Solo incluir archivos de tu código fuente (external tiene su propio .clang-tidy)
|
||||||
# Excluye jail_audio.hpp del análisis
|
# Excluye jail_audio.hpp del análisis
|
||||||
HeaderFilterRegex: '^source/(?!core/audio/jail_audio\.hpp).*'
|
HeaderFilterRegex: 'source/(?!core/audio/jail_audio\.hpp|core/rendering/sdl3gpu/.*_spv\.h).*'
|
||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
|
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
.cache/
|
.cache/
|
||||||
.vscode/
|
|
||||||
*data/config/config.yaml
|
*data/config/config.yaml
|
||||||
*stats.txt
|
*stats.txt
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
|||||||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json"
|
||||||
|
}
|
||||||
204
CHANGELOG.md
Normal file
204
CHANGELOG.md
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
Tots els canvis notables de JailDoctor's Dilemma es documenten ací.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v1.13] - 2026-04-03
|
||||||
|
|
||||||
|
### Novetats
|
||||||
|
- **Editor de mapes (mode debug):** editor complet de nivells integrat en el joc
|
||||||
|
- Drag & drop de jugador, enemics, boundaries i ítems
|
||||||
|
- Editor de tiles amb TilePicker (amb spacing_in i spacing_out)
|
||||||
|
- Edició de propietats d'enemics i d'habitacions
|
||||||
|
- MiniMapa amb visualització de tiles i càlcul correcte de minipíxels
|
||||||
|
- Rejilla configurable
|
||||||
|
- Navegació entre habitacions (left, right, up, down)
|
||||||
|
- Guardat automàtic dels canvis en l'habitació
|
||||||
|
- Creació i eliminació d'habitacions
|
||||||
|
- Nova font específica per a l'editor
|
||||||
|
- Opcions persistents de l'editor
|
||||||
|
- Tecla 9 per a entrar i eixir de l'editor
|
||||||
|
- Al eixir de l'editor, recarrega l'habitació amb els canvis
|
||||||
|
- Mostra les rutes dels enemics
|
||||||
|
- RoomSaver millorat (ja no corromp els fitxers YAML)
|
||||||
|
- Status bar de l'editor reorganitzada
|
||||||
|
- **Àmbits en la consola:** filtratge de comandos per mode (editor, debug, global)
|
||||||
|
- **Nou format per a assets.yaml:** ResourceList gestiona addAsset i removeAsset
|
||||||
|
- Eliminats fitxers sobrants de frameworks
|
||||||
|
- Arreglos en stats.cpp
|
||||||
|
- Posat un poc d'ordre en els comandos de la consola
|
||||||
|
|
||||||
|
### Correccions
|
||||||
|
- Fix: bug que feia que en l'editor, al canviar d'habitació el renderInfo tornara a eixir
|
||||||
|
- Fix: faltava propietat mirror en els enemics
|
||||||
|
- Fix: al fer clic es tanca la consola
|
||||||
|
- Arreglat el càlcul dels minipíxels en els tiles amb transparent
|
||||||
|
- Verificació que l'habitació de debug.yaml existisca
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v1.12] - 2026-04-02
|
||||||
|
|
||||||
|
### Novetats
|
||||||
|
- **Color del jugador configurable:** es pot canviar des de la consola (persistent), amb comprovació automàtica per a evitar que coincidisca amb el color de fons
|
||||||
|
- **Skins d'enemics per al jugador:** possibilitat d'utilitzar skins d'enemics en el jugador, amb canvi en calent en el marcador
|
||||||
|
- **Indicador de trucs millorat:** ja no gasta el color del jugador, ara es mostra al marcador
|
||||||
|
- **Shader presets per nom:** es pot establir un shader preset directament per nom des de la consola, amb autocompletat
|
||||||
|
- **Comandos externs en consola:** la consola llig els comandos des d'un fitxer extern
|
||||||
|
- **Gestió de paletes millorada:**
|
||||||
|
- Noves paletes afegides
|
||||||
|
- Restaurat l'ordre original de les paletes
|
||||||
|
- Opció de reordenar paletes automàticament per luminositat o paregut a la paleta d'Spectrum
|
||||||
|
- Noms "pretty" per a les paletes (canvia els `-` per ` `)
|
||||||
|
- Eliminades responsabilitats d'`Options` sobre les paletes
|
||||||
|
- Nova ferramenta en Python per a reordenar paletes
|
||||||
|
- **Acceleració hardware configurable:** possibilitat de desactivar l'acceleració hardware des del fitxer de configuració; si no hi ha acceleració, es deshabiliten tecles i comandos de shaders
|
||||||
|
- **Autocompletat millorat:** shader preset i palette autocompleten amb la llista de noms
|
||||||
|
- Reestructuració de comandos de consola
|
||||||
|
- Reestructuració de l'apartat de vídeo en `config.yaml`
|
||||||
|
- Optimitzacions en `Surface`
|
||||||
|
|
||||||
|
### Correccions
|
||||||
|
- Fix: entrar i eixir del mode debug manté l'estat previ del jugador
|
||||||
|
- Corregit Makefile: migració completa a cmake, detecció automàtica de SO per a release
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v1.11] - 2026-03-31
|
||||||
|
|
||||||
|
### Novetats
|
||||||
|
- **PaletteManager:** refactorització de `Screen`, responsabilitats de gestió de paletes extretes a classe pròpia
|
||||||
|
- **Consola 2.1:** la consola pot canviar de paleta per nom (`Screen` torna llista de paletes)
|
||||||
|
- **Zoom configurable:** `Screen` permet establir el nivell de zoom directament des de la consola
|
||||||
|
- **Autocompletar en consola:** autocompletat de comandos amb Tab (incloent suport per a armadura de lagarto)
|
||||||
|
- Generació automàtica de taula de tab-completions en la consola
|
||||||
|
|
||||||
|
### Correccions
|
||||||
|
- Fix: al entrar a GAME amb la consola oberta, el jugador no tenia els inputs deshabilitats
|
||||||
|
- Fix: al fer restart amb la música de l'attract mode sonant, la música no parava al anar al logo
|
||||||
|
- Fix: en mode debug, protecció per a que el jugador no caiga infinitament si ix de la pantalla
|
||||||
|
- Corregit el case en algunes respostes de la consola
|
||||||
|
- Corregit Makefile
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v1.10] - 2026-03-30
|
||||||
|
|
||||||
|
### Novetats
|
||||||
|
- **Consola 2.0:** redisseny complet de la consola de desenvolupador
|
||||||
|
- Efecte typewriter al mostrar text
|
||||||
|
- Separació de línies automàtica
|
||||||
|
- Canvi de skin
|
||||||
|
- Historial i navegació millorada
|
||||||
|
- Comandos per a cheats, control d'escena, debug, àudio i shaders
|
||||||
|
- Tecles de funció operatives amb la consola oberta
|
||||||
|
- Límit de caràcters ampliat
|
||||||
|
- La consola ja no pausa al jugador
|
||||||
|
- Reorganització del sistema de comandos i aliases (`show info`, `hide info`, etc.)
|
||||||
|
- **RenderInfo:** nova classe amb animació per a mostrar info de renderitzat en pantalla
|
||||||
|
- **Suport multi-shader:** comandos i tecles per a manejar el nou disseny de shaders (SPIRV/SPIR-V)
|
||||||
|
- **Mode kiosc:** defaults i restriccions de comandos per a mode kiosc
|
||||||
|
- **Supersampling Lanczos:** implementació d'escalat Lanczos en el supersampling
|
||||||
|
- **Driver GPU configurable:** permet triar driver de GPU o cap des de la consola
|
||||||
|
- Cheats accessibles des de la consola
|
||||||
|
- Canvi i reinici d'escena des de la consola
|
||||||
|
- Posició i habitació inicial de debug configurables des de la consola i fitxer
|
||||||
|
- `Debug` carrega posició i habitació inicial des de fitxer
|
||||||
|
- Comandos d'àudio configurables des de la consola
|
||||||
|
- Renderitzat del dispositiu GPU en info_debug
|
||||||
|
- `Screen` optimitzat (`textureToRenderer()`)
|
||||||
|
- Eliminat suport per a arguments de línia de comandos
|
||||||
|
- Eliminat `Options::console`
|
||||||
|
- Help de consola organitzat
|
||||||
|
|
||||||
|
### Correccions
|
||||||
|
- Fix: vsync off no funcionava en Wayland
|
||||||
|
- Fix: en TITLE, la consola no bloquejava la pulsació de l'1 al 4 i entrava a opcions
|
||||||
|
- Fix: dos logs de consola amb format incorrecte
|
||||||
|
- Fix: lògica per a obrir i entrar a la jail (ara gasta número d'habitació, no nom)
|
||||||
|
- Corregit `compile_spirv.cmake` i la `system_folder` per a shaders
|
||||||
|
- Corregit caràcter de caret que s'havia perdut
|
||||||
|
- Eliminats accents en títols d'habitacions que causaven problemes amb fonts
|
||||||
|
- Revisades i corregides traduccions
|
||||||
|
- Corregits fitxers `.fnt`
|
||||||
|
- Correcció en `Screen` per a `std::setprecision()` (faltava `#include <iomanip>`)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v1.09] - 2025-03-01
|
||||||
|
|
||||||
|
### Novetats
|
||||||
|
- **Refactorització a singletons:** `Screen`, `Input`, `Audio`, `Resource::Cache`, `Resource::List`, `Director`, `Cheevos`, `Debug` convertits a singletons thread-safe
|
||||||
|
- **Smart pointers:** ús de `std::shared_ptr` i `std::unique_ptr` per a gestió de recursos i sprites
|
||||||
|
- **Surfaces 8-bit indexades:** nou sistema de renderitzat amb color indexat i paletes intercanviables
|
||||||
|
- **Sistema de notificacions redissenyat:** nou engine de notificacions amb control d'offset
|
||||||
|
- **Modes de vídeo millorats:** la finestra manté posició al canviar tamany o activar borde; pot créixer segons l'escriptori
|
||||||
|
- **ItemTracker:** nou singleton per a rastrejar ítems arreplegats
|
||||||
|
- **globalEvents:** nou sistema d'events globals SDL
|
||||||
|
- **Barra de progrés en càrrega de recursos** (actualització cada 5 ítems per a major rendiment amb vsync)
|
||||||
|
- **Mètodes show/hide finestra:** mètodes per a mostrar o amagar la finestra
|
||||||
|
- Afinada la classe `Options`
|
||||||
|
- Actualitzada a l'última versió de `jail_audio`
|
||||||
|
- Implementats shaders
|
||||||
|
- Nova tipografia afegida
|
||||||
|
- Paràmetres de fitxers `.ani` migrats a snake_case
|
||||||
|
- Música de Title i attract mode restaurada
|
||||||
|
- Eliminat sistema online complet
|
||||||
|
|
||||||
|
### Correccions
|
||||||
|
- Fix: notificacions ja no embruten la pantalla de càrrega
|
||||||
|
- Fix: no pintava l'efecte de càrrega del borde en `LoadingScreen`
|
||||||
|
- Fix: bug amb el punter a `ScoreboardData`
|
||||||
|
- Fix: càrrega d'opcions i recursos corregida
|
||||||
|
- Eliminats accents problemàtics
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v1.08] - 2024-02-22
|
||||||
|
|
||||||
|
### Novetats
|
||||||
|
- Possibilitat de saltar la pantalla de càrrega ja completada des del menú de títol
|
||||||
|
- El `gamestate_title` pot començar en diferents estats
|
||||||
|
- Pantalla de càrrega amb fade de paleta
|
||||||
|
- GIF loader: dibuixat correcte de GIFs en pantalla
|
||||||
|
- Afegida `paleta.cpp`/`.h` i `gif.c`
|
||||||
|
|
||||||
|
### Correccions
|
||||||
|
- Corregit bug en el fade de paleta (el canal blau no es propagava)
|
||||||
|
- Arreglada la separació entre el títol i el fade
|
||||||
|
- Online deshabilitat per defecte al crear el fitxer de configuració
|
||||||
|
- Temps de la pantalla de càrrega augmentat
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v1.07] - 2022-12-02
|
||||||
|
|
||||||
|
### Novetats
|
||||||
|
- El nom de l'habitació es pinta a partir d'una textura
|
||||||
|
- Afegit Batman a FEEL THE HEAT
|
||||||
|
- Cel de la Jail actualitzat
|
||||||
|
- Retocada la pantalla de títol
|
||||||
|
- Sprite de PACO modificat
|
||||||
|
- Nom de l'enemic diskette canviat a floppy
|
||||||
|
- Canvis cosmètics en algunes habitacions (BE CAREFUL WITH THE FUSE reanomenat)
|
||||||
|
- El color de fons de l'habitació es pinta en la textura del mapa
|
||||||
|
- Optimitzacions en intro i title
|
||||||
|
- Preparació per a compatibilitat amb consoles
|
||||||
|
- Actualitzat `jail_audio` a l'última versió
|
||||||
|
- Eliminats la major part d'accessos a `vector::at()`
|
||||||
|
|
||||||
|
### Correccions
|
||||||
|
- Corregit bug: en la jail es rellenaven les vides mentre estava activa la pausa
|
||||||
|
- Corregit memory leak en `texture.cpp`
|
||||||
|
- Corregit bug en obertura de la Jail
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v1.0] - 2022-11-13
|
||||||
|
|
||||||
|
Versió de llançament inicial.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*El format d'este changelog seguix [Keep a Changelog](https://keepachangelog.com/).*
|
||||||
154
CLAUDE.md
154
CLAUDE.md
@@ -53,7 +53,7 @@ cmake --build build --clean-first
|
|||||||
./jaildoctors_dilemma
|
./jaildoctors_dilemma
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important:** The build directory is `/Users/sergio/Gitea/jaildoctors_dilemma/build` and the output executable is placed in the project root directory.
|
**Important:** The build directory is `build/` relative to the project root and the output executable is placed in the project root directory.
|
||||||
|
|
||||||
### Testing in Headless Environment (SSH/Remote Server)
|
### Testing in Headless Environment (SSH/Remote Server)
|
||||||
|
|
||||||
@@ -67,17 +67,12 @@ sudo apt-get install xvfb
|
|||||||
|
|
||||||
#### Running the Game in Headless Mode
|
#### Running the Game in Headless Mode
|
||||||
|
|
||||||
**Option 1: Using the wrapper script (RECOMMENDED)**
|
**Option 1: Using xvfb-run directly (RECOMMENDED)**
|
||||||
```bash
|
|
||||||
./run_headless.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
**Option 2: Using xvfb-run directly**
|
|
||||||
```bash
|
```bash
|
||||||
xvfb-run -a ./jaildoctors_dilemma
|
xvfb-run -a ./jaildoctors_dilemma
|
||||||
```
|
```
|
||||||
|
|
||||||
**Option 3: Custom display configuration**
|
**Option 2: Custom display configuration**
|
||||||
```bash
|
```bash
|
||||||
xvfb-run -a -s "-screen 0 1280x720x24" ./jaildoctors_dilemma
|
xvfb-run -a -s "-screen 0 1280x720x24" ./jaildoctors_dilemma
|
||||||
```
|
```
|
||||||
@@ -238,26 +233,39 @@ The architecture follows a **layered, modular design** with clear separation of
|
|||||||
source/
|
source/
|
||||||
├── core/ # Core engine systems
|
├── core/ # Core engine systems
|
||||||
│ ├── audio/ # Audio management
|
│ ├── audio/ # Audio management
|
||||||
│ │ └── audio.hpp/cpp # Audio singleton (music, sounds, volumes)
|
│ │ ├── audio.hpp/cpp # Audio singleton (music, sounds, volumes)
|
||||||
|
│ │ └── jail_audio.hpp # Custom jail_audio library wrapper
|
||||||
│ ├── input/ # Input handling
|
│ ├── input/ # Input handling
|
||||||
│ │ ├── input.hpp/cpp # Input manager (keyboard, gamepad)
|
│ │ ├── input.hpp/cpp # Input manager (keyboard, gamepad)
|
||||||
|
│ │ ├── input_types.hpp # Input type definitions
|
||||||
│ │ ├── global_inputs.hpp # Global input state
|
│ │ ├── global_inputs.hpp # Global input state
|
||||||
│ │ └── mouse.hpp # Mouse input
|
│ │ └── mouse.hpp # Mouse input
|
||||||
|
│ ├── locale/ # Localization
|
||||||
|
│ │ └── locale.hpp # Locale/language support
|
||||||
│ ├── rendering/ # Graphics rendering
|
│ ├── rendering/ # Graphics rendering
|
||||||
│ │ ├── screen.hpp/cpp # Screen/window singleton, SDL renderer
|
│ │ ├── screen.hpp/cpp # Screen/window singleton, SDL renderer
|
||||||
│ │ ├── surface.hpp/cpp # 8-bit indexed color surface abstraction
|
│ │ ├── surface.hpp/cpp # 8-bit indexed color surface abstraction
|
||||||
│ │ ├── surface_sprite.hpp # Static sprite rendering
|
│ │ ├── sprite/ # Sprite rendering classes
|
||||||
│ │ ├── surface_animated_sprite.hpp # Animated sprite with frame data
|
│ │ │ ├── sprite.hpp # Static sprite rendering
|
||||||
│ │ ├── surface_moving_sprite.hpp # Moving sprite with velocity
|
│ │ │ ├── animated_sprite.hpp # Animated sprite with frame data
|
||||||
│ │ ├── texture.hpp/cpp # SDL texture wrapper
|
│ │ │ ├── moving_sprite.hpp # Moving sprite with velocity
|
||||||
|
│ │ │ └── dissolve_sprite.hpp # Dissolve transition sprite
|
||||||
│ │ ├── text.hpp/cpp # Text rendering system
|
│ │ ├── text.hpp/cpp # Text rendering system
|
||||||
│ │ ├── gif.hpp/cpp # GIF image loader
|
│ │ ├── gif.hpp/cpp # GIF image loader
|
||||||
│ │ ├── opengl/ # OpenGL shader backend
|
│ │ ├── pixel_reveal.hpp # Pixel reveal effect
|
||||||
│ │ │ └── opengl_shader.hpp/cpp # CRT shader effects
|
│ │ ├── render_info.hpp # Render information data
|
||||||
|
│ │ ├── palette_manager.hpp # Palette management
|
||||||
|
│ │ ├── sdl3gpu/ # SDL3 GPU shader backend
|
||||||
|
│ │ │ ├── sdl3gpu_shader.hpp/cpp # CRT/post-processing shader effects
|
||||||
|
│ │ │ └── *_spv.h # Pre-compiled SPIR-V shader headers
|
||||||
│ │ └── shader_backend.hpp # Abstract shader interface
|
│ │ └── shader_backend.hpp # Abstract shader interface
|
||||||
│ ├── resources/ # Asset & Resource management
|
│ ├── resources/ # Asset & Resource management
|
||||||
│ │ ├── asset.hpp/cpp # Asset registry (file path mapping)
|
│ │ ├── resource_list.hpp # Asset path registry (O(1) lookups)
|
||||||
│ │ └── resource.hpp/cpp # Resource singleton (loads/caches assets)
|
│ │ ├── resource_cache.hpp # Resource caching singleton
|
||||||
|
│ │ ├── resource_loader.hpp # Asset loading logic
|
||||||
|
│ │ ├── resource_pack.hpp # Resource pack handling
|
||||||
|
│ │ ├── resource_helper.hpp # Resource utility functions
|
||||||
|
│ │ └── resource_types.hpp # Resource type definitions
|
||||||
│ └── system/ # System management
|
│ └── system/ # System management
|
||||||
│ ├── director.hpp/cpp # Main application controller
|
│ ├── director.hpp/cpp # Main application controller
|
||||||
│ ├── debug.hpp/cpp # Debug info overlay
|
│ ├── debug.hpp/cpp # Debug info overlay
|
||||||
@@ -268,8 +276,13 @@ source/
|
|||||||
│ │ ├── enemy.hpp/cpp # Enemy entities
|
│ │ ├── enemy.hpp/cpp # Enemy entities
|
||||||
│ │ └── item.hpp/cpp # Collectible items
|
│ │ └── item.hpp/cpp # Collectible items
|
||||||
│ ├── gameplay/ # Core gameplay systems
|
│ ├── gameplay/ # Core gameplay systems
|
||||||
│ │ ├── room.hpp/cpp # Room/level logic, tilemap, collision
|
│ │ ├── room.hpp/cpp # Room/level logic, collision
|
||||||
|
│ │ ├── room_loader.hpp/cpp # Room loading from YAML files
|
||||||
│ │ ├── room_tracker.hpp/cpp # Tracks visited rooms
|
│ │ ├── room_tracker.hpp/cpp # Tracks visited rooms
|
||||||
|
│ │ ├── collision_map.hpp/cpp # Collision map data
|
||||||
|
│ │ ├── tilemap_renderer.hpp/cpp # Tilemap rendering
|
||||||
|
│ │ ├── enemy_manager.hpp/cpp # Enemy lifecycle management
|
||||||
|
│ │ ├── item_manager.hpp/cpp # Item lifecycle management
|
||||||
│ │ ├── scoreboard.hpp/cpp # Score display & data
|
│ │ ├── scoreboard.hpp/cpp # Score display & data
|
||||||
│ │ ├── item_tracker.hpp/cpp # Tracks collected items
|
│ │ ├── item_tracker.hpp/cpp # Tracks collected items
|
||||||
│ │ ├── stats.hpp/cpp # Game statistics
|
│ │ ├── stats.hpp/cpp # Game statistics
|
||||||
@@ -284,18 +297,20 @@ source/
|
|||||||
│ │ ├── ending2.hpp/cpp # Ending sequence 2
|
│ │ ├── ending2.hpp/cpp # Ending sequence 2
|
||||||
│ │ └── credits.hpp/cpp # Credits screen
|
│ │ └── credits.hpp/cpp # Credits screen
|
||||||
│ ├── ui/ # User interface
|
│ ├── ui/ # User interface
|
||||||
│ │ └── notifier.hpp/cpp # Achievement/notification display
|
│ │ ├── notifier.hpp/cpp # Achievement/notification display
|
||||||
|
│ │ ├── console.hpp/cpp # In-game debug console
|
||||||
|
│ │ └── console_commands.hpp/cpp # Console command definitions
|
||||||
│ ├── options.hpp/cpp # Game configuration/options
|
│ ├── options.hpp/cpp # Game configuration/options
|
||||||
|
│ ├── game_control.hpp # Game control logic
|
||||||
│ ├── scene_manager.hpp # Scene flow state machine
|
│ ├── scene_manager.hpp # Scene flow state machine
|
||||||
│ ├── defaults.hpp # Game defaults constants
|
│ └── defaults.hpp # Game defaults constants
|
||||||
│ └── gameplay.hpp # Gameplay constants
|
|
||||||
├── external/ # Third-party libraries
|
├── external/ # Third-party libraries
|
||||||
│ ├── jail_audio.hpp/cpp # Custom audio library
|
│ ├── fkyaml_node.hpp # YAML parsing library
|
||||||
│ ├── jail_audio.h # C interface for jail_audio
|
|
||||||
│ ├── stb_image.h # Image loading library
|
│ ├── stb_image.h # Image loading library
|
||||||
│ └── stb_vorbis.h # OGG Vorbis audio decoding
|
│ └── stb_vorbis.h # OGG Vorbis audio decoding
|
||||||
├── utils/ # Utility code
|
├── utils/ # Utility code
|
||||||
│ ├── delta_timer.hpp/cpp # Frame-rate independent timing
|
│ ├── delta_timer.hpp/cpp # Frame-rate independent timing
|
||||||
|
│ ├── easing_functions.hpp # Easing/interpolation functions
|
||||||
│ ├── defines.hpp # Game constants (resolutions, block sizes)
|
│ ├── defines.hpp # Game constants (resolutions, block sizes)
|
||||||
│ └── utils.hpp/cpp # Helper functions (colors, math)
|
│ └── utils.hpp/cpp # Helper functions (colors, math)
|
||||||
└── main.cpp # Application entry point
|
└── main.cpp # Application entry point
|
||||||
@@ -360,7 +375,7 @@ The game uses a scene manager to control application flow:
|
|||||||
// namespace SceneManager
|
// namespace SceneManager
|
||||||
enum class Scene {
|
enum class Scene {
|
||||||
LOGO, LOADING_SCREEN, TITLE, CREDITS, GAME, DEMO,
|
LOGO, LOADING_SCREEN, TITLE, CREDITS, GAME, DEMO,
|
||||||
GAME_OVER, ENDING, ENDING2, QUIT
|
GAME_OVER, ENDING, ENDING2, RESTART_CURRENT, QUIT
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Scene current = Scene::LOGO; // Global scene state
|
inline Scene current = Scene::LOGO; // Global scene state
|
||||||
@@ -397,9 +412,10 @@ Display
|
|||||||
|
|
||||||
**Key Components:**
|
**Key Components:**
|
||||||
- `Surface` - 8-bit indexed pixel buffer with palette support
|
- `Surface` - 8-bit indexed pixel buffer with palette support
|
||||||
- `SurfaceSprite` - Renders a fixed region of a surface
|
- `Sprite` - Renders a fixed region of a surface
|
||||||
- `SurfaceAnimatedSprite` - Frame-based animation on top of sprite
|
- `AnimatedSprite` - Frame-based animation on top of sprite
|
||||||
- `SurfaceMovingSprite` - Adds velocity/position to animated sprite
|
- `MovingSprite` - Adds velocity/position to animated sprite
|
||||||
|
- `DissolveSprite` - Dissolve transition effect sprite
|
||||||
- Supports color replacement, palette swapping, and shader effects (CRT)
|
- Supports color replacement, palette swapping, and shader effects (CRT)
|
||||||
|
|
||||||
### 3.5 Tile-Based Collision System
|
### 3.5 Tile-Based Collision System
|
||||||
@@ -439,8 +455,8 @@ struct AnimationData {
|
|||||||
int counter;
|
int counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Loaded from .ani files (list of animation names)
|
// Loaded from .yaml animation definition files
|
||||||
// Rendered with SurfaceAnimatedSprite
|
// Rendered with AnimatedSprite
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -454,7 +470,7 @@ main()
|
|||||||
↓
|
↓
|
||||||
Director::Director() [Initialization]
|
Director::Director() [Initialization]
|
||||||
├─ Resource::List::init() - Initialize asset registry singleton
|
├─ Resource::List::init() - Initialize asset registry singleton
|
||||||
├─ Director::setFileList() - Load assets.yaml configuration (no verification)
|
├─ Director::setFileList() - Load assets.yaml via Resource::List (no verification)
|
||||||
├─ Options::loadFromFile() - Load game configuration
|
├─ Options::loadFromFile() - Load game configuration
|
||||||
├─ Audio::init() - Initialize SDL audio
|
├─ Audio::init() - Initialize SDL audio
|
||||||
├─ Screen::init() - Create window, SDL renderer
|
├─ Screen::init() - Create window, SDL renderer
|
||||||
@@ -510,7 +526,7 @@ Game::run() {
|
|||||||
|
|
||||||
```
|
```
|
||||||
Director::setFileList()
|
Director::setFileList()
|
||||||
└─ Asset::loadFromFile(config_path, PREFIX, system_folder_)
|
└─ Resource::List::loadFromFile(config_path, PREFIX, system_folder_)
|
||||||
├─ Read config/assets.yaml - Parse text configuration file
|
├─ Read config/assets.yaml - Parse text configuration file
|
||||||
├─ Parse YAML structure: assets grouped by category
|
├─ Parse YAML structure: assets grouped by category
|
||||||
├─ Replace variables (${PREFIX}, ${SYSTEM_FOLDER})
|
├─ Replace variables (${PREFIX}, ${SYSTEM_FOLDER})
|
||||||
@@ -570,7 +586,7 @@ Game code
|
|||||||
|
|
||||||
**Classes:**
|
**Classes:**
|
||||||
- `PascalCase` for classes: `Player`, `Room`, `Screen`, `Director`
|
- `PascalCase` for classes: `Player`, `Room`, `Screen`, `Director`
|
||||||
- Suffix `Sprite` for sprite classes: `SurfaceSprite`, `SurfaceAnimatedSprite`
|
- Suffix `Sprite` for sprite classes: `Sprite`, `AnimatedSprite`, `MovingSprite`
|
||||||
|
|
||||||
**Methods:**
|
**Methods:**
|
||||||
- `get*()` for getters: `getWidth()`, `getRect()`
|
- `get*()` for getters: `getWidth()`, `getRect()`
|
||||||
@@ -613,8 +629,9 @@ Provides **time scaling** for slow-motion effects.
|
|||||||
### 5.4 Palette System
|
### 5.4 Palette System
|
||||||
|
|
||||||
- 8-bit indexed color (256 colors per palette)
|
- 8-bit indexed color (256 colors per palette)
|
||||||
- Multiple palettes can be loaded and swapped
|
- Multiple palettes can be loaded and swapped via `PaletteManager`
|
||||||
- `Surface::setPalette()` changes rendering colors
|
- `Screen::setPaletteByName()` changes the active palette
|
||||||
|
- Supports palette sort modes (by luminosity, similarity to Spectrum palette, etc.)
|
||||||
- Supports color replacement per-render: `renderWithColorReplace()`
|
- Supports color replacement per-render: `renderWithColorReplace()`
|
||||||
- CRT shader effects can modify colors in real-time
|
- CRT shader effects can modify colors in real-time
|
||||||
|
|
||||||
@@ -664,7 +681,7 @@ Achievements trigger notifications on unlock.
|
|||||||
| Component | Technology | Version | Role |
|
| Component | Technology | Version | Role |
|
||||||
|-----------|-----------|---------|------|
|
|-----------|-----------|---------|------|
|
||||||
| **Graphics** | SDL3 | Latest | Window, rendering, input |
|
| **Graphics** | SDL3 | Latest | Window, rendering, input |
|
||||||
| **GPU Rendering** | OpenGL | 3.2+ | Shader effects (CRT) |
|
| **GPU Rendering** | SDL3 GPU | Latest | Shader effects (CRT, post-processing via SPIR-V) |
|
||||||
| **Audio** | SDL3 Audio | Latest | Audio device, mixing |
|
| **Audio** | SDL3 Audio | Latest | Audio device, mixing |
|
||||||
| **Audio Decoding** | jail_audio (custom) | 1.x | OGG/WAV playback |
|
| **Audio Decoding** | jail_audio (custom) | 1.x | OGG/WAV playback |
|
||||||
| **Image Loading** | stb_image | v2.x | PNG/GIF image loading |
|
| **Image Loading** | stb_image | v2.x | PNG/GIF image loading |
|
||||||
@@ -700,6 +717,7 @@ Achievements trigger notifications on unlock.
|
|||||||
| `Audio` | Music and SFX playback | Singleton |
|
| `Audio` | Music and SFX playback | Singleton |
|
||||||
| `Resource::Cache` | Asset caching and loading (with detailed error messages) | Singleton |
|
| `Resource::Cache` | Asset caching and loading (with detailed error messages) | Singleton |
|
||||||
| `Resource::List` | Asset path registry from config/assets.yaml, O(1) lookups, variable substitution | Singleton |
|
| `Resource::List` | Asset path registry from config/assets.yaml, O(1) lookups, variable substitution | Singleton |
|
||||||
|
| `PaletteManager` | Palette loading, switching, and sorting | Managed by Screen |
|
||||||
| `Debug` | Debug overlay information | Singleton |
|
| `Debug` | Debug overlay information | Singleton |
|
||||||
| `globalEvents` | Global SDL event handling (quit, device reset, mouse) | Namespace |
|
| `globalEvents` | Global SDL event handling (quit, device reset, mouse) | Namespace |
|
||||||
|
|
||||||
@@ -709,7 +727,12 @@ Achievements trigger notifications on unlock.
|
|||||||
|-------|---------|
|
|-------|---------|
|
||||||
| `Game` | Main gameplay scene, orchestrates update/render |
|
| `Game` | Main gameplay scene, orchestrates update/render |
|
||||||
| `Player` | Player entity with physics and animation |
|
| `Player` | Player entity with physics and animation |
|
||||||
| `Room` | Level data, collision detection, tilemap rendering |
|
| `Room` | Level data, collision detection |
|
||||||
|
| `RoomLoader` | Room loading from YAML files |
|
||||||
|
| `TilemapRenderer` | Tilemap rendering |
|
||||||
|
| `CollisionMap` | Collision map data |
|
||||||
|
| `EnemyManager` | Enemy lifecycle management |
|
||||||
|
| `ItemManager` | Item lifecycle management |
|
||||||
| `Enemy` | Enemy entity behavior and rendering |
|
| `Enemy` | Enemy entity behavior and rendering |
|
||||||
| `Item` | Collectible items |
|
| `Item` | Collectible items |
|
||||||
| `Scoreboard` | HUD display data |
|
| `Scoreboard` | HUD display data |
|
||||||
@@ -722,17 +745,20 @@ Achievements trigger notifications on unlock.
|
|||||||
| Class | Purpose |
|
| Class | Purpose |
|
||||||
|-------|---------|
|
|-------|---------|
|
||||||
| `Surface` | 8-bit indexed color pixel buffer with palette |
|
| `Surface` | 8-bit indexed color pixel buffer with palette |
|
||||||
| `SurfaceSprite` | Renders a sprite region |
|
| `Sprite` | Renders a sprite region |
|
||||||
| `SurfaceAnimatedSprite` | Frame-based animation rendering |
|
| `AnimatedSprite` | Frame-based animation rendering |
|
||||||
| `SurfaceMovingSprite` | Sprite with velocity/position |
|
| `MovingSprite` | Sprite with velocity/position |
|
||||||
|
| `DissolveSprite` | Dissolve transition sprite |
|
||||||
| `Text` | Text rendering system |
|
| `Text` | Text rendering system |
|
||||||
| `OpenGLShader` | Shader compilation and effects |
|
| `Sdl3gpuShader` | SDL3 GPU shader compilation and effects |
|
||||||
|
| `PaletteManager` | Palette loading and management |
|
||||||
|
|
||||||
### Utility Classes
|
### Utility Classes
|
||||||
|
|
||||||
| Class | Purpose |
|
| Class/Header | Purpose |
|
||||||
|-------|---------|
|
|-------|---------|
|
||||||
| `DeltaTimer` | Frame-rate independent timing |
|
| `DeltaTimer` | Frame-rate independent timing |
|
||||||
|
| `easing_functions.hpp` | Easing/interpolation functions for animations |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -848,7 +874,7 @@ assets:
|
|||||||
- type: BITMAP
|
- type: BITMAP
|
||||||
path: ${PREFIX}/data/font/smb2.gif
|
path: ${PREFIX}/data/font/smb2.gif
|
||||||
- type: FONT
|
- type: FONT
|
||||||
path: ${PREFIX}/data/font/smb2.txt
|
path: ${PREFIX}/data/font/smb2.fnt
|
||||||
|
|
||||||
# PLAYER
|
# PLAYER
|
||||||
player:
|
player:
|
||||||
@@ -892,23 +918,26 @@ assets:
|
|||||||
- `${PREFIX}` - Replaced with `/../Resources` on macOS bundles, empty otherwise
|
- `${PREFIX}` - Replaced with `/../Resources` on macOS bundles, empty otherwise
|
||||||
- `${SYSTEM_FOLDER}` - Replaced with user's system config folder
|
- `${SYSTEM_FOLDER}` - Replaced with user's system config folder
|
||||||
|
|
||||||
### Animation Files (.ani)
|
### Animation Files (.yaml)
|
||||||
List of animation names, one per line:
|
YAML-based animation definitions with frame data:
|
||||||
```
|
```yaml
|
||||||
default
|
animations:
|
||||||
jump
|
- name: default
|
||||||
run
|
frameWidth: 16
|
||||||
fall
|
frameHeight: 16
|
||||||
|
speed: 100
|
||||||
|
loop: 0
|
||||||
|
frames: [...]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Room Data Files (.room)
|
### Room Data Files (.yaml)
|
||||||
Key-value pairs defining room properties:
|
YAML-based room definitions:
|
||||||
```
|
```yaml
|
||||||
number=01
|
room:
|
||||||
name=Starting Room
|
name_en: Starting Room
|
||||||
bg_color=0x000000
|
bgColor: 0x000000
|
||||||
border_color=0xFF00FF
|
connections: [...]
|
||||||
...
|
tilemap: [...]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tilemap Files (.tmx)
|
### Tilemap Files (.tmx)
|
||||||
@@ -923,7 +952,8 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
|
|||||||
|
|
||||||
### For Graphics Issues
|
### For Graphics Issues
|
||||||
- `Screen::render()` - Main rendering method
|
- `Screen::render()` - Main rendering method
|
||||||
- `Screen::setPalete()` - Palette application
|
- `Screen::setPaletteByName()` - Palette switching
|
||||||
|
- `PaletteManager` - Palette loading and sorting
|
||||||
- `Surface` class - Pixel buffer operations
|
- `Surface` class - Pixel buffer operations
|
||||||
|
|
||||||
### For Input Issues
|
### For Input Issues
|
||||||
@@ -942,10 +972,10 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
|
|||||||
|
|
||||||
### For Asset Management
|
### For Asset Management
|
||||||
- `config/assets.yaml` - Asset configuration file (text-based, no recompilation needed)
|
- `config/assets.yaml` - Asset configuration file (text-based, no recompilation needed)
|
||||||
- `Asset::loadFromFile()` - Loads assets from config file
|
- `Resource::List::loadFromFile()` - Loads asset registry from config file
|
||||||
- `Resource::List::get()` - Retrieves asset path (O(1) lookup with unordered_map)
|
- `Resource::List::get()` - Retrieves asset path (O(1) lookup with unordered_map)
|
||||||
- `Resource::load()` - Asset loading
|
- `Resource::Cache` - Asset loading and caching
|
||||||
- `Director::setFileList()` - Calls `Asset::loadFromFile()` with PREFIX and system_folder
|
- `Director::setFileList()` - Calls `Resource::List::loadFromFile()` with PREFIX and system_folder
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -985,6 +1015,6 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Last Updated:** November 2022 (per README)
|
**Last Updated:** April 2026
|
||||||
**Original Author:** JailDesigner
|
**Original Author:** JailDesigner
|
||||||
**Repository:** Gitea (internal)
|
**Repository:** Gitea (internal)
|
||||||
|
|||||||
110
CMakeLists.txt
110
CMakeLists.txt
@@ -34,31 +34,32 @@ set(APP_SOURCES
|
|||||||
|
|
||||||
# Core - Input
|
# Core - Input
|
||||||
source/core/input/global_inputs.cpp
|
source/core/input/global_inputs.cpp
|
||||||
source/core/input/input.cpp
|
|
||||||
source/core/input/input_types.cpp
|
source/core/input/input_types.cpp
|
||||||
|
source/core/input/input.cpp
|
||||||
source/core/input/mouse.cpp
|
source/core/input/mouse.cpp
|
||||||
|
|
||||||
# Core - Rendering
|
# Core - Rendering
|
||||||
source/core/rendering/gif.cpp
|
source/core/rendering/gif.cpp
|
||||||
|
source/core/rendering/palette_manager.cpp
|
||||||
source/core/rendering/pixel_reveal.cpp
|
source/core/rendering/pixel_reveal.cpp
|
||||||
|
source/core/rendering/render_info.cpp
|
||||||
source/core/rendering/screen.cpp
|
source/core/rendering/screen.cpp
|
||||||
|
source/core/rendering/sprite/animated_sprite.cpp
|
||||||
|
source/core/rendering/sprite/dissolve_sprite.cpp
|
||||||
|
source/core/rendering/sprite/moving_sprite.cpp
|
||||||
|
source/core/rendering/sprite/sprite.cpp
|
||||||
source/core/rendering/surface.cpp
|
source/core/rendering/surface.cpp
|
||||||
source/core/rendering/surface_animated_sprite.cpp
|
|
||||||
source/core/rendering/surface_dissolve_sprite.cpp
|
|
||||||
source/core/rendering/surface_moving_sprite.cpp
|
|
||||||
source/core/rendering/surface_sprite.cpp
|
|
||||||
source/core/rendering/text.cpp
|
source/core/rendering/text.cpp
|
||||||
source/core/rendering/texture.cpp
|
|
||||||
|
|
||||||
# Core - Locale
|
# Core - Locale
|
||||||
source/core/locale/locale.cpp
|
source/core/locale/locale.cpp
|
||||||
|
|
||||||
# Core - Resources
|
# Core - Resources
|
||||||
source/core/resources/resource_list.cpp
|
|
||||||
source/core/resources/resource_cache.cpp
|
source/core/resources/resource_cache.cpp
|
||||||
source/core/resources/resource_pack.cpp
|
|
||||||
source/core/resources/resource_loader.cpp
|
|
||||||
source/core/resources/resource_helper.cpp
|
source/core/resources/resource_helper.cpp
|
||||||
|
source/core/resources/resource_list.cpp
|
||||||
|
source/core/resources/resource_loader.cpp
|
||||||
|
source/core/resources/resource_pack.cpp
|
||||||
|
|
||||||
# Core - System
|
# Core - System
|
||||||
source/core/system/director.cpp
|
source/core/system/director.cpp
|
||||||
@@ -78,9 +79,9 @@ set(APP_SOURCES
|
|||||||
source/game/gameplay/enemy_manager.cpp
|
source/game/gameplay/enemy_manager.cpp
|
||||||
source/game/gameplay/item_manager.cpp
|
source/game/gameplay/item_manager.cpp
|
||||||
source/game/gameplay/item_tracker.cpp
|
source/game/gameplay/item_tracker.cpp
|
||||||
source/game/gameplay/room.cpp
|
|
||||||
source/game/gameplay/room_loader.cpp
|
source/game/gameplay/room_loader.cpp
|
||||||
source/game/gameplay/room_tracker.cpp
|
source/game/gameplay/room_tracker.cpp
|
||||||
|
source/game/gameplay/room.cpp
|
||||||
source/game/gameplay/scoreboard.cpp
|
source/game/gameplay/scoreboard.cpp
|
||||||
source/game/gameplay/stats.cpp
|
source/game/gameplay/stats.cpp
|
||||||
source/game/gameplay/tilemap_renderer.cpp
|
source/game/gameplay/tilemap_renderer.cpp
|
||||||
@@ -89,13 +90,22 @@ set(APP_SOURCES
|
|||||||
source/game/scenes/credits.cpp
|
source/game/scenes/credits.cpp
|
||||||
source/game/scenes/ending.cpp
|
source/game/scenes/ending.cpp
|
||||||
source/game/scenes/ending2.cpp
|
source/game/scenes/ending2.cpp
|
||||||
source/game/scenes/game.cpp
|
|
||||||
source/game/scenes/game_over.cpp
|
source/game/scenes/game_over.cpp
|
||||||
|
source/game/scenes/game.cpp
|
||||||
source/game/scenes/loading_screen.cpp
|
source/game/scenes/loading_screen.cpp
|
||||||
source/game/scenes/logo.cpp
|
source/game/scenes/logo.cpp
|
||||||
source/game/scenes/title.cpp
|
source/game/scenes/title.cpp
|
||||||
|
|
||||||
|
# Game - Editor (debug only, guarded by #ifdef _DEBUG in source)
|
||||||
|
source/game/editor/map_editor.cpp
|
||||||
|
source/game/editor/editor_statusbar.cpp
|
||||||
|
source/game/editor/room_saver.cpp
|
||||||
|
source/game/editor/tile_picker.cpp
|
||||||
|
source/game/editor/mini_map.cpp
|
||||||
|
|
||||||
# Game - UI
|
# Game - UI
|
||||||
|
source/game/ui/console.cpp
|
||||||
|
source/game/ui/console_commands.cpp
|
||||||
source/game/ui/notifier.cpp
|
source/game/ui/notifier.cpp
|
||||||
|
|
||||||
# Utils
|
# Utils
|
||||||
@@ -124,32 +134,62 @@ message(STATUS "SDL3 encontrado: ${SDL3_INCLUDE_DIRS}")
|
|||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
find_program(GLSLC_EXE NAMES glslc)
|
find_program(GLSLC_EXE NAMES glslc)
|
||||||
|
|
||||||
set(SHADER_VERT_SRC "${CMAKE_SOURCE_DIR}/data/shaders/postfx.vert")
|
set(SHADERS_DIR "${CMAKE_SOURCE_DIR}/data/shaders")
|
||||||
set(SHADER_FRAG_SRC "${CMAKE_SOURCE_DIR}/data/shaders/postfx.frag")
|
set(HEADERS_DIR "${CMAKE_SOURCE_DIR}/source/core/rendering/sdl3gpu")
|
||||||
set(SHADER_VERT_H "${CMAKE_SOURCE_DIR}/source/core/rendering/sdl3gpu/postfx_vert_spv.h")
|
|
||||||
set(SHADER_FRAG_H "${CMAKE_SOURCE_DIR}/source/core/rendering/sdl3gpu/postfx_frag_spv.h")
|
set(SHADER_POSTFX_VERT_SRC "${SHADERS_DIR}/postfx.vert")
|
||||||
|
set(SHADER_POSTFX_FRAG_SRC "${SHADERS_DIR}/postfx.frag")
|
||||||
|
set(SHADER_UPSCALE_FRAG_SRC "${SHADERS_DIR}/upscale.frag")
|
||||||
|
set(SHADER_DOWNSCALE_FRAG_SRC "${SHADERS_DIR}/downscale.frag")
|
||||||
|
set(SHADER_CRTPI_FRAG_SRC "${SHADERS_DIR}/crtpi_frag.glsl")
|
||||||
|
|
||||||
|
set(SHADER_POSTFX_VERT_H "${HEADERS_DIR}/postfx_vert_spv.h")
|
||||||
|
set(SHADER_POSTFX_FRAG_H "${HEADERS_DIR}/postfx_frag_spv.h")
|
||||||
|
set(SHADER_UPSCALE_FRAG_H "${HEADERS_DIR}/upscale_frag_spv.h")
|
||||||
|
set(SHADER_DOWNSCALE_FRAG_H "${HEADERS_DIR}/downscale_frag_spv.h")
|
||||||
|
set(SHADER_CRTPI_FRAG_H "${HEADERS_DIR}/crtpi_frag_spv.h")
|
||||||
|
|
||||||
|
set(ALL_SHADER_HEADERS
|
||||||
|
"${SHADER_POSTFX_VERT_H}"
|
||||||
|
"${SHADER_POSTFX_FRAG_H}"
|
||||||
|
"${SHADER_UPSCALE_FRAG_H}"
|
||||||
|
"${SHADER_DOWNSCALE_FRAG_H}"
|
||||||
|
"${SHADER_CRTPI_FRAG_H}"
|
||||||
|
)
|
||||||
|
set(ALL_SHADER_SOURCES
|
||||||
|
"${SHADER_POSTFX_VERT_SRC}"
|
||||||
|
"${SHADER_POSTFX_FRAG_SRC}"
|
||||||
|
"${SHADER_UPSCALE_FRAG_SRC}"
|
||||||
|
"${SHADER_DOWNSCALE_FRAG_SRC}"
|
||||||
|
"${SHADER_CRTPI_FRAG_SRC}"
|
||||||
|
)
|
||||||
|
|
||||||
if(GLSLC_EXE)
|
if(GLSLC_EXE)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT "${SHADER_VERT_H}" "${SHADER_FRAG_H}"
|
OUTPUT ${ALL_SHADER_HEADERS}
|
||||||
COMMAND "${CMAKE_SOURCE_DIR}/tools/shaders/compile_spirv.sh"
|
COMMAND ${CMAKE_COMMAND}
|
||||||
DEPENDS "${SHADER_VERT_SRC}" "${SHADER_FRAG_SRC}"
|
-D GLSLC=${GLSLC_EXE}
|
||||||
|
-D SHADERS_DIR=${SHADERS_DIR}
|
||||||
|
-D HEADERS_DIR=${HEADERS_DIR}
|
||||||
|
-P ${CMAKE_SOURCE_DIR}/tools/shaders/compile_spirv.cmake
|
||||||
|
DEPENDS ${ALL_SHADER_SOURCES}
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
COMMENT "Compilando shaders SPIR-V..."
|
COMMENT "Compilando shaders SPIR-V..."
|
||||||
)
|
)
|
||||||
add_custom_target(shaders DEPENDS "${SHADER_VERT_H}" "${SHADER_FRAG_H}")
|
add_custom_target(shaders DEPENDS ${ALL_SHADER_HEADERS})
|
||||||
message(STATUS "glslc encontrado: shaders se compilarán automáticamente")
|
message(STATUS "glslc encontrado: shaders se compilarán automáticamente")
|
||||||
else()
|
else()
|
||||||
if(NOT EXISTS "${SHADER_VERT_H}" OR NOT EXISTS "${SHADER_FRAG_H}")
|
foreach(HDR ${ALL_SHADER_HEADERS})
|
||||||
message(FATAL_ERROR
|
if(NOT EXISTS "${HDR}")
|
||||||
"glslc no encontrado y headers SPIR-V no existen.\n"
|
message(FATAL_ERROR
|
||||||
" Instala glslc: sudo apt install glslang-tools (Linux)\n"
|
"glslc no encontrado y header SPIR-V no existe: ${HDR}\n"
|
||||||
" choco install vulkan-sdk (Windows)\n"
|
" Instala glslc: sudo apt install glslang-tools (Linux)\n"
|
||||||
" O genera los headers manualmente: tools/shaders/compile_spirv.sh"
|
" choco install vulkan-sdk (Windows)\n"
|
||||||
)
|
" O genera los headers manualmente: tools/shaders/compile_spirv.sh"
|
||||||
else()
|
)
|
||||||
message(STATUS "glslc no encontrado - usando headers SPIR-V precompilados")
|
endif()
|
||||||
endif()
|
endforeach()
|
||||||
|
message(STATUS "glslc no encontrado - usando headers SPIR-V precompilados")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "macOS: shaders SPIR-V omitidos (usa Metal)")
|
message(STATUS "macOS: shaders SPIR-V omitidos (usa Metal)")
|
||||||
@@ -192,7 +232,17 @@ if(WIN32)
|
|||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-deprecated)
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-deprecated)
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||||
|
endif()
|
||||||
|
if(MACOS_BUNDLE)
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUNDLE)
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE
|
||||||
|
-framework SDL3
|
||||||
|
-F ${CMAKE_SOURCE_DIR}/release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64
|
||||||
|
-rpath @executable_path/../Frameworks/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX AND NOT APPLE)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
311
Makefile
311
Makefile
@@ -18,25 +18,18 @@ RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
|||||||
RESOURCE_FILE := release/windows/jdd.res
|
RESOURCE_FILE := release/windows/jdd.res
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# PACKING TOOL
|
# TOOLS
|
||||||
# ==============================================================================
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
PACK_TOOL := $(DIR_TOOLS)pack_resources/pack_resources.exe
|
|
||||||
PACK_CXX := $(CXX)
|
|
||||||
else
|
|
||||||
PACK_TOOL := $(DIR_TOOLS)pack_resources/pack_resources
|
|
||||||
PACK_CXX := $(CXX)
|
|
||||||
endif
|
|
||||||
PACK_SOURCES := $(DIR_TOOLS)pack_resources/pack_resources.cpp source/core/resources/resource_pack.cpp
|
|
||||||
PACK_INCLUDES := -Isource
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# SHADERS
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
DIR_PACK_TOOL := $(DIR_TOOLS)pack_resources
|
||||||
SHADER_SCRIPT := $(DIR_ROOT)tools/shaders/compile_spirv.sh
|
SHADER_SCRIPT := $(DIR_ROOT)tools/shaders/compile_spirv.sh
|
||||||
SHADER_VERT_H := $(DIR_ROOT)source/core/rendering/sdl3gpu/postfx_vert_spv.h
|
SHADER_CMAKE := $(DIR_ROOT)tools/shaders/compile_spirv.cmake
|
||||||
SHADER_FRAG_H := $(DIR_ROOT)source/core/rendering/sdl3gpu/postfx_frag_spv.h
|
SHADERS_DIR := $(DIR_ROOT)data/shaders
|
||||||
GLSLC := $(shell command -v glslc 2>/dev/null)
|
HEADERS_DIR := $(DIR_ROOT)source/core/rendering/sdl3gpu
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
GLSLC := $(shell where glslc 2>NUL)
|
||||||
|
else
|
||||||
|
GLSLC := $(shell command -v glslc 2>/dev/null)
|
||||||
|
endif
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# VERSION (extracted from defines.hpp)
|
# VERSION (extracted from defines.hpp)
|
||||||
@@ -47,6 +40,14 @@ else
|
|||||||
VERSION := v$(shell grep 'constexpr const char\* VERSION' source/utils/defines.hpp | sed -E 's/.*VERSION = "([^"]+)".*/\1/')
|
VERSION := v$(shell grep 'constexpr const char\* VERSION' source/utils/defines.hpp | sed -E 's/.*VERSION = "([^"]+)".*/\1/')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# SHELL (Windows usa cmd.exe para que las recetas con powershell funcionen igual
|
||||||
|
# desde cualquier terminal: PowerShell, cmd o git-bash)
|
||||||
|
# ==============================================================================
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
SHELL := cmd.exe
|
||||||
|
endif
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# WINDOWS-SPECIFIC VARIABLES
|
# WINDOWS-SPECIFIC VARIABLES
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@@ -67,213 +68,116 @@ MACOS_APPLE_SILICON_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-macos-apple
|
|||||||
LINUX_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux.tar.gz
|
LINUX_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux.tar.gz
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SOURCE FILES
|
# PLATAFORMA
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
APP_SOURCES := \
|
|
||||||
source/main.cpp \
|
|
||||||
source/core/audio/audio.cpp \
|
|
||||||
source/core/input/input.cpp \
|
|
||||||
source/core/input/input_types.cpp \
|
|
||||||
source/core/input/mouse.cpp \
|
|
||||||
source/core/input/global_inputs.cpp \
|
|
||||||
source/core/rendering/screen.cpp \
|
|
||||||
source/core/rendering/surface.cpp \
|
|
||||||
source/core/rendering/surface_sprite.cpp \
|
|
||||||
source/core/rendering/surface_animated_sprite.cpp \
|
|
||||||
source/core/rendering/surface_moving_sprite.cpp \
|
|
||||||
source/core/rendering/text.cpp \
|
|
||||||
source/core/rendering/texture.cpp \
|
|
||||||
source/core/rendering/gif.cpp \
|
|
||||||
source/core/rendering/pixel_reveal.cpp \
|
|
||||||
source/core/rendering/surface_dissolve_sprite.cpp \
|
|
||||||
source/core/rendering/sdl3gpu/sdl3gpu_shader.cpp \
|
|
||||||
source/core/resources/resource_list.cpp \
|
|
||||||
source/core/resources/resource_cache.cpp \
|
|
||||||
source/core/resources/resource_helper.cpp \
|
|
||||||
source/core/resources/resource_loader.cpp \
|
|
||||||
source/core/resources/resource_pack.cpp \
|
|
||||||
source/core/system/director.cpp \
|
|
||||||
source/core/system/debug.cpp \
|
|
||||||
source/core/system/global_events.cpp \
|
|
||||||
source/game/options.cpp \
|
|
||||||
source/game/entities/player.cpp \
|
|
||||||
source/game/entities/enemy.cpp \
|
|
||||||
source/game/entities/item.cpp \
|
|
||||||
source/game/gameplay/room.cpp \
|
|
||||||
source/game/gameplay/collision_map.cpp \
|
|
||||||
source/game/gameplay/enemy_manager.cpp \
|
|
||||||
source/game/gameplay/item_manager.cpp \
|
|
||||||
source/game/gameplay/room_loader.cpp \
|
|
||||||
source/game/gameplay/tilemap_renderer.cpp \
|
|
||||||
source/game/gameplay/scoreboard.cpp \
|
|
||||||
source/game/gameplay/cheevos.cpp \
|
|
||||||
source/game/gameplay/item_tracker.cpp \
|
|
||||||
source/game/gameplay/room_tracker.cpp \
|
|
||||||
source/game/gameplay/stats.cpp \
|
|
||||||
source/game/scenes/logo.cpp \
|
|
||||||
source/game/scenes/loading_screen.cpp \
|
|
||||||
source/game/scenes/title.cpp \
|
|
||||||
source/game/scenes/game.cpp \
|
|
||||||
source/game/scenes/game_over.cpp \
|
|
||||||
source/game/scenes/ending.cpp \
|
|
||||||
source/game/scenes/ending2.cpp \
|
|
||||||
source/game/scenes/credits.cpp \
|
|
||||||
source/game/ui/notifier.cpp \
|
|
||||||
source/utils/utils.cpp \
|
|
||||||
source/utils/delta_timer.cpp
|
|
||||||
|
|
||||||
# All sources combined
|
|
||||||
ALL_SOURCES := $(APP_SOURCES)
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# INCLUDES
|
|
||||||
# ==============================================================================
|
|
||||||
INCLUDES := -Isource
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# COMPILER FLAGS (OS-specific)
|
|
||||||
# ==============================================================================
|
|
||||||
CPP_STANDARD := c++20
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
FixPath = $(subst /,\\,$1)
|
FixPath = $(subst /,\\,$1)
|
||||||
CXXFLAGS := -std=$(CPP_STANDARD) -Wall -Os -ffunction-sections -fdata-sections \
|
|
||||||
-Wl,--gc-sections -static-libstdc++ -static-libgcc \
|
|
||||||
-Wl,-subsystem,windows -DWINDOWS_BUILD
|
|
||||||
CXXFLAGS_DEBUG := -std=$(CPP_STANDARD) -Wall -g -D_DEBUG -DWINDOWS_BUILD
|
|
||||||
LDFLAGS := -lmingw32 -lws2_32 -lSDL3
|
|
||||||
RM := del /Q
|
RM := del /Q
|
||||||
MKDIR := mkdir
|
MKDIR := mkdir
|
||||||
else
|
else
|
||||||
FixPath = $1
|
FixPath = $1
|
||||||
CXXFLAGS := -std=$(CPP_STANDARD) -Wall -Os -ffunction-sections -fdata-sections
|
|
||||||
CXXFLAGS_DEBUG := -std=$(CPP_STANDARD) -Wall -g -D_DEBUG
|
|
||||||
LDFLAGS := -lSDL3
|
|
||||||
RMFILE := rm -f
|
RMFILE := rm -f
|
||||||
RMDIR := rm -rdf
|
RMDIR := rm -rdf
|
||||||
MKDIR := mkdir -p
|
MKDIR := mkdir -p
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S),Linux)
|
|
||||||
CXXFLAGS += -DLINUX_BUILD
|
|
||||||
endif
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
|
||||||
CXXFLAGS += -DMACOS_BUILD
|
|
||||||
CXXFLAGS_DEBUG += -DMACOS_BUILD
|
|
||||||
# Configurar arquitectura (por defecto arm64)
|
|
||||||
CXXFLAGS += -arch arm64
|
|
||||||
CXXFLAGS_DEBUG += -arch arm64
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# REGLAS PARA COMPILACIÓN DE SHADERS
|
# COMPILACIÓN CON CMAKE
|
||||||
|
# ==============================================================================
|
||||||
|
all:
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
|
debug:
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# RELEASE AUTOMÁTICO (detecta SO)
|
||||||
|
# ==============================================================================
|
||||||
|
release:
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
@"$(MAKE)" windows_release
|
||||||
|
else
|
||||||
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
@$(MAKE) macos_release
|
||||||
|
else
|
||||||
|
@$(MAKE) linux_release
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# REGLAS PARA COMPILACIÓN DE SHADERS (multiplataforma via cmake)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
compile_shaders:
|
compile_shaders:
|
||||||
ifdef GLSLC
|
ifdef GLSLC
|
||||||
@echo "Compilando shaders SPIR-V..."
|
@cmake -D GLSLC=$(GLSLC) -D SHADERS_DIR=$(SHADERS_DIR) -D HEADERS_DIR=$(HEADERS_DIR) -P $(SHADER_CMAKE)
|
||||||
@$(SHADER_SCRIPT)
|
|
||||||
@echo "✓ Shaders compilados"
|
|
||||||
else
|
else
|
||||||
@if [ -f "$(SHADER_VERT_H)" ] && [ -f "$(SHADER_FRAG_H)" ]; then \
|
@echo "glslc no encontrado - asegurate de que los headers SPIR-V precompilados existen"
|
||||||
echo "⚠ glslc no encontrado - usando headers SPIR-V precompilados"; \
|
|
||||||
else \
|
|
||||||
echo "ERROR: glslc no encontrado y headers SPIR-V no existen."; \
|
|
||||||
echo " Instala glslc: sudo apt install glslang-tools"; \
|
|
||||||
echo " O ejecuta manualmente: tools/shaders/compile_spirv.sh"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# REGLAS PARA HERRAMIENTA DE EMPAQUETADO Y RESOURCES.PACK
|
# REGLAS PARA HERRAMIENTA DE EMPAQUETADO Y RESOURCES.PACK
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
$(PACK_TOOL): FORCE
|
pack_tool:
|
||||||
@echo "Compilando herramienta de empaquetado..."
|
@$(MAKE) -C $(DIR_PACK_TOOL)
|
||||||
$(PACK_CXX) -std=$(CPP_STANDARD) -Wall -Os $(PACK_INCLUDES) $(PACK_SOURCES) -o $(PACK_TOOL)
|
|
||||||
@echo "✓ Herramienta de empaquetado lista: $(PACK_TOOL)"
|
|
||||||
|
|
||||||
pack_tool: $(PACK_TOOL)
|
resources.pack: pack_tool
|
||||||
|
@$(MAKE) -C $(DIR_PACK_TOOL) pack
|
||||||
resources.pack: $(PACK_TOOL)
|
|
||||||
@echo "Generando resources.pack desde directorio data/..."
|
|
||||||
$(PACK_TOOL) data resources.pack
|
|
||||||
@echo "✓ resources.pack generado exitosamente"
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# COMPILACIÓN PARA WINDOWS
|
# COMPILACIÓN PARA WINDOWS (RELEASE)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
windows:
|
|
||||||
@echo off
|
|
||||||
@echo Generando version.h...
|
|
||||||
@powershell -Command "$$GIT_HASH = (git rev-parse --short=7 HEAD 2>$$null); if (-not $$GIT_HASH) { $$GIT_HASH = 'unknown' }; (Get-Content source/version.h.in) -replace '@GIT_HASH@', $$GIT_HASH | Set-Content source/version.h"
|
|
||||||
@echo Compilando para Windows con nombre: "$(WIN_TARGET_FILE).exe"
|
|
||||||
windres release/windows/jdd.rc -O coff -o $(RESOURCE_FILE)
|
|
||||||
g++ $(ALL_SOURCES) $(RESOURCE_FILE) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_TARGET_FILE).exe"
|
|
||||||
strip -s -R .comment -R .gnu.version "$(WIN_TARGET_FILE).exe" --strip-unneeded
|
|
||||||
|
|
||||||
windows_release:
|
windows_release:
|
||||||
@$(MAKE) compile_shaders
|
|
||||||
@$(MAKE) resources.pack
|
|
||||||
@echo off
|
@echo off
|
||||||
@echo Creando release para Windows - Version: $(VERSION)
|
@echo Creando release para Windows - Version: $(VERSION)
|
||||||
|
|
||||||
# Generate version.h from version.h.in
|
# Compila con cmake (genera shaders, resources.pack y ejecutable)
|
||||||
@echo "Generando version.h..."
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
@powershell -Command "$$GIT_HASH = (git rev-parse --short=7 HEAD 2>$$null); if (-not $$GIT_HASH) { $$GIT_HASH = 'unknown' }; (Get-Content source/version.h.in) -replace '@GIT_HASH@', $$GIT_HASH | Set-Content source/version.h"
|
@cmake --build build
|
||||||
|
|
||||||
# Crea carpeta de distribución y carpeta temporal 'RELEASE_FOLDER'
|
# Crea carpeta de distribución y carpeta temporal 'RELEASE_FOLDER'
|
||||||
powershell if (-not (Test-Path "$(DIST_DIR)")) {New-Item "$(DIST_DIR)" -ItemType Directory}
|
@powershell -Command "if (-not (Test-Path '$(DIST_DIR)')) {New-Item '$(DIST_DIR)' -ItemType Directory}"
|
||||||
powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force}
|
@powershell -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
||||||
powershell if (-not (Test-Path "$(RELEASE_FOLDER)")) {New-Item "$(RELEASE_FOLDER)" -ItemType Directory}
|
@powershell -Command "if (-not (Test-Path '$(RELEASE_FOLDER)')) {New-Item '$(RELEASE_FOLDER)' -ItemType Directory}"
|
||||||
|
|
||||||
# Copia el archivo 'resources.pack'
|
# Copia ficheros
|
||||||
powershell Copy-Item -Path "resources.pack" -Destination "$(RELEASE_FOLDER)"
|
@powershell -Command "Copy-Item -Path 'resources.pack' -Destination '$(RELEASE_FOLDER)'"
|
||||||
|
@powershell -Command "Copy-Item 'LICENSE' -Destination '$(RELEASE_FOLDER)'"
|
||||||
# Copia los ficheros que están en la raíz del proyecto
|
@powershell -Command "Copy-Item 'README.md' -Destination '$(RELEASE_FOLDER)'"
|
||||||
powershell Copy-Item "LICENSE" -Destination "$(RELEASE_FOLDER)"
|
@powershell -Command "Copy-Item 'gamecontrollerdb.txt' -Destination '$(RELEASE_FOLDER)'"
|
||||||
powershell Copy-Item "README.md" -Destination "$(RELEASE_FOLDER)"
|
@powershell -Command "Copy-Item 'release\windows\dll\*.dll' -Destination '$(RELEASE_FOLDER)'"
|
||||||
powershell Copy-Item "gamecontrollerdb.txt" -Destination "$(RELEASE_FOLDER)"
|
@powershell -Command "Copy-Item -Path '$(TARGET_FILE)' -Destination '\"$(WIN_RELEASE_FILE).exe\"'"
|
||||||
powershell Copy-Item "release\windows\dll\*.dll" -Destination "$(RELEASE_FOLDER)"
|
|
||||||
|
|
||||||
# Compila (con icono)
|
|
||||||
windres release/windows/jdd.rc -O coff -o $(RESOURCE_FILE)
|
|
||||||
g++ $(ALL_SOURCES) $(RESOURCE_FILE) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_RELEASE_FILE).exe"
|
|
||||||
strip -s -R .comment -R .gnu.version "$(WIN_RELEASE_FILE).exe" --strip-unneeded
|
strip -s -R .comment -R .gnu.version "$(WIN_RELEASE_FILE).exe" --strip-unneeded
|
||||||
|
|
||||||
# Crea el fichero .zip
|
# Crea el fichero .zip
|
||||||
powershell if (Test-Path "$(WINDOWS_RELEASE)") {Remove-Item "$(WINDOWS_RELEASE)"}
|
@powershell -Command "if (Test-Path '$(WINDOWS_RELEASE)') {Remove-Item '$(WINDOWS_RELEASE)'}"
|
||||||
powershell Compress-Archive -Path "$(RELEASE_FOLDER)"/* -DestinationPath "$(WINDOWS_RELEASE)"
|
@powershell -Command "Compress-Archive -Path '$(RELEASE_FOLDER)/*' -DestinationPath '$(WINDOWS_RELEASE)'"
|
||||||
@echo Release creado: $(WINDOWS_RELEASE)
|
@echo Release creado: $(WINDOWS_RELEASE)
|
||||||
|
|
||||||
# Elimina la carpeta temporal 'RELEASE_FOLDER'
|
# Elimina la carpeta temporal 'RELEASE_FOLDER'
|
||||||
powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force}
|
@powershell -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# COMPILACIÓN PARA MACOS
|
# COMPILACIÓN PARA MACOS (RELEASE)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
macos:
|
|
||||||
@GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \
|
|
||||||
sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
|
|
||||||
@echo "Compilando para macOS: $(TARGET_NAME)"
|
|
||||||
clang++ $(ALL_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
|
||||||
|
|
||||||
macos_release:
|
macos_release:
|
||||||
@$(MAKE) compile_shaders
|
|
||||||
@$(MAKE) resources.pack
|
|
||||||
@echo "Creando release para macOS - Version: $(VERSION)"
|
@echo "Creando release para macOS - Version: $(VERSION)"
|
||||||
|
|
||||||
# Verificar e instalar create-dmg si es necesario
|
# Verificar e instalar create-dmg si es necesario
|
||||||
@which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg)
|
@which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg)
|
||||||
|
|
||||||
# Generate version.h from version.h.in
|
# Compila la versión para procesadores Intel con cmake (genera shaders y resources.pack)
|
||||||
@echo "Generando version.h..."
|
@cmake -S . -B build/intel -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DMACOS_BUNDLE=ON
|
||||||
@GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \
|
@cmake --build build/intel
|
||||||
sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
|
|
||||||
|
|
||||||
# Elimina datos de compilaciones anteriores
|
# Elimina datos de compilaciones anteriores
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
$(RMFILE) tmp.dmg
|
$(RMFILE) tmp.dmg
|
||||||
$(RMFILE) "$(DIST_DIR)"/rw.*
|
$(RMFILE) "$(DIST_DIR)"/rw.*
|
||||||
|
$(RMFILE) "$(MACOS_INTEL_RELEASE)"
|
||||||
|
$(RMFILE) "$(MACOS_APPLE_SILICON_RELEASE)"
|
||||||
|
|
||||||
# Crea la carpeta temporal para hacer el trabajo y las carpetas obligatorias para crear una app de macOS
|
# Crea la carpeta temporal para hacer el trabajo y las carpetas obligatorias para crear una app de macOS
|
||||||
$(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks"
|
$(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks"
|
||||||
@@ -295,8 +199,8 @@ macos_release:
|
|||||||
sed -i '' '/<key>CFBundleShortVersionString<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"; \
|
sed -i '' '/<key>CFBundleShortVersionString<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"; \
|
||||||
sed -i '' '/<key>CFBundleVersion<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"
|
sed -i '' '/<key>CFBundleVersion<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"
|
||||||
|
|
||||||
# Compila la versión para procesadores Intel
|
# Copia el ejecutable Intel al bundle
|
||||||
clang++ $(ALL_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD -std=$(CPP_STANDARD) -Wall -Os -framework SDL3 -F release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64 -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.15
|
cp "$(TARGET_FILE)" "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)"
|
||||||
|
|
||||||
# Firma la aplicación
|
# Firma la aplicación
|
||||||
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
||||||
@@ -318,8 +222,10 @@ macos_release:
|
|||||||
"$(RELEASE_FOLDER)" || true
|
"$(RELEASE_FOLDER)" || true
|
||||||
@echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
|
@echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
|
||||||
|
|
||||||
# Compila la versión para procesadores Apple Silicon
|
# Compila la versión para procesadores Apple Silicon con cmake
|
||||||
clang++ $(ALL_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD -std=$(CPP_STANDARD) -Wall -Os -framework SDL3 -F release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64 -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11
|
@cmake -S . -B build/arm -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DMACOS_BUNDLE=ON
|
||||||
|
@cmake --build build/arm
|
||||||
|
cp "$(TARGET_FILE)" "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)"
|
||||||
|
|
||||||
# Firma la aplicación
|
# Firma la aplicación
|
||||||
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
||||||
@@ -343,27 +249,19 @@ macos_release:
|
|||||||
|
|
||||||
# Elimina las carpetas temporales
|
# Elimina las carpetas temporales
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
|
$(RMDIR) build/intel
|
||||||
|
$(RMDIR) build/arm
|
||||||
$(RMFILE) "$(DIST_DIR)"/rw.*
|
$(RMFILE) "$(DIST_DIR)"/rw.*
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# COMPILACIÓN PARA LINUX
|
# COMPILACIÓN PARA LINUX (RELEASE)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
linux:
|
|
||||||
@GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \
|
|
||||||
sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
|
|
||||||
@echo "Compilando para Linux: $(TARGET_NAME)"
|
|
||||||
g++ $(ALL_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
|
||||||
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded
|
|
||||||
|
|
||||||
linux_release:
|
linux_release:
|
||||||
@$(MAKE) compile_shaders
|
|
||||||
@$(MAKE) resources.pack
|
|
||||||
@echo "Creando release para Linux - Version: $(VERSION)"
|
@echo "Creando release para Linux - Version: $(VERSION)"
|
||||||
|
|
||||||
# Generate version.h from version.h.in
|
# Compila con cmake (genera shaders, resources.pack y ejecutable)
|
||||||
@echo "Generando version.h..."
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
@GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \
|
@cmake --build build
|
||||||
sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
|
|
||||||
|
|
||||||
# Elimina carpeta temporal previa y la recrea (crea dist/ si no existe)
|
# Elimina carpeta temporal previa y la recrea (crea dist/ si no existe)
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
@@ -374,9 +272,7 @@ linux_release:
|
|||||||
cp LICENSE "$(RELEASE_FOLDER)"
|
cp LICENSE "$(RELEASE_FOLDER)"
|
||||||
cp README.md "$(RELEASE_FOLDER)"
|
cp README.md "$(RELEASE_FOLDER)"
|
||||||
cp gamecontrollerdb.txt "$(RELEASE_FOLDER)"
|
cp gamecontrollerdb.txt "$(RELEASE_FOLDER)"
|
||||||
|
cp "$(TARGET_FILE)" "$(RELEASE_FILE)"
|
||||||
# Compila
|
|
||||||
g++ $(ALL_SOURCES) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE)"
|
|
||||||
strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded
|
strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded
|
||||||
|
|
||||||
# Empaqueta ficheros
|
# Empaqueta ficheros
|
||||||
@@ -398,17 +294,24 @@ show_version:
|
|||||||
help:
|
help:
|
||||||
@echo "Makefile para JailDoctor's Dilemma"
|
@echo "Makefile para JailDoctor's Dilemma"
|
||||||
@echo "Comandos disponibles:"
|
@echo "Comandos disponibles:"
|
||||||
@echo " windows - Compilar para Windows"
|
@echo ""
|
||||||
@echo " windows_release - Crear release completo para Windows"
|
@echo " Compilacion:"
|
||||||
@echo " linux - Compilar para Linux"
|
@echo " make - Compilar con cmake (Release)"
|
||||||
@echo " linux_release - Crear release completo para Linux"
|
@echo " make debug - Compilar con cmake (Debug)"
|
||||||
@echo " macos - Compilar para macOS"
|
@echo ""
|
||||||
@echo " macos_release - Crear release completo para macOS"
|
@echo " Release:"
|
||||||
@echo " pack_tool - Compilar herramienta de empaquetado"
|
@echo " make release - Crear release (detecta SO automaticamente)"
|
||||||
@echo " resources.pack - Generar pack de recursos desde data/"
|
@echo " make windows_release - Crear release para Windows"
|
||||||
@echo " show_version - Mostrar version actual ($(VERSION))"
|
@echo " make linux_release - Crear release para Linux"
|
||||||
@echo " help - Mostrar esta ayuda"
|
@echo " make macos_release - Crear release para macOS"
|
||||||
|
@echo ""
|
||||||
|
@echo " Herramientas:"
|
||||||
|
@echo " make compile_shaders - Compilar shaders SPIR-V"
|
||||||
|
@echo " make pack_tool - Compilar herramienta de empaquetado"
|
||||||
|
@echo " make resources.pack - Generar pack de recursos desde data/"
|
||||||
|
@echo ""
|
||||||
|
@echo " Otros:"
|
||||||
|
@echo " make show_version - Mostrar version actual ($(VERSION))"
|
||||||
|
@echo " make help - Mostrar esta ayuda"
|
||||||
|
|
||||||
FORCE:
|
.PHONY: all debug release windows_release macos_release linux_release compile_shaders pack_tool resources.pack show_version help
|
||||||
|
|
||||||
.PHONY: windows windows_release macos macos_release linux linux_release compile_shaders pack_tool resources.pack show_version help
|
|
||||||
|
|||||||
@@ -4,589 +4,369 @@
|
|||||||
assets:
|
assets:
|
||||||
# FONTS
|
# FONTS
|
||||||
fonts:
|
fonts:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/font/smb2.gif
|
- ${PREFIX}/data/font/smb2.gif
|
||||||
- type: FONT
|
- ${PREFIX}/data/font/aseprite.gif
|
||||||
path: ${PREFIX}/data/font/smb2.fnt
|
- ${PREFIX}/data/font/gauntlet.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/font/subatomic.gif
|
||||||
path: ${PREFIX}/data/font/aseprite.gif
|
- ${PREFIX}/data/font/8bithud.gif
|
||||||
- type: FONT
|
FONT:
|
||||||
path: ${PREFIX}/data/font/aseprite.fnt
|
- ${PREFIX}/data/font/smb2.fnt
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/font/aseprite.fnt
|
||||||
path: ${PREFIX}/data/font/gauntlet.gif
|
- ${PREFIX}/data/font/gauntlet.fnt
|
||||||
- type: FONT
|
- ${PREFIX}/data/font/subatomic.fnt
|
||||||
path: ${PREFIX}/data/font/gauntlet.fnt
|
- ${PREFIX}/data/font/8bithud.fnt
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/font/subatomic.gif
|
|
||||||
- type: FONT
|
|
||||||
path: ${PREFIX}/data/font/subatomic.fnt
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/font/8bithud.gif
|
|
||||||
- type: FONT
|
|
||||||
path: ${PREFIX}/data/font/8bithud.fnt
|
|
||||||
|
|
||||||
# PALETTES
|
# PALETTES
|
||||||
palettes:
|
palettes:
|
||||||
- type: PALETTE
|
PALETTE:
|
||||||
path: ${PREFIX}/data/palette/zx-spectrum.pal
|
- ${PREFIX}/data/palette/zx-spectrum.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/zx-spectrum-adjusted.pal
|
||||||
path: ${PREFIX}/data/palette/zx-spectrum-adjusted.pal
|
- ${PREFIX}/data/palette/zxarne-5.2.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/black-and-white.pal
|
||||||
path: ${PREFIX}/data/palette/zxarne-5-2.pal
|
- ${PREFIX}/data/palette/green-phosphor.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/orange-screen.pal
|
||||||
path: ${PREFIX}/data/palette/black-and-white.pal
|
- ${PREFIX}/data/palette/ruzx-spectrum.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/ruzx-spectrum-revision-2.pal
|
||||||
path: ${PREFIX}/data/palette/green-phosphor.pal
|
- ${PREFIX}/data/palette/pico-8.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/sweetie.pal
|
||||||
path: ${PREFIX}/data/palette/orange-screen.pal
|
- ${PREFIX}/data/palette/island-joy.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/lost-century.pal
|
||||||
path: ${PREFIX}/data/palette/ruzx-spectrum.pal
|
- ${PREFIX}/data/palette/na.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/steam-lords.pal
|
||||||
path: ${PREFIX}/data/palette/ruzx-spectrum-revision-2.pal
|
- ${PREFIX}/data/palette/winds-seed-pc98.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/psychic-fibre.pal
|
||||||
path: ${PREFIX}/data/palette/pico-8.pal
|
- ${PREFIX}/data/palette/shido-cyberneon.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/darkseed.pal
|
||||||
path: ${PREFIX}/data/palette/sweetie-16.pal
|
- ${PREFIX}/data/palette/antiquity.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/bubblegum.pal
|
||||||
path: ${PREFIX}/data/palette/island-joy-16.pal
|
- ${PREFIX}/data/palette/vanilla-milkshake.pal
|
||||||
- type: PALETTE
|
- ${PREFIX}/data/palette/aged-terracotta.pal
|
||||||
path: ${PREFIX}/data/palette/lost-century.pal
|
- ${PREFIX}/data/palette/h16da.pal
|
||||||
- type: PALETTE
|
|
||||||
path: ${PREFIX}/data/palette/na16.pal
|
|
||||||
- type: PALETTE
|
|
||||||
path: ${PREFIX}/data/palette/steam-lords.pal
|
|
||||||
|
|
||||||
# LOCALE
|
# LOCALE
|
||||||
locale:
|
locale:
|
||||||
- type: DATA
|
DATA:
|
||||||
path: ${PREFIX}/data/locale/en.yaml
|
- ${PREFIX}/data/locale/en.yaml
|
||||||
- type: DATA
|
- ${PREFIX}/data/locale/ca.yaml
|
||||||
path: ${PREFIX}/data/locale/ca.yaml
|
|
||||||
|
|
||||||
# INPUT
|
# INPUT
|
||||||
input:
|
input:
|
||||||
- type: DATA
|
DATA:
|
||||||
path: ${PREFIX}/gamecontrollerdb.txt
|
- ${PREFIX}/gamecontrollerdb.txt
|
||||||
|
|
||||||
# SYSTEM
|
# SYSTEM
|
||||||
system:
|
system:
|
||||||
- type: DATA
|
DATA:
|
||||||
path: ${SYSTEM_FOLDER}/config.yaml
|
- path: ${SYSTEM_FOLDER}/config.yaml
|
||||||
required: false
|
required: false
|
||||||
absolute: true
|
absolute: true
|
||||||
- type: DATA
|
- path: ${SYSTEM_FOLDER}/debug.yaml
|
||||||
path: ${SYSTEM_FOLDER}/stats_buffer.csv
|
required: false
|
||||||
required: false
|
absolute: true
|
||||||
absolute: true
|
- path: ${SYSTEM_FOLDER}/editor.yaml
|
||||||
- type: DATA
|
required: false
|
||||||
path: ${SYSTEM_FOLDER}/stats.csv
|
absolute: true
|
||||||
required: false
|
- path: ${SYSTEM_FOLDER}/stats_buffer.csv
|
||||||
absolute: true
|
required: false
|
||||||
- type: DATA
|
absolute: true
|
||||||
path: ${SYSTEM_FOLDER}/cheevos.bin
|
- path: ${SYSTEM_FOLDER}/stats.csv
|
||||||
required: false
|
required: false
|
||||||
absolute: true
|
absolute: true
|
||||||
- type: DATA
|
- path: ${SYSTEM_FOLDER}/cheevos.bin
|
||||||
path: ${SYSTEM_FOLDER}/postfx.yaml
|
required: false
|
||||||
required: false
|
absolute: true
|
||||||
absolute: true
|
- path: ${SYSTEM_FOLDER}/shaders/postfx.yaml
|
||||||
|
required: false
|
||||||
|
absolute: true
|
||||||
|
- path: ${SYSTEM_FOLDER}/shaders/crtpi.yaml
|
||||||
|
required: false
|
||||||
|
absolute: true
|
||||||
|
|
||||||
|
# CONSOLE
|
||||||
|
console:
|
||||||
|
DATA:
|
||||||
|
- ${PREFIX}/data/console/commands.yaml
|
||||||
|
|
||||||
# ROOMS
|
# ROOMS
|
||||||
rooms:
|
rooms:
|
||||||
- type: ROOM
|
ROOM:
|
||||||
path: ${PREFIX}/data/room/01.yaml
|
- ${PREFIX}/data/room/01.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/02.yaml
|
||||||
path: ${PREFIX}/data/room/02.yaml
|
- ${PREFIX}/data/room/03.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/04.yaml
|
||||||
path: ${PREFIX}/data/room/03.yaml
|
- ${PREFIX}/data/room/05.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/06.yaml
|
||||||
path: ${PREFIX}/data/room/04.yaml
|
- ${PREFIX}/data/room/07.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/08.yaml
|
||||||
path: ${PREFIX}/data/room/05.yaml
|
- ${PREFIX}/data/room/09.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/10.yaml
|
||||||
path: ${PREFIX}/data/room/06.yaml
|
- ${PREFIX}/data/room/11.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/12.yaml
|
||||||
path: ${PREFIX}/data/room/07.yaml
|
- ${PREFIX}/data/room/13.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/14.yaml
|
||||||
path: ${PREFIX}/data/room/08.yaml
|
- ${PREFIX}/data/room/15.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/16.yaml
|
||||||
path: ${PREFIX}/data/room/09.yaml
|
- ${PREFIX}/data/room/17.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/18.yaml
|
||||||
path: ${PREFIX}/data/room/10.yaml
|
- ${PREFIX}/data/room/19.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/20.yaml
|
||||||
path: ${PREFIX}/data/room/11.yaml
|
- ${PREFIX}/data/room/21.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/22.yaml
|
||||||
path: ${PREFIX}/data/room/12.yaml
|
- ${PREFIX}/data/room/23.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/24.yaml
|
||||||
path: ${PREFIX}/data/room/13.yaml
|
- ${PREFIX}/data/room/25.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/26.yaml
|
||||||
path: ${PREFIX}/data/room/14.yaml
|
- ${PREFIX}/data/room/27.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/28.yaml
|
||||||
path: ${PREFIX}/data/room/15.yaml
|
- ${PREFIX}/data/room/29.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/30.yaml
|
||||||
path: ${PREFIX}/data/room/16.yaml
|
- ${PREFIX}/data/room/31.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/32.yaml
|
||||||
path: ${PREFIX}/data/room/17.yaml
|
- ${PREFIX}/data/room/33.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/34.yaml
|
||||||
path: ${PREFIX}/data/room/18.yaml
|
- ${PREFIX}/data/room/35.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/36.yaml
|
||||||
path: ${PREFIX}/data/room/19.yaml
|
- ${PREFIX}/data/room/37.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/38.yaml
|
||||||
path: ${PREFIX}/data/room/20.yaml
|
- ${PREFIX}/data/room/39.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/40.yaml
|
||||||
path: ${PREFIX}/data/room/21.yaml
|
- ${PREFIX}/data/room/41.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/42.yaml
|
||||||
path: ${PREFIX}/data/room/22.yaml
|
- ${PREFIX}/data/room/43.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/44.yaml
|
||||||
path: ${PREFIX}/data/room/23.yaml
|
- ${PREFIX}/data/room/45.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/46.yaml
|
||||||
path: ${PREFIX}/data/room/24.yaml
|
- ${PREFIX}/data/room/47.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/48.yaml
|
||||||
path: ${PREFIX}/data/room/25.yaml
|
- ${PREFIX}/data/room/49.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/50.yaml
|
||||||
path: ${PREFIX}/data/room/26.yaml
|
- ${PREFIX}/data/room/51.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/52.yaml
|
||||||
path: ${PREFIX}/data/room/27.yaml
|
- ${PREFIX}/data/room/53.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/54.yaml
|
||||||
path: ${PREFIX}/data/room/28.yaml
|
- ${PREFIX}/data/room/55.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/56.yaml
|
||||||
path: ${PREFIX}/data/room/29.yaml
|
- ${PREFIX}/data/room/57.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/58.yaml
|
||||||
path: ${PREFIX}/data/room/30.yaml
|
- ${PREFIX}/data/room/59.yaml
|
||||||
- type: ROOM
|
- ${PREFIX}/data/room/60.yaml
|
||||||
path: ${PREFIX}/data/room/31.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/32.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/33.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/34.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/35.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/36.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/37.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/38.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/39.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/40.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/41.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/42.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/43.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/44.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/45.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/46.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/47.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/48.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/49.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/50.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/51.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/52.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/53.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/54.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/55.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/56.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/57.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/58.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/59.yaml
|
|
||||||
- type: ROOM
|
|
||||||
path: ${PREFIX}/data/room/60.yaml
|
|
||||||
|
|
||||||
# TILESETS
|
# TILESETS
|
||||||
tilesets:
|
tilesets:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/tilesets/standard.gif
|
- ${PREFIX}/data/tilesets/standard.gif
|
||||||
|
|
||||||
# ENEMIES
|
# ENEMIES
|
||||||
enemies:
|
enemies:
|
||||||
- type: ANIMATION
|
ANIMATION:
|
||||||
path: ${PREFIX}/data/enemies/abad_bell.yaml
|
- ${PREFIX}/data/enemies/abad_bell.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/abad.yaml
|
||||||
path: ${PREFIX}/data/enemies/abad_bell.gif
|
- ${PREFIX}/data/enemies/amstrad_cs.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/flying_arounder.yaml
|
||||||
path: ${PREFIX}/data/enemies/abad.yaml
|
- ${PREFIX}/data/enemies/stopped_arounder.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/walking_arounder.yaml
|
||||||
path: ${PREFIX}/data/enemies/abad.gif
|
- ${PREFIX}/data/enemies/arounders_door.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/arounders_machine.yaml
|
||||||
path: ${PREFIX}/data/enemies/amstrad_cs.yaml
|
- ${PREFIX}/data/enemies/bat.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/batman_bell.yaml
|
||||||
path: ${PREFIX}/data/enemies/amstrad_cs.gif
|
- ${PREFIX}/data/enemies/batman_fire.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/batman.yaml
|
||||||
path: ${PREFIX}/data/enemies/flying_arounder.yaml
|
- ${PREFIX}/data/enemies/bell.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/bin.yaml
|
||||||
path: ${PREFIX}/data/enemies/flying_arounder.gif
|
- ${PREFIX}/data/enemies/bird.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/breakout.yaml
|
||||||
path: ${PREFIX}/data/enemies/stopped_arounder.yaml
|
- ${PREFIX}/data/enemies/bry.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/chip.yaml
|
||||||
path: ${PREFIX}/data/enemies/stopped_arounder.gif
|
- ${PREFIX}/data/enemies/code.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/congo.yaml
|
||||||
path: ${PREFIX}/data/enemies/walking_arounder.yaml
|
- ${PREFIX}/data/enemies/crosshair.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/demon.yaml
|
||||||
path: ${PREFIX}/data/enemies/walking_arounder.gif
|
- ${PREFIX}/data/enemies/dimallas.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/floppy.yaml
|
||||||
path: ${PREFIX}/data/enemies/arounders_door.yaml
|
- ${PREFIX}/data/enemies/dong.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/guitar.yaml
|
||||||
path: ${PREFIX}/data/enemies/arounders_door.gif
|
- ${PREFIX}/data/enemies/heavy.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/jailer1.yaml
|
||||||
path: ${PREFIX}/data/enemies/arounders_machine.yaml
|
- ${PREFIX}/data/enemies/jailer2.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/jailer3.yaml
|
||||||
path: ${PREFIX}/data/enemies/arounders_machine.gif
|
- ${PREFIX}/data/enemies/jailbattle_alien.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/jailbattle_human.yaml
|
||||||
path: ${PREFIX}/data/enemies/bat.yaml
|
- ${PREFIX}/data/enemies/jeannine.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/lamp.yaml
|
||||||
path: ${PREFIX}/data/enemies/bat.gif
|
- ${PREFIX}/data/enemies/lord_abad.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/matatunos.yaml
|
||||||
path: ${PREFIX}/data/enemies/batman_bell.yaml
|
- ${PREFIX}/data/enemies/mummy.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/paco.yaml
|
||||||
path: ${PREFIX}/data/enemies/batman_bell.gif
|
- ${PREFIX}/data/enemies/elsa.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/qvoid.yaml
|
||||||
path: ${PREFIX}/data/enemies/batman_fire.yaml
|
- ${PREFIX}/data/enemies/robot.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/sam.yaml
|
||||||
path: ${PREFIX}/data/enemies/batman_fire.gif
|
- ${PREFIX}/data/enemies/shock.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/sigmasua.yaml
|
||||||
path: ${PREFIX}/data/enemies/batman.yaml
|
- ${PREFIX}/data/enemies/spark.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/special/aerojailer.yaml
|
||||||
path: ${PREFIX}/data/enemies/batman.gif
|
- ${PREFIX}/data/enemies/special/arounder.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/special/pepe_rosita_job.yaml
|
||||||
path: ${PREFIX}/data/enemies/bell.yaml
|
- ${PREFIX}/data/enemies/special/shooting_star.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/spider.yaml
|
||||||
path: ${PREFIX}/data/enemies/bell.gif
|
- ${PREFIX}/data/enemies/tree_thing.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/tuno.yaml
|
||||||
path: ${PREFIX}/data/enemies/bin.yaml
|
- ${PREFIX}/data/enemies/tv_panel.yaml
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/tv.yaml
|
||||||
path: ${PREFIX}/data/enemies/bin.gif
|
- ${PREFIX}/data/enemies/upv_student.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/wave.yaml
|
||||||
path: ${PREFIX}/data/enemies/bird.yaml
|
- ${PREFIX}/data/enemies/z80.yaml
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/enemies/bird.gif
|
- ${PREFIX}/data/enemies/abad_bell.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/abad.gif
|
||||||
path: ${PREFIX}/data/enemies/breakout.yaml
|
- ${PREFIX}/data/enemies/amstrad_cs.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/flying_arounder.gif
|
||||||
path: ${PREFIX}/data/enemies/breakout.gif
|
- ${PREFIX}/data/enemies/stopped_arounder.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/walking_arounder.gif
|
||||||
path: ${PREFIX}/data/enemies/bry.yaml
|
- ${PREFIX}/data/enemies/arounders_door.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/arounders_machine.gif
|
||||||
path: ${PREFIX}/data/enemies/bry.gif
|
- ${PREFIX}/data/enemies/bat.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/batman_bell.gif
|
||||||
path: ${PREFIX}/data/enemies/chip.yaml
|
- ${PREFIX}/data/enemies/batman_fire.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/batman.gif
|
||||||
path: ${PREFIX}/data/enemies/chip.gif
|
- ${PREFIX}/data/enemies/bell.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/bin.gif
|
||||||
path: ${PREFIX}/data/enemies/code.yaml
|
- ${PREFIX}/data/enemies/bird.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/breakout.gif
|
||||||
path: ${PREFIX}/data/enemies/code.gif
|
- ${PREFIX}/data/enemies/bry.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/chip.gif
|
||||||
path: ${PREFIX}/data/enemies/congo.yaml
|
- ${PREFIX}/data/enemies/code.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/congo.gif
|
||||||
path: ${PREFIX}/data/enemies/congo.gif
|
- ${PREFIX}/data/enemies/crosshair.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/demon.gif
|
||||||
path: ${PREFIX}/data/enemies/crosshair.yaml
|
- ${PREFIX}/data/enemies/dimallas.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/floppy.gif
|
||||||
path: ${PREFIX}/data/enemies/crosshair.gif
|
- ${PREFIX}/data/enemies/dong.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/guitar.gif
|
||||||
path: ${PREFIX}/data/enemies/demon.yaml
|
- ${PREFIX}/data/enemies/heavy.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/jailer1.gif
|
||||||
path: ${PREFIX}/data/enemies/demon.gif
|
- ${PREFIX}/data/enemies/jailer2.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/jailer3.gif
|
||||||
path: ${PREFIX}/data/enemies/dimallas.yaml
|
- ${PREFIX}/data/enemies/jailbattle_alien.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/jailbattle_human.gif
|
||||||
path: ${PREFIX}/data/enemies/dimallas.gif
|
- ${PREFIX}/data/enemies/jeannine.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/lamp.gif
|
||||||
path: ${PREFIX}/data/enemies/floppy.yaml
|
- ${PREFIX}/data/enemies/lord_abad.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/matatunos.gif
|
||||||
path: ${PREFIX}/data/enemies/floppy.gif
|
- ${PREFIX}/data/enemies/mummy.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/paco.gif
|
||||||
path: ${PREFIX}/data/enemies/dong.yaml
|
- ${PREFIX}/data/enemies/elsa.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/qvoid.gif
|
||||||
path: ${PREFIX}/data/enemies/dong.gif
|
- ${PREFIX}/data/enemies/robot.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/sam.gif
|
||||||
path: ${PREFIX}/data/enemies/guitar.yaml
|
- ${PREFIX}/data/enemies/shock.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/sigmasua.gif
|
||||||
path: ${PREFIX}/data/enemies/guitar.gif
|
- ${PREFIX}/data/enemies/spark.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/special/aerojailer.gif
|
||||||
path: ${PREFIX}/data/enemies/heavy.yaml
|
- ${PREFIX}/data/enemies/special/arounder.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/special/pepe_rosita_job.gif
|
||||||
path: ${PREFIX}/data/enemies/heavy.gif
|
- ${PREFIX}/data/enemies/special/shooting_star.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/spider.gif
|
||||||
path: ${PREFIX}/data/enemies/jailer1.yaml
|
- ${PREFIX}/data/enemies/tree_thing.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/tuno.gif
|
||||||
path: ${PREFIX}/data/enemies/jailer1.gif
|
- ${PREFIX}/data/enemies/tv_panel.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/enemies/tv.gif
|
||||||
path: ${PREFIX}/data/enemies/jailer2.yaml
|
- ${PREFIX}/data/enemies/upv_student.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/enemies/wave.gif
|
||||||
path: ${PREFIX}/data/enemies/jailer2.gif
|
- ${PREFIX}/data/enemies/z80.gif
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/jailer3.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/jailer3.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/jailbattle_alien.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/jailbattle_alien.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/jailbattle_human.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/jailbattle_human.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/jeannine.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/jeannine.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/lamp.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/lamp.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/lord_abad.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/lord_abad.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/matatunos.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/matatunos.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/mummy.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/mummy.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/paco.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/paco.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/elsa.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/elsa.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/qvoid.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/qvoid.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/robot.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/robot.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/sam.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/sam.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/shock.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/shock.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/sigmasua.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/sigmasua.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/spark.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/spark.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/special/aerojailer.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/special/aerojailer.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/special/arounder.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/special/arounder.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/special/pepe_rosita_job.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/special/pepe_rosita_job.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/special/shooting_star.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/special/shooting_star.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/spider.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/spider.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/tree_thing.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/tree_thing.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/tuno.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/tuno.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/tv_panel.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/tv_panel.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/tv.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/tv.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/upv_student.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/upv_student.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/wave.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/wave.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/enemies/z80.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/enemies/z80.gif
|
|
||||||
|
|
||||||
# PLAYER
|
# PLAYER
|
||||||
player:
|
player:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/player/player.gif
|
- ${PREFIX}/data/player/player.gif
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/player/player2.gif
|
||||||
path: ${PREFIX}/data/player/player.yaml
|
- ${PREFIX}/data/player/player_game_over.gif
|
||||||
- type: BITMAP
|
ANIMATION:
|
||||||
path: ${PREFIX}/data/player/player2.gif
|
- ${PREFIX}/data/player/player.yaml
|
||||||
- type: ANIMATION
|
- ${PREFIX}/data/player/player2.yaml
|
||||||
path: ${PREFIX}/data/player/player2.yaml
|
- ${PREFIX}/data/player/player_game_over.yaml
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/player/player_game_over.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/player/player_game_over.yaml
|
|
||||||
|
|
||||||
# ITEMS
|
# ITEMS
|
||||||
items:
|
items:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/items/items.gif
|
- ${PREFIX}/data/items/items.gif
|
||||||
|
|
||||||
# MUSIC
|
# MUSIC
|
||||||
music:
|
music:
|
||||||
- type: MUSIC
|
MUSIC:
|
||||||
path: ${PREFIX}/data/music/title.ogg
|
- ${PREFIX}/data/music/title.ogg
|
||||||
- type: MUSIC
|
- ${PREFIX}/data/music/game.ogg
|
||||||
path: ${PREFIX}/data/music/game.ogg
|
- ${PREFIX}/data/music/loading_data1.ogg
|
||||||
- type: MUSIC
|
- ${PREFIX}/data/music/loading_data2.ogg
|
||||||
path: ${PREFIX}/data/music/loading_data1.ogg
|
- ${PREFIX}/data/music/loading_header.ogg
|
||||||
- type: MUSIC
|
- ${PREFIX}/data/music/loading_screen_color.ogg
|
||||||
path: ${PREFIX}/data/music/loading_data2.ogg
|
- ${PREFIX}/data/music/loading_screen_data.ogg
|
||||||
- type: MUSIC
|
- ${PREFIX}/data/music/ending1.ogg
|
||||||
path: ${PREFIX}/data/music/loading_header.ogg
|
- ${PREFIX}/data/music/ending2.ogg
|
||||||
- type: MUSIC
|
- ${PREFIX}/data/music/game_over.ogg
|
||||||
path: ${PREFIX}/data/music/loading_screen_color.ogg
|
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/loading_screen_data.ogg
|
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/ending1.ogg
|
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/ending2.ogg
|
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/game_over.ogg
|
|
||||||
|
|
||||||
# SOUNDS
|
# SOUNDS
|
||||||
sounds:
|
sounds:
|
||||||
- type: SOUND
|
SOUND:
|
||||||
path: ${PREFIX}/data/sound/item.wav
|
- ${PREFIX}/data/sound/item.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/death.wav
|
||||||
path: ${PREFIX}/data/sound/death.wav
|
- ${PREFIX}/data/sound/notify.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump1.wav
|
||||||
path: ${PREFIX}/data/sound/notify.wav
|
- ${PREFIX}/data/sound/jump2.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump3.wav
|
||||||
path: ${PREFIX}/data/sound/jump1.wav
|
- ${PREFIX}/data/sound/jump4.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump5.wav
|
||||||
path: ${PREFIX}/data/sound/jump2.wav
|
- ${PREFIX}/data/sound/jump6.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump7.wav
|
||||||
path: ${PREFIX}/data/sound/jump3.wav
|
- ${PREFIX}/data/sound/jump8.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump9.wav
|
||||||
path: ${PREFIX}/data/sound/jump4.wav
|
- ${PREFIX}/data/sound/jump10.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump11.wav
|
||||||
path: ${PREFIX}/data/sound/jump5.wav
|
- ${PREFIX}/data/sound/jump12.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump13.wav
|
||||||
path: ${PREFIX}/data/sound/jump6.wav
|
- ${PREFIX}/data/sound/jump14.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump15.wav
|
||||||
path: ${PREFIX}/data/sound/jump7.wav
|
- ${PREFIX}/data/sound/jump16.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump17.wav
|
||||||
path: ${PREFIX}/data/sound/jump8.wav
|
- ${PREFIX}/data/sound/jump18.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump19.wav
|
||||||
path: ${PREFIX}/data/sound/jump9.wav
|
- ${PREFIX}/data/sound/jump20.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump21.wav
|
||||||
path: ${PREFIX}/data/sound/jump10.wav
|
- ${PREFIX}/data/sound/jump22.wav
|
||||||
- type: SOUND
|
- ${PREFIX}/data/sound/jump23.wav
|
||||||
path: ${PREFIX}/data/sound/jump11.wav
|
- ${PREFIX}/data/sound/jump24.wav
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump12.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump13.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump14.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump15.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump16.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump17.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump18.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump19.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump20.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump21.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump22.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump23.wav
|
|
||||||
- type: SOUND
|
|
||||||
path: ${PREFIX}/data/sound/jump24.wav
|
|
||||||
|
|
||||||
# LOGO
|
# LOGO
|
||||||
logo:
|
logo:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/logo/jailgames.gif
|
- ${PREFIX}/data/logo/jailgames.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/logo/since_1998.gif
|
||||||
path: ${PREFIX}/data/logo/since_1998.gif
|
|
||||||
|
|
||||||
# LOADING
|
# LOADING
|
||||||
loading:
|
loading:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/loading/loading_screen_bn.gif
|
- ${PREFIX}/data/loading/loading_screen_bn.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/loading/loading_screen_color.gif
|
||||||
path: ${PREFIX}/data/loading/loading_screen_color.gif
|
- ${PREFIX}/data/loading/program_jaildoc.gif
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/loading/program_jaildoc.gif
|
|
||||||
|
|
||||||
# TITLE
|
# TITLE
|
||||||
title:
|
title:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/title/title_logo.gif
|
- ${PREFIX}/data/title/title_logo.gif
|
||||||
|
|
||||||
# ENDING
|
# ENDING
|
||||||
ending:
|
ending:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/ending/ending1.gif
|
- ${PREFIX}/data/ending/ending1.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/ending/ending2.gif
|
||||||
path: ${PREFIX}/data/ending/ending2.gif
|
- ${PREFIX}/data/ending/ending3.gif
|
||||||
- type: BITMAP
|
- ${PREFIX}/data/ending/ending4.gif
|
||||||
path: ${PREFIX}/data/ending/ending3.gif
|
- ${PREFIX}/data/ending/ending5.gif
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/ending/ending4.gif
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/ending/ending5.gif
|
|
||||||
|
|
||||||
# CREDITS
|
# CREDITS
|
||||||
credits:
|
credits:
|
||||||
- type: BITMAP
|
BITMAP:
|
||||||
path: ${PREFIX}/data/credits/shine.gif
|
- ${PREFIX}/data/credits/shine.gif
|
||||||
- type: ANIMATION
|
ANIMATION:
|
||||||
path: ${PREFIX}/data/credits/shine.yaml
|
- ${PREFIX}/data/credits/shine.yaml
|
||||||
|
|||||||
286
data/console/commands.yaml
Normal file
286
data/console/commands.yaml
Normal file
@@ -0,0 +1,286 @@
|
|||||||
|
# JailDoctor's Dilemma - Console Commands
|
||||||
|
# Metadata for the in-game console command system.
|
||||||
|
# Execution logic stays in C++; this file defines metadata only.
|
||||||
|
#
|
||||||
|
# Fields:
|
||||||
|
# keyword - Command name (uppercase)
|
||||||
|
# handler - C++ handler function identifier
|
||||||
|
# description - Short description for help output
|
||||||
|
# usage - Full usage string for terminal help
|
||||||
|
# instant - (optional) Skip typewriter effect (default: false)
|
||||||
|
# hidden - (optional) Hide from TAB completion (default: false)
|
||||||
|
# debug_only - (optional) Only available in debug builds (default: false)
|
||||||
|
# help_hidden - (optional) Don't show in help output (default: false)
|
||||||
|
# dynamic_completions - (optional) Completions generated at runtime (default: false)
|
||||||
|
# completions - (optional) Static TAB completion tree
|
||||||
|
# debug_extras - (optional) Overrides applied in debug builds
|
||||||
|
# scope - (optional) Visibility scope: global, game, editor, debug (default: global)
|
||||||
|
# Can be a string or a list. Categories can set a default scope for all commands.
|
||||||
|
|
||||||
|
categories:
|
||||||
|
- name: VIDEO
|
||||||
|
scope: game
|
||||||
|
commands:
|
||||||
|
- keyword: SS
|
||||||
|
handler: cmd_ss
|
||||||
|
description: Supersampling
|
||||||
|
usage: "SS [ON|OFF|SIZE|UPSCALE [NEAREST|LINEAR]|DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3]]"
|
||||||
|
completions:
|
||||||
|
SS: [ON, OFF, SIZE, UPSCALE, DOWNSCALE]
|
||||||
|
SS UPSCALE: [NEAREST, LINEAR]
|
||||||
|
SS DOWNSCALE: [BILINEAR, LANCZOS2, LANCZOS3]
|
||||||
|
|
||||||
|
- keyword: SHADER
|
||||||
|
handler: cmd_shader
|
||||||
|
description: "Toggle/select shader (F4)"
|
||||||
|
usage: "SHADER [ON|OFF|NEXT|POSTFX|CRTPI|PRESET [NEXT|PREV|<name>]]"
|
||||||
|
completions:
|
||||||
|
SHADER: [ON, OFF, NEXT, POSTFX, CRTPI, PRESET]
|
||||||
|
dynamic_completions: true
|
||||||
|
|
||||||
|
- keyword: BORDER
|
||||||
|
handler: cmd_border
|
||||||
|
description: "Decorative border (B)"
|
||||||
|
usage: "BORDER [ON|OFF]"
|
||||||
|
completions:
|
||||||
|
BORDER: [ON, OFF]
|
||||||
|
|
||||||
|
- keyword: FULLSCREEN
|
||||||
|
handler: cmd_fullscreen
|
||||||
|
description: "Fullscreen mode (F3)"
|
||||||
|
usage: "FULLSCREEN [ON|OFF]"
|
||||||
|
completions:
|
||||||
|
FULLSCREEN: [ON, OFF]
|
||||||
|
|
||||||
|
- keyword: ZOOM
|
||||||
|
handler: cmd_zoom
|
||||||
|
description: "Window zoom (F1/F2)"
|
||||||
|
usage: "ZOOM [UP|DOWN|<1-N>]"
|
||||||
|
completions:
|
||||||
|
ZOOM: [UP, DOWN]
|
||||||
|
|
||||||
|
- keyword: INTSCALE
|
||||||
|
handler: cmd_intscale
|
||||||
|
description: "Integer scaling (F7)"
|
||||||
|
usage: "INTSCALE [ON|OFF]"
|
||||||
|
completions:
|
||||||
|
INTSCALE: [ON, OFF]
|
||||||
|
|
||||||
|
- keyword: VSYNC
|
||||||
|
handler: cmd_vsync
|
||||||
|
description: "Vertical sync"
|
||||||
|
usage: "VSYNC [ON|OFF]"
|
||||||
|
completions:
|
||||||
|
VSYNC: [ON, OFF]
|
||||||
|
|
||||||
|
- keyword: DRIVER
|
||||||
|
handler: cmd_driver
|
||||||
|
description: "GPU driver (restart to apply)"
|
||||||
|
usage: "DRIVER [LIST|AUTO|NONE|<name>]"
|
||||||
|
completions:
|
||||||
|
DRIVER: [LIST, AUTO, NONE]
|
||||||
|
|
||||||
|
- keyword: PALETTE
|
||||||
|
handler: cmd_palette
|
||||||
|
description: "Color palette (F5/F6)"
|
||||||
|
usage: "PALETTE [NEXT|PREV|SORT [ORIGINAL|LUMINANCE|SPECTRUM]|DEFAULT|<name>]"
|
||||||
|
completions:
|
||||||
|
PALETTE SORT: [ORIGINAL, LUMINANCE, SPECTRUM]
|
||||||
|
dynamic_completions: true
|
||||||
|
|
||||||
|
- name: AUDIO
|
||||||
|
scope: game
|
||||||
|
commands:
|
||||||
|
- keyword: AUDIO
|
||||||
|
handler: cmd_audio
|
||||||
|
description: Audio master
|
||||||
|
usage: "AUDIO [ON|OFF|VOL <0-100>]"
|
||||||
|
completions:
|
||||||
|
AUDIO: [ON, OFF, VOL]
|
||||||
|
|
||||||
|
- keyword: MUSIC
|
||||||
|
handler: cmd_music
|
||||||
|
description: Music volume
|
||||||
|
usage: "MUSIC [ON|OFF|VOL <0-100>]"
|
||||||
|
completions:
|
||||||
|
MUSIC: [ON, OFF, VOL]
|
||||||
|
|
||||||
|
- keyword: SOUND
|
||||||
|
handler: cmd_sound
|
||||||
|
description: Sound volume
|
||||||
|
usage: "SOUND [ON|OFF|VOL <0-100>]"
|
||||||
|
completions:
|
||||||
|
SOUND: [ON, OFF, VOL]
|
||||||
|
|
||||||
|
- name: GAME
|
||||||
|
scope: game
|
||||||
|
commands:
|
||||||
|
- keyword: PLAYER
|
||||||
|
handler: cmd_player
|
||||||
|
description: "Player skin and color"
|
||||||
|
usage: "PLAYER SKIN <name> | PLAYER COLOR <0-15>|DEFAULT"
|
||||||
|
completions:
|
||||||
|
PLAYER: [SKIN, COLOR]
|
||||||
|
PLAYER SKIN: [DEFAULT, ABAD, BATMAN, CHIP, CONGO, JEANNINE, MUMMY, UPV_STUDENT]
|
||||||
|
PLAYER COLOR: [DEFAULT]
|
||||||
|
|
||||||
|
- keyword: RESTART
|
||||||
|
handler: cmd_restart
|
||||||
|
description: Restart from the beginning
|
||||||
|
usage: RESTART
|
||||||
|
instant: true
|
||||||
|
|
||||||
|
- keyword: KIOSK
|
||||||
|
handler: cmd_kiosk
|
||||||
|
description: Enable kiosk mode
|
||||||
|
usage: "KIOSK [ON]"
|
||||||
|
completions:
|
||||||
|
KIOSK: [ON]
|
||||||
|
|
||||||
|
- keyword: EXIT
|
||||||
|
handler: cmd_exit
|
||||||
|
description: Quit application
|
||||||
|
usage: EXIT
|
||||||
|
instant: true
|
||||||
|
scope: global
|
||||||
|
|
||||||
|
- keyword: QUIT
|
||||||
|
handler: cmd_quit
|
||||||
|
description: Quit application
|
||||||
|
usage: QUIT
|
||||||
|
instant: true
|
||||||
|
help_hidden: true
|
||||||
|
scope: global
|
||||||
|
|
||||||
|
- name: INFO
|
||||||
|
scope: global
|
||||||
|
commands:
|
||||||
|
- keyword: SHOW
|
||||||
|
handler: cmd_show
|
||||||
|
description: Show info overlay
|
||||||
|
usage: "SHOW [INFO]"
|
||||||
|
completions:
|
||||||
|
SHOW: [INFO]
|
||||||
|
debug_extras:
|
||||||
|
description: "Show overlay/test notification"
|
||||||
|
usage: "SHOW [INFO|NOTIFICATION|CHEEVO]"
|
||||||
|
completions:
|
||||||
|
SHOW: [INFO, NOTIFICATION, CHEEVO]
|
||||||
|
|
||||||
|
- keyword: HIDE
|
||||||
|
handler: cmd_hide
|
||||||
|
description: Hide info overlay
|
||||||
|
usage: "HIDE [INFO]"
|
||||||
|
completions:
|
||||||
|
HIDE: [INFO]
|
||||||
|
|
||||||
|
- keyword: SIZE
|
||||||
|
handler: cmd_size
|
||||||
|
description: Window size in pixels
|
||||||
|
usage: SIZE
|
||||||
|
|
||||||
|
- keyword: HELP
|
||||||
|
handler: cmd_help
|
||||||
|
description: "Show this help"
|
||||||
|
usage: "HELP [<command>]"
|
||||||
|
dynamic_completions: true
|
||||||
|
|
||||||
|
- keyword: "?"
|
||||||
|
handler: cmd_help
|
||||||
|
help_hidden: true
|
||||||
|
|
||||||
|
- name: DEBUG
|
||||||
|
debug_only: true
|
||||||
|
scope: debug
|
||||||
|
commands:
|
||||||
|
- keyword: DEBUG
|
||||||
|
handler: cmd_debug
|
||||||
|
description: "Debug mode and start options (F12)"
|
||||||
|
usage: "DEBUG [MODE [ON|OFF]|START [HERE|ROOM|POS|SCENE <name>]]"
|
||||||
|
completions:
|
||||||
|
DEBUG: [MODE, START]
|
||||||
|
DEBUG MODE: [ON, OFF]
|
||||||
|
DEBUG START: [HERE, ROOM, POS, SCENE]
|
||||||
|
DEBUG START SCENE: [LOGO, LOADING, TITLE, CREDITS, GAME, ENDING, ENDING2]
|
||||||
|
|
||||||
|
- keyword: ITEMS
|
||||||
|
handler: cmd_items
|
||||||
|
description: "Set item count (GAME only)"
|
||||||
|
usage: "ITEMS <0-200>"
|
||||||
|
|
||||||
|
- keyword: ROOM
|
||||||
|
handler: cmd_room
|
||||||
|
description: "Change to room number (GAME only)"
|
||||||
|
usage: "ROOM <1-60>|NEXT|PREV|LEFT|RIGHT|UP|DOWN"
|
||||||
|
scope: [debug, editor]
|
||||||
|
completions:
|
||||||
|
ROOM: [NEXT, PREV, LEFT, RIGHT, UP, DOWN, NEW, DELETE]
|
||||||
|
ROOM NEW: [LEFT, RIGHT, UP, DOWN]
|
||||||
|
|
||||||
|
- keyword: SCENE
|
||||||
|
handler: cmd_scene
|
||||||
|
description: Change scene
|
||||||
|
usage: "SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART]"
|
||||||
|
completions:
|
||||||
|
SCENE: [LOGO, LOADING, TITLE, CREDITS, GAME, ENDING, ENDING2, RESTART]
|
||||||
|
|
||||||
|
- keyword: EDIT
|
||||||
|
handler: cmd_edit
|
||||||
|
description: "Map editor mode (GAME only)"
|
||||||
|
usage: "EDIT [ON|OFF|REVERT|SHOW|HIDE|MAPBG|MAPCONN] [...]"
|
||||||
|
scope: [debug, editor]
|
||||||
|
dynamic_completions: true
|
||||||
|
completions:
|
||||||
|
EDIT: [ON, OFF, REVERT, SHOW, HIDE, MAPBG, MAPCONN]
|
||||||
|
EDIT SHOW: [INFO, GRID]
|
||||||
|
EDIT HIDE: [INFO, GRID]
|
||||||
|
|
||||||
|
- name: EDITOR
|
||||||
|
debug_only: true
|
||||||
|
scope: editor
|
||||||
|
commands:
|
||||||
|
- keyword: ENEMY
|
||||||
|
handler: cmd_enemy
|
||||||
|
description: "Add, delete or duplicate enemy"
|
||||||
|
usage: "ENEMY <ADD|DELETE|DUPLICATE>"
|
||||||
|
completions:
|
||||||
|
ENEMY: [ADD, DELETE, DUPLICATE]
|
||||||
|
|
||||||
|
- keyword: ITEM
|
||||||
|
handler: cmd_item
|
||||||
|
description: "Add, delete or duplicate item"
|
||||||
|
usage: "ITEM <ADD|DELETE|DUPLICATE>"
|
||||||
|
completions:
|
||||||
|
ITEM: [ADD, DELETE, DUPLICATE]
|
||||||
|
|
||||||
|
- keyword: SET
|
||||||
|
handler: cmd_set
|
||||||
|
description: "Set property (enemy, item or room)"
|
||||||
|
usage: "SET <property> <value>"
|
||||||
|
dynamic_completions: true
|
||||||
|
completions:
|
||||||
|
SET FLIP: [ON, OFF]
|
||||||
|
SET MIRROR: [ON, OFF]
|
||||||
|
SET CONVEYOR: [LEFT, NONE, RIGHT]
|
||||||
|
|
||||||
|
- name: CHEATS
|
||||||
|
scope: [game, editor]
|
||||||
|
commands:
|
||||||
|
- keyword: CHEAT
|
||||||
|
handler: cmd_cheat
|
||||||
|
description: "Game cheats (GAME only)"
|
||||||
|
usage: "CHEAT [INFINITE LIVES|INVINCIBILITY|OPEN THE JAIL|CLOSE THE JAIL]"
|
||||||
|
hidden: true
|
||||||
|
help_hidden: true
|
||||||
|
completions:
|
||||||
|
CHEAT: [INFINITE, INVINCIBILITY, OPEN, CLOSE]
|
||||||
|
CHEAT INFINITE: [LIVES]
|
||||||
|
CHEAT INFINITE LIVES: [ON, OFF]
|
||||||
|
CHEAT INVINCIBILITY: [ON, OFF]
|
||||||
|
CHEAT OPEN: [THE]
|
||||||
|
CHEAT OPEN THE: [JAIL]
|
||||||
|
CHEAT CLOSE: [THE]
|
||||||
|
CHEAT CLOSE THE: [JAIL]
|
||||||
|
debug_extras:
|
||||||
|
hidden: false
|
||||||
|
help_hidden: false
|
||||||
@@ -105,24 +105,24 @@ columns 15
|
|||||||
193 6 # Á
|
193 6 # Á
|
||||||
200 6 # È
|
200 6 # È
|
||||||
201 6 # É
|
201 6 # É
|
||||||
|
204 6 # Ì
|
||||||
205 6 # Í
|
205 6 # Í
|
||||||
207 6 # Ï
|
|
||||||
210 6 # Ò
|
210 6 # Ò
|
||||||
211 6 # Ó
|
211 6 # Ó
|
||||||
|
219 6 # Ù
|
||||||
218 6 # Ú
|
218 6 # Ú
|
||||||
220 6 # Ü
|
|
||||||
209 6 # Ñ
|
209 6 # Ñ
|
||||||
199 6 # Ç
|
199 6 # Ç
|
||||||
224 5 # à
|
224 5 # à
|
||||||
225 5 # á
|
225 5 # á
|
||||||
232 5 # è
|
232 5 # è
|
||||||
233 5 # é
|
233 5 # é
|
||||||
|
236 4 # ì
|
||||||
237 4 # í
|
237 4 # í
|
||||||
239 4 # ï
|
|
||||||
242 5 # ò
|
242 5 # ò
|
||||||
243 5 # ó
|
243 5 # ó
|
||||||
|
249 5 # ù
|
||||||
250 5 # ú
|
250 5 # ú
|
||||||
252 5 # ü
|
|
||||||
241 5 # ñ
|
241 5 # ñ
|
||||||
231 5 # ç
|
231 5 # ç
|
||||||
161 2 # ¡
|
161 2 # ¡
|
||||||
|
|||||||
@@ -101,24 +101,24 @@ columns 15
|
|||||||
193 6 # Á
|
193 6 # Á
|
||||||
200 7 # È
|
200 7 # È
|
||||||
201 7 # É
|
201 7 # É
|
||||||
|
204 6 # Ì
|
||||||
205 6 # Í
|
205 6 # Í
|
||||||
207 6 # Ï
|
|
||||||
210 7 # Ò
|
210 7 # Ò
|
||||||
211 7 # Ó
|
211 7 # Ó
|
||||||
|
217 6 # Ù
|
||||||
218 6 # Ú
|
218 6 # Ú
|
||||||
220 6 # Ü
|
|
||||||
209 7 # Ñ
|
209 7 # Ñ
|
||||||
199 7 # Ç
|
199 7 # Ç
|
||||||
224 6 # à
|
224 6 # à
|
||||||
225 6 # á
|
225 6 # á
|
||||||
232 7 # è
|
232 7 # è
|
||||||
233 7 # é
|
233 7 # é
|
||||||
|
236 6 # ì
|
||||||
237 6 # í
|
237 6 # í
|
||||||
239 6 # ï
|
|
||||||
242 7 # ò
|
242 7 # ò
|
||||||
243 7 # ó
|
243 7 # ó
|
||||||
|
249 6 # ù
|
||||||
250 6 # ú
|
250 6 # ú
|
||||||
252 6 # ü
|
|
||||||
241 7 # ñ
|
241 7 # ñ
|
||||||
231 7 # ç
|
231 7 # ç
|
||||||
161 2 # ¡
|
161 2 # ¡
|
||||||
|
|||||||
@@ -6,24 +6,24 @@ box_height 8
|
|||||||
columns 15
|
columns 15
|
||||||
|
|
||||||
# codepoint_decimal ancho_visual
|
# codepoint_decimal ancho_visual
|
||||||
32 8 # U+0020
|
32 7 # U+0020
|
||||||
33 5 # !
|
33 7 # !
|
||||||
34 6 # "
|
34 7 # "
|
||||||
35 7 # #
|
35 7 # #
|
||||||
36 7 # $
|
36 7 # $
|
||||||
37 7 # %
|
37 7 # %
|
||||||
38 7 # &
|
38 7 # &
|
||||||
39 4 # '
|
39 7 # '
|
||||||
40 6 # (
|
40 7 # (
|
||||||
41 5 # )
|
41 7 # )
|
||||||
42 7 # *
|
42 7 # *
|
||||||
43 7 # +
|
43 7 # +
|
||||||
44 4 # ,
|
44 7 # ,
|
||||||
45 7 # -
|
45 7 # -
|
||||||
46 4 # .
|
46 7 # .
|
||||||
47 7 # /
|
47 7 # /
|
||||||
48 7 # 0
|
48 7 # 0
|
||||||
49 6 # 1
|
49 7 # 1
|
||||||
50 7 # 2
|
50 7 # 2
|
||||||
51 7 # 3
|
51 7 # 3
|
||||||
52 7 # 4
|
52 7 # 4
|
||||||
@@ -32,11 +32,11 @@ columns 15
|
|||||||
55 7 # 7
|
55 7 # 7
|
||||||
56 7 # 8
|
56 7 # 8
|
||||||
57 7 # 9
|
57 7 # 9
|
||||||
58 4 # :
|
58 7 # :
|
||||||
59 4 # ;
|
59 7 # ;
|
||||||
60 6 # <
|
60 7 # <
|
||||||
61 6 # =
|
61 7 # =
|
||||||
62 6 # >
|
62 7 # >
|
||||||
63 7 # ?
|
63 7 # ?
|
||||||
64 7 # @
|
64 7 # @
|
||||||
65 7 # A
|
65 7 # A
|
||||||
@@ -47,7 +47,7 @@ columns 15
|
|||||||
70 7 # F
|
70 7 # F
|
||||||
71 7 # G
|
71 7 # G
|
||||||
72 7 # H
|
72 7 # H
|
||||||
73 6 # I
|
73 7 # I
|
||||||
74 7 # J
|
74 7 # J
|
||||||
75 7 # K
|
75 7 # K
|
||||||
76 7 # L
|
76 7 # L
|
||||||
@@ -65,12 +65,12 @@ columns 15
|
|||||||
88 7 # X
|
88 7 # X
|
||||||
89 7 # Y
|
89 7 # Y
|
||||||
90 7 # Z
|
90 7 # Z
|
||||||
91 6 # [
|
91 7 # [
|
||||||
92 7 # \
|
92 7 # \
|
||||||
93 5 # ]
|
93 7 # ]
|
||||||
94 6 # ^
|
94 7 # ^
|
||||||
95 7 # _
|
95 7 # _
|
||||||
96 4 # `
|
96 7 # `
|
||||||
97 7 # a
|
97 7 # a
|
||||||
98 7 # b
|
98 7 # b
|
||||||
99 7 # c
|
99 7 # c
|
||||||
@@ -79,7 +79,7 @@ columns 15
|
|||||||
102 7 # f
|
102 7 # f
|
||||||
103 7 # g
|
103 7 # g
|
||||||
104 7 # h
|
104 7 # h
|
||||||
105 6 # i
|
105 7 # i
|
||||||
106 7 # j
|
106 7 # j
|
||||||
107 7 # k
|
107 7 # k
|
||||||
108 7 # l
|
108 7 # l
|
||||||
@@ -97,36 +97,37 @@ columns 15
|
|||||||
120 7 # x
|
120 7 # x
|
||||||
121 7 # y
|
121 7 # y
|
||||||
122 7 # z
|
122 7 # z
|
||||||
123 6 # {
|
123 7 # {
|
||||||
124 5 # |
|
124 7 # |
|
||||||
125 5 # }
|
125 7 # }
|
||||||
126 7 # ~
|
126 7 # ~
|
||||||
192 7 # À
|
192 7 # À
|
||||||
193 7 # Á
|
193 7 # Á
|
||||||
200 7 # È
|
200 7 # È
|
||||||
201 7 # É
|
201 7 # É
|
||||||
205 6 # Í
|
204 7 # Ì
|
||||||
207 6 # Ï
|
205 7 # Í
|
||||||
210 7 # Ò
|
210 7 # Ò
|
||||||
211 7 # Ó
|
211 7 # Ó
|
||||||
|
217 7 # Ù
|
||||||
218 7 # Ú
|
218 7 # Ú
|
||||||
220 7 # Ü
|
|
||||||
209 7 # Ñ
|
209 7 # Ñ
|
||||||
199 7 # Ç
|
199 7 # Ç
|
||||||
224 7 # à
|
224 7 # à
|
||||||
225 7 # á
|
225 7 # á
|
||||||
232 7 # è
|
232 7 # è
|
||||||
233 7 # é
|
233 7 # é
|
||||||
237 6 # í
|
236 7 # ì
|
||||||
239 6 # ï
|
237 7 # í
|
||||||
242 7 # ò
|
242 7 # ò
|
||||||
243 7 # ó
|
243 7 # ó
|
||||||
|
249 7 # ù
|
||||||
250 7 # ú
|
250 7 # ú
|
||||||
252 7 # ü
|
|
||||||
241 7 # ñ
|
241 7 # ñ
|
||||||
231 7 # ç
|
231 7 # ç
|
||||||
161 5 # ¡
|
161 7 # ¡
|
||||||
191 7 # ¿
|
191 7 # ¿
|
||||||
171 7 # «
|
171 7 # «
|
||||||
187 7 # »
|
187 7 # »
|
||||||
183 4 # ·
|
183 7 # ·
|
||||||
|
228 7 # ä (corazón)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 968 B After Width: | Height: | Size: 1001 B |
@@ -105,24 +105,24 @@ columns 15
|
|||||||
193 5 # Á
|
193 5 # Á
|
||||||
200 4 # È
|
200 4 # È
|
||||||
201 4 # É
|
201 4 # É
|
||||||
|
204 1 # Ì
|
||||||
205 1 # Í
|
205 1 # Í
|
||||||
207 1 # Ï
|
|
||||||
210 5 # Ò
|
210 5 # Ò
|
||||||
211 5 # Ó
|
211 5 # Ó
|
||||||
|
217 5 # Ù
|
||||||
218 5 # Ú
|
218 5 # Ú
|
||||||
220 5 # Ü
|
|
||||||
209 5 # Ñ
|
209 5 # Ñ
|
||||||
199 5 # Ç
|
199 5 # Ç
|
||||||
224 4 # à
|
224 4 # à
|
||||||
225 4 # á
|
225 4 # á
|
||||||
232 4 # è
|
232 4 # è
|
||||||
233 4 # é
|
233 4 # é
|
||||||
|
236 1 # ì
|
||||||
237 1 # í
|
237 1 # í
|
||||||
239 1 # ï
|
|
||||||
242 4 # ò
|
242 4 # ò
|
||||||
243 4 # ó
|
243 4 # ó
|
||||||
|
249 4 # ù
|
||||||
250 4 # ú
|
250 4 # ú
|
||||||
252 4 # ü
|
|
||||||
241 4 # ñ
|
241 4 # ñ
|
||||||
231 3 # ç
|
231 3 # ç
|
||||||
161 1 # ¡
|
161 1 # ¡
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
# lang: ca
|
# lang: ca
|
||||||
|
|
||||||
title:
|
title:
|
||||||
marquee: "EH JAILEROS!! ESTEM EN 2022 I ENCARA HO PETEM COM EN 1998!! QUE, HO HEU SENTIT O NO? ELS JAILGAMES HAN TORNAT!! SÍ, COLLONS, HAN TORNAT!! MÉS DE 10 TÍTOLS QUE EL JAILDOC TÉ A FOC LENT!! AIXÒ ÉS UNA BARBARITAT, PERÒ... QUIN EIXIRÀ PRIMER? I ATENCIÓ, QUE HI HA UN APARELLET NOU QUE VOS FARÀ VOLAR EL CAP: EL P.A.C.O.! PERÒ UN MOMENT... QUÈ ÉS AQUELL ENCANTET QUE VE ALLÀ? OOOH, AQUELLA MINIASCII ÉS AMOR DEL BO!! LI PEGARIA UNA MOSSEGADA A CADA BYTE! OSTRES! I NO VOS OBLIDEU DE PUJAR AQUELLS JAILGAMES VELLS I PANXUTS DE MS-DOS A GITHUB, QUE SI NO ES PERDRAN!! QUIN SERÀ EL PROPER PROJECTE DEL JAILDOC? QUÈ PRENDRA VIDA? AI MARE... NI IDEA, PERÒ ACÍ PODEU SABER-HO SI RESOLGUEU EL DILEMA DEL JAILDOCTOR... VOS ATREVIU O QUÈ?"
|
marquee: "EI JAILERS!! ESTEM EN 2022 I ENCARA HO PETEM COM EN 1998!! QUÉ, HO HEU SENTIT O NO? ELS JAILGAMES HAN TORNAT!! SÍ, COLLONS, HAN TORNAT!! MÉS DE 10 TÍTOLS QUE EL JAILDOC TÉ EN LA CUINA A FOC LENT!! MOLT LENT!! AIXÒ ÉS UNA BARBARITAT, PERÒ... QUIN EIXIRÀ PRIMER? I ATENCIÓ, QUE HI HA UN APARELLET NOU QUE VOS FARÀ VOLAR EL CAP: EL P.A.C.O.! PERÒ UN MOMENT... QUÈ ÉS AQUELLA COSETA QUE VE PER ALLÀ? OOOH, AQUELLA MINIASCII ÉS AMOR DEL BO!! LI PEGARIA UNA LLEPAETA A CADA BYTE! OSTRES! I NO VOS OBLIDEU DE PUJAR AQUELLS JAILGAMES VELLS I PANXUTS DE MS-DOS A GITHUB, QUE SI NO ES PERDRAN!! QUIN SERÀ EL PRÒXIM PROJECTE DE JAILDOC? SERÀ UN PROJECTE DE MERDA? AI MARE... NI IDEA, PERÒ ACÍ PODEU SABER-HO SI RESOLEU EL DILEMA DEL JAILDOCTOR... VOS ATREVIU O QUÈ? VAAAAA!!!"
|
||||||
menu:
|
menu:
|
||||||
play: "1. JUGAR"
|
play: "1. JUGAR"
|
||||||
keyboard: "2. REDEFINIR TECLAT"
|
keyboard: "2. REDEFINIR TECLES"
|
||||||
joystick: "3. REDEFINIR MANDO"
|
joystick: "3. REDEFINIR MANDO"
|
||||||
projects: "4. PROJECTES"
|
projects: "4. PROJECTES"
|
||||||
keys:
|
keys:
|
||||||
@@ -42,11 +42,11 @@ ending:
|
|||||||
t6: "FOREN ALLIBERATS"
|
t6: "FOREN ALLIBERATS"
|
||||||
t7: "HI HAVIA FINS I TOT BARRULLS"
|
t7: "HI HAVIA FINS I TOT BARRULLS"
|
||||||
t8: "I BEGGINERS ENTRE LA GENT"
|
t8: "I BEGGINERS ENTRE LA GENT"
|
||||||
t9: "BRY ESTAVA FENT LLAGRIMETA..."
|
t9: "BRY ESTAVA PLORANT..."
|
||||||
t10: "PERÒ DE SOBTE ALGUNA COSA"
|
t10: "PERÒ DE SOBTE ALGUNA COSA"
|
||||||
t11: "LI VA CRIDAR L'ATENCIÓ"
|
t11: "LI VA CRIDAR L'ATENCIÓ"
|
||||||
t12: "UN MUNT DE FERRALLA!"
|
t12: "UN MUNT DE FERRALLA!"
|
||||||
t13: "PLE D'ANDROMINES QUE NI ANAVEN!!"
|
t13: "PLE DE TRASTOS QUE NI ANAVEN!!"
|
||||||
t14: "I ALESHORES,"
|
t14: "I ALESHORES,"
|
||||||
t15: "QUARANTA PROJECTES NOUS"
|
t15: "QUARANTA PROJECTES NOUS"
|
||||||
t16: "VAN NÀIXER..."
|
t16: "VAN NÀIXER..."
|
||||||
@@ -71,7 +71,7 @@ credits:
|
|||||||
f9: "F9 VORA DE LA PANTALLA"
|
f9: "F9 VORA DE LA PANTALLA"
|
||||||
author: "UN JOC DE JAILDESIGNER"
|
author: "UN JOC DE JAILDESIGNER"
|
||||||
date: "FET A L'ESTIU/TARDOR DEL 2022"
|
date: "FET A L'ESTIU/TARDOR DEL 2022"
|
||||||
love: "M'ENCANTEN ELS JAILGAMES!"
|
love: "I LOVE JAILGAMES! "
|
||||||
|
|
||||||
achievements:
|
achievements:
|
||||||
header: "ASSOLIMENT DESBLOQUEJAT!"
|
header: "ASSOLIMENT DESBLOQUEJAT!"
|
||||||
@@ -108,10 +108,15 @@ ui:
|
|||||||
fullscreen_enabled: "PANTALLA COMPLETA ACTIVADA"
|
fullscreen_enabled: "PANTALLA COMPLETA ACTIVADA"
|
||||||
fullscreen_disabled: "PANTALLA COMPLETA DESACTIVADA"
|
fullscreen_disabled: "PANTALLA COMPLETA DESACTIVADA"
|
||||||
window_zoom: "ZOOM FINESTRA x"
|
window_zoom: "ZOOM FINESTRA x"
|
||||||
postfx_enabled: "POSTFX ACTIVAT"
|
shaders_enabled: "SHADERS ACTIVATS"
|
||||||
postfx_disabled: "POSTFX DESACTIVAT"
|
shaders_disabled: "SHADERS DESACTIVATS"
|
||||||
|
shader: "SHADER"
|
||||||
postfx: "POSTFX"
|
postfx: "POSTFX"
|
||||||
|
crtpi: "CRTPI"
|
||||||
|
supersampling_enabled: "SUPERMOSTREIG ACTIVAT"
|
||||||
|
supersampling_disabled: "SUPERMOSTREIG DESACTIVAT"
|
||||||
palette: "PALETA"
|
palette: "PALETA"
|
||||||
|
palette_sort: "ORDENACIÓ PALETA"
|
||||||
integer_scale_enabled: "ESCALAT SENCER ACTIVAT"
|
integer_scale_enabled: "ESCALAT SENCER ACTIVAT"
|
||||||
integer_scale_disabled: "ESCALAT SENCER DESACTIVAT"
|
integer_scale_disabled: "ESCALAT SENCER DESACTIVAT"
|
||||||
vsync_enabled: "V-SYNC ACTIVAT"
|
vsync_enabled: "V-SYNC ACTIVAT"
|
||||||
@@ -121,6 +126,8 @@ scoreboard:
|
|||||||
items: "TRESORS PILLATS "
|
items: "TRESORS PILLATS "
|
||||||
time: " HORA "
|
time: " HORA "
|
||||||
rooms: "SALES"
|
rooms: "SALES"
|
||||||
|
cheat_infinite_lives: "vides inf"
|
||||||
|
cheat_invincibility: "inv"
|
||||||
|
|
||||||
game:
|
game:
|
||||||
music_enabled: "MÚSICA ACTIVADA"
|
music_enabled: "MÚSICA ACTIVADA"
|
||||||
@@ -134,3 +141,5 @@ game:
|
|||||||
cheat_jail_open: "JAIL OBERTA"
|
cheat_jail_open: "JAIL OBERTA"
|
||||||
debug_enabled: "DEBUG ACTIVAT"
|
debug_enabled: "DEBUG ACTIVAT"
|
||||||
debug_disabled: "DEBUG DESACTIVAT"
|
debug_disabled: "DEBUG DESACTIVAT"
|
||||||
|
editor_enabled: "EDITOR ACTIVAT"
|
||||||
|
editor_disabled: "EDITOR DESACTIVAT"
|
||||||
|
|||||||
@@ -108,10 +108,15 @@ ui:
|
|||||||
fullscreen_enabled: "FULLSCREEN ENABLED"
|
fullscreen_enabled: "FULLSCREEN ENABLED"
|
||||||
fullscreen_disabled: "FULLSCREEN DISABLED"
|
fullscreen_disabled: "FULLSCREEN DISABLED"
|
||||||
window_zoom: "WINDOW ZOOM x"
|
window_zoom: "WINDOW ZOOM x"
|
||||||
postfx_enabled: "POSTFX ENABLED"
|
shaders_enabled: "SHADERS ON"
|
||||||
postfx_disabled: "POSTFX DISABLED"
|
shaders_disabled: "SHADERS OFF"
|
||||||
|
shader: "SHADER"
|
||||||
postfx: "POSTFX"
|
postfx: "POSTFX"
|
||||||
|
crtpi: "CRTPI"
|
||||||
|
supersampling_enabled: "SUPERSAMPLING ON"
|
||||||
|
supersampling_disabled: "SUPERSAMPLING OFF"
|
||||||
palette: "PALETTE"
|
palette: "PALETTE"
|
||||||
|
palette_sort: "PALETTE SORT"
|
||||||
integer_scale_enabled: "INTEGER SCALE ENABLED"
|
integer_scale_enabled: "INTEGER SCALE ENABLED"
|
||||||
integer_scale_disabled: "INTEGER SCALE DISABLED"
|
integer_scale_disabled: "INTEGER SCALE DISABLED"
|
||||||
vsync_enabled: "V-SYNC ENABLED"
|
vsync_enabled: "V-SYNC ENABLED"
|
||||||
@@ -121,6 +126,8 @@ scoreboard:
|
|||||||
items: "ITEMS COLLECTED "
|
items: "ITEMS COLLECTED "
|
||||||
time: " TIME "
|
time: " TIME "
|
||||||
rooms: "ROOMS"
|
rooms: "ROOMS"
|
||||||
|
cheat_infinite_lives: "inf lives"
|
||||||
|
cheat_invincibility: "inv"
|
||||||
|
|
||||||
game:
|
game:
|
||||||
music_enabled: "MUSIC ENABLED"
|
music_enabled: "MUSIC ENABLED"
|
||||||
@@ -134,3 +141,5 @@ game:
|
|||||||
cheat_jail_open: "JAIL IS OPEN"
|
cheat_jail_open: "JAIL IS OPEN"
|
||||||
debug_enabled: "DEBUG ENABLED"
|
debug_enabled: "DEBUG ENABLED"
|
||||||
debug_disabled: "DEBUG DISABLED"
|
debug_disabled: "DEBUG DISABLED"
|
||||||
|
editor_enabled: "EDITOR ENABLED"
|
||||||
|
editor_disabled: "EDITOR DISABLED"
|
||||||
|
|||||||
19
data/palette/aged-terracotta.pal
Normal file
19
data/palette/aged-terracotta.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
52 49 40
|
||||||
|
80 73 57
|
||||||
|
92 104 82
|
||||||
|
108 116 76
|
||||||
|
125 130 73
|
||||||
|
163 158 85
|
||||||
|
202 181 103
|
||||||
|
119 63 53
|
||||||
|
132 86 64
|
||||||
|
160 119 84
|
||||||
|
188 153 120
|
||||||
|
214 193 157
|
||||||
|
234 220 193
|
||||||
|
247 240 221
|
||||||
|
255 251 237
|
||||||
|
255 255 255
|
||||||
19
data/palette/antiquity.pal
Normal file
19
data/palette/antiquity.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
32 32 32
|
||||||
|
45 33 30
|
||||||
|
69 41 35
|
||||||
|
109 61 41
|
||||||
|
177 107 74
|
||||||
|
232 159 110
|
||||||
|
232 190 130
|
||||||
|
93 117 87
|
||||||
|
142 146 87
|
||||||
|
112 123 136
|
||||||
|
138 167 172
|
||||||
|
229 93 77
|
||||||
|
241 134 108
|
||||||
|
210 103 48
|
||||||
|
222 154 40
|
||||||
|
232 216 165
|
||||||
19
data/palette/bubblegum.pal
Normal file
19
data/palette/bubblegum.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
22 23 26
|
||||||
|
127 6 34
|
||||||
|
214 36 17
|
||||||
|
255 132 38
|
||||||
|
255 209 0
|
||||||
|
250 253 255
|
||||||
|
255 128 164
|
||||||
|
255 38 116
|
||||||
|
148 33 106
|
||||||
|
67 0 103
|
||||||
|
35 73 117
|
||||||
|
104 174 212
|
||||||
|
191 255 60
|
||||||
|
16 210 117
|
||||||
|
0 120 153
|
||||||
|
0 40 89
|
||||||
19
data/palette/darkseed.pal
Normal file
19
data/palette/darkseed.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
0 0 0
|
||||||
|
0 20 24
|
||||||
|
0 32 36
|
||||||
|
0 44 56
|
||||||
|
20 52 68
|
||||||
|
68 52 68
|
||||||
|
88 60 72
|
||||||
|
108 76 68
|
||||||
|
128 96 88
|
||||||
|
108 112 108
|
||||||
|
136 128 120
|
||||||
|
164 148 132
|
||||||
|
196 172 156
|
||||||
|
216 176 168
|
||||||
|
236 212 208
|
||||||
|
252 252 252
|
||||||
19
data/palette/h16da.pal
Normal file
19
data/palette/h16da.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
226 217 228
|
||||||
|
108 154 154
|
||||||
|
82 103 93
|
||||||
|
55 64 59
|
||||||
|
243 200 147
|
||||||
|
229 152 125
|
||||||
|
203 94 92
|
||||||
|
114 51 76
|
||||||
|
192 165 169
|
||||||
|
191 125 133
|
||||||
|
128 77 83
|
||||||
|
64 48 56
|
||||||
|
124 143 178
|
||||||
|
76 82 116
|
||||||
|
46 51 77
|
||||||
|
31 32 37
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
JASC-PAL
|
JASC-PAL
|
||||||
0100
|
0100
|
||||||
16
|
16
|
||||||
255 255 255
|
255 255 255
|
||||||
109 247 193
|
109 247 193
|
||||||
17 173 193
|
17 173 193
|
||||||
96 108 129
|
96 108 129
|
||||||
57 52 87
|
57 52 87
|
||||||
30 136 117
|
30 136 117
|
||||||
91 179 97
|
91 179 97
|
||||||
161 229 90
|
161 229 90
|
||||||
247 228 118
|
247 228 118
|
||||||
249 146 82
|
249 146 82
|
||||||
203 77 104
|
203 77 104
|
||||||
106 55 113
|
106 55 113
|
||||||
201 36 100
|
201 36 100
|
||||||
244 140 182
|
244 140 182
|
||||||
247 182 158
|
247 182 158
|
||||||
155 156 130
|
155 156 130
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
JASC-PAL
|
JASC-PAL
|
||||||
0100
|
0100
|
||||||
16
|
16
|
||||||
209 177 135
|
209 177 135
|
||||||
199 123 88
|
199 123 88
|
||||||
174 93 64
|
174 93 64
|
||||||
121 68 74
|
121 68 74
|
||||||
75 61 68
|
75 61 68
|
||||||
186 145 88
|
186 145 88
|
||||||
146 116 65
|
146 116 65
|
||||||
77 69 57
|
77 69 57
|
||||||
119 116 59
|
119 116 59
|
||||||
179 165 85
|
179 165 85
|
||||||
210 201 165
|
210 201 165
|
||||||
140 171 161
|
140 171 161
|
||||||
75 114 110
|
75 114 110
|
||||||
87 72 82
|
87 72 82
|
||||||
132 120 117
|
132 120 117
|
||||||
171 155 142
|
171 155 142
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
JASC-PAL
|
JASC-PAL
|
||||||
0100
|
0100
|
||||||
16
|
16
|
||||||
140 143 174
|
140 143 174
|
||||||
88 69 99
|
88 69 99
|
||||||
62 33 55
|
62 33 55
|
||||||
154 99 72
|
154 99 72
|
||||||
215 155 125
|
215 155 125
|
||||||
245 237 186
|
245 237 186
|
||||||
192 199 65
|
192 199 65
|
||||||
100 125 52
|
100 125 52
|
||||||
228 148 58
|
228 148 58
|
||||||
157 48 59
|
157 48 59
|
||||||
210 100 113
|
210 100 113
|
||||||
112 55 127
|
112 55 127
|
||||||
126 196 193
|
126 196 193
|
||||||
52 133 157
|
52 133 157
|
||||||
23 67 75
|
23 67 75
|
||||||
31 14 28
|
31 14 28
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
JASC-PAL
|
JASC-PAL
|
||||||
0100
|
0100
|
||||||
16
|
16
|
||||||
0 0 0
|
0 0 0
|
||||||
29 43 83
|
29 43 83
|
||||||
126 37 83
|
126 37 83
|
||||||
0 135 81
|
0 135 81
|
||||||
171 82 54
|
171 82 54
|
||||||
95 87 79
|
95 87 79
|
||||||
194 195 199
|
194 195 199
|
||||||
255 241 232
|
255 241 232
|
||||||
255 0 77
|
255 0 77
|
||||||
255 163 0
|
255 163 0
|
||||||
255 236 39
|
255 236 39
|
||||||
0 228 54
|
0 228 54
|
||||||
41 173 255
|
41 173 255
|
||||||
131 118 156
|
131 118 156
|
||||||
255 119 168
|
255 119 168
|
||||||
255 204 170
|
255 204 170
|
||||||
|
|||||||
19
data/palette/psychic-fibre.pal
Normal file
19
data/palette/psychic-fibre.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
10 8 25
|
||||||
|
49 50 67
|
||||||
|
69 59 70
|
||||||
|
87 84 117
|
||||||
|
130 105 128
|
||||||
|
164 111 114
|
||||||
|
185 115 113
|
||||||
|
205 95 105
|
||||||
|
229 76 81
|
||||||
|
201 55 73
|
||||||
|
144 161 168
|
||||||
|
140 147 137
|
||||||
|
195 150 145
|
||||||
|
236 151 134
|
||||||
|
235 171 145
|
||||||
|
219 182 167
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
JASC-PAL
|
JASC-PAL
|
||||||
0100
|
0100
|
||||||
16
|
16
|
||||||
17 17 37
|
17 17 37
|
||||||
82 75 109
|
82 75 109
|
||||||
176 201 196
|
176 201 196
|
||||||
255 252 241
|
255 252 241
|
||||||
36 34 114
|
36 34 114
|
||||||
52 112 190
|
52 112 190
|
||||||
159 32 98
|
159 32 98
|
||||||
255 94 57
|
255 94 57
|
||||||
150 58 191
|
150 58 191
|
||||||
255 105 246
|
255 105 246
|
||||||
44 126 75
|
44 126 75
|
||||||
160 195 95
|
160 195 95
|
||||||
67 152 196
|
67 152 196
|
||||||
147 255 229
|
147 255 229
|
||||||
210 133 55
|
210 133 55
|
||||||
254 245 107
|
254 245 107
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
JASC-PAL
|
JASC-PAL
|
||||||
0100
|
0100
|
||||||
16
|
16
|
||||||
15 11 56
|
15 11 56
|
||||||
97 106 130
|
97 106 130
|
||||||
173 180 183
|
173 180 183
|
||||||
249 255 236
|
249 255 236
|
||||||
40 19 160
|
40 19 160
|
||||||
74 107 255
|
74 107 255
|
||||||
160 35 17
|
160 35 17
|
||||||
237 23 95
|
237 23 95
|
||||||
115 16 147
|
115 16 147
|
||||||
238 20 181
|
238 20 181
|
||||||
39 139 97
|
39 139 97
|
||||||
157 255 38
|
157 255 38
|
||||||
27 105 167
|
27 105 167
|
||||||
71 233 223
|
71 233 223
|
||||||
122 87 22
|
122 87 22
|
||||||
247 229 77
|
247 229 77
|
||||||
|
|||||||
19
data/palette/shido-cyberneon.pal
Normal file
19
data/palette/shido-cyberneon.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
0 3 60
|
||||||
|
0 82 96
|
||||||
|
0 157 74
|
||||||
|
10 255 82
|
||||||
|
0 56 132
|
||||||
|
0 138 197
|
||||||
|
0 247 255
|
||||||
|
255 92 255
|
||||||
|
172 41 206
|
||||||
|
96 0 136
|
||||||
|
177 5 133
|
||||||
|
255 0 78
|
||||||
|
42 46 121
|
||||||
|
78 110 168
|
||||||
|
173 212 250
|
||||||
|
255 255 255
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
JASC-PAL
|
JASC-PAL
|
||||||
0100
|
0100
|
||||||
16
|
16
|
||||||
33 59 37
|
33 59 37
|
||||||
58 96 74
|
58 96 74
|
||||||
79 119 84
|
79 119 84
|
||||||
161 159 124
|
161 159 124
|
||||||
119 116 79
|
119 116 79
|
||||||
119 92 79
|
119 92 79
|
||||||
96 59 58
|
96 59 58
|
||||||
59 33 55
|
59 33 55
|
||||||
23 14 25
|
23 14 25
|
||||||
47 33 59
|
47 33 59
|
||||||
67 58 96
|
67 58 96
|
||||||
79 82 119
|
79 82 119
|
||||||
101 115 140
|
101 115 140
|
||||||
124 148 161
|
124 148 161
|
||||||
160 185 186
|
160 185 186
|
||||||
192 209 204
|
192 209 204
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
JASC-PAL
|
|
||||||
0100
|
|
||||||
16
|
|
||||||
26 28 44
|
|
||||||
93 39 93
|
|
||||||
177 62 83
|
|
||||||
239 125 87
|
|
||||||
255 205 117
|
|
||||||
167 240 112
|
|
||||||
56 183 100
|
|
||||||
37 113 121
|
|
||||||
41 54 111
|
|
||||||
59 93 201
|
|
||||||
65 166 246
|
|
||||||
115 239 247
|
|
||||||
244 244 244
|
|
||||||
148 176 194
|
|
||||||
86 108 134
|
|
||||||
51 60 87
|
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
JASC-PAL
|
JASC-PAL
|
||||||
0100
|
0100
|
||||||
16
|
16
|
||||||
26 28 44
|
26 28 44
|
||||||
41 54 111
|
93 39 93
|
||||||
51 60 87
|
177 62 83
|
||||||
86 108 134
|
239 125 87
|
||||||
59 93 201
|
255 205 117
|
||||||
37 113 121
|
167 240 112
|
||||||
93 39 93
|
56 183 100
|
||||||
177 62 83
|
37 113 121
|
||||||
56 183 100
|
41 54 111
|
||||||
167 240 112
|
59 93 201
|
||||||
65 166 246
|
65 166 246
|
||||||
115 239 247
|
115 239 247
|
||||||
239 125 87
|
244 244 244
|
||||||
255 205 117
|
148 176 194
|
||||||
148 176 194
|
86 108 134
|
||||||
244 244 244
|
51 60 87
|
||||||
19
data/palette/vanilla-milkshake.pal
Normal file
19
data/palette/vanilla-milkshake.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
40 40 46
|
||||||
|
108 86 113
|
||||||
|
217 200 191
|
||||||
|
249 130 132
|
||||||
|
176 169 228
|
||||||
|
172 204 228
|
||||||
|
179 227 218
|
||||||
|
254 170 228
|
||||||
|
135 168 137
|
||||||
|
176 235 147
|
||||||
|
233 245 157
|
||||||
|
255 230 198
|
||||||
|
222 163 139
|
||||||
|
255 195 132
|
||||||
|
255 247 160
|
||||||
|
255 247 228
|
||||||
19
data/palette/winds-seed-pc98.pal
Normal file
19
data/palette/winds-seed-pc98.pal
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
16
|
||||||
|
0 0 0
|
||||||
|
50 1 50
|
||||||
|
84 1 103
|
||||||
|
118 50 118
|
||||||
|
50 50 171
|
||||||
|
35 103 239
|
||||||
|
152 186 220
|
||||||
|
253 253 253
|
||||||
|
1 186 152
|
||||||
|
1 137 84
|
||||||
|
254 239 69
|
||||||
|
119 70 2
|
||||||
|
186 118 84
|
||||||
|
254 1 69
|
||||||
|
239 152 152
|
||||||
|
254 205 205
|
||||||
@@ -4,17 +4,7 @@ frameWidth: 8
|
|||||||
frameHeight: 16
|
frameHeight: 16
|
||||||
|
|
||||||
animations:
|
animations:
|
||||||
- name: stand
|
- name: default
|
||||||
speed: 0.1333
|
|
||||||
loop: 0
|
|
||||||
frames: [0]
|
|
||||||
|
|
||||||
- name: walk
|
|
||||||
speed: 0.1333
|
speed: 0.1333
|
||||||
loop: 0
|
loop: 0
|
||||||
frames: [0, 1, 2, 3]
|
frames: [0, 1, 2, 3]
|
||||||
|
|
||||||
- name: walk_menu
|
|
||||||
speed: 0.0
|
|
||||||
loop: 0
|
|
||||||
frames: [0, 1, 2, 3]
|
|
||||||
|
|||||||
@@ -4,17 +4,7 @@ frameWidth: 8
|
|||||||
frameHeight: 16
|
frameHeight: 16
|
||||||
|
|
||||||
animations:
|
animations:
|
||||||
- name: stand
|
- name: default
|
||||||
speed: 0.1333
|
|
||||||
loop: 0
|
|
||||||
frames: [0]
|
|
||||||
|
|
||||||
- name: walk
|
|
||||||
speed: 0.1333
|
speed: 0.1333
|
||||||
loop: 0
|
loop: 0
|
||||||
frames: [0, 1, 2, 3, 4, 5, 6, 7]
|
frames: [0, 1, 2, 3, 4, 5, 6, 7]
|
||||||
|
|
||||||
- name: walk_menu
|
|
||||||
speed: 0.0
|
|
||||||
loop: 0
|
|
||||||
frames: [0, 1, 2, 3, 4, 5, 6, 7]
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# BIG JUMP
|
# BIG JUMP
|
||||||
room:
|
room:
|
||||||
name_en: "BIG JUMP"
|
name_en: "BIG JUMP"
|
||||||
name_ca: "GRAN SALT"
|
name_ca: "EL GRAN BOT"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: red
|
border: red
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# WELCOME TO MY ABBEY
|
# WELCOME TO MY ABBEY
|
||||||
room:
|
room:
|
||||||
name_en: "WELCOME TO MY ABBEY"
|
name_en: "WELCOME TO MY ABBEY"
|
||||||
name_ca: "BENVINGUT A LA MEVA ABADIA"
|
name_ca: "BENVINGUT A LA MEUA ABADIA"
|
||||||
bgColor: blue
|
bgColor: blue
|
||||||
border: yellow
|
border: yellow
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# TREE TOP
|
# TREE TOP
|
||||||
room:
|
room:
|
||||||
name_en: "TREE TOP"
|
name_en: "TREE TOP"
|
||||||
name_ca: "AMUNT DE L'ARBRE"
|
name_ca: "DALT DE L'ARBRE"
|
||||||
bgColor: bright_black
|
bgColor: bright_black
|
||||||
border: blue
|
border: blue
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# LAZY ROOM
|
# LAZY ROOM
|
||||||
room:
|
room:
|
||||||
name_en: "LAZY ROOM"
|
name_en: "LAZY ROOM"
|
||||||
name_ca: "SALA DE LA PEREA"
|
name_ca: "LA SALA GOSSA"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: blue
|
border: blue
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# KILLING SPREE
|
# KILLING SPREE
|
||||||
room:
|
room:
|
||||||
name_en: "KILLING SPREE"
|
name_en: "KILLING SPREE"
|
||||||
name_ca: "MATANCA INDISCRIMINADA"
|
name_ca: "MATANÇA INDISCRIMINADA"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: blue
|
border: blue
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# NOW THIS IS THE BATCAVE!
|
# NOW THIS IS THE BATCAVE!
|
||||||
room:
|
room:
|
||||||
name_en: "NOW THIS IS THE BATCAVE!"
|
name_en: "NOW THIS IS THE BATCAVE!"
|
||||||
name_ca: "AQUESTA SI QUE ES LA BATCOVA!"
|
name_ca: "ESTA SI QUE ES LA BATCOVA!"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: black
|
border: black
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# THE FRIDGE
|
# THE FRIDGE
|
||||||
room:
|
room:
|
||||||
name_en: "THE FRIDGE"
|
name_en: "THE FRIDGE"
|
||||||
name_ca: "LA NEVERA"
|
name_ca: "EL FRIGO"
|
||||||
bgColor: blue
|
bgColor: blue
|
||||||
border: blue
|
border: blue
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# I DID NOT COPY THIS ONE
|
# I DID NOT COPY THIS ONE
|
||||||
room:
|
room:
|
||||||
name_en: "I DID NOT COPY THIS ONE"
|
name_en: "I DID NOT COPY THIS ONE"
|
||||||
name_ca: "ESTA NO LA HE COPIADA, NO"
|
name_ca: "ESTA NO LA HE COPIADA"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: magenta
|
border: magenta
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# THIS CAN'T BE THE BATCAVE
|
# THIS CAN'T BE THE BATCAVE
|
||||||
room:
|
room:
|
||||||
name_en: "THIS CAN'T BE THE BATCAVE"
|
name_en: "THIS CAN'T BE THE BATCAVE"
|
||||||
name_ca: "AQUESTA NO POT SER LA BATCOVA"
|
name_ca: "ESTA NO POT SER LA BATCOVA"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: cyan
|
border: cyan
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# ENTER PAKU SIMBEL
|
# ENTER PAKU SIMBEL
|
||||||
room:
|
room:
|
||||||
name_en: "ENTER PAKU SIMBEL"
|
name_en: "ENTER PAKU SIMBEL"
|
||||||
name_ca: "ENTRANT A PAKU SIMBEL"
|
name_ca: "ACCEDINT A PAKU SIMBEL"
|
||||||
bgColor: bright_black
|
bgColor: bright_black
|
||||||
border: yellow
|
border: yellow
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# } WE ALL LOVE JAILGAMES }
|
# } WE ALL LOVE JAILGAMES }
|
||||||
room:
|
room:
|
||||||
name_en: "} WE ALL LOVE JAILGAMES }"
|
name_en: "ä WE ALL LOVE JAILGAMES ä"
|
||||||
name_ca: "} AMOR PELS JAILGAMES }"
|
name_ca: "ä AMOR PELS JAILGAMES ä"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: bright_black
|
border: bright_black
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# PREVENT THE CRISIS
|
# PREVENT THE CRISIS
|
||||||
room:
|
room:
|
||||||
name_en: "PREVENT THE CRISIS"
|
name_en: "PREVENT THE CRISIS"
|
||||||
name_ca: "PREVEU LA CRISI"
|
name_ca: "EVITA LA CRISI"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: bright_magenta
|
border: bright_magenta
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# AROUND WITH ME
|
# AROUND WITH ME
|
||||||
room:
|
room:
|
||||||
name_en: "AROUND WITH ME"
|
name_en: "AROUND WITH ME"
|
||||||
name_ca: "VOLTA AMB MI"
|
name_ca: "AROUNDA AMB MI"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: blue
|
border: blue
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# SANDWITCH AND COUNTER
|
# SANDWITCH AND COUNTER
|
||||||
room:
|
room:
|
||||||
name_en: "SANDWITCH AND COUNTER"
|
name_en: "SANDWITCH AND COUNTER"
|
||||||
name_ca: "SANDVITX I COUNTER S."
|
name_ca: "SANDVITX I COUNTER STRIKE"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: cyan
|
border: cyan
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# FEEL THE HEAT
|
# FEEL THE HEAT
|
||||||
room:
|
room:
|
||||||
name_en: "FEEL THE HEAT"
|
name_en: "FEEL THE HEAT"
|
||||||
name_ca: "NOTA LA CALOR"
|
name_ca: "NOTA EL CALORET"
|
||||||
bgColor: bright_black
|
bgColor: bright_black
|
||||||
border: bright_yellow
|
border: bright_yellow
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# WE NEED A ROBOT
|
# WE NEED A ROBOT
|
||||||
room:
|
room:
|
||||||
name_en: "WE NEED A ROBOT"
|
name_en: "WE NEED A JAILROBOT"
|
||||||
name_ca: "NECESSITEM UN ROBOT"
|
name_ca: "NECESSITEM UN JAILROBOT"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: red
|
border: red
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# STORED JAILGAMES
|
# STORED JAILGAMES
|
||||||
room:
|
room:
|
||||||
name_en: "STORED JAILGAMES"
|
name_en: "STORED JAILGAMES"
|
||||||
name_ca: "JAILGAMES EMMAGATZEMATS"
|
name_ca: "EL MAGATZEM DE JAILGAMES"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: blue
|
border: blue
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# P.A.C.O. WORKSHOP
|
# P.A.C.O. WORKSHOP
|
||||||
room:
|
room:
|
||||||
name_en: "P.A.C.O. WORKSHOP"
|
name_en: "P.A.C.O. WORKSHOP"
|
||||||
name_ca: "TALLER DE P.A.C.O."
|
name_ca: "EL TALLER DE P.A.C.O."
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: yellow
|
border: yellow
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# CHIRPING
|
# CHIRPING
|
||||||
room:
|
room:
|
||||||
name_en: "CHIRPING DEVELOPMENT"
|
name_en: "CHIRPING"
|
||||||
name_ca: "DESENVOLUPANT CHIRPING"
|
name_ca: "CHIRPING"
|
||||||
bgColor: black
|
bgColor: black
|
||||||
border: magenta
|
border: magenta
|
||||||
tileSetFile: standard.gif
|
tileSetFile: standard.gif
|
||||||
|
|||||||
157
data/shaders/crtpi.glsl
Normal file
157
data/shaders/crtpi.glsl
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
#version 330 core
|
||||||
|
|
||||||
|
// Configuración
|
||||||
|
#define SCANLINES
|
||||||
|
#define MULTISAMPLE
|
||||||
|
#define GAMMA
|
||||||
|
//#define FAKE_GAMMA
|
||||||
|
//#define CURVATURE
|
||||||
|
//#define SHARPER
|
||||||
|
#define MASK_TYPE 2
|
||||||
|
|
||||||
|
#define CURVATURE_X 0.05
|
||||||
|
#define CURVATURE_Y 0.1
|
||||||
|
#define MASK_BRIGHTNESS 0.80
|
||||||
|
#define SCANLINE_WEIGHT 6.0
|
||||||
|
#define SCANLINE_GAP_BRIGHTNESS 0.12
|
||||||
|
#define BLOOM_FACTOR 3.5
|
||||||
|
#define INPUT_GAMMA 2.4
|
||||||
|
#define OUTPUT_GAMMA 2.2
|
||||||
|
|
||||||
|
// Inputs desde vertex shader
|
||||||
|
in vec2 vTexCoord;
|
||||||
|
in float vFilterWidth;
|
||||||
|
#if defined(CURVATURE)
|
||||||
|
in vec2 vScreenScale;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Output
|
||||||
|
out vec4 FragColor;
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
uniform sampler2D Texture;
|
||||||
|
uniform vec2 TextureSize;
|
||||||
|
|
||||||
|
#if defined(CURVATURE)
|
||||||
|
vec2 Distort(vec2 coord)
|
||||||
|
{
|
||||||
|
vec2 CURVATURE_DISTORTION = vec2(CURVATURE_X, CURVATURE_Y);
|
||||||
|
vec2 barrelScale = 1.0 - (0.23 * CURVATURE_DISTORTION);
|
||||||
|
coord *= vScreenScale;
|
||||||
|
coord -= vec2(0.5);
|
||||||
|
float rsq = coord.x * coord.x + coord.y * coord.y;
|
||||||
|
coord += coord * (CURVATURE_DISTORTION * rsq);
|
||||||
|
coord *= barrelScale;
|
||||||
|
if (abs(coord.x) >= 0.5 || abs(coord.y) >= 0.5)
|
||||||
|
coord = vec2(-1.0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coord += vec2(0.5);
|
||||||
|
coord /= vScreenScale;
|
||||||
|
}
|
||||||
|
return coord;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float CalcScanLineWeight(float dist)
|
||||||
|
{
|
||||||
|
return max(1.0 - dist * dist * SCANLINE_WEIGHT, SCANLINE_GAP_BRIGHTNESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
float CalcScanLine(float dy)
|
||||||
|
{
|
||||||
|
float scanLineWeight = CalcScanLineWeight(dy);
|
||||||
|
#if defined(MULTISAMPLE)
|
||||||
|
scanLineWeight += CalcScanLineWeight(dy - vFilterWidth);
|
||||||
|
scanLineWeight += CalcScanLineWeight(dy + vFilterWidth);
|
||||||
|
scanLineWeight *= 0.3333333;
|
||||||
|
#endif
|
||||||
|
return scanLineWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
#if defined(CURVATURE)
|
||||||
|
vec2 texcoord = Distort(vTexCoord);
|
||||||
|
if (texcoord.x < 0.0) {
|
||||||
|
FragColor = vec4(0.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
vec2 texcoord = vTexCoord;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec2 texcoordInPixels = texcoord * TextureSize;
|
||||||
|
|
||||||
|
#if defined(SHARPER)
|
||||||
|
vec2 tempCoord = floor(texcoordInPixels) + 0.5;
|
||||||
|
vec2 coord = tempCoord / TextureSize;
|
||||||
|
vec2 deltas = texcoordInPixels - tempCoord;
|
||||||
|
float scanLineWeight = CalcScanLine(deltas.y);
|
||||||
|
vec2 signs = sign(deltas);
|
||||||
|
deltas.x *= 2.0;
|
||||||
|
deltas = deltas * deltas;
|
||||||
|
deltas.y = deltas.y * deltas.y;
|
||||||
|
deltas.x *= 0.5;
|
||||||
|
deltas.y *= 8.0;
|
||||||
|
deltas /= TextureSize;
|
||||||
|
deltas *= signs;
|
||||||
|
vec2 tc = coord + deltas;
|
||||||
|
#else
|
||||||
|
float tempY = floor(texcoordInPixels.y) + 0.5;
|
||||||
|
float yCoord = tempY / TextureSize.y;
|
||||||
|
float dy = texcoordInPixels.y - tempY;
|
||||||
|
float scanLineWeight = CalcScanLine(dy);
|
||||||
|
float signY = sign(dy);
|
||||||
|
dy = dy * dy;
|
||||||
|
dy = dy * dy;
|
||||||
|
dy *= 8.0;
|
||||||
|
dy /= TextureSize.y;
|
||||||
|
dy *= signY;
|
||||||
|
vec2 tc = vec2(texcoord.x, yCoord + dy);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec3 colour = texture(Texture, tc).rgb;
|
||||||
|
|
||||||
|
#if defined(SCANLINES)
|
||||||
|
#if defined(GAMMA)
|
||||||
|
#if defined(FAKE_GAMMA)
|
||||||
|
colour = colour * colour;
|
||||||
|
#else
|
||||||
|
colour = pow(colour, vec3(INPUT_GAMMA));
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
scanLineWeight *= BLOOM_FACTOR;
|
||||||
|
colour *= scanLineWeight;
|
||||||
|
|
||||||
|
#if defined(GAMMA)
|
||||||
|
#if defined(FAKE_GAMMA)
|
||||||
|
colour = sqrt(colour);
|
||||||
|
#else
|
||||||
|
colour = pow(colour, vec3(1.0 / OUTPUT_GAMMA));
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MASK_TYPE == 0
|
||||||
|
FragColor = vec4(colour, 1.0);
|
||||||
|
#elif MASK_TYPE == 1
|
||||||
|
float whichMask = fract(gl_FragCoord.x * 0.5);
|
||||||
|
vec3 mask;
|
||||||
|
if (whichMask < 0.5)
|
||||||
|
mask = vec3(MASK_BRIGHTNESS, 1.0, MASK_BRIGHTNESS);
|
||||||
|
else
|
||||||
|
mask = vec3(1.0, MASK_BRIGHTNESS, 1.0);
|
||||||
|
FragColor = vec4(colour * mask, 1.0);
|
||||||
|
#elif MASK_TYPE == 2
|
||||||
|
float whichMask = fract(gl_FragCoord.x * 0.3333333);
|
||||||
|
vec3 mask = vec3(MASK_BRIGHTNESS, MASK_BRIGHTNESS, MASK_BRIGHTNESS);
|
||||||
|
if (whichMask < 0.3333333)
|
||||||
|
mask.x = 1.0;
|
||||||
|
else if (whichMask < 0.6666666)
|
||||||
|
mask.y = 1.0;
|
||||||
|
else
|
||||||
|
mask.z = 1.0;
|
||||||
|
FragColor = vec4(colour * mask, 1.0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
48
data/shaders/crtpi.vert
Normal file
48
data/shaders/crtpi.vert
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#version 330 core
|
||||||
|
|
||||||
|
// Configuración
|
||||||
|
#define SCANLINES
|
||||||
|
#define MULTISAMPLE
|
||||||
|
#define GAMMA
|
||||||
|
//#define FAKE_GAMMA
|
||||||
|
//#define CURVATURE
|
||||||
|
//#define SHARPER
|
||||||
|
#define MASK_TYPE 2
|
||||||
|
|
||||||
|
#define CURVATURE_X 0.05
|
||||||
|
#define CURVATURE_Y 0.1
|
||||||
|
#define MASK_BRIGHTNESS 0.80
|
||||||
|
#define SCANLINE_WEIGHT 6.0
|
||||||
|
#define SCANLINE_GAP_BRIGHTNESS 0.12
|
||||||
|
#define BLOOM_FACTOR 3.5
|
||||||
|
#define INPUT_GAMMA 2.4
|
||||||
|
#define OUTPUT_GAMMA 2.2
|
||||||
|
|
||||||
|
// Inputs (desde VAO)
|
||||||
|
layout(location = 0) in vec2 aPosition;
|
||||||
|
layout(location = 1) in vec2 aTexCoord;
|
||||||
|
|
||||||
|
// Outputs al fragment shader
|
||||||
|
out vec2 vTexCoord;
|
||||||
|
out float vFilterWidth;
|
||||||
|
#if defined(CURVATURE)
|
||||||
|
out vec2 vScreenScale;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Uniforms
|
||||||
|
uniform vec2 TextureSize;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
#if defined(CURVATURE)
|
||||||
|
vScreenScale = vec2(1.0, 1.0);
|
||||||
|
#endif
|
||||||
|
// Calcula filterWidth dinámicamente basándose en la altura de la textura
|
||||||
|
vFilterWidth = (768.0 / TextureSize.y) / 3.0;
|
||||||
|
|
||||||
|
// Pasar coordenadas de textura (invertir Y para SDL)
|
||||||
|
vTexCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y) * 1.0001;
|
||||||
|
|
||||||
|
// Posición del vértice (ya en espacio de clip [-1, 1])
|
||||||
|
gl_Position = vec4(aPosition, 0.0, 1.0);
|
||||||
|
}
|
||||||
152
data/shaders/crtpi_frag.glsl
Normal file
152
data/shaders/crtpi_frag.glsl
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
#version 450
|
||||||
|
|
||||||
|
// Vulkan GLSL fragment shader — CRT-Pi PostFX
|
||||||
|
// Algoritmo de scanlines continuas con pesos gaussianos, bloom y máscara de fósforo.
|
||||||
|
// Basado en el shader CRT-Pi original (GLSL 3.3), portado a GLSL 4.50 con parámetros uniformes.
|
||||||
|
//
|
||||||
|
// Compile: glslc -fshader-stage=frag --target-env=vulkan1.0 crtpi_frag.glsl -o crtpi_frag.spv
|
||||||
|
// xxd -i crtpi_frag.spv > ../../source/core/rendering/sdl3gpu/crtpi_frag_spv.h
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 v_uv;
|
||||||
|
layout(location = 0) out vec4 out_color;
|
||||||
|
|
||||||
|
layout(set = 2, binding = 0) uniform sampler2D Texture;
|
||||||
|
|
||||||
|
layout(set = 3, binding = 0) uniform CrtPiBlock {
|
||||||
|
// vec4 #0
|
||||||
|
float scanline_weight; // Ajuste gaussiano de scanlines (default 6.0)
|
||||||
|
float scanline_gap_brightness; // Brillo mínimo entre scanlines (default 0.12)
|
||||||
|
float bloom_factor; // Factor de brillo en zonas iluminadas (default 3.5)
|
||||||
|
float input_gamma; // Gamma de entrada — linealización (default 2.4)
|
||||||
|
// vec4 #1
|
||||||
|
float output_gamma; // Gamma de salida — codificación (default 2.2)
|
||||||
|
float mask_brightness; // Brillo sub-píxeles de la máscara (default 0.80)
|
||||||
|
float curvature_x; // Distorsión barrel eje X (default 0.05)
|
||||||
|
float curvature_y; // Distorsión barrel eje Y (default 0.10)
|
||||||
|
// vec4 #2
|
||||||
|
int mask_type; // 0=ninguna, 1=verde/magenta, 2=RGB fósforo
|
||||||
|
int enable_scanlines; // 0 = off, 1 = on
|
||||||
|
int enable_multisample; // 0 = off, 1 = on (antialiasing analítico de scanlines)
|
||||||
|
int enable_gamma; // 0 = off, 1 = on
|
||||||
|
// vec4 #3
|
||||||
|
int enable_curvature; // 0 = off, 1 = on
|
||||||
|
int enable_sharper; // 0 = off, 1 = on
|
||||||
|
float texture_width; // Ancho del canvas lógico en píxeles
|
||||||
|
float texture_height; // Alto del canvas lógico en píxeles
|
||||||
|
} u;
|
||||||
|
|
||||||
|
// Distorsión barrel CRT
|
||||||
|
vec2 distort(vec2 coord, vec2 screen_scale) {
|
||||||
|
vec2 curvature = vec2(u.curvature_x, u.curvature_y);
|
||||||
|
vec2 barrel_scale = 1.0 - (0.23 * curvature);
|
||||||
|
coord *= screen_scale;
|
||||||
|
coord -= vec2(0.5);
|
||||||
|
float rsq = coord.x * coord.x + coord.y * coord.y;
|
||||||
|
coord += coord * (curvature * rsq);
|
||||||
|
coord *= barrel_scale;
|
||||||
|
if (abs(coord.x) >= 0.5 || abs(coord.y) >= 0.5) {
|
||||||
|
return vec2(-1.0); // fuera de pantalla
|
||||||
|
}
|
||||||
|
coord += vec2(0.5);
|
||||||
|
coord /= screen_scale;
|
||||||
|
return coord;
|
||||||
|
}
|
||||||
|
|
||||||
|
float calcScanLineWeight(float dist) {
|
||||||
|
return max(1.0 - dist * dist * u.scanline_weight, u.scanline_gap_brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
float calcScanLine(float dy, float filter_width) {
|
||||||
|
float weight = calcScanLineWeight(dy);
|
||||||
|
if (u.enable_multisample != 0) {
|
||||||
|
weight += calcScanLineWeight(dy - filter_width);
|
||||||
|
weight += calcScanLineWeight(dy + filter_width);
|
||||||
|
weight *= 0.3333333;
|
||||||
|
}
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 tex_size = vec2(u.texture_width, u.texture_height);
|
||||||
|
|
||||||
|
// filterWidth: equivalente al original (768.0 / TextureSize.y) / 3.0
|
||||||
|
float filter_width = (768.0 / u.texture_height) / 3.0;
|
||||||
|
|
||||||
|
vec2 texcoord = v_uv;
|
||||||
|
|
||||||
|
// Curvatura barrel opcional
|
||||||
|
if (u.enable_curvature != 0) {
|
||||||
|
texcoord = distort(texcoord, vec2(1.0, 1.0));
|
||||||
|
if (texcoord.x < 0.0) {
|
||||||
|
out_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 texcoord_in_pixels = texcoord * tex_size;
|
||||||
|
vec2 tc;
|
||||||
|
float scan_line_weight;
|
||||||
|
|
||||||
|
if (u.enable_sharper != 0) {
|
||||||
|
// Modo SHARPER: filtrado bicúbico-like con subpixel sharpen
|
||||||
|
vec2 temp_coord = floor(texcoord_in_pixels) + 0.5;
|
||||||
|
tc = temp_coord / tex_size;
|
||||||
|
vec2 deltas = texcoord_in_pixels - temp_coord;
|
||||||
|
scan_line_weight = calcScanLine(deltas.y, filter_width);
|
||||||
|
vec2 signs = sign(deltas);
|
||||||
|
deltas.x *= 2.0;
|
||||||
|
deltas = deltas * deltas;
|
||||||
|
deltas.y = deltas.y * deltas.y;
|
||||||
|
deltas.x *= 0.5;
|
||||||
|
deltas.y *= 8.0;
|
||||||
|
deltas /= tex_size;
|
||||||
|
deltas *= signs;
|
||||||
|
tc = tc + deltas;
|
||||||
|
} else {
|
||||||
|
// Modo estándar
|
||||||
|
float temp_y = floor(texcoord_in_pixels.y) + 0.5;
|
||||||
|
float y_coord = temp_y / tex_size.y;
|
||||||
|
float dy = texcoord_in_pixels.y - temp_y;
|
||||||
|
scan_line_weight = calcScanLine(dy, filter_width);
|
||||||
|
float sign_y = sign(dy);
|
||||||
|
dy = dy * dy;
|
||||||
|
dy = dy * dy;
|
||||||
|
dy *= 8.0;
|
||||||
|
dy /= tex_size.y;
|
||||||
|
dy *= sign_y;
|
||||||
|
tc = vec2(texcoord.x, y_coord + dy);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 colour = texture(Texture, tc).rgb;
|
||||||
|
|
||||||
|
if (u.enable_scanlines != 0) {
|
||||||
|
if (u.enable_gamma != 0) {
|
||||||
|
colour = pow(colour, vec3(u.input_gamma));
|
||||||
|
}
|
||||||
|
colour *= scan_line_weight * u.bloom_factor;
|
||||||
|
if (u.enable_gamma != 0) {
|
||||||
|
colour = pow(colour, vec3(1.0 / u.output_gamma));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Máscara de fósforo
|
||||||
|
if (u.mask_type == 1) {
|
||||||
|
float which_mask = fract(gl_FragCoord.x * 0.5);
|
||||||
|
vec3 mask = (which_mask < 0.5)
|
||||||
|
? vec3(u.mask_brightness, 1.0, u.mask_brightness)
|
||||||
|
: vec3(1.0, u.mask_brightness, 1.0);
|
||||||
|
colour *= mask;
|
||||||
|
} else if (u.mask_type == 2) {
|
||||||
|
float which_mask = fract(gl_FragCoord.x * 0.3333333);
|
||||||
|
vec3 mask = vec3(u.mask_brightness);
|
||||||
|
if (which_mask < 0.3333333)
|
||||||
|
mask.x = 1.0;
|
||||||
|
else if (which_mask < 0.6666666)
|
||||||
|
mask.y = 1.0;
|
||||||
|
else
|
||||||
|
mask.z = 1.0;
|
||||||
|
colour *= mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
out_color = vec4(colour, 1.0);
|
||||||
|
}
|
||||||
BIN
data/shaders/crtpi_frag.spv
Normal file
BIN
data/shaders/crtpi_frag.spv
Normal file
Binary file not shown.
48
data/shaders/downscale.frag
Normal file
48
data/shaders/downscale.frag
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#version 450
|
||||||
|
layout(location = 0) in vec2 v_uv;
|
||||||
|
layout(location = 0) out vec4 out_color;
|
||||||
|
|
||||||
|
layout(set = 2, binding = 0) uniform sampler2D source;
|
||||||
|
|
||||||
|
layout(set = 3, binding = 0) uniform DownscaleUniforms {
|
||||||
|
int algorithm; // 0 = Lanczos2 (ventana 2, ±2 taps), 1 = Lanczos3 (ventana 3, ±3 taps)
|
||||||
|
float pad0;
|
||||||
|
float pad1;
|
||||||
|
float pad2;
|
||||||
|
} u;
|
||||||
|
|
||||||
|
// Kernel Lanczos normalizado: sinc(t) * sinc(t/a) para |t| < a, 0 fuera.
|
||||||
|
float lanczos(float t, float a) {
|
||||||
|
t = abs(t);
|
||||||
|
if (t < 0.0001) { return 1.0; }
|
||||||
|
if (t >= a) { return 0.0; }
|
||||||
|
const float PI = 3.14159265358979;
|
||||||
|
float pt = PI * t;
|
||||||
|
return (a * sin(pt) * sin(pt / a)) / (pt * pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 src_size = vec2(textureSize(source, 0));
|
||||||
|
// Posición en coordenadas de texel (centros de texel en N+0.5)
|
||||||
|
vec2 p = v_uv * src_size;
|
||||||
|
vec2 p_floor = floor(p);
|
||||||
|
|
||||||
|
float a = (u.algorithm == 0) ? 2.0 : 3.0;
|
||||||
|
int win = int(a);
|
||||||
|
|
||||||
|
vec4 color = vec4(0.0);
|
||||||
|
float weight_sum = 0.0;
|
||||||
|
|
||||||
|
for (int j = -win; j <= win; j++) {
|
||||||
|
for (int i = -win; i <= win; i++) {
|
||||||
|
// Centro del texel (i,j) relativo a p_floor
|
||||||
|
vec2 tap_center = p_floor + vec2(float(i), float(j)) + 0.5;
|
||||||
|
vec2 offset = tap_center - p;
|
||||||
|
float w = lanczos(offset.x, a) * lanczos(offset.y, a);
|
||||||
|
color += texture(source, tap_center / src_size) * w;
|
||||||
|
weight_sum += w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out_color = (weight_sum > 0.0) ? (color / weight_sum) : vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
}
|
||||||
@@ -22,6 +22,10 @@ layout(set = 3, binding = 0) uniform PostFXUniforms {
|
|||||||
float gamma_strength;
|
float gamma_strength;
|
||||||
float curvature;
|
float curvature;
|
||||||
float bleeding;
|
float bleeding;
|
||||||
|
float pixel_scale; // physical pixels per logical pixel (vh / tex_height_)
|
||||||
|
float time; // seconds since SDL init
|
||||||
|
float oversample; // supersampling factor (1.0 = off, 3.0 = 3×SS)
|
||||||
|
float flicker; // 0 = off, 1 = phosphor flicker ~50 Hz — 48 bytes total (3 × 16)
|
||||||
} u;
|
} u;
|
||||||
|
|
||||||
// YCbCr helpers for NTSC bleeding
|
// YCbCr helpers for NTSC bleeding
|
||||||
@@ -64,23 +68,25 @@ void main() {
|
|||||||
// Muestra base
|
// Muestra base
|
||||||
vec3 base = texture(scene, uv).rgb;
|
vec3 base = texture(scene, uv).rgb;
|
||||||
|
|
||||||
// Sangrado NTSC — difuminado horizontal de crominancia
|
// Sangrado NTSC — difuminado horizontal de crominancia.
|
||||||
|
// step = 1 pixel lógico de juego en UV (corrige SS: textureSize.x = game_w * oversample).
|
||||||
vec3 colour;
|
vec3 colour;
|
||||||
if (u.bleeding > 0.0) {
|
if (u.bleeding > 0.0) {
|
||||||
float tw = float(textureSize(scene, 0).x);
|
float tw = float(textureSize(scene, 0).x);
|
||||||
|
float step = u.oversample / tw; // 1 pixel lógico en UV
|
||||||
vec3 ycc = rgb_to_ycc(base);
|
vec3 ycc = rgb_to_ycc(base);
|
||||||
vec3 ycc_l2 = rgb_to_ycc(texture(scene, uv - vec2(2.0/tw, 0.0)).rgb);
|
vec3 ycc_l2 = rgb_to_ycc(texture(scene, uv - vec2(2.0*step, 0.0)).rgb);
|
||||||
vec3 ycc_l1 = rgb_to_ycc(texture(scene, uv - vec2(1.0/tw, 0.0)).rgb);
|
vec3 ycc_l1 = rgb_to_ycc(texture(scene, uv - vec2(1.0*step, 0.0)).rgb);
|
||||||
vec3 ycc_r1 = rgb_to_ycc(texture(scene, uv + vec2(1.0/tw, 0.0)).rgb);
|
vec3 ycc_r1 = rgb_to_ycc(texture(scene, uv + vec2(1.0*step, 0.0)).rgb);
|
||||||
vec3 ycc_r2 = rgb_to_ycc(texture(scene, uv + vec2(2.0/tw, 0.0)).rgb);
|
vec3 ycc_r2 = rgb_to_ycc(texture(scene, uv + vec2(2.0*step, 0.0)).rgb);
|
||||||
ycc.yz = (ycc_l2.yz + ycc_l1.yz*2.0 + ycc.yz*2.0 + ycc_r1.yz*2.0 + ycc_r2.yz) / 8.0;
|
ycc.yz = (ycc_l2.yz + ycc_l1.yz*2.0 + ycc.yz*2.0 + ycc_r1.yz*2.0 + ycc_r2.yz) / 8.0;
|
||||||
colour = mix(base, ycc_to_rgb(ycc), u.bleeding);
|
colour = mix(base, ycc_to_rgb(ycc), u.bleeding);
|
||||||
} else {
|
} else {
|
||||||
colour = base;
|
colour = base;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aberración cromática
|
// Aberración cromática (drift animado con time para efecto NTSC real)
|
||||||
float ca = u.chroma_strength * 0.005;
|
float ca = u.chroma_strength * 0.005 * (1.0 + 0.15 * sin(u.time * 7.3));
|
||||||
colour.r = texture(scene, uv + vec2(ca, 0.0)).r;
|
colour.r = texture(scene, uv + vec2(ca, 0.0)).r;
|
||||||
colour.b = texture(scene, uv - vec2(ca, 0.0)).b;
|
colour.b = texture(scene, uv - vec2(ca, 0.0)).b;
|
||||||
|
|
||||||
@@ -90,14 +96,24 @@ void main() {
|
|||||||
colour = mix(colour, lin, u.gamma_strength);
|
colour = mix(colour, lin, u.gamma_strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scanlines
|
// Scanlines — proporción 2/3 brillantes + 1/3 oscuras por fila lógica.
|
||||||
float texHeight = float(textureSize(scene, 0).y);
|
// Casos especiales: 1 subfila → sin efecto; 2 subfilas → 1+1 (50/50).
|
||||||
float scaleY = u.screen_height / texHeight;
|
// Constantes ajustables:
|
||||||
float screenY = uv.y * u.screen_height;
|
const float SCAN_DARK_RATIO = 0.333; // fracción de subfilas oscuras (ps >= 3)
|
||||||
float posInRow = mod(screenY, scaleY);
|
const float SCAN_DARK_FLOOR = 0.42; // multiplicador de brillo de subfilas oscuras
|
||||||
float scanLineDY = posInRow / scaleY - 0.5;
|
if (u.scanline_strength > 0.0) {
|
||||||
float scan = max(1.0 - scanLineDY * scanLineDY * 6.0, 0.12) * 3.5;
|
float ps = max(1.0, round(u.pixel_scale));
|
||||||
colour *= mix(1.0, scan, u.scanline_strength);
|
float frac_in_row = fract(uv.y * u.screen_height);
|
||||||
|
float row_pos = floor(frac_in_row * ps);
|
||||||
|
// bright_rows: cuántas subfilas son brillantes
|
||||||
|
// ps==1 → ps (todo brillante → is_dark nunca se activa)
|
||||||
|
// ps==2 → 1 brillante + 1 oscura
|
||||||
|
// ps>=3 → floor(ps * (1 - DARK_RATIO)) brillantes
|
||||||
|
float bright_rows = (ps < 2.0) ? ps : ((ps < 3.0) ? 1.0 : floor(ps * (1.0 - SCAN_DARK_RATIO)));
|
||||||
|
float is_dark = step(bright_rows, row_pos);
|
||||||
|
float scan = mix(1.0, SCAN_DARK_FLOOR, is_dark);
|
||||||
|
colour *= mix(1.0, scan, u.scanline_strength);
|
||||||
|
}
|
||||||
|
|
||||||
if (u.gamma_strength > 0.0) {
|
if (u.gamma_strength > 0.0) {
|
||||||
vec3 enc = pow(colour, vec3(1.0 / 2.2));
|
vec3 enc = pow(colour, vec3(1.0 / 2.2));
|
||||||
@@ -109,7 +125,8 @@ void main() {
|
|||||||
float vignette = 1.0 - dot(d, d) * u.vignette_strength;
|
float vignette = 1.0 - dot(d, d) * u.vignette_strength;
|
||||||
colour *= clamp(vignette, 0.0, 1.0);
|
colour *= clamp(vignette, 0.0, 1.0);
|
||||||
|
|
||||||
// Máscara de fósforo RGB
|
// Máscara de fósforo RGB — después de scanlines (orden original):
|
||||||
|
// filas brillantes saturadas → máscara invisible, filas oscuras → RGB visible.
|
||||||
if (u.mask_strength > 0.0) {
|
if (u.mask_strength > 0.0) {
|
||||||
float whichMask = fract(gl_FragCoord.x * 0.3333333);
|
float whichMask = fract(gl_FragCoord.x * 0.3333333);
|
||||||
vec3 mask = vec3(0.80);
|
vec3 mask = vec3(0.80);
|
||||||
@@ -122,5 +139,11 @@ void main() {
|
|||||||
colour = mix(colour, colour * mask, u.mask_strength);
|
colour = mix(colour, colour * mask, u.mask_strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parpadeo de fósforo CRT (~50 Hz)
|
||||||
|
if (u.flicker > 0.0) {
|
||||||
|
float flicker_wave = sin(u.time * 100.0) * 0.5 + 0.5;
|
||||||
|
colour *= 1.0 - u.flicker * 0.04 * flicker_wave;
|
||||||
|
}
|
||||||
|
|
||||||
out_color = vec4(colour, 1.0);
|
out_color = vec4(colour, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
data/shaders/postfx.frag.spv
Normal file
BIN
data/shaders/postfx.frag.spv
Normal file
Binary file not shown.
15
data/shaders/upscale.frag
Normal file
15
data/shaders/upscale.frag
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#version 450
|
||||||
|
|
||||||
|
// Vulkan GLSL fragment shader — Nearest-neighbour upscale pass
|
||||||
|
// Used as the first render pass when supersampling is active.
|
||||||
|
// Compile: glslc upscale.frag -o upscale.frag.spv
|
||||||
|
// xxd -i upscale.frag.spv > ../../source/core/rendering/sdl3gpu/upscale_frag_spv.h
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 v_uv;
|
||||||
|
layout(location = 0) out vec4 out_color;
|
||||||
|
|
||||||
|
layout(set = 2, binding = 0) uniform sampler2D scene;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
out_color = texture(scene, v_uv);
|
||||||
|
}
|
||||||
BIN
data/shaders/upscale.frag.spv
Normal file
BIN
data/shaders/upscale.frag.spv
Normal file
Binary file not shown.
@@ -1,106 +0,0 @@
|
|||||||
# SDL3 CMake configuration file:
|
|
||||||
# This file is meant to be placed in Resources/CMake of a SDL3 framework
|
|
||||||
|
|
||||||
# INTERFACE_LINK_OPTIONS needs CMake 3.12
|
|
||||||
cmake_minimum_required(VERSION 3.12)
|
|
||||||
|
|
||||||
include(FeatureSummary)
|
|
||||||
set_package_properties(SDL3 PROPERTIES
|
|
||||||
URL "https://www.libsdl.org/"
|
|
||||||
DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Copied from `configure_package_config_file`
|
|
||||||
macro(set_and_check _var _file)
|
|
||||||
set(${_var} "${_file}")
|
|
||||||
if(NOT EXISTS "${_file}")
|
|
||||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Copied from `configure_package_config_file`
|
|
||||||
macro(check_required_components _NAME)
|
|
||||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
|
||||||
if(NOT ${_NAME}_${comp}_FOUND)
|
|
||||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
|
||||||
set(${_NAME}_FOUND FALSE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
set(SDL3_FOUND TRUE)
|
|
||||||
|
|
||||||
# Compute the installation prefix relative to this file.
|
|
||||||
set(_sdl3_framework_path "${CMAKE_CURRENT_LIST_DIR}") # > /SDL3.framework/Resources/CMake/
|
|
||||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/Current/Resources/CMake
|
|
||||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/A/Resources/CMake/
|
|
||||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/Resources/
|
|
||||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/
|
|
||||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/
|
|
||||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/
|
|
||||||
get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH) # > /
|
|
||||||
|
|
||||||
|
|
||||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
|
||||||
# This is done for compatibility with CMake generated SDL3-target.cmake files.
|
|
||||||
|
|
||||||
if(NOT TARGET SDL3::Headers)
|
|
||||||
add_library(SDL3::Headers INTERFACE IMPORTED)
|
|
||||||
set_target_properties(SDL3::Headers
|
|
||||||
PROPERTIES
|
|
||||||
INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${_sdl3_framework_parent_path}\""
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
set(SDL3_Headers_FOUND TRUE)
|
|
||||||
|
|
||||||
if(NOT TARGET SDL3::SDL3-shared)
|
|
||||||
add_library(SDL3::SDL3-shared SHARED IMPORTED)
|
|
||||||
set_target_properties(SDL3::SDL3-shared
|
|
||||||
PROPERTIES
|
|
||||||
FRAMEWORK "TRUE"
|
|
||||||
IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3"
|
|
||||||
INTERFACE_LINK_LIBRARIES "SDL3::Headers"
|
|
||||||
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
|
|
||||||
INTERFACE_SDL3_SHARED "ON"
|
|
||||||
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
|
|
||||||
INTERFACE_SDL_VERSION "SDL3"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
set(SDL3_SDL3-shared_FOUND TRUE)
|
|
||||||
|
|
||||||
set(SDL3_SDL3-static FALSE)
|
|
||||||
|
|
||||||
set(SDL3_SDL3_test FALSE)
|
|
||||||
|
|
||||||
unset(_sdl3_framework_parent_path)
|
|
||||||
unset(_sdl3_framework_path)
|
|
||||||
|
|
||||||
if(SDL3_SDL3-shared_FOUND)
|
|
||||||
set(SDL3_SDL3_FOUND TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
|
|
||||||
if(CMAKE_VERSION VERSION_LESS "3.18")
|
|
||||||
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
|
||||||
add_library(${NEW_TARGET} INTERFACE IMPORTED)
|
|
||||||
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
|
|
||||||
else()
|
|
||||||
add_library(${NEW_TARGET} ALIAS ${TARGET})
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Make sure SDL3::SDL3 always exists
|
|
||||||
if(NOT TARGET SDL3::SDL3)
|
|
||||||
if(TARGET SDL3::SDL3-shared)
|
|
||||||
_sdl_create_target_alias_compat(SDL3::SDL3 SDL3::SDL3-shared)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_required_components(SDL3)
|
|
||||||
|
|
||||||
set(SDL3_LIBRARIES SDL3::SDL3)
|
|
||||||
set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static)
|
|
||||||
set(SDL3_STATIC_PRIVATE_LIBS)
|
|
||||||
|
|
||||||
set(SDL3TEST_LIBRARY SDL3::SDL3_test)
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
# based on the files generated by CMake's write_basic_package_version_file
|
|
||||||
|
|
||||||
# SDL CMake version configuration file:
|
|
||||||
# This file is meant to be placed in Resources/CMake of a SDL3 framework
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.12)
|
|
||||||
|
|
||||||
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
|
|
||||||
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h" _sdl_version_h)
|
|
||||||
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
|
|
||||||
set(_sdl_major "${CMAKE_MATCH_1}")
|
|
||||||
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
|
|
||||||
set(_sdl_minor "${CMAKE_MATCH_1}")
|
|
||||||
string(REGEX MATCH "#define[ \t]+SDL_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_version_h}")
|
|
||||||
set(_sdl_micro "${CMAKE_MATCH_1}")
|
|
||||||
if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
|
|
||||||
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
|
|
||||||
else()
|
|
||||||
message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
unset(_sdl_major_re)
|
|
||||||
unset(_sdl_major)
|
|
||||||
unset(_sdl_minor_re)
|
|
||||||
unset(_sdl_minor)
|
|
||||||
unset(_sdl_micro_re)
|
|
||||||
unset(_sdl_micro)
|
|
||||||
|
|
||||||
if(PACKAGE_FIND_VERSION_RANGE)
|
|
||||||
# Package version must be in the requested version range
|
|
||||||
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
|
|
||||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
|
|
||||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
||||||
else()
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
||||||
else()
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
||||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
|
||||||
set(PACKAGE_VERSION_EXACT TRUE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# The SDL3.xcframework only contains 64-bit archives
|
|
||||||
if(NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
|
||||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
|
||||||
endif()
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main include header for the SDL library, version 3.2.20
|
|
||||||
*
|
|
||||||
* It is almost always best to include just this one header instead of
|
|
||||||
* picking out individual headers included here. There are exceptions to
|
|
||||||
* this rule--SDL_main.h is special and not included here--but usually
|
|
||||||
* letting SDL.h include the kitchen sink for you is the correct approach.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_h_
|
|
||||||
#define SDL_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_assert.h>
|
|
||||||
#include <SDL3/SDL_asyncio.h>
|
|
||||||
#include <SDL3/SDL_atomic.h>
|
|
||||||
#include <SDL3/SDL_audio.h>
|
|
||||||
#include <SDL3/SDL_bits.h>
|
|
||||||
#include <SDL3/SDL_blendmode.h>
|
|
||||||
#include <SDL3/SDL_camera.h>
|
|
||||||
#include <SDL3/SDL_clipboard.h>
|
|
||||||
#include <SDL3/SDL_cpuinfo.h>
|
|
||||||
#include <SDL3/SDL_dialog.h>
|
|
||||||
#include <SDL3/SDL_endian.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
#include <SDL3/SDL_events.h>
|
|
||||||
#include <SDL3/SDL_filesystem.h>
|
|
||||||
#include <SDL3/SDL_gamepad.h>
|
|
||||||
#include <SDL3/SDL_gpu.h>
|
|
||||||
#include <SDL3/SDL_guid.h>
|
|
||||||
#include <SDL3/SDL_haptic.h>
|
|
||||||
#include <SDL3/SDL_hidapi.h>
|
|
||||||
#include <SDL3/SDL_hints.h>
|
|
||||||
#include <SDL3/SDL_init.h>
|
|
||||||
#include <SDL3/SDL_iostream.h>
|
|
||||||
#include <SDL3/SDL_joystick.h>
|
|
||||||
#include <SDL3/SDL_keyboard.h>
|
|
||||||
#include <SDL3/SDL_keycode.h>
|
|
||||||
#include <SDL3/SDL_loadso.h>
|
|
||||||
#include <SDL3/SDL_locale.h>
|
|
||||||
#include <SDL3/SDL_log.h>
|
|
||||||
#include <SDL3/SDL_messagebox.h>
|
|
||||||
#include <SDL3/SDL_metal.h>
|
|
||||||
#include <SDL3/SDL_misc.h>
|
|
||||||
#include <SDL3/SDL_mouse.h>
|
|
||||||
#include <SDL3/SDL_mutex.h>
|
|
||||||
#include <SDL3/SDL_pen.h>
|
|
||||||
#include <SDL3/SDL_pixels.h>
|
|
||||||
#include <SDL3/SDL_platform.h>
|
|
||||||
#include <SDL3/SDL_power.h>
|
|
||||||
#include <SDL3/SDL_process.h>
|
|
||||||
#include <SDL3/SDL_properties.h>
|
|
||||||
#include <SDL3/SDL_rect.h>
|
|
||||||
#include <SDL3/SDL_render.h>
|
|
||||||
#include <SDL3/SDL_scancode.h>
|
|
||||||
#include <SDL3/SDL_sensor.h>
|
|
||||||
#include <SDL3/SDL_storage.h>
|
|
||||||
#include <SDL3/SDL_surface.h>
|
|
||||||
#include <SDL3/SDL_system.h>
|
|
||||||
#include <SDL3/SDL_thread.h>
|
|
||||||
#include <SDL3/SDL_time.h>
|
|
||||||
#include <SDL3/SDL_timer.h>
|
|
||||||
#include <SDL3/SDL_tray.h>
|
|
||||||
#include <SDL3/SDL_touch.h>
|
|
||||||
#include <SDL3/SDL_version.h>
|
|
||||||
#include <SDL3/SDL_video.h>
|
|
||||||
#include <SDL3/SDL_oldnames.h>
|
|
||||||
|
|
||||||
#endif /* SDL_h_ */
|
|
||||||
@@ -1,662 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryAssert
|
|
||||||
*
|
|
||||||
* A helpful assertion macro!
|
|
||||||
*
|
|
||||||
* SDL assertions operate like your usual `assert` macro, but with some added
|
|
||||||
* features:
|
|
||||||
*
|
|
||||||
* - It uses a trick with the `sizeof` operator, so disabled assertions
|
|
||||||
* vaporize out of the compiled code, but variables only referenced in the
|
|
||||||
* assertion won't trigger compiler warnings about being unused.
|
|
||||||
* - It is safe to use with a dangling-else: `if (x) SDL_assert(y); else
|
|
||||||
* do_something();`
|
|
||||||
* - It works the same everywhere, instead of counting on various platforms'
|
|
||||||
* compiler and C runtime to behave.
|
|
||||||
* - It provides multiple levels of assertion (SDL_assert, SDL_assert_release,
|
|
||||||
* SDL_assert_paranoid) instead of a single all-or-nothing option.
|
|
||||||
* - It offers a variety of responses when an assertion fails (retry, trigger
|
|
||||||
* the debugger, abort the program, ignore the failure once, ignore it for
|
|
||||||
* the rest of the program's run).
|
|
||||||
* - It tries to show the user a dialog by default, if possible, but the app
|
|
||||||
* can provide a callback to handle assertion failures however they like.
|
|
||||||
* - It lets failed assertions be retried. Perhaps you had a network failure
|
|
||||||
* and just want to retry the test after plugging your network cable back
|
|
||||||
* in? You can.
|
|
||||||
* - It lets the user ignore an assertion failure, if there's a harmless
|
|
||||||
* problem that one can continue past.
|
|
||||||
* - It lets the user mark an assertion as ignored for the rest of the
|
|
||||||
* program's run; if there's a harmless problem that keeps popping up.
|
|
||||||
* - It provides statistics and data on all failed assertions to the app.
|
|
||||||
* - It allows the default assertion handler to be controlled with environment
|
|
||||||
* variables, in case an automated script needs to control it.
|
|
||||||
* - It can be used as an aid to Clang's static analysis; it will treat SDL
|
|
||||||
* assertions as universally true (under the assumption that you are serious
|
|
||||||
* about the asserted claims and that your debug builds will detect when
|
|
||||||
* these claims were wrong). This can help the analyzer avoid false
|
|
||||||
* positives.
|
|
||||||
*
|
|
||||||
* To use it: compile a debug build and just sprinkle around tests to check
|
|
||||||
* your code!
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_assert_h_
|
|
||||||
#define SDL_assert_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The level of assertion aggressiveness.
|
|
||||||
*
|
|
||||||
* This value changes depending on compiler options and other preprocessor
|
|
||||||
* defines.
|
|
||||||
*
|
|
||||||
* It is currently one of the following values, but future SDL releases might
|
|
||||||
* add more:
|
|
||||||
*
|
|
||||||
* - 0: All SDL assertion macros are disabled.
|
|
||||||
* - 1: Release settings: SDL_assert disabled, SDL_assert_release enabled.
|
|
||||||
* - 2: Debug settings: SDL_assert and SDL_assert_release enabled.
|
|
||||||
* - 3: Paranoid settings: All SDL assertion macros enabled, including
|
|
||||||
* SDL_assert_paranoid.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_ASSERT_LEVEL SomeNumberBasedOnVariousFactors
|
|
||||||
|
|
||||||
#elif !defined(SDL_ASSERT_LEVEL)
|
|
||||||
#ifdef SDL_DEFAULT_ASSERT_LEVEL
|
|
||||||
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
|
|
||||||
#elif defined(_DEBUG) || defined(DEBUG) || \
|
|
||||||
(defined(__GNUC__) && !defined(__OPTIMIZE__))
|
|
||||||
#define SDL_ASSERT_LEVEL 2
|
|
||||||
#else
|
|
||||||
#define SDL_ASSERT_LEVEL 1
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to tell an attached debugger to pause.
|
|
||||||
*
|
|
||||||
* This allows an app to programmatically halt ("break") the debugger as if it
|
|
||||||
* had hit a breakpoint, allowing the developer to examine program state, etc.
|
|
||||||
*
|
|
||||||
* This is a macro--not a function--so that the debugger breaks on the source
|
|
||||||
* code line that used SDL_TriggerBreakpoint and not in some random guts of
|
|
||||||
* SDL. SDL_assert uses this macro for the same reason.
|
|
||||||
*
|
|
||||||
* If the program is not running under a debugger, SDL_TriggerBreakpoint will
|
|
||||||
* likely terminate the app, possibly without warning. If the current platform
|
|
||||||
* isn't supported, this macro is left undefined.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
|
|
||||||
|
|
||||||
#elif defined(_MSC_VER) && _MSC_VER >= 1310
|
|
||||||
/* Don't include intrin.h here because it contains C++ code */
|
|
||||||
extern void __cdecl __debugbreak(void);
|
|
||||||
#define SDL_TriggerBreakpoint() __debugbreak()
|
|
||||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
|
||||||
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
|
|
||||||
#elif defined(ANDROID)
|
|
||||||
#include <assert.h>
|
|
||||||
#define SDL_TriggerBreakpoint() assert(0)
|
|
||||||
#elif SDL_HAS_BUILTIN(__builtin_debugtrap)
|
|
||||||
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
|
|
||||||
#elif SDL_HAS_BUILTIN(__builtin_trap)
|
|
||||||
#define SDL_TriggerBreakpoint() __builtin_trap()
|
|
||||||
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
|
|
||||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
|
|
||||||
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
|
|
||||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
|
|
||||||
#elif ( defined(SDL_PLATFORM_APPLE) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
|
|
||||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
|
|
||||||
#elif defined(SDL_PLATFORM_APPLE) && defined(__arm__)
|
|
||||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
|
|
||||||
#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
|
|
||||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
|
|
||||||
#elif defined(__GNUC__) || defined(__clang__)
|
|
||||||
#define SDL_TriggerBreakpoint() __builtin_trap() /* older gcc may not support SDL_HAS_BUILTIN(__builtin_trap) above */
|
|
||||||
#elif defined(__386__) && defined(__WATCOMC__)
|
|
||||||
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
|
|
||||||
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
|
|
||||||
#include <signal.h>
|
|
||||||
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
|
|
||||||
#else
|
|
||||||
/* SDL_TriggerBreakpoint is intentionally left undefined on unknown platforms. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro that reports the current function being compiled.
|
|
||||||
*
|
|
||||||
* If SDL can't figure how the compiler reports this, it will use "???".
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_FUNCTION __FUNCTION__
|
|
||||||
|
|
||||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
|
|
||||||
# define SDL_FUNCTION __func__
|
|
||||||
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
|
|
||||||
# define SDL_FUNCTION __FUNCTION__
|
|
||||||
#else
|
|
||||||
# define SDL_FUNCTION "???"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro that reports the current file being compiled.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_FILE __FILE__
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro that reports the current line number of the file being compiled.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_LINE __LINE__
|
|
||||||
|
|
||||||
/*
|
|
||||||
sizeof (x) makes the compiler still parse the expression even without
|
|
||||||
assertions enabled, so the code is always checked at compile time, but
|
|
||||||
doesn't actually generate code for it, so there are no side effects or
|
|
||||||
expensive checks at run time, just the constant size of what x WOULD be,
|
|
||||||
which presumably gets optimized out as unused.
|
|
||||||
This also solves the problem of...
|
|
||||||
|
|
||||||
int somevalue = blah();
|
|
||||||
SDL_assert(somevalue == 1);
|
|
||||||
|
|
||||||
...which would cause compiles to complain that somevalue is unused if we
|
|
||||||
disable assertions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro for wrapping code in `do {} while (0);` without compiler warnings.
|
|
||||||
*
|
|
||||||
* Visual Studio with really aggressive warnings enabled needs this to avoid
|
|
||||||
* compiler complaints.
|
|
||||||
*
|
|
||||||
* the `do {} while (0);` trick is useful for wrapping code in a macro that
|
|
||||||
* may or may not be a single statement, to avoid various C language
|
|
||||||
* accidents.
|
|
||||||
*
|
|
||||||
* To use:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* do { SomethingOnce(); } while (SDL_NULL_WHILE_LOOP_CONDITION (0));
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
|
|
||||||
|
|
||||||
#elif defined(_MSC_VER) /* Avoid /W4 warnings. */
|
|
||||||
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
|
|
||||||
this condition isn't constant. And looks like an owl's face! */
|
|
||||||
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
|
|
||||||
#else
|
|
||||||
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The macro used when an assertion is disabled.
|
|
||||||
*
|
|
||||||
* This isn't for direct use by apps, but this is the code that is inserted
|
|
||||||
* when an SDL_assert is disabled (perhaps in a release build).
|
|
||||||
*
|
|
||||||
* The code does nothing, but wraps `condition` in a sizeof operator, which
|
|
||||||
* generates no code and has no side effects, but avoid compiler warnings
|
|
||||||
* about unused variables.
|
|
||||||
*
|
|
||||||
* \param condition the condition to assert (but not actually run here).
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_disabled_assert(condition) \
|
|
||||||
do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Possible outcomes from a triggered assertion.
|
|
||||||
*
|
|
||||||
* When an enabled assertion triggers, it may call the assertion handler
|
|
||||||
* (possibly one provided by the app via SDL_SetAssertionHandler), which will
|
|
||||||
* return one of these values, possibly after asking the user.
|
|
||||||
*
|
|
||||||
* Then SDL will respond based on this outcome (loop around to retry the
|
|
||||||
* condition, try to break in a debugger, kill the program, or ignore the
|
|
||||||
* problem).
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef enum SDL_AssertState
|
|
||||||
{
|
|
||||||
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
|
|
||||||
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
|
|
||||||
SDL_ASSERTION_ABORT, /**< Terminate the program. */
|
|
||||||
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
|
|
||||||
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
|
|
||||||
} SDL_AssertState;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Information about an assertion failure.
|
|
||||||
*
|
|
||||||
* This structure is filled in with information about a triggered assertion,
|
|
||||||
* used by the assertion handler, then added to the assertion report. This is
|
|
||||||
* returned as a linked list from SDL_GetAssertionReport().
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_AssertData
|
|
||||||
{
|
|
||||||
bool always_ignore; /**< true if app should always continue when assertion is triggered. */
|
|
||||||
unsigned int trigger_count; /**< Number of times this assertion has been triggered. */
|
|
||||||
const char *condition; /**< A string of this assert's test code. */
|
|
||||||
const char *filename; /**< The source file where this assert lives. */
|
|
||||||
int linenum; /**< The line in `filename` where this assert lives. */
|
|
||||||
const char *function; /**< The name of the function where this assert lives. */
|
|
||||||
const struct SDL_AssertData *next; /**< next item in the linked list. */
|
|
||||||
} SDL_AssertData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Never call this directly.
|
|
||||||
*
|
|
||||||
* Use the SDL_assert macros instead.
|
|
||||||
*
|
|
||||||
* \param data assert data structure.
|
|
||||||
* \param func function name.
|
|
||||||
* \param file file name.
|
|
||||||
* \param line line number.
|
|
||||||
* \returns assert state.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data,
|
|
||||||
const char *func,
|
|
||||||
const char *file, int line) SDL_ANALYZER_NORETURN;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The macro used when an assertion triggers a breakpoint.
|
|
||||||
*
|
|
||||||
* This isn't for direct use by apps; use SDL_assert or SDL_TriggerBreakpoint
|
|
||||||
* instead.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
|
|
||||||
|
|
||||||
#elif !defined(SDL_AssertBreakpoint)
|
|
||||||
# if defined(ANDROID) && defined(assert)
|
|
||||||
/* Define this as empty in case assert() is defined as SDL_assert */
|
|
||||||
# define SDL_AssertBreakpoint()
|
|
||||||
# else
|
|
||||||
# define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
|
|
||||||
# endif
|
|
||||||
#endif /* !SDL_AssertBreakpoint */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The macro used when an assertion is enabled.
|
|
||||||
*
|
|
||||||
* This isn't for direct use by apps, but this is the code that is inserted
|
|
||||||
* when an SDL_assert is enabled.
|
|
||||||
*
|
|
||||||
* The `do {} while(0)` avoids dangling else problems:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* if (x) SDL_assert(y); else blah();
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* ... without the do/while, the "else" could attach to this macro's "if". We
|
|
||||||
* try to handle just the minimum we need here in a macro...the loop, the
|
|
||||||
* static vars, and break points. The heavy lifting is handled in
|
|
||||||
* SDL_ReportAssertion().
|
|
||||||
*
|
|
||||||
* \param condition the condition to assert.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_enabled_assert(condition) \
|
|
||||||
do { \
|
|
||||||
while ( !(condition) ) { \
|
|
||||||
static struct SDL_AssertData sdl_assert_data = { false, 0, #condition, NULL, 0, NULL, NULL }; \
|
|
||||||
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
|
|
||||||
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
|
|
||||||
continue; /* go again. */ \
|
|
||||||
} else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
|
|
||||||
SDL_AssertBreakpoint(); \
|
|
||||||
} \
|
|
||||||
break; /* not retrying. */ \
|
|
||||||
} \
|
|
||||||
} while (SDL_NULL_WHILE_LOOP_CONDITION)
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An assertion test that is normally performed only in debug builds.
|
|
||||||
*
|
|
||||||
* This macro is enabled when the SDL_ASSERT_LEVEL is >= 2, otherwise it is
|
|
||||||
* disabled. This is meant to only do these tests in debug builds, so they can
|
|
||||||
* tend to be more expensive, and they are meant to bring everything to a halt
|
|
||||||
* when they fail, with the programmer there to assess the problem.
|
|
||||||
*
|
|
||||||
* In short: you can sprinkle these around liberally and assume they will
|
|
||||||
* evaporate out of the build when building for end-users.
|
|
||||||
*
|
|
||||||
* When assertions are disabled, this wraps `condition` in a `sizeof`
|
|
||||||
* operator, which means any function calls and side effects will not run, but
|
|
||||||
* the compiler will not complain about any otherwise-unused variables that
|
|
||||||
* are only referenced in the assertion.
|
|
||||||
*
|
|
||||||
* One can set the environment variable "SDL_ASSERT" to one of several strings
|
|
||||||
* ("abort", "break", "retry", "ignore", "always_ignore") to force a default
|
|
||||||
* behavior, which may be desirable for automation purposes. If your platform
|
|
||||||
* requires GUI interfaces to happen on the main thread but you're debugging
|
|
||||||
* an assertion in a background thread, it might be desirable to set this to
|
|
||||||
* "break" so that your debugger takes control as soon as assert is triggered,
|
|
||||||
* instead of risking a bad UI interaction (deadlock, etc) in the application.
|
|
||||||
*
|
|
||||||
* \param condition boolean value to test.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_assert(condition) if (assertion_enabled && (condition)) { trigger_assertion; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An assertion test that is performed even in release builds.
|
|
||||||
*
|
|
||||||
* This macro is enabled when the SDL_ASSERT_LEVEL is >= 1, otherwise it is
|
|
||||||
* disabled. This is meant to be for tests that are cheap to make and
|
|
||||||
* extremely unlikely to fail; generally it is frowned upon to have an
|
|
||||||
* assertion failure in a release build, so these assertions generally need to
|
|
||||||
* be of more than life-and-death importance if there's a chance they might
|
|
||||||
* trigger. You should almost always consider handling these cases more
|
|
||||||
* gracefully than an assert allows.
|
|
||||||
*
|
|
||||||
* When assertions are disabled, this wraps `condition` in a `sizeof`
|
|
||||||
* operator, which means any function calls and side effects will not run, but
|
|
||||||
* the compiler will not complain about any otherwise-unused variables that
|
|
||||||
* are only referenced in the assertion.
|
|
||||||
*
|
|
||||||
* One can set the environment variable "SDL_ASSERT" to one of several strings
|
|
||||||
* ("abort", "break", "retry", "ignore", "always_ignore") to force a default
|
|
||||||
* behavior, which may be desirable for automation purposes. If your platform
|
|
||||||
* requires GUI interfaces to happen on the main thread but you're debugging
|
|
||||||
* an assertion in a background thread, it might be desirable to set this to
|
|
||||||
* "break" so that your debugger takes control as soon as assert is triggered,
|
|
||||||
* instead of risking a bad UI interaction (deadlock, etc) in the application.
|
|
||||||
* *
|
|
||||||
*
|
|
||||||
* \param condition boolean value to test.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_assert_release(condition) SDL_disabled_assert(condition)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An assertion test that is performed only when built with paranoid settings.
|
|
||||||
*
|
|
||||||
* This macro is enabled when the SDL_ASSERT_LEVEL is >= 3, otherwise it is
|
|
||||||
* disabled. This is a higher level than both release and debug, so these
|
|
||||||
* tests are meant to be expensive and only run when specifically looking for
|
|
||||||
* extremely unexpected failure cases in a special build.
|
|
||||||
*
|
|
||||||
* When assertions are disabled, this wraps `condition` in a `sizeof`
|
|
||||||
* operator, which means any function calls and side effects will not run, but
|
|
||||||
* the compiler will not complain about any otherwise-unused variables that
|
|
||||||
* are only referenced in the assertion.
|
|
||||||
*
|
|
||||||
* One can set the environment variable "SDL_ASSERT" to one of several strings
|
|
||||||
* ("abort", "break", "retry", "ignore", "always_ignore") to force a default
|
|
||||||
* behavior, which may be desirable for automation purposes. If your platform
|
|
||||||
* requires GUI interfaces to happen on the main thread but you're debugging
|
|
||||||
* an assertion in a background thread, it might be desirable to set this to
|
|
||||||
* "break" so that your debugger takes control as soon as assert is triggered,
|
|
||||||
* instead of risking a bad UI interaction (deadlock, etc) in the application.
|
|
||||||
*
|
|
||||||
* \param condition boolean value to test.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
|
||||||
|
|
||||||
/* Enable various levels of assertions. */
|
|
||||||
#elif SDL_ASSERT_LEVEL == 0 /* assertions disabled */
|
|
||||||
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
|
||||||
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
|
|
||||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
|
||||||
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
|
|
||||||
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
|
||||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
|
||||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
|
||||||
#elif SDL_ASSERT_LEVEL == 2 /* debug settings. */
|
|
||||||
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
|
||||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
|
||||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
|
||||||
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
|
|
||||||
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
|
||||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
|
||||||
# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
|
|
||||||
#else
|
|
||||||
# error Unknown assertion level.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An assertion test that is always performed.
|
|
||||||
*
|
|
||||||
* This macro is always enabled no matter what SDL_ASSERT_LEVEL is set to. You
|
|
||||||
* almost never want to use this, as it could trigger on an end-user's system,
|
|
||||||
* crashing your program.
|
|
||||||
*
|
|
||||||
* One can set the environment variable "SDL_ASSERT" to one of several strings
|
|
||||||
* ("abort", "break", "retry", "ignore", "always_ignore") to force a default
|
|
||||||
* behavior, which may be desirable for automation purposes. If your platform
|
|
||||||
* requires GUI interfaces to happen on the main thread but you're debugging
|
|
||||||
* an assertion in a background thread, it might be desirable to set this to
|
|
||||||
* "break" so that your debugger takes control as soon as assert is triggered,
|
|
||||||
* instead of risking a bad UI interaction (deadlock, etc) in the application.
|
|
||||||
*
|
|
||||||
* \param condition boolean value to test.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A callback that fires when an SDL assertion fails.
|
|
||||||
*
|
|
||||||
* \param data a pointer to the SDL_AssertData structure corresponding to the
|
|
||||||
* current assertion.
|
|
||||||
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler().
|
|
||||||
* \returns an SDL_AssertState value indicating how to handle the failure.
|
|
||||||
*
|
|
||||||
* \threadsafety This callback may be called from any thread that triggers an
|
|
||||||
* assert at any time.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
|
|
||||||
const SDL_AssertData *data, void *userdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set an application-defined assertion handler.
|
|
||||||
*
|
|
||||||
* This function allows an application to show its own assertion UI and/or
|
|
||||||
* force the response to an assertion failure. If the application doesn't
|
|
||||||
* provide this, SDL will try to do the right thing, popping up a
|
|
||||||
* system-specific GUI dialog, and probably minimizing any fullscreen windows.
|
|
||||||
*
|
|
||||||
* This callback may fire from any thread, but it runs wrapped in a mutex, so
|
|
||||||
* it will only fire from one thread at a time.
|
|
||||||
*
|
|
||||||
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
|
|
||||||
*
|
|
||||||
* \param handler the SDL_AssertionHandler function to call when an assertion
|
|
||||||
* fails or NULL for the default handler.
|
|
||||||
* \param userdata a pointer that is passed to `handler`.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetAssertionHandler
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
|
||||||
SDL_AssertionHandler handler,
|
|
||||||
void *userdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the default assertion handler.
|
|
||||||
*
|
|
||||||
* This returns the function pointer that is called by default when an
|
|
||||||
* assertion is triggered. This is an internal function provided by SDL, that
|
|
||||||
* is used for assertions when SDL_SetAssertionHandler() hasn't been used to
|
|
||||||
* provide a different function.
|
|
||||||
*
|
|
||||||
* \returns the default SDL_AssertionHandler that is called when an assert
|
|
||||||
* triggers.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetAssertionHandler
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current assertion handler.
|
|
||||||
*
|
|
||||||
* This returns the function pointer that is called when an assertion is
|
|
||||||
* triggered. This is either the value last passed to
|
|
||||||
* SDL_SetAssertionHandler(), or if no application-specified function is set,
|
|
||||||
* is equivalent to calling SDL_GetDefaultAssertionHandler().
|
|
||||||
*
|
|
||||||
* The parameter `puserdata` is a pointer to a void*, which will store the
|
|
||||||
* "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value
|
|
||||||
* will always be NULL for the default handler. If you don't care about this
|
|
||||||
* data, it is safe to pass a NULL pointer to this function to ignore it.
|
|
||||||
*
|
|
||||||
* \param puserdata pointer which is filled with the "userdata" pointer that
|
|
||||||
* was passed to SDL_SetAssertionHandler().
|
|
||||||
* \returns the SDL_AssertionHandler that is called when an assert triggers.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetAssertionHandler
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of all assertion failures.
|
|
||||||
*
|
|
||||||
* This function gets all assertions triggered since the last call to
|
|
||||||
* SDL_ResetAssertionReport(), or the start of the program.
|
|
||||||
*
|
|
||||||
* The proper way to examine this data looks something like this:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* const SDL_AssertData *item = SDL_GetAssertionReport();
|
|
||||||
* while (item) {
|
|
||||||
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
|
|
||||||
* item->condition, item->function, item->filename,
|
|
||||||
* item->linenum, item->trigger_count,
|
|
||||||
* item->always_ignore ? "yes" : "no");
|
|
||||||
* item = item->next;
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \returns a list of all failed assertions or NULL if the list is empty. This
|
|
||||||
* memory should not be modified or freed by the application. This
|
|
||||||
* pointer remains valid until the next call to SDL_Quit() or
|
|
||||||
* SDL_ResetAssertionReport().
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe. Other threads calling
|
|
||||||
* SDL_ResetAssertionReport() simultaneously, may render the
|
|
||||||
* returned pointer invalid.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ResetAssertionReport
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the list of all assertion failures.
|
|
||||||
*
|
|
||||||
* This function will clear the list of all assertions triggered up to that
|
|
||||||
* point. Immediately following this call, SDL_GetAssertionReport will return
|
|
||||||
* no items. In addition, any previously-triggered assertions will be reset to
|
|
||||||
* a trigger_count of zero, and their always_ignore state will be false.
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe. Other threads triggering an
|
|
||||||
* assertion, or simultaneously calling this function may cause
|
|
||||||
* memory leaks or crashes.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetAssertionReport
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_assert_h_ */
|
|
||||||
@@ -1,546 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WIKI CATEGORY: AsyncIO */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryAsyncIO
|
|
||||||
*
|
|
||||||
* SDL offers a way to perform I/O asynchronously. This allows an app to read
|
|
||||||
* or write files without waiting for data to actually transfer; the functions
|
|
||||||
* that request I/O never block while the request is fulfilled.
|
|
||||||
*
|
|
||||||
* Instead, the data moves in the background and the app can check for results
|
|
||||||
* at their leisure.
|
|
||||||
*
|
|
||||||
* This is more complicated than just reading and writing files in a
|
|
||||||
* synchronous way, but it can allow for more efficiency, and never having
|
|
||||||
* framerate drops as the hard drive catches up, etc.
|
|
||||||
*
|
|
||||||
* The general usage pattern for async I/O is:
|
|
||||||
*
|
|
||||||
* - Create one or more SDL_AsyncIOQueue objects.
|
|
||||||
* - Open files with SDL_AsyncIOFromFile.
|
|
||||||
* - Start I/O tasks to the files with SDL_ReadAsyncIO or SDL_WriteAsyncIO,
|
|
||||||
* putting those tasks into one of the queues.
|
|
||||||
* - Later on, use SDL_GetAsyncIOResult on a queue to see if any task is
|
|
||||||
* finished without blocking. Tasks might finish in any order with success
|
|
||||||
* or failure.
|
|
||||||
* - When all your tasks are done, close the file with SDL_CloseAsyncIO. This
|
|
||||||
* also generates a task, since it might flush data to disk!
|
|
||||||
*
|
|
||||||
* This all works, without blocking, in a single thread, but one can also wait
|
|
||||||
* on a queue in a background thread, sleeping until new results have arrived:
|
|
||||||
*
|
|
||||||
* - Call SDL_WaitAsyncIOResult from one or more threads to efficiently block
|
|
||||||
* until new tasks complete.
|
|
||||||
* - When shutting down, call SDL_SignalAsyncIOQueue to unblock any sleeping
|
|
||||||
* threads despite there being no new tasks completed.
|
|
||||||
*
|
|
||||||
* And, of course, to match the synchronous SDL_LoadFile, we offer
|
|
||||||
* SDL_LoadFileAsync as a convenience function. This will handle allocating a
|
|
||||||
* buffer, slurping in the file data, and null-terminating it; you still check
|
|
||||||
* for results later.
|
|
||||||
*
|
|
||||||
* Behind the scenes, SDL will use newer, efficient APIs on platforms that
|
|
||||||
* support them: Linux's io_uring and Windows 11's IoRing, for example. If
|
|
||||||
* those technologies aren't available, SDL will offload the work to a thread
|
|
||||||
* pool that will manage otherwise-synchronous loads without blocking the app.
|
|
||||||
*
|
|
||||||
* ## Best Practices
|
|
||||||
*
|
|
||||||
* Simple non-blocking I/O--for an app that just wants to pick up data
|
|
||||||
* whenever it's ready without losing framerate waiting on disks to spin--can
|
|
||||||
* use whatever pattern works well for the program. In this case, simply call
|
|
||||||
* SDL_ReadAsyncIO, or maybe SDL_LoadFileAsync, as needed. Once a frame, call
|
|
||||||
* SDL_GetAsyncIOResult to check for any completed tasks and deal with the
|
|
||||||
* data as it arrives.
|
|
||||||
*
|
|
||||||
* If two separate pieces of the same program need their own I/O, it is legal
|
|
||||||
* for each to create their own queue. This will prevent either piece from
|
|
||||||
* accidentally consuming the other's completed tasks. Each queue does require
|
|
||||||
* some amount of resources, but it is not an overwhelming cost. Do not make a
|
|
||||||
* queue for each task, however. It is better to put many tasks into a single
|
|
||||||
* queue. They will be reported in order of completion, not in the order they
|
|
||||||
* were submitted, so it doesn't generally matter what order tasks are
|
|
||||||
* started.
|
|
||||||
*
|
|
||||||
* One async I/O queue can be shared by multiple threads, or one thread can
|
|
||||||
* have more than one queue, but the most efficient way--if ruthless
|
|
||||||
* efficiency is the goal--is to have one queue per thread, with multiple
|
|
||||||
* threads working in parallel, and attempt to keep each queue loaded with
|
|
||||||
* tasks that are both started by and consumed by the same thread. On modern
|
|
||||||
* platforms that can use newer interfaces, this can keep data flowing as
|
|
||||||
* efficiently as possible all the way from storage hardware to the app, with
|
|
||||||
* no contention between threads for access to the same queue.
|
|
||||||
*
|
|
||||||
* Written data is not guaranteed to make it to physical media by the time a
|
|
||||||
* closing task is completed, unless SDL_CloseAsyncIO is called with its
|
|
||||||
* `flush` parameter set to true, which is to say that a successful result
|
|
||||||
* here can still result in lost data during an unfortunately-timed power
|
|
||||||
* outage if not flushed. However, flushing will take longer and may be
|
|
||||||
* unnecessary, depending on the app's needs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_asyncio_h_
|
|
||||||
#define SDL_asyncio_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The asynchronous I/O operation structure.
|
|
||||||
*
|
|
||||||
* This operates as an opaque handle. One can then request read or write
|
|
||||||
* operations on it.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_AsyncIOFromFile
|
|
||||||
*/
|
|
||||||
typedef struct SDL_AsyncIO SDL_AsyncIO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Types of asynchronous I/O tasks.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef enum SDL_AsyncIOTaskType
|
|
||||||
{
|
|
||||||
SDL_ASYNCIO_TASK_READ, /**< A read operation. */
|
|
||||||
SDL_ASYNCIO_TASK_WRITE, /**< A write operation. */
|
|
||||||
SDL_ASYNCIO_TASK_CLOSE /**< A close operation. */
|
|
||||||
} SDL_AsyncIOTaskType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Possible outcomes of an asynchronous I/O task.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef enum SDL_AsyncIOResult
|
|
||||||
{
|
|
||||||
SDL_ASYNCIO_COMPLETE, /**< request was completed without error */
|
|
||||||
SDL_ASYNCIO_FAILURE, /**< request failed for some reason; check SDL_GetError()! */
|
|
||||||
SDL_ASYNCIO_CANCELED /**< request was canceled before completing. */
|
|
||||||
} SDL_AsyncIOResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Information about a completed asynchronous I/O request.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_AsyncIOOutcome
|
|
||||||
{
|
|
||||||
SDL_AsyncIO *asyncio; /**< what generated this task. This pointer will be invalid if it was closed! */
|
|
||||||
SDL_AsyncIOTaskType type; /**< What sort of task was this? Read, write, etc? */
|
|
||||||
SDL_AsyncIOResult result; /**< the result of the work (success, failure, cancellation). */
|
|
||||||
void *buffer; /**< buffer where data was read/written. */
|
|
||||||
Uint64 offset; /**< offset in the SDL_AsyncIO where data was read/written. */
|
|
||||||
Uint64 bytes_requested; /**< number of bytes the task was to read/write. */
|
|
||||||
Uint64 bytes_transferred; /**< actual number of bytes that were read/written. */
|
|
||||||
void *userdata; /**< pointer provided by the app when starting the task */
|
|
||||||
} SDL_AsyncIOOutcome;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A queue of completed asynchronous I/O tasks.
|
|
||||||
*
|
|
||||||
* When starting an asynchronous operation, you specify a queue for the new
|
|
||||||
* task. A queue can be asked later if any tasks in it have completed,
|
|
||||||
* allowing an app to manage multiple pending tasks in one place, in whatever
|
|
||||||
* order they complete.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_CreateAsyncIOQueue
|
|
||||||
* \sa SDL_ReadAsyncIO
|
|
||||||
* \sa SDL_WriteAsyncIO
|
|
||||||
* \sa SDL_GetAsyncIOResult
|
|
||||||
* \sa SDL_WaitAsyncIOResult
|
|
||||||
*/
|
|
||||||
typedef struct SDL_AsyncIOQueue SDL_AsyncIOQueue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this function to create a new SDL_AsyncIO object for reading from
|
|
||||||
* and/or writing to a named file.
|
|
||||||
*
|
|
||||||
* The `mode` string understands the following values:
|
|
||||||
*
|
|
||||||
* - "r": Open a file for reading only. It must exist.
|
|
||||||
* - "w": Open a file for writing only. It will create missing files or
|
|
||||||
* truncate existing ones.
|
|
||||||
* - "r+": Open a file for update both reading and writing. The file must
|
|
||||||
* exist.
|
|
||||||
* - "w+": Create an empty file for both reading and writing. If a file with
|
|
||||||
* the same name already exists its content is erased and the file is
|
|
||||||
* treated as a new empty file.
|
|
||||||
*
|
|
||||||
* There is no "b" mode, as there is only "binary" style I/O, and no "a" mode
|
|
||||||
* for appending, since you specify the position when starting a task.
|
|
||||||
*
|
|
||||||
* This function supports Unicode filenames, but they must be encoded in UTF-8
|
|
||||||
* format, regardless of the underlying operating system.
|
|
||||||
*
|
|
||||||
* This call is _not_ asynchronous; it will open the file before returning,
|
|
||||||
* under the assumption that doing so is generally a fast operation. Future
|
|
||||||
* reads and writes to the opened file will be async, however.
|
|
||||||
*
|
|
||||||
* \param file a UTF-8 string representing the filename to open.
|
|
||||||
* \param mode an ASCII string representing the mode to be used for opening
|
|
||||||
* the file.
|
|
||||||
* \returns a pointer to the SDL_AsyncIO structure that is created or NULL on
|
|
||||||
* failure; call SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_CloseAsyncIO
|
|
||||||
* \sa SDL_ReadAsyncIO
|
|
||||||
* \sa SDL_WriteAsyncIO
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_AsyncIO * SDLCALL SDL_AsyncIOFromFile(const char *file, const char *mode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this function to get the size of the data stream in an SDL_AsyncIO.
|
|
||||||
*
|
|
||||||
* This call is _not_ asynchronous; it assumes that obtaining this info is a
|
|
||||||
* non-blocking operation in most reasonable cases.
|
|
||||||
*
|
|
||||||
* \param asyncio the SDL_AsyncIO to get the size of the data stream from.
|
|
||||||
* \returns the size of the data stream in the SDL_IOStream on success or a
|
|
||||||
* negative error code on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start an async read.
|
|
||||||
*
|
|
||||||
* This function reads up to `size` bytes from `offset` position in the data
|
|
||||||
* source to the area pointed at by `ptr`. This function may read less bytes
|
|
||||||
* than requested.
|
|
||||||
*
|
|
||||||
* This function returns as quickly as possible; it does not wait for the read
|
|
||||||
* to complete. On a successful return, this work will continue in the
|
|
||||||
* background. If the work begins, even failure is asynchronous: a failing
|
|
||||||
* return value from this function only means the work couldn't start at all.
|
|
||||||
*
|
|
||||||
* `ptr` must remain available until the work is done, and may be accessed by
|
|
||||||
* the system at any time until then. Do not allocate it on the stack, as this
|
|
||||||
* might take longer than the life of the calling function to complete!
|
|
||||||
*
|
|
||||||
* An SDL_AsyncIOQueue must be specified. The newly-created task will be added
|
|
||||||
* to it when it completes its work.
|
|
||||||
*
|
|
||||||
* \param asyncio a pointer to an SDL_AsyncIO structure.
|
|
||||||
* \param ptr a pointer to a buffer to read data into.
|
|
||||||
* \param offset the position to start reading in the data source.
|
|
||||||
* \param size the number of bytes to read from the data source.
|
|
||||||
* \param queue a queue to add the new SDL_AsyncIO to.
|
|
||||||
* \param userdata an app-defined pointer that will be provided with the task
|
|
||||||
* results.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_WriteAsyncIO
|
|
||||||
* \sa SDL_CreateAsyncIOQueue
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_ReadAsyncIO(SDL_AsyncIO *asyncio, void *ptr, Uint64 offset, Uint64 size, SDL_AsyncIOQueue *queue, void *userdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start an async write.
|
|
||||||
*
|
|
||||||
* This function writes `size` bytes from `offset` position in the data source
|
|
||||||
* to the area pointed at by `ptr`.
|
|
||||||
*
|
|
||||||
* This function returns as quickly as possible; it does not wait for the
|
|
||||||
* write to complete. On a successful return, this work will continue in the
|
|
||||||
* background. If the work begins, even failure is asynchronous: a failing
|
|
||||||
* return value from this function only means the work couldn't start at all.
|
|
||||||
*
|
|
||||||
* `ptr` must remain available until the work is done, and may be accessed by
|
|
||||||
* the system at any time until then. Do not allocate it on the stack, as this
|
|
||||||
* might take longer than the life of the calling function to complete!
|
|
||||||
*
|
|
||||||
* An SDL_AsyncIOQueue must be specified. The newly-created task will be added
|
|
||||||
* to it when it completes its work.
|
|
||||||
*
|
|
||||||
* \param asyncio a pointer to an SDL_AsyncIO structure.
|
|
||||||
* \param ptr a pointer to a buffer to write data from.
|
|
||||||
* \param offset the position to start writing to the data source.
|
|
||||||
* \param size the number of bytes to write to the data source.
|
|
||||||
* \param queue a queue to add the new SDL_AsyncIO to.
|
|
||||||
* \param userdata an app-defined pointer that will be provided with the task
|
|
||||||
* results.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ReadAsyncIO
|
|
||||||
* \sa SDL_CreateAsyncIOQueue
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_WriteAsyncIO(SDL_AsyncIO *asyncio, void *ptr, Uint64 offset, Uint64 size, SDL_AsyncIOQueue *queue, void *userdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close and free any allocated resources for an async I/O object.
|
|
||||||
*
|
|
||||||
* Closing a file is _also_ an asynchronous task! If a write failure were to
|
|
||||||
* happen during the closing process, for example, the task results will
|
|
||||||
* report it as usual.
|
|
||||||
*
|
|
||||||
* Closing a file that has been written to does not guarantee the data has
|
|
||||||
* made it to physical media; it may remain in the operating system's file
|
|
||||||
* cache, for later writing to disk. This means that a successfully-closed
|
|
||||||
* file can be lost if the system crashes or loses power in this small window.
|
|
||||||
* To prevent this, call this function with the `flush` parameter set to true.
|
|
||||||
* This will make the operation take longer, and perhaps increase system load
|
|
||||||
* in general, but a successful result guarantees that the data has made it to
|
|
||||||
* physical storage. Don't use this for temporary files, caches, and
|
|
||||||
* unimportant data, and definitely use it for crucial irreplaceable files,
|
|
||||||
* like game saves.
|
|
||||||
*
|
|
||||||
* This function guarantees that the close will happen after any other pending
|
|
||||||
* tasks to `asyncio`, so it's safe to open a file, start several operations,
|
|
||||||
* close the file immediately, then check for all results later. This function
|
|
||||||
* will not block until the tasks have completed.
|
|
||||||
*
|
|
||||||
* Once this function returns true, `asyncio` is no longer valid, regardless
|
|
||||||
* of any future outcomes. Any completed tasks might still contain this
|
|
||||||
* pointer in their SDL_AsyncIOOutcome data, in case the app was using this
|
|
||||||
* value to track information, but it should not be used again.
|
|
||||||
*
|
|
||||||
* If this function returns false, the close wasn't started at all, and it's
|
|
||||||
* safe to attempt to close again later.
|
|
||||||
*
|
|
||||||
* An SDL_AsyncIOQueue must be specified. The newly-created task will be added
|
|
||||||
* to it when it completes its work.
|
|
||||||
*
|
|
||||||
* \param asyncio a pointer to an SDL_AsyncIO structure to close.
|
|
||||||
* \param flush true if data should sync to disk before the task completes.
|
|
||||||
* \param queue a queue to add the new SDL_AsyncIO to.
|
|
||||||
* \param userdata an app-defined pointer that will be provided with the task
|
|
||||||
* results.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread, but two
|
|
||||||
* threads should not attempt to close the same object.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flush, SDL_AsyncIOQueue *queue, void *userdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a task queue for tracking multiple I/O operations.
|
|
||||||
*
|
|
||||||
* Async I/O operations are assigned to a queue when started. The queue can be
|
|
||||||
* checked for completed tasks thereafter.
|
|
||||||
*
|
|
||||||
* \returns a new task queue object or NULL if there was an error; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_DestroyAsyncIOQueue
|
|
||||||
* \sa SDL_GetAsyncIOResult
|
|
||||||
* \sa SDL_WaitAsyncIOResult
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_AsyncIOQueue * SDLCALL SDL_CreateAsyncIOQueue(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy a previously-created async I/O task queue.
|
|
||||||
*
|
|
||||||
* If there are still tasks pending for this queue, this call will block until
|
|
||||||
* those tasks are finished. All those tasks will be deallocated. Their
|
|
||||||
* results will be lost to the app.
|
|
||||||
*
|
|
||||||
* Any pending reads from SDL_LoadFileAsync() that are still in this queue
|
|
||||||
* will have their buffers deallocated by this function, to prevent a memory
|
|
||||||
* leak.
|
|
||||||
*
|
|
||||||
* Once this function is called, the queue is no longer valid and should not
|
|
||||||
* be used, including by other threads that might access it while destruction
|
|
||||||
* is blocking on pending tasks.
|
|
||||||
*
|
|
||||||
* Do not destroy a queue that still has threads waiting on it through
|
|
||||||
* SDL_WaitAsyncIOResult(). You can call SDL_SignalAsyncIOQueue() first to
|
|
||||||
* unblock those threads, and take measures (such as SDL_WaitThread()) to make
|
|
||||||
* sure they have finished their wait and won't wait on the queue again.
|
|
||||||
*
|
|
||||||
* \param queue the task queue to destroy.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread, so long as
|
|
||||||
* no other thread is waiting on the queue with
|
|
||||||
* SDL_WaitAsyncIOResult.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Query an async I/O task queue for completed tasks.
|
|
||||||
*
|
|
||||||
* If a task assigned to this queue has finished, this will return true and
|
|
||||||
* fill in `outcome` with the details of the task. If no task in the queue has
|
|
||||||
* finished, this function will return false. This function does not block.
|
|
||||||
*
|
|
||||||
* If a task has completed, this function will free its resources and the task
|
|
||||||
* pointer will no longer be valid. The task will be removed from the queue.
|
|
||||||
*
|
|
||||||
* It is safe for multiple threads to call this function on the same queue at
|
|
||||||
* once; a completed task will only go to one of the threads.
|
|
||||||
*
|
|
||||||
* \param queue the async I/O task queue to query.
|
|
||||||
* \param outcome details of a finished task will be written here. May not be
|
|
||||||
* NULL.
|
|
||||||
* \returns true if a task has completed, false otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_WaitAsyncIOResult
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetAsyncIOResult(SDL_AsyncIOQueue *queue, SDL_AsyncIOOutcome *outcome);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Block until an async I/O task queue has a completed task.
|
|
||||||
*
|
|
||||||
* This function puts the calling thread to sleep until there a task assigned
|
|
||||||
* to the queue that has finished.
|
|
||||||
*
|
|
||||||
* If a task assigned to the queue has finished, this will return true and
|
|
||||||
* fill in `outcome` with the details of the task. If no task in the queue has
|
|
||||||
* finished, this function will return false.
|
|
||||||
*
|
|
||||||
* If a task has completed, this function will free its resources and the task
|
|
||||||
* pointer will no longer be valid. The task will be removed from the queue.
|
|
||||||
*
|
|
||||||
* It is safe for multiple threads to call this function on the same queue at
|
|
||||||
* once; a completed task will only go to one of the threads.
|
|
||||||
*
|
|
||||||
* Note that by the nature of various platforms, more than one waiting thread
|
|
||||||
* may wake to handle a single task, but only one will obtain it, so
|
|
||||||
* `timeoutMS` is a _maximum_ wait time, and this function may return false
|
|
||||||
* sooner.
|
|
||||||
*
|
|
||||||
* This function may return false if there was a system error, the OS
|
|
||||||
* inadvertently awoke multiple threads, or if SDL_SignalAsyncIOQueue() was
|
|
||||||
* called to wake up all waiting threads without a finished task.
|
|
||||||
*
|
|
||||||
* A timeout can be used to specify a maximum wait time, but rather than
|
|
||||||
* polling, it is possible to have a timeout of -1 to wait forever, and use
|
|
||||||
* SDL_SignalAsyncIOQueue() to wake up the waiting threads later.
|
|
||||||
*
|
|
||||||
* \param queue the async I/O task queue to wait on.
|
|
||||||
* \param outcome details of a finished task will be written here. May not be
|
|
||||||
* NULL.
|
|
||||||
* \param timeoutMS the maximum time to wait, in milliseconds, or -1 to wait
|
|
||||||
* indefinitely.
|
|
||||||
* \returns true if task has completed, false otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SignalAsyncIOQueue
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_WaitAsyncIOResult(SDL_AsyncIOQueue *queue, SDL_AsyncIOOutcome *outcome, Sint32 timeoutMS);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wake up any threads that are blocking in SDL_WaitAsyncIOResult().
|
|
||||||
*
|
|
||||||
* This will unblock any threads that are sleeping in a call to
|
|
||||||
* SDL_WaitAsyncIOResult for the specified queue, and cause them to return
|
|
||||||
* from that function.
|
|
||||||
*
|
|
||||||
* This can be useful when destroying a queue to make sure nothing is touching
|
|
||||||
* it indefinitely. In this case, once this call completes, the caller should
|
|
||||||
* take measures to make sure any previously-blocked threads have returned
|
|
||||||
* from their wait and will not touch the queue again (perhaps by setting a
|
|
||||||
* flag to tell the threads to terminate and then using SDL_WaitThread() to
|
|
||||||
* make sure they've done so).
|
|
||||||
*
|
|
||||||
* \param queue the async I/O task queue to signal.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_WaitAsyncIOResult
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue *queue);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load all the data from a file path, asynchronously.
|
|
||||||
*
|
|
||||||
* This function returns as quickly as possible; it does not wait for the read
|
|
||||||
* to complete. On a successful return, this work will continue in the
|
|
||||||
* background. If the work begins, even failure is asynchronous: a failing
|
|
||||||
* return value from this function only means the work couldn't start at all.
|
|
||||||
*
|
|
||||||
* The data is allocated with a zero byte at the end (null terminated) for
|
|
||||||
* convenience. This extra byte is not included in SDL_AsyncIOOutcome's
|
|
||||||
* bytes_transferred value.
|
|
||||||
*
|
|
||||||
* This function will allocate the buffer to contain the file. It must be
|
|
||||||
* deallocated by calling SDL_free() on SDL_AsyncIOOutcome's buffer field
|
|
||||||
* after completion.
|
|
||||||
*
|
|
||||||
* An SDL_AsyncIOQueue must be specified. The newly-created task will be added
|
|
||||||
* to it when it completes its work.
|
|
||||||
*
|
|
||||||
* \param file the path to read all available data from.
|
|
||||||
* \param queue a queue to add the new SDL_AsyncIO to.
|
|
||||||
* \param userdata an app-defined pointer that will be provided with the task
|
|
||||||
* results.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LoadFile_IO
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_LoadFileAsync(const char *file, SDL_AsyncIOQueue *queue, void *userdata);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_asyncio_h_ */
|
|
||||||
@@ -1,664 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryAtomic
|
|
||||||
*
|
|
||||||
* Atomic operations.
|
|
||||||
*
|
|
||||||
* IMPORTANT: If you are not an expert in concurrent lockless programming, you
|
|
||||||
* should not be using any functions in this file. You should be protecting
|
|
||||||
* your data structures with full mutexes instead.
|
|
||||||
*
|
|
||||||
* ***Seriously, here be dragons!***
|
|
||||||
*
|
|
||||||
* You can find out a little more about lockless programming and the subtle
|
|
||||||
* issues that can arise here:
|
|
||||||
* https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming
|
|
||||||
*
|
|
||||||
* There's also lots of good information here:
|
|
||||||
*
|
|
||||||
* - https://www.1024cores.net/home/lock-free-algorithms
|
|
||||||
* - https://preshing.com/
|
|
||||||
*
|
|
||||||
* These operations may or may not actually be implemented using processor
|
|
||||||
* specific atomic operations. When possible they are implemented as true
|
|
||||||
* processor specific atomic operations. When that is not possible the are
|
|
||||||
* implemented using locks that *do* use the available atomic operations.
|
|
||||||
*
|
|
||||||
* All of the atomic operations that modify memory are full memory barriers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_atomic_h_
|
|
||||||
#define SDL_atomic_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_platform_defines.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An atomic spinlock.
|
|
||||||
*
|
|
||||||
* The atomic locks are efficient spinlocks using CPU instructions, but are
|
|
||||||
* vulnerable to starvation and can spin forever if a thread holding a lock
|
|
||||||
* has been terminated. For this reason you should minimize the code executed
|
|
||||||
* inside an atomic lock and never do expensive things like API or system
|
|
||||||
* calls while holding them.
|
|
||||||
*
|
|
||||||
* They are also vulnerable to starvation if the thread holding the lock is
|
|
||||||
* lower priority than other threads and doesn't get scheduled. In general you
|
|
||||||
* should use mutexes instead, since they have better performance and
|
|
||||||
* contention behavior.
|
|
||||||
*
|
|
||||||
* The atomic locks are not safe to lock recursively.
|
|
||||||
*
|
|
||||||
* Porting Note: The spin lock functions and type are required and can not be
|
|
||||||
* emulated because they are used in the atomic emulation code.
|
|
||||||
*/
|
|
||||||
typedef int SDL_SpinLock;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to lock a spin lock by setting it to a non-zero value.
|
|
||||||
*
|
|
||||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
|
||||||
* doing. Please be careful using any sort of spinlock!***
|
|
||||||
*
|
|
||||||
* \param lock a pointer to a lock variable.
|
|
||||||
* \returns true if the lock succeeded, false if the lock is already held.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LockSpinlock
|
|
||||||
* \sa SDL_UnlockSpinlock
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockSpinlock(SDL_SpinLock *lock);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lock a spin lock by setting it to a non-zero value.
|
|
||||||
*
|
|
||||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
|
||||||
* doing. Please be careful using any sort of spinlock!***
|
|
||||||
*
|
|
||||||
* \param lock a pointer to a lock variable.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_TryLockSpinlock
|
|
||||||
* \sa SDL_UnlockSpinlock
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_LockSpinlock(SDL_SpinLock *lock);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unlock a spin lock by setting it to 0.
|
|
||||||
*
|
|
||||||
* Always returns immediately.
|
|
||||||
*
|
|
||||||
* ***Please note that spinlocks are dangerous if you don't know what you're
|
|
||||||
* doing. Please be careful using any sort of spinlock!***
|
|
||||||
*
|
|
||||||
* \param lock a pointer to a lock variable.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LockSpinlock
|
|
||||||
* \sa SDL_TryLockSpinlock
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_UnlockSpinlock(SDL_SpinLock *lock);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mark a compiler barrier.
|
|
||||||
*
|
|
||||||
* A compiler barrier prevents the compiler from reordering reads and writes
|
|
||||||
* to globally visible variables across the call.
|
|
||||||
*
|
|
||||||
* This macro only prevents the compiler from reordering reads and writes, it
|
|
||||||
* does not prevent the CPU from reordering reads and writes. However, all of
|
|
||||||
* the atomic operations that modify memory are full memory barriers.
|
|
||||||
*
|
|
||||||
* \threadsafety Obviously this macro is safe to use from any thread at any
|
|
||||||
* time, but if you find yourself needing this, you are probably
|
|
||||||
* dealing with some very sensitive code; be careful!
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_CompilerBarrier() DoCompilerSpecificReadWriteBarrier()
|
|
||||||
|
|
||||||
#elif defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
|
|
||||||
void _ReadWriteBarrier(void);
|
|
||||||
#pragma intrinsic(_ReadWriteBarrier)
|
|
||||||
#define SDL_CompilerBarrier() _ReadWriteBarrier()
|
|
||||||
#elif (defined(__GNUC__) && !defined(SDL_PLATFORM_EMSCRIPTEN)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
|
|
||||||
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
|
|
||||||
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
|
||||||
#elif defined(__WATCOMC__)
|
|
||||||
extern __inline void SDL_CompilerBarrier(void);
|
|
||||||
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
|
|
||||||
#else
|
|
||||||
#define SDL_CompilerBarrier() \
|
|
||||||
{ SDL_SpinLock _tmp = 0; SDL_LockSpinlock(&_tmp); SDL_UnlockSpinlock(&_tmp); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a memory release barrier (function version).
|
|
||||||
*
|
|
||||||
* Please refer to SDL_MemoryBarrierRelease for details. This is a function
|
|
||||||
* version, which might be useful if you need to use this functionality from a
|
|
||||||
* scripting language, etc. Also, some of the macro versions call this
|
|
||||||
* function behind the scenes, where more heavy lifting can happen inside of
|
|
||||||
* SDL. Generally, though, an app written in C/C++/etc should use the macro
|
|
||||||
* version, as it will be more efficient.
|
|
||||||
*
|
|
||||||
* \threadsafety Obviously this function is safe to use from any thread at any
|
|
||||||
* time, but if you find yourself needing this, you are probably
|
|
||||||
* dealing with some very sensitive code; be careful!
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_MemoryBarrierRelease
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a memory acquire barrier (function version).
|
|
||||||
*
|
|
||||||
* Please refer to SDL_MemoryBarrierRelease for details. This is a function
|
|
||||||
* version, which might be useful if you need to use this functionality from a
|
|
||||||
* scripting language, etc. Also, some of the macro versions call this
|
|
||||||
* function behind the scenes, where more heavy lifting can happen inside of
|
|
||||||
* SDL. Generally, though, an app written in C/C++/etc should use the macro
|
|
||||||
* version, as it will be more efficient.
|
|
||||||
*
|
|
||||||
* \threadsafety Obviously this function is safe to use from any thread at any
|
|
||||||
* time, but if you find yourself needing this, you are probably
|
|
||||||
* dealing with some very sensitive code; be careful!
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_MemoryBarrierAcquire
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a memory release barrier (macro version).
|
|
||||||
*
|
|
||||||
* Memory barriers are designed to prevent reads and writes from being
|
|
||||||
* reordered by the compiler and being seen out of order on multi-core CPUs.
|
|
||||||
*
|
|
||||||
* A typical pattern would be for thread A to write some data and a flag, and
|
|
||||||
* for thread B to read the flag and get the data. In this case you would
|
|
||||||
* insert a release barrier between writing the data and the flag,
|
|
||||||
* guaranteeing that the data write completes no later than the flag is
|
|
||||||
* written, and you would insert an acquire barrier between reading the flag
|
|
||||||
* and reading the data, to ensure that all the reads associated with the flag
|
|
||||||
* have completed.
|
|
||||||
*
|
|
||||||
* In this pattern you should always see a release barrier paired with an
|
|
||||||
* acquire barrier and you should gate the data reads/writes with a single
|
|
||||||
* flag variable.
|
|
||||||
*
|
|
||||||
* For more information on these semantics, take a look at the blog post:
|
|
||||||
* http://preshing.com/20120913/acquire-and-release-semantics
|
|
||||||
*
|
|
||||||
* This is the macro version of this functionality; if possible, SDL will use
|
|
||||||
* compiler intrinsics or inline assembly, but some platforms might need to
|
|
||||||
* call the function version of this, SDL_MemoryBarrierReleaseFunction to do
|
|
||||||
* the heavy lifting. Apps that can use the macro should favor it over the
|
|
||||||
* function.
|
|
||||||
*
|
|
||||||
* \threadsafety Obviously this macro is safe to use from any thread at any
|
|
||||||
* time, but if you find yourself needing this, you are probably
|
|
||||||
* dealing with some very sensitive code; be careful!
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_MemoryBarrierAcquire
|
|
||||||
* \sa SDL_MemoryBarrierReleaseFunction
|
|
||||||
*/
|
|
||||||
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a memory acquire barrier (macro version).
|
|
||||||
*
|
|
||||||
* Please see SDL_MemoryBarrierRelease for the details on what memory barriers
|
|
||||||
* are and when to use them.
|
|
||||||
*
|
|
||||||
* This is the macro version of this functionality; if possible, SDL will use
|
|
||||||
* compiler intrinsics or inline assembly, but some platforms might need to
|
|
||||||
* call the function version of this, SDL_MemoryBarrierAcquireFunction, to do
|
|
||||||
* the heavy lifting. Apps that can use the macro should favor it over the
|
|
||||||
* function.
|
|
||||||
*
|
|
||||||
* \threadsafety Obviously this macro is safe to use from any thread at any
|
|
||||||
* time, but if you find yourself needing this, you are probably
|
|
||||||
* dealing with some very sensitive code; be careful!
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_MemoryBarrierRelease
|
|
||||||
* \sa SDL_MemoryBarrierAcquireFunction
|
|
||||||
*/
|
|
||||||
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
|
|
||||||
|
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
|
||||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
|
|
||||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
|
|
||||||
#elif defined(__GNUC__) && defined(__aarch64__)
|
|
||||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
|
||||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
|
||||||
#elif defined(__GNUC__) && defined(__arm__)
|
|
||||||
#if 0 /* defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID) */
|
|
||||||
/* Information from:
|
|
||||||
https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
|
|
||||||
|
|
||||||
The Linux kernel provides a helper function which provides the right code for a memory barrier,
|
|
||||||
hard-coded at address 0xffff0fa0
|
|
||||||
*/
|
|
||||||
typedef void (*SDL_KernelMemoryBarrierFunc)();
|
|
||||||
#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
|
||||||
#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
|
|
||||||
#else
|
|
||||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__)
|
|
||||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
|
||||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
|
||||||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
|
|
||||||
#ifdef __thumb__
|
|
||||||
/* The mcr instruction isn't available in thumb mode, use real functions */
|
|
||||||
#define SDL_MEMORY_BARRIER_USES_FUNCTION
|
|
||||||
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
|
|
||||||
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
|
|
||||||
#else
|
|
||||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
|
||||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
|
||||||
#endif /* __thumb__ */
|
|
||||||
#else
|
|
||||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
|
|
||||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
|
|
||||||
#endif /* SDL_PLATFORM_LINUX || SDL_PLATFORM_ANDROID */
|
|
||||||
#endif /* __GNUC__ && __arm__ */
|
|
||||||
#else
|
|
||||||
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
|
|
||||||
/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
|
|
||||||
#include <mbarrier.h>
|
|
||||||
#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
|
|
||||||
#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
|
|
||||||
#else
|
|
||||||
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
|
|
||||||
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
|
|
||||||
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to insert a CPU-specific "pause" instruction into the program.
|
|
||||||
*
|
|
||||||
* This can be useful in busy-wait loops, as it serves as a hint to the CPU as
|
|
||||||
* to the program's intent; some CPUs can use this to do more efficient
|
|
||||||
* processing. On some platforms, this doesn't do anything, so using this
|
|
||||||
* macro might just be a harmless no-op.
|
|
||||||
*
|
|
||||||
* Note that if you are busy-waiting, there are often more-efficient
|
|
||||||
* approaches with other synchronization primitives: mutexes, semaphores,
|
|
||||||
* condition variables, etc.
|
|
||||||
*
|
|
||||||
* \threadsafety This macro is safe to use from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_CPUPauseInstruction() DoACPUPauseInACompilerAndArchitectureSpecificWay
|
|
||||||
|
|
||||||
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
|
|
||||||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
|
|
||||||
#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__)
|
|
||||||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
|
|
||||||
#elif (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
|
|
||||||
#elif (defined(__riscv) && __riscv_xlen == 64)
|
|
||||||
#define SDL_CPUPauseInstruction() __asm__ __volatile__(".insn i 0x0F, 0, x0, x0, 0x010");
|
|
||||||
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
|
||||||
#define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
|
|
||||||
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
|
|
||||||
#define SDL_CPUPauseInstruction() __yield()
|
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
|
||||||
extern __inline void SDL_CPUPauseInstruction(void);
|
|
||||||
#pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause"
|
|
||||||
#else
|
|
||||||
#define SDL_CPUPauseInstruction()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A type representing an atomic integer value.
|
|
||||||
*
|
|
||||||
* This can be used to manage a value that is synchronized across multiple
|
|
||||||
* CPUs without a race condition; when an app sets a value with
|
|
||||||
* SDL_SetAtomicInt all other threads, regardless of the CPU it is running on,
|
|
||||||
* will see that value when retrieved with SDL_GetAtomicInt, regardless of CPU
|
|
||||||
* caches, etc.
|
|
||||||
*
|
|
||||||
* This is also useful for atomic compare-and-swap operations: a thread can
|
|
||||||
* change the value as long as its current value matches expectations. When
|
|
||||||
* done in a loop, one can guarantee data consistency across threads without a
|
|
||||||
* lock (but the usual warnings apply: if you don't know what you're doing, or
|
|
||||||
* you don't do it carefully, you can confidently cause any number of
|
|
||||||
* disasters with this, so in most cases, you _should_ use a mutex instead of
|
|
||||||
* this!).
|
|
||||||
*
|
|
||||||
* This is a struct so people don't accidentally use numeric operations on it
|
|
||||||
* directly. You have to use SDL atomic functions.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_CompareAndSwapAtomicInt
|
|
||||||
* \sa SDL_GetAtomicInt
|
|
||||||
* \sa SDL_SetAtomicInt
|
|
||||||
* \sa SDL_AddAtomicInt
|
|
||||||
*/
|
|
||||||
typedef struct SDL_AtomicInt { int value; } SDL_AtomicInt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set an atomic variable to a new value if it is currently an old value.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicInt variable to be modified.
|
|
||||||
* \param oldval the old value.
|
|
||||||
* \param newval the new value.
|
|
||||||
* \returns true if the atomic variable was set, false otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetAtomicInt
|
|
||||||
* \sa SDL_SetAtomicInt
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicInt(SDL_AtomicInt *a, int oldval, int newval);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set an atomic variable to a value.
|
|
||||||
*
|
|
||||||
* This function also acts as a full memory barrier.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicInt variable to be modified.
|
|
||||||
* \param v the desired value.
|
|
||||||
* \returns the previous value of the atomic variable.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetAtomicInt
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_SetAtomicInt(SDL_AtomicInt *a, int v);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the value of an atomic variable.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicInt variable.
|
|
||||||
* \returns the current value of an atomic variable.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetAtomicInt
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetAtomicInt(SDL_AtomicInt *a);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add to an atomic variable.
|
|
||||||
*
|
|
||||||
* This function also acts as a full memory barrier.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicInt variable to be modified.
|
|
||||||
* \param v the desired value to add.
|
|
||||||
* \returns the previous value of the atomic variable.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_AtomicDecRef
|
|
||||||
* \sa SDL_AtomicIncRef
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v);
|
|
||||||
|
|
||||||
#ifndef SDL_AtomicIncRef
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Increment an atomic variable used as a reference count.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this macro is for, you shouldn't use it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicInt to increment.
|
|
||||||
* \returns the previous value of the atomic variable.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_AtomicDecRef
|
|
||||||
*/
|
|
||||||
#define SDL_AtomicIncRef(a) SDL_AddAtomicInt(a, 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SDL_AtomicDecRef
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decrement an atomic variable used as a reference count.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this macro is for, you shouldn't use it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicInt to decrement.
|
|
||||||
* \returns true if the variable reached zero after decrementing, false
|
|
||||||
* otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_AtomicIncRef
|
|
||||||
*/
|
|
||||||
#define SDL_AtomicDecRef(a) (SDL_AddAtomicInt(a, -1) == 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A type representing an atomic unsigned 32-bit value.
|
|
||||||
*
|
|
||||||
* This can be used to manage a value that is synchronized across multiple
|
|
||||||
* CPUs without a race condition; when an app sets a value with
|
|
||||||
* SDL_SetAtomicU32 all other threads, regardless of the CPU it is running on,
|
|
||||||
* will see that value when retrieved with SDL_GetAtomicU32, regardless of CPU
|
|
||||||
* caches, etc.
|
|
||||||
*
|
|
||||||
* This is also useful for atomic compare-and-swap operations: a thread can
|
|
||||||
* change the value as long as its current value matches expectations. When
|
|
||||||
* done in a loop, one can guarantee data consistency across threads without a
|
|
||||||
* lock (but the usual warnings apply: if you don't know what you're doing, or
|
|
||||||
* you don't do it carefully, you can confidently cause any number of
|
|
||||||
* disasters with this, so in most cases, you _should_ use a mutex instead of
|
|
||||||
* this!).
|
|
||||||
*
|
|
||||||
* This is a struct so people don't accidentally use numeric operations on it
|
|
||||||
* directly. You have to use SDL atomic functions.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_CompareAndSwapAtomicU32
|
|
||||||
* \sa SDL_GetAtomicU32
|
|
||||||
* \sa SDL_SetAtomicU32
|
|
||||||
*/
|
|
||||||
typedef struct SDL_AtomicU32 { Uint32 value; } SDL_AtomicU32;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set an atomic variable to a new value if it is currently an old value.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicU32 variable to be modified.
|
|
||||||
* \param oldval the old value.
|
|
||||||
* \param newval the new value.
|
|
||||||
* \returns true if the atomic variable was set, false otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetAtomicU32
|
|
||||||
* \sa SDL_SetAtomicU32
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicU32(SDL_AtomicU32 *a, Uint32 oldval, Uint32 newval);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set an atomic variable to a value.
|
|
||||||
*
|
|
||||||
* This function also acts as a full memory barrier.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicU32 variable to be modified.
|
|
||||||
* \param v the desired value.
|
|
||||||
* \returns the previous value of the atomic variable.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetAtomicU32
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_SetAtomicU32(SDL_AtomicU32 *a, Uint32 v);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the value of an atomic variable.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to an SDL_AtomicU32 variable.
|
|
||||||
* \returns the current value of an atomic variable.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetAtomicU32
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAtomicU32(SDL_AtomicU32 *a);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a pointer to a new value if it is currently an old value.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to a pointer.
|
|
||||||
* \param oldval the old pointer value.
|
|
||||||
* \param newval the new pointer value.
|
|
||||||
* \returns true if the pointer was set, false otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_CompareAndSwapAtomicInt
|
|
||||||
* \sa SDL_GetAtomicPointer
|
|
||||||
* \sa SDL_SetAtomicPointer
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicPointer(void **a, void *oldval, void *newval);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a pointer to a value atomically.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to a pointer.
|
|
||||||
* \param v the desired pointer value.
|
|
||||||
* \returns the previous value of the pointer.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_CompareAndSwapAtomicPointer
|
|
||||||
* \sa SDL_GetAtomicPointer
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void * SDLCALL SDL_SetAtomicPointer(void **a, void *v);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the value of a pointer atomically.
|
|
||||||
*
|
|
||||||
* ***Note: If you don't know what this function is for, you shouldn't use
|
|
||||||
* it!***
|
|
||||||
*
|
|
||||||
* \param a a pointer to a pointer.
|
|
||||||
* \returns the current value of a pointer.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_CompareAndSwapAtomicPointer
|
|
||||||
* \sa SDL_SetAtomicPointer
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void * SDLCALL SDL_GetAtomicPointer(void **a);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_atomic_h_ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,486 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WIKI CATEGORY: BeginCode */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryBeginCode
|
|
||||||
*
|
|
||||||
* `SDL_begin_code.h` sets things up for C dynamic library function
|
|
||||||
* definitions, static inlined functions, and structures aligned at 4-byte
|
|
||||||
* alignment. If you don't like ugly C preprocessor code, don't look at this
|
|
||||||
* file. :)
|
|
||||||
*
|
|
||||||
* SDL's headers use this; applications generally should not include this
|
|
||||||
* header directly.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This shouldn't be nested -- included it around code only. */
|
|
||||||
#ifdef SDL_begin_code_h
|
|
||||||
#error Nested inclusion of SDL_begin_code.h
|
|
||||||
#endif
|
|
||||||
#define SDL_begin_code_h
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a symbol as deprecated.
|
|
||||||
*
|
|
||||||
* A function is marked deprecated by adding this macro to its declaration:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* extern SDL_DEPRECATED int ThisFunctionWasABadIdea(void);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Compilers with deprecation support can give a warning when a deprecated
|
|
||||||
* function is used. This symbol may be used in SDL's headers, but apps are
|
|
||||||
* welcome to use it for their own interfaces as well.
|
|
||||||
*
|
|
||||||
* SDL, on occasion, might deprecate a function for various reasons. However,
|
|
||||||
* SDL never removes symbols before major versions, so deprecated interfaces
|
|
||||||
* in SDL3 will remain available until SDL4, where it would be expected an app
|
|
||||||
* would have to take steps to migrate anyhow.
|
|
||||||
*
|
|
||||||
* On compilers without a deprecation mechanism, this is defined to nothing,
|
|
||||||
* and using a deprecated function will not generate a warning.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_DEPRECATED __attribute__((deprecated))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a symbol as a public API.
|
|
||||||
*
|
|
||||||
* SDL uses this macro for all its public functions. On some targets, it is
|
|
||||||
* used to signal to the compiler that this function needs to be exported from
|
|
||||||
* a shared library, but it might have other side effects.
|
|
||||||
*
|
|
||||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
|
||||||
* welcome to use it for their own interfaces as well.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_DECLSPEC __attribute__ ((visibility("default")))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to set a function's calling conventions.
|
|
||||||
*
|
|
||||||
* SDL uses this macro for all its public functions, and any callbacks it
|
|
||||||
* defines. This macro guarantees that calling conventions match between SDL
|
|
||||||
* and the app, even if the two were built with different compilers or
|
|
||||||
* optimization settings.
|
|
||||||
*
|
|
||||||
* When writing a callback function, it is very important for it to be
|
|
||||||
* correctly tagged with SDLCALL, as mismatched calling conventions can cause
|
|
||||||
* strange behaviors and can be difficult to diagnose. Plus, on many
|
|
||||||
* platforms, SDLCALL is defined to nothing, so compilers won't be able to
|
|
||||||
* warn that the tag is missing.
|
|
||||||
*
|
|
||||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
|
||||||
* welcome to use it for their own interfaces as well.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDLCALL __cdecl
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to request a function be inlined.
|
|
||||||
*
|
|
||||||
* This is a hint to the compiler to inline a function. The compiler is free
|
|
||||||
* to ignore this request. On compilers without inline support, this is
|
|
||||||
* defined to nothing.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_INLINE __inline
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to demand a function be inlined.
|
|
||||||
*
|
|
||||||
* This is a command to the compiler to inline a function. SDL uses this macro
|
|
||||||
* in its public headers for a handful of simple functions. On compilers
|
|
||||||
* without forceinline support, this is defined to `static SDL_INLINE`, which
|
|
||||||
* is often good enough.
|
|
||||||
*
|
|
||||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
|
||||||
* welcome to use it for their own interfaces as well.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_FORCE_INLINE __forceinline
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a function as never-returning.
|
|
||||||
*
|
|
||||||
* This is a hint to the compiler that a function does not return. An example
|
|
||||||
* of a function like this is the C runtime's exit() function.
|
|
||||||
*
|
|
||||||
* This hint can lead to code optimizations, and help analyzers understand
|
|
||||||
* code flow better. On compilers without noreturn support, this is defined to
|
|
||||||
* nothing.
|
|
||||||
*
|
|
||||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
|
||||||
* welcome to use it for their own interfaces as well.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_NORETURN __attribute__((noreturn))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a function as never-returning (for analysis purposes).
|
|
||||||
*
|
|
||||||
* This is almost identical to SDL_NORETURN, except functions marked with this
|
|
||||||
* _can_ actually return. The difference is that this isn't used for code
|
|
||||||
* generation, but rather static analyzers use this information to assume
|
|
||||||
* truths about program state and available code paths. Specifically, this tag
|
|
||||||
* is useful for writing an assertion mechanism. Indeed, SDL_assert uses this
|
|
||||||
* tag behind the scenes. Generally, apps that don't understand the specific
|
|
||||||
* use-case for this tag should avoid using it directly.
|
|
||||||
*
|
|
||||||
* On compilers without analyzer_noreturn support, this is defined to nothing.
|
|
||||||
*
|
|
||||||
* This symbol is used in SDL's headers, but apps and other libraries are
|
|
||||||
* welcome to use it for their own interfaces as well.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to signal that a case statement without a `break` is intentional.
|
|
||||||
*
|
|
||||||
* C compilers have gotten more aggressive about warning when a switch's
|
|
||||||
* `case` block does not end with a `break` or other flow control statement,
|
|
||||||
* flowing into the next case's code, as this is a common accident that leads
|
|
||||||
* to strange bugs. But sometimes falling through to the next case is the
|
|
||||||
* correct and desired behavior. This symbol lets an app communicate this
|
|
||||||
* intention to the compiler, so it doesn't generate a warning.
|
|
||||||
*
|
|
||||||
* It is used like this:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* switch (x) {
|
|
||||||
* case 1:
|
|
||||||
* DoSomethingOnlyForOne();
|
|
||||||
* SDL_FALLTHROUGH; // tell the compiler this was intentional.
|
|
||||||
* case 2:
|
|
||||||
* DoSomethingForOneAndTwo();
|
|
||||||
* break;
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_FALLTHROUGH [[fallthrough]]
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a function's return value as critical.
|
|
||||||
*
|
|
||||||
* This is a hint to the compiler that a function's return value should not be
|
|
||||||
* ignored.
|
|
||||||
*
|
|
||||||
* If an NODISCARD function's return value is thrown away (the function is
|
|
||||||
* called as if it returns `void`), the compiler will issue a warning.
|
|
||||||
*
|
|
||||||
* While it's generally good practice to check return values for errors, often
|
|
||||||
* times legitimate programs do not for good reasons. Be careful about what
|
|
||||||
* functions are tagged as NODISCARD. It operates best when used on a function
|
|
||||||
* that's failure is surprising and catastrophic; a good example would be a
|
|
||||||
* program that checks the return values of all its file write function calls
|
|
||||||
* but not the call to close the file, which it assumes incorrectly never
|
|
||||||
* fails.
|
|
||||||
*
|
|
||||||
* Function callers that want to throw away a NODISCARD return value can call
|
|
||||||
* the function with a `(void)` cast, which informs the compiler the act is
|
|
||||||
* intentional.
|
|
||||||
*
|
|
||||||
* On compilers without nodiscard support, this is defined to nothing.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_NODISCARD [[nodiscard]]
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a function as an allocator.
|
|
||||||
*
|
|
||||||
* This is a hint to the compiler that a function is an allocator, like
|
|
||||||
* malloc(), with certain rules. A description of how GCC treats this hint is
|
|
||||||
* here:
|
|
||||||
*
|
|
||||||
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute
|
|
||||||
*
|
|
||||||
* On compilers without allocator tag support, this is defined to nothing.
|
|
||||||
*
|
|
||||||
* Most apps don't need to, and should not, use this directly.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_MALLOC __declspec(allocator) __desclspec(restrict)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a function as returning a certain allocation.
|
|
||||||
*
|
|
||||||
* This is a hint to the compiler that a function allocates and returns a
|
|
||||||
* specific amount of memory based on one of its arguments. For example, the C
|
|
||||||
* runtime's malloc() function could use this macro with an argument of 1
|
|
||||||
* (first argument to malloc is the size of the allocation).
|
|
||||||
*
|
|
||||||
* On compilers without alloc_size support, this is defined to nothing.
|
|
||||||
*
|
|
||||||
* Most apps don't need to, and should not, use this directly.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a pointer variable, to help with pointer aliasing.
|
|
||||||
*
|
|
||||||
* A good explanation of the restrict keyword is here:
|
|
||||||
*
|
|
||||||
* https://en.wikipedia.org/wiki/Restrict
|
|
||||||
*
|
|
||||||
* On compilers without restrict support, this is defined to nothing.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_RESTRICT __restrict__
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the compiler supports a given builtin functionality.
|
|
||||||
*
|
|
||||||
* This allows preprocessor checks for things that otherwise might fail to
|
|
||||||
* compile.
|
|
||||||
*
|
|
||||||
* Supported by virtually all clang versions and more-recent GCCs. Use this
|
|
||||||
* instead of checking the clang version if possible.
|
|
||||||
*
|
|
||||||
* On compilers without has_builtin support, this is defined to 0 (always
|
|
||||||
* false).
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_HAS_BUILTIN(x) __has_builtin(x)
|
|
||||||
|
|
||||||
/* end of wiki documentation section. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SDL_HAS_BUILTIN
|
|
||||||
#ifdef __has_builtin
|
|
||||||
#define SDL_HAS_BUILTIN(x) __has_builtin(x)
|
|
||||||
#else
|
|
||||||
#define SDL_HAS_BUILTIN(x) 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SDL_DEPRECATED
|
|
||||||
# if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
|
|
||||||
# define SDL_DEPRECATED __attribute__((deprecated))
|
|
||||||
# elif defined(_MSC_VER)
|
|
||||||
# define SDL_DEPRECATED __declspec(deprecated)
|
|
||||||
# else
|
|
||||||
# define SDL_DEPRECATED
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SDL_UNUSED
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define SDL_UNUSED __attribute__((unused))
|
|
||||||
# else
|
|
||||||
# define SDL_UNUSED
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Some compilers use a special export keyword */
|
|
||||||
#ifndef SDL_DECLSPEC
|
|
||||||
# if defined(SDL_PLATFORM_WINDOWS)
|
|
||||||
# ifdef DLL_EXPORT
|
|
||||||
# define SDL_DECLSPEC __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define SDL_DECLSPEC
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
|
||||||
# define SDL_DECLSPEC __attribute__ ((visibility("default")))
|
|
||||||
# else
|
|
||||||
# define SDL_DECLSPEC
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* By default SDL uses the C calling convention */
|
|
||||||
#ifndef SDLCALL
|
|
||||||
#if defined(SDL_PLATFORM_WINDOWS) && !defined(__GNUC__)
|
|
||||||
#define SDLCALL __cdecl
|
|
||||||
#else
|
|
||||||
#define SDLCALL
|
|
||||||
#endif
|
|
||||||
#endif /* SDLCALL */
|
|
||||||
|
|
||||||
/* Force structure packing at 4 byte alignment.
|
|
||||||
This is necessary if the header is included in code which has structure
|
|
||||||
packing set to an alternate value, say for loading structures from disk.
|
|
||||||
The packing is reset to the previous value in SDL_close_code.h
|
|
||||||
*/
|
|
||||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable: 4103)
|
|
||||||
#endif
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic ignored "-Wpragma-pack"
|
|
||||||
#endif
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma nopackwarning
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN64
|
|
||||||
/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
|
|
||||||
#pragma pack(push,8)
|
|
||||||
#else
|
|
||||||
#pragma pack(push,4)
|
|
||||||
#endif
|
|
||||||
#endif /* Compiler needs structure packing set */
|
|
||||||
|
|
||||||
#ifndef SDL_INLINE
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define SDL_INLINE __inline__
|
|
||||||
#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
|
|
||||||
defined(__DMC__) || defined(__SC__) || \
|
|
||||||
defined(__WATCOMC__) || defined(__LCC__) || \
|
|
||||||
defined(__DECC) || defined(__CC_ARM)
|
|
||||||
#define SDL_INLINE __inline
|
|
||||||
#ifndef __inline__
|
|
||||||
#define __inline__ __inline
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define SDL_INLINE inline
|
|
||||||
#ifndef __inline__
|
|
||||||
#define __inline__ inline
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif /* SDL_INLINE not defined */
|
|
||||||
|
|
||||||
#ifndef SDL_FORCE_INLINE
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define SDL_FORCE_INLINE __forceinline
|
|
||||||
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
|
|
||||||
#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
|
|
||||||
#else
|
|
||||||
#define SDL_FORCE_INLINE static SDL_INLINE
|
|
||||||
#endif
|
|
||||||
#endif /* SDL_FORCE_INLINE not defined */
|
|
||||||
|
|
||||||
#ifndef SDL_NORETURN
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define SDL_NORETURN __attribute__((noreturn))
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#define SDL_NORETURN __declspec(noreturn)
|
|
||||||
#else
|
|
||||||
#define SDL_NORETURN
|
|
||||||
#endif
|
|
||||||
#endif /* SDL_NORETURN not defined */
|
|
||||||
|
|
||||||
#ifdef __clang__
|
|
||||||
#if __has_feature(attribute_analyzer_noreturn)
|
|
||||||
#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SDL_ANALYZER_NORETURN
|
|
||||||
#define SDL_ANALYZER_NORETURN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Apparently this is needed by several Windows compilers */
|
|
||||||
#ifndef __MACH__
|
|
||||||
#ifndef NULL
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define NULL 0
|
|
||||||
#else
|
|
||||||
#define NULL ((void *)0)
|
|
||||||
#endif
|
|
||||||
#endif /* NULL */
|
|
||||||
#endif /* ! macOS - breaks precompiled headers */
|
|
||||||
|
|
||||||
#ifndef SDL_FALLTHROUGH
|
|
||||||
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
|
|
||||||
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
|
|
||||||
#define SDL_FALLTHROUGH [[fallthrough]]
|
|
||||||
#else
|
|
||||||
#if defined(__has_attribute) && !defined(__SUNPRO_C) && !defined(__SUNPRO_CC)
|
|
||||||
#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
|
|
||||||
#else
|
|
||||||
#define SDL_HAS_FALLTHROUGH 0
|
|
||||||
#endif /* __has_attribute */
|
|
||||||
#if SDL_HAS_FALLTHROUGH && \
|
|
||||||
((defined(__GNUC__) && __GNUC__ >= 7) || \
|
|
||||||
(defined(__clang_major__) && __clang_major__ >= 10))
|
|
||||||
#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
|
|
||||||
#else
|
|
||||||
#define SDL_FALLTHROUGH do {} while (0) /* fallthrough */
|
|
||||||
#endif /* SDL_HAS_FALLTHROUGH */
|
|
||||||
#undef SDL_HAS_FALLTHROUGH
|
|
||||||
#endif /* C++17 or C2x */
|
|
||||||
#endif /* SDL_FALLTHROUGH not defined */
|
|
||||||
|
|
||||||
#ifndef SDL_NODISCARD
|
|
||||||
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
|
|
||||||
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
|
|
||||||
#define SDL_NODISCARD [[nodiscard]]
|
|
||||||
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
|
|
||||||
#define SDL_NODISCARD __attribute__((warn_unused_result))
|
|
||||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1700)
|
|
||||||
#define SDL_NODISCARD _Check_return_
|
|
||||||
#else
|
|
||||||
#define SDL_NODISCARD
|
|
||||||
#endif /* C++17 or C23 */
|
|
||||||
#endif /* SDL_NODISCARD not defined */
|
|
||||||
|
|
||||||
#ifndef SDL_MALLOC
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
|
||||||
#define SDL_MALLOC __attribute__((malloc))
|
|
||||||
/** FIXME
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#define SDL_MALLOC __declspec(allocator) __desclspec(restrict)
|
|
||||||
**/
|
|
||||||
#else
|
|
||||||
#define SDL_MALLOC
|
|
||||||
#endif
|
|
||||||
#endif /* SDL_MALLOC not defined */
|
|
||||||
|
|
||||||
#ifndef SDL_ALLOC_SIZE
|
|
||||||
#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
|
||||||
#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#define SDL_ALLOC_SIZE(p)
|
|
||||||
#else
|
|
||||||
#define SDL_ALLOC_SIZE(p)
|
|
||||||
#endif
|
|
||||||
#endif /* SDL_ALLOC_SIZE not defined */
|
|
||||||
|
|
||||||
#ifndef SDL_ALLOC_SIZE2
|
|
||||||
#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
|
|
||||||
#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#define SDL_ALLOC_SIZE2(p1, p2)
|
|
||||||
#else
|
|
||||||
#define SDL_ALLOC_SIZE2(p1, p2)
|
|
||||||
#endif
|
|
||||||
#endif /* SDL_ALLOC_SIZE2 not defined */
|
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryBits
|
|
||||||
*
|
|
||||||
* Functions for fiddling with bits and bitmasks.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_bits_h_
|
|
||||||
#define SDL_bits_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__WATCOMC__) && defined(__386__)
|
|
||||||
extern __inline int _SDL_bsr_watcom(Uint32);
|
|
||||||
#pragma aux _SDL_bsr_watcom = \
|
|
||||||
"bsr eax, eax" \
|
|
||||||
parm [eax] nomemory \
|
|
||||||
value [eax] \
|
|
||||||
modify exact [eax] nomemory;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the index of the most significant (set) bit in a 32-bit number.
|
|
||||||
*
|
|
||||||
* Result is undefined when called with 0. This operation can also be stated
|
|
||||||
* as "count leading zeroes" and "log base 2".
|
|
||||||
*
|
|
||||||
* Note that this is a forced-inline function in a header, and not a public
|
|
||||||
* API function available in the SDL library (which is to say, the code is
|
|
||||||
* embedded in the calling program and the linker and dynamic loader will not
|
|
||||||
* be able to find this function inside SDL itself).
|
|
||||||
*
|
|
||||||
* \param x the 32-bit value to examine.
|
|
||||||
* \returns the index of the most significant bit, or -1 if the value is 0.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x)
|
|
||||||
{
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
|
||||||
/* Count Leading Zeroes builtin in GCC.
|
|
||||||
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
|
|
||||||
*/
|
|
||||||
if (x == 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 31 - __builtin_clz(x);
|
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
|
||||||
if (x == 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return _SDL_bsr_watcom(x);
|
|
||||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
|
||||||
unsigned long index;
|
|
||||||
if (_BitScanReverse(&index, x)) {
|
|
||||||
return (int)index;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
#else
|
|
||||||
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
|
|
||||||
* <seander@cs.stanford.edu>, released in the public domain.
|
|
||||||
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
|
|
||||||
*/
|
|
||||||
const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
|
|
||||||
const int S[] = {1, 2, 4, 8, 16};
|
|
||||||
|
|
||||||
int msbIndex = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (x == 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 4; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (x & b[i])
|
|
||||||
{
|
|
||||||
x >>= S[i];
|
|
||||||
msbIndex |= S[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return msbIndex;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if a unsigned 32-bit value has exactly one bit set.
|
|
||||||
*
|
|
||||||
* If there are no bits set (`x` is zero), or more than one bit set, this
|
|
||||||
* returns false. If any one bit is exclusively set, this returns true.
|
|
||||||
*
|
|
||||||
* Note that this is a forced-inline function in a header, and not a public
|
|
||||||
* API function available in the SDL library (which is to say, the code is
|
|
||||||
* embedded in the calling program and the linker and dynamic loader will not
|
|
||||||
* be able to find this function inside SDL itself).
|
|
||||||
*
|
|
||||||
* \param x the 32-bit value to examine.
|
|
||||||
* \returns true if exactly one bit is set in `x`, false otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
SDL_FORCE_INLINE bool SDL_HasExactlyOneBitSet32(Uint32 x)
|
|
||||||
{
|
|
||||||
if (x && !(x & (x - 1))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_bits_h_ */
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryBlendmode
|
|
||||||
*
|
|
||||||
* Blend modes decide how two colors will mix together. There are both
|
|
||||||
* standard modes for basic needs and a means to create custom modes,
|
|
||||||
* dictating what sort of math to do on what color components.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_blendmode_h_
|
|
||||||
#define SDL_blendmode_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of blend modes used in drawing operations.
|
|
||||||
*
|
|
||||||
* These predefined blend modes are supported everywhere.
|
|
||||||
*
|
|
||||||
* Additional values may be obtained from SDL_ComposeCustomBlendMode.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ComposeCustomBlendMode
|
|
||||||
*/
|
|
||||||
typedef Uint32 SDL_BlendMode;
|
|
||||||
|
|
||||||
#define SDL_BLENDMODE_NONE 0x00000000u /**< no blending: dstRGBA = srcRGBA */
|
|
||||||
#define SDL_BLENDMODE_BLEND 0x00000001u /**< alpha blending: dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)), dstA = srcA + (dstA * (1-srcA)) */
|
|
||||||
#define SDL_BLENDMODE_BLEND_PREMULTIPLIED 0x00000010u /**< pre-multiplied alpha blending: dstRGBA = srcRGBA + (dstRGBA * (1-srcA)) */
|
|
||||||
#define SDL_BLENDMODE_ADD 0x00000002u /**< additive blending: dstRGB = (srcRGB * srcA) + dstRGB, dstA = dstA */
|
|
||||||
#define SDL_BLENDMODE_ADD_PREMULTIPLIED 0x00000020u /**< pre-multiplied additive blending: dstRGB = srcRGB + dstRGB, dstA = dstA */
|
|
||||||
#define SDL_BLENDMODE_MOD 0x00000004u /**< color modulate: dstRGB = srcRGB * dstRGB, dstA = dstA */
|
|
||||||
#define SDL_BLENDMODE_MUL 0x00000008u /**< color multiply: dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)), dstA = dstA */
|
|
||||||
#define SDL_BLENDMODE_INVALID 0x7FFFFFFFu
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The blend operation used when combining source and destination pixel
|
|
||||||
* components.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef enum SDL_BlendOperation
|
|
||||||
{
|
|
||||||
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
|
|
||||||
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan */
|
|
||||||
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan */
|
|
||||||
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan */
|
|
||||||
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan */
|
|
||||||
} SDL_BlendOperation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The normalized factor used to multiply pixel components.
|
|
||||||
*
|
|
||||||
* The blend factors are multiplied with the pixels from a drawing operation
|
|
||||||
* (src) and the pixels from the render target (dst) before the blend
|
|
||||||
* operation. The comma-separated factors listed above are always applied in
|
|
||||||
* the component order red, green, blue, and alpha.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef enum SDL_BlendFactor
|
|
||||||
{
|
|
||||||
SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
|
|
||||||
SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
|
|
||||||
SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
|
|
||||||
SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
|
|
||||||
SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
|
|
||||||
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
|
|
||||||
SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
|
|
||||||
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
|
|
||||||
SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
|
|
||||||
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
|
|
||||||
} SDL_BlendFactor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compose a custom blend mode for renderers.
|
|
||||||
*
|
|
||||||
* The functions SDL_SetRenderDrawBlendMode and SDL_SetTextureBlendMode accept
|
|
||||||
* the SDL_BlendMode returned by this function if the renderer supports it.
|
|
||||||
*
|
|
||||||
* A blend mode controls how the pixels from a drawing operation (source) get
|
|
||||||
* combined with the pixels from the render target (destination). First, the
|
|
||||||
* components of the source and destination pixels get multiplied with their
|
|
||||||
* blend factors. Then, the blend operation takes the two products and
|
|
||||||
* calculates the result that will get stored in the render target.
|
|
||||||
*
|
|
||||||
* Expressed in pseudocode, it would look like this:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* dstRGB = colorOperation(srcRGB * srcColorFactor, dstRGB * dstColorFactor);
|
|
||||||
* dstA = alphaOperation(srcA * srcAlphaFactor, dstA * dstAlphaFactor);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Where the functions `colorOperation(src, dst)` and `alphaOperation(src,
|
|
||||||
* dst)` can return one of the following:
|
|
||||||
*
|
|
||||||
* - `src + dst`
|
|
||||||
* - `src - dst`
|
|
||||||
* - `dst - src`
|
|
||||||
* - `min(src, dst)`
|
|
||||||
* - `max(src, dst)`
|
|
||||||
*
|
|
||||||
* The red, green, and blue components are always multiplied with the first,
|
|
||||||
* second, and third components of the SDL_BlendFactor, respectively. The
|
|
||||||
* fourth component is not used.
|
|
||||||
*
|
|
||||||
* The alpha component is always multiplied with the fourth component of the
|
|
||||||
* SDL_BlendFactor. The other components are not used in the alpha
|
|
||||||
* calculation.
|
|
||||||
*
|
|
||||||
* Support for these blend modes varies for each renderer. To check if a
|
|
||||||
* specific SDL_BlendMode is supported, create a renderer and pass it to
|
|
||||||
* either SDL_SetRenderDrawBlendMode or SDL_SetTextureBlendMode. They will
|
|
||||||
* return with an error if the blend mode is not supported.
|
|
||||||
*
|
|
||||||
* This list describes the support of custom blend modes for each renderer.
|
|
||||||
* All renderers support the four blend modes listed in the SDL_BlendMode
|
|
||||||
* enumeration.
|
|
||||||
*
|
|
||||||
* - **direct3d**: Supports all operations with all factors. However, some
|
|
||||||
* factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and
|
|
||||||
* `SDL_BLENDOPERATION_MAXIMUM`.
|
|
||||||
* - **direct3d11**: Same as Direct3D 9.
|
|
||||||
* - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
|
|
||||||
* factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly here.
|
|
||||||
* - **opengles2**: Supports the `SDL_BLENDOPERATION_ADD`,
|
|
||||||
* `SDL_BLENDOPERATION_SUBTRACT`, `SDL_BLENDOPERATION_REV_SUBTRACT`
|
|
||||||
* operations with all factors.
|
|
||||||
* - **psp**: No custom blend mode support.
|
|
||||||
* - **software**: No custom blend mode support.
|
|
||||||
*
|
|
||||||
* Some renderers do not provide an alpha component for the default render
|
|
||||||
* target. The `SDL_BLENDFACTOR_DST_ALPHA` and
|
|
||||||
* `SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA` factors do not have an effect in this
|
|
||||||
* case.
|
|
||||||
*
|
|
||||||
* \param srcColorFactor the SDL_BlendFactor applied to the red, green, and
|
|
||||||
* blue components of the source pixels.
|
|
||||||
* \param dstColorFactor the SDL_BlendFactor applied to the red, green, and
|
|
||||||
* blue components of the destination pixels.
|
|
||||||
* \param colorOperation the SDL_BlendOperation used to combine the red,
|
|
||||||
* green, and blue components of the source and
|
|
||||||
* destination pixels.
|
|
||||||
* \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of
|
|
||||||
* the source pixels.
|
|
||||||
* \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of
|
|
||||||
* the destination pixels.
|
|
||||||
* \param alphaOperation the SDL_BlendOperation used to combine the alpha
|
|
||||||
* component of the source and destination pixels.
|
|
||||||
* \returns an SDL_BlendMode that represents the chosen factors and
|
|
||||||
* operations.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetRenderDrawBlendMode
|
|
||||||
* \sa SDL_GetRenderDrawBlendMode
|
|
||||||
* \sa SDL_SetTextureBlendMode
|
|
||||||
* \sa SDL_GetTextureBlendMode
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
|
|
||||||
SDL_BlendFactor dstColorFactor,
|
|
||||||
SDL_BlendOperation colorOperation,
|
|
||||||
SDL_BlendFactor srcAlphaFactor,
|
|
||||||
SDL_BlendFactor dstAlphaFactor,
|
|
||||||
SDL_BlendOperation alphaOperation);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_blendmode_h_ */
|
|
||||||
@@ -1,519 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryCamera
|
|
||||||
*
|
|
||||||
* Video capture for the SDL library.
|
|
||||||
*
|
|
||||||
* This API lets apps read input from video sources, like webcams. Camera
|
|
||||||
* devices can be enumerated, queried, and opened. Once opened, it will
|
|
||||||
* provide SDL_Surface objects as new frames of video come in. These surfaces
|
|
||||||
* can be uploaded to an SDL_Texture or processed as pixels in memory.
|
|
||||||
*
|
|
||||||
* Several platforms will alert the user if an app tries to access a camera,
|
|
||||||
* and some will present a UI asking the user if your application should be
|
|
||||||
* allowed to obtain images at all, which they can deny. A successfully opened
|
|
||||||
* camera will not provide images until permission is granted. Applications,
|
|
||||||
* after opening a camera device, can see if they were granted access by
|
|
||||||
* either polling with the SDL_GetCameraPermissionState() function, or waiting
|
|
||||||
* for an SDL_EVENT_CAMERA_DEVICE_APPROVED or SDL_EVENT_CAMERA_DEVICE_DENIED
|
|
||||||
* event. Platforms that don't have any user approval process will report
|
|
||||||
* approval immediately.
|
|
||||||
*
|
|
||||||
* Note that SDL cameras only provide video as individual frames; they will
|
|
||||||
* not provide full-motion video encoded in a movie file format, although an
|
|
||||||
* app is free to encode the acquired frames into any format it likes. It also
|
|
||||||
* does not provide audio from the camera hardware through this API; not only
|
|
||||||
* do many webcams not have microphones at all, many people--from streamers to
|
|
||||||
* people on Zoom calls--will want to use a separate microphone regardless of
|
|
||||||
* the camera. In any case, recorded audio will be available through SDL's
|
|
||||||
* audio API no matter what hardware provides the microphone.
|
|
||||||
*
|
|
||||||
* ## Camera gotchas
|
|
||||||
*
|
|
||||||
* Consumer-level camera hardware tends to take a little while to warm up,
|
|
||||||
* once the device has been opened. Generally most camera apps have some sort
|
|
||||||
* of UI to take a picture (a button to snap a pic while a preview is showing,
|
|
||||||
* some sort of multi-second countdown for the user to pose, like a photo
|
|
||||||
* booth), which puts control in the users' hands, or they are intended to
|
|
||||||
* stay on for long times (Pokemon Go, etc).
|
|
||||||
*
|
|
||||||
* It's not uncommon that a newly-opened camera will provide a couple of
|
|
||||||
* completely black frames, maybe followed by some under-exposed images. If
|
|
||||||
* taking a single frame automatically, or recording video from a camera's
|
|
||||||
* input without the user initiating it from a preview, it could be wise to
|
|
||||||
* drop the first several frames (if not the first several _seconds_ worth of
|
|
||||||
* frames!) before using images from a camera.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_camera_h_
|
|
||||||
#define SDL_camera_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
#include <SDL3/SDL_pixels.h>
|
|
||||||
#include <SDL3/SDL_properties.h>
|
|
||||||
#include <SDL3/SDL_surface.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a unique ID for a camera device for the time it is connected to the
|
|
||||||
* system, and is never reused for the lifetime of the application.
|
|
||||||
*
|
|
||||||
* If the device is disconnected and reconnected, it will get a new ID.
|
|
||||||
*
|
|
||||||
* The value 0 is an invalid ID.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetCameras
|
|
||||||
*/
|
|
||||||
typedef Uint32 SDL_CameraID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The opaque structure used to identify an opened SDL camera.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_Camera SDL_Camera;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The details of an output format for a camera device.
|
|
||||||
*
|
|
||||||
* Cameras often support multiple formats; each one will be encapsulated in
|
|
||||||
* this struct.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetCameraSupportedFormats
|
|
||||||
* \sa SDL_GetCameraFormat
|
|
||||||
*/
|
|
||||||
typedef struct SDL_CameraSpec
|
|
||||||
{
|
|
||||||
SDL_PixelFormat format; /**< Frame format */
|
|
||||||
SDL_Colorspace colorspace; /**< Frame colorspace */
|
|
||||||
int width; /**< Frame width */
|
|
||||||
int height; /**< Frame height */
|
|
||||||
int framerate_numerator; /**< Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds) */
|
|
||||||
int framerate_denominator; /**< Frame rate demoninator ((num / denom) == FPS, (denom / num) == duration in seconds) */
|
|
||||||
} SDL_CameraSpec;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The position of camera in relation to system device.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetCameraPosition
|
|
||||||
*/
|
|
||||||
typedef enum SDL_CameraPosition
|
|
||||||
{
|
|
||||||
SDL_CAMERA_POSITION_UNKNOWN,
|
|
||||||
SDL_CAMERA_POSITION_FRONT_FACING,
|
|
||||||
SDL_CAMERA_POSITION_BACK_FACING
|
|
||||||
} SDL_CameraPosition;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this function to get the number of built-in camera drivers.
|
|
||||||
*
|
|
||||||
* This function returns a hardcoded number. This never returns a negative
|
|
||||||
* value; if there are no drivers compiled into this build of SDL, this
|
|
||||||
* function returns zero. The presence of a driver in this list does not mean
|
|
||||||
* it will function, it just means SDL is capable of interacting with that
|
|
||||||
* interface. For example, a build of SDL might have v4l2 support, but if
|
|
||||||
* there's no kernel support available, SDL's v4l2 driver would fail if used.
|
|
||||||
*
|
|
||||||
* By default, SDL tries all drivers, in its preferred order, until one is
|
|
||||||
* found to be usable.
|
|
||||||
*
|
|
||||||
* \returns the number of built-in camera drivers.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetCameraDriver
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this function to get the name of a built in camera driver.
|
|
||||||
*
|
|
||||||
* The list of camera drivers is given in the order that they are normally
|
|
||||||
* initialized by default; the drivers that seem more reasonable to choose
|
|
||||||
* first (as far as the SDL developers believe) are earlier in the list.
|
|
||||||
*
|
|
||||||
* The names of drivers are all simple, low-ASCII identifiers, like "v4l2",
|
|
||||||
* "coremedia" or "android". These never have Unicode characters, and are not
|
|
||||||
* meant to be proper names.
|
|
||||||
*
|
|
||||||
* \param index the index of the camera driver; the value ranges from 0 to
|
|
||||||
* SDL_GetNumCameraDrivers() - 1.
|
|
||||||
* \returns the name of the camera driver at the requested index, or NULL if
|
|
||||||
* an invalid index was specified.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetNumCameraDrivers
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of the current camera driver.
|
|
||||||
*
|
|
||||||
* The names of drivers are all simple, low-ASCII identifiers, like "v4l2",
|
|
||||||
* "coremedia" or "android". These never have Unicode characters, and are not
|
|
||||||
* meant to be proper names.
|
|
||||||
*
|
|
||||||
* \returns the name of the current camera driver or NULL if no driver has
|
|
||||||
* been initialized.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of currently connected camera devices.
|
|
||||||
*
|
|
||||||
* \param count a pointer filled in with the number of cameras returned, may
|
|
||||||
* be NULL.
|
|
||||||
* \returns a 0 terminated array of camera instance IDs or NULL on failure;
|
|
||||||
* call SDL_GetError() for more information. This should be freed
|
|
||||||
* with SDL_free() when it is no longer needed.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_OpenCamera
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the list of native formats/sizes a camera supports.
|
|
||||||
*
|
|
||||||
* This returns a list of all formats and frame sizes that a specific camera
|
|
||||||
* can offer. This is useful if your app can accept a variety of image formats
|
|
||||||
* and sizes and so want to find the optimal spec that doesn't require
|
|
||||||
* conversion.
|
|
||||||
*
|
|
||||||
* This function isn't strictly required; if you call SDL_OpenCamera with a
|
|
||||||
* NULL spec, SDL will choose a native format for you, and if you instead
|
|
||||||
* specify a desired format, it will transparently convert to the requested
|
|
||||||
* format on your behalf.
|
|
||||||
*
|
|
||||||
* If `count` is not NULL, it will be filled with the number of elements in
|
|
||||||
* the returned array.
|
|
||||||
*
|
|
||||||
* Note that it's legal for a camera to supply an empty list. This is what
|
|
||||||
* will happen on Emscripten builds, since that platform won't tell _anything_
|
|
||||||
* about available cameras until you've opened one, and won't even tell if
|
|
||||||
* there _is_ a camera until the user has given you permission to check
|
|
||||||
* through a scary warning popup.
|
|
||||||
*
|
|
||||||
* \param instance_id the camera device instance ID.
|
|
||||||
* \param count a pointer filled in with the number of elements in the list,
|
|
||||||
* may be NULL.
|
|
||||||
* \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on
|
|
||||||
* failure; call SDL_GetError() for more information. This is a
|
|
||||||
* single allocation that should be freed with SDL_free() when it is
|
|
||||||
* no longer needed.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetCameras
|
|
||||||
* \sa SDL_OpenCamera
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID instance_id, int *count);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the human-readable device name for a camera.
|
|
||||||
*
|
|
||||||
* \param instance_id the camera device instance ID.
|
|
||||||
* \returns a human-readable device name or NULL on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetCameras
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance_id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the position of the camera in relation to the system.
|
|
||||||
*
|
|
||||||
* Most platforms will report UNKNOWN, but mobile devices, like phones, can
|
|
||||||
* often make a distinction between cameras on the front of the device (that
|
|
||||||
* points towards the user, for taking "selfies") and cameras on the back (for
|
|
||||||
* filming in the direction the user is facing).
|
|
||||||
*
|
|
||||||
* \param instance_id the camera device instance ID.
|
|
||||||
* \returns the position of the camera on the system hardware.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetCameras
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_CameraPosition SDLCALL SDL_GetCameraPosition(SDL_CameraID instance_id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open a video recording device (a "camera").
|
|
||||||
*
|
|
||||||
* You can open the device with any reasonable spec, and if the hardware can't
|
|
||||||
* directly support it, it will convert data seamlessly to the requested
|
|
||||||
* format. This might incur overhead, including scaling of image data.
|
|
||||||
*
|
|
||||||
* If you would rather accept whatever format the device offers, you can pass
|
|
||||||
* a NULL spec here and it will choose one for you (and you can use
|
|
||||||
* SDL_Surface's conversion/scaling functions directly if necessary).
|
|
||||||
*
|
|
||||||
* You can call SDL_GetCameraFormat() to get the actual data format if passing
|
|
||||||
* a NULL spec here. You can see the exact specs a device can support without
|
|
||||||
* conversion with SDL_GetCameraSupportedFormats().
|
|
||||||
*
|
|
||||||
* SDL will not attempt to emulate framerate; it will try to set the hardware
|
|
||||||
* to the rate closest to the requested speed, but it won't attempt to limit
|
|
||||||
* or duplicate frames artificially; call SDL_GetCameraFormat() to see the
|
|
||||||
* actual framerate of the opened the device, and check your timestamps if
|
|
||||||
* this is crucial to your app!
|
|
||||||
*
|
|
||||||
* Note that the camera is not usable until the user approves its use! On some
|
|
||||||
* platforms, the operating system will prompt the user to permit access to
|
|
||||||
* the camera, and they can choose Yes or No at that point. Until they do, the
|
|
||||||
* camera will not be usable. The app should either wait for an
|
|
||||||
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event,
|
|
||||||
* or poll SDL_GetCameraPermissionState() occasionally until it returns
|
|
||||||
* non-zero. On platforms that don't require explicit user approval (and
|
|
||||||
* perhaps in places where the user previously permitted access), the approval
|
|
||||||
* event might come immediately, but it might come seconds, minutes, or hours
|
|
||||||
* later!
|
|
||||||
*
|
|
||||||
* \param instance_id the camera device instance ID.
|
|
||||||
* \param spec the desired format for data the device will provide. Can be
|
|
||||||
* NULL.
|
|
||||||
* \returns an SDL_Camera object or NULL on failure; call SDL_GetError() for
|
|
||||||
* more information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetCameras
|
|
||||||
* \sa SDL_GetCameraFormat
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Camera * SDLCALL SDL_OpenCamera(SDL_CameraID instance_id, const SDL_CameraSpec *spec);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Query if camera access has been approved by the user.
|
|
||||||
*
|
|
||||||
* Cameras will not function between when the device is opened by the app and
|
|
||||||
* when the user permits access to the hardware. On some platforms, this
|
|
||||||
* presents as a popup dialog where the user has to explicitly approve access;
|
|
||||||
* on others the approval might be implicit and not alert the user at all.
|
|
||||||
*
|
|
||||||
* This function can be used to check the status of that approval. It will
|
|
||||||
* return 0 if still waiting for user response, 1 if the camera is approved
|
|
||||||
* for use, and -1 if the user denied access.
|
|
||||||
*
|
|
||||||
* Instead of polling with this function, you can wait for a
|
|
||||||
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event
|
|
||||||
* in the standard SDL event loop, which is guaranteed to be sent once when
|
|
||||||
* permission to use the camera is decided.
|
|
||||||
*
|
|
||||||
* If a camera is declined, there's nothing to be done but call
|
|
||||||
* SDL_CloseCamera() to dispose of it.
|
|
||||||
*
|
|
||||||
* \param camera the opened camera device to query.
|
|
||||||
* \returns -1 if user denied access to the camera, 1 if user approved access,
|
|
||||||
* 0 if no decision has been made yet.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_OpenCamera
|
|
||||||
* \sa SDL_CloseCamera
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetCameraPermissionState(SDL_Camera *camera);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the instance ID of an opened camera.
|
|
||||||
*
|
|
||||||
* \param camera an SDL_Camera to query.
|
|
||||||
* \returns the instance ID of the specified camera on success or 0 on
|
|
||||||
* failure; call SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_OpenCamera
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_CameraID SDLCALL SDL_GetCameraID(SDL_Camera *camera);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the properties associated with an opened camera.
|
|
||||||
*
|
|
||||||
* \param camera the SDL_Camera obtained from SDL_OpenCamera().
|
|
||||||
* \returns a valid property ID on success or 0 on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera *camera);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the spec that a camera is using when generating images.
|
|
||||||
*
|
|
||||||
* Note that this might not be the native format of the hardware, as SDL might
|
|
||||||
* be converting to this format behind the scenes.
|
|
||||||
*
|
|
||||||
* If the system is waiting for the user to approve access to the camera, as
|
|
||||||
* some platforms require, this will return false, but this isn't necessarily
|
|
||||||
* a fatal error; you should either wait for an
|
|
||||||
* SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event,
|
|
||||||
* or poll SDL_GetCameraPermissionState() occasionally until it returns
|
|
||||||
* non-zero.
|
|
||||||
*
|
|
||||||
* \param camera opened camera device.
|
|
||||||
* \param spec the SDL_CameraSpec to be initialized by this function.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_OpenCamera
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Acquire a frame.
|
|
||||||
*
|
|
||||||
* The frame is a memory pointer to the image data, whose size and format are
|
|
||||||
* given by the spec requested when opening the device.
|
|
||||||
*
|
|
||||||
* This is a non blocking API. If there is a frame available, a non-NULL
|
|
||||||
* surface is returned, and timestampNS will be filled with a non-zero value.
|
|
||||||
*
|
|
||||||
* Note that an error case can also return NULL, but a NULL by itself is
|
|
||||||
* normal and just signifies that a new frame is not yet available. Note that
|
|
||||||
* even if a camera device fails outright (a USB camera is unplugged while in
|
|
||||||
* use, etc), SDL will send an event separately to notify the app, but
|
|
||||||
* continue to provide blank frames at ongoing intervals until
|
|
||||||
* SDL_CloseCamera() is called, so real failure here is almost always an out
|
|
||||||
* of memory condition.
|
|
||||||
*
|
|
||||||
* After use, the frame should be released with SDL_ReleaseCameraFrame(). If
|
|
||||||
* you don't do this, the system may stop providing more video!
|
|
||||||
*
|
|
||||||
* Do not call SDL_DestroySurface() on the returned surface! It must be given
|
|
||||||
* back to the camera subsystem with SDL_ReleaseCameraFrame!
|
|
||||||
*
|
|
||||||
* If the system is waiting for the user to approve access to the camera, as
|
|
||||||
* some platforms require, this will return NULL (no frames available); you
|
|
||||||
* should either wait for an SDL_EVENT_CAMERA_DEVICE_APPROVED (or
|
|
||||||
* SDL_EVENT_CAMERA_DEVICE_DENIED) event, or poll
|
|
||||||
* SDL_GetCameraPermissionState() occasionally until it returns non-zero.
|
|
||||||
*
|
|
||||||
* \param camera opened camera device.
|
|
||||||
* \param timestampNS a pointer filled in with the frame's timestamp, or 0 on
|
|
||||||
* error. Can be NULL.
|
|
||||||
* \returns a new frame of video on success, NULL if none is currently
|
|
||||||
* available.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ReleaseCameraFrame
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_AcquireCameraFrame(SDL_Camera *camera, Uint64 *timestampNS);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Release a frame of video acquired from a camera.
|
|
||||||
*
|
|
||||||
* Let the back-end re-use the internal buffer for camera.
|
|
||||||
*
|
|
||||||
* This function _must_ be called only on surface objects returned by
|
|
||||||
* SDL_AcquireCameraFrame(). This function should be called as quickly as
|
|
||||||
* possible after acquisition, as SDL keeps a small FIFO queue of surfaces for
|
|
||||||
* video frames; if surfaces aren't released in a timely manner, SDL may drop
|
|
||||||
* upcoming video frames from the camera.
|
|
||||||
*
|
|
||||||
* If the app needs to keep the surface for a significant time, they should
|
|
||||||
* make a copy of it and release the original.
|
|
||||||
*
|
|
||||||
* The app should not use the surface again after calling this function;
|
|
||||||
* assume the surface is freed and the pointer is invalid.
|
|
||||||
*
|
|
||||||
* \param camera opened camera device.
|
|
||||||
* \param frame the video frame surface to release.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_AcquireCameraFrame
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_ReleaseCameraFrame(SDL_Camera *camera, SDL_Surface *frame);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this function to shut down camera processing and close the camera
|
|
||||||
* device.
|
|
||||||
*
|
|
||||||
* \param camera opened camera device.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread, but no
|
|
||||||
* thread may reference `device` once this function is called.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_OpenCamera
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_CloseCamera(SDL_Camera *camera);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_camera_h_ */
|
|
||||||
@@ -1,331 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryClipboard
|
|
||||||
*
|
|
||||||
* SDL provides access to the system clipboard, both for reading information
|
|
||||||
* from other processes and publishing information of its own.
|
|
||||||
*
|
|
||||||
* This is not just text! SDL apps can access and publish data by mimetype.
|
|
||||||
*
|
|
||||||
* ## Basic use (text)
|
|
||||||
*
|
|
||||||
* Obtaining and publishing simple text to the system clipboard is as easy as
|
|
||||||
* calling SDL_GetClipboardText() and SDL_SetClipboardText(), respectively.
|
|
||||||
* These deal with C strings in UTF-8 encoding. Data transmission and encoding
|
|
||||||
* conversion is completely managed by SDL.
|
|
||||||
*
|
|
||||||
* ## Clipboard callbacks (data other than text)
|
|
||||||
*
|
|
||||||
* Things get more complicated when the clipboard contains something other
|
|
||||||
* than text. Not only can the system clipboard contain data of any type, in
|
|
||||||
* some cases it can contain the same data in different formats! For example,
|
|
||||||
* an image painting app might let the user copy a graphic to the clipboard,
|
|
||||||
* and offers it in .BMP, .JPG, or .PNG format for other apps to consume.
|
|
||||||
*
|
|
||||||
* Obtaining clipboard data ("pasting") like this is a matter of calling
|
|
||||||
* SDL_GetClipboardData() and telling it the mimetype of the data you want.
|
|
||||||
* But how does one know if that format is available? SDL_HasClipboardData()
|
|
||||||
* can report if a specific mimetype is offered, and
|
|
||||||
* SDL_GetClipboardMimeTypes() can provide the entire list of mimetypes
|
|
||||||
* available, so the app can decide what to do with the data and what formats
|
|
||||||
* it can support.
|
|
||||||
*
|
|
||||||
* Setting the clipboard ("copying") to arbitrary data is done with
|
|
||||||
* SDL_SetClipboardData. The app does not provide the data in this call, but
|
|
||||||
* rather the mimetypes it is willing to provide and a callback function.
|
|
||||||
* During the callback, the app will generate the data. This allows massive
|
|
||||||
* data sets to be provided to the clipboard, without any data being copied
|
|
||||||
* before it is explicitly requested. More specifically, it allows an app to
|
|
||||||
* offer data in multiple formats without providing a copy of all of them
|
|
||||||
* upfront. If the app has an image that it could provide in PNG or JPG
|
|
||||||
* format, it doesn't have to encode it to either of those unless and until
|
|
||||||
* something tries to paste it.
|
|
||||||
*
|
|
||||||
* ## Primary Selection
|
|
||||||
*
|
|
||||||
* The X11 and Wayland video targets have a concept of the "primary selection"
|
|
||||||
* in addition to the usual clipboard. This is generally highlighted (but not
|
|
||||||
* explicitly copied) text from various apps. SDL offers APIs for this through
|
|
||||||
* SDL_GetPrimarySelectionText() and SDL_SetPrimarySelectionText(). SDL offers
|
|
||||||
* these APIs on platforms without this concept, too, but only so far that it
|
|
||||||
* will keep a copy of a string that the app sets for later retrieval; the
|
|
||||||
* operating system will not ever attempt to change the string externally if
|
|
||||||
* it doesn't support a primary selection.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_clipboard_h_
|
|
||||||
#define SDL_clipboard_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put UTF-8 text into the clipboard.
|
|
||||||
*
|
|
||||||
* \param text the text to store in the clipboard.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetClipboardText
|
|
||||||
* \sa SDL_HasClipboardText
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardText(const char *text);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get UTF-8 text from the clipboard.
|
|
||||||
*
|
|
||||||
* This function returns an empty string if there is not enough memory left
|
|
||||||
* for a copy of the clipboard's content.
|
|
||||||
*
|
|
||||||
* \returns the clipboard text on success or an empty string on failure; call
|
|
||||||
* SDL_GetError() for more information. This should be freed with
|
|
||||||
* SDL_free() when it is no longer needed.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasClipboardText
|
|
||||||
* \sa SDL_SetClipboardText
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Query whether the clipboard exists and contains a non-empty text string.
|
|
||||||
*
|
|
||||||
* \returns true if the clipboard has text, or false if it does not.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetClipboardText
|
|
||||||
* \sa SDL_SetClipboardText
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardText(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put UTF-8 text into the primary selection.
|
|
||||||
*
|
|
||||||
* \param text the text to store in the primary selection.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetPrimarySelectionText
|
|
||||||
* \sa SDL_HasPrimarySelectionText
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetPrimarySelectionText(const char *text);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get UTF-8 text from the primary selection.
|
|
||||||
*
|
|
||||||
* This function returns an empty string if there is not enough memory left
|
|
||||||
* for a copy of the primary selection's content.
|
|
||||||
*
|
|
||||||
* \returns the primary selection text on success or an empty string on
|
|
||||||
* failure; call SDL_GetError() for more information. This should be
|
|
||||||
* freed with SDL_free() when it is no longer needed.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasPrimarySelectionText
|
|
||||||
* \sa SDL_SetPrimarySelectionText
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Query whether the primary selection exists and contains a non-empty text
|
|
||||||
* string.
|
|
||||||
*
|
|
||||||
* \returns true if the primary selection has text, or false if it does not.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetPrimarySelectionText
|
|
||||||
* \sa SDL_SetPrimarySelectionText
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasPrimarySelectionText(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback function that will be called when data for the specified mime-type
|
|
||||||
* is requested by the OS.
|
|
||||||
*
|
|
||||||
* The callback function is called with NULL as the mime_type when the
|
|
||||||
* clipboard is cleared or new data is set. The clipboard is automatically
|
|
||||||
* cleared in SDL_Quit().
|
|
||||||
*
|
|
||||||
* \param userdata a pointer to the provided user data.
|
|
||||||
* \param mime_type the requested mime-type.
|
|
||||||
* \param size a pointer filled in with the length of the returned data.
|
|
||||||
* \returns a pointer to the data for the provided mime-type. Returning NULL
|
|
||||||
* or setting the length to 0 will cause no data to be sent to the
|
|
||||||
* "receiver". It is up to the receiver to handle this. Essentially
|
|
||||||
* returning no data is more or less undefined behavior and may cause
|
|
||||||
* breakage in receiving applications. The returned data will not be
|
|
||||||
* freed, so it needs to be retained and dealt with internally.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetClipboardData
|
|
||||||
*/
|
|
||||||
typedef const void *(SDLCALL *SDL_ClipboardDataCallback)(void *userdata, const char *mime_type, size_t *size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback function that will be called when the clipboard is cleared, or when new
|
|
||||||
* data is set.
|
|
||||||
*
|
|
||||||
* \param userdata a pointer to the provided user data.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetClipboardData
|
|
||||||
*/
|
|
||||||
typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Offer clipboard data to the OS.
|
|
||||||
*
|
|
||||||
* Tell the operating system that the application is offering clipboard data
|
|
||||||
* for each of the provided mime-types. Once another application requests the
|
|
||||||
* data the callback function will be called, allowing it to generate and
|
|
||||||
* respond with the data for the requested mime-type.
|
|
||||||
*
|
|
||||||
* The size of text data does not include any terminator, and the text does
|
|
||||||
* not need to be null-terminated (e.g., you can directly copy a portion of a
|
|
||||||
* document).
|
|
||||||
*
|
|
||||||
* \param callback a function pointer to the function that provides the
|
|
||||||
* clipboard data.
|
|
||||||
* \param cleanup a function pointer to the function that cleans up the
|
|
||||||
* clipboard data.
|
|
||||||
* \param userdata an opaque pointer that will be forwarded to the callbacks.
|
|
||||||
* \param mime_types a list of mime-types that are being offered. SDL copies the given list.
|
|
||||||
* \param num_mime_types the number of mime-types in the mime_types list.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ClearClipboardData
|
|
||||||
* \sa SDL_GetClipboardData
|
|
||||||
* \sa SDL_HasClipboardData
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the clipboard data.
|
|
||||||
*
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetClipboardData
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_ClearClipboardData(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the data from the clipboard for a given mime type.
|
|
||||||
*
|
|
||||||
* The size of text data does not include the terminator, but the text is
|
|
||||||
* guaranteed to be null-terminated.
|
|
||||||
*
|
|
||||||
* \param mime_type the mime type to read from the clipboard.
|
|
||||||
* \param size a pointer filled in with the length of the returned data.
|
|
||||||
* \returns the retrieved data buffer or NULL on failure; call SDL_GetError()
|
|
||||||
* for more information. This should be freed with SDL_free() when it
|
|
||||||
* is no longer needed.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasClipboardData
|
|
||||||
* \sa SDL_SetClipboardData
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Query whether there is data in the clipboard for the provided mime type.
|
|
||||||
*
|
|
||||||
* \param mime_type the mime type to check for data.
|
|
||||||
* \returns true if data exists in the clipboard for the provided mime type,
|
|
||||||
* false if it does not.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetClipboardData
|
|
||||||
* \sa SDL_GetClipboardData
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardData(const char *mime_type);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the list of mime types available in the clipboard.
|
|
||||||
*
|
|
||||||
* \param num_mime_types a pointer filled with the number of mime types, may
|
|
||||||
* be NULL.
|
|
||||||
* \returns a null-terminated array of strings with mime types, or NULL on
|
|
||||||
* failure; call SDL_GetError() for more information. This should be
|
|
||||||
* freed with SDL_free() when it is no longer needed.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetClipboardData
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC char ** SDLCALL SDL_GetClipboardMimeTypes(size_t *num_mime_types);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_clipboard_h_ */
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file reverses the effects of SDL_begin_code.h and should be included
|
|
||||||
* after you finish any function and structure declarations in your headers.
|
|
||||||
*
|
|
||||||
* SDL's headers use this; applications generally should not include this
|
|
||||||
* header directly.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_begin_code_h
|
|
||||||
#error SDL_close_code.h included without matching SDL_begin_code.h
|
|
||||||
#endif
|
|
||||||
#undef SDL_begin_code_h
|
|
||||||
|
|
||||||
/* Reset structure packing at previous byte alignment */
|
|
||||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma nopackwarning
|
|
||||||
#endif
|
|
||||||
#pragma pack(pop)
|
|
||||||
#endif /* Compiler needs structure packing set */
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Header file containing SDL's license. */
|
|
||||||
@@ -1,353 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WIKI CATEGORY: CPUInfo */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryCPUInfo
|
|
||||||
*
|
|
||||||
* CPU feature detection for SDL.
|
|
||||||
*
|
|
||||||
* These functions are largely concerned with reporting if the system has
|
|
||||||
* access to various SIMD instruction sets, but also has other important info
|
|
||||||
* to share, such as system RAM size and number of logical CPU cores.
|
|
||||||
*
|
|
||||||
* CPU instruction set checks, like SDL_HasSSE() and SDL_HasNEON(), are
|
|
||||||
* available on all platforms, even if they don't make sense (an ARM processor
|
|
||||||
* will never have SSE and an x86 processor will never have NEON, for example,
|
|
||||||
* but these functions still exist and will simply return false in these
|
|
||||||
* cases).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_cpuinfo_h_
|
|
||||||
#define SDL_cpuinfo_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A guess for the cacheline size used for padding.
|
|
||||||
*
|
|
||||||
* Most x86 processors have a 64 byte cache line. The 64-bit PowerPC
|
|
||||||
* processors have a 128 byte cache line. We use the larger value to be
|
|
||||||
* generally safe.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_CACHELINE_SIZE 128
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the number of logical CPU cores available.
|
|
||||||
*
|
|
||||||
* \returns the total number of logical CPU cores. On CPUs that include
|
|
||||||
* technologies such as hyperthreading, the number of logical cores
|
|
||||||
* may be more than the number of physical cores.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetNumLogicalCPUCores(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine the L1 cache line size of the CPU.
|
|
||||||
*
|
|
||||||
* This is useful for determining multi-threaded structure padding or SIMD
|
|
||||||
* prefetch sizes.
|
|
||||||
*
|
|
||||||
* \returns the L1 cache line size of the CPU, in bytes.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has AltiVec features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using PowerPC instruction
|
|
||||||
* sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has AltiVec features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasAltiVec(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has MMX features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has MMX features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasMMX(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has SSE features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has SSE features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasSSE2
|
|
||||||
* \sa SDL_HasSSE3
|
|
||||||
* \sa SDL_HasSSE41
|
|
||||||
* \sa SDL_HasSSE42
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has SSE2 features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has SSE2 features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasSSE
|
|
||||||
* \sa SDL_HasSSE3
|
|
||||||
* \sa SDL_HasSSE41
|
|
||||||
* \sa SDL_HasSSE42
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE2(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has SSE3 features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has SSE3 features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasSSE
|
|
||||||
* \sa SDL_HasSSE2
|
|
||||||
* \sa SDL_HasSSE41
|
|
||||||
* \sa SDL_HasSSE42
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE3(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has SSE4.1 features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has SSE4.1 features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasSSE
|
|
||||||
* \sa SDL_HasSSE2
|
|
||||||
* \sa SDL_HasSSE3
|
|
||||||
* \sa SDL_HasSSE42
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE41(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has SSE4.2 features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has SSE4.2 features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasSSE
|
|
||||||
* \sa SDL_HasSSE2
|
|
||||||
* \sa SDL_HasSSE3
|
|
||||||
* \sa SDL_HasSSE41
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE42(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has AVX features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has AVX features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasAVX2
|
|
||||||
* \sa SDL_HasAVX512F
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has AVX2 features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has AVX2 features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasAVX
|
|
||||||
* \sa SDL_HasAVX512F
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX2(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has AVX-512F (foundation) features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using Intel instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has AVX-512F features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasAVX
|
|
||||||
* \sa SDL_HasAVX2
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX512F(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has ARM SIMD (ARMv6) features.
|
|
||||||
*
|
|
||||||
* This is different from ARM NEON, which is a different instruction set.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using ARM instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has ARM SIMD features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasNEON
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasARMSIMD(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has NEON (ARM SIMD) features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using ARM instruction sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has ARM NEON features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasNEON(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has LSX (LOONGARCH SIMD) features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using LOONGARCH instruction
|
|
||||||
* sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has LOONGARCH LSX features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasLSX(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the CPU has LASX (LOONGARCH SIMD) features.
|
|
||||||
*
|
|
||||||
* This always returns false on CPUs that aren't using LOONGARCH instruction
|
|
||||||
* sets.
|
|
||||||
*
|
|
||||||
* \returns true if the CPU has LOONGARCH LASX features or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasLASX(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the amount of RAM configured in the system.
|
|
||||||
*
|
|
||||||
* \returns the amount of RAM configured in the system in MiB.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Report the alignment this system needs for SIMD allocations.
|
|
||||||
*
|
|
||||||
* This will return the minimum number of bytes to which a pointer must be
|
|
||||||
* aligned to be compatible with SIMD instructions on the current machine. For
|
|
||||||
* example, if the machine supports SSE only, it will return 16, but if it
|
|
||||||
* supports AVX-512F, it'll return 64 (etc). This only reports values for
|
|
||||||
* instruction sets SDL knows about, so if your SDL build doesn't have
|
|
||||||
* SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
|
|
||||||
* not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
|
|
||||||
* Plan accordingly.
|
|
||||||
*
|
|
||||||
* \returns the alignment in bytes needed for available, known SIMD
|
|
||||||
* instructions.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_aligned_alloc
|
|
||||||
* \sa SDL_aligned_free
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC size_t SDLCALL SDL_GetSIMDAlignment(void);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_cpuinfo_h_ */
|
|
||||||
@@ -1,341 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryDialog
|
|
||||||
*
|
|
||||||
* File dialog support.
|
|
||||||
*
|
|
||||||
* SDL offers file dialogs, to let users select files with native GUI
|
|
||||||
* interfaces. There are "open" dialogs, "save" dialogs, and folder selection
|
|
||||||
* dialogs. The app can control some details, such as filtering to specific
|
|
||||||
* files, or whether multiple files can be selected by the user.
|
|
||||||
*
|
|
||||||
* Note that launching a file dialog is a non-blocking operation; control
|
|
||||||
* returns to the app immediately, and a callback is called later (possibly in
|
|
||||||
* another thread) when the user makes a choice.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_dialog_h_
|
|
||||||
#define SDL_dialog_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
#include <SDL3/SDL_properties.h>
|
|
||||||
#include <SDL3/SDL_video.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An entry for filters for file dialogs.
|
|
||||||
*
|
|
||||||
* `name` is a user-readable label for the filter (for example, "Office
|
|
||||||
* document").
|
|
||||||
*
|
|
||||||
* `pattern` is a semicolon-separated list of file extensions (for example,
|
|
||||||
* "doc;docx"). File extensions may only contain alphanumeric characters,
|
|
||||||
* hyphens, underscores and periods. Alternatively, the whole string can be a
|
|
||||||
* single asterisk ("*"), which serves as an "All files" filter.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_DialogFileCallback
|
|
||||||
* \sa SDL_ShowOpenFileDialog
|
|
||||||
* \sa SDL_ShowSaveFileDialog
|
|
||||||
* \sa SDL_ShowOpenFolderDialog
|
|
||||||
* \sa SDL_ShowFileDialogWithProperties
|
|
||||||
*/
|
|
||||||
typedef struct SDL_DialogFileFilter
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
const char *pattern;
|
|
||||||
} SDL_DialogFileFilter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback used by file dialog functions.
|
|
||||||
*
|
|
||||||
* The specific usage is described in each function.
|
|
||||||
*
|
|
||||||
* If `filelist` is:
|
|
||||||
*
|
|
||||||
* - NULL, an error occurred. Details can be obtained with SDL_GetError().
|
|
||||||
* - A pointer to NULL, the user either didn't choose any file or canceled the
|
|
||||||
* dialog.
|
|
||||||
* - A pointer to non-`NULL`, the user chose one or more files. The argument
|
|
||||||
* is a null-terminated array of pointers to UTF-8 encoded strings, each
|
|
||||||
* containing a path.
|
|
||||||
*
|
|
||||||
* The filelist argument should not be freed; it will automatically be freed
|
|
||||||
* when the callback returns.
|
|
||||||
*
|
|
||||||
* The filter argument is the index of the filter that was selected, or -1 if
|
|
||||||
* no filter was selected or if the platform or method doesn't support
|
|
||||||
* fetching the selected filter.
|
|
||||||
*
|
|
||||||
* In Android, the `filelist` are `content://` URIs. They should be opened
|
|
||||||
* using SDL_IOFromFile() with appropriate modes. This applies both to open
|
|
||||||
* and save file dialog.
|
|
||||||
*
|
|
||||||
* \param userdata an app-provided pointer, for the callback's use.
|
|
||||||
* \param filelist the file(s) chosen by the user.
|
|
||||||
* \param filter index of the selected filter.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_DialogFileFilter
|
|
||||||
* \sa SDL_ShowOpenFileDialog
|
|
||||||
* \sa SDL_ShowSaveFileDialog
|
|
||||||
* \sa SDL_ShowOpenFolderDialog
|
|
||||||
* \sa SDL_ShowFileDialogWithProperties
|
|
||||||
*/
|
|
||||||
typedef void (SDLCALL *SDL_DialogFileCallback)(void *userdata, const char * const *filelist, int filter);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a dialog that lets the user select a file on their filesystem.
|
|
||||||
*
|
|
||||||
* This is an asynchronous function; it will return immediately, and the
|
|
||||||
* result will be passed to the callback.
|
|
||||||
*
|
|
||||||
* The callback will be invoked with a null-terminated list of files the user
|
|
||||||
* chose. The list will be empty if the user canceled the dialog, and it will
|
|
||||||
* be NULL if an error occurred.
|
|
||||||
*
|
|
||||||
* Note that the callback may be called from a different thread than the one
|
|
||||||
* the function was invoked on.
|
|
||||||
*
|
|
||||||
* Depending on the platform, the user may be allowed to input paths that
|
|
||||||
* don't yet exist.
|
|
||||||
*
|
|
||||||
* On Linux, dialogs may require XDG Portals, which requires DBus, which
|
|
||||||
* requires an event-handling loop. Apps that do not use SDL to handle events
|
|
||||||
* should add a call to SDL_PumpEvents in their main loop.
|
|
||||||
*
|
|
||||||
* \param callback a function pointer to be invoked when the user selects a
|
|
||||||
* file and accepts, or cancels the dialog, or an error
|
|
||||||
* occurs.
|
|
||||||
* \param userdata an optional pointer to pass extra data to the callback when
|
|
||||||
* it will be invoked.
|
|
||||||
* \param window the window that the dialog should be modal for, may be NULL.
|
|
||||||
* Not all platforms support this option.
|
|
||||||
* \param filters a list of filters, may be NULL. Not all platforms support
|
|
||||||
* this option, and platforms that do support it may allow the
|
|
||||||
* user to ignore the filters. If non-NULL, it must remain
|
|
||||||
* valid at least until the callback is invoked.
|
|
||||||
* \param nfilters the number of filters. Ignored if filters is NULL.
|
|
||||||
* \param default_location the default folder or file to start the dialog at,
|
|
||||||
* may be NULL. Not all platforms support this option.
|
|
||||||
* \param allow_many if non-zero, the user will be allowed to select multiple
|
|
||||||
* entries. Not all platforms support this option.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should be called only from the main thread. The
|
|
||||||
* callback may be invoked from the same thread or from a
|
|
||||||
* different one, depending on the OS's constraints.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_DialogFileCallback
|
|
||||||
* \sa SDL_DialogFileFilter
|
|
||||||
* \sa SDL_ShowSaveFileDialog
|
|
||||||
* \sa SDL_ShowOpenFolderDialog
|
|
||||||
* \sa SDL_ShowFileDialogWithProperties
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, bool allow_many);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a dialog that lets the user choose a new or existing file on their
|
|
||||||
* filesystem.
|
|
||||||
*
|
|
||||||
* This is an asynchronous function; it will return immediately, and the
|
|
||||||
* result will be passed to the callback.
|
|
||||||
*
|
|
||||||
* The callback will be invoked with a null-terminated list of files the user
|
|
||||||
* chose. The list will be empty if the user canceled the dialog, and it will
|
|
||||||
* be NULL if an error occurred.
|
|
||||||
*
|
|
||||||
* Note that the callback may be called from a different thread than the one
|
|
||||||
* the function was invoked on.
|
|
||||||
*
|
|
||||||
* The chosen file may or may not already exist.
|
|
||||||
*
|
|
||||||
* On Linux, dialogs may require XDG Portals, which requires DBus, which
|
|
||||||
* requires an event-handling loop. Apps that do not use SDL to handle events
|
|
||||||
* should add a call to SDL_PumpEvents in their main loop.
|
|
||||||
*
|
|
||||||
* \param callback a function pointer to be invoked when the user selects a
|
|
||||||
* file and accepts, or cancels the dialog, or an error
|
|
||||||
* occurs.
|
|
||||||
* \param userdata an optional pointer to pass extra data to the callback when
|
|
||||||
* it will be invoked.
|
|
||||||
* \param window the window that the dialog should be modal for, may be NULL.
|
|
||||||
* Not all platforms support this option.
|
|
||||||
* \param filters a list of filters, may be NULL. Not all platforms support
|
|
||||||
* this option, and platforms that do support it may allow the
|
|
||||||
* user to ignore the filters. If non-NULL, it must remain
|
|
||||||
* valid at least until the callback is invoked.
|
|
||||||
* \param nfilters the number of filters. Ignored if filters is NULL.
|
|
||||||
* \param default_location the default folder or file to start the dialog at,
|
|
||||||
* may be NULL. Not all platforms support this option.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should be called only from the main thread. The
|
|
||||||
* callback may be invoked from the same thread or from a
|
|
||||||
* different one, depending on the OS's constraints.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_DialogFileCallback
|
|
||||||
* \sa SDL_DialogFileFilter
|
|
||||||
* \sa SDL_ShowOpenFileDialog
|
|
||||||
* \sa SDL_ShowOpenFolderDialog
|
|
||||||
* \sa SDL_ShowFileDialogWithProperties
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a dialog that lets the user select a folder on their filesystem.
|
|
||||||
*
|
|
||||||
* This is an asynchronous function; it will return immediately, and the
|
|
||||||
* result will be passed to the callback.
|
|
||||||
*
|
|
||||||
* The callback will be invoked with a null-terminated list of files the user
|
|
||||||
* chose. The list will be empty if the user canceled the dialog, and it will
|
|
||||||
* be NULL if an error occurred.
|
|
||||||
*
|
|
||||||
* Note that the callback may be called from a different thread than the one
|
|
||||||
* the function was invoked on.
|
|
||||||
*
|
|
||||||
* Depending on the platform, the user may be allowed to input paths that
|
|
||||||
* don't yet exist.
|
|
||||||
*
|
|
||||||
* On Linux, dialogs may require XDG Portals, which requires DBus, which
|
|
||||||
* requires an event-handling loop. Apps that do not use SDL to handle events
|
|
||||||
* should add a call to SDL_PumpEvents in their main loop.
|
|
||||||
*
|
|
||||||
* \param callback a function pointer to be invoked when the user selects a
|
|
||||||
* file and accepts, or cancels the dialog, or an error
|
|
||||||
* occurs.
|
|
||||||
* \param userdata an optional pointer to pass extra data to the callback when
|
|
||||||
* it will be invoked.
|
|
||||||
* \param window the window that the dialog should be modal for, may be NULL.
|
|
||||||
* Not all platforms support this option.
|
|
||||||
* \param default_location the default folder or file to start the dialog at,
|
|
||||||
* may be NULL. Not all platforms support this option.
|
|
||||||
* \param allow_many if non-zero, the user will be allowed to select multiple
|
|
||||||
* entries. Not all platforms support this option.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should be called only from the main thread. The
|
|
||||||
* callback may be invoked from the same thread or from a
|
|
||||||
* different one, depending on the OS's constraints.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_DialogFileCallback
|
|
||||||
* \sa SDL_ShowOpenFileDialog
|
|
||||||
* \sa SDL_ShowSaveFileDialog
|
|
||||||
* \sa SDL_ShowFileDialogWithProperties
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char *default_location, bool allow_many);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Various types of file dialogs.
|
|
||||||
*
|
|
||||||
* This is used by SDL_ShowFileDialogWithProperties() to decide what kind of
|
|
||||||
* dialog to present to the user.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ShowFileDialogWithProperties
|
|
||||||
*/
|
|
||||||
typedef enum SDL_FileDialogType
|
|
||||||
{
|
|
||||||
SDL_FILEDIALOG_OPENFILE,
|
|
||||||
SDL_FILEDIALOG_SAVEFILE,
|
|
||||||
SDL_FILEDIALOG_OPENFOLDER
|
|
||||||
} SDL_FileDialogType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create and launch a file dialog with the specified properties.
|
|
||||||
*
|
|
||||||
* These are the supported properties:
|
|
||||||
*
|
|
||||||
* - `SDL_PROP_FILE_DIALOG_FILTERS_POINTER`: a pointer to a list of
|
|
||||||
* SDL_DialogFileFilter structs, which will be used as filters for
|
|
||||||
* file-based selections. Ignored if the dialog is an "Open Folder" dialog.
|
|
||||||
* If non-NULL, the array of filters must remain valid at least until the
|
|
||||||
* callback is invoked.
|
|
||||||
* - `SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER`: the number of filters in the
|
|
||||||
* array of filters, if it exists.
|
|
||||||
* - `SDL_PROP_FILE_DIALOG_WINDOW_POINTER`: the window that the dialog should
|
|
||||||
* be modal for.
|
|
||||||
* - `SDL_PROP_FILE_DIALOG_LOCATION_STRING`: the default folder or file to
|
|
||||||
* start the dialog at.
|
|
||||||
* - `SDL_PROP_FILE_DIALOG_MANY_BOOLEAN`: true to allow the user to select
|
|
||||||
* more than one entry.
|
|
||||||
* - `SDL_PROP_FILE_DIALOG_TITLE_STRING`: the title for the dialog.
|
|
||||||
* - `SDL_PROP_FILE_DIALOG_ACCEPT_STRING`: the label that the accept button
|
|
||||||
* should have.
|
|
||||||
* - `SDL_PROP_FILE_DIALOG_CANCEL_STRING`: the label that the cancel button
|
|
||||||
* should have.
|
|
||||||
*
|
|
||||||
* Note that each platform may or may not support any of the properties.
|
|
||||||
*
|
|
||||||
* \param type the type of file dialog.
|
|
||||||
* \param callback a function pointer to be invoked when the user selects a
|
|
||||||
* file and accepts, or cancels the dialog, or an error
|
|
||||||
* occurs.
|
|
||||||
* \param userdata an optional pointer to pass extra data to the callback when
|
|
||||||
* it will be invoked.
|
|
||||||
* \param props the properties to use.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should be called only from the main thread. The
|
|
||||||
* callback may be invoked from the same thread or from a
|
|
||||||
* different one, depending on the OS's constraints.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_FileDialogType
|
|
||||||
* \sa SDL_DialogFileCallback
|
|
||||||
* \sa SDL_DialogFileFilter
|
|
||||||
* \sa SDL_ShowOpenFileDialog
|
|
||||||
* \sa SDL_ShowSaveFileDialog
|
|
||||||
* \sa SDL_ShowOpenFolderDialog
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFileCallback callback, void *userdata, SDL_PropertiesID props);
|
|
||||||
|
|
||||||
#define SDL_PROP_FILE_DIALOG_FILTERS_POINTER "SDL.filedialog.filters"
|
|
||||||
#define SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER "SDL.filedialog.nfilters"
|
|
||||||
#define SDL_PROP_FILE_DIALOG_WINDOW_POINTER "SDL.filedialog.window"
|
|
||||||
#define SDL_PROP_FILE_DIALOG_LOCATION_STRING "SDL.filedialog.location"
|
|
||||||
#define SDL_PROP_FILE_DIALOG_MANY_BOOLEAN "SDL.filedialog.many"
|
|
||||||
#define SDL_PROP_FILE_DIALOG_TITLE_STRING "SDL.filedialog.title"
|
|
||||||
#define SDL_PROP_FILE_DIALOG_ACCEPT_STRING "SDL.filedialog.accept"
|
|
||||||
#define SDL_PROP_FILE_DIALOG_CANCEL_STRING "SDL.filedialog.cancel"
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_dialog_h_ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,645 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryEndian
|
|
||||||
*
|
|
||||||
* Functions converting endian-specific values to different byte orders.
|
|
||||||
*
|
|
||||||
* These functions either unconditionally swap byte order (SDL_Swap16,
|
|
||||||
* SDL_Swap32, SDL_Swap64, SDL_SwapFloat), or they swap to/from the system's
|
|
||||||
* native byte order (SDL_Swap16LE, SDL_Swap16BE, SDL_Swap32LE, SDL_Swap32BE,
|
|
||||||
* SDL_Swap32LE, SDL_Swap32BE, SDL_SwapFloatLE, SDL_SwapFloatBE). In the
|
|
||||||
* latter case, the functionality is provided by macros that become no-ops if
|
|
||||||
* a swap isn't necessary: on an x86 (littleendian) processor, SDL_Swap32LE
|
|
||||||
* does nothing, but SDL_Swap32BE reverses the bytes of the data. On a PowerPC
|
|
||||||
* processor (bigendian), the macros behavior is reversed.
|
|
||||||
*
|
|
||||||
* The swap routines are inline functions, and attempt to use compiler
|
|
||||||
* intrinsics, inline assembly, and other magic to make byteswapping
|
|
||||||
* efficient.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_endian_h_
|
|
||||||
#define SDL_endian_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
|
||||||
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
|
|
||||||
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
|
|
||||||
#ifdef __clang__
|
|
||||||
#ifndef __PRFCHWINTRIN_H
|
|
||||||
#define __PRFCHWINTRIN_H
|
|
||||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
|
||||||
_m_prefetch(void *__P)
|
|
||||||
{
|
|
||||||
__builtin_prefetch(__P, 0, 3 /* _MM_HINT_T0 */);
|
|
||||||
}
|
|
||||||
#endif /* __PRFCHWINTRIN_H */
|
|
||||||
#endif /* __clang__ */
|
|
||||||
|
|
||||||
#include <intrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \name The two types of endianness
|
|
||||||
*/
|
|
||||||
/* @{ */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A value to represent littleendian byteorder.
|
|
||||||
*
|
|
||||||
* This is used with the preprocessor macro SDL_BYTEORDER, to determine a
|
|
||||||
* platform's byte ordering:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* #if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
|
||||||
* SDL_Log("This system is littleendian.");
|
|
||||||
* #endif
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_BYTEORDER
|
|
||||||
* \sa SDL_BIG_ENDIAN
|
|
||||||
*/
|
|
||||||
#define SDL_LIL_ENDIAN 1234
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A value to represent bigendian byteorder.
|
|
||||||
*
|
|
||||||
* This is used with the preprocessor macro SDL_BYTEORDER, to determine a
|
|
||||||
* platform's byte ordering:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* #if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
|
||||||
* SDL_Log("This system is bigendian.");
|
|
||||||
* #endif
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_BYTEORDER
|
|
||||||
* \sa SDL_LIL_ENDIAN
|
|
||||||
*/
|
|
||||||
#define SDL_BIG_ENDIAN 4321
|
|
||||||
|
|
||||||
/* @} */
|
|
||||||
|
|
||||||
#ifndef SDL_BYTEORDER
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro that reports the target system's byte order.
|
|
||||||
*
|
|
||||||
* This is set to either SDL_LIL_ENDIAN or SDL_BIG_ENDIAN (and maybe other
|
|
||||||
* values in the future, if something else becomes popular). This can be
|
|
||||||
* tested with the preprocessor, so decisions can be made at compile time.
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* #if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
|
||||||
* SDL_Log("This system is bigendian.");
|
|
||||||
* #endif
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LIL_ENDIAN
|
|
||||||
* \sa SDL_BIG_ENDIAN
|
|
||||||
*/
|
|
||||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
|
|
||||||
#elif defined(SDL_PLATFORM_LINUX)
|
|
||||||
#include <endian.h>
|
|
||||||
#define SDL_BYTEORDER __BYTE_ORDER
|
|
||||||
#elif defined(SDL_PLATFORM_SOLARIS)
|
|
||||||
#include <sys/byteorder.h>
|
|
||||||
#if defined(_LITTLE_ENDIAN)
|
|
||||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
|
||||||
#elif defined(_BIG_ENDIAN)
|
|
||||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#error Unsupported endianness
|
|
||||||
#endif
|
|
||||||
#elif defined(SDL_PLATFORM_OPENBSD) || defined(__DragonFly__)
|
|
||||||
#include <endian.h>
|
|
||||||
#define SDL_BYTEORDER BYTE_ORDER
|
|
||||||
#elif defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_NETBSD)
|
|
||||||
#include <sys/endian.h>
|
|
||||||
#define SDL_BYTEORDER BYTE_ORDER
|
|
||||||
/* predefs from newer gcc and clang versions: */
|
|
||||||
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__)
|
|
||||||
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
||||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
|
||||||
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
|
||||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#error Unsupported endianness
|
|
||||||
#endif /**/
|
|
||||||
#else
|
|
||||||
#if defined(__hppa__) || \
|
|
||||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
|
||||||
(defined(__MIPS__) && defined(__MIPSEB__)) || \
|
|
||||||
defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \
|
|
||||||
defined(__sparc__) || defined(__sparc)
|
|
||||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
|
||||||
#endif
|
|
||||||
#endif /* SDL_PLATFORM_LINUX */
|
|
||||||
#endif /* !SDL_BYTEORDER */
|
|
||||||
|
|
||||||
#ifndef SDL_FLOATWORDORDER
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro that reports the target system's floating point word order.
|
|
||||||
*
|
|
||||||
* This is set to either SDL_LIL_ENDIAN or SDL_BIG_ENDIAN (and maybe other
|
|
||||||
* values in the future, if something else becomes popular). This can be
|
|
||||||
* tested with the preprocessor, so decisions can be made at compile time.
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* #if SDL_FLOATWORDORDER == SDL_BIG_ENDIAN
|
|
||||||
* SDL_Log("This system's floats are bigendian.");
|
|
||||||
* #endif
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LIL_ENDIAN
|
|
||||||
* \sa SDL_BIG_ENDIAN
|
|
||||||
*/
|
|
||||||
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN___or_maybe___SDL_BIG_ENDIAN
|
|
||||||
/* predefs from newer gcc versions: */
|
|
||||||
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__)
|
|
||||||
#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
||||||
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
|
|
||||||
#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
|
|
||||||
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#error Unsupported endianness
|
|
||||||
#endif /**/
|
|
||||||
#elif defined(__MAVERICK__)
|
|
||||||
/* For Maverick, float words are always little-endian. */
|
|
||||||
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
|
|
||||||
#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__)
|
|
||||||
/* For FPA, float words are always big-endian. */
|
|
||||||
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
/* By default, assume that floats words follow the memory system mode. */
|
|
||||||
#define SDL_FLOATWORDORDER SDL_BYTEORDER
|
|
||||||
#endif /* __FLOAT_WORD_ORDER__ */
|
|
||||||
#endif /* !SDL_FLOATWORDORDER */
|
|
||||||
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* various modern compilers may have builtin swap */
|
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
|
||||||
# define HAS_BUILTIN_BSWAP16 (SDL_HAS_BUILTIN(__builtin_bswap16)) || \
|
|
||||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
|
|
||||||
# define HAS_BUILTIN_BSWAP32 (SDL_HAS_BUILTIN(__builtin_bswap32)) || \
|
|
||||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
|
||||||
# define HAS_BUILTIN_BSWAP64 (SDL_HAS_BUILTIN(__builtin_bswap64)) || \
|
|
||||||
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
|
||||||
|
|
||||||
/* this one is broken */
|
|
||||||
# define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
|
|
||||||
#else
|
|
||||||
# define HAS_BUILTIN_BSWAP16 0
|
|
||||||
# define HAS_BUILTIN_BSWAP32 0
|
|
||||||
# define HAS_BUILTIN_BSWAP64 0
|
|
||||||
# define HAS_BROKEN_BSWAP 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Byte swap 16-bit integer. */
|
|
||||||
#ifndef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
#if HAS_BUILTIN_BSWAP16
|
|
||||||
#define SDL_Swap16(x) __builtin_bswap16(x)
|
|
||||||
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
|
|
||||||
#pragma intrinsic(_byteswap_ushort)
|
|
||||||
#define SDL_Swap16(x) _byteswap_ushort(x)
|
|
||||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
|
||||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__x86_64__)
|
|
||||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif (defined(__powerpc__) || defined(__ppc__))
|
|
||||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
|
|
||||||
__asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
|
|
||||||
return (Uint16)result;
|
|
||||||
}
|
|
||||||
#elif (defined(__m68k__) && !defined(__mcoldfire__))
|
|
||||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
|
||||||
extern __inline Uint16 SDL_Swap16(Uint16);
|
|
||||||
#pragma aux SDL_Swap16 = \
|
|
||||||
"xchg al, ah" \
|
|
||||||
parm [ax] \
|
|
||||||
modify [ax];
|
|
||||||
#else
|
|
||||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
|
|
||||||
{
|
|
||||||
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Byte swap 32-bit integer. */
|
|
||||||
#ifndef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
#if HAS_BUILTIN_BSWAP32
|
|
||||||
#define SDL_Swap32(x) __builtin_bswap32(x)
|
|
||||||
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
|
|
||||||
#pragma intrinsic(_byteswap_ulong)
|
|
||||||
#define SDL_Swap32(x) _byteswap_ulong(x)
|
|
||||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
|
||||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
__asm__("bswap %0": "=r"(x):"0"(x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__x86_64__)
|
|
||||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
__asm__("bswapl %0": "=r"(x):"0"(x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif (defined(__powerpc__) || defined(__ppc__))
|
|
||||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
Uint32 result;
|
|
||||||
|
|
||||||
__asm__("rlwimi %0,%2,24,16,23": "=&r"(result): "0" (x>>24), "r"(x));
|
|
||||||
__asm__("rlwimi %0,%2,8,8,15" : "=&r"(result): "0" (result), "r"(x));
|
|
||||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#elif (defined(__m68k__) && !defined(__mcoldfire__))
|
|
||||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
|
||||||
extern __inline Uint32 SDL_Swap32(Uint32);
|
|
||||||
#pragma aux SDL_Swap32 = \
|
|
||||||
"bswap eax" \
|
|
||||||
parm [eax] \
|
|
||||||
modify [eax];
|
|
||||||
#else
|
|
||||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
|
|
||||||
{
|
|
||||||
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
|
|
||||||
((x >> 8) & 0x0000FF00) | (x >> 24)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Byte swap 64-bit integer. */
|
|
||||||
#ifndef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
#if HAS_BUILTIN_BSWAP64
|
|
||||||
#define SDL_Swap64(x) __builtin_bswap64(x)
|
|
||||||
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
|
|
||||||
#pragma intrinsic(_byteswap_uint64)
|
|
||||||
#define SDL_Swap64(x) _byteswap_uint64(x)
|
|
||||||
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
|
|
||||||
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
|
|
||||||
{
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
Uint32 a, b;
|
|
||||||
} s;
|
|
||||||
Uint64 u;
|
|
||||||
} v;
|
|
||||||
v.u = x;
|
|
||||||
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
|
||||||
: "=r"(v.s.a), "=r"(v.s.b)
|
|
||||||
: "0" (v.s.a), "1"(v.s.b));
|
|
||||||
return v.u;
|
|
||||||
}
|
|
||||||
#elif defined(__x86_64__)
|
|
||||||
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
|
|
||||||
{
|
|
||||||
__asm__("bswapq %0": "=r"(x):"0"(x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
|
||||||
extern __inline Uint64 SDL_Swap64(Uint64);
|
|
||||||
#pragma aux SDL_Swap64 = \
|
|
||||||
"bswap eax" \
|
|
||||||
"bswap edx" \
|
|
||||||
"xchg eax,edx" \
|
|
||||||
parm [eax edx] \
|
|
||||||
modify [eax edx];
|
|
||||||
#else
|
|
||||||
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
|
|
||||||
{
|
|
||||||
Uint32 hi, lo;
|
|
||||||
|
|
||||||
/* Separate into high and low 32-bit values and swap them */
|
|
||||||
lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
|
|
||||||
x >>= 32;
|
|
||||||
hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
|
|
||||||
x = SDL_Swap32(lo);
|
|
||||||
x <<= 32;
|
|
||||||
x |= SDL_Swap32(hi);
|
|
||||||
return (x);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Byte-swap a floating point number.
|
|
||||||
*
|
|
||||||
* This will always byte-swap the value, whether it's currently in the native
|
|
||||||
* byteorder of the system or not. You should use SDL_SwapFloatLE or
|
|
||||||
* SDL_SwapFloatBE instead, in most cases.
|
|
||||||
*
|
|
||||||
* Note that this is a forced-inline function in a header, and not a public
|
|
||||||
* API function available in the SDL library (which is to say, the code is
|
|
||||||
* embedded in the calling program and the linker and dynamic loader will not
|
|
||||||
* be able to find this function inside SDL itself).
|
|
||||||
*
|
|
||||||
* \param x the value to byte-swap.
|
|
||||||
* \returns x, with its bytes in the opposite endian order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
SDL_FORCE_INLINE float SDL_SwapFloat(float x)
|
|
||||||
{
|
|
||||||
union {
|
|
||||||
float f;
|
|
||||||
Uint32 ui32;
|
|
||||||
} swapper;
|
|
||||||
swapper.f = x;
|
|
||||||
swapper.ui32 = SDL_Swap32(swapper.ui32);
|
|
||||||
return swapper.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove extra macros */
|
|
||||||
#undef HAS_BROKEN_BSWAP
|
|
||||||
#undef HAS_BUILTIN_BSWAP16
|
|
||||||
#undef HAS_BUILTIN_BSWAP32
|
|
||||||
#undef HAS_BUILTIN_BSWAP64
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Byte-swap an unsigned 16-bit number.
|
|
||||||
*
|
|
||||||
* This will always byte-swap the value, whether it's currently in the native
|
|
||||||
* byteorder of the system or not. You should use SDL_Swap16LE or SDL_Swap16BE
|
|
||||||
* instead, in most cases.
|
|
||||||
*
|
|
||||||
* Note that this is a forced-inline function in a header, and not a public
|
|
||||||
* API function available in the SDL library (which is to say, the code is
|
|
||||||
* embedded in the calling program and the linker and dynamic loader will not
|
|
||||||
* be able to find this function inside SDL itself).
|
|
||||||
*
|
|
||||||
* \param x the value to byte-swap.
|
|
||||||
* \returns `x`, with its bytes in the opposite endian order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return x_but_byteswapped; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Byte-swap an unsigned 32-bit number.
|
|
||||||
*
|
|
||||||
* This will always byte-swap the value, whether it's currently in the native
|
|
||||||
* byteorder of the system or not. You should use SDL_Swap32LE or SDL_Swap32BE
|
|
||||||
* instead, in most cases.
|
|
||||||
*
|
|
||||||
* Note that this is a forced-inline function in a header, and not a public
|
|
||||||
* API function available in the SDL library (which is to say, the code is
|
|
||||||
* embedded in the calling program and the linker and dynamic loader will not
|
|
||||||
* be able to find this function inside SDL itself).
|
|
||||||
*
|
|
||||||
* \param x the value to byte-swap.
|
|
||||||
* \returns `x`, with its bytes in the opposite endian order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return x_but_byteswapped; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Byte-swap an unsigned 64-bit number.
|
|
||||||
*
|
|
||||||
* This will always byte-swap the value, whether it's currently in the native
|
|
||||||
* byteorder of the system or not. You should use SDL_Swap64LE or SDL_Swap64BE
|
|
||||||
* instead, in most cases.
|
|
||||||
*
|
|
||||||
* Note that this is a forced-inline function in a header, and not a public
|
|
||||||
* API function available in the SDL library (which is to say, the code is
|
|
||||||
* embedded in the calling program and the linker and dynamic loader will not
|
|
||||||
* be able to find this function inside SDL itself).
|
|
||||||
*
|
|
||||||
* \param x the value to byte-swap.
|
|
||||||
* \returns `x`, with its bytes in the opposite endian order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { return x_but_byteswapped; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap a 16-bit value from littleendian to native byte order.
|
|
||||||
*
|
|
||||||
* If this is running on a littleendian system, `x` is returned unchanged.
|
|
||||||
*
|
|
||||||
* This macro never references `x` more than once, avoiding side effects.
|
|
||||||
*
|
|
||||||
* \param x the value to swap, in littleendian byte order.
|
|
||||||
* \returns `x` in native byte order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_Swap16LE(x) SwapOnlyIfNecessary(x)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap a 32-bit value from littleendian to native byte order.
|
|
||||||
*
|
|
||||||
* If this is running on a littleendian system, `x` is returned unchanged.
|
|
||||||
*
|
|
||||||
* This macro never references `x` more than once, avoiding side effects.
|
|
||||||
*
|
|
||||||
* \param x the value to swap, in littleendian byte order.
|
|
||||||
* \returns `x` in native byte order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_Swap32LE(x) SwapOnlyIfNecessary(x)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap a 64-bit value from littleendian to native byte order.
|
|
||||||
*
|
|
||||||
* If this is running on a littleendian system, `x` is returned unchanged.
|
|
||||||
*
|
|
||||||
* This macro never references `x` more than once, avoiding side effects.
|
|
||||||
*
|
|
||||||
* \param x the value to swap, in littleendian byte order.
|
|
||||||
* \returns `x` in native byte order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_Swap64LE(x) SwapOnlyIfNecessary(x)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap a floating point value from littleendian to native byte order.
|
|
||||||
*
|
|
||||||
* If this is running on a littleendian system, `x` is returned unchanged.
|
|
||||||
*
|
|
||||||
* This macro never references `x` more than once, avoiding side effects.
|
|
||||||
*
|
|
||||||
* \param x the value to swap, in littleendian byte order.
|
|
||||||
* \returns `x` in native byte order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_SwapFloatLE(x) SwapOnlyIfNecessary(x)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap a 16-bit value from bigendian to native byte order.
|
|
||||||
*
|
|
||||||
* If this is running on a bigendian system, `x` is returned unchanged.
|
|
||||||
*
|
|
||||||
* This macro never references `x` more than once, avoiding side effects.
|
|
||||||
*
|
|
||||||
* \param x the value to swap, in bigendian byte order.
|
|
||||||
* \returns `x` in native byte order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_Swap16BE(x) SwapOnlyIfNecessary(x)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap a 32-bit value from bigendian to native byte order.
|
|
||||||
*
|
|
||||||
* If this is running on a bigendian system, `x` is returned unchanged.
|
|
||||||
*
|
|
||||||
* This macro never references `x` more than once, avoiding side effects.
|
|
||||||
*
|
|
||||||
* \param x the value to swap, in bigendian byte order.
|
|
||||||
* \returns `x` in native byte order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_Swap32BE(x) SwapOnlyIfNecessary(x)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap a 64-bit value from bigendian to native byte order.
|
|
||||||
*
|
|
||||||
* If this is running on a bigendian system, `x` is returned unchanged.
|
|
||||||
*
|
|
||||||
* This macro never references `x` more than once, avoiding side effects.
|
|
||||||
*
|
|
||||||
* \param x the value to swap, in bigendian byte order.
|
|
||||||
* \returns `x` in native byte order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_Swap64BE(x) SwapOnlyIfNecessary(x)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Swap a floating point value from bigendian to native byte order.
|
|
||||||
*
|
|
||||||
* If this is running on a bigendian system, `x` is returned unchanged.
|
|
||||||
*
|
|
||||||
* This macro never references `x` more than once, avoiding side effects.
|
|
||||||
*
|
|
||||||
* \param x the value to swap, in bigendian byte order.
|
|
||||||
* \returns `x` in native byte order.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_SwapFloatBE(x) SwapOnlyIfNecessary(x)
|
|
||||||
|
|
||||||
#elif SDL_BYTEORDER == SDL_LIL_ENDIAN
|
|
||||||
#define SDL_Swap16LE(x) (x)
|
|
||||||
#define SDL_Swap32LE(x) (x)
|
|
||||||
#define SDL_Swap64LE(x) (x)
|
|
||||||
#define SDL_SwapFloatLE(x) (x)
|
|
||||||
#define SDL_Swap16BE(x) SDL_Swap16(x)
|
|
||||||
#define SDL_Swap32BE(x) SDL_Swap32(x)
|
|
||||||
#define SDL_Swap64BE(x) SDL_Swap64(x)
|
|
||||||
#define SDL_SwapFloatBE(x) SDL_SwapFloat(x)
|
|
||||||
#else
|
|
||||||
#define SDL_Swap16LE(x) SDL_Swap16(x)
|
|
||||||
#define SDL_Swap32LE(x) SDL_Swap32(x)
|
|
||||||
#define SDL_Swap64LE(x) SDL_Swap64(x)
|
|
||||||
#define SDL_SwapFloatLE(x) SDL_SwapFloat(x)
|
|
||||||
#define SDL_Swap16BE(x) (x)
|
|
||||||
#define SDL_Swap32BE(x) (x)
|
|
||||||
#define SDL_Swap64BE(x) (x)
|
|
||||||
#define SDL_SwapFloatBE(x) (x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_endian_h_ */
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryError
|
|
||||||
*
|
|
||||||
* Simple error message routines for SDL.
|
|
||||||
*
|
|
||||||
* Most apps will interface with these APIs in exactly one function: when
|
|
||||||
* almost any SDL function call reports failure, you can get a human-readable
|
|
||||||
* string of the problem from SDL_GetError().
|
|
||||||
*
|
|
||||||
* These strings are maintained per-thread, and apps are welcome to set their
|
|
||||||
* own errors, which is popular when building libraries on top of SDL for
|
|
||||||
* other apps to consume. These strings are set by calling SDL_SetError().
|
|
||||||
*
|
|
||||||
* A common usage pattern is to have a function that returns true for success
|
|
||||||
* and false for failure, and do this when something fails:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* if (something_went_wrong) {
|
|
||||||
* return SDL_SetError("The thing broke in this specific way: %d", errcode);
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* It's also common to just return `false` in this case if the failing thing
|
|
||||||
* is known to call SDL_SetError(), so errors simply propagate through.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_error_h_
|
|
||||||
#define SDL_error_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Public functions */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the SDL error message for the current thread.
|
|
||||||
*
|
|
||||||
* Calling this function will replace any previous error message that was set.
|
|
||||||
*
|
|
||||||
* This function always returns false, since SDL frequently uses false to
|
|
||||||
* signify a failing result, leading to this idiom:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* if (error_code) {
|
|
||||||
* return SDL_SetError("This operation has failed: %d", error_code);
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \param fmt a printf()-style message format string.
|
|
||||||
* \param ... additional parameters matching % tokens in the `fmt` string, if
|
|
||||||
* any.
|
|
||||||
* \returns false.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ClearError
|
|
||||||
* \sa SDL_GetError
|
|
||||||
* \sa SDL_SetErrorV
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the SDL error message for the current thread.
|
|
||||||
*
|
|
||||||
* Calling this function will replace any previous error message that was set.
|
|
||||||
*
|
|
||||||
* \param fmt a printf()-style message format string.
|
|
||||||
* \param ap a variable argument list.
|
|
||||||
* \returns false.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ClearError
|
|
||||||
* \sa SDL_GetError
|
|
||||||
* \sa SDL_SetError
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetErrorV(SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set an error indicating that memory allocation failed.
|
|
||||||
*
|
|
||||||
* This function does not do any memory allocation.
|
|
||||||
*
|
|
||||||
* \returns false.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_OutOfMemory(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve a message about the last error that occurred on the current
|
|
||||||
* thread.
|
|
||||||
*
|
|
||||||
* It is possible for multiple errors to occur before calling SDL_GetError().
|
|
||||||
* Only the last error is returned.
|
|
||||||
*
|
|
||||||
* The message is only applicable when an SDL function has signaled an error.
|
|
||||||
* You must check the return values of SDL function calls to determine when to
|
|
||||||
* appropriately call SDL_GetError(). You should *not* use the results of
|
|
||||||
* SDL_GetError() to decide if an error has occurred! Sometimes SDL will set
|
|
||||||
* an error string even when reporting success.
|
|
||||||
*
|
|
||||||
* SDL will *not* clear the error string for successful API calls. You *must*
|
|
||||||
* check return values for failure cases before you can assume the error
|
|
||||||
* string applies.
|
|
||||||
*
|
|
||||||
* Error strings are set per-thread, so an error set in a different thread
|
|
||||||
* will not interfere with the current thread's operation.
|
|
||||||
*
|
|
||||||
* The returned value is a thread-local string which will remain valid until
|
|
||||||
* the current thread's error string is changed. The caller should make a copy
|
|
||||||
* if the value is needed after the next SDL API call.
|
|
||||||
*
|
|
||||||
* \returns a message with information about the specific error that occurred,
|
|
||||||
* or an empty string if there hasn't been an error message set since
|
|
||||||
* the last call to SDL_ClearError().
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_ClearError
|
|
||||||
* \sa SDL_SetError
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetError(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear any previous error message for this thread.
|
|
||||||
*
|
|
||||||
* \returns true.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetError
|
|
||||||
* \sa SDL_SetError
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_ClearError(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \name Internal error functions
|
|
||||||
*
|
|
||||||
* \internal
|
|
||||||
* Private error reporting function - used internally.
|
|
||||||
*/
|
|
||||||
/* @{ */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to standardize error reporting on unsupported operations.
|
|
||||||
*
|
|
||||||
* This simply calls SDL_SetError() with a standardized error string, for
|
|
||||||
* convenience, consistency, and clarity.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_Unsupported() SDL_SetError("That operation is not supported")
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to standardize error reporting on unsupported operations.
|
|
||||||
*
|
|
||||||
* This simply calls SDL_SetError() with a standardized error string, for
|
|
||||||
* convenience, consistency, and clarity.
|
|
||||||
*
|
|
||||||
* A common usage pattern inside SDL is this:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* bool MyFunction(const char *str) {
|
|
||||||
* if (!str) {
|
|
||||||
* return SDL_InvalidParamError("str"); // returns false.
|
|
||||||
* }
|
|
||||||
* DoSomething(str);
|
|
||||||
* return true;
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this macro from any thread.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
|
|
||||||
|
|
||||||
/* @} *//* Internal error functions */
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_error_h_ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,503 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryFilesystem
|
|
||||||
*
|
|
||||||
* SDL offers an API for examining and manipulating the system's filesystem.
|
|
||||||
* This covers most things one would need to do with directories, except for
|
|
||||||
* actual file I/O (which is covered by [CategoryIOStream](CategoryIOStream)
|
|
||||||
* and [CategoryAsyncIO](CategoryAsyncIO) instead).
|
|
||||||
*
|
|
||||||
* There are functions to answer necessary path questions:
|
|
||||||
*
|
|
||||||
* - Where is my app's data? SDL_GetBasePath().
|
|
||||||
* - Where can I safely write files? SDL_GetPrefPath().
|
|
||||||
* - Where are paths like Downloads, Desktop, Music? SDL_GetUserFolder().
|
|
||||||
* - What is this thing at this location? SDL_GetPathInfo().
|
|
||||||
* - What items live in this folder? SDL_EnumerateDirectory().
|
|
||||||
* - What items live in this folder by wildcard? SDL_GlobDirectory().
|
|
||||||
* - What is my current working directory? SDL_GetCurrentDirectory().
|
|
||||||
*
|
|
||||||
* SDL also offers functions to manipulate the directory tree: renaming,
|
|
||||||
* removing, copying files.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_filesystem_h_
|
|
||||||
#define SDL_filesystem_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the directory where the application was run from.
|
|
||||||
*
|
|
||||||
* SDL caches the result of this call internally, but the first call to this
|
|
||||||
* function is not necessarily fast, so plan accordingly.
|
|
||||||
*
|
|
||||||
* **macOS and iOS Specific Functionality**: If the application is in a ".app"
|
|
||||||
* bundle, this function returns the Resource directory (e.g.
|
|
||||||
* MyApp.app/Contents/Resources/). This behaviour can be overridden by adding
|
|
||||||
* a property to the Info.plist file. Adding a string key with the name
|
|
||||||
* SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the
|
|
||||||
* behaviour.
|
|
||||||
*
|
|
||||||
* Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an
|
|
||||||
* application in /Applications/SDLApp/MyApp.app):
|
|
||||||
*
|
|
||||||
* - `resource`: bundle resource directory (the default). For example:
|
|
||||||
* `/Applications/SDLApp/MyApp.app/Contents/Resources`
|
|
||||||
* - `bundle`: the Bundle directory. For example:
|
|
||||||
* `/Applications/SDLApp/MyApp.app/`
|
|
||||||
* - `parent`: the containing directory of the bundle. For example:
|
|
||||||
* `/Applications/SDLApp/`
|
|
||||||
*
|
|
||||||
* **Nintendo 3DS Specific Functionality**: This function returns "romfs"
|
|
||||||
* directory of the application as it is uncommon to store resources outside
|
|
||||||
* the executable. As such it is not a writable directory.
|
|
||||||
*
|
|
||||||
* The returned path is guaranteed to end with a path separator ('\\' on
|
|
||||||
* Windows, '/' on most other platforms).
|
|
||||||
*
|
|
||||||
* \returns an absolute path in UTF-8 encoding to the application data
|
|
||||||
* directory. NULL will be returned on error or when the platform
|
|
||||||
* doesn't implement this functionality, call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetPrefPath
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the user-and-app-specific path where files can be written.
|
|
||||||
*
|
|
||||||
* Get the "pref dir". This is meant to be where users can write personal
|
|
||||||
* files (preferences and save games, etc) that are specific to your
|
|
||||||
* application. This directory is unique per user, per application.
|
|
||||||
*
|
|
||||||
* This function will decide the appropriate location in the native
|
|
||||||
* filesystem, create the directory if necessary, and return a string of the
|
|
||||||
* absolute path to the directory in UTF-8 encoding.
|
|
||||||
*
|
|
||||||
* On Windows, the string might look like:
|
|
||||||
*
|
|
||||||
* `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\`
|
|
||||||
*
|
|
||||||
* On Linux, the string might look like:
|
|
||||||
*
|
|
||||||
* `/home/bob/.local/share/My Program Name/`
|
|
||||||
*
|
|
||||||
* On macOS, the string might look like:
|
|
||||||
*
|
|
||||||
* `/Users/bob/Library/Application Support/My Program Name/`
|
|
||||||
*
|
|
||||||
* You should assume the path returned by this function is the only safe place
|
|
||||||
* to write files (and that SDL_GetBasePath(), while it might be writable, or
|
|
||||||
* even the parent of the returned path, isn't where you should be writing
|
|
||||||
* things).
|
|
||||||
*
|
|
||||||
* Both the org and app strings may become part of a directory name, so please
|
|
||||||
* follow these rules:
|
|
||||||
*
|
|
||||||
* - Try to use the same org string (_including case-sensitivity_) for all
|
|
||||||
* your applications that use this function.
|
|
||||||
* - Always use a unique app string for each one, and make sure it never
|
|
||||||
* changes for an app once you've decided on it.
|
|
||||||
* - Unicode characters are legal, as long as they are UTF-8 encoded, but...
|
|
||||||
* - ...only use letters, numbers, and spaces. Avoid punctuation like "Game
|
|
||||||
* Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
|
|
||||||
*
|
|
||||||
* The returned path is guaranteed to end with a path separator ('\\' on
|
|
||||||
* Windows, '/' on most other platforms).
|
|
||||||
*
|
|
||||||
* \param org the name of your organization.
|
|
||||||
* \param app the name of your application.
|
|
||||||
* \returns a UTF-8 string of the user directory in platform-dependent
|
|
||||||
* notation. NULL if there's a problem (creating directory failed,
|
|
||||||
* etc.). This should be freed with SDL_free() when it is no longer
|
|
||||||
* needed.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetBasePath
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char *app);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of the OS-provided default folder for a specific purpose.
|
|
||||||
*
|
|
||||||
* Note that the Trash folder isn't included here, because trashing files
|
|
||||||
* usually involves extra OS-specific functionality to remember the file's
|
|
||||||
* original location.
|
|
||||||
*
|
|
||||||
* The folders supported per platform are:
|
|
||||||
*
|
|
||||||
* | | Windows | macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten |
|
|
||||||
* | ----------- | ------- | --------- | ---- | ---------- | ----- | ---------- |
|
|
||||||
* | HOME | X | X | | X | X | X |
|
|
||||||
* | DESKTOP | X | X | | X | X | |
|
|
||||||
* | DOCUMENTS | X | X | | X | | |
|
|
||||||
* | DOWNLOADS | Vista+ | X | | X | | |
|
|
||||||
* | MUSIC | X | X | | X | | |
|
|
||||||
* | PICTURES | X | X | | X | | |
|
|
||||||
* | PUBLICSHARE | | X | | X | | |
|
|
||||||
* | SAVEDGAMES | Vista+ | | | | | |
|
|
||||||
* | SCREENSHOTS | Vista+ | | | | | |
|
|
||||||
* | TEMPLATES | X | X | | X | | |
|
|
||||||
* | VIDEOS | X | X* | | X | | |
|
|
||||||
*
|
|
||||||
* Note that on macOS/iOS, the Videos folder is called "Movies".
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetUserFolder
|
|
||||||
*/
|
|
||||||
typedef enum SDL_Folder
|
|
||||||
{
|
|
||||||
SDL_FOLDER_HOME, /**< The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents. */
|
|
||||||
SDL_FOLDER_DESKTOP, /**< The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons. */
|
|
||||||
SDL_FOLDER_DOCUMENTS, /**< User document files, possibly application-specific. This is a good place to save a user's projects. */
|
|
||||||
SDL_FOLDER_DOWNLOADS, /**< Standard folder for user files downloaded from the internet. */
|
|
||||||
SDL_FOLDER_MUSIC, /**< Music files that can be played using a standard music player (mp3, ogg...). */
|
|
||||||
SDL_FOLDER_PICTURES, /**< Image files that can be displayed using a standard viewer (png, jpg...). */
|
|
||||||
SDL_FOLDER_PUBLICSHARE, /**< Files that are meant to be shared with other users on the same computer. */
|
|
||||||
SDL_FOLDER_SAVEDGAMES, /**< Save files for games. */
|
|
||||||
SDL_FOLDER_SCREENSHOTS, /**< Application screenshots. */
|
|
||||||
SDL_FOLDER_TEMPLATES, /**< Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as "New Text File.txt". Any file in the Templates folder can be used as a starting point for a new file. */
|
|
||||||
SDL_FOLDER_VIDEOS, /**< Video files that can be played using a standard video player (mp4, webm...). */
|
|
||||||
SDL_FOLDER_COUNT /**< Total number of types in this enum, not a folder type by itself. */
|
|
||||||
} SDL_Folder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds the most suitable user folder for a specific purpose.
|
|
||||||
*
|
|
||||||
* Many OSes provide certain standard folders for certain purposes, such as
|
|
||||||
* storing pictures, music or videos for a certain user. This function gives
|
|
||||||
* the path for many of those special locations.
|
|
||||||
*
|
|
||||||
* This function is specifically for _user_ folders, which are meant for the
|
|
||||||
* user to access and manage. For application-specific folders, meant to hold
|
|
||||||
* data for the application to manage, see SDL_GetBasePath() and
|
|
||||||
* SDL_GetPrefPath().
|
|
||||||
*
|
|
||||||
* The returned path is guaranteed to end with a path separator ('\\' on
|
|
||||||
* Windows, '/' on most other platforms).
|
|
||||||
*
|
|
||||||
* If NULL is returned, the error may be obtained with SDL_GetError().
|
|
||||||
*
|
|
||||||
* \param folder the type of folder to find.
|
|
||||||
* \returns either a null-terminated C string containing the full path to the
|
|
||||||
* folder, or NULL if an error happened.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetUserFolder(SDL_Folder folder);
|
|
||||||
|
|
||||||
|
|
||||||
/* Abstract filesystem interface */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Types of filesystem entries.
|
|
||||||
*
|
|
||||||
* Note that there may be other sorts of items on a filesystem: devices,
|
|
||||||
* symlinks, named pipes, etc. They are currently reported as
|
|
||||||
* SDL_PATHTYPE_OTHER.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_PathInfo
|
|
||||||
*/
|
|
||||||
typedef enum SDL_PathType
|
|
||||||
{
|
|
||||||
SDL_PATHTYPE_NONE, /**< path does not exist */
|
|
||||||
SDL_PATHTYPE_FILE, /**< a normal file */
|
|
||||||
SDL_PATHTYPE_DIRECTORY, /**< a directory */
|
|
||||||
SDL_PATHTYPE_OTHER /**< something completely different like a device node (not a symlink, those are always followed) */
|
|
||||||
} SDL_PathType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Information about a path on the filesystem.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetPathInfo
|
|
||||||
* \sa SDL_GetStoragePathInfo
|
|
||||||
*/
|
|
||||||
typedef struct SDL_PathInfo
|
|
||||||
{
|
|
||||||
SDL_PathType type; /**< the path type */
|
|
||||||
Uint64 size; /**< the file size in bytes */
|
|
||||||
SDL_Time create_time; /**< the time when the path was created */
|
|
||||||
SDL_Time modify_time; /**< the last time the path was modified */
|
|
||||||
SDL_Time access_time; /**< the last time the path was read */
|
|
||||||
} SDL_PathInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flags for path matching.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GlobDirectory
|
|
||||||
* \sa SDL_GlobStorageDirectory
|
|
||||||
*/
|
|
||||||
typedef Uint32 SDL_GlobFlags;
|
|
||||||
|
|
||||||
#define SDL_GLOB_CASEINSENSITIVE (1u << 0)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a directory, and any missing parent directories.
|
|
||||||
*
|
|
||||||
* This reports success if `path` already exists as a directory.
|
|
||||||
*
|
|
||||||
* If parent directories are missing, it will also create them. Note that if
|
|
||||||
* this fails, it will not remove any parent directories it already made.
|
|
||||||
*
|
|
||||||
* \param path the path of the directory to create.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_CreateDirectory(const char *path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Possible results from an enumeration callback.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_EnumerateDirectoryCallback
|
|
||||||
*/
|
|
||||||
typedef enum SDL_EnumerationResult
|
|
||||||
{
|
|
||||||
SDL_ENUM_CONTINUE, /**< Value that requests that enumeration continue. */
|
|
||||||
SDL_ENUM_SUCCESS, /**< Value that requests that enumeration stop, successfully. */
|
|
||||||
SDL_ENUM_FAILURE /**< Value that requests that enumeration stop, as a failure. */
|
|
||||||
} SDL_EnumerationResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback for directory enumeration.
|
|
||||||
*
|
|
||||||
* Enumeration of directory entries will continue until either all entries
|
|
||||||
* have been provided to the callback, or the callback has requested a stop
|
|
||||||
* through its return value.
|
|
||||||
*
|
|
||||||
* Returning SDL_ENUM_CONTINUE will let enumeration proceed, calling the
|
|
||||||
* callback with further entries. SDL_ENUM_SUCCESS and SDL_ENUM_FAILURE will
|
|
||||||
* terminate the enumeration early, and dictate the return value of the
|
|
||||||
* enumeration function itself.
|
|
||||||
*
|
|
||||||
* `dirname` is guaranteed to end with a path separator ('\\' on Windows, '/'
|
|
||||||
* on most other platforms).
|
|
||||||
*
|
|
||||||
* \param userdata an app-controlled pointer that is passed to the callback.
|
|
||||||
* \param dirname the directory that is being enumerated.
|
|
||||||
* \param fname the next entry in the enumeration.
|
|
||||||
* \returns how the enumeration should proceed.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_EnumerateDirectory
|
|
||||||
*/
|
|
||||||
typedef SDL_EnumerationResult (SDLCALL *SDL_EnumerateDirectoryCallback)(void *userdata, const char *dirname, const char *fname);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerate a directory through a callback function.
|
|
||||||
*
|
|
||||||
* This function provides every directory entry through an app-provided
|
|
||||||
* callback, called once for each directory entry, until all results have been
|
|
||||||
* provided or the callback returns either SDL_ENUM_SUCCESS or
|
|
||||||
* SDL_ENUM_FAILURE.
|
|
||||||
*
|
|
||||||
* This will return false if there was a system problem in general, or if a
|
|
||||||
* callback returns SDL_ENUM_FAILURE. A successful return means a callback
|
|
||||||
* returned SDL_ENUM_SUCCESS to halt enumeration, or all directory entries
|
|
||||||
* were enumerated.
|
|
||||||
*
|
|
||||||
* \param path the path of the directory to enumerate.
|
|
||||||
* \param callback a function that is called for each entry in the directory.
|
|
||||||
* \param userdata a pointer that is passed to `callback`.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a file or an empty directory.
|
|
||||||
*
|
|
||||||
* Directories that are not empty will fail; this function will not recursely
|
|
||||||
* delete directory trees.
|
|
||||||
*
|
|
||||||
* \param path the path to remove from the filesystem.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_RemovePath(const char *path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rename a file or directory.
|
|
||||||
*
|
|
||||||
* If the file at `newpath` already exists, it will replaced.
|
|
||||||
*
|
|
||||||
* Note that this will not copy files across filesystems/drives/volumes, as
|
|
||||||
* that is a much more complicated (and possibly time-consuming) operation.
|
|
||||||
*
|
|
||||||
* Which is to say, if this function fails, SDL_CopyFile() to a temporary file
|
|
||||||
* in the same directory as `newpath`, then SDL_RenamePath() from the
|
|
||||||
* temporary file to `newpath` and SDL_RemovePath() on `oldpath` might work
|
|
||||||
* for files. Renaming a non-empty directory across filesystems is
|
|
||||||
* dramatically more complex, however.
|
|
||||||
*
|
|
||||||
* \param oldpath the old path.
|
|
||||||
* \param newpath the new path.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy a file.
|
|
||||||
*
|
|
||||||
* If the file at `newpath` already exists, it will be overwritten with the
|
|
||||||
* contents of the file at `oldpath`.
|
|
||||||
*
|
|
||||||
* This function will block until the copy is complete, which might be a
|
|
||||||
* significant time for large files on slow disks. On some platforms, the copy
|
|
||||||
* can be handed off to the OS itself, but on others SDL might just open both
|
|
||||||
* paths, and read from one and write to the other.
|
|
||||||
*
|
|
||||||
* Note that this is not an atomic operation! If something tries to read from
|
|
||||||
* `newpath` while the copy is in progress, it will see an incomplete copy of
|
|
||||||
* the data, and if the calling thread terminates (or the power goes out)
|
|
||||||
* during the copy, `newpath`'s previous contents will be gone, replaced with
|
|
||||||
* an incomplete copy of the data. To avoid this risk, it is recommended that
|
|
||||||
* the app copy to a temporary file in the same directory as `newpath`, and if
|
|
||||||
* the copy is successful, use SDL_RenamePath() to replace `newpath` with the
|
|
||||||
* temporary file. This will ensure that reads of `newpath` will either see a
|
|
||||||
* complete copy of the data, or it will see the pre-copy state of `newpath`.
|
|
||||||
*
|
|
||||||
* This function attempts to synchronize the newly-copied data to disk before
|
|
||||||
* returning, if the platform allows it, so that the renaming trick will not
|
|
||||||
* have a problem in a system crash or power failure, where the file could be
|
|
||||||
* renamed but the contents never made it from the system file cache to the
|
|
||||||
* physical disk.
|
|
||||||
*
|
|
||||||
* If the copy fails for any reason, the state of `newpath` is undefined. It
|
|
||||||
* might be half a copy, it might be the untouched data of what was already
|
|
||||||
* there, or it might be a zero-byte file, etc.
|
|
||||||
*
|
|
||||||
* \param oldpath the old path.
|
|
||||||
* \param newpath the new path.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get information about a filesystem path.
|
|
||||||
*
|
|
||||||
* \param path the path to query.
|
|
||||||
* \param info a pointer filled in with information about the path, or NULL to
|
|
||||||
* check for the existence of a file.
|
|
||||||
* \returns true on success or false if the file doesn't exist, or another
|
|
||||||
* failure; call SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerate a directory tree, filtered by pattern, and return a list.
|
|
||||||
*
|
|
||||||
* Files are filtered out if they don't match the string in `pattern`, which
|
|
||||||
* may contain wildcard characters '\*' (match everything) and '?' (match one
|
|
||||||
* character). If pattern is NULL, no filtering is done and all results are
|
|
||||||
* returned. Subdirectories are permitted, and are specified with a path
|
|
||||||
* separator of '/'. Wildcard characters '\*' and '?' never match a path
|
|
||||||
* separator.
|
|
||||||
*
|
|
||||||
* `flags` may be set to SDL_GLOB_CASEINSENSITIVE to make the pattern matching
|
|
||||||
* case-insensitive.
|
|
||||||
*
|
|
||||||
* The returned array is always NULL-terminated, for your iterating
|
|
||||||
* convenience, but if `count` is non-NULL, on return it will contain the
|
|
||||||
* number of items in the array, not counting the NULL terminator.
|
|
||||||
*
|
|
||||||
* \param path the path of the directory to enumerate.
|
|
||||||
* \param pattern the pattern that files in the directory must match. Can be
|
|
||||||
* NULL.
|
|
||||||
* \param flags `SDL_GLOB_*` bitflags that affect this search.
|
|
||||||
* \param count on return, will be set to the number of items in the returned
|
|
||||||
* array. Can be NULL.
|
|
||||||
* \returns an array of strings on success or NULL on failure; call
|
|
||||||
* SDL_GetError() for more information. This is a single allocation
|
|
||||||
* that should be freed with SDL_free() when it is no longer needed.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get what the system believes is the "current working directory."
|
|
||||||
*
|
|
||||||
* For systems without a concept of a current working directory, this will
|
|
||||||
* still attempt to provide something reasonable.
|
|
||||||
*
|
|
||||||
* SDL does not provide a means to _change_ the current working directory; for
|
|
||||||
* platforms without this concept, this would cause surprises with file access
|
|
||||||
* outside of SDL.
|
|
||||||
*
|
|
||||||
* The returned path is guaranteed to end with a path separator ('\\' on
|
|
||||||
* Windows, '/' on most other platforms).
|
|
||||||
*
|
|
||||||
* \returns a UTF-8 string of the current working directory in
|
|
||||||
* platform-dependent notation. NULL if there's a problem. This
|
|
||||||
* should be freed with SDL_free() when it is no longer needed.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC char * SDLCALL SDL_GetCurrentDirectory(void);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_filesystem_h_ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WIKI CATEGORY: GUID */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryGUID
|
|
||||||
*
|
|
||||||
* A GUID is a 128-bit value that represents something that is uniquely
|
|
||||||
* identifiable by this value: "globally unique."
|
|
||||||
*
|
|
||||||
* SDL provides functions to convert a GUID to/from a string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_guid_h_
|
|
||||||
#define SDL_guid_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An SDL_GUID is a 128-bit identifier for an input device that identifies
|
|
||||||
* that device across runs of SDL programs on the same platform.
|
|
||||||
*
|
|
||||||
* If the device is detached and then re-attached to a different port, or if
|
|
||||||
* the base system is rebooted, the device should still report the same GUID.
|
|
||||||
*
|
|
||||||
* GUIDs are as precise as possible but are not guaranteed to distinguish
|
|
||||||
* physically distinct but equivalent devices. For example, two game
|
|
||||||
* controllers from the same vendor with the same product ID and revision may
|
|
||||||
* have the same GUID.
|
|
||||||
*
|
|
||||||
* GUIDs may be platform-dependent (i.e., the same device may report different
|
|
||||||
* GUIDs on different operating systems).
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_GUID {
|
|
||||||
Uint8 data[16];
|
|
||||||
} SDL_GUID;
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an ASCII string representation for a given SDL_GUID.
|
|
||||||
*
|
|
||||||
* \param guid the SDL_GUID you wish to convert to string.
|
|
||||||
* \param pszGUID buffer in which to write the ASCII string.
|
|
||||||
* \param cbGUID the size of pszGUID, should be at least 33 bytes.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_StringToGUID
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a GUID string into a SDL_GUID structure.
|
|
||||||
*
|
|
||||||
* Performs no error checking. If this function is given a string containing
|
|
||||||
* an invalid GUID, the function will silently succeed, but the GUID generated
|
|
||||||
* will not be useful.
|
|
||||||
*
|
|
||||||
* \param pchGUID string containing an ASCII representation of a GUID.
|
|
||||||
* \returns a SDL_GUID structure.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GUIDToString
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_guid_h_ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,552 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WIKI CATEGORY: HIDAPI */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryHIDAPI
|
|
||||||
*
|
|
||||||
* Header file for SDL HIDAPI functions.
|
|
||||||
*
|
|
||||||
* This is an adaptation of the original HIDAPI interface by Alan Ott, and
|
|
||||||
* includes source code licensed under the following license:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* HIDAPI - Multi-Platform library for
|
|
||||||
* communication with HID devices.
|
|
||||||
*
|
|
||||||
* Copyright 2009, Alan Ott, Signal 11 Software.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This software may be used by anyone for any reason so
|
|
||||||
* long as the copyright notice in the source files
|
|
||||||
* remains intact.
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* (Note that this license is the same as item three of SDL's zlib license, so
|
|
||||||
* it adds no new requirements on the user.)
|
|
||||||
*
|
|
||||||
* If you would like a version of SDL without this code, you can build SDL
|
|
||||||
* with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for
|
|
||||||
* example on iOS or tvOS to avoid a dependency on the CoreBluetooth
|
|
||||||
* framework.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_hidapi_h_
|
|
||||||
#define SDL_hidapi_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An opaque handle representing an open HID device.
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_hid_device SDL_hid_device;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HID underlying bus types.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef enum SDL_hid_bus_type {
|
|
||||||
/** Unknown bus type */
|
|
||||||
SDL_HID_API_BUS_UNKNOWN = 0x00,
|
|
||||||
|
|
||||||
/** USB bus
|
|
||||||
Specifications:
|
|
||||||
https://usb.org/hid */
|
|
||||||
SDL_HID_API_BUS_USB = 0x01,
|
|
||||||
|
|
||||||
/** Bluetooth or Bluetooth LE bus
|
|
||||||
Specifications:
|
|
||||||
https://www.bluetooth.com/specifications/specs/human-interface-device-profile-1-1-1/
|
|
||||||
https://www.bluetooth.com/specifications/specs/hid-service-1-0/
|
|
||||||
https://www.bluetooth.com/specifications/specs/hid-over-gatt-profile-1-0/ */
|
|
||||||
SDL_HID_API_BUS_BLUETOOTH = 0x02,
|
|
||||||
|
|
||||||
/** I2C bus
|
|
||||||
Specifications:
|
|
||||||
https://docs.microsoft.com/previous-versions/windows/hardware/design/dn642101(v=vs.85) */
|
|
||||||
SDL_HID_API_BUS_I2C = 0x03,
|
|
||||||
|
|
||||||
/** SPI bus
|
|
||||||
Specifications:
|
|
||||||
https://www.microsoft.com/download/details.aspx?id=103325 */
|
|
||||||
SDL_HID_API_BUS_SPI = 0x04
|
|
||||||
|
|
||||||
} SDL_hid_bus_type;
|
|
||||||
|
|
||||||
/** hidapi info structure */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Information about a connected HID device
|
|
||||||
*
|
|
||||||
* \since This struct is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef struct SDL_hid_device_info
|
|
||||||
{
|
|
||||||
/** Platform-specific device path */
|
|
||||||
char *path;
|
|
||||||
/** Device Vendor ID */
|
|
||||||
unsigned short vendor_id;
|
|
||||||
/** Device Product ID */
|
|
||||||
unsigned short product_id;
|
|
||||||
/** Serial Number */
|
|
||||||
wchar_t *serial_number;
|
|
||||||
/** Device Release Number in binary-coded decimal,
|
|
||||||
also known as Device Version Number */
|
|
||||||
unsigned short release_number;
|
|
||||||
/** Manufacturer String */
|
|
||||||
wchar_t *manufacturer_string;
|
|
||||||
/** Product string */
|
|
||||||
wchar_t *product_string;
|
|
||||||
/** Usage Page for this Device/Interface
|
|
||||||
(Windows/Mac/hidraw only) */
|
|
||||||
unsigned short usage_page;
|
|
||||||
/** Usage for this Device/Interface
|
|
||||||
(Windows/Mac/hidraw only) */
|
|
||||||
unsigned short usage;
|
|
||||||
/** The USB interface which this logical device
|
|
||||||
represents.
|
|
||||||
|
|
||||||
Valid only if the device is a USB HID device.
|
|
||||||
Set to -1 in all other cases.
|
|
||||||
*/
|
|
||||||
int interface_number;
|
|
||||||
|
|
||||||
/** Additional information about the USB interface.
|
|
||||||
Valid on libusb and Android implementations. */
|
|
||||||
int interface_class;
|
|
||||||
int interface_subclass;
|
|
||||||
int interface_protocol;
|
|
||||||
|
|
||||||
/** Underlying bus type */
|
|
||||||
SDL_hid_bus_type bus_type;
|
|
||||||
|
|
||||||
/** Pointer to the next device */
|
|
||||||
struct SDL_hid_device_info *next;
|
|
||||||
|
|
||||||
} SDL_hid_device_info;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the HIDAPI library.
|
|
||||||
*
|
|
||||||
* This function initializes the HIDAPI library. Calling it is not strictly
|
|
||||||
* necessary, as it will be called automatically by SDL_hid_enumerate() and
|
|
||||||
* any of the SDL_hid_open_*() functions if it is needed. This function should
|
|
||||||
* be called at the beginning of execution however, if there is a chance of
|
|
||||||
* HIDAPI handles being opened by different threads simultaneously.
|
|
||||||
*
|
|
||||||
* Each call to this function should have a matching call to SDL_hid_exit()
|
|
||||||
*
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_hid_exit
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_init(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finalize the HIDAPI library.
|
|
||||||
*
|
|
||||||
* This function frees all of the static data associated with HIDAPI. It
|
|
||||||
* should be called at the end of execution to avoid memory leaks.
|
|
||||||
*
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_hid_init
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_exit(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check to see if devices may have been added or removed.
|
|
||||||
*
|
|
||||||
* Enumerating the HID devices is an expensive operation, so you can call this
|
|
||||||
* to see if there have been any system device changes since the last call to
|
|
||||||
* this function. A change in the counter returned doesn't necessarily mean
|
|
||||||
* that anything has changed, but you can call SDL_hid_enumerate() to get an
|
|
||||||
* updated device list.
|
|
||||||
*
|
|
||||||
* Calling this function for the first time may cause a thread or other system
|
|
||||||
* resource to be allocated to track device change notifications.
|
|
||||||
*
|
|
||||||
* \returns a change counter that is incremented with each potential device
|
|
||||||
* change, or 0 if device change detection isn't available.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_hid_enumerate
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enumerate the HID Devices.
|
|
||||||
*
|
|
||||||
* This function returns a linked list of all the HID devices attached to the
|
|
||||||
* system which match vendor_id and product_id. If `vendor_id` is set to 0
|
|
||||||
* then any vendor matches. If `product_id` is set to 0 then any product
|
|
||||||
* matches. If `vendor_id` and `product_id` are both set to 0, then all HID
|
|
||||||
* devices will be returned.
|
|
||||||
*
|
|
||||||
* By default SDL will only enumerate controllers, to reduce risk of hanging
|
|
||||||
* or crashing on bad drivers, but SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS
|
|
||||||
* can be set to "0" to enumerate all HID devices.
|
|
||||||
*
|
|
||||||
* \param vendor_id the Vendor ID (VID) of the types of device to open, or 0
|
|
||||||
* to match any vendor.
|
|
||||||
* \param product_id the Product ID (PID) of the types of device to open, or 0
|
|
||||||
* to match any product.
|
|
||||||
* \returns a pointer to a linked list of type SDL_hid_device_info, containing
|
|
||||||
* information about the HID devices attached to the system, or NULL
|
|
||||||
* in the case of failure. Free this linked list by calling
|
|
||||||
* SDL_hid_free_enumeration().
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_hid_device_change_count
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free an enumeration linked list.
|
|
||||||
*
|
|
||||||
* This function frees a linked list created by SDL_hid_enumerate().
|
|
||||||
*
|
|
||||||
* \param devs pointer to a list of struct_device returned from
|
|
||||||
* SDL_hid_enumerate().
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally
|
|
||||||
* a serial number.
|
|
||||||
*
|
|
||||||
* If `serial_number` is NULL, the first device with the specified VID and PID
|
|
||||||
* is opened.
|
|
||||||
*
|
|
||||||
* \param vendor_id the Vendor ID (VID) of the device to open.
|
|
||||||
* \param product_id the Product ID (PID) of the device to open.
|
|
||||||
* \param serial_number the Serial Number of the device to open (Optionally
|
|
||||||
* NULL).
|
|
||||||
* \returns a pointer to a SDL_hid_device object on success or NULL on
|
|
||||||
* failure; call SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open a HID device by its path name.
|
|
||||||
*
|
|
||||||
* The path name be determined by calling SDL_hid_enumerate(), or a
|
|
||||||
* platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
|
|
||||||
*
|
|
||||||
* \param path the path name of the device to open.
|
|
||||||
* \returns a pointer to a SDL_hid_device object on success or NULL on
|
|
||||||
* failure; call SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write an Output report to a HID device.
|
|
||||||
*
|
|
||||||
* The first byte of `data` must contain the Report ID. For devices which only
|
|
||||||
* support a single report, this must be set to 0x0. The remaining bytes
|
|
||||||
* contain the report data. Since the Report ID is mandatory, calls to
|
|
||||||
* SDL_hid_write() will always contain one more byte than the report contains.
|
|
||||||
* For example, if a hid report is 16 bytes long, 17 bytes must be passed to
|
|
||||||
* SDL_hid_write(), the Report ID (or 0x0, for devices with a single report),
|
|
||||||
* followed by the report data (16 bytes). In this example, the length passed
|
|
||||||
* in would be 17.
|
|
||||||
*
|
|
||||||
* SDL_hid_write() will send the data on the first OUT endpoint, if one
|
|
||||||
* exists. If it does not, it will send the data through the Control Endpoint
|
|
||||||
* (Endpoint 0).
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param data the data to send, including the report number as the first
|
|
||||||
* byte.
|
|
||||||
* \param length the length in bytes of the data to send.
|
|
||||||
* \returns the actual number of bytes written and -1 on on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read an Input report from a HID device with timeout.
|
|
||||||
*
|
|
||||||
* Input reports are returned to the host through the INTERRUPT IN endpoint.
|
|
||||||
* The first byte will contain the Report number if the device uses numbered
|
|
||||||
* reports.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param data a buffer to put the read data into.
|
|
||||||
* \param length the number of bytes to read. For devices with multiple
|
|
||||||
* reports, make sure to read an extra byte for the report
|
|
||||||
* number.
|
|
||||||
* \param milliseconds timeout in milliseconds or -1 for blocking wait.
|
|
||||||
* \returns the actual number of bytes read and -1 on on failure; call
|
|
||||||
* SDL_GetError() for more information. If no packet was available to
|
|
||||||
* be read within the timeout period, this function returns 0.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read an Input report from a HID device.
|
|
||||||
*
|
|
||||||
* Input reports are returned to the host through the INTERRUPT IN endpoint.
|
|
||||||
* The first byte will contain the Report number if the device uses numbered
|
|
||||||
* reports.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param data a buffer to put the read data into.
|
|
||||||
* \param length the number of bytes to read. For devices with multiple
|
|
||||||
* reports, make sure to read an extra byte for the report
|
|
||||||
* number.
|
|
||||||
* \returns the actual number of bytes read and -1 on failure; call
|
|
||||||
* SDL_GetError() for more information. If no packet was available to
|
|
||||||
* be read and the handle is in non-blocking mode, this function
|
|
||||||
* returns 0.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the device handle to be non-blocking.
|
|
||||||
*
|
|
||||||
* In non-blocking mode calls to SDL_hid_read() will return immediately with a
|
|
||||||
* value of 0 if there is no data to be read. In blocking mode, SDL_hid_read()
|
|
||||||
* will wait (block) until there is data to read before returning.
|
|
||||||
*
|
|
||||||
* Nonblocking can be turned on and off at any time.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param nonblock enable or not the nonblocking reads - 1 to enable
|
|
||||||
* nonblocking - 0 to disable nonblocking.
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a Feature report to the device.
|
|
||||||
*
|
|
||||||
* Feature reports are sent over the Control endpoint as a Set_Report
|
|
||||||
* transfer. The first byte of `data` must contain the Report ID. For devices
|
|
||||||
* which only support a single report, this must be set to 0x0. The remaining
|
|
||||||
* bytes contain the report data. Since the Report ID is mandatory, calls to
|
|
||||||
* SDL_hid_send_feature_report() will always contain one more byte than the
|
|
||||||
* report contains. For example, if a hid report is 16 bytes long, 17 bytes
|
|
||||||
* must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for
|
|
||||||
* devices which do not use numbered reports), followed by the report data (16
|
|
||||||
* bytes). In this example, the length passed in would be 17.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param data the data to send, including the report number as the first
|
|
||||||
* byte.
|
|
||||||
* \param length the length in bytes of the data to send, including the report
|
|
||||||
* number.
|
|
||||||
* \returns the actual number of bytes written and -1 on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a feature report from a HID device.
|
|
||||||
*
|
|
||||||
* Set the first byte of `data` to the Report ID of the report to be read.
|
|
||||||
* Make sure to allow space for this extra byte in `data`. Upon return, the
|
|
||||||
* first byte will still contain the Report ID, and the report data will start
|
|
||||||
* in data[1].
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param data a buffer to put the read data into, including the Report ID.
|
|
||||||
* Set the first byte of `data` to the Report ID of the report to
|
|
||||||
* be read, or set it to zero if your device does not use numbered
|
|
||||||
* reports.
|
|
||||||
* \param length the number of bytes to read, including an extra byte for the
|
|
||||||
* report ID. The buffer can be longer than the actual report.
|
|
||||||
* \returns the number of bytes read plus one for the report ID (which is
|
|
||||||
* still in the first byte), or -1 on on failure; call SDL_GetError()
|
|
||||||
* for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an input report from a HID device.
|
|
||||||
*
|
|
||||||
* Set the first byte of `data` to the Report ID of the report to be read.
|
|
||||||
* Make sure to allow space for this extra byte in `data`. Upon return, the
|
|
||||||
* first byte will still contain the Report ID, and the report data will start
|
|
||||||
* in data[1].
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param data a buffer to put the read data into, including the Report ID.
|
|
||||||
* Set the first byte of `data` to the Report ID of the report to
|
|
||||||
* be read, or set it to zero if your device does not use numbered
|
|
||||||
* reports.
|
|
||||||
* \param length the number of bytes to read, including an extra byte for the
|
|
||||||
* report ID. The buffer can be longer than the actual report.
|
|
||||||
* \returns the number of bytes read plus one for the report ID (which is
|
|
||||||
* still in the first byte), or -1 on on failure; call SDL_GetError()
|
|
||||||
* for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_input_report(SDL_hid_device *dev, unsigned char *data, size_t length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close a HID device.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_close(SDL_hid_device *dev);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get The Manufacturer String from a HID device.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param string a wide string buffer to put the data into.
|
|
||||||
* \param maxlen the length of the buffer in multiples of wchar_t.
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get The Product String from a HID device.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param string a wide string buffer to put the data into.
|
|
||||||
* \param maxlen the length of the buffer in multiples of wchar_t.
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get The Serial Number String from a HID device.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param string a wide string buffer to put the data into.
|
|
||||||
* \param maxlen the length of the buffer in multiples of wchar_t.
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a string from a HID device, based on its string index.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param string_index the index of the string to get.
|
|
||||||
* \param string a wide string buffer to put the data into.
|
|
||||||
* \param maxlen the length of the buffer in multiples of wchar_t.
|
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the device info from a HID device.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \returns a pointer to the SDL_hid_device_info for this hid_device or NULL
|
|
||||||
* on failure; call SDL_GetError() for more information. This struct
|
|
||||||
* is valid until the device is closed with SDL_hid_close().
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_get_device_info(SDL_hid_device *dev);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a report descriptor from a HID device.
|
|
||||||
*
|
|
||||||
* User has to provide a preallocated buffer where descriptor will be copied
|
|
||||||
* to. The recommended size for a preallocated buffer is 4096 bytes.
|
|
||||||
*
|
|
||||||
* \param dev a device handle returned from SDL_hid_open().
|
|
||||||
* \param buf the buffer to copy descriptor into.
|
|
||||||
* \param buf_size the size of the buffer in bytes.
|
|
||||||
* \returns the number of bytes actually copied or -1 on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_hid_get_report_descriptor(SDL_hid_device *dev, unsigned char *buf, size_t buf_size);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers.
|
|
||||||
*
|
|
||||||
* \param active true to start the scan, false to stop the scan.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_hid_ble_scan(bool active);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_hidapi_h_ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,497 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryInit
|
|
||||||
*
|
|
||||||
* All SDL programs need to initialize the library before starting to work
|
|
||||||
* with it.
|
|
||||||
*
|
|
||||||
* Almost everything can simply call SDL_Init() near startup, with a handful
|
|
||||||
* of flags to specify subsystems to touch. These are here to make sure SDL
|
|
||||||
* does not even attempt to touch low-level pieces of the operating system
|
|
||||||
* that you don't intend to use. For example, you might be using SDL for video
|
|
||||||
* and input but chose an external library for audio, and in this case you
|
|
||||||
* would just need to leave off the `SDL_INIT_AUDIO` flag to make sure that
|
|
||||||
* external library has complete control.
|
|
||||||
*
|
|
||||||
* Most apps, when terminating, should call SDL_Quit(). This will clean up
|
|
||||||
* (nearly) everything that SDL might have allocated, and crucially, it'll
|
|
||||||
* make sure that the display's resolution is back to what the user expects if
|
|
||||||
* you had previously changed it for your game.
|
|
||||||
*
|
|
||||||
* SDL3 apps are strongly encouraged to call SDL_SetAppMetadata() at startup
|
|
||||||
* to fill in details about the program. This is completely optional, but it
|
|
||||||
* helps in small ways (we can provide an About dialog box for the macOS menu,
|
|
||||||
* we can name the app in the system's audio mixer, etc). Those that want to
|
|
||||||
* provide a _lot_ of information should look at the more-detailed
|
|
||||||
* SDL_SetAppMetadataProperty().
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_init_h_
|
|
||||||
#define SDL_init_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
#include <SDL3/SDL_events.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialization flags for SDL_Init and/or SDL_InitSubSystem
|
|
||||||
*
|
|
||||||
* These are the flags which may be passed to SDL_Init(). You should specify
|
|
||||||
* the subsystems which you will be using in your application.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_Init
|
|
||||||
* \sa SDL_Quit
|
|
||||||
* \sa SDL_InitSubSystem
|
|
||||||
* \sa SDL_QuitSubSystem
|
|
||||||
* \sa SDL_WasInit
|
|
||||||
*/
|
|
||||||
typedef Uint32 SDL_InitFlags;
|
|
||||||
|
|
||||||
#define SDL_INIT_AUDIO 0x00000010u /**< `SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS` */
|
|
||||||
#define SDL_INIT_VIDEO 0x00000020u /**< `SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`, should be initialized on the main thread */
|
|
||||||
#define SDL_INIT_JOYSTICK 0x00000200u /**< `SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS` */
|
|
||||||
#define SDL_INIT_HAPTIC 0x00001000u
|
|
||||||
#define SDL_INIT_GAMEPAD 0x00002000u /**< `SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK` */
|
|
||||||
#define SDL_INIT_EVENTS 0x00004000u
|
|
||||||
#define SDL_INIT_SENSOR 0x00008000u /**< `SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS` */
|
|
||||||
#define SDL_INIT_CAMERA 0x00010000u /**< `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return values for optional main callbacks.
|
|
||||||
*
|
|
||||||
* Returning SDL_APP_SUCCESS or SDL_APP_FAILURE from SDL_AppInit,
|
|
||||||
* SDL_AppEvent, or SDL_AppIterate will terminate the program and report
|
|
||||||
* success/failure to the operating system. What that means is
|
|
||||||
* platform-dependent. On Unix, for example, on success, the process error
|
|
||||||
* code will be zero, and on failure it will be 1. This interface doesn't
|
|
||||||
* allow you to return specific exit codes, just whether there was an error
|
|
||||||
* generally or not.
|
|
||||||
*
|
|
||||||
* Returning SDL_APP_CONTINUE from these functions will let the app continue
|
|
||||||
* to run.
|
|
||||||
*
|
|
||||||
* See
|
|
||||||
* [Main callbacks in SDL3](https://wiki.libsdl.org/SDL3/README/main-functions#main-callbacks-in-sdl3)
|
|
||||||
* for complete details.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef enum SDL_AppResult
|
|
||||||
{
|
|
||||||
SDL_APP_CONTINUE, /**< Value that requests that the app continue from the main callbacks. */
|
|
||||||
SDL_APP_SUCCESS, /**< Value that requests termination with success from the main callbacks. */
|
|
||||||
SDL_APP_FAILURE /**< Value that requests termination with error from the main callbacks. */
|
|
||||||
} SDL_AppResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function pointer typedef for SDL_AppInit.
|
|
||||||
*
|
|
||||||
* These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind
|
|
||||||
* the scenes for apps using the optional main callbacks. Apps that want to
|
|
||||||
* use this should just implement SDL_AppInit directly.
|
|
||||||
*
|
|
||||||
* \param appstate a place where the app can optionally store a pointer for
|
|
||||||
* future use.
|
|
||||||
* \param argc the standard ANSI C main's argc; number of elements in `argv`.
|
|
||||||
* \param argv the standard ANSI C main's argv; array of command line
|
|
||||||
* arguments.
|
|
||||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
|
||||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function pointer typedef for SDL_AppIterate.
|
|
||||||
*
|
|
||||||
* These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind
|
|
||||||
* the scenes for apps using the optional main callbacks. Apps that want to
|
|
||||||
* use this should just implement SDL_AppIterate directly.
|
|
||||||
*
|
|
||||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
|
||||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
|
||||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef SDL_AppResult (SDLCALL *SDL_AppIterate_func)(void *appstate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function pointer typedef for SDL_AppEvent.
|
|
||||||
*
|
|
||||||
* These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind
|
|
||||||
* the scenes for apps using the optional main callbacks. Apps that want to
|
|
||||||
* use this should just implement SDL_AppEvent directly.
|
|
||||||
*
|
|
||||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
|
||||||
* \param event the new event for the app to examine.
|
|
||||||
* \returns SDL_APP_FAILURE to terminate with an error, SDL_APP_SUCCESS to
|
|
||||||
* terminate with success, SDL_APP_CONTINUE to continue.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef SDL_AppResult (SDLCALL *SDL_AppEvent_func)(void *appstate, SDL_Event *event);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function pointer typedef for SDL_AppQuit.
|
|
||||||
*
|
|
||||||
* These are used by SDL_EnterAppMainCallbacks. This mechanism operates behind
|
|
||||||
* the scenes for apps using the optional main callbacks. Apps that want to
|
|
||||||
* use this should just implement SDL_AppEvent directly.
|
|
||||||
*
|
|
||||||
* \param appstate an optional pointer, provided by the app in SDL_AppInit.
|
|
||||||
* \param result the result code that terminated the app (success or failure).
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate, SDL_AppResult result);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the SDL library.
|
|
||||||
*
|
|
||||||
* SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the
|
|
||||||
* two may be used interchangeably. Though for readability of your code
|
|
||||||
* SDL_InitSubSystem() might be preferred.
|
|
||||||
*
|
|
||||||
* The file I/O (for example: SDL_IOFromFile) and threading (SDL_CreateThread)
|
|
||||||
* subsystems are initialized by default. Message boxes
|
|
||||||
* (SDL_ShowSimpleMessageBox) also attempt to work without initializing the
|
|
||||||
* video subsystem, in hopes of being useful in showing an error dialog when
|
|
||||||
* SDL_Init fails. You must specifically initialize other subsystems if you
|
|
||||||
* use them in your application.
|
|
||||||
*
|
|
||||||
* Logging (such as SDL_Log) works without initialization, too.
|
|
||||||
*
|
|
||||||
* `flags` may be any of the following OR'd together:
|
|
||||||
*
|
|
||||||
* - `SDL_INIT_AUDIO`: audio subsystem; automatically initializes the events
|
|
||||||
* subsystem
|
|
||||||
* - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events
|
|
||||||
* subsystem, should be initialized on the main thread.
|
|
||||||
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
|
|
||||||
* events subsystem
|
|
||||||
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
|
|
||||||
* - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically initializes the
|
|
||||||
* joystick subsystem
|
|
||||||
* - `SDL_INIT_EVENTS`: events subsystem
|
|
||||||
* - `SDL_INIT_SENSOR`: sensor subsystem; automatically initializes the events
|
|
||||||
* subsystem
|
|
||||||
* - `SDL_INIT_CAMERA`: camera subsystem; automatically initializes the events
|
|
||||||
* subsystem
|
|
||||||
*
|
|
||||||
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
|
|
||||||
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or
|
|
||||||
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then
|
|
||||||
* this call will increase the ref-count and return.
|
|
||||||
*
|
|
||||||
* Consider reporting some basic metadata about your application before
|
|
||||||
* calling SDL_Init, using either SDL_SetAppMetadata() or
|
|
||||||
* SDL_SetAppMetadataProperty().
|
|
||||||
*
|
|
||||||
* \param flags subsystem initialization flags.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetAppMetadata
|
|
||||||
* \sa SDL_SetAppMetadataProperty
|
|
||||||
* \sa SDL_InitSubSystem
|
|
||||||
* \sa SDL_Quit
|
|
||||||
* \sa SDL_SetMainReady
|
|
||||||
* \sa SDL_WasInit
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_Init(SDL_InitFlags flags);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compatibility function to initialize the SDL library.
|
|
||||||
*
|
|
||||||
* This function and SDL_Init() are interchangeable.
|
|
||||||
*
|
|
||||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_Init
|
|
||||||
* \sa SDL_Quit
|
|
||||||
* \sa SDL_QuitSubSystem
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_InitSubSystem(SDL_InitFlags flags);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shut down specific SDL subsystems.
|
|
||||||
*
|
|
||||||
* You still need to call SDL_Quit() even if you close all open subsystems
|
|
||||||
* with SDL_QuitSubSystem().
|
|
||||||
*
|
|
||||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_InitSubSystem
|
|
||||||
* \sa SDL_Quit
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_QuitSubSystem(SDL_InitFlags flags);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a mask of the specified subsystems which are currently initialized.
|
|
||||||
*
|
|
||||||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
|
|
||||||
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
|
|
||||||
* returns the initialization status of the specified subsystems.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_Init
|
|
||||||
* \sa SDL_InitSubSystem
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_InitFlags SDLCALL SDL_WasInit(SDL_InitFlags flags);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clean up all initialized subsystems.
|
|
||||||
*
|
|
||||||
* You should call this function even if you have already shutdown each
|
|
||||||
* initialized subsystem with SDL_QuitSubSystem(). It is safe to call this
|
|
||||||
* function even in the case of errors in initialization.
|
|
||||||
*
|
|
||||||
* You can use this function with atexit() to ensure that it is run when your
|
|
||||||
* application is shutdown, but it is not wise to do this from a library or
|
|
||||||
* other dynamically loaded code.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_Init
|
|
||||||
* \sa SDL_QuitSubSystem
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_Quit(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether this is the main thread.
|
|
||||||
*
|
|
||||||
* On Apple platforms, the main thread is the thread that runs your program's
|
|
||||||
* main() entry point. On other platforms, the main thread is the one that
|
|
||||||
* calls SDL_Init(SDL_INIT_VIDEO), which should usually be the one that runs
|
|
||||||
* your program's main() entry point. If you are using the main callbacks,
|
|
||||||
* SDL_AppInit(), SDL_AppIterate(), and SDL_AppQuit() are all called on the
|
|
||||||
* main thread.
|
|
||||||
*
|
|
||||||
* \returns true if this thread is the main thread, or false otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_RunOnMainThread
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_IsMainThread(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback run on the main thread.
|
|
||||||
*
|
|
||||||
* \param userdata an app-controlled pointer that is passed to the callback.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_RunOnMainThread
|
|
||||||
*/
|
|
||||||
typedef void (SDLCALL *SDL_MainThreadCallback)(void *userdata);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call a function on the main thread during event processing.
|
|
||||||
*
|
|
||||||
* If this is called on the main thread, the callback is executed immediately.
|
|
||||||
* If this is called on another thread, this callback is queued for execution
|
|
||||||
* on the main thread during event processing.
|
|
||||||
*
|
|
||||||
* Be careful of deadlocks when using this functionality. You should not have
|
|
||||||
* the main thread wait for the current thread while this function is being
|
|
||||||
* called with `wait_complete` true.
|
|
||||||
*
|
|
||||||
* \param callback the callback to call on the main thread.
|
|
||||||
* \param userdata a pointer that is passed to `callback`.
|
|
||||||
* \param wait_complete true to wait for the callback to complete, false to
|
|
||||||
* return immediately.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_IsMainThread
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_RunOnMainThread(SDL_MainThreadCallback callback, void *userdata, bool wait_complete);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specify basic metadata about your app.
|
|
||||||
*
|
|
||||||
* You can optionally provide metadata about your app to SDL. This is not
|
|
||||||
* required, but strongly encouraged.
|
|
||||||
*
|
|
||||||
* There are several locations where SDL can make use of metadata (an "About"
|
|
||||||
* box in the macOS menu bar, the name of the app can be shown on some audio
|
|
||||||
* mixers, etc). Any piece of metadata can be left as NULL, if a specific
|
|
||||||
* detail doesn't make sense for the app.
|
|
||||||
*
|
|
||||||
* This function should be called as early as possible, before SDL_Init.
|
|
||||||
* Multiple calls to this function are allowed, but various state might not
|
|
||||||
* change once it has been set up with a previous call to this function.
|
|
||||||
*
|
|
||||||
* Passing a NULL removes any previous metadata.
|
|
||||||
*
|
|
||||||
* This is a simplified interface for the most important information. You can
|
|
||||||
* supply significantly more detailed metadata with
|
|
||||||
* SDL_SetAppMetadataProperty().
|
|
||||||
*
|
|
||||||
* \param appname The name of the application ("My Game 2: Bad Guy's
|
|
||||||
* Revenge!").
|
|
||||||
* \param appversion The version of the application ("1.0.0beta5" or a git
|
|
||||||
* hash, or whatever makes sense).
|
|
||||||
* \param appidentifier A unique string in reverse-domain format that
|
|
||||||
* identifies this app ("com.example.mygame2").
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetAppMetadataProperty
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specify metadata about your app through a set of properties.
|
|
||||||
*
|
|
||||||
* You can optionally provide metadata about your app to SDL. This is not
|
|
||||||
* required, but strongly encouraged.
|
|
||||||
*
|
|
||||||
* There are several locations where SDL can make use of metadata (an "About"
|
|
||||||
* box in the macOS menu bar, the name of the app can be shown on some audio
|
|
||||||
* mixers, etc). Any piece of metadata can be left out, if a specific detail
|
|
||||||
* doesn't make sense for the app.
|
|
||||||
*
|
|
||||||
* This function should be called as early as possible, before SDL_Init.
|
|
||||||
* Multiple calls to this function are allowed, but various state might not
|
|
||||||
* change once it has been set up with a previous call to this function.
|
|
||||||
*
|
|
||||||
* Once set, this metadata can be read using SDL_GetAppMetadataProperty().
|
|
||||||
*
|
|
||||||
* These are the supported properties:
|
|
||||||
*
|
|
||||||
* - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of the
|
|
||||||
* application, like "My Game 2: Bad Guy's Revenge!". This will show up
|
|
||||||
* anywhere the OS shows the name of the application separately from window
|
|
||||||
* titles, such as volume control applets, etc. This defaults to "SDL
|
|
||||||
* Application".
|
|
||||||
* - `SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is
|
|
||||||
* running; there are no rules on format, so "1.0.3beta2" and "April 22nd,
|
|
||||||
* 2024" and a git hash are all valid options. This has no default.
|
|
||||||
* - `SDL_PROP_APP_METADATA_IDENTIFIER_STRING`: A unique string that
|
|
||||||
* identifies this app. This must be in reverse-domain format, like
|
|
||||||
* "com.example.mygame2". This string is used by desktop compositors to
|
|
||||||
* identify and group windows together, as well as match applications with
|
|
||||||
* associated desktop settings and icons. If you plan to package your
|
|
||||||
* application in a container such as Flatpak, the app ID should match the
|
|
||||||
* name of your Flatpak container as well. This has no default.
|
|
||||||
* - `SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the
|
|
||||||
* creator/developer/maker of this app, like "MojoWorkshop, LLC"
|
|
||||||
* - `SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright
|
|
||||||
* notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this
|
|
||||||
* to one line, don't paste a copy of a whole software license in here. This
|
|
||||||
* has no default.
|
|
||||||
* - `SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a
|
|
||||||
* product page, or a storefront, or even a GitHub repository, for user's
|
|
||||||
* further information This has no default.
|
|
||||||
* - `SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is.
|
|
||||||
* Currently this string can be "game" for a video game, "mediaplayer" for a
|
|
||||||
* media player, or generically "application" if nothing else applies.
|
|
||||||
* Future versions of SDL might add new types. This defaults to
|
|
||||||
* "application".
|
|
||||||
*
|
|
||||||
* \param name the name of the metadata property to set.
|
|
||||||
* \param value the value of the property, or NULL to remove that property.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetAppMetadataProperty
|
|
||||||
* \sa SDL_SetAppMetadata
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value);
|
|
||||||
|
|
||||||
#define SDL_PROP_APP_METADATA_NAME_STRING "SDL.app.metadata.name"
|
|
||||||
#define SDL_PROP_APP_METADATA_VERSION_STRING "SDL.app.metadata.version"
|
|
||||||
#define SDL_PROP_APP_METADATA_IDENTIFIER_STRING "SDL.app.metadata.identifier"
|
|
||||||
#define SDL_PROP_APP_METADATA_CREATOR_STRING "SDL.app.metadata.creator"
|
|
||||||
#define SDL_PROP_APP_METADATA_COPYRIGHT_STRING "SDL.app.metadata.copyright"
|
|
||||||
#define SDL_PROP_APP_METADATA_URL_STRING "SDL.app.metadata.url"
|
|
||||||
#define SDL_PROP_APP_METADATA_TYPE_STRING "SDL.app.metadata.type"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get metadata about your app.
|
|
||||||
*
|
|
||||||
* This returns metadata previously set using SDL_SetAppMetadata() or
|
|
||||||
* SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list
|
|
||||||
* of available properties and their meanings.
|
|
||||||
*
|
|
||||||
* \param name the name of the metadata property to get.
|
|
||||||
* \returns the current value of the metadata property, or the default if it
|
|
||||||
* is not set, NULL for properties with no default.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread, although
|
|
||||||
* the string returned is not protected and could potentially be
|
|
||||||
* freed if you call SDL_SetAppMetadataProperty() to set that
|
|
||||||
* property from another thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetAppMetadata
|
|
||||||
* \sa SDL_SetAppMetadataProperty
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetAppMetadataProperty(const char *name);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_init_h_ */
|
|
||||||
@@ -1,407 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WIKI CATEGORY: Intrinsics */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryIntrinsics
|
|
||||||
*
|
|
||||||
* SDL does some preprocessor gymnastics to determine if any CPU-specific
|
|
||||||
* compiler intrinsics are available, as this is not necessarily an easy thing
|
|
||||||
* to calculate, and sometimes depends on quirks of a system, versions of
|
|
||||||
* build tools, and other external forces.
|
|
||||||
*
|
|
||||||
* Apps including SDL's headers will be able to check consistent preprocessor
|
|
||||||
* definitions to decide if it's safe to use compiler intrinsics for a
|
|
||||||
* specific CPU architecture. This check only tells you that the compiler is
|
|
||||||
* capable of using those intrinsics; at runtime, you should still check if
|
|
||||||
* they are available on the current system with the
|
|
||||||
* [CPU info functions](https://wiki.libsdl.org/SDL3/CategoryCPUInfo)
|
|
||||||
* , such as SDL_HasSSE() or SDL_HasNEON(). Otherwise, the process might crash
|
|
||||||
* for using an unsupported CPU instruction.
|
|
||||||
*
|
|
||||||
* SDL only sets preprocessor defines for CPU intrinsics if they are
|
|
||||||
* supported, so apps should check with `#ifdef` and not `#if`.
|
|
||||||
*
|
|
||||||
* SDL will also include the appropriate instruction-set-specific support
|
|
||||||
* headers, so if SDL decides to define SDL_SSE2_INTRINSICS, it will also
|
|
||||||
* `#include <emmintrin.h>` as well.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_intrin_h_
|
|
||||||
#define SDL_intrin_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Loongarch LSX intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<lsxintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LASX_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_LSX_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Loongarch LSX intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<lasxintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LASX_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_LASX_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports ARM NEON intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<armintr.h>`
|
|
||||||
* `<arm_neon.h>`, `<arm64intr.h>`, and `<arm64_neon.h>`, as appropriate.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_NEON_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports PowerPC Altivec intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<altivec.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_ALTIVEC_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel MMX intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<mmintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SSE_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_MMX_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel SSE intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<xmmintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SSE2_INTRINSICS
|
|
||||||
* \sa SDL_SSE3_INTRINSICS
|
|
||||||
* \sa SDL_SSE4_1_INTRINSICS
|
|
||||||
* \sa SDL_SSE4_2_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_SSE_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel SSE2 intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<emmintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SSE_INTRINSICS
|
|
||||||
* \sa SDL_SSE3_INTRINSICS
|
|
||||||
* \sa SDL_SSE4_1_INTRINSICS
|
|
||||||
* \sa SDL_SSE4_2_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_SSE2_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel SSE3 intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<pmmintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SSE_INTRINSICS
|
|
||||||
* \sa SDL_SSE2_INTRINSICS
|
|
||||||
* \sa SDL_SSE4_1_INTRINSICS
|
|
||||||
* \sa SDL_SSE4_2_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_SSE3_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel SSE4.1 intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<smmintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SSE_INTRINSICS
|
|
||||||
* \sa SDL_SSE2_INTRINSICS
|
|
||||||
* \sa SDL_SSE3_INTRINSICS
|
|
||||||
* \sa SDL_SSE4_2_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_SSE4_1_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel SSE4.2 intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<nmmintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SSE_INTRINSICS
|
|
||||||
* \sa SDL_SSE2_INTRINSICS
|
|
||||||
* \sa SDL_SSE3_INTRINSICS
|
|
||||||
* \sa SDL_SSE4_1_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_SSE4_2_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel AVX intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<immintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_AVX2_INTRINSICS
|
|
||||||
* \sa SDL_AVX512F_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_AVX_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel AVX2 intrinsics.
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<immintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_AVX_INTRINSICS
|
|
||||||
* \sa SDL_AVX512F_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_AVX2_INTRINSICS 1
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defined if (and only if) the compiler supports Intel AVX-512F intrinsics.
|
|
||||||
*
|
|
||||||
* AVX-512F is also sometimes referred to as "AVX-512 Foundation."
|
|
||||||
*
|
|
||||||
* If this macro is defined, SDL will have already included `<immintrin.h>`
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_AVX_INTRINSICS
|
|
||||||
* \sa SDL_AVX2_INTRINSICS
|
|
||||||
*/
|
|
||||||
#define SDL_AVX512F_INTRINSICS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Need to do this here because intrin.h has C++ code in it */
|
|
||||||
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
|
|
||||||
#ifdef __clang__
|
|
||||||
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
|
|
||||||
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
|
|
||||||
#ifndef __PRFCHWINTRIN_H
|
|
||||||
#define __PRFCHWINTRIN_H
|
|
||||||
static __inline__ void __attribute__((__always_inline__, __nodebug__))
|
|
||||||
_m_prefetch(void *__P)
|
|
||||||
{
|
|
||||||
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
|
|
||||||
}
|
|
||||||
#endif /* __PRFCHWINTRIN_H */
|
|
||||||
#endif /* __clang__ */
|
|
||||||
#include <intrin.h>
|
|
||||||
|
|
||||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
|
||||||
#include <intrin.h>
|
|
||||||
#if defined(__ARM_NEON) && !defined(SDL_DISABLE_NEON)
|
|
||||||
# define SDL_NEON_INTRINSICS 1
|
|
||||||
# include <arm_neon.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC to have it included. */
|
|
||||||
#if defined(__ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC)
|
|
||||||
#define SDL_ALTIVEC_INTRINSICS 1
|
|
||||||
#include <altivec.h>
|
|
||||||
#endif
|
|
||||||
#ifndef SDL_DISABLE_NEON
|
|
||||||
# ifdef __ARM_NEON
|
|
||||||
# define SDL_NEON_INTRINSICS 1
|
|
||||||
# include <arm_neon.h>
|
|
||||||
# elif defined(SDL_PLATFORM_WINDOWS)
|
|
||||||
/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
|
|
||||||
# ifdef _M_ARM
|
|
||||||
# define SDL_NEON_INTRINSICS 1
|
|
||||||
# include <armintr.h>
|
|
||||||
# include <arm_neon.h>
|
|
||||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
|
||||||
# endif
|
|
||||||
# if defined (_M_ARM64)
|
|
||||||
# define SDL_NEON_INTRINSICS 1
|
|
||||||
# include <arm64intr.h>
|
|
||||||
# include <arm64_neon.h>
|
|
||||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
|
||||||
# define __ARM_ARCH 8
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#endif /* compiler version */
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
/**
|
|
||||||
* A macro to decide if the compiler supports `__attribute__((target))`.
|
|
||||||
*
|
|
||||||
* Even though this is defined in SDL's public headers, it is generally not
|
|
||||||
* used directly by apps. Apps should probably just use SDL_TARGETING
|
|
||||||
* directly, instead.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_TARGETING
|
|
||||||
*/
|
|
||||||
#define SDL_HAS_TARGET_ATTRIBS
|
|
||||||
|
|
||||||
#elif defined(__clang__) && defined(__has_attribute)
|
|
||||||
# if __has_attribute(target)
|
|
||||||
# define SDL_HAS_TARGET_ATTRIBS
|
|
||||||
# endif
|
|
||||||
#elif defined(__GNUC__) && (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) /* gcc >= 4.9 */
|
|
||||||
# define SDL_HAS_TARGET_ATTRIBS
|
|
||||||
#elif defined(__ICC) && __ICC >= 1600
|
|
||||||
# define SDL_HAS_TARGET_ATTRIBS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A macro to tag a function as targeting a specific CPU architecture.
|
|
||||||
*
|
|
||||||
* This is a hint to the compiler that a function should be built with support
|
|
||||||
* for a CPU instruction set that might be different than the rest of the
|
|
||||||
* program.
|
|
||||||
*
|
|
||||||
* The particulars of this are explained in the GCC documentation:
|
|
||||||
*
|
|
||||||
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-target-function-attribute
|
|
||||||
*
|
|
||||||
* An example of using this feature is to turn on SSE2 support for a specific
|
|
||||||
* function, even if the rest of the source code is not compiled to use SSE2
|
|
||||||
* code:
|
|
||||||
*
|
|
||||||
* ```c
|
|
||||||
* #ifdef SDL_SSE2_INTRINSICS
|
|
||||||
* static void SDL_TARGETING("sse2") DoSomethingWithSSE2(char *x) {
|
|
||||||
* ...use SSE2 intrinsic functions, etc...
|
|
||||||
* }
|
|
||||||
* #endif
|
|
||||||
*
|
|
||||||
* // later...
|
|
||||||
* #ifdef SDL_SSE2_INTRINSICS
|
|
||||||
* if (SDL_HasSSE2()) {
|
|
||||||
* DoSomethingWithSSE2(str);
|
|
||||||
* }
|
|
||||||
* #endif
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* The application is, on a whole, built without SSE2 instructions, so it will
|
|
||||||
* run on Intel machines that don't support SSE2. But then at runtime, it
|
|
||||||
* checks if the system supports the instructions, and then calls into a
|
|
||||||
* function that uses SSE2 opcodes. The ifdefs make sure that this code isn't
|
|
||||||
* used on platforms that don't have SSE2 at all.
|
|
||||||
*
|
|
||||||
* On compilers without target support, this is defined to nothing.
|
|
||||||
*
|
|
||||||
* This symbol is used by SDL internally, but apps and other libraries are
|
|
||||||
* welcome to use it for their own interfaces as well.
|
|
||||||
*
|
|
||||||
* \since This macro is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
#define SDL_TARGETING(x) __attribute__((target(x)))
|
|
||||||
|
|
||||||
#elif defined(SDL_HAS_TARGET_ATTRIBS)
|
|
||||||
# define SDL_TARGETING(x) __attribute__((target(x)))
|
|
||||||
#else
|
|
||||||
# define SDL_TARGETING(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __loongarch64
|
|
||||||
# ifndef SDL_DISABLE_LSX
|
|
||||||
# define SDL_LSX_INTRINSICS 1
|
|
||||||
# include <lsxintrin.h>
|
|
||||||
# endif
|
|
||||||
# ifndef SDL_DISABLE_LASX
|
|
||||||
# define SDL_LASX_INTRINSICS 1
|
|
||||||
# include <lasxintrin.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
|
|
||||||
# if ((defined(_MSC_VER) && !defined(_M_X64)) || defined(__MMX__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_MMX)
|
|
||||||
# define SDL_MMX_INTRINSICS 1
|
|
||||||
# include <mmintrin.h>
|
|
||||||
# endif
|
|
||||||
# if (defined(_MSC_VER) || defined(__SSE__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE)
|
|
||||||
# define SDL_SSE_INTRINSICS 1
|
|
||||||
# include <xmmintrin.h>
|
|
||||||
# endif
|
|
||||||
# if (defined(_MSC_VER) || defined(__SSE2__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE2)
|
|
||||||
# define SDL_SSE2_INTRINSICS 1
|
|
||||||
# include <emmintrin.h>
|
|
||||||
# endif
|
|
||||||
# if (defined(_MSC_VER) || defined(__SSE3__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE3)
|
|
||||||
# define SDL_SSE3_INTRINSICS 1
|
|
||||||
# include <pmmintrin.h>
|
|
||||||
# endif
|
|
||||||
# if (defined(_MSC_VER) || defined(__SSE4_1__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE4_1)
|
|
||||||
# define SDL_SSE4_1_INTRINSICS 1
|
|
||||||
# include <smmintrin.h>
|
|
||||||
# endif
|
|
||||||
# if (defined(_MSC_VER) || defined(__SSE4_2__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_SSE4_2)
|
|
||||||
# define SDL_SSE4_2_INTRINSICS 1
|
|
||||||
# include <nmmintrin.h>
|
|
||||||
# endif
|
|
||||||
# if defined(__clang__) && (defined(_MSC_VER) || defined(__SCE__)) && !defined(__AVX__) && !defined(SDL_DISABLE_AVX)
|
|
||||||
# define SDL_DISABLE_AVX /* see https://reviews.llvm.org/D20291 and https://reviews.llvm.org/D79194 */
|
|
||||||
# endif
|
|
||||||
# if (defined(_MSC_VER) || defined(__AVX__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(_M_ARM64EC) && !defined(SDL_DISABLE_AVX)
|
|
||||||
# define SDL_AVX_INTRINSICS 1
|
|
||||||
# include <immintrin.h>
|
|
||||||
# endif
|
|
||||||
# if defined(__clang__) && (defined(_MSC_VER) || defined(__SCE__)) && !defined(__AVX2__) && !defined(SDL_DISABLE_AVX2)
|
|
||||||
# define SDL_DISABLE_AVX2 /* see https://reviews.llvm.org/D20291 and https://reviews.llvm.org/D79194 */
|
|
||||||
# endif
|
|
||||||
# if (defined(_MSC_VER) || defined(__AVX2__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(_M_ARM64EC) && !defined(SDL_DISABLE_AVX2)
|
|
||||||
# define SDL_AVX2_INTRINSICS 1
|
|
||||||
# include <immintrin.h>
|
|
||||||
# endif
|
|
||||||
# if defined(__clang__) && (defined(_MSC_VER) || defined(__SCE__)) && !defined(__AVX512F__) && !defined(SDL_DISABLE_AVX512F)
|
|
||||||
# define SDL_DISABLE_AVX512F /* see https://reviews.llvm.org/D20291 and https://reviews.llvm.org/D79194 */
|
|
||||||
# endif
|
|
||||||
# if (defined(_MSC_VER) || defined(__AVX512F__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(_M_ARM64EC) && !defined(SDL_DISABLE_AVX512F)
|
|
||||||
# define SDL_AVX512F_INTRINSICS 1
|
|
||||||
# include <immintrin.h>
|
|
||||||
# endif
|
|
||||||
#endif /* defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) */
|
|
||||||
|
|
||||||
#endif /* SDL_intrin_h_ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,609 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryKeyboard
|
|
||||||
*
|
|
||||||
* SDL keyboard management.
|
|
||||||
*
|
|
||||||
* Please refer to the Best Keyboard Practices document for details on how
|
|
||||||
* best to accept keyboard input in various types of programs:
|
|
||||||
*
|
|
||||||
* https://wiki.libsdl.org/SDL3/BestKeyboardPractices
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_keyboard_h_
|
|
||||||
#define SDL_keyboard_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
#include <SDL3/SDL_keycode.h>
|
|
||||||
#include <SDL3/SDL_properties.h>
|
|
||||||
#include <SDL3/SDL_rect.h>
|
|
||||||
#include <SDL3/SDL_scancode.h>
|
|
||||||
#include <SDL3/SDL_video.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a unique ID for a keyboard for the time it is connected to the
|
|
||||||
* system, and is never reused for the lifetime of the application.
|
|
||||||
*
|
|
||||||
* If the keyboard is disconnected and reconnected, it will get a new ID.
|
|
||||||
*
|
|
||||||
* The value 0 is an invalid ID.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef Uint32 SDL_KeyboardID;
|
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether a keyboard is currently connected.
|
|
||||||
*
|
|
||||||
* \returns true if a keyboard is connected, false otherwise.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyboards
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasKeyboard(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of currently connected keyboards.
|
|
||||||
*
|
|
||||||
* Note that this will include any device or virtual driver that includes
|
|
||||||
* keyboard functionality, including some mice, KVM switches, motherboard
|
|
||||||
* power buttons, etc. You should wait for input from a device before you
|
|
||||||
* consider it actively in use.
|
|
||||||
*
|
|
||||||
* \param count a pointer filled in with the number of keyboards returned, may
|
|
||||||
* be NULL.
|
|
||||||
* \returns a 0 terminated array of keyboards instance IDs or NULL on failure;
|
|
||||||
* call SDL_GetError() for more information. This should be freed
|
|
||||||
* with SDL_free() when it is no longer needed.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyboardNameForID
|
|
||||||
* \sa SDL_HasKeyboard
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of a keyboard.
|
|
||||||
*
|
|
||||||
* This function returns "" if the keyboard doesn't have a name.
|
|
||||||
*
|
|
||||||
* \param instance_id the keyboard instance ID.
|
|
||||||
* \returns the name of the selected keyboard or NULL on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyboards
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Query the window which currently has keyboard focus.
|
|
||||||
*
|
|
||||||
* \returns the window with keyboard focus.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a snapshot of the current state of the keyboard.
|
|
||||||
*
|
|
||||||
* The pointer returned is a pointer to an internal SDL array. It will be
|
|
||||||
* valid for the whole lifetime of the application and should not be freed by
|
|
||||||
* the caller.
|
|
||||||
*
|
|
||||||
* A array element with a value of true means that the key is pressed and a
|
|
||||||
* value of false means that it is not. Indexes into this array are obtained
|
|
||||||
* by using SDL_Scancode values.
|
|
||||||
*
|
|
||||||
* Use SDL_PumpEvents() to update the state array.
|
|
||||||
*
|
|
||||||
* This function gives you the current state after all events have been
|
|
||||||
* processed, so if a key or button has been pressed and released before you
|
|
||||||
* process events, then the pressed state will never show up in the
|
|
||||||
* SDL_GetKeyboardState() calls.
|
|
||||||
*
|
|
||||||
* Note: This function doesn't take into account whether shift has been
|
|
||||||
* pressed or not.
|
|
||||||
*
|
|
||||||
* \param numkeys if non-NULL, receives the length of the returned array.
|
|
||||||
* \returns a pointer to an array of key states.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_PumpEvents
|
|
||||||
* \sa SDL_ResetKeyboard
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const bool * SDLCALL SDL_GetKeyboardState(int *numkeys);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the state of the keyboard.
|
|
||||||
*
|
|
||||||
* This function will generate key up events for all pressed keys.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyboardState
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_ResetKeyboard(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current key modifier state for the keyboard.
|
|
||||||
*
|
|
||||||
* \returns an OR'd combination of the modifier keys for the keyboard. See
|
|
||||||
* SDL_Keymod for details.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyboardState
|
|
||||||
* \sa SDL_SetModState
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the current key modifier state for the keyboard.
|
|
||||||
*
|
|
||||||
* The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose
|
|
||||||
* modifier key states on your application. Simply pass your desired modifier
|
|
||||||
* states into `modstate`. This value may be a bitwise, OR'd combination of
|
|
||||||
* SDL_Keymod values.
|
|
||||||
*
|
|
||||||
* This does not change the keyboard state, only the key modifier flags that
|
|
||||||
* SDL reports.
|
|
||||||
*
|
|
||||||
* \param modstate the desired SDL_Keymod for the keyboard.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetModState
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the key code corresponding to the given scancode according to the
|
|
||||||
* current keyboard layout.
|
|
||||||
*
|
|
||||||
* If you want to get the keycode as it would be delivered in key events,
|
|
||||||
* including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should
|
|
||||||
* pass `key_event` as true. Otherwise this function simply translates the
|
|
||||||
* scancode based on the given modifier state.
|
|
||||||
*
|
|
||||||
* \param scancode the desired SDL_Scancode to query.
|
|
||||||
* \param modstate the modifier state to use when translating the scancode to
|
|
||||||
* a keycode.
|
|
||||||
* \param key_event true if the keycode will be used in key events.
|
|
||||||
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyName
|
|
||||||
* \sa SDL_GetScancodeFromKey
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, bool key_event);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the scancode corresponding to the given key code according to the
|
|
||||||
* current keyboard layout.
|
|
||||||
*
|
|
||||||
* Note that there may be multiple scancode+modifier states that can generate
|
|
||||||
* this keycode, this will just return the first one found.
|
|
||||||
*
|
|
||||||
* \param key the desired SDL_Keycode to query.
|
|
||||||
* \param modstate a pointer to the modifier state that would be used when the
|
|
||||||
* scancode generates this key, may be NULL.
|
|
||||||
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyFromScancode
|
|
||||||
* \sa SDL_GetScancodeName
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a human-readable name for a scancode.
|
|
||||||
*
|
|
||||||
* \param scancode the desired SDL_Scancode.
|
|
||||||
* \param name the name to use for the scancode, encoded as UTF-8. The string
|
|
||||||
* is not copied, so the pointer given to this function must stay
|
|
||||||
* valid while SDL is being used.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetScancodeName
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a human-readable name for a scancode.
|
|
||||||
*
|
|
||||||
* **Warning**: The returned name is by design not stable across platforms,
|
|
||||||
* e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left
|
|
||||||
* Windows" under Microsoft Windows, and some scancodes like
|
|
||||||
* `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even
|
|
||||||
* scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and
|
|
||||||
* `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore
|
|
||||||
* unsuitable for creating a stable cross-platform two-way mapping between
|
|
||||||
* strings and scancodes.
|
|
||||||
*
|
|
||||||
* \param scancode the desired SDL_Scancode to query.
|
|
||||||
* \returns a pointer to the name for the scancode. If the scancode doesn't
|
|
||||||
* have a name this function returns an empty string ("").
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetScancodeFromKey
|
|
||||||
* \sa SDL_GetScancodeFromName
|
|
||||||
* \sa SDL_SetScancodeName
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a scancode from a human-readable name.
|
|
||||||
*
|
|
||||||
* \param name the human-readable scancode name.
|
|
||||||
* \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't
|
|
||||||
* recognized; call SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyFromName
|
|
||||||
* \sa SDL_GetScancodeFromKey
|
|
||||||
* \sa SDL_GetScancodeName
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a human-readable name for a key.
|
|
||||||
*
|
|
||||||
* If the key doesn't have a name, this function returns an empty string ("").
|
|
||||||
*
|
|
||||||
* Letters will be presented in their uppercase form, if applicable.
|
|
||||||
*
|
|
||||||
* \param key the desired SDL_Keycode to query.
|
|
||||||
* \returns a UTF-8 encoded string of the key name.
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyFromName
|
|
||||||
* \sa SDL_GetKeyFromScancode
|
|
||||||
* \sa SDL_GetScancodeFromKey
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetKeyName(SDL_Keycode key);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a key code from a human-readable name.
|
|
||||||
*
|
|
||||||
* \param name the human-readable key name.
|
|
||||||
* \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function is not thread safe.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetKeyFromScancode
|
|
||||||
* \sa SDL_GetKeyName
|
|
||||||
* \sa SDL_GetScancodeFromName
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start accepting Unicode text input events in a window.
|
|
||||||
*
|
|
||||||
* This function will enable text input (SDL_EVENT_TEXT_INPUT and
|
|
||||||
* SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this
|
|
||||||
* function paired with SDL_StopTextInput().
|
|
||||||
*
|
|
||||||
* Text input events are not received by default.
|
|
||||||
*
|
|
||||||
* On some platforms using this function shows the screen keyboard and/or
|
|
||||||
* activates an IME, which can prevent some key press events from being passed
|
|
||||||
* through.
|
|
||||||
*
|
|
||||||
* \param window the window to enable text input.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetTextInputArea
|
|
||||||
* \sa SDL_StartTextInputWithProperties
|
|
||||||
* \sa SDL_StopTextInput
|
|
||||||
* \sa SDL_TextInputActive
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_StartTextInput(SDL_Window *window);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Text input type.
|
|
||||||
*
|
|
||||||
* These are the valid values for SDL_PROP_TEXTINPUT_TYPE_NUMBER. Not every
|
|
||||||
* value is valid on every platform, but where a value isn't supported, a
|
|
||||||
* reasonable fallback will be used.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_StartTextInputWithProperties
|
|
||||||
*/
|
|
||||||
typedef enum SDL_TextInputType
|
|
||||||
{
|
|
||||||
SDL_TEXTINPUT_TYPE_TEXT, /**< The input is text */
|
|
||||||
SDL_TEXTINPUT_TYPE_TEXT_NAME, /**< The input is a person's name */
|
|
||||||
SDL_TEXTINPUT_TYPE_TEXT_EMAIL, /**< The input is an e-mail address */
|
|
||||||
SDL_TEXTINPUT_TYPE_TEXT_USERNAME, /**< The input is a username */
|
|
||||||
SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN, /**< The input is a secure password that is hidden */
|
|
||||||
SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE, /**< The input is a secure password that is visible */
|
|
||||||
SDL_TEXTINPUT_TYPE_NUMBER, /**< The input is a number */
|
|
||||||
SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN, /**< The input is a secure PIN that is hidden */
|
|
||||||
SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE /**< The input is a secure PIN that is visible */
|
|
||||||
} SDL_TextInputType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto capitalization type.
|
|
||||||
*
|
|
||||||
* These are the valid values for SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER.
|
|
||||||
* Not every value is valid on every platform, but where a value isn't
|
|
||||||
* supported, a reasonable fallback will be used.
|
|
||||||
*
|
|
||||||
* \since This enum is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_StartTextInputWithProperties
|
|
||||||
*/
|
|
||||||
typedef enum SDL_Capitalization
|
|
||||||
{
|
|
||||||
SDL_CAPITALIZE_NONE, /**< No auto-capitalization will be done */
|
|
||||||
SDL_CAPITALIZE_SENTENCES, /**< The first letter of sentences will be capitalized */
|
|
||||||
SDL_CAPITALIZE_WORDS, /**< The first letter of words will be capitalized */
|
|
||||||
SDL_CAPITALIZE_LETTERS /**< All letters will be capitalized */
|
|
||||||
} SDL_Capitalization;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start accepting Unicode text input events in a window, with properties
|
|
||||||
* describing the input.
|
|
||||||
*
|
|
||||||
* This function will enable text input (SDL_EVENT_TEXT_INPUT and
|
|
||||||
* SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this
|
|
||||||
* function paired with SDL_StopTextInput().
|
|
||||||
*
|
|
||||||
* Text input events are not received by default.
|
|
||||||
*
|
|
||||||
* On some platforms using this function shows the screen keyboard and/or
|
|
||||||
* activates an IME, which can prevent some key press events from being passed
|
|
||||||
* through.
|
|
||||||
*
|
|
||||||
* These are the supported properties:
|
|
||||||
*
|
|
||||||
* - `SDL_PROP_TEXTINPUT_TYPE_NUMBER` - an SDL_TextInputType value that
|
|
||||||
* describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT.
|
|
||||||
* - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value
|
|
||||||
* that describes how text should be capitalized, defaults to
|
|
||||||
* SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for
|
|
||||||
* SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail
|
|
||||||
* addresses, usernames, and passwords.
|
|
||||||
* - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion
|
|
||||||
* and auto correction, defaults to true.
|
|
||||||
* - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text
|
|
||||||
* are allowed. This defaults to true if SDL_HINT_RETURN_KEY_HIDES_IME is
|
|
||||||
* "0" or is not set, and defaults to false if SDL_HINT_RETURN_KEY_HIDES_IME
|
|
||||||
* is "1".
|
|
||||||
*
|
|
||||||
* On Android you can directly specify the input type:
|
|
||||||
*
|
|
||||||
* - `SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER` - the text input type to
|
|
||||||
* use, overriding other properties. This is documented at
|
|
||||||
* https://developer.android.com/reference/android/text/InputType
|
|
||||||
*
|
|
||||||
* \param window the window to enable text input.
|
|
||||||
* \param props the properties to use.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetTextInputArea
|
|
||||||
* \sa SDL_StartTextInput
|
|
||||||
* \sa SDL_StopTextInput
|
|
||||||
* \sa SDL_TextInputActive
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props);
|
|
||||||
|
|
||||||
#define SDL_PROP_TEXTINPUT_TYPE_NUMBER "SDL.textinput.type"
|
|
||||||
#define SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER "SDL.textinput.capitalization"
|
|
||||||
#define SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN "SDL.textinput.autocorrect"
|
|
||||||
#define SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN "SDL.textinput.multiline"
|
|
||||||
#define SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER "SDL.textinput.android.inputtype"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether or not Unicode text input events are enabled for a window.
|
|
||||||
*
|
|
||||||
* \param window the window to check.
|
|
||||||
* \returns true if text input events are enabled else false.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_StartTextInput
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_TextInputActive(SDL_Window *window);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop receiving any text input events in a window.
|
|
||||||
*
|
|
||||||
* If SDL_StartTextInput() showed the screen keyboard, this function will hide
|
|
||||||
* it.
|
|
||||||
*
|
|
||||||
* \param window the window to disable text input.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_StartTextInput
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_StopTextInput(SDL_Window *window);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dismiss the composition window/IME without disabling the subsystem.
|
|
||||||
*
|
|
||||||
* \param window the window to affect.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_StartTextInput
|
|
||||||
* \sa SDL_StopTextInput
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_ClearComposition(SDL_Window *window);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the area used to type Unicode text input.
|
|
||||||
*
|
|
||||||
* Native input methods may place a window with word suggestions near the
|
|
||||||
* cursor, without covering the text being entered.
|
|
||||||
*
|
|
||||||
* \param window the window for which to set the text input area.
|
|
||||||
* \param rect the SDL_Rect representing the text input area, in window
|
|
||||||
* coordinates, or NULL to clear it.
|
|
||||||
* \param cursor the offset of the current cursor location relative to
|
|
||||||
* `rect->x`, in window coordinates.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetTextInputArea
|
|
||||||
* \sa SDL_StartTextInput
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the area used to type Unicode text input.
|
|
||||||
*
|
|
||||||
* This returns the values previously set by SDL_SetTextInputArea().
|
|
||||||
*
|
|
||||||
* \param window the window for which to query the text input area.
|
|
||||||
* \param rect a pointer to an SDL_Rect filled in with the text input area,
|
|
||||||
* may be NULL.
|
|
||||||
* \param cursor a pointer to the offset of the current cursor location
|
|
||||||
* relative to `rect->x`, may be NULL.
|
|
||||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
|
||||||
* information.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_SetTextInputArea
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether the platform has screen keyboard support.
|
|
||||||
*
|
|
||||||
* \returns true if the platform has some screen keyboard support or false if
|
|
||||||
* not.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_StartTextInput
|
|
||||||
* \sa SDL_ScreenKeyboardShown
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_HasScreenKeyboardSupport(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether the screen keyboard is shown for given window.
|
|
||||||
*
|
|
||||||
* \param window the window for which screen keyboard should be queried.
|
|
||||||
* \returns true if screen keyboard is shown or false if not.
|
|
||||||
*
|
|
||||||
* \threadsafety This function should only be called on the main thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_HasScreenKeyboardSupport
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_ScreenKeyboardShown(SDL_Window *window);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_keyboard_h_ */
|
|
||||||
@@ -1,343 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryKeycode
|
|
||||||
*
|
|
||||||
* Defines constants which identify keyboard keys and modifiers.
|
|
||||||
*
|
|
||||||
* Please refer to the Best Keyboard Practices document for details on what
|
|
||||||
* this information means and how best to use it.
|
|
||||||
*
|
|
||||||
* https://wiki.libsdl.org/SDL3/BestKeyboardPractices
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_keycode_h_
|
|
||||||
#define SDL_keycode_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_scancode.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The SDL virtual key representation.
|
|
||||||
*
|
|
||||||
* Values of this type are used to represent keyboard keys using the current
|
|
||||||
* layout of the keyboard. These values include Unicode values representing
|
|
||||||
* the unmodified character that would be generated by pressing the key, or an
|
|
||||||
* `SDLK_*` constant for those keys that do not generate characters.
|
|
||||||
*
|
|
||||||
* A special exception is the number keys at the top of the keyboard which map
|
|
||||||
* to SDLK_0...SDLK_9 on AZERTY layouts.
|
|
||||||
*
|
|
||||||
* Keys with the `SDLK_EXTENDED_MASK` bit set do not map to a scancode or
|
|
||||||
* unicode code point.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef Uint32 SDL_Keycode;
|
|
||||||
|
|
||||||
#define SDLK_EXTENDED_MASK (1u << 29)
|
|
||||||
#define SDLK_SCANCODE_MASK (1u << 30)
|
|
||||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
|
||||||
#define SDLK_UNKNOWN 0x00000000u /**< 0 */
|
|
||||||
#define SDLK_RETURN 0x0000000du /**< '\r' */
|
|
||||||
#define SDLK_ESCAPE 0x0000001bu /**< '\x1B' */
|
|
||||||
#define SDLK_BACKSPACE 0x00000008u /**< '\b' */
|
|
||||||
#define SDLK_TAB 0x00000009u /**< '\t' */
|
|
||||||
#define SDLK_SPACE 0x00000020u /**< ' ' */
|
|
||||||
#define SDLK_EXCLAIM 0x00000021u /**< '!' */
|
|
||||||
#define SDLK_DBLAPOSTROPHE 0x00000022u /**< '"' */
|
|
||||||
#define SDLK_HASH 0x00000023u /**< '#' */
|
|
||||||
#define SDLK_DOLLAR 0x00000024u /**< '$' */
|
|
||||||
#define SDLK_PERCENT 0x00000025u /**< '%' */
|
|
||||||
#define SDLK_AMPERSAND 0x00000026u /**< '&' */
|
|
||||||
#define SDLK_APOSTROPHE 0x00000027u /**< '\'' */
|
|
||||||
#define SDLK_LEFTPAREN 0x00000028u /**< '(' */
|
|
||||||
#define SDLK_RIGHTPAREN 0x00000029u /**< ')' */
|
|
||||||
#define SDLK_ASTERISK 0x0000002au /**< '*' */
|
|
||||||
#define SDLK_PLUS 0x0000002bu /**< '+' */
|
|
||||||
#define SDLK_COMMA 0x0000002cu /**< ',' */
|
|
||||||
#define SDLK_MINUS 0x0000002du /**< '-' */
|
|
||||||
#define SDLK_PERIOD 0x0000002eu /**< '.' */
|
|
||||||
#define SDLK_SLASH 0x0000002fu /**< '/' */
|
|
||||||
#define SDLK_0 0x00000030u /**< '0' */
|
|
||||||
#define SDLK_1 0x00000031u /**< '1' */
|
|
||||||
#define SDLK_2 0x00000032u /**< '2' */
|
|
||||||
#define SDLK_3 0x00000033u /**< '3' */
|
|
||||||
#define SDLK_4 0x00000034u /**< '4' */
|
|
||||||
#define SDLK_5 0x00000035u /**< '5' */
|
|
||||||
#define SDLK_6 0x00000036u /**< '6' */
|
|
||||||
#define SDLK_7 0x00000037u /**< '7' */
|
|
||||||
#define SDLK_8 0x00000038u /**< '8' */
|
|
||||||
#define SDLK_9 0x00000039u /**< '9' */
|
|
||||||
#define SDLK_COLON 0x0000003au /**< ':' */
|
|
||||||
#define SDLK_SEMICOLON 0x0000003bu /**< ';' */
|
|
||||||
#define SDLK_LESS 0x0000003cu /**< '<' */
|
|
||||||
#define SDLK_EQUALS 0x0000003du /**< '=' */
|
|
||||||
#define SDLK_GREATER 0x0000003eu /**< '>' */
|
|
||||||
#define SDLK_QUESTION 0x0000003fu /**< '?' */
|
|
||||||
#define SDLK_AT 0x00000040u /**< '@' */
|
|
||||||
#define SDLK_LEFTBRACKET 0x0000005bu /**< '[' */
|
|
||||||
#define SDLK_BACKSLASH 0x0000005cu /**< '\\' */
|
|
||||||
#define SDLK_RIGHTBRACKET 0x0000005du /**< ']' */
|
|
||||||
#define SDLK_CARET 0x0000005eu /**< '^' */
|
|
||||||
#define SDLK_UNDERSCORE 0x0000005fu /**< '_' */
|
|
||||||
#define SDLK_GRAVE 0x00000060u /**< '`' */
|
|
||||||
#define SDLK_A 0x00000061u /**< 'a' */
|
|
||||||
#define SDLK_B 0x00000062u /**< 'b' */
|
|
||||||
#define SDLK_C 0x00000063u /**< 'c' */
|
|
||||||
#define SDLK_D 0x00000064u /**< 'd' */
|
|
||||||
#define SDLK_E 0x00000065u /**< 'e' */
|
|
||||||
#define SDLK_F 0x00000066u /**< 'f' */
|
|
||||||
#define SDLK_G 0x00000067u /**< 'g' */
|
|
||||||
#define SDLK_H 0x00000068u /**< 'h' */
|
|
||||||
#define SDLK_I 0x00000069u /**< 'i' */
|
|
||||||
#define SDLK_J 0x0000006au /**< 'j' */
|
|
||||||
#define SDLK_K 0x0000006bu /**< 'k' */
|
|
||||||
#define SDLK_L 0x0000006cu /**< 'l' */
|
|
||||||
#define SDLK_M 0x0000006du /**< 'm' */
|
|
||||||
#define SDLK_N 0x0000006eu /**< 'n' */
|
|
||||||
#define SDLK_O 0x0000006fu /**< 'o' */
|
|
||||||
#define SDLK_P 0x00000070u /**< 'p' */
|
|
||||||
#define SDLK_Q 0x00000071u /**< 'q' */
|
|
||||||
#define SDLK_R 0x00000072u /**< 'r' */
|
|
||||||
#define SDLK_S 0x00000073u /**< 's' */
|
|
||||||
#define SDLK_T 0x00000074u /**< 't' */
|
|
||||||
#define SDLK_U 0x00000075u /**< 'u' */
|
|
||||||
#define SDLK_V 0x00000076u /**< 'v' */
|
|
||||||
#define SDLK_W 0x00000077u /**< 'w' */
|
|
||||||
#define SDLK_X 0x00000078u /**< 'x' */
|
|
||||||
#define SDLK_Y 0x00000079u /**< 'y' */
|
|
||||||
#define SDLK_Z 0x0000007au /**< 'z' */
|
|
||||||
#define SDLK_LEFTBRACE 0x0000007bu /**< '{' */
|
|
||||||
#define SDLK_PIPE 0x0000007cu /**< '|' */
|
|
||||||
#define SDLK_RIGHTBRACE 0x0000007du /**< '}' */
|
|
||||||
#define SDLK_TILDE 0x0000007eu /**< '~' */
|
|
||||||
#define SDLK_DELETE 0x0000007fu /**< '\x7F' */
|
|
||||||
#define SDLK_PLUSMINUS 0x000000b1u /**< '\xB1' */
|
|
||||||
#define SDLK_CAPSLOCK 0x40000039u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK) */
|
|
||||||
#define SDLK_F1 0x4000003au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1) */
|
|
||||||
#define SDLK_F2 0x4000003bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2) */
|
|
||||||
#define SDLK_F3 0x4000003cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3) */
|
|
||||||
#define SDLK_F4 0x4000003du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4) */
|
|
||||||
#define SDLK_F5 0x4000003eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5) */
|
|
||||||
#define SDLK_F6 0x4000003fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6) */
|
|
||||||
#define SDLK_F7 0x40000040u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7) */
|
|
||||||
#define SDLK_F8 0x40000041u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8) */
|
|
||||||
#define SDLK_F9 0x40000042u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9) */
|
|
||||||
#define SDLK_F10 0x40000043u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10) */
|
|
||||||
#define SDLK_F11 0x40000044u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11) */
|
|
||||||
#define SDLK_F12 0x40000045u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12) */
|
|
||||||
#define SDLK_PRINTSCREEN 0x40000046u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN) */
|
|
||||||
#define SDLK_SCROLLLOCK 0x40000047u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK) */
|
|
||||||
#define SDLK_PAUSE 0x40000048u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE) */
|
|
||||||
#define SDLK_INSERT 0x40000049u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT) */
|
|
||||||
#define SDLK_HOME 0x4000004au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME) */
|
|
||||||
#define SDLK_PAGEUP 0x4000004bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP) */
|
|
||||||
#define SDLK_END 0x4000004du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END) */
|
|
||||||
#define SDLK_PAGEDOWN 0x4000004eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN) */
|
|
||||||
#define SDLK_RIGHT 0x4000004fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT) */
|
|
||||||
#define SDLK_LEFT 0x40000050u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT) */
|
|
||||||
#define SDLK_DOWN 0x40000051u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN) */
|
|
||||||
#define SDLK_UP 0x40000052u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP) */
|
|
||||||
#define SDLK_NUMLOCKCLEAR 0x40000053u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR) */
|
|
||||||
#define SDLK_KP_DIVIDE 0x40000054u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE) */
|
|
||||||
#define SDLK_KP_MULTIPLY 0x40000055u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY) */
|
|
||||||
#define SDLK_KP_MINUS 0x40000056u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS) */
|
|
||||||
#define SDLK_KP_PLUS 0x40000057u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS) */
|
|
||||||
#define SDLK_KP_ENTER 0x40000058u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER) */
|
|
||||||
#define SDLK_KP_1 0x40000059u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1) */
|
|
||||||
#define SDLK_KP_2 0x4000005au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2) */
|
|
||||||
#define SDLK_KP_3 0x4000005bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3) */
|
|
||||||
#define SDLK_KP_4 0x4000005cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4) */
|
|
||||||
#define SDLK_KP_5 0x4000005du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5) */
|
|
||||||
#define SDLK_KP_6 0x4000005eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6) */
|
|
||||||
#define SDLK_KP_7 0x4000005fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7) */
|
|
||||||
#define SDLK_KP_8 0x40000060u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8) */
|
|
||||||
#define SDLK_KP_9 0x40000061u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9) */
|
|
||||||
#define SDLK_KP_0 0x40000062u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0) */
|
|
||||||
#define SDLK_KP_PERIOD 0x40000063u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD) */
|
|
||||||
#define SDLK_APPLICATION 0x40000065u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION) */
|
|
||||||
#define SDLK_POWER 0x40000066u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER) */
|
|
||||||
#define SDLK_KP_EQUALS 0x40000067u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS) */
|
|
||||||
#define SDLK_F13 0x40000068u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13) */
|
|
||||||
#define SDLK_F14 0x40000069u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14) */
|
|
||||||
#define SDLK_F15 0x4000006au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15) */
|
|
||||||
#define SDLK_F16 0x4000006bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16) */
|
|
||||||
#define SDLK_F17 0x4000006cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17) */
|
|
||||||
#define SDLK_F18 0x4000006du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18) */
|
|
||||||
#define SDLK_F19 0x4000006eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19) */
|
|
||||||
#define SDLK_F20 0x4000006fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20) */
|
|
||||||
#define SDLK_F21 0x40000070u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21) */
|
|
||||||
#define SDLK_F22 0x40000071u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22) */
|
|
||||||
#define SDLK_F23 0x40000072u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23) */
|
|
||||||
#define SDLK_F24 0x40000073u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24) */
|
|
||||||
#define SDLK_EXECUTE 0x40000074u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE) */
|
|
||||||
#define SDLK_HELP 0x40000075u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP) */
|
|
||||||
#define SDLK_MENU 0x40000076u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU) */
|
|
||||||
#define SDLK_SELECT 0x40000077u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT) */
|
|
||||||
#define SDLK_STOP 0x40000078u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP) */
|
|
||||||
#define SDLK_AGAIN 0x40000079u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN) */
|
|
||||||
#define SDLK_UNDO 0x4000007au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO) */
|
|
||||||
#define SDLK_CUT 0x4000007bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT) */
|
|
||||||
#define SDLK_COPY 0x4000007cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY) */
|
|
||||||
#define SDLK_PASTE 0x4000007du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE) */
|
|
||||||
#define SDLK_FIND 0x4000007eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND) */
|
|
||||||
#define SDLK_MUTE 0x4000007fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE) */
|
|
||||||
#define SDLK_VOLUMEUP 0x40000080u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP) */
|
|
||||||
#define SDLK_VOLUMEDOWN 0x40000081u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN) */
|
|
||||||
#define SDLK_KP_COMMA 0x40000085u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA) */
|
|
||||||
#define SDLK_KP_EQUALSAS400 0x40000086u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400) */
|
|
||||||
#define SDLK_ALTERASE 0x40000099u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE) */
|
|
||||||
#define SDLK_SYSREQ 0x4000009au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ) */
|
|
||||||
#define SDLK_CANCEL 0x4000009bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL) */
|
|
||||||
#define SDLK_CLEAR 0x4000009cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR) */
|
|
||||||
#define SDLK_PRIOR 0x4000009du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR) */
|
|
||||||
#define SDLK_RETURN2 0x4000009eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2) */
|
|
||||||
#define SDLK_SEPARATOR 0x4000009fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR) */
|
|
||||||
#define SDLK_OUT 0x400000a0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT) */
|
|
||||||
#define SDLK_OPER 0x400000a1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER) */
|
|
||||||
#define SDLK_CLEARAGAIN 0x400000a2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN) */
|
|
||||||
#define SDLK_CRSEL 0x400000a3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL) */
|
|
||||||
#define SDLK_EXSEL 0x400000a4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL) */
|
|
||||||
#define SDLK_KP_00 0x400000b0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00) */
|
|
||||||
#define SDLK_KP_000 0x400000b1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000) */
|
|
||||||
#define SDLK_THOUSANDSSEPARATOR 0x400000b2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR) */
|
|
||||||
#define SDLK_DECIMALSEPARATOR 0x400000b3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR) */
|
|
||||||
#define SDLK_CURRENCYUNIT 0x400000b4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT) */
|
|
||||||
#define SDLK_CURRENCYSUBUNIT 0x400000b5u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT) */
|
|
||||||
#define SDLK_KP_LEFTPAREN 0x400000b6u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN) */
|
|
||||||
#define SDLK_KP_RIGHTPAREN 0x400000b7u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN) */
|
|
||||||
#define SDLK_KP_LEFTBRACE 0x400000b8u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE) */
|
|
||||||
#define SDLK_KP_RIGHTBRACE 0x400000b9u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE) */
|
|
||||||
#define SDLK_KP_TAB 0x400000bau /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB) */
|
|
||||||
#define SDLK_KP_BACKSPACE 0x400000bbu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE) */
|
|
||||||
#define SDLK_KP_A 0x400000bcu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A) */
|
|
||||||
#define SDLK_KP_B 0x400000bdu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B) */
|
|
||||||
#define SDLK_KP_C 0x400000beu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C) */
|
|
||||||
#define SDLK_KP_D 0x400000bfu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D) */
|
|
||||||
#define SDLK_KP_E 0x400000c0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E) */
|
|
||||||
#define SDLK_KP_F 0x400000c1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F) */
|
|
||||||
#define SDLK_KP_XOR 0x400000c2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR) */
|
|
||||||
#define SDLK_KP_POWER 0x400000c3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER) */
|
|
||||||
#define SDLK_KP_PERCENT 0x400000c4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT) */
|
|
||||||
#define SDLK_KP_LESS 0x400000c5u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS) */
|
|
||||||
#define SDLK_KP_GREATER 0x400000c6u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER) */
|
|
||||||
#define SDLK_KP_AMPERSAND 0x400000c7u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND) */
|
|
||||||
#define SDLK_KP_DBLAMPERSAND 0x400000c8u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND) */
|
|
||||||
#define SDLK_KP_VERTICALBAR 0x400000c9u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR) */
|
|
||||||
#define SDLK_KP_DBLVERTICALBAR 0x400000cau /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR) */
|
|
||||||
#define SDLK_KP_COLON 0x400000cbu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON) */
|
|
||||||
#define SDLK_KP_HASH 0x400000ccu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH) */
|
|
||||||
#define SDLK_KP_SPACE 0x400000cdu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE) */
|
|
||||||
#define SDLK_KP_AT 0x400000ceu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT) */
|
|
||||||
#define SDLK_KP_EXCLAM 0x400000cfu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM) */
|
|
||||||
#define SDLK_KP_MEMSTORE 0x400000d0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE) */
|
|
||||||
#define SDLK_KP_MEMRECALL 0x400000d1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL) */
|
|
||||||
#define SDLK_KP_MEMCLEAR 0x400000d2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR) */
|
|
||||||
#define SDLK_KP_MEMADD 0x400000d3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD) */
|
|
||||||
#define SDLK_KP_MEMSUBTRACT 0x400000d4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT) */
|
|
||||||
#define SDLK_KP_MEMMULTIPLY 0x400000d5u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY) */
|
|
||||||
#define SDLK_KP_MEMDIVIDE 0x400000d6u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE) */
|
|
||||||
#define SDLK_KP_PLUSMINUS 0x400000d7u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS) */
|
|
||||||
#define SDLK_KP_CLEAR 0x400000d8u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR) */
|
|
||||||
#define SDLK_KP_CLEARENTRY 0x400000d9u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY) */
|
|
||||||
#define SDLK_KP_BINARY 0x400000dau /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY) */
|
|
||||||
#define SDLK_KP_OCTAL 0x400000dbu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL) */
|
|
||||||
#define SDLK_KP_DECIMAL 0x400000dcu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL) */
|
|
||||||
#define SDLK_KP_HEXADECIMAL 0x400000ddu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL) */
|
|
||||||
#define SDLK_LCTRL 0x400000e0u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL) */
|
|
||||||
#define SDLK_LSHIFT 0x400000e1u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT) */
|
|
||||||
#define SDLK_LALT 0x400000e2u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT) */
|
|
||||||
#define SDLK_LGUI 0x400000e3u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI) */
|
|
||||||
#define SDLK_RCTRL 0x400000e4u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL) */
|
|
||||||
#define SDLK_RSHIFT 0x400000e5u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT) */
|
|
||||||
#define SDLK_RALT 0x400000e6u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT) */
|
|
||||||
#define SDLK_RGUI 0x400000e7u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI) */
|
|
||||||
#define SDLK_MODE 0x40000101u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE) */
|
|
||||||
#define SDLK_SLEEP 0x40000102u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) */
|
|
||||||
#define SDLK_WAKE 0x40000103u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WAKE) */
|
|
||||||
#define SDLK_CHANNEL_INCREMENT 0x40000104u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CHANNEL_INCREMENT) */
|
|
||||||
#define SDLK_CHANNEL_DECREMENT 0x40000105u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CHANNEL_DECREMENT) */
|
|
||||||
#define SDLK_MEDIA_PLAY 0x40000106u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PLAY) */
|
|
||||||
#define SDLK_MEDIA_PAUSE 0x40000107u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PAUSE) */
|
|
||||||
#define SDLK_MEDIA_RECORD 0x40000108u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_RECORD) */
|
|
||||||
#define SDLK_MEDIA_FAST_FORWARD 0x40000109u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_FAST_FORWARD) */
|
|
||||||
#define SDLK_MEDIA_REWIND 0x4000010au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_REWIND) */
|
|
||||||
#define SDLK_MEDIA_NEXT_TRACK 0x4000010bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_NEXT_TRACK) */
|
|
||||||
#define SDLK_MEDIA_PREVIOUS_TRACK 0x4000010cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PREVIOUS_TRACK) */
|
|
||||||
#define SDLK_MEDIA_STOP 0x4000010du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_STOP) */
|
|
||||||
#define SDLK_MEDIA_EJECT 0x4000010eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_EJECT) */
|
|
||||||
#define SDLK_MEDIA_PLAY_PAUSE 0x4000010fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PLAY_PAUSE) */
|
|
||||||
#define SDLK_MEDIA_SELECT 0x40000110u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_SELECT) */
|
|
||||||
#define SDLK_AC_NEW 0x40000111u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_NEW) */
|
|
||||||
#define SDLK_AC_OPEN 0x40000112u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_OPEN) */
|
|
||||||
#define SDLK_AC_CLOSE 0x40000113u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_CLOSE) */
|
|
||||||
#define SDLK_AC_EXIT 0x40000114u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_EXIT) */
|
|
||||||
#define SDLK_AC_SAVE 0x40000115u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SAVE) */
|
|
||||||
#define SDLK_AC_PRINT 0x40000116u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_PRINT) */
|
|
||||||
#define SDLK_AC_PROPERTIES 0x40000117u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_PROPERTIES) */
|
|
||||||
#define SDLK_AC_SEARCH 0x40000118u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH) */
|
|
||||||
#define SDLK_AC_HOME 0x40000119u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME) */
|
|
||||||
#define SDLK_AC_BACK 0x4000011au /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK) */
|
|
||||||
#define SDLK_AC_FORWARD 0x4000011bu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD) */
|
|
||||||
#define SDLK_AC_STOP 0x4000011cu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP) */
|
|
||||||
#define SDLK_AC_REFRESH 0x4000011du /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH) */
|
|
||||||
#define SDLK_AC_BOOKMARKS 0x4000011eu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS) */
|
|
||||||
#define SDLK_SOFTLEFT 0x4000011fu /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT) */
|
|
||||||
#define SDLK_SOFTRIGHT 0x40000120u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT) */
|
|
||||||
#define SDLK_CALL 0x40000121u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL) */
|
|
||||||
#define SDLK_ENDCALL 0x40000122u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL) */
|
|
||||||
#define SDLK_LEFT_TAB 0x20000001u /**< Extended key Left Tab */
|
|
||||||
#define SDLK_LEVEL5_SHIFT 0x20000002u /**< Extended key Level 5 Shift */
|
|
||||||
#define SDLK_MULTI_KEY_COMPOSE 0x20000003u /**< Extended key Multi-key Compose */
|
|
||||||
#define SDLK_LMETA 0x20000004u /**< Extended key Left Meta */
|
|
||||||
#define SDLK_RMETA 0x20000005u /**< Extended key Right Meta */
|
|
||||||
#define SDLK_LHYPER 0x20000006u /**< Extended key Left Hyper */
|
|
||||||
#define SDLK_RHYPER 0x20000007u /**< Extended key Right Hyper */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Valid key modifiers (possibly OR'd together).
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
typedef Uint16 SDL_Keymod;
|
|
||||||
|
|
||||||
#define SDL_KMOD_NONE 0x0000u /**< no modifier is applicable. */
|
|
||||||
#define SDL_KMOD_LSHIFT 0x0001u /**< the left Shift key is down. */
|
|
||||||
#define SDL_KMOD_RSHIFT 0x0002u /**< the right Shift key is down. */
|
|
||||||
#define SDL_KMOD_LEVEL5 0x0004u /**< the Level 5 Shift key is down. */
|
|
||||||
#define SDL_KMOD_LCTRL 0x0040u /**< the left Ctrl (Control) key is down. */
|
|
||||||
#define SDL_KMOD_RCTRL 0x0080u /**< the right Ctrl (Control) key is down. */
|
|
||||||
#define SDL_KMOD_LALT 0x0100u /**< the left Alt key is down. */
|
|
||||||
#define SDL_KMOD_RALT 0x0200u /**< the right Alt key is down. */
|
|
||||||
#define SDL_KMOD_LGUI 0x0400u /**< the left GUI key (often the Windows key) is down. */
|
|
||||||
#define SDL_KMOD_RGUI 0x0800u /**< the right GUI key (often the Windows key) is down. */
|
|
||||||
#define SDL_KMOD_NUM 0x1000u /**< the Num Lock key (may be located on an extended keypad) is down. */
|
|
||||||
#define SDL_KMOD_CAPS 0x2000u /**< the Caps Lock key is down. */
|
|
||||||
#define SDL_KMOD_MODE 0x4000u /**< the !AltGr key is down. */
|
|
||||||
#define SDL_KMOD_SCROLL 0x8000u /**< the Scroll Lock key is down. */
|
|
||||||
#define SDL_KMOD_CTRL (SDL_KMOD_LCTRL | SDL_KMOD_RCTRL) /**< Any Ctrl key is down. */
|
|
||||||
#define SDL_KMOD_SHIFT (SDL_KMOD_LSHIFT | SDL_KMOD_RSHIFT) /**< Any Shift key is down. */
|
|
||||||
#define SDL_KMOD_ALT (SDL_KMOD_LALT | SDL_KMOD_RALT) /**< Any Alt key is down. */
|
|
||||||
#define SDL_KMOD_GUI (SDL_KMOD_LGUI | SDL_KMOD_RGUI) /**< Any GUI key is down. */
|
|
||||||
|
|
||||||
#endif /* SDL_keycode_h_ */
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WIKI CATEGORY: SharedObject */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategorySharedObject
|
|
||||||
*
|
|
||||||
* System-dependent library loading routines.
|
|
||||||
*
|
|
||||||
* Shared objects are code that is programmatically loadable at runtime.
|
|
||||||
* Windows calls these "DLLs", Linux calls them "shared libraries", etc.
|
|
||||||
*
|
|
||||||
* To use them, build such a library, then call SDL_LoadObject() on it. Once
|
|
||||||
* loaded, you can use SDL_LoadFunction() on that object to find the address
|
|
||||||
* of its exported symbols. When done with the object, call SDL_UnloadObject()
|
|
||||||
* to dispose of it.
|
|
||||||
*
|
|
||||||
* Some things to keep in mind:
|
|
||||||
*
|
|
||||||
* - These functions only work on C function names. Other languages may have
|
|
||||||
* name mangling and intrinsic language support that varies from compiler to
|
|
||||||
* compiler.
|
|
||||||
* - Make sure you declare your function pointers with the same calling
|
|
||||||
* convention as the actual library function. Your code will crash
|
|
||||||
* mysteriously if you do not do this.
|
|
||||||
* - Avoid namespace collisions. If you load a symbol from the library, it is
|
|
||||||
* not defined whether or not it goes into the global symbol namespace for
|
|
||||||
* the application. If it does and it conflicts with symbols in your code or
|
|
||||||
* other shared libraries, you will not get the results you expect. :)
|
|
||||||
* - Once a library is unloaded, all pointers into it obtained through
|
|
||||||
* SDL_LoadFunction() become invalid, even if the library is later reloaded.
|
|
||||||
* Don't unload a library if you plan to use these pointers in the future.
|
|
||||||
* Notably: beware of giving one of these pointers to atexit(), since it may
|
|
||||||
* call that pointer after the library unloads.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_loadso_h_
|
|
||||||
#define SDL_loadso_h_
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An opaque datatype that represents a loaded shared object.
|
|
||||||
*
|
|
||||||
* \since This datatype is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LoadObject
|
|
||||||
* \sa SDL_LoadFunction
|
|
||||||
* \sa SDL_UnloadObject
|
|
||||||
*/
|
|
||||||
typedef struct SDL_SharedObject SDL_SharedObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dynamically load a shared object.
|
|
||||||
*
|
|
||||||
* \param sofile a system-dependent name of the object file.
|
|
||||||
* \returns an opaque pointer to the object handle or NULL on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LoadFunction
|
|
||||||
* \sa SDL_UnloadObject
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_SharedObject * SDLCALL SDL_LoadObject(const char *sofile);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Look up the address of the named function in a shared object.
|
|
||||||
*
|
|
||||||
* This function pointer is no longer valid after calling SDL_UnloadObject().
|
|
||||||
*
|
|
||||||
* This function can only look up C function names. Other languages may have
|
|
||||||
* name mangling and intrinsic language support that varies from compiler to
|
|
||||||
* compiler.
|
|
||||||
*
|
|
||||||
* Make sure you declare your function pointers with the same calling
|
|
||||||
* convention as the actual library function. Your code will crash
|
|
||||||
* mysteriously if you do not do this.
|
|
||||||
*
|
|
||||||
* If the requested function doesn't exist, NULL is returned.
|
|
||||||
*
|
|
||||||
* \param handle a valid shared object handle returned by SDL_LoadObject().
|
|
||||||
* \param name the name of the function to look up.
|
|
||||||
* \returns a pointer to the function or NULL on failure; call SDL_GetError()
|
|
||||||
* for more information.
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LoadObject
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_LoadFunction(SDL_SharedObject *handle, const char *name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unload a shared object from memory.
|
|
||||||
*
|
|
||||||
* Note that any pointers from this object looked up through
|
|
||||||
* SDL_LoadFunction() will no longer be valid.
|
|
||||||
*
|
|
||||||
* \param handle a valid shared object handle returned by SDL_LoadObject().
|
|
||||||
*
|
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_LoadObject
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC void SDLCALL SDL_UnloadObject(SDL_SharedObject *handle);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_loadso_h_ */
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
/*
|
|
||||||
Simple DirectMedia Layer
|
|
||||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # CategoryLocale
|
|
||||||
*
|
|
||||||
* SDL locale services.
|
|
||||||
*
|
|
||||||
* This provides a way to get a list of preferred locales (language plus
|
|
||||||
* country) for the user. There is exactly one function:
|
|
||||||
* SDL_GetPreferredLocales(), which handles all the heavy lifting, and offers
|
|
||||||
* documentation on all the strange ways humans might have configured their
|
|
||||||
* language settings.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SDL_locale_h
|
|
||||||
#define SDL_locale_h
|
|
||||||
|
|
||||||
#include <SDL3/SDL_stdinc.h>
|
|
||||||
#include <SDL3/SDL_error.h>
|
|
||||||
|
|
||||||
#include <SDL3/SDL_begin_code.h>
|
|
||||||
/* Set up for C function definitions, even when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
extern "C" {
|
|
||||||
/* *INDENT-ON* */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A struct to provide locale data.
|
|
||||||
*
|
|
||||||
* Locale data is split into a spoken language, like English, and an optional
|
|
||||||
* country, like Canada. The language will be in ISO-639 format (so English
|
|
||||||
* would be "en"), and the country, if not NULL, will be an ISO-3166 country
|
|
||||||
* code (so Canada would be "CA").
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*
|
|
||||||
* \sa SDL_GetPreferredLocales
|
|
||||||
*/
|
|
||||||
typedef struct SDL_Locale
|
|
||||||
{
|
|
||||||
const char *language; /**< A language name, like "en" for English. */
|
|
||||||
const char *country; /**< A country, like "US" for America. Can be NULL. */
|
|
||||||
} SDL_Locale;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Report the user's preferred locale.
|
|
||||||
*
|
|
||||||
* Returned language strings are in the format xx, where 'xx' is an ISO-639
|
|
||||||
* language specifier (such as "en" for English, "de" for German, etc).
|
|
||||||
* Country strings are in the format YY, where "YY" is an ISO-3166 country
|
|
||||||
* code (such as "US" for the United States, "CA" for Canada, etc). Country
|
|
||||||
* might be NULL if there's no specific guidance on them (so you might get {
|
|
||||||
* "en", "US" } for American English, but { "en", NULL } means "English
|
|
||||||
* language, generically"). Language strings are never NULL, except to
|
|
||||||
* terminate the array.
|
|
||||||
*
|
|
||||||
* Please note that not all of these strings are 2 characters; some are three
|
|
||||||
* or more.
|
|
||||||
*
|
|
||||||
* The returned list of locales are in the order of the user's preference. For
|
|
||||||
* example, a German citizen that is fluent in US English and knows enough
|
|
||||||
* Japanese to navigate around Tokyo might have a list like: { "de", "en_US",
|
|
||||||
* "jp", NULL }. Someone from England might prefer British English (where
|
|
||||||
* "color" is spelled "colour", etc), but will settle for anything like it: {
|
|
||||||
* "en_GB", "en", NULL }.
|
|
||||||
*
|
|
||||||
* This function returns NULL on error, including when the platform does not
|
|
||||||
* supply this information at all.
|
|
||||||
*
|
|
||||||
* This might be a "slow" call that has to query the operating system. It's
|
|
||||||
* best to ask for this once and save the results. However, this list can
|
|
||||||
* change, usually because the user has changed a system preference outside of
|
|
||||||
* your program; SDL will send an SDL_EVENT_LOCALE_CHANGED event in this case,
|
|
||||||
* if possible, and you can call this function again to get an updated copy of
|
|
||||||
* preferred locales.
|
|
||||||
*
|
|
||||||
* \param count a pointer filled in with the number of locales returned, may
|
|
||||||
* be NULL.
|
|
||||||
* \returns a NULL terminated array of locale pointers, or NULL on failure;
|
|
||||||
* call SDL_GetError() for more information. This is a single
|
|
||||||
* allocation that should be freed with SDL_free() when it is no
|
|
||||||
* longer needed.
|
|
||||||
*
|
|
||||||
* \since This function is available since SDL 3.2.0.
|
|
||||||
*/
|
|
||||||
extern SDL_DECLSPEC SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count);
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
}
|
|
||||||
/* *INDENT-ON* */
|
|
||||||
#endif
|
|
||||||
#include <SDL3/SDL_close_code.h>
|
|
||||||
|
|
||||||
#endif /* SDL_locale_h */
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user