def update
# some game logic which flags the grid as dirty
if grid.dirty?
@grid_image = record(w,h){ tiles.each{|tile| tile.draw} }
end
end
def draw
@grid_image.draw( 0, 0, 0 )
end
def draw
if grid_dirty?
@grid_image = record(w,h){ tiles.each{|tile| tile.draw} }
end
@grid_image.draw( 0, 0, 0 )
end
record
anywhere. This should be documented, I guess - and if it doesn't work, please let me know or file a bug on GitHub :)@grid_image ||= record { ... }
@grid_image.draw 0, 0, 0
draw
because it means that the image will be created right when it is needed. It is impossible for it to be invalid or missing when I want to draw it.
record
callable from a thread? Is it meant to be? C: I know that most of Gosu isn't.Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill