If this was C++, i’d be happily using the ‘friend’ keyword, as is i’m stuck as to how to do this…
So theres a ‘World’ class which holds the game state, character position etc. etc. and has all the game logic in it. Along with this we have a GLRenderer and a J2DRenderer, each rendering the world in its own way. Thus any generic info goes in World, anything drawing related (textures, sprites etc.) goes in the appropriate renderer.
Problem is the actual rendering code - each renderer obviously needs access to the World data, and not in an abstracted way, but in a raw data sense. This means that the two become tightly coupled, but this is unavoidable. But without a friend, the only solution is to make the World data public (ick, ugly and dangerous), add a whole bunch of getters (not much of an improvement really) or…?
Anyone any ideas?
