It would be as follows:
-The map
*Just acts as a source of tile data, like getTile(x,y)
-The view
*Has a 3*3 grid of tile chunks, which it then renders like render(renderer, offset)
*The chunks may or may not be aligned with the chunks of the map, not sure if i need to. Would be more flexible if i dont need to align them i guess.
-The glue (controller/whatever)
*Fills the view with tiles according to the camera position, then renders with render(renderer, offset) again the offset according to camera position.
*Registers as observer to map to receive updates of changed tiles so it can update the view. Also fills in larger chunks of tiles when scrolling.
I need a glue for each view i have, but it makes sense to have them separate since i could for example have:
-A glue which allows me only to see certain types of tiles
-Or add a fog of war effect
-Or fill it with random tiles for no reason
so the view just blindly draws tiles, while the glue decides where the tiles come from and wether they need to be modified or filtered or something.
Anything to improve in this design? Should i not think about each of this kind of problem for months? :c
Does this tile renderer design look correct?
Started by Waterlimon, Oct 03 2012 09:45 AM
No replies to this topic






