donwilson / Game-Boilerplate

A boilerplate for building small games using SFML/Thor w/Sublime Text 2 and GCC to build/compile

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Game Project Template

Boilerplate for quickly getting started with SFML 2.3 and Thor while using Sublime Text 2 as the project/build manager and MinGW G++ for compiling.

Source files are located in src/. A few C++ structs are included, namely Game, Screen, and Level. Level (for now) is where most new code will be placed. Game runs the show and Screen manages most of the window management and drawing with SFML. utils.hpp is used for storing miscellaneous functions.

Images, sounds, fonts, etc are stored in resources/ (which can be easily accessed through SFML's loadFromFile() functions using 'resources/...').

Open the project in Sublime Text 2 by opening Project.sublime-project. Select Build & Run from the Tools > Build System pulldown. CTRL + B will run compile.bat (compile.sh for linux) which gathers C++ files, starts the build, automatically opens the newly built project (if possible), logs output to the Sublime Text console window, and cleans up all build-related files upon exit. Executables are built to build/win32/main.exe (build/linux/main for linux).

Prerequisites

This project uses a few external requirements like GCC 4.9.2, SFML 2.3.2 (GCC 4.9.2), and Thor v2.0 (mingw). They're extracted into their relative directories into C:\dev_resources\. This is primarily focused for Windows development but notes for building to Linux is also included.

Windows

compile.bat automatically sets (and reverts) environment variables so you don't have to manually add the above paths to your %PATH% environment variable. It's recommended to not have MinGW/SFML/Thor directories in your %PATH% variable if you already do.

libstdc++-6.dll in build/win32/ is necesary to run a newly built main.exe. This is likely due to my inexperience with building projects using G++.

Linux

Install GCC 4.9.2. Extract SFML (GCC) - 32-bit and Thor into /root/sfml/ and /root/thor/ respectively. If another path is chosen (and you should), be sure to update compile.sh. Also, be sure to chmod +x compile.sh.

Future

  • OS X additions to build requirements/build script
  • Better cleanup on build errors
  • other useful library support
  • Game states
  • Entities
  • Tilemap class
  • Switch from structs to classes

Related documentation links

MinGW has a helpful C Preprocessor page.

SFML 2.3 has helpful pages like their documentation tutorials, class index, and wiki examples.

Thor v2.0+ documentation can be found here.

Helpful links

About

A boilerplate for building small games using SFML/Thor w/Sublime Text 2 and GCC to build/compile


Languages

Language:C++ 70.7%Language:Batchfile 18.7%Language:Shell 10.6%