delete button texturized but still at incorrect position

This commit is contained in:
Sebastian
2026-06-26 02:23:08 +02:00
parent 9ea1305c27
commit 3f8984b69f
3 changed files with 12 additions and 7 deletions
+2 -1
View File
@@ -14,8 +14,9 @@ inline bool ViButton(Vec2Df mp, float x, float y, float radius, Color color){
inline bool ViTexButton(Vec2Df mp, Vec2Df position, float rotation, float radius, Texture2D tex, Color color){
float scale = (radius*2.0f) / (float)tex.width;
Vec2Df center_pos = position - Vec2Df((tex.width*scale)/1.0f * sin(rotation), (tex.height*scale)/1.0f * cos(rotation));
Vec2Df center_pos = position - Vec2Df((tex.width*scale) / 2.0f, (tex.height*scale) / 2.0f).rotate(rotation);
DrawTextureEx(tex, center_pos, rotation, scale, color);
return (Vector2Distance(mp, position) < radius && IsMouseButtonPressed(MOUSE_BUTTON_LEFT));
}