[gameprogrammer] Re: making a global instance

Try using a namespace, they're really simple to use and they, for the
most part, avoid nasty global variables... I'm not sure of a good url to
help with more info but basically you do something like:

namespace bla {
        int somevar;
}

Then, once you want to use somevar you can access it by bla::somevar or
you can do:
using namespace bla;

I'm not sure it's the best idea, but that's how I've done it in the past

See ya,
Eugene

On Sat, 2004-06-12 at 07:40, Roger D. Vargas wrote:
> I have a problem with my project, I want to have all images, scene nodes
> and sounds stored in caches, to avoid repeated resources consuming
> memory. I need to make those caches available to all game components,
> like the gui, character entities, etc. Something like a global variable.
> But of course I want to avoid declaring that instance as a global
> variable or passing the cache as parameter to all constructors. Can
> somebody give me an idea? Im using C++.


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: