Skip to content

Commit

Permalink
refactor: Add types in renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
strakam committed Oct 3, 2024
1 parent 1dc144a commit bc3f7b0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions generals/gui/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def render(self, fps=None):

def render_cell_text(
self,
cell,
cell: pygame.Surface,
text: str,
fg_color: Color = BLACK,
bg_color: Color = WHITE,
Expand Down Expand Up @@ -257,7 +257,7 @@ def render_grid(self):
self.game_area.blit(self.tiles[i][j], (j * square_size, i * square_size))
self.screen.blit(self.game_area, (0, 0))

def draw_channel(self, channel, color: Color):
def draw_channel(self, channel: np.ndarray, color: Color):
"""
Draw background and borders (left and top) for grid tiles of a given channel
"""
Expand All @@ -267,9 +267,10 @@ def draw_channel(self, channel, color: Color):
pygame.draw.line(self.tiles[i][j], BLACK, (0, 0), (0, square_size), 1)
pygame.draw.line(self.tiles[i][j], BLACK, (0, 0), (square_size, 0), 1)

def draw_images(self, channel, image):
def draw_images(self, channel: np.ndarray, image: pygame.Surface):
"""
Draw images on grid tiles of a given channel
"""
print(type(image))
for i, j in self.game.channel_to_indices(channel):
self.tiles[i][j].blit(image, (3, 2))

0 comments on commit bc3f7b0

Please sign in to comment.