Frame rate counter
parent
ac0b8dc2f5
commit
48c8163609
|
@ -51,12 +51,13 @@ if what_to_run == 'level':
|
|||
ghost_character.position_scale = PositionScale((90, 50), (1, 1))
|
||||
sprite_manager.add_ui_element(DrawLayers.OBJECTS, ghost_character)
|
||||
|
||||
text_1 = TextLabel("Frame: 0", 2, 110, 50, alignment="left")
|
||||
text_1.position_scale.scale = (0.3, 0.3)
|
||||
sprite_manager.add_ui_element(DrawLayers.UI, text_1)
|
||||
calculated_frame_rate_text = TextLabel("Frame rate: 0", 2, 110, 70, alignment="left")
|
||||
calculated_frame_rate_text.position_scale.scale = (0.3, 0.3)
|
||||
sprite_manager.add_ui_element(DrawLayers.UI, calculated_frame_rate_text)
|
||||
|
||||
while True:
|
||||
clock.tick(frame_rate)
|
||||
calculated_frame_rate_text.text = f"Frame rate: {round(clock.get_fps())}"
|
||||
|
||||
pygame_events: list[pygame.event.Event] = pygame.event.get()
|
||||
key_manager.update_key_events(pygame_events)
|
||||
|
|
Loading…
Reference in New Issue