]> Untitled Git - axy/ft/a-maze-ing.git/commitdiff
Fixed dumb frame timing issues, now only need to cleanup a bunch of things
authorAxy <gilliardmarthey.axel@gmail.com>
Sat, 21 Mar 2026 04:00:01 +0000 (05:00 +0100)
committerAxy <gilliardmarthey.axel@gmail.com>
Sat, 21 Mar 2026 04:00:01 +0000 (05:00 +0100)
__main__.py

index 85934b6541c6fbf8ef69c59082b8eaab65c75741..4e1593122391e9cb598e324af93acccb77608d5c 100644 (file)
@@ -52,18 +52,17 @@ def clear_backend() -> None:
 
 
 class Tick:
-    tick: float = time.monotonic()
+    tick: float | None = None
 
 
 def display_maze(maze: Maze) -> None:
     now = time.monotonic()
-    if now - Tick.tick < 0.016:
+    if Tick.tick is not None and now - Tick.tick < 0.016:
         return
     Tick.tick = time.monotonic()
 
     clear_backend()
     # pathfind()
-    backend.set_style(full.curr_style())
 
     rewrites = {
         wall for wall in dirty_tracker.curr_dirty() if maze.get_wall(wall)
@@ -74,6 +73,7 @@ def display_maze(maze: Maze) -> None:
         if maze.check_coord(e) and maze.get_wall(e)
     }
 
+    backend.set_style(full.curr_style())
     for wall in rewrites:
         for pixel in wall.tile_coords():
             backend.draw_tile(pixel)
@@ -117,12 +117,10 @@ if config.exit is not None:
 
 pattern = Pattern(config.maze_pattern).centered_for(dims, excluded)
 pattern.fill(maze)
-
 maze.outline()
 
 walls_const = set(maze.walls_full())
 
-
 maze_make_perfect(maze, network_tracker, callback=display_maze)
 maze_make_pacman(maze, walls_const, pacman_tracker, callback=display_maze)