A small game that just animates a few characters, and a menu to start and stop animation. The purpose of this was to simplify an animation system I created for another project
A live example can be run here Click me!
Platform | Status |
---|---|
Windows - MingGW | ✔️ |
Windows - MSVC | ✔️ |
OSX | ✔️ |
Browser - Emscripten | ✔️ |
Through CLI:
git clone https://github.com/Reesy/sdl-rpg-battle-system
Graphically (this will also generate a project on your profile)
This project has a dependency on SDL2 and SDL_image (which I have bundled under /libs) but can be found at libsdl.org.
- Requirements
- CMake -- required to build this project
- Recommended Plugins
- C/C++ Plugin
- CodeLLDB*
To build a Visual Studios project (the .vcxproj file will be placed in the sdl2-emscripten-project-template/build folder)
cmake . -B build
To build a release on OSX or MinGW (if using -G "MinGW Makefiles"
):
cmake . -B build
make
To build for browser with Emscripten (requires emscripten installed and on the path):
emcmake cmake . -B build
To build with debug symbols (on OSX):
cmake -DCMAKE_BUILD_TYPE=Debug . -B build
make
Manually building with MinGW for 32bit:
g++ ../src/main.cpp -o testApp \
-I ../libs/mingw/SDL2-2.0.14/i686-w64-mingw32/include/SDL2 \
-I ../libs/mingw/SDL2_image-2.0.5/i686-w64-mingw32/include/SDL2 \
-L ../libs/mingw/SDL2-2.0.14/i686-w64-mingw32/lib/ \
-L ../libs/mingw/SDL2_image-2.0.5/i686-w64-mingw32/lib/ \
-lmingw32 -lSDL2main -lSDL2 -lSDL2_image
Manually building with emscripten
emcc src/main.cpp -s WASM=1 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -O3 -o index.js
This will create a make file and copy a basic index.html and python script to the embuild folder
emcmake cmake -B embuild .
cd embuild && make
Serving the file using httpserver with Python 2: python -m SimpleHTTPServer 8080
The emscripten build must me run first
emcmake cmake -B embuild .
cd embuild && make
docker build -t <desired_image_name> .
docker run --name <desired_container_name> -p <desired_port>:3000 <desired_image_name>
You will then be able to view the application on http://localhost:<desired_port>
i.e http://localhost:3000
This project comes with a .vscode folder prebundled to make debugging easier, for this to work two plugins are necessary
*CodeLLDB is only recommended for debugging on modern OSX versions
SDL2 can be found https://www.libsdl.org/