Guest User

Improper yield

a guest
Mar 29th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment