[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Advik-B/game-template-2D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game Template 2D

This is a basic template for making SFML games in C++. I made this template because I often find myself writing the same, boring CMake files.

Installation (for development)

Prerequisites

⚪ Optional but recommended

🟩 REQUIRED

🟨 NOT recommended

Item Required (see legend)
CMake 🟩
Ninja 🟩
Any compiler 🟩
ccache
CLion IDE
MinGW 🟨

Click this button on top (or just click the button below)

image

Or simply download the source code via git clone or press image and download zip.

Unzip your files into a folder. The folder structure should look like this:

game-template-2D
├── .gitignore
├── CMakeLists.txt
├── .idea/* (we dont care about this for now)
├── src
│   ├── main.cpp
│   └── Window.cpp
└── include
    └── Window.hpp

Open any shell of your choice.

Note for Windows users (click to expand) When using Windows

MAKE SURE TO USE DEVELOPER COMMAND PROMPT/DEVELOPER POWERSHELL for this step.

Navigate to the project folder and create a build folder:

mkdir build
cd build

Generate CMake files:

Note for Windows users (click to expand) If you have MinGW installed, make sure to add:
-DCMAKE_IGNORE_PATH=D:\Path\to\mingw

So that it dosent use mingw in the compilation process

cmake -DCMAKE_BUILD_TYPE=Release -G Ninja ..

If you have any issues with until now, then go back and retry If you still have issues, open an issue ticket via github

Finally, we get to the exceiting part

run the build command, in the same directory you generated the cmake files

cmake --build . --config Release

If everything goes well 🤞...

You should have an executable in:

bin/Release

(I am assuming you are in the game-template-2D/build directory already.)

Run the executable bin/Release (warning, flashing colors).

It should display a window similar to this: image

or (Flashing colors warning)

NVIDIA_Share_lvWIXuQbh6.mp4

Tada ✨

Happy Developing

Compilers

Here is a list of compilers that are recommended by me for the respective OS:

OS Compiler
Windows MSVC
Mac clang/g++
Linux g++

Warning

DO NOT, FOR THE LOVE OF GOD, USE MINGW ON WINDOWS.

IT WILL RUN FINE ON YOUR PC/Laptop, BUT IT WILL INTRODUCE MANY MORE PROBLEMS WHEN YOU DISTRIBUTE YOUR PROGRAM.

Use the Visual Studio compiler from Microsoft instead; you will be doing yourself a favor.

About

A C++ game template for making 2D games

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published