update to latest Zig (zig fmt)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
419d82d5fd
commit
29964c99bb
39 changed files with 156 additions and 156 deletions
|
|
@ -11,4 +11,4 @@
|
|||
.hash = "12203cb075bec68c8cb4cfa1337bc9dabe47f055e377d1b8144b2c21f9a2577efb07",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pub inline fn readPrecise(timer: *Timer) u64 {
|
|||
|
||||
/// Reads the timer value since start or the last reset in seconds.
|
||||
pub inline fn read(timer: *Timer) f32 {
|
||||
return @intToFloat(f32, timer.readPrecise()) / @intToFloat(f32, std.time.ns_per_s);
|
||||
return @floatFromInt(f32, timer.readPrecise()) / @floatFromInt(f32, std.time.ns_per_s);
|
||||
}
|
||||
|
||||
/// Resets the timer value to 0/now.
|
||||
|
|
@ -34,5 +34,5 @@ pub inline fn lapPrecise(timer: *Timer) u64 {
|
|||
|
||||
/// Returns the current value of the timer in seconds, then resets it.
|
||||
pub inline fn lap(timer: *Timer) f32 {
|
||||
return @intToFloat(f32, timer.lapPrecise()) / @intToFloat(f32, std.time.ns_per_s);
|
||||
return @floatFromInt(f32, timer.lapPrecise()) / @floatFromInt(f32, std.time.ns_per_s);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ pub fn setCursorShape(self: *Core, cursor: CursorShape) void {
|
|||
// we hope to provide custom backup images for these.
|
||||
// See https://github.com/hexops/mach/pull/352 for more info
|
||||
|
||||
const enum_int = @enumToInt(cursor);
|
||||
const enum_int = @intFromEnum(cursor);
|
||||
const tried = self.cursors_tried[enum_int];
|
||||
if (!tried) {
|
||||
self.cursors_tried[enum_int] = true;
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ pub const EventIterator = struct {
|
|||
const event_int = js.machEventShift();
|
||||
if (event_int == -1) return null;
|
||||
|
||||
const event_type = @intToEnum(std.meta.Tag(Event), event_int);
|
||||
const event_type = @enumFromInt(std.meta.Tag(Event), event_int);
|
||||
return switch (event_type) {
|
||||
.key_press, .key_repeat => blk: {
|
||||
const key = @intToEnum(Key, js.machEventShift());
|
||||
const key = @enumFromInt(Key, js.machEventShift());
|
||||
switch (key) {
|
||||
.left_shift, .right_shift => self.key_mods.shift = true,
|
||||
.left_control, .right_control => self.key_mods.control = true,
|
||||
|
|
@ -63,7 +63,7 @@ pub const EventIterator = struct {
|
|||
continue;
|
||||
},
|
||||
.key_release => blk: {
|
||||
const key = @intToEnum(Key, js.machEventShift());
|
||||
const key = @enumFromInt(Key, js.machEventShift());
|
||||
switch (key) {
|
||||
.left_shift, .right_shift => self.key_mods.shift = false,
|
||||
.left_control, .right_control => self.key_mods.control = false,
|
||||
|
|
@ -83,8 +83,8 @@ pub const EventIterator = struct {
|
|||
continue;
|
||||
},
|
||||
.mouse_motion => blk: {
|
||||
const x = @intToFloat(f64, js.machEventShift());
|
||||
const y = @intToFloat(f64, js.machEventShift());
|
||||
const x = @floatFromInt(f64, js.machEventShift());
|
||||
const y = @floatFromInt(f64, js.machEventShift());
|
||||
self.last_cursor_position = .{
|
||||
.x = x,
|
||||
.y = y,
|
||||
|
|
@ -191,11 +191,11 @@ pub fn setDisplayMode(self: *Core, mode: DisplayMode, monitor: ?usize) void {
|
|||
// borderless fullscreen window has no meaning in web
|
||||
mode = .fullscreen;
|
||||
}
|
||||
js.machCanvasSetDisplayMode(self.id, @enumToInt(mode));
|
||||
js.machCanvasSetDisplayMode(self.id, @intFromEnum(mode));
|
||||
}
|
||||
|
||||
pub fn displayMode(self: *Core) DisplayMode {
|
||||
return @intToEnum(DisplayMode, js.machDisplayMode(self.id));
|
||||
return @enumFromInt(DisplayMode, js.machDisplayMode(self.id));
|
||||
}
|
||||
|
||||
pub fn setBorder(self: *Core, value: bool) void {
|
||||
|
|
@ -264,19 +264,19 @@ pub fn sizeLimit(self: *Core) SizeLimit {
|
|||
}
|
||||
|
||||
pub fn setCursorMode(self: *Core, mode: CursorMode) void {
|
||||
js.machSetCursorMode(self.id, @enumToInt(mode));
|
||||
js.machSetCursorMode(self.id, @intFromEnum(mode));
|
||||
}
|
||||
|
||||
pub fn cursorMode(self: *Core) CursorMode {
|
||||
return @intToEnum(CursorMode, js.machCursorMode(self.id));
|
||||
return @enumFromInt(CursorMode, js.machCursorMode(self.id));
|
||||
}
|
||||
|
||||
pub fn setCursorShape(self: *Core, shape: CursorShape) void {
|
||||
js.machSetCursorShape(self.id, @enumToInt(shape));
|
||||
js.machSetCursorShape(self.id, @intFromEnum(shape));
|
||||
}
|
||||
|
||||
pub fn cursorShape(self: *Core) CursorShape {
|
||||
return @intToEnum(CursorShape, js.machCursorShape(self.id));
|
||||
return @enumFromInt(CursorShape, js.machCursorShape(self.id));
|
||||
}
|
||||
|
||||
pub fn adapter(_: *Core) *gpu.Adapter {
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@ pub fn lap(timer: *Timer) u64 {
|
|||
const now = js.machPerfNow();
|
||||
const initial = timer.initial;
|
||||
timer.initial = now;
|
||||
return @floatToInt(u64, now - initial) * std.time.ns_per_ms;
|
||||
return @intFromFloat(u64, now - initial) * std.time.ns_per_ms;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue