ui improvements and texture tests
This commit is contained in:
@@ -12,6 +12,13 @@ inline bool ViButton(Vec2Df mp, float x, float y, float radius, Color color){
|
||||
return (Vector2Distance(mp, (Vector2){x,y}) < radius && IsMouseButtonPressed(MOUSE_BUTTON_LEFT));
|
||||
}
|
||||
|
||||
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));
|
||||
DrawTextureEx(tex, center_pos, rotation, scale, color);
|
||||
return (Vector2Distance(mp, position) < radius && IsMouseButtonPressed(MOUSE_BUTTON_LEFT));
|
||||
}
|
||||
|
||||
inline bool ViButton(Vec2Df mp, Vec2Df position, float radius, Color color){
|
||||
return ViButton(mp, position.x, position.y, radius, color);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user