From b823139687f3c55dd3695e11a0cf8f9693524e9b Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 10 May 2025 15:26:01 -0500 Subject: max framerate setter getter --- window.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/window.py b/window.py index 4c51bd1..e3c9fa2 100644 --- a/window.py +++ b/window.py @@ -17,13 +17,20 @@ class PixDisplay: self.renderer = None self.window_width = 0 self.window_height = 0 - # TODO - self.max_framerate = 60 - self.frame_time = int(1000 / self.max_framerate) # In ms + self.max_framerate = 30 self.display_duration = 2.0 self.transition_duration = 0.5 + @property + def max_framerate(self): + return self._max_fps + + @max_framerate.setter + def max_framerate(self, max_fps): + self._max_fps = max_fps # This is just for the getter since otherwise e.g. int(1000/int(1000/60)) would round to 62 + self.frame_time = int(1000 / 60) # In ms + @property def next_texture_index(self): return (self.current_texture_index + 1) % len(self.textures) @@ -44,8 +51,6 @@ class PixDisplay: if not self.textures: glClearColor(0.0, 0.0, 0.0, 1.0) # Set the background color to black glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) - #glLoadIdentity() - glutSwapBuffers() return @@ -65,7 +70,6 @@ class PixDisplay: glClearColor(0.0, 0.0, 0.0, 1.0) # Set the background color to black glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) - #glLoadIdentity() self.renderer.draw_static(self.texture_current, self.window_width, self.window_height, 1) @@ -76,7 +80,6 @@ class PixDisplay: glClearColor(0.0, 0.0, 0.0, 1.0) # Set the background color to black glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) - #glLoadIdentity() # DRAW transition_time = self.image_time - self.display_duration -- cgit v1.2.3