add pygame_gui and save button
This commit is contained in:
parent
95cd888aed
commit
14aad68cb7
24
main.py
24
main.py
|
@ -27,12 +27,12 @@ def main():
|
|||
bg.fill(pygame.Color("#cccccc"))
|
||||
clock = pygame.time.Clock()
|
||||
|
||||
# gui_manager = pgg.UIManager(screen_size)
|
||||
# save_btn = pgg.elements.UIButton(
|
||||
# relative_rect=pygame.Rect((0, 0), (100, 20)),
|
||||
# text="Save",
|
||||
# manager=gui_manager,
|
||||
# )
|
||||
gui_manager = pgg.UIManager(screen_size)
|
||||
save_btn = pgg.elements.UIButton(
|
||||
relative_rect=pygame.Rect((0, 0), (100, 20)),
|
||||
text="Save",
|
||||
manager=gui_manager,
|
||||
)
|
||||
|
||||
# mouse_prev_x, mouse_prev_y = pygame.mouse.get_pos()
|
||||
|
||||
|
@ -63,18 +63,18 @@ def main():
|
|||
if evt.key == pygame.K_ESCAPE:
|
||||
is_running = False
|
||||
|
||||
# if evt.type == pgg.UI_BUTTON_PRESSED:
|
||||
# if evt.ui_element == save_btn:
|
||||
# save_map(map_tiles)
|
||||
# gui_manager.process_events(evt)
|
||||
if evt.type == pgg.UI_BUTTON_PRESSED:
|
||||
if evt.ui_element == save_btn:
|
||||
save_map(map_tiles)
|
||||
gui_manager.process_events(evt)
|
||||
|
||||
# gui_manager.update(time_delta)
|
||||
gui_manager.update(time_delta)
|
||||
|
||||
# Drawing
|
||||
screen.blit(bg, (0, 0))
|
||||
map_tiles.draw(screen)
|
||||
|
||||
# gui_manager.draw_ui(screen)
|
||||
gui_manager.draw_ui(screen)
|
||||
pygame.display.flip()
|
||||
|
||||
gameit += 1
|
||||
|
|
Loading…
Reference in New Issue