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 21:44

>>20
when an element's constructor, copy-constructor, or assignment operator throws an exception when moving elements around.
None of which happen when you put pointers in it. Way to completely miss the point.

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