diff --git a/build.zig b/build.zig index a81ec94..c93b3fd 100644 --- a/build.zig +++ b/build.zig @@ -6,6 +6,7 @@ pub fn build(b: *Builder) void { exe.setBuildMode(mode); exe.linkSystemLibrary("SDL2"); + exe.linkSystemLibrary("SDL_TTF"); exe.linkSystemLibrary("c"); b.default_step.dependOn(&exe.step); diff --git a/src/main.zig b/src/main.zig index 533c4b9..da166bf 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3,6 +3,11 @@ const std = @import("std"); const c = @cImport({ @cInclude("SDL2/SDL.h"); }); + +const t = @cImport({ + @cInclude("SDL/SDL_ttf.h"); +}); + const assert = @import("std").debug.assert; pub fn main() !void { @@ -37,6 +42,13 @@ pub fn main() !void { return error.SDLInitializationFailed; } + const ttf_init_result = t.TTF_Init(); + if (ttf_init_result != 0) { + c.SDL_Log("Unable to init TTF: %d", ttf_init_result); + return error.TTFInitializationFailed; + } + defer t.TTF_Quit(); + // const surface = c.SDL_GetWindowSurface(screen); var quit = false;