2019-12-05 11:25:55 +03:00
|
|
|
# sdl
|
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
SDL2 V module -- libSDL2 wrapper.
|
|
|
|
|
|
|
|
Current APIs available/tested in examples:
|
2019-12-05 11:25:55 +03:00
|
|
|
- basic graphics (2D drawing)
|
|
|
|
- [Image](image/README.md)
|
|
|
|
- TTF font (text rendering)
|
|
|
|
- input handling (keyboard/joystick events)
|
|
|
|
- sounds (WAV mixing)
|
|
|
|
- music (MOD mixing)
|
|
|
|
- more to come.. (networking ?)
|
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
## Support
|
|
|
|
sdl is supported on:
|
|
|
|
- Linux (major distros)
|
2019-12-05 11:25:55 +03:00
|
|
|
- MacOS (brew)
|
2020-03-06 22:43:33 +03:00
|
|
|
- Windows
|
2019-12-05 11:25:55 +03:00
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
## Examples
|
2019-12-05 11:25:55 +03:00
|
|
|
|
|
|
|
[tVintris](examples/tvintris)
|
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
![tVintris screenshot](/examples/sdl/tvintris/images/tvintris.png)
|
2019-12-05 11:25:55 +03:00
|
|
|
|
|
|
|
You can run the tVintris example from the V root folder like this :
|
|
|
|
```
|
|
|
|
v run vlib/sdl/examples/tvintris/tvintris.v
|
|
|
|
```
|
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
### Linux
|
2019-12-05 11:25:55 +03:00
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
#### Fedora
|
2019-12-05 11:25:55 +03:00
|
|
|
`$ sudo dnf install SDL2-devel SDL2_ttf-devel SDL2_mixer-devel SDL2_image-devel`
|
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
#### Ubuntu
|
2019-12-05 11:25:55 +03:00
|
|
|
`$ sudo apt install libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev`
|
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
#### ClearLinux
|
2019-12-05 11:25:55 +03:00
|
|
|
`$ sudo swupd bundle-add devpkg-SDL2_ttf devpkg-SDL2_mixer devpkg-SDL2_image`
|
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
### MacOS
|
|
|
|
|
|
|
|
#### Brew
|
2019-12-05 11:25:55 +03:00
|
|
|
`$ brew install sdl2 sdl2_gfx sdl2_ttf sdl2_mixer sdl2_image sdl2_net`
|
|
|
|
|
2019-12-09 03:18:08 +03:00
|
|
|
If you get no music with the above, try:
|
|
|
|
`$ brew reinstall --build-from-source --force sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf webp libtiff libmodplug libogg`
|
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
### Windows
|
|
|
|
|
|
|
|
`$ .github\workflows\windows-install-sdl.bat`
|
2019-12-05 11:25:55 +03:00
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
## Contributions
|
2019-12-05 11:25:55 +03:00
|
|
|
|
2020-03-06 22:43:33 +03:00
|
|
|
- nsauzede
|
|
|
|
- spytheman
|
|
|
|
- adlesh
|