Create bundle module #61

Closed
opened 2024-07-24 13:50:22 +02:00 by kayomn · 2 comments
Owner

Create a bundling module for Ona that groups all of the otherwise optional modules together so that they make be easily supplied without having to manually set up each one.

The current workflow does not have what I would consider a sane workflow for the average user or the framework:

pub const main = ona.start(my_game_setup, .{});

fn my_game_setup(world: *ona.World, events: ona.App.Events) !void {
  try gfx.setup(world, events);
  try hid.setup(world, events);

  // game code here...
}
Create a bundling module for Ona that groups all of the otherwise optional modules together so that they make be easily supplied without having to manually set up each one. The current workflow does not have what I would consider a sane workflow for the average user or the framework: ```zig pub const main = ona.start(my_game_setup, .{}); fn my_game_setup(world: *ona.World, events: ona.App.Events) !void { try gfx.setup(world, events); try hid.setup(world, events); // game code here... }
Author
Owner

Each module will also eventually be getting setup parameters exposed for finer control. Whatever aggregate setup approach is used will want to forward these parameters to each relevant modules.

Each module will also eventually be getting setup parameters exposed for finer control. Whatever aggregate setup approach is used will want to forward these parameters to each relevant modules.
kayomn added this to the 1.0 milestone 2024-07-24 13:55:42 +02:00
Author
Owner

My thinking is somethig like this:

pub main = ona.start(bundle.setup_then(my_game_setup));

This change would get rid the of the options structure entirely, as I don't see much point in having those parameters if they're comptime values only.

But basically it would daisy-chain through a combinator function that creates all of the systems automatically.

pub main = ona.start(gfx.setup_then(hid.setup_then(my_game_setup)));

These then combinators could also be exposed on each specific module as well to give further granularity without dropping into an imperative list of function calls.

My thinking is somethig like this: ```zig pub main = ona.start(bundle.setup_then(my_game_setup)); ``` This change would get rid the of the options structure entirely, as I don't see much point in having those parameters if they're comptime values only. But basically it would daisy-chain through a combinator function that creates all of the systems automatically. ```zig pub main = ona.start(gfx.setup_then(hid.setup_then(my_game_setup))); ``` These then combinators could also be exposed on each specific module as well to give further granularity without dropping into an imperative list of function calls.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: kayomn/ona#61
No description provided.