Sorry, this is probably a pretty basic thing, but I have yet to run across it, and it seems like it's gonna be necessary to understand.
Lets assuming I have the following objects, each contained within another object:
GameManagerObject contains CarManagerObject, which contains a number of CarObjects.
So, in order to simplify things like number of surfaces and such, I'd like to use a single surface for the car graphic, though I may have 15 cars.
It seems like a good idea to ME to have that surface in CarManagerObject, and have each CarObject access that surface when it needs to draw itself to the backbuffer.
But the problem i've having is, this doesn't seem to me like the CarObject can even access the backbuffer OR the graphic surface without me passing pointer to them to it. Is there a way around this? I could imagine a LOT of stuff i'd like to be able to access, and passing pointers or whatever to EVERY method seems messy.
Any guidance is greatly appreciated!
Lets assuming I have the following objects, each contained within another object:
- Code:
+ GameManagerObject
+ CarManagerObject
+CarObject
+CarObject
+CarObject
+CarObject
GameManagerObject contains CarManagerObject, which contains a number of CarObjects.
So, in order to simplify things like number of surfaces and such, I'd like to use a single surface for the car graphic, though I may have 15 cars.
It seems like a good idea to ME to have that surface in CarManagerObject, and have each CarObject access that surface when it needs to draw itself to the backbuffer.
But the problem i've having is, this doesn't seem to me like the CarObject can even access the backbuffer OR the graphic surface without me passing pointer to them to it. Is there a way around this? I could imagine a LOT of stuff i'd like to be able to access, and passing pointers or whatever to EVERY method seems messy.
Any guidance is greatly appreciated!