Guest User

Generator yield

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