fps limit
This commit is contained in:
5
main.py
5
main.py
@@ -16,6 +16,8 @@ def main():
|
|||||||
|
|
||||||
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||||
|
|
||||||
|
time = pygame.time.Clock()
|
||||||
|
dt = 0
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
@@ -23,8 +25,9 @@ def main():
|
|||||||
return
|
return
|
||||||
|
|
||||||
pygame.Surface.fill(screen, (0,0,0))
|
pygame.Surface.fill(screen, (0,0,0))
|
||||||
|
pygame.display.flip() #refresh screen
|
||||||
|
|
||||||
pygame.display.flip() #this is the last in loop | refresh screen
|
dt = time.tick(60) / 1000 #conveted to ms
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user