A blank for a SDL2-based platformer game

Related tags

Game sdl2-demo
Overview

A blank for a SDL2-based platformer game

Attention, this repository does not contain (and never will) a playable game. The goal is to show basic principles to my students, so it is only a demo repo. Here is an example of what is inside:

Check the wiki for the detailed description of how the project is built.

At the moment of this writing the repository contains less than 300 lines of code:

[email protected]:~/sdl2-demo/src$ cat *.cpp *.h | wc -l
296

Compilation (tested on linux and windows, macos is yet to try)

git clone --recurse-submodules https://github.com/ssloy/sdl2-demo.git &&
cd sdl2-demo &&
mkdir build &&
cd build &&
cmake .. &&
cmake --build . -j &&
./sdl2-demo

You can open the project in Gitpod, a free online dev environment for GitHub:

Open in Gitpod

On open, the editor will compile & run the program as well as open the resulting image in the editor's preview. Just change the code in the editor and rerun the script (use the terminal's history) to see updated images. Note how awesome Gitpod is, it allows to run SDL2 games directly in the browser!

You might also like...
A good & simple gameplay loop for C and SDL2.

FPSLoop A good & simple gameplay loop for C and SDL2. Dependencies A C compiler SDL2 Building The easiest way is just to run make, which will build th

sdl4cpp, header-only C++ wrapper around SDL2.

sdl4cpp sdl4cpp, header-only C++ wrapper around SDL2 (heavily work-in-progress) An example: #include "sdl4cpp/sdl4.hpp" #include "sdl4cpp/timer.hpp" #

Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World.
Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World.

OpenXRay OpenXRay is an improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World. S

Stealthy way to hijack the existing game process handle within the game launcher (currently supports Steam and Battle.net). Achieve external game process read/write with minimum footprint.
Stealthy way to hijack the existing game process handle within the game launcher (currently supports Steam and Battle.net). Achieve external game process read/write with minimum footprint.

Launcher Abuser Stealthy way to hijack the existing game process handle within the game launcher (currently supports Steam and Battle.net). Achieve ex

Game Boy, Game Boy Color, and Game Boy Advanced Emulator
Game Boy, Game Boy Color, and Game Boy Advanced Emulator

SkyEmu SkyEmu is low level cycle accurate GameBoy, GameBoy Color and Game Boy Advance emulator that I have been developing in my spare time. Its prima

SameBoy DX is a Qt-based interface of SameBoy, a free, highly accurate Game Boy and Game Boy Color emulator.

SameBoy DX SameBoy DX is a Qt-based interface of SameBoy, a free, highly accurate Game Boy and Game Boy Color emulator. Build requirements: CMake Pyth

To recreate the board game Scotland yard and  enable a single player to play the game by letting one of the roles being played by the computer based on written algorithm
To recreate the board game Scotland yard and enable a single player to play the game by letting one of the roles being played by the computer based on written algorithm

Scotland Yard GAME OF SCOTLAND YARD This is a custom version of the classic board game, Scotland Yard .The game uses the London map used in the origin

Ncurses based omok game, execute omok game in your terminal
Ncurses based omok game, execute omok game in your terminal

omok_game execute omok game in your terminal Omok game played by two people. 한국어 버전(korean version)

A cycle-accurate Game Boy and Game Boy Color Emulator, with rewind feature.
A cycle-accurate Game Boy and Game Boy Color Emulator, with rewind feature.

Azayaka is a free and open-source Game Boy and Game Boy Color emulator written in C++. Features Cycle-Accurate emulation. Console based Debugg

Comments
  • Предложение некотрых изменений

    Предложение некотрых изменений

    Добрый день,

    решил быть несколько более конструктивным после нашей беседы на Хабре и предложить вам несколько изменений. По большому счёту основные изменения лежат в области переработки кода класса Animation, который, по моему мнению, не должен наследовать от Sprite. Вместо этого в структуре player отдельно создаются необходимые объекты типа Sprite, а затем часть информации из них используется для инициализации Animation. Логика этого изменения предельно проста: Анимация не является Sprite, но Sprite может быть анимирован. Изменения не критические и не несут большое значение, но с точки зрения архитектуры имеют смысл.

    Буду рад услышать ваше мнение :) С уважением Сергей

    opened by besworland 1
Owner
Dmitry V. Sokolov
Dmitry V. Sokolov
Full source code for WarriOrb, a Dark-Souls like action platformer - using Unreal Engine 4

WarriOrb source code WarriOrb is a hardcore action platformer where you play as a demon who is trapped in an unlikely body. The game mixes the difficu

Not Yet 247 Dec 30, 2022
Project 1945 is a top down scroller game made with SDL2, CMake and programmed in C as a project of study for the Italian Videogames Academy for the 3rd year course of Videogames programming.

Project 1945 is a top down scroller game made with SDL2, CMake and programmed in C as a project of study for the Italian Videogames Academy for the 3rd year course of Videogames programming. The game is based on the old videogame 1945: The Final Front of the 2002.

null 19 Dec 30, 2022
A tester for game controller written in C, using SDL2.

SDL2 Controller Tester This little application has been made while I was attending a tutorial to make games in C using SDL2. Since my purpose will be

Michele Righi 16 Jan 4, 2023
A (broken) SDL2 game made in 48 hours

Twini-Golf Twini-Golf is a game created in 48 hours for the 2021 GMTK Game Jam using C++ and SDL2. It can be played on itch.io. Screenshots Background

PolyMars 186 Dec 30, 2022
A game called Lavendachrysanth. I am working on using SDL2 and C++(Originally ran on windows 10)

Lavendachrysanth A game called Lavendachrysanth. I am working on using SDL2 and C++(Originally ran on windows 10) MinGW 6.3.0-1 Vscode 1.61.2 GNU Make

Sitanshu Shrestha 0 Aug 29, 2022
Game engine in c++ and SDL2

Netune game engine How to build As said, all work is in progress, if you want to run it you need to have SDL2 configured on your machine. This makefil

Pedro Lucas 4 May 24, 2022
Implementation of Conway's Game of Life in C++ with SDL2

Conway's Game of Life Implementation of Conway's Game of Life in C++ with SDL2. Usage make sure SDL2 is well configured. make run click on screen to m

Juni May 2 Feb 12, 2022
SDL2 example games

SDL games Just a repository for make retro and new games with SDL and C++... Snake The classic game that everyone in our life has played, be a Snake a

Juan Salazar 1 Nov 16, 2021
Chessclone with SDL2

Chess Description Links Repo Screenshots Built With C++ Visual Studio 2019 SDL2 SDL2_Image Build process Clone the repository copy "sdl2-config.cmake"

Julian Unland 62 Dec 28, 2022
Super Mario Bros in C++ under SDL2

Super Mario Bros DEMO! Super Mario Bros in C++ under SDL2. This game is a DEMO with his first world! How to compile Code::Blocks is needed (although w

Gastón Martínez 1 Aug 22, 2022