glfw: Revert error denormalization
This commit is contained in:
parent
44fee8f1f1
commit
ef7ada052c
10 changed files with 146 additions and 146 deletions
|
|
@ -214,11 +214,11 @@ pub const Key = enum(c_int) {
|
|||
/// @thread_safety This function must only be called from the main thread.
|
||||
///
|
||||
/// see also: input_key_name
|
||||
pub inline fn getName(self: Key, scancode: isize) error{ PlatformError }!?[:0]const u8 {
|
||||
pub inline fn getName(self: Key, scancode: isize) Error!?[:0]const u8 {
|
||||
internal_debug.assertInitialized();
|
||||
const name_opt = cc.glfwGetKeyName(@enumToInt(self), @intCast(c_int, scancode));
|
||||
getError() catch |err| return switch (err) {
|
||||
Error.PlatformError => @errSetCast(error{ PlatformError }, err),
|
||||
Error.PlatformError => err,
|
||||
else => unreachable,
|
||||
};
|
||||
return if (name_opt) |name|
|
||||
|
|
@ -239,12 +239,12 @@ pub const Key = enum(c_int) {
|
|||
/// Possible errors include glfw.Error.NotInitialized, glfw.Error.InvalidEnum and glfw.Error.PlatformError.
|
||||
///
|
||||
/// @thread_safety This function may be called from any thread.
|
||||
pub inline fn getScancode(self: Key) error{ PlatformError }!isize {
|
||||
pub inline fn getScancode(self: Key) Error!isize {
|
||||
internal_debug.assertInitialized();
|
||||
const scancode = cc.glfwGetKeyScancode(@enumToInt(self));
|
||||
getError() catch |err| return switch (err) {
|
||||
Error.InvalidEnum => unreachable, // Should be unreachable for any valid 'Key' value.
|
||||
Error.PlatformError => @errSetCast(error{ PlatformError }, err),
|
||||
Error.PlatformError => err,
|
||||
else => unreachable,
|
||||
};
|
||||
return scancode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue