nsauzede / sdl2test

🎬 Testing SDL2 with V, Rust, C/++ : Nuklear, ImGui, TTF, 2D/3D, joystick, sounds, music, ...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sdl2test

Small examples of libSDL2 usage in V, C and C++ languages. Historically, the purpose was to evaluate the changes from SDL1 to SDL2.

Note that the V modules wrapping : SDL2, Imgui and Nuklear have been moved to their separate git repo, and are still used/demonstrated here as git sub-modules.

You can find their own repos here:


  • cratesan is a Sokoban clone, in Rust and V

  • tvintris_v.v is a dual-player (local) version, inspired by ancient game Twintris. It uses published vpm module nsauzede.vsdl2

  • tvintrisgl_v.v is a dual-player (local) version with OpenGL, inspired by ancient game Twintris. It uses published vpm module nsauzede.vsdl2 This OpenGL version still lacks TTF font for now, however

Credits

  • tetris_v.v is just and SDL2 port of original source from vlang/v example by Alex I wrote a simple SDL2 V wrapper, ported GLFW usage to SDL2, tweaked colors and added music & sounds

Colors, Music and Sounds ripped from amiga title Twintris (1990 nostalgia !)

  • Graphician : Svein Berge
  • Musician : Tor Bernhard Gausen (Walkman/Cryptoburners)

Dependencies

Ubuntu : $ sudo apt install libsdl2-ttf-dev libsdl2-mixer-dev libssl-dev And optionally for extra tests : $ sudo apt install libglfw3-dev libglm-dev libfreetype-dev

Archlinux: $ sudo pacman -S glew glm And maybe other similar packages as for Ubuntu above?

ClearLinux : (maybe miss libopenssl dev ?) $ sudo swupd bundle-add devpkg-SDL2_ttf devpkg-SDL2_mixer

Windows/MSYS2 : (maybe miss libopenssl dev ?) $ pacman -S mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer

How to build all (including vsdl2, vnk, vig..)

Eg: on Linux:

sdl2test$ make

Can then run eg: VNK, VIG demo:

sdl2test$ ./mainnk.exe
sdl2test$ ./mainig.exe

Misc

Makefile auto-detects available SDL version (2 or 1)

Old notes:

  • vsdl : naive V wrapper for SDL2 binding (obsolete - rather see nsauzede/vsdl2)
  • CSDL : small C++ class to abstract SDL1/2
  • various C and V examples

About

🎬 Testing SDL2 with V, Rust, C/++ : Nuklear, ImGui, TTF, 2D/3D, joystick, sounds, music, ...

License:MIT License


Languages

Language:V 48.1%Language:C++ 20.6%Language:C 18.5%Language:Rust 9.1%Language:Makefile 3.0%Language:Coq 0.4%Language:GLSL 0.2%Language:AMPL 0.0%