sokol-playground/readme.md

29 lines
1.7 KiB
Markdown

A little learning playground of [sokol](https://github.com/floooh/sokol) in [zig](https://ziglang.org/). Started on the gamejam at Decentrala, 9th June 2024.
The goal of this project is not fixed, and is just to try out some sokol features. But here's a few things I'd like to try out:
- [x] Draw a circle
- [ ] Load and render textures
- [ ] Render a 3D object
- [ ] Compile it for WebAssembly and run it in the browser
## Build
To build, you need to have zig master (you can use [zvm](https://www.zvm.app/) to help you with this). Then just `zig build run` and that should be it!
Note that if you change shaders, you have to recompile them manually - run compile_shaders.bat.
## Why zig?
Zig is a low level language and toolchain that is designed as a "better C". Its main goal is to be simple, robust and fast. A few strong points:
- It can cross-compile from any platform to any platform.
- It can include C headers and you can use it in zig directly.
- It has a built-in build system that is also written in zig, so no other build systems like cmake are needed.
- Unlike C++, it's not OOP, there are no hidden constructor and destructor calls and overcomplicated copy/move rules.
- Unlike C, it solves A LOT of problems of C, and is MUCH harder to shoot yourself in the foot.
- There are no hidden allocations, everything that is heap-allocating has to be done explicitely.
- It has a powerful metaprogramming facility "comptime", which provides full static reflection.
- I can go on listing more cool features, but that is enough for now.. :)
## Why sokol?
Sokol is a cross platform graphics library with minimal footprint that can compile to any backend like DirectX, OpenGL, Vulcan, Metal or even WebAssembly.