def map_(): map_ = libtcodpy.map_new(MAP_WIDTH, MAP_HEIGHT) for y, line in enumerate(MAP): for x, ch in enumerate(line): libtcodpy.map_set_properties(map_, x, y, ch == ' ', ch == ' ') yield map_ libtcodpy.map_delete(map_)
def test_map(): map = libtcodpy.map_new(16, 16) assert libtcodpy.map_get_width(map) == 16 assert libtcodpy.map_get_height(map) == 16 libtcodpy.map_copy(map, map) libtcodpy.map_clear(map) libtcodpy.map_set_properties(map, 0, 0, True, True) assert libtcodpy.map_is_transparent(map, 0, 0) assert libtcodpy.map_is_walkable(map, 0, 0) libtcodpy.map_is_in_fov(map, 0, 0) libtcodpy.map_delete(map)
def __del__(self): libtcod.map_delete(self.map) libtcod.path_delete(self.path) self.map, self.path = None, None
def __del__(self): """ The sight map must be manually garbage-collected. """ tcod.map_delete(self.sight_map)
def close(self): libtcod.map_delete(self.__tcod_light_map) libtcod.image_delete(self.__tcod_light_image)
def close(self): """Clean up lighting assets prior to deleting object""" libtcod.map_delete(self.__tcod_light_map) libtcod.image_delete(self.__tcod_light_image) self.light_enabled = False
def __del__(self): # garbage collect libtcod.map_delete(self.map) self.map = None