From 0d30245e20fc5248121e438aa4160b780d5a74b6 Mon Sep 17 00:00:00 2001 From: s452645 Date: Tue, 16 Mar 2021 06:41:40 +0100 Subject: [PATCH] added FPS control --- main.py | 5 +++++ project_constants.py | 1 + 2 files changed, 6 insertions(+) diff --git a/main.py b/main.py index d98bdca..61af3bd 100644 --- a/main.py +++ b/main.py @@ -11,6 +11,9 @@ def main(): pygame.init() pygame.display.set_caption(const.V_NAME_OF_WINDOW) + # FPS clock + clock = pygame.time.Clock() + # for blocky textures glEnable(GL_TEXTURE_2D) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) @@ -20,6 +23,8 @@ def main(): running = True while running: + # FPS control + clock.tick(const.V_FPS) # ================ # # === GRAPHICS === # diff --git a/project_constants.py b/project_constants.py index 91e38c1..63ae841 100644 --- a/project_constants.py +++ b/project_constants.py @@ -14,6 +14,7 @@ import os V_NAME_OF_WINDOW = "MineFusion TM" ASSETS_DIR = os.path.join("resources", "assets") +V_FPS = 60 V_TILE_SIZE = 60 V_GRID_VER_TILES = V_GRID_HOR_TILES = 10 # vertical, horizontal