update to work on windows

This commit is contained in:
Rokas Puzonas 2025-12-27 21:24:22 +02:00
parent a8604946f6
commit 0349bfe50b
2 changed files with 12 additions and 9 deletions

View File

@ -2,6 +2,9 @@
#include "stdio.h" #include "stdio.h"
#include "stdbool.h" #include "stdbool.h"
#include <stdint.h> #include <stdint.h>
#ifdef _WIN32
#include <windows.h>
#endif
#define FONTSTASH_IMPLEMENTATION #define FONTSTASH_IMPLEMENTATION
#include "fontstash.h" #include "fontstash.h"

View File

@ -84,22 +84,22 @@ pub fn main() !void {
var debug_allocator: std.heap.DebugAllocator(.{}) = .init; var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
defer _ = debug_allocator.deinit(); defer _ = debug_allocator.deinit();
if (builtin.mode == .ReleaseFast) { if (builtin.mode == .Debug) {
gpa = std.heap.smp_allocator;
} else {
gpa = debug_allocator.allocator(); gpa = debug_allocator.allocator();
} else {
gpa = std.heap.smp_allocator;
} }
// TODO: Use tracy TracingAllocator // TODO: Use tracy TracingAllocator
tracy.setThreadName("Main"); tracy.setThreadName("Main");
var sa: std.posix.Sigaction = .{ // var sa: std.posix.Sigaction = .{
.handler = .{ .handler = signalHandler }, // .handler = .{ .handler = signalHandler },
.mask = std.posix.sigemptyset(), // .mask = std.posix.sigemptyset(),
.flags = std.posix.SA.RESTART, // .flags = std.posix.SA.RESTART,
}; // };
std.posix.sigaction(std.posix.SIG.INT, &sa, null); // std.posix.sigaction(std.posix.SIG.INT, &sa, null);
sapp.run(.{ sapp.run(.{
.init_cb = init, .init_cb = init,