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 8:27

>>5
Then what the fuck made you think the code you posted in >>1 was the relevant piece, as opposed to, say, the getGUI method?
Goddammit people like you piss me off.

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