Improved console rendering at 16:10 aspect ratio
authorChristoph Sommer <mail@christoph-sommer.de>
Sun, 16 Dec 2007 00:32:13 +0000 (00:32 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Sun, 16 Dec 2007 00:32:13 +0000 (00:32 +0000)
SVN-Revision: 5194

src/console.cpp

index 77a1fcd..28ea36c 100644 (file)
@@ -19,6 +19,7 @@
 #include <config.h>
 
 #include <iostream>
+#include <math.h>
 #include <SDL_timer.h>
 #include <SDL_keyboard.h>
 #include "console.hpp"
@@ -487,7 +488,9 @@ Console::draw(DrawingContext& context)
   context.set_alpha(alpha);
   context.draw_surface(background2.get(), Vector(SCREEN_WIDTH/2 - background->get_width()/2 - background->get_width() + backgroundOffset, height - background->get_height()), layer);
   context.draw_surface(background2.get(), Vector(SCREEN_WIDTH/2 - background->get_width()/2 + backgroundOffset, height - background->get_height()), layer);
-  context.draw_surface(background.get(), Vector(SCREEN_WIDTH/2 - background->get_width()/2, height - background->get_height()), layer);
+  for (int x = (SCREEN_WIDTH/2 - background->get_width()/2 - (static_cast<int>(ceilf((float)SCREEN_WIDTH / (float)background->get_width()) - 1) * background->get_width())); x < SCREEN_WIDTH; x+=background->get_width()) {
+    context.draw_surface(background.get(), Vector(x, height - background->get_height()), layer);
+  }
   backgroundOffset+=10;
   if (backgroundOffset > (int)background->get_width()) backgroundOffset -= (int)background->get_width();