-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.py
More file actions
18 lines (14 loc) · 654 Bytes
/
Copy pathui.py
File metadata and controls
18 lines (14 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""
Small UI drawing helpers.
Non-technical summary:
- Keeps repeated button drawing style in one place.
- If you want all buttons to look different, edit this file.
"""
import pygame
def draw_button(surface, rect, label, font, hover=False):
"""Draw one rounded button with hover highlight and centered text."""
fill = (220, 220, 220) if hover else (180, 180, 180)
pygame.draw.rect(surface, fill, rect, border_radius=8)
pygame.draw.rect(surface, (30, 30, 30), rect, 2, border_radius=8)
txt = font.render(label, True, (20, 20, 20))
surface.blit(txt, (rect.centerx - txt.get_width() // 2, rect.centery - txt.get_height() // 2))