Work around zig compiler bug

This commit is contained in:
Locria Cyber 2022-04-26 23:47:02 +08:00
parent 2c5854f8a3
commit 5d0e927a2e
No known key found for this signature in database
GPG Key ID: ED0D424AE4406330
1 changed files with 11 additions and 1 deletions

View File

@ -43,7 +43,17 @@ comptime {
assert_equal(@bitSizeOf(Memory), 64 * 1024 * 8, "Memory layout wrong");
}
pub const m = @intToPtr(*allowzero Memory, 0);
const dummym: Memory = undefined;
pub const m = struct {
pub const palette = @intToPtr(*@TypeOf(dummym.palette ), 0 + @offsetOf(Memory, "palette" ));
pub const colors = @intToPtr(*@TypeOf(dummym.colors ), 0 + @offsetOf(Memory, "colors" ));
pub const gamepads = @intToPtr(*@TypeOf(dummym.gamepads ), 0 + @offsetOf(Memory, "gamepads" ));
pub const mouse = @intToPtr(*@TypeOf(dummym.mouse ), 0 + @offsetOf(Memory, "mouse" ));
pub const system = @intToPtr(*@TypeOf(dummym.system ), 0 + @offsetOf(Memory, "system" ));
pub const framebuffer = @intToPtr(*@TypeOf(dummym.framebuffer), 0 + @offsetOf(Memory, "framebuffer"));
pub const userdata = @intToPtr(*@TypeOf(dummym.userdata ), 0 + @offsetOf(Memory, "userdata" ));
};
pub const Color = packed struct {
blue : u8,