Name: Anonymous 2010-08-25 7:45
So I have a hopefully simple problem.
I have a mainWindow and Window class in my C++ project. For debugging purposes, I want to add 20 points to the player's score every second.
So, in my main loop, I do:
The getGUI() is just a normal getter function of type GUI that returns the gui object from the Window class. However, it doesn't update the score correctly. If I do a direct gui.addPoints(20); in the Window class, the score does update correctly, so I'm assuming it's a problem with accessing the gui object from outside the Window class. Any ideas?
I have a mainWindow and Window class in my C++ project. For debugging purposes, I want to add 20 points to the player's score every second.
So, in my main loop, I do:
if(event.type == SDL_KEYDOWN)
{
window.getGUI().addPoints(20);
}The getGUI() is just a normal getter function of type GUI that returns the gui object from the Window class. However, it doesn't update the score correctly. If I do a direct gui.addPoints(20); in the Window class, the score does update correctly, so I'm assuming it's a problem with accessing the gui object from outside the Window class. Any ideas?