This commit is contained in:
Vicente Ferrari Smith 2026-01-29 21:35:54 +01:00
parent 20ba7b51a1
commit 729b8e9af1
3 changed files with 26 additions and 52 deletions

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{ .default_target = .{ .cpu_model = .native } });
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast });
const assets = b.addInstallDirectory(.{
.source_dir = b.path("assets"),
@ -10,43 +10,6 @@ pub fn build(b: *std.Build) void {
.install_subdir = "assets",
});
// const sdl3 = b.dependency("sdl3", .{
// .target = target,
// .optimize = .Debug,
// // Lib options.
// // .callbacks = false,
// // .ext_image = false,
// // .ext_net = false,
// // .ext_ttf = false,
// // .log_message_stack_size = 1024,
// // .main = false,
// // .renderer_debug_text_stack_size = 1024,
// // Options passed directly to https://github.com/castholm/SDL (SDL3 C Bindings):
// // .c_sdl_preferred_linkage = .static,
// // .c_sdl_strip = false,
// // .c_sdl_sanitize_c = .off,
// // .c_sdl_lto = .none,
// // .c_sdl_emscripten_pthreads = false,
// // .c_sdl_install_build_config_h = false,
// // Options if `ext_image` is enabled:
// // .image_enable_bmp = true,
// // .image_enable_gif = true,
// // .image_enable_jpg = true,
// // .image_enable_lbm = true,
// // .image_enable_pcx = true,
// // .image_enable_png = true,
// // .image_enable_pnm = true,
// // .image_enable_qoi = true,
// // .image_enable_svg = true,
// // .image_enable_tga = true,
// // .image_enable_xcf = true,
// // .image_enable_xpm = true,
// // .image_enable_xv = true,
// });
const shared = b.addModule("shared", .{
.root_source_file = b.path("src/shared/shared.zig"),
.target = target,
@ -67,6 +30,7 @@ pub fn build(b: *std.Build) void {
}),
.use_llvm = true,
});
client.root_module.strip = true;
const server = b.addExecutable(.{
.name = "server",
@ -80,6 +44,7 @@ pub fn build(b: *std.Build) void {
}),
.use_llvm = true,
});
server.root_module.strip = true;
const ztracy = b.dependency("ztracy", .{
.enable_ztracy = true,
@ -96,7 +61,18 @@ pub fn build(b: *std.Build) void {
client.root_module.addImport("mach-freetype", mach_freetype.module("mach-freetype"));
client.root_module.addImport("mach-harfbuzz", mach_freetype.module("mach-harfbuzz"));
client.root_module.addCSourceFile(.{ .file = b.path("vendor/kb_text_shape/kb_text_shape.h"), .language = .c, .flags = &.{"-DKB_TEXT_SHAPE_IMPLEMENTATION"} });
client.root_module.addCSourceFile(.{
.file = b.path("vendor/kb_text_shape/kb_text_shape.h"),
.language = .c,
.flags = &.{
"-DKB_TEXT_SHAPE_IMPLEMENTATION",
"-O3", // Maximum optimization
// "-ffast-math", // Allows algebraic reorganizations (risky for precision, great for speed)
// "-fno-plt", // Reduces overhead for library calls
// "-march=native", // Use every instruction your CPU has
// "-flto", // Enable LTO for the C side specifically
},
});
const kb_text_shape = b.addTranslateC(.{
.root_source_file = b.path("vendor/kb_text_shape/kb_text_shape.h"),
.target = target,

View File

@ -1,10 +1,10 @@
const std = @import("std");
const rl = @import("raylib");
const kb = @import("kb");
const ft = @import("mach-freetype");
const hb = @import("mach-harfbuzz");
const rp = @import("stb_rect_pack");
const ztracy = @import("ztracy");
const std = @import("std");
const rl = @import("raylib");
const kb = @import("kb");
const ft = @import("mach-freetype");
const hb = @import("mach-harfbuzz");
const rp = @import("stb_rect_pack");
const ztracy = @import("ztracy");
pub var ft_lib : ft.Library = undefined;
pub var shader : rl.Shader = undefined;
@ -286,9 +286,6 @@ pub const Font = struct {
const dpi_offset_y = offset_y / rl.getWindowScaleDPI().y;
if (self.glyphs.getPtr(RunGlyph.Id)) |glyph| {
if (RunGlyph.OffsetX != 0) {
std.log.info("font bearing ({}, {}), kb offset ({}, {})", .{glyph.bearing_x, glyph.bearing_y, RunGlyph.OffsetX, RunGlyph.OffsetX});
}
var v0 = rl.Vector2.zero();
var v1 = rl.Vector2.zero();

View File

@ -3,8 +3,9 @@ const zm = @import("zmath");
const znet = @import("znet");
const rl = @import("raylib");
const bufzilla = @import("bufzilla");
const ft = @import("mach-freetype");
const ft = @import("mach-freetype");
const ztracy = @import("ztracy");
const kb = @import("kb");
const shared = @import("shared");
@ -49,7 +50,7 @@ pub fn main() !void {
try znet.init();
defer znet.deinit();
rl.setConfigFlags(.{ .window_highdpi = true, .vsync_hint = true });
// rl.setConfigFlags(.{ .window_highdpi = true, .vsync_hint = true });
rl.initWindow(screen_width, screen_height, "zzz");
defer rl.closeWindow();