[Fix] Fixed the orthorgraphic view bug Tamir introduced.

This commit is contained in:
Rtch90 2012-04-15 13:42:10 +01:00
parent e6f773dd68
commit d57835d806

View File

@ -31,6 +31,7 @@ void Destroy(void) {
static void ResizeWindow(Game& game, int w, int h) { static void ResizeWindow(Game& game, int w, int h) {
SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_RESIZABLE); SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_RESIZABLE);
game.OnResize(w, h); game.OnResize(w, h);
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
} }
@ -68,7 +69,7 @@ int main(int argc, char** argv) {
} }
if(TTF_Init()) { if(TTF_Init()) {
Debug::logger->message("SDL_ttf initialized.\n"); Debug::logger->message("SDL_ttf initialized.\n");
} }
info = SDL_GetVideoInfo(); info = SDL_GetVideoInfo();
@ -93,6 +94,11 @@ int main(int argc, char** argv) {
Uint32 timeStart = SDL_GetTicks(); Uint32 timeStart = SDL_GetTicks();
float dt = 1.0f / 60.0f; float dt = 1.0f / 60.0f;
// We need to give windowWidth and windowHeight an initial value
// Otherwise it is just garbage, and the orthorgraphic view
// screws up for me. -- Allanis.
game.OnResize(windowWidth, windowHeight);
bool isRunning = true; bool isRunning = true;
while(isRunning) { while(isRunning) {
@ -114,8 +120,8 @@ int main(int argc, char** argv) {
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
Uint32 timeEnd = SDL_GetTicks(); Uint32 timeEnd = SDL_GetTicks();
dt = (float)(timeEnd - timeStart) / 1000.0f; dt = (float)(timeEnd - timeStart) / 1000.0f;
timeStart = timeEnd; timeStart = timeEnd;
} }
game.Shutdown(); game.Shutdown();