@@ -1,5 +1,6 @@
const std = @import("std");
const root = @import("root");
const ModuleInfo = @import("module-info.zig");
const bufPrintZ = std.fmt.bufPrintZ;
pub const OBS = @cImport({
@@ -15,27 +16,7 @@ pub const Scene = @import("obs/frontend.zig").OBSScene;
pub const QtShim = @import("obs/frontend.zig").QtShim;
/// Define a module_defaults in you root project file
const module_defaults: ModuleDefaults = if (@hasDecl(root, "module_defaults")) root.module_defaults else .{};
pub const ModuleDefaults = struct {
/// Name of the OBS plugin
name: [:0]const u8 = "Unnamed Module",
/// Current version of this plugin
version: [:0]const u8 = "0.0.0",
/// Author of the this plugin
author: [:0]const u8 = "Anonymous Authors",
/// Description for this plugin
description: [:0]const u8 = "Default Description for an unnamed module.",
/// Optional function that will be called when the plugin is loaded by OBS
/// this function does not require callconv(.C) but other call backs
/// provided may require it.
on_load_fn: *const fn () bool = empty_on_load,
/// Optional function that will be called when the plugin is unloaded by OBS
/// usually at program exit, but there are other events that could unload a
/// plugin.
on_unload_fn: *const fn () void = empty_on_unload,
};
const module_defaults: ModuleInfo = if (@hasDecl(root, "module_defaults")) root.module_defaults else .{};
/// call exportOBS in comptime to ensure Zig is able to see the required
/// funtions obs needs to export.
@@ -92,12 +73,6 @@ export fn obs_module_unload() void {
return module_defaults.on_unload_fn();
}
fn empty_on_load() bool {
return true;
}
fn empty_on_unload() void {}
pub fn logFmt(comptime text: []const u8, vars: anytype) void {
var buf: [0xffff:0]u8 = undefined;
const txt = bufPrintZ(&buf, text, vars) catch unreachable;