Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Godsmith committed Aug 30, 2023
1 parent a4cf626 commit f7608e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion trainfinity2/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self):
self.right = self.original_right
self.bottom = self.original_bottom
self.top = self.original_top
self._old_viewport = (0, 0, 0, 0)
self._old_viewport = (0.0, 0.0, 0.0, 0.0)
self._is_active = False

def __enter__(self):
Expand Down
10 changes: 5 additions & 5 deletions trainfinity2/graphics/drawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any, Collection, Iterable

import arcade
from arcade import color
from arcade import Shape, color
from pyglet.math import Vec2

from trainfinity2.graphics.rail_shapes import get_rail_shapes
Expand Down Expand Up @@ -42,7 +42,7 @@ class _ShapeElementList:
if trying to draw an empty list."""

def __init__(self) -> None:
self._list = arcade.ShapeElementList()
self._list = arcade.ShapeElementList[Shape]()

def __len__(self) -> int:
return len(self._list)
Expand Down Expand Up @@ -119,7 +119,7 @@ def _remove(self, object: Any):
del self._signal_shapes_from_object_id[id(object)]

def _create_grid(self, grid: Grid):
self._grid_shape_list = arcade.ShapeElementList()
self._grid_shape_list = _ShapeElementList()
for x in range(grid.left, grid.right + 1, GRID_BOX_SIZE):
self._grid_shape_list.append(
arcade.create_line(
Expand Down Expand Up @@ -310,7 +310,7 @@ def _remove_iron(self, position: Vec2, amount: int):

def _show_rails_being_built(self, rails: set[Rail]):
if rails != self._rails_being_built:
self.rails_being_built_shape_element_list = arcade.ShapeElementList()
self.rails_being_built_shape_element_list = _ShapeElementList()
for rail in rails:
color = (
BUILDING_RAIL_COLOR if rail.legal else BUILDING_ILLEGAL_RAIL_COLOR
Expand All @@ -325,7 +325,7 @@ def _create_rail(self, rail: Rail):
self._add_rail_shape(rail_shape, rail)

def highlight(self, positions: Iterable[Vec2]):
self.highlight_shape_element_list = arcade.ShapeElementList()
self.highlight_shape_element_list = _ShapeElementList()
for position in positions:
shape = arcade.create_rectangle_filled(
position.x + GRID_BOX_SIZE / 2,
Expand Down

0 comments on commit f7608e2

Please sign in to comment.