Skip to content
forked from Honeybunch/sdltest

A Simple SDL Test Program for Windows & Android

License

Notifications You must be signed in to change notification settings

SpexGuy/sdltest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdltest

A simple vulkan + SDL test application in Zig for Windows.

It currently draws a spinning cube and a fullscreen fractal.

This was ported from https://github.com/Honeybunch/sdltest

Building

This project currently only supports Windows, but I don't believe there's any code outside of the build script that limits it to that platform. In theory this should be portable to other platforms as long as a static SDL library can be built for that platform. Some of the bindings may not work properly on big-endian systems.

Windows

Make sure to have the following tools available on your path:

The program uses MSVC libc by default, so you will need VS2017 or later. Or build with -Dtarget=native-native-gnu to use mingw (packaged with zig) instead.

To build and run, use the command

zig build run

If you want an executable for debugging, use the command

zig build

to put the executable in zig-cache/bin/sdltest.exe.

Zig build supports several flags. Use zig build --help to get a full list. Some common ones you might want:

# build in release mode
zig build -Drelease-fast

# build a redistributable binary
zig build -Dtarget=x86_64-native-gnu

VSCode

Debugging through VS Code is supported for this project. You will need the C/C++ extension for VSCode, and you may also need to check "Debug: Allow Breakpoints Everywhere" in File -> Preferences -> Settings. The project has debug configurations set up for debugging both debug and release builds. For a better browsing and editing experience, also check out the Zig Language Server: https://github.com/zigtools/zls.

Third-party libraries

This project vendors a pre-built lib file for vulkan-1, which comes directly from the Lib folder of the SDK.

Structure of this repo

  • c_src: Libraries and stubs for C code. In this case, just VMA.
  • include: Zig files which provide extern declarations for C libraries
  • lib: Precompiled binaries for third party dependencies
  • shaders: Shader source files, in hlsl
  • sdl: Copy of the SDL library, with slight modifications (search for "ZIG MOD")
  • src: Zig source for the project
  • build.zig: Build script

Future Work

There's still more that can be done on this port. The build.zig file contains a partial port of SDL's CMakeLists.txt, but this currently only supports windows. Some more work is needed to add support for other platforms.

About

A Simple SDL Test Program for Windows & Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 54.2%
  • C++ 38.7%
  • Zig 4.0%
  • Objective-C 2.7%
  • Assembly 0.1%
  • M4 0.1%
  • Other 0.2%