{Core,examples}: add TODO markers for core APIs that require module exposure

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-04-22 05:37:13 -07:00 committed by Stephen Gutekanst
parent 03a089610b
commit 4a000c7995
9 changed files with 17 additions and 3 deletions

View file

@ -61,6 +61,7 @@ pub fn deinit(game: *Mod) void {
// TODO(important): remove need for returning an error here
fn tick(core: *mach.Core.Mod, game: *Mod) !void {
// TODO(important): event polling should occur in mach.Core module and get fired as ECS event.
// TODO(Core)
var iter = mach.core.pollEvents();
while (iter.next()) |event| {
switch (event) {
@ -70,6 +71,7 @@ fn tick(core: *mach.Core.Mod, game: *Mod) !void {
}
// Grab the back buffer of the swapchain
// TODO(Core)
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
defer back_buffer_view.release();
@ -119,6 +121,7 @@ fn updateWindowTitle(core: *mach.Core.Mod) !void {
core.state().main_window,
"core-custom-entrypoint [ {d}fps ] [ Input {d}hz ]",
.{
// TODO(Core)
mach.core.frameRate(),
mach.core.inputRate(),
},

View file

@ -77,6 +77,7 @@ fn tick(
game: *Mod,
) !void {
// TODO(important): event polling should occur in mach.Core module and get fired as ECS event.
// TODO(Core)
var iter = mach.core.pollEvents();
var direction = game.state().direction;
var spawning = game.state().spawning;

View file

@ -122,10 +122,8 @@ fn tick(
core: *mach.Core.Mod,
renderer: *Mod,
) !void {
const device = core.state().device;
_ = device; // autofix
// Grab the back buffer of the swapchain
// TODO(Core)
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
defer back_buffer_view.release();

View file

@ -96,6 +96,7 @@ fn tick(
game: *Mod,
) !void {
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
// TODO(Core)
var iter = mach.core.pollEvents();
var direction = game.state().direction;
var spawning = game.state().spawning;
@ -163,6 +164,7 @@ fn tick(
for (ids, transforms) |id, *old_transform| {
var location = old_transform.translation();
// TODO: formatting
// TODO(Core)
if (location.x() < -@as(f32, @floatFromInt(mach.core.size().width)) / 1.5 or location.x() > @as(f32, @floatFromInt(mach.core.size().width)) / 1.5 or location.y() < -@as(f32, @floatFromInt(mach.core.size().height)) / 1.5 or location.y() > @as(f32, @floatFromInt(mach.core.size().height)) / 1.5) {
try core.entities.remove(id);
game.state().sprites -= 1;
@ -200,6 +202,7 @@ fn tick(
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
// Grab the back buffer of the swapchain
// TODO(Core)
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
defer back_buffer_view.release();

View file

@ -78,6 +78,7 @@ fn tick(
audio: *mach.Audio.Mod,
piano: *Mod,
) !void {
// TODO(Core)
var iter = mach.core.pollEvents();
while (iter.next()) |event| {
switch (event) {
@ -111,6 +112,7 @@ fn tick(
}
// Grab the back buffer of the swapchain
// TODO(Core)
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
defer back_buffer_view.release();
@ -174,6 +176,7 @@ fn fillTone(audio: *mach.Audio.Mod, frequency: f32) ![]const f32 {
return samples;
}
// TODO(Core)
fn keyToFrequency(key: mach.core.Key) f32 {
// The frequencies here just come from a piano frequencies chart. You can google for them.
return switch (key) {

View file

@ -90,6 +90,7 @@ fn tick(
game: *Mod,
) !void {
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
// TODO(Core)
var iter = mach.core.pollEvents();
var direction = game.state().direction;
var spawning = game.state().spawning;
@ -184,6 +185,7 @@ fn tick(
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
// Grab the back buffer of the swapchain
// TODO(Core)
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
defer back_buffer_view.release();

View file

@ -128,6 +128,7 @@ fn tick(
game: *Mod,
) !void {
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
// TODO(Core)
var iter = mach.core.pollEvents();
var direction = game.state().direction;
var spawning = game.state().spawning;
@ -228,6 +229,7 @@ fn tick(
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
// Grab the back buffer of the swapchain
// TODO(Core)
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
defer back_buffer_view.release();