View difference between Paste ID: 38Fb7N0Y and Mx6ngAaL
SHOW: | | - or go back to the newest paste.
1
def draw():
2
    draw = tcod.console_put_char_ex
3
    w, h = screen_size()
4
    for x in range(w):
5
        for y in range(h):
6
            c, fg, bg = yield cartesian.Point(x, y)
7
            fg, bg = (getattr(tcod, str(fg), tcod.white),
8
                      getattr(tcod, str(bg), tcod.black))
9
            draw(None, x, y, c, fg, bg)
10
    yield None
11
12
13
# Outside the generator
14
def render(self):
15
    draw = render.draw()
16
    point = draw.send(None)
17
    world = self.world
18
    while point:
19
        world_coord = self.camera.position + point
20
        tile_data = ('.', 'red', 'blue')
21
        if world_coord in world:
22
            tile = world[world_coord]
23
            tile_data = (tile.repr, tile.fg, tile.bg)
24
        point = draw.send(tile_data)