Decryptu/zig-playground
A hands-on learning repository showcasing Zig programming language features through practical examples. Features both a command-line and GUI application demonstrating core Zig concepts, modern systems programming practices, and SDL2 integration.
This project contains four examples demonstrating different aspects of the Zig programming language:
# Install Zig
brew install zig
# Install SDL2 (required for GUI example)
brew install sdl2
The project includes four examples that can be built and run separately. After building, the executables can be found in the zig-out/bin/
directory:
zig-out/bin/basic
- The basic command-line examplezig-out/bin/gui
- The GUI applicationzig-out/bin/vector
- The vector operations examplezig-out/bin/matrix
- The matrix operations exampleDemonstrates fundamental Zig features including:
# Build all targets
zig build
# Run the basic example directly
./zig-out/bin/basic
# Or use zig build command
zig build run-basic
Shows how to create a simple GUI application using SDL2:
# Build all targets
zig build
# Run the GUI example directly
./zig-out/bin/gui
# Or use zig build command
zig build run-gui
Demonstrates Zig's SIMD vector operations with an interactive visualization:
# Build all targets
zig build
# Run the vector example directly
./zig-out/bin/vector
# Or use zig build command
zig build vector
Showcases advanced Zig features using matrix operations:
# Build all targets
zig build
# Run the matrix example directly
./zig-out/bin/matrix
# Or use zig build command
zig build matrix
.
├── .gitignore
├── LICENSE
├── README.md
├── build.zig # Build configuration
├── src/
│ ├── basic.zig # Basic Zig example
│ ├── gui.zig # SDL2 GUI example
│ ├── vector.zig # Vector operations example
│ └── matrix.zig # Matrix operations example
└── .vscode/
└── settings.json
After building, the project generates the following executables:
zig-out/
└── bin/
├── basic # Basic command-line example executable
├── gui # GUI application executable
├── vector # Vector operations executable
└── matrix # Matrix operations executable
try
defer
Feel free to:
All contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.