zig-chess/src/window.zig

30 lines
832 B
Zig

const std = @import("std");
const log = std.log.scoped(.graphics);
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,
);
log.debug("GLFW platform: {any}", .{glfw.getPlatform()});
log.debug("Vulkan supported by GLFW: {}", .{glfw.isVulkanSupported()});
const size = window.getSize();
const fb_size = window.getFramebufferSize();
log.debug("Window size: {}x{}", .{ size[0], size[1] });
log.debug("Framebuffer size: {}x{}", .{ fb_size[0], fb_size[1] });
log.debug("Window visible: {}", .{window.getAttribute(.visible)});
return window;
}