Skip to content

Reesy/sdl-rpg-battle-system

Repository files navigation

sdl-rpg-battle-system

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!

Supported platforms

Platform Status
Windows - MingGW ✔️
Windows - MSVC ✔️
OSX ✔️
Browser - Emscripten ✔️

Cloning:

Through CLI:

git clone https://github.com/Reesy/sdl-rpg-battle-system

Graphically (this will also generate a project on your profile)

image

Building:

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

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
The 'resources' folder needs to exist in the same directory as the .exe file (on OSX it will be automatically bundled into the app

Manual building without CMake

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

Building and hosting on the web

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

Hosting with docker

Building the image

The emscripten build must me run first

emcmake cmake -B embuild . 
cd embuild && make
docker build -t <desired_image_name> .

Running the image

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

Debugging

This project comes with a .vscode folder prebundled to make debugging easier, for this to work two plugins are necessary

Recommended Plugins
C/C++ Plugin
CodeLLDB*

*CodeLLDB is only recommended for debugging on modern OSX versions

SDL2 can be found https://www.libsdl.org/

About

A standard RPG battle system written in SDL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages