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"))
|
bg.fill(pygame.Color("#cccccc"))
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
|
|
||||||
# gui_manager = pgg.UIManager(screen_size)
|
gui_manager = pgg.UIManager(screen_size)
|
||||||
# save_btn = pgg.elements.UIButton(
|
save_btn = pgg.elements.UIButton(
|
||||||
# relative_rect=pygame.Rect((0, 0), (100, 20)),
|
relative_rect=pygame.Rect((0, 0), (100, 20)),
|
||||||
# text="Save",
|
text="Save",
|
||||||
# manager=gui_manager,
|
manager=gui_manager,
|
||||||
# )
|
)
|
||||||
|
|
||||||
# mouse_prev_x, mouse_prev_y = pygame.mouse.get_pos()
|
# mouse_prev_x, mouse_prev_y = pygame.mouse.get_pos()
|
||||||
|
|
||||||
|
|
@ -63,18 +63,18 @@ def main():
|
||||||
if evt.key == pygame.K_ESCAPE:
|
if evt.key == pygame.K_ESCAPE:
|
||||||
is_running = False
|
is_running = False
|
||||||
|
|
||||||
# if evt.type == pgg.UI_BUTTON_PRESSED:
|
if evt.type == pgg.UI_BUTTON_PRESSED:
|
||||||
# if evt.ui_element == save_btn:
|
if evt.ui_element == save_btn:
|
||||||
# save_map(map_tiles)
|
save_map(map_tiles)
|
||||||
# gui_manager.process_events(evt)
|
gui_manager.process_events(evt)
|
||||||
|
|
||||||
# gui_manager.update(time_delta)
|
gui_manager.update(time_delta)
|
||||||
|
|
||||||
# Drawing
|
# Drawing
|
||||||
screen.blit(bg, (0, 0))
|
screen.blit(bg, (0, 0))
|
||||||
map_tiles.draw(screen)
|
map_tiles.draw(screen)
|
||||||
|
|
||||||
# gui_manager.draw_ui(screen)
|
gui_manager.draw_ui(screen)
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
|
||||||
gameit += 1
|
gameit += 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue