Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ game programming

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:


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?

Name: Anonymous 2010-08-25 11:47

>>13
Exception-safe?  The program will terminate shortly is an exception is thrown, all the memory will be released when the program terminates.  In before misuse of exceptions.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List