Hi im fairly new to oo programming, and ive started working on a little isometric game in c++ using sdl. i have a question about the alternatives to using global variables. heres my problem.
I have a class screen which sets up the video for my game.
i have a class sprite, for each image that is drawn to the screen.
i have a class map which contains tile objects. each of these contains a sprite, of the tile type.
i then also have a player class which will contain a sprite.
to draw a sprite i have to get a surface from the screen object.
so in order to do this i could either make my screen object global, and available to both the player class and the tile class, or pass a pointer to the screen object to the map then to each tile, and also pass it to the player class.
would passing lots of pointer around have any effect on the speed of the code?
is there an easier way to do this? would making my screen object global be more suited than passing it to one class then to another?
does anyone have any good links describing the kind of thing im doing? ive come across this before in java, and have always worked around it, and not been very OO in the process. but id like to try and be as OO as possible with this.
cheers for absolutely any help. thanks rob.