Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- draw_world() ->
- Q = qlc:q([X || X <- mnesia:table(world)]),
- F = fun() -> qlc:eval(Q) end,
- {atomic, World} = mnesia:transaction(F),
- {WorldWidth, WorldHeight} = bounding_dimensions(World),
- {DrawX, DrawY} = rogueunlike_util:centering_coords(WorldWidth, WorldHeight),
- DrawF = fun(Spot) ->
- Char = case Spot#world.stuff of
- [walkable] -> ".";
- [wall] -> "#";
- _ -> "\s"
- end,
- {LocX, LocY} = Spot#world.loc,
- cecho:mvaddstr(DrawY+LocY, DrawX+LocX, Char)
- end,
- lists:foreach(DrawF, World),
- cecho:refresh(),
- ok.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement