add code to debug collision rectangles
[supertux.git] / src / video / drawing_context.cpp
index c231e4b..19ca657 100644 (file)
@@ -23,7 +23,6 @@
 #include <iostream>
 #include <SDL_image.h>
 #include <GL/gl.h>
-#include <GL/glu.h>
 
 #include "drawing_context.hpp"
 #include "surface.hpp"
@@ -204,6 +203,28 @@ DrawingContext::draw_filled_rect(const Vector& topleft, const Vector& size,
 }
 
 void
+DrawingContext::draw_filled_rect(const Rect& rect, const Color& color,
+                                 int layer)
+{
+  DrawingRequest request;
+
+  request.type = FILLRECT;
+  request.pos = transform.apply(rect.p1);
+  request.layer = layer;
+
+  request.drawing_effect = transform.drawing_effect;
+  request.alpha = transform.alpha;                    
+
+  FillRectRequest* fillrectrequest = new FillRectRequest;
+  fillrectrequest->size = Vector(rect.get_width(), rect.get_height());
+  fillrectrequest->color = color;
+  fillrectrequest->color.alpha = color.alpha * transform.alpha;
+  request.request_data = fillrectrequest;
+
+  requests->push_back(request);
+}
+
+void
 DrawingContext::draw_surface_part(DrawingRequest& request)
 {
   SurfacePartRequest* surfacepartrequest
@@ -296,7 +317,8 @@ DrawingContext::do_drawing()
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
 
-    glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+    //glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+    glClearColor(0, 0, 0, 1);
     glClear(GL_COLOR_BUFFER_BIT);
     handle_drawing_requests(lightmap_requests);
     lightmap_requests.clear();
@@ -319,7 +341,7 @@ DrawingContext::do_drawing()
   drawing_requests.clear();
 
   if(use_lightmap) {
-    glBlendFunc(GL_DST_COLOR, GL_ZERO);
+    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
 
     glBindTexture(GL_TEXTURE_2D, lightmap->get_handle());
     glBegin(GL_QUADS);