Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / video / drawing_context.cpp
index b75b950..89b925c 100644 (file)
@@ -1,12 +1,10 @@
-//  $Id$
-//
 //  SuperTux
 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
 //
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
 //
 //  This program is distributed in the hope that it will be useful,
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  GNU General Public License for more details.
 //
 //  You should have received a copy of the GNU General Public License
-//  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#include <config.h>
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 #include <algorithm>
+#include <config.h>
+
+#include "video/drawing_context.hpp"
 
-#include "drawing_context.hpp"
-
-#include "drawing_request.hpp"
-#include "video_systems.hpp"
-#include "renderer.hpp"
-#include "lightmap.hpp"
-#include "surface.hpp"
-#include "main.hpp"
-#include "gameconfig.hpp"
-#include "texture.hpp"
-#include "texture_manager.hpp"
 #include "obstack/obstackpp.hpp"
+#include "supertux/gameconfig.hpp"
+#include "supertux/main.hpp"
+#include "video/drawing_request.hpp"
+#include "video/lightmap.hpp"
+#include "video/renderer.hpp"
+#include "video/surface.hpp"
+#include "video/texture.hpp"
+#include "video/texture_manager.hpp"
+#include "video/video_systems.hpp"
 
 static inline int next_po2(int val)
 {
@@ -80,8 +78,8 @@ DrawingContext::draw_surface(const Surface* surface, const Vector& position,
   request->pos = transform.apply(position);
 
   if(request->pos.x >= SCREEN_WIDTH || request->pos.y >= SCREEN_HEIGHT
-      || request->pos.x + surface->get_width() < 0
-      || request->pos.y + surface->get_height() < 0)
+     || request->pos.x + surface->get_width() < 0
+     || request->pos.y + surface->get_height() < 0)
     return;
 
   request->layer = layer;
@@ -98,14 +96,14 @@ DrawingContext::draw_surface(const Surface* surface, const Vector& position,
 
 void
 DrawingContext::draw_surface(const Surface* surface, const Vector& position,
-    int layer)
+                             int layer)
 {
   draw_surface(surface, position, 0.0f, Color(1.0f, 1.0f, 1.0f), Blend(), layer);
 }
 
 void
 DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
-    const Vector& size, const Vector& dest, int layer)
+                                  const Vector& size, const Vector& dest, int layer)
 {
   assert(surface != 0);
 
@@ -145,7 +143,7 @@ DrawingContext::draw_surface_part(const Surface* surface, const Vector& source,
 
 void
 DrawingContext::draw_text(const Font* font, const std::string& text,
-    const Vector& position, FontAlignment alignment, int layer, Color color)
+                          const Vector& position, FontAlignment alignment, int layer, Color color)
 {
   DrawingRequest* request = new(obst) DrawingRequest();
 
@@ -168,10 +166,10 @@ DrawingContext::draw_text(const Font* font, const std::string& text,
 
 void
 DrawingContext::draw_center_text(const Font* font, const std::string& text,
-    const Vector& position, int layer, Color color)
+                                 const Vector& position, int layer, Color color)
 {
   draw_text(font, text, Vector(position.x + SCREEN_WIDTH/2, position.y),
-      ALIGN_CENTER, layer, color);
+            ALIGN_CENTER, layer, color);
 }
 
 void
@@ -288,7 +286,7 @@ DrawingContext::get_light(const Vector& position, Color* color)
 
   //There is no light offscreen.
   if(request->pos.x >= SCREEN_WIDTH || request->pos.y >= SCREEN_HEIGHT
-      || request->pos.x < 0 || request->pos.y < 0){
+     || request->pos.x < 0 || request->pos.y < 0){
     *color = Color( 0, 0, 0);
     return;
   }
@@ -376,12 +374,12 @@ DrawingContext::handle_drawing_requests(DrawingRequests& requests)
             renderer->draw_gradient(request);
             break;
           case TEXT:
-            {
-              const TextRequest* textrequest = (TextRequest*) request.request_data;
-              textrequest->font->draw(renderer, textrequest->text, request.pos,
-                  textrequest->alignment, request.drawing_effect, request.color, request.alpha);
-            }
-            break;
+          {
+            const TextRequest* textrequest = (TextRequest*) request.request_data;
+            textrequest->font->draw(renderer, textrequest->text, request.pos,
+                                    textrequest->alignment, request.drawing_effect, request.color, request.alpha);
+          }
+          break;
           case FILLRECT:
             renderer->draw_filled_rect(request);
             break;
@@ -408,12 +406,12 @@ DrawingContext::handle_drawing_requests(DrawingRequests& requests)
             lightmap->draw_gradient(request);
             break;
           case TEXT:
-            {
-              const TextRequest* textrequest = (TextRequest*) request.request_data;
-              textrequest->font->draw(renderer, textrequest->text, request.pos,
-                  textrequest->alignment, request.drawing_effect, request.color, request.alpha);
-            }
-            break;
+          {
+            const TextRequest* textrequest = (TextRequest*) request.request_data;
+            textrequest->font->draw(renderer, textrequest->text, request.pos,
+                                    textrequest->alignment, request.drawing_effect, request.color, request.alpha);
+          }
+          break;
           case FILLRECT:
             lightmap->draw_filled_rect(request);
             break;
@@ -508,3 +506,4 @@ DrawingContext::take_screenshot()
   screenshot_requested = true;
 }
 
+/* EOF */