Skip to content

Commit

Permalink
Example of debug mode stretching the 'legal' area.
Browse files Browse the repository at this point in the history
  • Loading branch information
skytreader committed Mar 11, 2018
1 parent 14cd238 commit fada85a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion algorithms/grids/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from screen import GridScreen

if __name__ == "__main__":
config = GameConfig(window_size=(600, 600))
config = GameConfig(window_size=(600, 600), debug_mode=True, log_to_terminal=True)
model = Grid((10, 10))
screen = GridScreen(config, model)
loop_events = GameLoopEvents(config, screen)
Expand Down
4 changes: 3 additions & 1 deletion algorithms/grids/screen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from components.core import GameScreen, GameLoopEvents
from components.core import Colors

import logging
import pygame

class GridScreen(GameScreen):
Expand All @@ -20,8 +21,9 @@ def __init__(self, gamescreen):
super(GridLoopEvents, self).__init__(gamescreen.config, gamescreen)

def __mouse_click(self):
self.debug_queue.log("click event detected")
pos = pygame.mouse.get_pos()
clicked_cell = self.gamescreen.model.qg.get_clicked_cell(self.gamescreen pos)
clicked_cell = self.gamescreen.model.qg.get_clicked_cell(self.gamescreen, pos)
self.gamescreen.model.toggle(clicked_cell[0], clicked_cell[1])

def attach_event_handlers(self):
Expand Down

0 comments on commit fada85a

Please sign in to comment.