-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.py
More file actions
33 lines (24 loc) · 970 Bytes
/
Copy pathgui.py
File metadata and controls
33 lines (24 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pygame as pg
import pygame_gui as pg_gui
from utilities import get_resolution
class Gui:
def __init__(self):
self.manager = pg_gui.UIManager(get_resolution())
def events(self, event):
pass
def update(self, time_delta):
self.manager.update(time_delta)
def draw(self, screen):
self.manager.draw_ui(screen)
class BattleGui(Gui):
def __init__(self):
super().__init__()
self.hello_button = pg_gui.elements.UIButton(relative_rect=pg.Rect((350, 275), (100, 50)),
text='Test button',
manager=self.manager)
def events(self, event):
if event.type == pg.USEREVENT:
if event.user_type == pg_gui.UI_BUTTON_PRESSED:
if event.ui_element == self.hello_button:
print('Test button pressed')
self.manager.process_events(event)