18 lines
356 B
Python
18 lines
356 B
Python
import pygame
|
|
|
|
def start_loop():
|
|
global g_timer, g_elapsed
|
|
g_elapsed = 0
|
|
g_timer = pygame.time.get_ticks()
|
|
|
|
def next_frame():
|
|
global g_timer, g_elapsed
|
|
newticks = pygame.time.get_ticks()
|
|
g_elapsed = newticks - g_timer
|
|
g_timer = newticks
|
|
|
|
def elapsed():
|
|
"""
|
|
get the amount of time passed since the last frame was displayed
|
|
"""
|
|
return g_elapsed
|