Skip to content

Latest commit

 

History

History
84 lines (65 loc) · 4.15 KB

README.md

File metadata and controls

84 lines (65 loc) · 4.15 KB

Zig examples

Zig project Directory sdl-examples\ contains Zig code examples using SDL, a cross-platform library providing low level access to audio, keyboard, mouse, joystick, and graphics hardware.

Read the document "Introduction to SDL 2.0" for a quick overview od the SDL library,

hello-gamedev Example

This project depends on version 2 of the SDL library; it has the following directory structure :

> tree /f /a . | findstr /v /b [A-Z]
|   00download.txt
|   build.bat
|   build.sh
|   build.zig
|   Makefile
\---src
    \---main
        \---zig
                main.zig

Command build.bat-verbose clean run generates and executes the Zig program target\hello.exe:

> build -verbose clean run
Delete directory "target"
Delete directory ".zig-cache"
Compile 1 Zig source file to directory "target"
Copy SDL2 dynamic library to directory "target"
Execute Zig program "build\hello.exe"

hello-gamedev-sdl3 Example

This project depends on version 3 of the SDL library; it has the following directory structure :

> tree /f /a . | findstr /v /b [A-Z]
|   00download.txt
|   build.bat
|   build.sh
|   build.zig
|   Makefile
\---src
    \---main
        \---zig
                main.zig

Command build.bat-verbose clean run generates and executes the Zig program build\hello.exe:

> build -verbose clean run
Delete directory "target"
Delete directory ".zig-cache"
Compile 1 Zig source file to directory "target"
Copy SDL3 dynamic library to directory "target"
Execute Zig program "target\hello.exe"

mics/December 2024