mach: Added runtime application options
Reused mach.Options for run time options. It is set with Engine.setOptions function. ``pub const options`` on top level App has no effect and will be ignored completely. Added a blank struct StartupOptions which would be used for startup time options in future. Currently they aren't used for anything.
This commit is contained in:
parent
01eee68f5b
commit
ed0e6f5c61
4 changed files with 27 additions and 9 deletions
|
|
@ -34,10 +34,10 @@ target_desc: gpu.SwapChain.Descriptor,
|
|||
|
||||
internal: platform.Type,
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator, options: structs.Options) !Engine {
|
||||
pub fn init(allocator: std.mem.Allocator) !Engine {
|
||||
var engine: Engine = undefined;
|
||||
engine.allocator = allocator;
|
||||
engine.options = options;
|
||||
engine.options = structs.Options{};
|
||||
engine.timer = try Timer.start();
|
||||
|
||||
engine.internal = try platform.Type.init(allocator, &engine);
|
||||
|
|
@ -45,6 +45,14 @@ pub fn init(allocator: std.mem.Allocator, options: structs.Options) !Engine {
|
|||
return engine;
|
||||
}
|
||||
|
||||
/// Set runtime options for application, like title, window size etc.
|
||||
///
|
||||
/// See mach.Options for details
|
||||
pub fn setOptions(engine: *Engine, options: structs.Options) !void {
|
||||
try engine.internal.setOptions(options);
|
||||
engine.options = options;
|
||||
}
|
||||
|
||||
pub fn setShouldClose(engine: *Engine, value: bool) void {
|
||||
engine.internal.setShouldClose(value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue