I'm skimmed the code down to only highlight what I'm having trouble with. I have a class that creates a window. I want to be able to save the name of the object that's created when the class is initialized so that other objects know which window to draw on. Here is my code. What I can't figure out is how to pass the OBJECT name to the setActiveWindow() function...
//In a global header file
extern window *_activeWindow;
void setActiveWindow(window *const w) { _activeWindow = w; }
//In a window.h file
class window {
public:
window() { _buildWindow(800,600); }
private:
_buildWindow(unsignedint width, unsignedint height) {
//... do some stuff to create the window
//set THIS window to the ACTIVE window
setActiveWindow(this);
}
unsignedint _width, _height;
};