{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:
parent
03a089610b
commit
4a000c7995
9 changed files with 17 additions and 3 deletions
|
|
@ -61,6 +61,7 @@ pub fn deinit(game: *Mod) void {
|
||||||
// TODO(important): remove need for returning an error here
|
// TODO(important): remove need for returning an error here
|
||||||
fn tick(core: *mach.Core.Mod, game: *Mod) !void {
|
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(important): event polling should occur in mach.Core module and get fired as ECS event.
|
||||||
|
// TODO(Core)
|
||||||
var iter = mach.core.pollEvents();
|
var iter = mach.core.pollEvents();
|
||||||
while (iter.next()) |event| {
|
while (iter.next()) |event| {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -70,6 +71,7 @@ fn tick(core: *mach.Core.Mod, game: *Mod) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the back buffer of the swapchain
|
// Grab the back buffer of the swapchain
|
||||||
|
// TODO(Core)
|
||||||
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
||||||
defer back_buffer_view.release();
|
defer back_buffer_view.release();
|
||||||
|
|
||||||
|
|
@ -119,6 +121,7 @@ fn updateWindowTitle(core: *mach.Core.Mod) !void {
|
||||||
core.state().main_window,
|
core.state().main_window,
|
||||||
"core-custom-entrypoint [ {d}fps ] [ Input {d}hz ]",
|
"core-custom-entrypoint [ {d}fps ] [ Input {d}hz ]",
|
||||||
.{
|
.{
|
||||||
|
// TODO(Core)
|
||||||
mach.core.frameRate(),
|
mach.core.frameRate(),
|
||||||
mach.core.inputRate(),
|
mach.core.inputRate(),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ fn tick(
|
||||||
game: *Mod,
|
game: *Mod,
|
||||||
) !void {
|
) !void {
|
||||||
// TODO(important): event polling should occur in mach.Core module and get fired as ECS event.
|
// TODO(important): event polling should occur in mach.Core module and get fired as ECS event.
|
||||||
|
// TODO(Core)
|
||||||
var iter = mach.core.pollEvents();
|
var iter = mach.core.pollEvents();
|
||||||
var direction = game.state().direction;
|
var direction = game.state().direction;
|
||||||
var spawning = game.state().spawning;
|
var spawning = game.state().spawning;
|
||||||
|
|
|
||||||
|
|
@ -122,10 +122,8 @@ fn tick(
|
||||||
core: *mach.Core.Mod,
|
core: *mach.Core.Mod,
|
||||||
renderer: *Mod,
|
renderer: *Mod,
|
||||||
) !void {
|
) !void {
|
||||||
const device = core.state().device;
|
|
||||||
_ = device; // autofix
|
|
||||||
|
|
||||||
// Grab the back buffer of the swapchain
|
// Grab the back buffer of the swapchain
|
||||||
|
// TODO(Core)
|
||||||
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
||||||
defer back_buffer_view.release();
|
defer back_buffer_view.release();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ fn tick(
|
||||||
game: *Mod,
|
game: *Mod,
|
||||||
) !void {
|
) !void {
|
||||||
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
|
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
|
||||||
|
// TODO(Core)
|
||||||
var iter = mach.core.pollEvents();
|
var iter = mach.core.pollEvents();
|
||||||
var direction = game.state().direction;
|
var direction = game.state().direction;
|
||||||
var spawning = game.state().spawning;
|
var spawning = game.state().spawning;
|
||||||
|
|
@ -163,6 +164,7 @@ fn tick(
|
||||||
for (ids, transforms) |id, *old_transform| {
|
for (ids, transforms) |id, *old_transform| {
|
||||||
var location = old_transform.translation();
|
var location = old_transform.translation();
|
||||||
// TODO: formatting
|
// 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) {
|
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);
|
try core.entities.remove(id);
|
||||||
game.state().sprites -= 1;
|
game.state().sprites -= 1;
|
||||||
|
|
@ -200,6 +202,7 @@ fn tick(
|
||||||
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
|
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
|
||||||
|
|
||||||
// Grab the back buffer of the swapchain
|
// Grab the back buffer of the swapchain
|
||||||
|
// TODO(Core)
|
||||||
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
||||||
defer back_buffer_view.release();
|
defer back_buffer_view.release();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ fn tick(
|
||||||
audio: *mach.Audio.Mod,
|
audio: *mach.Audio.Mod,
|
||||||
piano: *Mod,
|
piano: *Mod,
|
||||||
) !void {
|
) !void {
|
||||||
|
// TODO(Core)
|
||||||
var iter = mach.core.pollEvents();
|
var iter = mach.core.pollEvents();
|
||||||
while (iter.next()) |event| {
|
while (iter.next()) |event| {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
|
@ -111,6 +112,7 @@ fn tick(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the back buffer of the swapchain
|
// Grab the back buffer of the swapchain
|
||||||
|
// TODO(Core)
|
||||||
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
||||||
defer back_buffer_view.release();
|
defer back_buffer_view.release();
|
||||||
|
|
||||||
|
|
@ -174,6 +176,7 @@ fn fillTone(audio: *mach.Audio.Mod, frequency: f32) ![]const f32 {
|
||||||
return samples;
|
return samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(Core)
|
||||||
fn keyToFrequency(key: mach.core.Key) f32 {
|
fn keyToFrequency(key: mach.core.Key) f32 {
|
||||||
// The frequencies here just come from a piano frequencies chart. You can google for them.
|
// The frequencies here just come from a piano frequencies chart. You can google for them.
|
||||||
return switch (key) {
|
return switch (key) {
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ fn tick(
|
||||||
game: *Mod,
|
game: *Mod,
|
||||||
) !void {
|
) !void {
|
||||||
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
|
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
|
||||||
|
// TODO(Core)
|
||||||
var iter = mach.core.pollEvents();
|
var iter = mach.core.pollEvents();
|
||||||
var direction = game.state().direction;
|
var direction = game.state().direction;
|
||||||
var spawning = game.state().spawning;
|
var spawning = game.state().spawning;
|
||||||
|
|
@ -184,6 +185,7 @@ fn tick(
|
||||||
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
|
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
|
||||||
|
|
||||||
// Grab the back buffer of the swapchain
|
// Grab the back buffer of the swapchain
|
||||||
|
// TODO(Core)
|
||||||
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
||||||
defer back_buffer_view.release();
|
defer back_buffer_view.release();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ fn tick(
|
||||||
game: *Mod,
|
game: *Mod,
|
||||||
) !void {
|
) !void {
|
||||||
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
|
// TODO(important): event polling should occur in mach.Core module and get fired as ECS events.
|
||||||
|
// TODO(Core)
|
||||||
var iter = mach.core.pollEvents();
|
var iter = mach.core.pollEvents();
|
||||||
var direction = game.state().direction;
|
var direction = game.state().direction;
|
||||||
var spawning = game.state().spawning;
|
var spawning = game.state().spawning;
|
||||||
|
|
@ -228,6 +229,7 @@ fn tick(
|
||||||
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
|
game.state().frame_encoder = core.state().device.createCommandEncoder(&.{ .label = label });
|
||||||
|
|
||||||
// Grab the back buffer of the swapchain
|
// Grab the back buffer of the swapchain
|
||||||
|
// TODO(Core)
|
||||||
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
const back_buffer_view = mach.core.swap_chain.getCurrentTextureView().?;
|
||||||
defer back_buffer_view.release();
|
defer back_buffer_view.release();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,7 @@ fn preRender(sprite_pipeline: *Mod, core: *mach.Core.Mod) void {
|
||||||
// Create the projection matrix
|
// Create the projection matrix
|
||||||
// TODO(sprite): move this out of the hot codepath
|
// TODO(sprite): move this out of the hot codepath
|
||||||
const proj = math.Mat4x4.projection2D(.{
|
const proj = math.Mat4x4.projection2D(.{
|
||||||
|
// TODO(Core)
|
||||||
.left = -@as(f32, @floatFromInt(mach.core.size().width)) / 2,
|
.left = -@as(f32, @floatFromInt(mach.core.size().width)) / 2,
|
||||||
.right = @as(f32, @floatFromInt(mach.core.size().width)) / 2,
|
.right = @as(f32, @floatFromInt(mach.core.size().width)) / 2,
|
||||||
.bottom = -@as(f32, @floatFromInt(mach.core.size().height)) / 2,
|
.bottom = -@as(f32, @floatFromInt(mach.core.size().height)) / 2,
|
||||||
|
|
|
||||||
|
|
@ -366,6 +366,7 @@ fn preRender(text_pipeline: *Mod, core: *mach.Core.Mod) void {
|
||||||
// Create the projection matrix
|
// Create the projection matrix
|
||||||
// TODO(text): move this out of the hot codepath
|
// TODO(text): move this out of the hot codepath
|
||||||
const proj = math.Mat4x4.projection2D(.{
|
const proj = math.Mat4x4.projection2D(.{
|
||||||
|
// TODO(Core)
|
||||||
.left = -@as(f32, @floatFromInt(mach.core.size().width)) / 2,
|
.left = -@as(f32, @floatFromInt(mach.core.size().width)) / 2,
|
||||||
.right = @as(f32, @floatFromInt(mach.core.size().width)) / 2,
|
.right = @as(f32, @floatFromInt(mach.core.size().width)) / 2,
|
||||||
.bottom = -@as(f32, @floatFromInt(mach.core.size().height)) / 2,
|
.bottom = -@as(f32, @floatFromInt(mach.core.size().height)) / 2,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue