[Fix] Flickery scrolling.

This commit is contained in:
Tamir Atias 2012-04-17 20:41:55 +03:00
parent 8028320cef
commit 2c50be6573
3 changed files with 12 additions and 2 deletions

View File

@ -117,3 +117,11 @@ float Actor::GetWidth(void) {
float Actor::GetHeight(void) {
return GetAnimation()->GetCurrentFrameSprite()->GetHeight();
}
float Actor::GetMaxWidth(void) {
return GetAnimation()->GetMaxWidth();
}
float Actor::GetMaxHeight(void) {
return GetAnimation()->GetMaxHeight();
}

View File

@ -37,6 +37,8 @@ public:
float GetY(void) { return y; }
float GetWidth(void);
float GetHeight(void);
float GetMaxWidth(void);
float GetMaxHeight(void);
void SetXY(float xArg, float yArg) { x = xArg; y = yArg; }

View File

@ -60,8 +60,8 @@ void Game::Render(void) {
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
float windowCenterX = ((float)windowWidth / 2.0f) - ((float)_player->GetWidth() / 2.0f);
float windowCenterY = ((float)windowHeight / 2.0f) - ((float)_player->GetHeight() / 2.0f);
float windowCenterX = ((float)windowWidth / 2.0f) - ((float)_player->GetMaxWidth() / 2.0f);
float windowCenterY = ((float)windowHeight / 2.0f) - ((float)_player->GetMaxHeight() / 2.0f);
float xOffset = _player->GetX() - windowCenterX;
float yOffset = _player->GetY() - windowCenterY;