fix(vagrant): wrap world rendering in camera.begin/finish

Map + furniture + puppet now render via the 2D camera so the camera
target (= puppet position) appears at screen-center. Without the wrap,
world rendering happened in raw window-coords: puppet at world (320,240)
appeared at screen upper-left, mouse-screen-to-world math was correct
but mouse cursor over the visible puppet computed dx/dy from puppet's
world position to mouse_world which was OFF-by-(w/2,h/2). Visual result:
head pointed in wrong direction relative to actual mouse position.

Spine-prototype already used this pattern (init.lua:128). Aligning
vagrant-skeleton with that convention.
This commit is contained in:
Axel Meyer
2026-05-18 20:26:45 +02:00
parent c3f2730119
commit 60afa48976

View File

@@ -193,14 +193,16 @@ function M.update(ctx, dt)
end
function M.draw(ctx)
-- Sprite-tilemap (maps.draw_map with sprite-mode + tile_rotations).
r_lib.draw_map()
-- Hardcoded furniture placements (test-chamber spirit).
engine.render.draw_sprite_transform(state.bed_tex, 200, 150, 0, 1, 1, 32, 32, 0xFFFFFFFF)
engine.render.draw_sprite_transform(state.bench_tex, 400, 300, 0, 1, 1, 32, 32, 0xFFFFFFFF)
engine.render.draw_sprite_transform(state.backpack_tex, 350, 400, 0, 1, 1, 16, 16, 0xFFFFFFFF)
-- Puppet (sprite-mode via texture_handles populated by load_rig+load_textures).
puppet.render(state.player)
camera.begin()
-- Sprite-tilemap (maps.draw_map with sprite-mode + tile_rotations).
r_lib.draw_map()
-- Hardcoded furniture placements (test-chamber spirit).
engine.render.draw_sprite_transform(state.bed_tex, 200, 150, 0, 1, 1, 32, 32, 0xFFFFFFFF)
engine.render.draw_sprite_transform(state.bench_tex, 400, 300, 0, 1, 1, 32, 32, 0xFFFFFFFF)
engine.render.draw_sprite_transform(state.backpack_tex, 350, 400, 0, 1, 1, 16, 16, 0xFFFFFFFF)
-- Puppet (sprite-mode via texture_handles populated by load_rig+load_textures).
puppet.render(state.player)
camera.finish()
if CI_FRAME_PERF then
engine.print("vagrant: render_frame_ok")
if not ci_sprite_traced then