Defining and accessing objects in a large framework

What would be a good method of defining wrapper class objects (outside of main) for which there should be no more than one instance per class in a large framework. Needs to be in a way that they can be accessed from anywhere.

(e.g. using Clock.Get_Deltatime() in a gameobject like player, but running Clock.Update() in main.)

Can I do something like this?:

1
2
3
4
5
6
7
8
9
10
11
#ifndef PLUGIN_H
#define PLUGIN_H

#include "DisplayManager.h"
#include "EventHandler.h"

DisplayManager Display;
EventHandler Input;
Time Clock;

#endif PLUGIN_H 


Than include Plugin.h anytime I need to access Display, Clock and Input? Considering this method I just mentioned, singletons and static variables, but am open to suggestions.
Last edited on
Topic archived. No new replies allowed.