Do you know about constness ? Stuff like getters and such which don't modify the class should be defined as const. Also passing a std::string by value isn't cheap it has to allocate new memory and copy the string, passing by const reference would be ideal.
1 2 3 4 5 6 7 8 9 10 11 12
class Player
{
// ...
int getHealth() const { return health; }
// ...
};
Animation::Init( const std::string& filename /* ... */ ) { }
Also use a third party website, like pastebin, to post that much code so you don't inflate the thread like it already is ...
void Animation::UpdateAnim()
{
if(Pause == false)
{
// Every cycle add 1 to the delay
Delay++;
// If the delay hit the point where it needs to change the frame...
if(Delay == FrameChange)
{
// Reset the delay
Delay == 0;
Frame++; // Go to the next frame
// If the frame is at the last, we reset the animation.
if(Frame > Graphic->w/W - 1)
{
Frame = 0;
}
}
}
// If the animation is paused...
else
{
// If the frame is paused, as soon as it's unpaused we don't want
// it to immediately switch frames
Delay = 0;
}
}
There is something wrong specifically in here. It might actually be responsible for the issue you are currently suffering. It is... well, painfully obvious.
Check your debugger site documentation, search through the threads here as I remember being told a few things about a debugger here. Google, when you have questions, before asking, Google for results to get an idea.
Well depends on what debugger you are using, visual studio's is probably the easiest as you don't need to really look at any assembly. There's also GDB though I prefer to have a gui as it makes it easier to scroll through assembly (might just be a feature gdb lacks or i don't know of, but it just prints chunks at a time).
Go on your compiler's website, and look for documentation of their debugger features.
Plenty of debuggers that don't come with compilers.