25 lines
674 B
Python
25 lines
674 B
Python
from gui import *
|
|
from vector2 import *
|
|
|
|
class World:
|
|
def __init__(self, data: list[list[int]], symbols: list[str]) -> None:
|
|
self.__width = len(data[0])
|
|
self.__height = len(data)
|
|
self.__data = data
|
|
self.__symbols = symbols
|
|
|
|
@property
|
|
def width(self):
|
|
return self.__width
|
|
|
|
@property
|
|
def height(self):
|
|
return self.__height
|
|
|
|
def is_empty(self, position: Vector2):
|
|
return self.__data[position.y][position.x] == 0
|
|
|
|
def draw(self, gui: Gui) -> None:
|
|
for y in range(self.height):
|
|
for x in range(self.width):
|
|
gui.draw(x, y, self.__symbols[self.__data[y][x]]) |