diff options
Diffstat (limited to 'src/source.zig')
| -rw-r--r-- | src/source.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/source.zig b/src/source.zig index 917e08a..6a3781c 100644 --- a/src/source.zig +++ b/src/source.zig @@ -6,6 +6,7 @@ const util = @import("util.zig"); pub const Source = struct { texture: gl.Texture, + update_fn: ?*const fn (self: *Source) anyerror!bool = null, deinit_fn: *const fn (self: *Source, allocator: std.mem.Allocator) void, register_fn: ?*const fn (self: *Source, name: []const u8, control: *ctrl.ControlServer) void = null, unregister_fn: ?*const fn (self: *Source, name: []const u8, control: *ctrl.ControlServer) void = null, @@ -27,6 +28,14 @@ pub const Source = struct { } } + pub fn update(self: *Source) bool { + if (self.update_fn) |update_fn| { + return update_fn(self) catch return true; + } + + return false; + } + pub fn updateUniform(self: *Source, param: []const u8, value: gl.UniformPointer) anyerror!void { if (self.update_uniform_fn) |update_uniform_fn| { try update_uniform_fn(self, param, value); |
