diff --git a/src/game/scenes/ingame.c b/src/game/scenes/ingame.c index 8a26802..ac0d281 100644 --- a/src/game/scenes/ingame.c +++ b/src/game/scenes/ingame.c @@ -37,6 +37,11 @@ static void ingame_tick(struct state *state) { .path = "/assets/player/baron-walk.png", .color = (t_color){255, 255, 255, 255}, }); + push_sprite_ex((t_frect){ .x = 128, .y = 32, .w = 128, .h = 64 }, (t_push_sprite_args){ + .path = "/assets/player/baron-walk.png", + .color = (t_color){255, 255, 255, 255}, + .rotation = (float)M_PI * 2 * (float)(ctx.tick_count % 64) / 64, }); + unfurl_triangle("/assets/big-violet.png", (t_fvec3){ -1, -1, 0 }, (t_fvec3){ 1, -1, 0 }, diff --git a/src/rendering/sprites.h b/src/rendering/sprites.h index 88c2c58..9c3e24e 100644 --- a/src/rendering/sprites.h +++ b/src/rendering/sprites.h @@ -241,7 +241,15 @@ static void render_sprites(const struct primitive_2d primitives[], } else { /* rotated non-square case*/ - CRY("Rotation", "Unimplemented"); + const t_fvec2 c = frect_center(sprite.rect); + const t_fvec2 t = fast_cossine(sprite.rotation); + + const t_fvec2 h = { sprite.rect.w / 2, sprite.rect.h / 2 }; + + v0 = (t_fvec2){ c.x + t.x * -h.x - t.y * -h.y, c.y + t.y * -h.x + t.x * -h.y }; + v1 = (t_fvec2){ c.x + t.x * -h.x - t.y * +h.y, c.y + t.y * -h.x + t.x * +h.y }; + v2 = (t_fvec2){ c.x + t.x * +h.x - t.y * +h.y, c.y + t.y * +h.x + t.x * +h.y }; + v3 = (t_fvec2){ c.x + t.x * +h.x - t.y * -h.y, c.y + t.y * +h.x + t.x * -h.y }; } if (!batch.constant_colored)