glfw: add assumeInitialized for external GLFW initialization

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-30 10:18:47 -07:00
parent 383d5f4d6e
commit e4b790e9f4
2 changed files with 11 additions and 0 deletions

View file

@ -9,3 +9,6 @@ pub inline fn toggleInitialized() void {
pub inline fn assertInitialized() void {
if (debug_mode) std.debug.assert(glfw_initialized);
}
pub inline fn assumeInitialized() void {
glfw_initialized = true;
}

View file

@ -41,6 +41,14 @@ pub usingnamespace @import("mod.zig");
const internal_debug = @import("internal_debug.zig");
/// If GLFW was already initialized in your program, e.g. you are embedding Zig code into an existing
/// program that has already called glfwInit via the C API for you - then you need to tell mach/glfw
/// that it has in fact been initialized already, otherwise when you call other methods mach/glfw
/// would panic thinking glfw.init has not been called yet.
pub fn assumeInitialized() void {
internal_debug.assumeInitialized();
}
/// Initializes the GLFW library.
///
/// This function initializes the GLFW library. Before most GLFW functions can be used, GLFW must