glfw: add system for nice Zig callbacks, add Window.setPosCallback

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-10-18 00:02:57 -07:00 committed by Stephen Gutekanst
parent a93de211cf
commit 09415dd3e8
2 changed files with 98 additions and 41 deletions

View file

@ -48,7 +48,7 @@ pub inline fn makeContextCurrent(window: ?Window) Error!void {
pub inline fn getCurrentContext() Error!?Window {
const handle = c.glfwGetCurrentContext();
try getError();
if (handle) |h| return Window{ .handle = h };
if (handle) |h| return try Window.from(h);
return null;
}