Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johanrimez/zigripples
Graphic demonstration featuring ZIG & SDL2
https://github.com/johanrimez/zigripples
sdl2 zig
Last synced: about 1 month ago
JSON representation
Graphic demonstration featuring ZIG & SDL2
- Host: GitHub
- URL: https://github.com/johanrimez/zigripples
- Owner: JohanRimez
- License: mit
- Created: 2024-08-21T10:46:30.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-09-18T11:34:04.000Z (5 months ago)
- Last Synced: 2025-01-07T23:47:27.560Z (about 1 month ago)
- Topics: sdl2, zig
- Language: Zig
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.txt
- License: License.txt
Awesome Lists containing this project
README
ZigRipples
Johan Rimez - 2024This is an open source project featuring:
* ZIG programming language (www.ziglang.org)
* SDL2 - Simple DirectMedia Layer (www.libsdl.org)This program is intended to demonstrate graphics programming for a simple but fully working coding example using ZIG & SDL.
Moreover, this project is intended to be as flexible as possible towards:
* Coding and compiling in and for WindowsOS & VS Code
* Coding and compiling in and for Linux & VS Codium
* Coding and compiling in Windows for Linux as target
The original idea for the program came from this coding tutorial:The Coding Train - Coding challenge #102 - 2D Water Ripple
https://thecodingtrain.com/challenges/102-2d-water-rippleUSAGE:
quits the application
CODING:
In order for VS Code/Codium to run smoothly with the Zig Language Server (ZLS) in both Windows and Linux, the C-library and the SDL-library header files
are first exported to a common import file "cImport.zig" (important: UTF-8) as a preparatory step (you may want to locate the header files first and
adapt the below commands first). I consider this file to be put in the source directory.target specific:
(Windows) zig translate-c C:\Users\Public\Includes\SDL2\include\sdl.h -lc > cImport.zig
(Linux) zig translate-c /usr/include/SDL2/SDL.h -lc -target x86_64-linux-gnu -I/usr/include -I/usr/include/x86_64-linux-gnu > cImport.zigCOMPILING:
The build.zig build file is configured for these scenarios:
* Building in windows for windows
* Building in windows for linux (.a & .so libraries need to be provided in the root project directory)
* Building in linux for linuxVS CODE:
the json-build and launch tasks are configured for windows.
RUNNING:
Windows users need to put the path to the SDL2.dll SDL2_image.dll libraries into their PATH or have them in the same folder as the executable.
REMARK:
The main calculation loop is explicitely made without any multiplication to calculate the current pixel index.
No clue whether this is an advantage as the LLVM system clearly optimises at lot in this regard.Kind regards
Johan*