Skip to content

Latest commit

 

History

History
130 lines (83 loc) · 5.2 KB

README.md

File metadata and controls

130 lines (83 loc) · 5.2 KB

sdl2-sokoban Build Status

Cross-platform Sokoban clone written in C++ and SDL2. Maps authored using Tiled map editor and loaded using TMX C Loader.


Dependencies

This project depends on SDL2, SDL_image 2.0, SDL_ttf 2.0 and TMX C Loader, which depends on zlib and LibXML2.

Installing dependencies on Windows

It is assumed that tar and curl are available.

Clone the repository and install dependencies by running the provided batch scripts from a Visual Studio Native Tools Command Prompt

git clone https://github.com/howprice/sdl2-sokoban
scripts\install_sdl.bat
scripts\install_tmx.bat

Alternatively the SDL2, SDL_image 2.0 and SDL_ttf 2.0 Windows VC development libraries can be unzipped manually into the 3rdParty folder, removing the version numbers from the directory names.

To install TMX manually see TMX.md.

To use different lib versions edit the variables at the top of install_sdl.bat and install_tmx.bat.

Installing dependencies on Linux

Install developer libs using a package manager. For example, for Ubuntu and Raspberry Pi:

sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-image-dev
sudo apt-get install libsdl2-ttf-dev
sudo apt install libxml2-dev
sudo apt install cmake

Clone, build and install TMX C Loader

git clone https://github.com/baylej/tmx
cd tmx
mkdir build
cd build
cmake ..
make
sudo make install   

Installing dependencies on Mac OS X

brew install sdl2
brew install sdl2_image
brew install sdl2_ttf
brew install cmake
git clone https://github.com/baylej/tmx
cd tmx
mkdir build
cd build
cmake ..
make
sudo make install  

Building and Running

This project uses GENie to generate the build files for the target platform. The GENie executables for Windows, Linux, Mac OS X and Raspberry Pi can be found in the tools directory for convenience.

There are three build configurations:

  • Debug - no optimisations, symbols, asserts
  • Dev - optimisations, symbols, asserts
  • Release - optimisations, no symbols, no asserts

Windows

Run genie_vs2017.bat or genie_vs2019.bat to generate the Visual Studio Solution and Project files into the 'build' folder. Build and run from within Visual Studio, or build from the command line with MSBuild.

Linux (including Raspberry Pi)

Clone this repo, build the makefiles and build:

$ git clone https://github.com/howprice/sdl2-sokoban
$ cd sdl2-sokoban
$ scripts/genie_gmake.sh
$ cd build
$ make

n.b. You may need to 'chmod +x' genie executable and or .sh shell script files.

make with no config specified defaults to the debug config for native architecture (usually 64-bit). Can call make config=<xxx> where xxx can be debug, dev, release, debug32, dev32, release32, debug64, dev64 or release64. Or type make help for more info. Make sure you're in the build folder.

To run the game

$ cd data
$ ../bin/x86/debug/sdl2-sokoban   (or x64, or dev or release)

Mac OS X

Clone this repo, build the makefiles for either gcc (aliased to clang on Mac) or Xcode:

$ scripts/genie_gmake.sh   // then build and run as Linux above

or

$ scripts/genie_xcode10.sh   // then build and run in XCode

Cleaning the build files

Run genie_clean.bat on Windows or genie_clean.sh on other platforms.

Controls

Cursor keys

Links and thanks

TODO

License

See the LICENSE file for details.