directories needed: * build - for cmake output * deps - stuff needed to compile McRogueface (headers) libtcod -> ../modules/libtcod/src/libtcod sfml -> ../modules/SFML/include/SFML python -> ../modules/cpython/Include * lib - stuff needed to link McRogueFace (shared objects); also required at runtime libtcod -> `../modules/libtcod/buildsys/autotools/.libs/libtcod.so.1.0.24` sfml -> `../modules/SFML/build/lib/*` python -> `../modules/cpython/libpython3.12.so`; standard lib at ../modules/cpython/build/lib.linux-x86_64-3.12 & ../modules/cpython/Lib You can get dependencies by: - Build from source (i.e. all submodules) - Go download them from each project's website - install packages from your distro and symlink them to deps/lib directories
50 lines
1.9 KiB
Python
50 lines
1.9 KiB
Python
class GridPoint:
|
|
def __init__(self, color, walkable, tilesprite, transparent, visible, discovered, color_overlay, tile_overlay, uisprite):
|
|
self.color = color
|
|
self.walkable = walkable
|
|
self.tilesprite = tilesprite
|
|
self.transparent = transparent
|
|
self.visible = visible
|
|
self.discovered = discovered
|
|
self.color_overlay = color_overlay
|
|
self.tile_overlay = tile_overlay
|
|
self.uisprite = uisprite
|
|
|
|
def __repr__(self):
|
|
return f"<GridPoint {self.color}, {self.tilesprite}/{self.uisprite} {'W' if self.walkable else '-'}{'T' if self.transparent else '-'}{'V' if self.visible else '-'}{'D' if self.discovered else '-'} {self.color_overlay}/{self.tile_overlay}>"
|
|
|
|
class Grid:
|
|
def __init__(self, title, gx, gy, gs, x, y, w, h, visible=False):
|
|
self.title = title
|
|
self.grid_x = gx
|
|
self.grid_y = gy
|
|
self.grid_size = gs
|
|
self.x = x
|
|
self.y = y
|
|
self.w = w
|
|
self.h = h
|
|
self.visible = visible
|
|
|
|
self.points = []
|
|
self.entities = []
|
|
|
|
def at(self, x, y):
|
|
if not (x > 0 and y > 0 and x < self.grid_x and y < self.grid_y): return None
|
|
return self.points[y * self.grid_y + x]
|
|
|
|
def __repr__(self):
|
|
return f"<Grid {self.grid_x}x{self.grid_y}, grid_size={self.grid_size}, (({self.x},{self.y}), ({self.w}, {self.h})), visible={self.visible}>"
|
|
|
|
|
|
# CGrid(Grid* _g, int _ti, int _si, int _x, int _y, bool _v)
|
|
class Entity:
|
|
def __init__(self, parent, tex_index, sprite_index, x, y, visible=True):
|
|
self.parent = parent
|
|
self.tex_index = tex_index
|
|
self.sprite_index = sprite_index
|
|
self.x = x
|
|
self.y = y
|
|
self.visible = visible
|
|
|
|
def __repr__(self):
|
|
return f"<Entity on grid {repr(self.parent)}@({self.x},{self.y}), TI={self.tex_index}, SI={self.sprite_index}, visible={self.visible}>"
|