[Fix] Flickery scrolling.
This commit is contained in:
parent
8028320cef
commit
2c50be6573
@ -117,3 +117,11 @@ float Actor::GetWidth(void) {
|
|||||||
float Actor::GetHeight(void) {
|
float Actor::GetHeight(void) {
|
||||||
return GetAnimation()->GetCurrentFrameSprite()->GetHeight();
|
return GetAnimation()->GetCurrentFrameSprite()->GetHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Actor::GetMaxWidth(void) {
|
||||||
|
return GetAnimation()->GetMaxWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
float Actor::GetMaxHeight(void) {
|
||||||
|
return GetAnimation()->GetMaxHeight();
|
||||||
|
}
|
||||||
|
@ -37,6 +37,8 @@ public:
|
|||||||
float GetY(void) { return y; }
|
float GetY(void) { return y; }
|
||||||
float GetWidth(void);
|
float GetWidth(void);
|
||||||
float GetHeight(void);
|
float GetHeight(void);
|
||||||
|
float GetMaxWidth(void);
|
||||||
|
float GetMaxHeight(void);
|
||||||
|
|
||||||
void SetXY(float xArg, float yArg) { x = xArg; y = yArg; }
|
void SetXY(float xArg, float yArg) { x = xArg; y = yArg; }
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ void Game::Render(void) {
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
float windowCenterX = ((float)windowWidth / 2.0f) - ((float)_player->GetWidth() / 2.0f);
|
float windowCenterX = ((float)windowWidth / 2.0f) - ((float)_player->GetMaxWidth() / 2.0f);
|
||||||
float windowCenterY = ((float)windowHeight / 2.0f) - ((float)_player->GetHeight() / 2.0f);
|
float windowCenterY = ((float)windowHeight / 2.0f) - ((float)_player->GetMaxHeight() / 2.0f);
|
||||||
|
|
||||||
float xOffset = _player->GetX() - windowCenterX;
|
float xOffset = _player->GetX() - windowCenterX;
|
||||||
float yOffset = _player->GetY() - windowCenterY;
|
float yOffset = _player->GetY() - windowCenterY;
|
||||||
|
Loading…
Reference in New Issue
Block a user