/Cursor-Custodian

A small SDL2 game made in 48 hours

Primary LanguageC++

Cursor Custodian

Cursor Custodian is a game created in 48 hours for the 2020 GMTK Game Jam using C++ and SDL2. It can be played in your web browser here.

Screenshots

Background

Cursor Custodian is a simple endless platformer where you use your cursor to guide the player away from obstacles. The player moves away from your cursor and will jump if you click the left mouse button near him. More information on how to play is available on the game's itch.io page.

Compiling

Windows

After installing Mingw64, SDL2, SDL_Image, SDL_TTF, and SDL_Mixer, execute the following command in the project's root directory:

g++ -c src/*.cpp -std=c++14 -O3 -Wall -m64 -I include -I C:/SDL2-w64/include && g++ *.o -o bin/release/main -s -L C:/SDL2-w64/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer && start bin/release/main

The compiled .exe is located in ./bin. For it to run, you must copy the ./res folder as well as all .dll files from your SDL installation to its directory.

Linux

After installing the dev packages of SDL2 for your distribution, execute the following command in the project's root directory:

g++ -c src/*.cpp -std=c++14 -O3 -Wall -m64 -I include && mkdir -p bin/release && g++ *.o -o bin/release/main -s -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer

The compiled binary main is located in ./bin. For it to run, you must copy the ./res folder to its directory.

Web

Install emscripten and execute the following command in the project's root directory:

emcc src/main.cpp src/entity.cpp src/renderwindow.cpp src/player.cpp src/ground.cpp src/groundtile.cpp -I include -O2 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s \"SDL2_IMAGE_FORMATS=['png']\" -s USE_SDL_TTF=2 -s USE_SDL_MIXER=2 --preload-file res -o index.html

The compiled .js, .wasm, .data, and .html files are located in the project's root.

Contributing

Pull requests are welcome! For major refactors, please open an issue first to discuss what you would like to improve. Feel free to create a fork of this repository or use the code for any other noncommercial purposes.