glfw: dont use @errSetCast
This commit is contained in:
parent
3e79a12f3d
commit
2e9347399d
10 changed files with 74 additions and 87 deletions
|
|
@ -66,7 +66,7 @@ pub inline fn create(image: Image, xhot: i32, yhot: i32) error{PlatformError}!Cu
|
||||||
if (c.glfwCreateCursor(&img, @intCast(c_int, xhot), @intCast(c_int, yhot))) |cursor| return Cursor{ .ptr = cursor };
|
if (c.glfwCreateCursor(&img, @intCast(c_int, xhot), @intCast(c_int, yhot))) |cursor| return Cursor{ .ptr = cursor };
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -87,7 +87,7 @@ pub inline fn createStandard(shape: Shape) error{PlatformError}!Cursor {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ pub inline fn present(self: Joystick) error{PlatformError}!bool {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return is_present == c.GLFW_TRUE;
|
return is_present == c.GLFW_TRUE;
|
||||||
|
|
@ -126,7 +126,7 @@ pub inline fn getAxes(self: Joystick) error{PlatformError}!?[]const f32 {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
if (axes == null) return null;
|
if (axes == null) return null;
|
||||||
|
|
@ -164,7 +164,7 @@ pub inline fn getButtons(self: Joystick) error{PlatformError}!?[]const u8 {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
if (buttons == null) return null;
|
if (buttons == null) return null;
|
||||||
|
|
@ -218,7 +218,7 @@ pub inline fn getHats(self: Joystick) error{PlatformError}!?[]const Hat {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
if (hats == null) return null;
|
if (hats == null) return null;
|
||||||
|
|
@ -251,7 +251,7 @@ pub inline fn getName(self: Joystick) error{PlatformError}!?[:0]const u8 {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return if (name_opt) |name|
|
return if (name_opt) |name|
|
||||||
|
|
@ -293,7 +293,7 @@ pub inline fn getGUID(self: Joystick) error{PlatformError}!?[:0]const u8 {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return if (guid_opt) |guid|
|
return if (guid_opt) |guid|
|
||||||
|
|
@ -421,7 +421,7 @@ pub inline fn updateGamepadMappings(gamepad_mappings: [*:0]const u8) error{Inval
|
||||||
// TODO: Look into upstream proposal for GLFW to publicize
|
// TODO: Look into upstream proposal for GLFW to publicize
|
||||||
// their Gamepad mappings parsing functions/interface
|
// their Gamepad mappings parsing functions/interface
|
||||||
// for a better error message in debug.
|
// for a better error message in debug.
|
||||||
Error.InvalidValue => @errSetCast(error{InvalidValue}, err),
|
Error.InvalidValue => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ pub inline fn getPos(self: Monitor) error{PlatformError}!Pos {
|
||||||
c.glfwGetMonitorPos(self.handle, &xpos, &ypos);
|
c.glfwGetMonitorPos(self.handle, &xpos, &ypos);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return Pos{ .x = @intCast(u32, xpos), .y = @intCast(u32, ypos) };
|
return Pos{ .x = @intCast(u32, xpos), .y = @intCast(u32, ypos) };
|
||||||
|
|
@ -74,7 +74,7 @@ pub inline fn getWorkarea(self: Monitor) error{PlatformError}!Workarea {
|
||||||
c.glfwGetMonitorWorkarea(self.handle, &xpos, &ypos, &width, &height);
|
c.glfwGetMonitorWorkarea(self.handle, &xpos, &ypos, &width, &height);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return Workarea{ .x = @intCast(u32, xpos), .y = @intCast(u32, ypos), .width = @intCast(u32, width), .height = @intCast(u32, height) };
|
return Workarea{ .x = @intCast(u32, xpos), .y = @intCast(u32, ypos), .width = @intCast(u32, width), .height = @intCast(u32, height) };
|
||||||
|
|
@ -142,7 +142,7 @@ pub inline fn getContentScale(self: Monitor) error{PlatformError}!ContentScale {
|
||||||
c.glfwGetMonitorContentScale(self.handle, &x_scale, &y_scale);
|
c.glfwGetMonitorContentScale(self.handle, &x_scale, &y_scale);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return ContentScale{ .x_scale = @floatCast(f32, x_scale), .y_scale = @floatCast(f32, y_scale) };
|
return ContentScale{ .x_scale = @floatCast(f32, x_scale), .y_scale = @floatCast(f32, y_scale) };
|
||||||
|
|
@ -244,7 +244,7 @@ pub inline fn getVideoModes(self: Monitor, allocator: mem.Allocator) (mem.Alloca
|
||||||
}
|
}
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -266,7 +266,7 @@ pub inline fn getVideoMode(self: Monitor) error{PlatformError}!VideoMode {
|
||||||
if (c.glfwGetVideoMode(self.handle)) |mode| return VideoMode{ .handle = mode.* };
|
if (c.glfwGetVideoMode(self.handle)) |mode| return VideoMode{ .handle = mode.* };
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -302,7 +302,7 @@ pub inline fn setGamma(self: Monitor, gamma: f32) error{PlatformError}!void {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidValue => unreachable,
|
Error.InvalidValue => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -327,7 +327,7 @@ pub inline fn getGammaRamp(self: Monitor) error{PlatformError}!GammaRamp {
|
||||||
if (c.glfwGetGammaRamp(self.handle)) |ramp| return GammaRamp.fromC(ramp.*);
|
if (c.glfwGetGammaRamp(self.handle)) |ramp| return GammaRamp.fromC(ramp.*);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -363,7 +363,7 @@ pub inline fn setGammaRamp(self: Monitor, ramp: GammaRamp) error{PlatformError}!
|
||||||
c.glfwSetGammaRamp(self.handle, &ramp.toC());
|
c.glfwSetGammaRamp(self.handle, &ramp.toC());
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -437,10 +437,11 @@ pub inline fn create(
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.InvalidValue => unreachable,
|
Error.InvalidValue => unreachable,
|
||||||
Error.APIUnavailable,
|
Error.APIUnavailable,
|
||||||
|
Error.PlatformError,
|
||||||
Error.VersionUnavailable,
|
Error.VersionUnavailable,
|
||||||
Error.FormatUnavailable,
|
Error.FormatUnavailable,
|
||||||
Error.PlatformError,
|
=> |e| e,
|
||||||
=> @errSetCast(error{ APIUnavailable, VersionUnavailable, FormatUnavailable, PlatformError }, err),
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -537,7 +538,7 @@ pub inline fn setTitle(self: Window, title: [*:0]const u8) error{PlatformError}!
|
||||||
c.glfwSetWindowTitle(self.handle, title);
|
c.glfwSetWindowTitle(self.handle, title);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -580,7 +581,7 @@ pub inline fn setIcon(self: Window, allocator: mem.Allocator, images: ?[]Image)
|
||||||
} else c.glfwSetWindowIcon(self.handle, 0, null);
|
} else c.glfwSetWindowIcon(self.handle, 0, null);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -610,7 +611,7 @@ pub inline fn getPos(self: Window) error{PlatformError}!Pos {
|
||||||
c.glfwGetWindowPos(self.handle, &x, &y);
|
c.glfwGetWindowPos(self.handle, &x, &y);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return Pos{ .x = @intCast(u32, x), .y = @intCast(u32, y) };
|
return Pos{ .x = @intCast(u32, x), .y = @intCast(u32, y) };
|
||||||
|
|
@ -641,7 +642,7 @@ pub inline fn setPos(self: Window, pos: Pos) error{PlatformError}!void {
|
||||||
c.glfwSetWindowPos(self.handle, @intCast(c_int, pos.x), @intCast(c_int, pos.y));
|
c.glfwSetWindowPos(self.handle, @intCast(c_int, pos.x), @intCast(c_int, pos.y));
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -669,7 +670,7 @@ pub inline fn getSize(self: Window) error{PlatformError}!Size {
|
||||||
c.glfwGetWindowSize(self.handle, &width, &height);
|
c.glfwGetWindowSize(self.handle, &width, &height);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return Size{ .width = @intCast(u32, width), .height = @intCast(u32, height) };
|
return Size{ .width = @intCast(u32, width), .height = @intCast(u32, height) };
|
||||||
|
|
@ -702,7 +703,7 @@ pub inline fn setSize(self: Window, size: Size) error{PlatformError}!void {
|
||||||
c.glfwSetWindowSize(self.handle, @intCast(c_int, size.width), @intCast(c_int, size.height));
|
c.glfwSetWindowSize(self.handle, @intCast(c_int, size.width), @intCast(c_int, size.height));
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -755,7 +756,7 @@ pub inline fn setSizeLimits(self: Window, min: SizeOptional, max: SizeOptional)
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidValue => unreachable,
|
Error.InvalidValue => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -802,7 +803,7 @@ pub inline fn setAspectRatio(self: Window, numerator: ?u32, denominator: ?u32) e
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidValue => unreachable,
|
Error.InvalidValue => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -824,7 +825,7 @@ pub inline fn getFramebufferSize(self: Window) error{PlatformError}!Size {
|
||||||
c.glfwGetFramebufferSize(self.handle, &width, &height);
|
c.glfwGetFramebufferSize(self.handle, &width, &height);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return Size{ .width = @intCast(u32, width), .height = @intCast(u32, height) };
|
return Size{ .width = @intCast(u32, width), .height = @intCast(u32, height) };
|
||||||
|
|
@ -860,7 +861,7 @@ pub inline fn getFrameSize(self: Window) error{PlatformError}!FrameSize {
|
||||||
c.glfwGetWindowFrameSize(self.handle, &left, &top, &right, &bottom);
|
c.glfwGetWindowFrameSize(self.handle, &left, &top, &right, &bottom);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return FrameSize{
|
return FrameSize{
|
||||||
|
|
@ -900,7 +901,7 @@ pub inline fn getContentScale(self: Window) error{PlatformError}!ContentScale {
|
||||||
c.glfwGetWindowContentScale(self.handle, &x_scale, &y_scale);
|
c.glfwGetWindowContentScale(self.handle, &x_scale, &y_scale);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return ContentScale{ .x_scale = x_scale, .y_scale = y_scale };
|
return ContentScale{ .x_scale = x_scale, .y_scale = y_scale };
|
||||||
|
|
@ -926,7 +927,7 @@ pub inline fn getOpacity(self: Window) error{PlatformError}!f32 {
|
||||||
const opacity = c.glfwGetWindowOpacity(self.handle);
|
const opacity = c.glfwGetWindowOpacity(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return opacity;
|
return opacity;
|
||||||
|
|
@ -954,7 +955,7 @@ pub inline fn setOpacity(self: Window, opacity: f32) error{PlatformError}!void {
|
||||||
c.glfwSetWindowOpacity(self.handle, opacity);
|
c.glfwSetWindowOpacity(self.handle, opacity);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -980,7 +981,7 @@ pub inline fn iconify(self: Window) error{PlatformError}!void {
|
||||||
c.glfwIconifyWindow(self.handle);
|
c.glfwIconifyWindow(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1003,7 +1004,7 @@ pub inline fn restore(self: Window) error{PlatformError}!void {
|
||||||
c.glfwRestoreWindow(self.handle);
|
c.glfwRestoreWindow(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1025,7 +1026,7 @@ pub inline fn maximize(self: Window) error{PlatformError}!void {
|
||||||
c.glfwMaximizeWindow(self.handle);
|
c.glfwMaximizeWindow(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1049,7 +1050,7 @@ pub inline fn show(self: Window) error{PlatformError}!void {
|
||||||
c.glfwShowWindow(self.handle);
|
c.glfwShowWindow(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1069,7 +1070,7 @@ pub inline fn hide(self: Window) error{PlatformError}!void {
|
||||||
c.glfwHideWindow(self.handle);
|
c.glfwHideWindow(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1103,7 +1104,7 @@ pub inline fn focus(self: Window) error{PlatformError}!void {
|
||||||
c.glfwFocusWindow(self.handle);
|
c.glfwFocusWindow(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1128,7 +1129,7 @@ pub inline fn requestAttention(self: Window) error{PlatformError}!void {
|
||||||
c.glfwRequestWindowAttention(self.handle);
|
c.glfwRequestWindowAttention(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1159,9 +1160,7 @@ pub inline fn swapBuffers(self: Window) error{ NoWindowContext, PlatformError }!
|
||||||
c.glfwSwapBuffers(self.handle);
|
c.glfwSwapBuffers(self.handle);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext,
|
Error.NoWindowContext, Error.PlatformError => |e| e,
|
||||||
Error.PlatformError,
|
|
||||||
=> @errSetCast(error{ NoWindowContext, PlatformError }, err),
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1242,7 +1241,7 @@ pub inline fn setMonitor(self: Window, monitor: ?Monitor, xpos: i32, ypos: i32,
|
||||||
);
|
);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1302,7 +1301,7 @@ pub inline fn getAttrib(self: Window, attrib: Attrib) error{PlatformError}!i32 {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -1348,7 +1347,7 @@ pub inline fn setAttrib(self: Window, attrib: Attrib, value: bool) error{Platfor
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.InvalidValue => unreachable,
|
Error.InvalidValue => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1873,7 +1872,7 @@ pub inline fn setInputMode(self: Window, mode: InputMode, value: anytype) error{
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1978,7 +1977,7 @@ pub inline fn getCursorPos(self: Window) error{PlatformError}!CursorPos {
|
||||||
c.glfwGetCursorPos(self.handle, &pos.xpos, &pos.ypos);
|
c.glfwGetCursorPos(self.handle, &pos.xpos, &pos.ypos);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return pos;
|
return pos;
|
||||||
|
|
@ -2014,7 +2013,7 @@ pub inline fn setCursorPos(self: Window, xpos: f64, ypos: f64) error{PlatformErr
|
||||||
c.glfwSetCursorPos(self.handle, xpos, ypos);
|
c.glfwSetCursorPos(self.handle, xpos, ypos);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -2039,7 +2038,7 @@ pub inline fn setCursor(self: Window, cursor: Cursor) error{PlatformError}!void
|
||||||
c.glfwSetCursor(self.handle, cursor.ptr);
|
c.glfwSetCursor(self.handle, cursor.ptr);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ pub inline fn setClipboardString(value: [*:0]const u8) error{PlatformError}!void
|
||||||
c.glfwSetClipboardString(null, value);
|
c.glfwSetClipboardString(null, value);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -51,9 +51,7 @@ pub inline fn getClipboardString() error{ FormatUnavailable, PlatformError }![:0
|
||||||
if (c.glfwGetClipboardString(null)) |c_str| return std.mem.span(c_str);
|
if (c.glfwGetClipboardString(null)) |c_str| return std.mem.span(c_str);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.FormatUnavailable,
|
Error.FormatUnavailable, Error.PlatformError => |e| e,
|
||||||
Error.PlatformError,
|
|
||||||
=> @errSetCast(error{ FormatUnavailable, PlatformError }, err),
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ pub const Key = enum(c_int) {
|
||||||
const name_opt = cc.glfwGetKeyName(@enumToInt(self), @intCast(c_int, scancode));
|
const name_opt = cc.glfwGetKeyName(@enumToInt(self), @intCast(c_int, scancode));
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return if (name_opt) |name|
|
return if (name_opt) |name|
|
||||||
|
|
@ -247,7 +247,7 @@ pub const Key = enum(c_int) {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidEnum => unreachable,
|
Error.InvalidEnum => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ pub inline fn init(hints: InitHints) error{PlatformError}!void {
|
||||||
|
|
||||||
if (c.glfwInit() == c.GLFW_TRUE) return;
|
if (c.glfwInit() == c.GLFW_TRUE) return;
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -243,7 +243,7 @@ pub inline fn pollEvents() error{PlatformError}!void {
|
||||||
c.glfwPollEvents();
|
c.glfwPollEvents();
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -283,7 +283,7 @@ pub inline fn waitEvents() error{PlatformError}!void {
|
||||||
c.glfwWaitEvents();
|
c.glfwWaitEvents();
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -331,7 +331,7 @@ pub inline fn waitEventsTimeout(timeout: f64) error{PlatformError}!void {
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidValue => unreachable,
|
Error.InvalidValue => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -351,7 +351,7 @@ pub inline fn postEmptyEvent() error{PlatformError}!void {
|
||||||
c.glfwPostEmptyEvent();
|
c.glfwPostEmptyEvent();
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => @errSetCast(error{PlatformError}, err),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
if (native.glfwGetWGLContext(@ptrCast(*native.GLFWwindow, window.handle))) |context| return context;
|
if (native.glfwGetWGLContext(@ptrCast(*native.GLFWwindow, window.handle))) |context| return context;
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext => |e| @errSetCast(error{NoWindowContext}, e),
|
Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -182,7 +182,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
const context = native.glfwGetNSGLContext(@ptrCast(*native.GLFWwindow, window.handle));
|
const context = native.glfwGetNSGLContext(@ptrCast(*native.GLFWwindow, window.handle));
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext => |e| @errSetCast(error{NoWindowContext}, e),
|
Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return context;
|
return context;
|
||||||
|
|
@ -263,7 +263,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
native.glfwSetX11SelectionString(string);
|
native.glfwSetX11SelectionString(string);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError => |e| @errSetCast(error{PlatformError}, e),
|
Error.PlatformError => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -282,7 +282,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
if (native.glfwGetX11SelectionString()) |str| return str;
|
if (native.glfwGetX11SelectionString()) |str| return str;
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.FormatUnavailable => |e| @errSetCast(error{FormatUnavailable}, e),
|
Error.FormatUnavailable => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -298,7 +298,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
if (native.glfwGetGLXContext(@ptrCast(*native.GLFWwindow, window.handle))) |context| return @ptrCast(*anyopaque, context);
|
if (native.glfwGetGLXContext(@ptrCast(*native.GLFWwindow, window.handle))) |context| return @ptrCast(*anyopaque, context);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext => |e| @errSetCast(error{NoWindowContext}, e),
|
Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -315,7 +315,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
if (win != 0) return @ptrCast(*anyopaque, win);
|
if (win != 0) return @ptrCast(*anyopaque, win);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext => |e| @errSetCast(error{NoWindowContext}, e),
|
Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -393,7 +393,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
if (context != native.EGL_NO_CONTEXT) return @ptrCast(*anyopaque, context);
|
if (context != native.EGL_NO_CONTEXT) return @ptrCast(*anyopaque, context);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext => |e| @errSetCast(error{NoWindowContext}, e),
|
Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -410,7 +410,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
if (surface != native.EGL_NO_SURFACE) return @ptrCast(*anyopaque, surface);
|
if (surface != native.EGL_NO_SURFACE) return @ptrCast(*anyopaque, surface);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext => |e| @errSetCast(error{NoWindowContext}, e),
|
Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -441,7 +441,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
) == native.GLFW_TRUE) return buf;
|
) == native.GLFW_TRUE) return buf;
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError, Error.NoWindowContext => |e| @errSetCast(error{ PlatformError, NoWindowContext }, e),
|
Error.PlatformError, Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -472,7 +472,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
) == native.GLFW_TRUE) return buf;
|
) == native.GLFW_TRUE) return buf;
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.PlatformError, Error.NoWindowContext => |e| @errSetCast(error{ PlatformError, NoWindowContext }, e),
|
Error.PlatformError, Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -488,7 +488,7 @@ pub fn Native(comptime options: BackendOptions) type {
|
||||||
if (native.glfwGetOSMesaContext(@ptrCast(*native.GLFWwindow, window.handle))) |context| return @ptrCast(*anyopaque, context);
|
if (native.glfwGetOSMesaContext(@ptrCast(*native.GLFWwindow, window.handle))) |context| return @ptrCast(*anyopaque, context);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext => |e| @errSetCast(error{NoWindowContext}, e),
|
Error.NoWindowContext => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,7 @@ pub inline fn makeContextCurrent(window: ?Window) error{ NoWindowContext, Platfo
|
||||||
if (window) |w| c.glfwMakeContextCurrent(w.handle) else c.glfwMakeContextCurrent(null);
|
if (window) |w| c.glfwMakeContextCurrent(w.handle) else c.glfwMakeContextCurrent(null);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoWindowContext,
|
Error.NoWindowContext, Error.PlatformError => |e| e,
|
||||||
Error.PlatformError,
|
|
||||||
=> @errSetCast(error{ NoWindowContext, PlatformError }, err),
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -103,9 +101,7 @@ pub inline fn swapInterval(interval: i32) error{ NoCurrentContext, PlatformError
|
||||||
c.glfwSwapInterval(@intCast(c_int, interval));
|
c.glfwSwapInterval(@intCast(c_int, interval));
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.NoCurrentContext,
|
Error.NoCurrentContext, Error.PlatformError => |e| e,
|
||||||
Error.PlatformError,
|
|
||||||
=> @errSetCast(error{ NoCurrentContext, PlatformError }, err),
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -143,9 +139,7 @@ pub inline fn extensionSupported(extension: [:0]const u8) error{ NoCurrentContex
|
||||||
|
|
||||||
const supported = c.glfwExtensionSupported(extension);
|
const supported = c.glfwExtensionSupported(extension);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NoCurrentContext,
|
Error.NoCurrentContext, Error.PlatformError => |e| e,
|
||||||
Error.PlatformError,
|
|
||||||
=> @errSetCast(error{ NoCurrentContext, PlatformError }, err),
|
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidValue => unreachable,
|
Error.InvalidValue => unreachable,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ pub inline fn getRequiredInstanceExtensions() error{APIUnavailable}![][*:0]const
|
||||||
if (c.glfwGetRequiredInstanceExtensions(&count)) |extensions| return @ptrCast([*][*:0]const u8, extensions)[0..count];
|
if (c.glfwGetRequiredInstanceExtensions(&count)) |extensions| return @ptrCast([*][*:0]const u8, extensions)[0..count];
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.APIUnavailable => @errSetCast(error{APIUnavailable}, err),
|
Error.APIUnavailable => |e| e,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
@ -154,9 +154,7 @@ pub inline fn getPhysicalDevicePresentationSupport(
|
||||||
);
|
);
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.APIUnavailable,
|
Error.APIUnavailable, Error.PlatformError => |e| e,
|
||||||
Error.PlatformError,
|
|
||||||
=> @errSetCast(error{ APIUnavailable, PlatformError }, err),
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return v == c.GLFW_TRUE;
|
return v == c.GLFW_TRUE;
|
||||||
|
|
@ -226,9 +224,7 @@ pub inline fn createWindowSurface(vk_instance: anytype, window: Window, vk_alloc
|
||||||
getError() catch |err| return switch (err) {
|
getError() catch |err| return switch (err) {
|
||||||
Error.NotInitialized => unreachable,
|
Error.NotInitialized => unreachable,
|
||||||
Error.InvalidValue => @panic("Attempted to use window with client api to create vulkan surface."),
|
Error.InvalidValue => @panic("Attempted to use window with client api to create vulkan surface."),
|
||||||
Error.APIUnavailable,
|
Error.APIUnavailable, Error.PlatformError => |e| e,
|
||||||
Error.PlatformError,
|
|
||||||
=> @errSetCast(error{ APIUnavailable, PlatformError }, err),
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
unreachable;
|
unreachable;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue