Skip to content

Writing a 2D Platform Game in Zig language with SDL

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-nim-platformer.txt
Notifications You must be signed in to change notification settings

dinau/zig-platformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zig-Platformer


alt alt
alt alt

Tutorial: Writing a 2D Platform Game in Zig language with SDL2 / SDL3 / SDL_ttf.

This repository has been inherited from Nim-Platformer, LuaJIT-Platformer and Nelua-Platformer project.

Skin database https://ddnet.org/skins

alt

Prerequisites

Zig version


Support OS


Windows Linux MacOS
SDL2 v v v
SDL3 v - -
  • Windows10 or later

    • MSys2/MinGW basic commands (make, rm, cp, strip ...)
  • Linux: Debian families

    $ sudo apt install xorg-dev libopengl-dev libgl1-mesa-dev
    $ sudo apt install libsdl2-dev libsdl2-ttf-dev
  • MacOS: P.R.

Build and run


git clone https://github.com/dinau/zig-platformer
cd zig-platformer/tutorial

For instance,

cd sdl2/part3
make run       

or

cd sdl2/part3
zig build --release=fast
cd zig-out/bin 
platformer_part3.exe

You can build SDL3 tutorials same as SDL2.

Key operation


Key Function
Up,Space, J, K Jump
Left, A, H Left
Right, D, L Right
R Restart
Q Quit, Esc

Tutorial sources


Part1 Part2 Part3
(Showing item)
Part4 Part5
(Moving item)
Part6 Part7 Part8
(Almost completed)
Part9
SDL2 part1 part2 part3 part4 part5 part6 part7 part8 -
SDL3 part1 part2 part3 part4 part5 part6 part7 part8 -

SDL librarys


https://github.com/libsdl-org/SDL/releases

Other SDL game tutorial platfromer project


ald

Language Project
Nim Compiler Nim-Platformer / sdl3_nim
LuaJIT Script LuaJIT-Platformer
Nelua Compiler NeLua-Platformer
Zig Compiler Zig-Platformer
C3 Compiler C3-Platformer WIP
Ruby Script Ruby-Platformer WIP

Other project


Language Project
Nim Compiler ImGuin, Nimgl_test, Nim_implot
Lua Script LuaJITImGui
Zig, C lang. Compiler Dear_Bindings_Build
Zig Compiler ImGuinZ
NeLua Compiler NeLuaImGui
Python Script DearPyGui for 32bit WindowsOS Binary
Ruby Script IgRuby-Examples