glfw: replace isize, usize with i32, u32 where appropriate (#126)

Fixes hexops/mach#114
This commit is contained in:
Ali Chraghi 2021-12-14 19:50:14 +03:30 committed by GitHub
parent 8b5fdbc333
commit 595cf48450
Failed to generate hash of commit
8 changed files with 87 additions and 87 deletions

View file

@ -63,13 +63,13 @@ const GamepadState = extern struct {
/// Returns the state of the specified gamepad button.
pub fn getButton(self: @This(), which: GamepadButton) Action {
_ = self;
return @intToEnum(Action, self.buttons[@intCast(usize, @enumToInt(which))]);
return @intToEnum(Action, self.buttons[@intCast(u32, @enumToInt(which))]);
}
/// Returns the status of the specified gamepad axis, in the range -1.0 to 1.0 inclusive.
pub fn getAxis(self: @This(), which: GamepadAxis) f32 {
_ = self;
return self.axes[@intCast(usize, @enumToInt(which))];
return self.axes[@intCast(u32, @enumToInt(which))];
}
};
@ -130,7 +130,7 @@ pub inline fn getAxes(self: Joystick) error{PlatformError}!?[]const f32 {
else => unreachable,
};
if (axes == null) return null;
return axes[0..@intCast(usize, count)];
return axes[0..@intCast(u32, count)];
}
/// Returns the state of all buttons of the specified joystick.
@ -168,7 +168,7 @@ pub inline fn getButtons(self: Joystick) error{PlatformError}!?[]const u8 {
else => unreachable,
};
if (buttons == null) return null;
return buttons[0..@intCast(usize, count)];
return buttons[0..@intCast(u32, count)];
}
/// Returns the state of all hats of the specified joystick.
@ -222,7 +222,7 @@ pub inline fn getHats(self: Joystick) error{PlatformError}!?[]const Hat {
else => unreachable,
};
if (hats == null) return null;
const slice = hats[0..@intCast(usize, count)];
const slice = hats[0..@intCast(u32, count)];
return @ptrCast(*const []const Hat, &slice).*;
}