Sway and matrices

This commit is contained in:
duck
2025-08-24 18:54:49 +05:00
parent b73f0d446a
commit f3d2eff20e
4 changed files with 42 additions and 20 deletions

View File

@@ -6,7 +6,7 @@ const comp = @import("components.zig");
pub var time: Time = undefined;
var next_stop: Time = undefined;
var entities: comp.Storage(Entity, .{}) = undefined;
pub var entities: comp.Storage(Entity, .{}) = undefined;
pub var plane_mesh: Graphics.Mesh = undefined;
pub var cube_mesh: Graphics.Mesh = undefined;
@@ -19,20 +19,6 @@ pub fn initDebug() void {
.position = .{ 0, 0 },
.player = true,
});
_ = entities.add(.{
.position = .{ 2, 0 },
.enemy = true,
.controller = .{
.move_units = 0.25,
},
});
_ = entities.add(.{
.position = .{ 3, 0 },
.enemy = true,
.controller = .{
.move_units = 0.25,
},
});
time = Time.ZERO;
World.plane_mesh = Graphics.loadMesh(@ptrCast(&PLANE_MESH_DATA));
World.cube_mesh = Graphics.loadMesh(@ptrCast(&CUBE_MESH_DATA));
@@ -60,7 +46,7 @@ pub fn updateReal(delta: f32) void {
}
pub fn draw(delta: f32) void {
Graphics.drawMesh(World.plane_mesh, World.texture, .{ .scale = @splat(5) });
Graphics.drawMesh(World.plane_mesh, World.texture, Graphics.Transform.matrix(.{ .scale = @splat(5) }));
var iter = World.entities.iter();
while (iter.next()) |entity| {
entity.draw(delta);