Add SDL TTF for text rendering
This commit is contained in:
parent
80de6db167
commit
deb02fa359
|
@ -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);
|
||||
|
|
12
src/main.zig
12
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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user