Skip to content

Commit

Permalink
core: win32: various improvements (#1255)
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
Authored-by: Hordur Johannsson <[email protected]>
  • Loading branch information
slimsag committed Aug 25, 2024
1 parent a5a3d31 commit 984d4de
Show file tree
Hide file tree
Showing 6 changed files with 326 additions and 208 deletions.
26 changes: 14 additions & 12 deletions src/Core.zig
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ pub const InitOptions = struct {
};

fn update(core: *Mod, entities: *mach.Entities.Mod) !void {
_ = core; // autofix
_ = entities; // autofix
_ = core;
_ = entities;
}

fn init(core: *Mod, entities: *mach.Entities.Mod) !void {
Expand Down Expand Up @@ -517,6 +517,7 @@ pub const Key = enum {
kp_8,
kp_9,
kp_decimal,
kp_comma,
kp_equal,
kp_enter,

Expand Down Expand Up @@ -561,6 +562,9 @@ pub const Key = enum {
slash,
grave,

iso_backslash,
international1,

unknown,

pub const max = Key.unknown;
Expand Down Expand Up @@ -968,17 +972,14 @@ pub fn printTitle(
comptime fmt: []const u8,
args: anytype,
) !void {
_ = core;
_ = window_id;
_ = fmt;
_ = args;
// TODO: NO OP
// // Free any previous window title slice
// if (core.get(window_id, .title)) |slice| core.state().allocator.free(slice);

// // Allocate and assign a new window title slice.
// const slice = try std.fmt.allocPrintZ(core.state().allocator, fmt, args);
// try core.set(window_id, .title, slice);
// Allocate and assign a new window title slice.
const slice = try std.fmt.allocPrintZ(core.allocator, fmt, args);
defer core.allocator.free(slice);
core.setTitle(slice);

// TODO: This function does not have access to *core.Mod to update
// try core.Mod.set(window_id, .title, slice);
}

fn exit(core: *Mod) void {
Expand Down Expand Up @@ -1054,6 +1055,7 @@ pub fn deinitLinuxGamemode() void {
comptime {
// Core
assertHasField(Platform, "surface_descriptor");
assertHasField(Platform, "refresh_rate");

assertHasDecl(Platform, "init");
assertHasDecl(Platform, "deinit");
Expand Down
Loading

0 comments on commit 984d4de

Please sign in to comment.