Browse Source

Load font if it exists

master
Kenneth Bruen 9 months ago
parent
commit
eefb0a436f
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 18
      src/main.zig

18
src/main.zig

@ -14,20 +14,22 @@ pub fn main() !void {
rl.InitWindow(800, 600, "Testing Raylib");
defer rl.CloseWindow();
// const font = blk: {
// const maybeFont = rl.LoadFontEx("./db.ttf", 64, null, 0);
// if (std.meta.eql(maybeFont, rl.GetFontDefault())) {
// break :blk null;
// }
// break :blk maybeFont;
// };
const font = blk: {
var cp_cnt: c_int = 0;
const cp = rl.LoadCodepoints("aäbcdeèéfghijklmnoöpqrsßtuüvwxyzAÄBCDEÈÉFGHIJKLMNOÖPQRSẞTUÜVWXYZ0123456789-_,()/\\:+", &cp_cnt,);
const maybeFont = rl.LoadFontEx("./db.ttf", 64, cp, cp_cnt);
if (std.meta.eql(maybeFont, rl.GetFontDefault())) {
break :blk null;
}
break :blk maybeFont;
};
var station_name_buffer: [100]u8 = .{0} ** 100;
var platform_buffer: [20]u8 = .{0} ** 20;
var station_id_buffer: [10]u8 = .{0} ** 10;
var appState = AppState{
.allocator = allocator,
// .db_font = font,
.db_font = font,
.home_screen_state = .{
.station_name = std.ArrayListUnmanaged(u8).initBuffer(&station_name_buffer),
},

Loading…
Cancel
Save