Fixed Sprite Transform functions

* Stored base offsets and vertices in sprite structure
* Calculated the average of vertices in polygon and chain shapes and used that as center
* Applied offsets to drawSprites()
This commit is contained in:
n00b
2025-05-26 14:07:18 -04:00
parent bd3ec7f502
commit 207868cd5d
6 changed files with 628 additions and 272 deletions

View File

@@ -20,11 +20,23 @@ struct rc_sprite2D_physics_obj
int offset_x;
int offset_y;
int base_offset_x = 0;
int base_offset_y = 0;
float radius; //radius when scale is 1
int user_offset_x;
int user_offset_y;
int base_user_offset_x;
int base_user_offset_y;
int box_width;
int box_height;
irr::core::array<b2Vec2> vertices; //store vertices at scale 1
b2Vec2 prev_vertex;
b2Vec2 next_vertex;
};
struct rc_sprite2D_animation_obj