Created
July 1, 2018 18:49
-
-
Save TheMatt2/0c49bc8b4f883f171f04adeda89394d0 to your computer and use it in GitHub Desktop.
A pygame test that looks at the behavior of the pygame.time.Clock.tick() function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import pygame | |
FPSCLOCK = pygame.time.Clock() | |
def test_time(): | |
start = time.time() | |
for i in range(100000): | |
x = i + 5 | |
FPSCLOCK.tick(60) | |
return 100000 / (time.time() - start) | |
def test_tick(tick = None): | |
stop = time.time() + 1 | |
x = 0 | |
while time.time() < stop: | |
x += 1 | |
if tick is None: | |
FPSCLOCK.tick() | |
else: | |
FPSCLOCK.tick(tick) | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment