root module nu_options
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const nu = @import("../nu.zig");
|
||||
|
||||
pub const c = @cImport({
|
||||
@cDefine("GLFW_INCLUDE_NONE", {});
|
||||
@cInclude("GLFW/glfw3.h");
|
||||
@@ -12,7 +14,7 @@ pub const c = @cImport({
|
||||
pub const Bus = @import("Bus.zig");
|
||||
|
||||
pub const Options = struct {
|
||||
title: [*:0]const u8,
|
||||
title: [*:0]const u8 = "Hello World",
|
||||
width: u32 = 1280,
|
||||
height: u32 = 720,
|
||||
x11_class_name: [*:0]const u8 = "floating_window",
|
||||
@@ -23,7 +25,7 @@ var bus: Bus = undefined;
|
||||
pub var handle: *c.GLFWwindow = undefined;
|
||||
var unfocused_rate: f32 = 1.0 / 20.0;
|
||||
|
||||
pub fn init(alloc: std.mem.Allocator, options: Options) !void {
|
||||
pub fn init(alloc: std.mem.Allocator) !void {
|
||||
if (c.glfwInit() != c.GLFW_TRUE)
|
||||
return error.glfwInitFailed;
|
||||
errdefer c.glfwTerminate();
|
||||
@@ -32,13 +34,13 @@ pub fn init(alloc: std.mem.Allocator, options: Options) !void {
|
||||
errdefer bus.deinit();
|
||||
|
||||
c.glfwWindowHint(c.GLFW_CLIENT_API, c.GLFW_NO_API);
|
||||
c.glfwWindowHintString(c.GLFW_X11_CLASS_NAME, options.x11_class_name);
|
||||
c.glfwWindowHintString(c.GLFW_X11_INSTANCE_NAME, options.x11_instance_name);
|
||||
c.glfwWindowHintString(c.GLFW_X11_CLASS_NAME, nu.options.window.x11_class_name);
|
||||
c.glfwWindowHintString(c.GLFW_X11_INSTANCE_NAME, nu.options.window.x11_instance_name);
|
||||
|
||||
handle = c.glfwCreateWindow(
|
||||
@intCast(options.width),
|
||||
@intCast(options.height),
|
||||
options.title,
|
||||
@intCast(nu.options.window.width),
|
||||
@intCast(nu.options.window.height),
|
||||
nu.options.window.title,
|
||||
null,
|
||||
null,
|
||||
) orelse
|
||||
|
Reference in New Issue
Block a user