Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def draw():
- draw = tcod.console_put_char_ex
- w, h = screen_size()
- for x in range(w):
- for y in range(h):
- c, fg, bg = yield cartesian.Point(x, y)
- fg, bg = (getattr(tcod, str(fg), tcod.white),
- getattr(tcod, str(bg), tcod.black))
- draw(None, x, y, c, fg, bg)
- yield None
- # Outside the generator
- def render(self):
- draw = render.draw()
- point = draw.send(None)
- world = self.world
- while point:
- world_coord = self.camera.position + point
- tile_data = ('.', 'red', 'blue')
- if world_coord in world:
- tile = world[world_coord]
- tile_data = (tile.repr, tile.fg, tile.bg)
- point = draw.send(tile_data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement