zig-chess/src/window.zig

29 lines
833 B
Zig

const std = @import("std");
const glfw = @import("zglfw");
pub fn initWindow(x: c_int, y: c_int, name: [:0]const u8) !*glfw.Window {
try glfw.init();
errdefer glfw.terminate();
glfw.windowHint(.client_api, .no_api);
const window = try glfw.Window.create(
x,
y,
name,
null,
null,
);
std.debug.print("GLFW platform: {any}\n", .{glfw.getPlatform()});
std.debug.print("Vulkan supported by GLFW: {}\n", .{glfw.isVulkanSupported()});
const size = window.getSize();
const fb_size = window.getFramebufferSize();
std.debug.print("Window size: {}x{}\n", .{ size[0], size[1] });
std.debug.print("Framebuffer size: {}x{}\n", .{ fb_size[0], fb_size[1] });
std.debug.print("Window visible: {}\n", .{window.getAttribute(.visible)});
return window;
}