[Supertux-Commit] r5996 - in branches/supertux-milestone2-grumbel/src/video: . gl sdl

grumbel at cummiskey.dreamhost.com grumbel at cummiskey.dreamhost.com
Mon Nov 16 08:32:53 PST 2009


Author: grumbel
Date: 2009-11-16 08:32:53 -0800 (Mon, 16 Nov 2009)
New Revision: 5996

Modified:
   branches/supertux-milestone2-grumbel/src/video/gl/gl_lightmap.cpp
   branches/supertux-milestone2-grumbel/src/video/gl/gl_lightmap.hpp
   branches/supertux-milestone2-grumbel/src/video/gl/gl_renderer.cpp
   branches/supertux-milestone2-grumbel/src/video/gl/gl_renderer.hpp
   branches/supertux-milestone2-grumbel/src/video/gl/gl_surface_data.hpp
   branches/supertux-milestone2-grumbel/src/video/gl/gl_texture.cpp
   branches/supertux-milestone2-grumbel/src/video/gl/gl_texture.hpp
   branches/supertux-milestone2-grumbel/src/video/sdl/sdl_lightmap.cpp
   branches/supertux-milestone2-grumbel/src/video/sdl/sdl_lightmap.hpp
   branches/supertux-milestone2-grumbel/src/video/sdl/sdl_renderer.cpp
   branches/supertux-milestone2-grumbel/src/video/sdl/sdl_renderer.hpp
   branches/supertux-milestone2-grumbel/src/video/sdl/sdl_surface_data.hpp
   branches/supertux-milestone2-grumbel/src/video/sdl/sdl_texture.cpp
   branches/supertux-milestone2-grumbel/src/video/sdl/sdl_texture.hpp
   branches/supertux-milestone2-grumbel/src/video/texture_manager.cpp
   branches/supertux-milestone2-grumbel/src/video/texture_manager.hpp
   branches/supertux-milestone2-grumbel/src/video/video_systems.cpp
Log:
Replaced namespace with simple class prefix

Modified: branches/supertux-milestone2-grumbel/src/video/gl/gl_lightmap.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/gl/gl_lightmap.cpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/gl/gl_lightmap.cpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -116,10 +116,6 @@
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 }
 
-} // namespace
-
-namespace GL {
-
 static inline int next_po2(int val)
 {
   int result = 1;
@@ -129,7 +125,9 @@
   return result;
 }
 
-Lightmap::Lightmap() :
+} // namespace
+
+GLLightmap::GLLightmap() :
   screen(),
   lightmap(),
   lightmap_width(),
@@ -144,14 +142,14 @@
   unsigned int width = next_po2(lightmap_width);
   unsigned int height = next_po2(lightmap_height);
 
-  lightmap = new Texture(width, height);
+  lightmap = new GLTexture(width, height);
 
   lightmap_uv_right = static_cast<float>(lightmap_width) / static_cast<float>(width);
   lightmap_uv_bottom = static_cast<float>(lightmap_height) / static_cast<float>(height);
   texture_manager->register_texture(lightmap);
 }
 
-Lightmap::~Lightmap()
+GLLightmap::~GLLightmap()
 {
   if(texture_manager){
     texture_manager->remove_texture(lightmap);
@@ -160,7 +158,7 @@
 }
 
 void
-Lightmap::start_draw(const Color &ambient_color)
+GLLightmap::start_draw(const Color &ambient_color)
 {
   glViewport(0, screen->h - lightmap_height, lightmap_width, lightmap_height);
   glMatrixMode(GL_PROJECTION);
@@ -178,7 +176,7 @@
 }
 
 void
-Lightmap::end_draw()
+GLLightmap::end_draw()
 {
   glDisable(GL_BLEND);
   glBindTexture(GL_TEXTURE_2D, lightmap->get_handle());
@@ -199,9 +197,9 @@
 }
 
 void
-Lightmap::do_draw()
+GLLightmap::do_draw()
 {
-  const Texture* texture = lightmap;
+  const GLTexture* texture = lightmap;
 
   // multiple the lightmap with the framebuffer
   glBlendFunc(GL_DST_COLOR, GL_ZERO);
@@ -230,11 +228,11 @@
 }
 
 void
-Lightmap::draw_surface(const DrawingRequest& request)
+GLLightmap::draw_surface(const DrawingRequest& request)
 {
   const Surface* surface = (const Surface*) request.request_data;
-  GL::Texture *gltexture = dynamic_cast<GL::Texture *>(surface->get_texture());
-  GL::SurfaceData *surface_data = reinterpret_cast<GL::SurfaceData *>(surface->get_surface_data());
+  GLTexture *gltexture = dynamic_cast<GLTexture *>(surface->get_texture());
+  GLSurfaceData *surface_data = reinterpret_cast<GLSurfaceData *>(surface->get_surface_data());
 
   glBindTexture(GL_TEXTURE_2D, gltexture->get_handle());
   intern_draw(request.pos.x, request.pos.y,
@@ -252,13 +250,13 @@
 }
 
 void
-Lightmap::draw_surface_part(const DrawingRequest& request)
+GLLightmap::draw_surface_part(const DrawingRequest& request)
 {
   const SurfacePartRequest* surfacepartrequest
     = (SurfacePartRequest*) request.request_data;
   const Surface *surface = surfacepartrequest->surface;
-  GL::Texture *gltexture = dynamic_cast<GL::Texture *>(surface->get_texture());
-  GL::SurfaceData *surface_data = reinterpret_cast<GL::SurfaceData *>(surface->get_surface_data());
+  GLTexture *gltexture = dynamic_cast<GLTexture *>(surface->get_texture());
+  GLSurfaceData *surface_data = reinterpret_cast<GLSurfaceData *>(surface->get_surface_data());
 
   float uv_width = surface_data->get_uv_right() - surface_data->get_uv_left();
   float uv_height = surface_data->get_uv_bottom() - surface_data->get_uv_top();
@@ -284,7 +282,7 @@
 }
 
 void
-Lightmap::draw_gradient(const DrawingRequest& request)
+GLLightmap::draw_gradient(const DrawingRequest& request)
 {
   const GradientRequest* gradientrequest 
     = (GradientRequest*) request.request_data;
@@ -321,7 +319,7 @@
 }
 
 void
-Lightmap::draw_filled_rect(const DrawingRequest& request)
+GLLightmap::draw_filled_rect(const DrawingRequest& request)
 {
   const FillRectRequest* fillrectrequest
     = (FillRectRequest*) request.request_data;
@@ -352,7 +350,7 @@
 }
 
 void
-Lightmap::get_light(const DrawingRequest& request) const
+GLLightmap::get_light(const DrawingRequest& request) const
 {
   const GetLightRequest* getlightrequest 
     = (GetLightRequest*) request.request_data;
@@ -367,6 +365,4 @@
   *(getlightrequest->color_ptr) = Color( pixels[0], pixels[1], pixels[2]);
 }
 
-} // namespace GL
-
 /* EOF */

Modified: branches/supertux-milestone2-grumbel/src/video/gl/gl_lightmap.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/gl/gl_lightmap.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/gl/gl_lightmap.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -21,15 +21,13 @@
 
 struct DrawingRequest;
 
-namespace GL {
-
 class Texture;
 
-class Lightmap : public ::Lightmap
+class GLLightmap : public Lightmap
 {
 public:
-  Lightmap();
-  ~Lightmap();
+  GLLightmap();
+  ~GLLightmap();
 
   void start_draw(const Color &ambient_color);
   void end_draw();
@@ -45,19 +43,17 @@
   static const int LIGHTMAP_DIV = 5;
 
   SDL_Surface* screen;
-  Texture* lightmap;
+  GLTexture* lightmap;
   int lightmap_width;
   int lightmap_height;
   float lightmap_uv_right;
   float lightmap_uv_bottom;
 
 private:
-  Lightmap(const Lightmap&);
-  Lightmap& operator=(const Lightmap&);
+  GLLightmap(const GLLightmap&);
+  GLLightmap& operator=(const GLLightmap&);
 };
 
-} // namespace GL
-
 #endif
 
 /* EOF */

Modified: branches/supertux-milestone2-grumbel/src/video/gl/gl_renderer.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/gl/gl_renderer.cpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/gl/gl_renderer.cpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -109,15 +109,13 @@
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 }
 
-}
+} // namespace
 
-namespace GL {
-
-Renderer::Renderer()
+GLRenderer::GLRenderer()
   : desktop_width(-1),
     desktop_height(-1)
 {
-  ::Renderer::instance_ = this;
+  Renderer::instance_ = this;
 
 #if SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION > 2 || (SDL_MINOR_VERSION == 2 && SDL_PATCHLEVEL >= 10)
   // unfortunately only newer SDLs have these infos.
@@ -193,16 +191,16 @@
     texture_manager->reload_textures();
 }
 
-Renderer::~Renderer()
+GLRenderer::~GLRenderer()
 {
 }
 
 void
-Renderer::draw_surface(const DrawingRequest& request)
+GLRenderer::draw_surface(const DrawingRequest& request)
 {
   const Surface* surface = (const Surface*) request.request_data;
-  GL::Texture *gltexture = dynamic_cast<GL::Texture *>(surface->get_texture());
-  GL::SurfaceData *surface_data = reinterpret_cast<GL::SurfaceData *>(surface->get_surface_data());
+  GLTexture *gltexture = dynamic_cast<GLTexture *>(surface->get_texture());
+  GLSurfaceData *surface_data = reinterpret_cast<GLSurfaceData *>(surface->get_surface_data());
 
   glBindTexture(GL_TEXTURE_2D, gltexture->get_handle());
   intern_draw(request.pos.x, request.pos.y,
@@ -220,13 +218,13 @@
 }
 
 void
-Renderer::draw_surface_part(const DrawingRequest& request)
+GLRenderer::draw_surface_part(const DrawingRequest& request)
 {
   const SurfacePartRequest* surfacepartrequest
     = (SurfacePartRequest*) request.request_data;
   const Surface *surface = surfacepartrequest->surface;
-  GL::Texture *gltexture = dynamic_cast<GL::Texture *>(surface->get_texture());
-  GL::SurfaceData *surface_data = reinterpret_cast<GL::SurfaceData *>(surface->get_surface_data());
+  GLTexture *gltexture = dynamic_cast<GLTexture *>(surface->get_texture());
+  GLSurfaceData *surface_data = reinterpret_cast<GLSurfaceData *>(surface->get_surface_data());
 
   float uv_width = surface_data->get_uv_right() - surface_data->get_uv_left();
   float uv_height = surface_data->get_uv_bottom() - surface_data->get_uv_top();
@@ -252,7 +250,7 @@
 }
 
 void
-Renderer::draw_gradient(const DrawingRequest& request)
+GLRenderer::draw_gradient(const DrawingRequest& request)
 {
   const GradientRequest* gradientrequest 
     = (GradientRequest*) request.request_data;
@@ -289,7 +287,7 @@
 }
 
 void
-Renderer::draw_filled_rect(const DrawingRequest& request)
+GLRenderer::draw_filled_rect(const DrawingRequest& request)
 {
   const FillRectRequest* fillrectrequest
     = (FillRectRequest*) request.request_data;
@@ -369,7 +367,7 @@
 }
 
 void
-Renderer::draw_inverse_ellipse(const DrawingRequest& request)
+GLRenderer::draw_inverse_ellipse(const DrawingRequest& request)
 {
   const InverseEllipseRequest* ellipse = (InverseEllipseRequest*)request.request_data;
 
@@ -449,7 +447,7 @@
 }
 
 void 
-Renderer::do_take_screenshot()
+GLRenderer::do_take_screenshot()
 {
   // [Christoph] TODO: Yes, this method also takes care of the actual disk I/O. Split it?
 
@@ -517,14 +515,14 @@
 }
 
 void
-Renderer::flip()
+GLRenderer::flip()
 {
   assert_gl("drawing");
   SDL_GL_SwapBuffers();
 }
 
 void
-Renderer::resize(int w, int h)
+GLRenderer::resize(int w, int h)
 {
   // This causes the screen to go black, which is annoying, but seems
   // unavoidable with SDL at the moment
@@ -537,7 +535,7 @@
 }
 
 void
-Renderer::apply_config()
+GLRenderer::apply_config()
 {    
   if (1)
   {
@@ -659,6 +657,4 @@
   check_gl_error("Setting up view matrices");
 }
 
-} // namespace GL
-
 /* EOF */

Modified: branches/supertux-milestone2-grumbel/src/video/gl/gl_renderer.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/gl/gl_renderer.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/gl/gl_renderer.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -19,16 +19,15 @@
 
 #include "video/renderer.hpp"
 
-namespace GL {
-class Renderer : public ::Renderer
+class GLRenderer : public Renderer
 {
 private:
   int desktop_width;
   int desktop_height;
 
 public:
-  Renderer();
-  ~Renderer();
+  GLRenderer();
+  ~GLRenderer();
 
   void draw_surface(const DrawingRequest& request);
   void draw_surface_part(const DrawingRequest& request);
@@ -41,7 +40,6 @@
   void resize(int w, int h);
   void apply_config();
 };
-}
 
 #endif
 

Modified: branches/supertux-milestone2-grumbel/src/video/gl/gl_surface_data.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/gl/gl_surface_data.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/gl/gl_surface_data.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -19,8 +19,7 @@
 
 #include "video/surface.hpp"
 
-namespace GL {
-class SurfaceData
+class GLSurfaceData
 {
 private:
   const Surface &surface;
@@ -30,7 +29,7 @@
   float uv_bottom;
 
 public:
-  SurfaceData(const Surface &surface) :
+  GLSurfaceData(const Surface &surface) :
     surface(surface),
     uv_left((float) surface.get_x() / surface.get_texture()->get_texture_width()),
     uv_top((float) surface.get_y() / surface.get_texture()->get_texture_height()),
@@ -59,7 +58,6 @@
     return uv_bottom;
   }
 };
-}
 
 #endif
 

Modified: branches/supertux-milestone2-grumbel/src/video/gl/gl_texture.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/gl/gl_texture.cpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/gl/gl_texture.cpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -17,8 +17,8 @@
 #include "supertux/gameconfig.hpp"
 #include "video/gl/gl_texture.hpp"
 
-namespace
-{
+namespace {
+
 inline bool is_power_of_2(int v)
 {
   return (v & (v-1)) == 0;
@@ -31,10 +31,10 @@
     result *= 2;
   return result;
 }
-}
 
-namespace GL {
-Texture::Texture(unsigned int width, unsigned int height)
+} // namespace
+
+GLTexture::GLTexture(unsigned int width, unsigned int height)
 {
   assert(is_power_of_2(width));
   assert(is_power_of_2(height));
@@ -59,7 +59,7 @@
   }
 }
 
-Texture::Texture(SDL_Surface* image)
+GLTexture::GLTexture(SDL_Surface* image)
 {
   texture_width = next_power_of_two(image->w);
   texture_height = next_power_of_two(image->h);
@@ -128,13 +128,13 @@
   SDL_FreeSurface(convert);
 }
 
-Texture::~Texture()
+GLTexture::~GLTexture()
 {
   glDeleteTextures(1, &handle);
 }
 
 void
-Texture::set_texture_params()
+GLTexture::set_texture_params()
 {
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -146,6 +146,5 @@
 
   assert_gl("set texture params");
 }
-}
 
 /* EOF */

Modified: branches/supertux-milestone2-grumbel/src/video/gl/gl_texture.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/gl/gl_texture.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/gl/gl_texture.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -24,8 +24,7 @@
  * and height and provides convenience functions for uploading SDL_Surfaces
  * into the texture
  */
-namespace GL {
-class Texture : public ::Texture
+class GLTexture : public Texture
 {
 protected:
   GLuint handle;
@@ -35,9 +34,9 @@
   unsigned int image_height;
 
 public:
-  Texture(unsigned int width, unsigned int height);
-  Texture(SDL_Surface* image);
-  ~Texture();
+  GLTexture(unsigned int width, unsigned int height);
+  GLTexture(SDL_Surface* image);
+  ~GLTexture();
 
   const GLuint &get_handle() const {
     return handle;
@@ -80,7 +79,6 @@
 private:
   void set_texture_params();
 };
-}
 
 #endif
 

Modified: branches/supertux-milestone2-grumbel/src/video/sdl/sdl_lightmap.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/sdl/sdl_lightmap.cpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/sdl/sdl_lightmap.cpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -20,8 +20,7 @@
 #include "video/sdl/sdl_surface_data.hpp"
 #include "video/sdl/sdl_texture.hpp"
 
-namespace SDL {
-Lightmap::Lightmap()
+SDLLightmap::SDLLightmap()
 {
   screen = SDL_GetVideoSurface();
 
@@ -54,7 +53,7 @@
   blue_channel = (Uint8 *)malloc(width * height * sizeof(Uint8));
 }
 
-Lightmap::~Lightmap()
+SDLLightmap::~SDLLightmap()
 {
   free(red_channel);
   free(green_channel);
@@ -62,7 +61,7 @@
 }
 
 void
-Lightmap::start_draw(const Color &ambient_color)
+SDLLightmap::start_draw(const Color &ambient_color)
 {
   memset(red_channel, (Uint8) (ambient_color.red * 255), width * height * sizeof(Uint8));
   memset(green_channel, (Uint8) (ambient_color.green * 255), width * height * sizeof(Uint8));
@@ -70,26 +69,27 @@
 }
 
 void
-Lightmap::end_draw()
+SDLLightmap::end_draw()
 {
 }
 
 //#define BILINEAR
 
 #ifdef BILINEAR
-namespace
-{
+namespace {
+
 void merge(Uint8 color[3], Uint8 color0[3], Uint8 color1[3], int rem, int total)
 {
   color[0] = (color0[0] * (total - rem) + color1[0] * rem) / total;
   color[1] = (color0[1] * (total - rem) + color1[1] * rem) / total;
   color[2] = (color0[2] * (total - rem) + color1[2] * rem) / total;
 }
-}
+
+} // namespace
 #endif
 
 void
-Lightmap::do_draw()
+SDLLightmap::do_draw()
 {
   // FIXME: This is really slow
   if(LIGHTMAP_DIV == 1)
@@ -283,7 +283,8 @@
   }
 }
 
-void Lightmap::light_blit(SDL_Surface *src, SDL_Rect *src_rect, int dstx, int dsty)
+void
+SDLLightmap::light_blit(SDL_Surface *src, SDL_Rect *src_rect, int dstx, int dsty)
 {
   dstx /= LIGHTMAP_DIV;
   dsty /= LIGHTMAP_DIV;
@@ -432,7 +433,7 @@
   }*/
 
 void
-Lightmap::draw_surface(const DrawingRequest& request)
+SDLLightmap::draw_surface(const DrawingRequest& request)
 {
   if((request.color.red == 0.0 && request.color.green == 0.0 && request.color.blue == 0.0) || request.color.alpha == 0.0 || request.alpha == 0.0)
   {
@@ -441,8 +442,8 @@
   //FIXME: support parameters request.alpha, request.angle, request.blend
  
   const Surface* surface = (const Surface*) request.request_data;
-  SDL::Texture *sdltexture = dynamic_cast<SDL::Texture *>(surface->get_texture());
-  SDL::SurfaceData *surface_data = reinterpret_cast<SDL::SurfaceData *>(surface->get_surface_data());
+  SDLTexture *sdltexture = dynamic_cast<SDLTexture *>(surface->get_texture());
+  SDLSurfaceData *surface_data = reinterpret_cast<SDLSurfaceData *>(surface->get_surface_data());
 
   DrawingEffect effect = request.drawing_effect;
   if (surface->get_flipx()) effect = HORIZONTAL_FLIP;
@@ -462,13 +463,13 @@
 }
 
 void
-Lightmap::draw_surface_part(const DrawingRequest& request)
+SDLLightmap::draw_surface_part(const DrawingRequest& request)
 {
   const SurfacePartRequest* surfacepartrequest
     = (SurfacePartRequest*) request.request_data;
 
   const Surface* surface = surfacepartrequest->surface;
-  SDL::Texture *sdltexture = dynamic_cast<SDL::Texture *>(surface->get_texture());
+  SDLTexture *sdltexture = dynamic_cast<SDLTexture *>(surface->get_texture());
 
   DrawingEffect effect = request.drawing_effect;
   if (surface->get_flipx()) effect = HORIZONTAL_FLIP;
@@ -510,7 +511,7 @@
 }
 
 void
-Lightmap::draw_gradient(const DrawingRequest& request)
+SDLLightmap::draw_gradient(const DrawingRequest& request)
 {
   const GradientRequest* gradientrequest 
     = (GradientRequest*) request.request_data;
@@ -545,7 +546,7 @@
 }
 
 void
-Lightmap::draw_filled_rect(const DrawingRequest& request)
+SDLLightmap::draw_filled_rect(const DrawingRequest& request)
 {
   const FillRectRequest* fillrectrequest
     = (FillRectRequest*) request.request_data;
@@ -584,7 +585,7 @@
 }
 
 void
-Lightmap::get_light(const DrawingRequest& request) const
+SDLLightmap::get_light(const DrawingRequest& request) const
 {
   const GetLightRequest* getlightrequest 
     = (GetLightRequest*) request.request_data;
@@ -594,6 +595,5 @@
   int loc = y * width + x;
   *(getlightrequest->color_ptr) = Color(((float)red_channel[loc])/255, ((float)green_channel[loc])/255, ((float)blue_channel[loc])/255);
 }
-}
 
 /* EOF */

Modified: branches/supertux-milestone2-grumbel/src/video/sdl/sdl_lightmap.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/sdl/sdl_lightmap.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/sdl/sdl_lightmap.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -22,12 +22,11 @@
 class Color;
 struct DrawingRequest;
 
-namespace SDL {
-class Lightmap : public ::Lightmap
+class SDLLightmap : public Lightmap
 {
 public:
-  Lightmap();
-  ~Lightmap();
+  SDLLightmap();
+  ~SDLLightmap();
 
   void start_draw(const Color &ambient_color);
   void end_draw();
@@ -50,7 +49,6 @@
 
   void light_blit(SDL_Surface *src, SDL_Rect *src_rect, int dstx, int dsty);
 };
-}
 
 #endif
 

Modified: branches/supertux-milestone2-grumbel/src/video/sdl/sdl_renderer.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/sdl/sdl_renderer.cpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/sdl/sdl_renderer.cpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -24,8 +24,8 @@
 #include "video/sdl/sdl_surface_data.hpp"
 #include "video/sdl/sdl_texture.hpp"
 
-namespace
-{
+namespace {
+
 SDL_Surface *apply_alpha(SDL_Surface *src, float alpha_factor)
 {
   // FIXME: This is really slow
@@ -105,10 +105,10 @@
   }
   return dst;
 }
-}
 
-namespace SDL {
-Renderer::Renderer()
+} // namespace
+
+SDLRenderer::SDLRenderer()
 {
   ::Renderer::instance_ = this;
 
@@ -157,17 +157,17 @@
     texture_manager = new TextureManager();
 }
 
-Renderer::~Renderer()
+SDLRenderer::~SDLRenderer()
 {
 }
 
 void
-Renderer::draw_surface(const DrawingRequest& request)
+SDLRenderer::draw_surface(const DrawingRequest& request)
 {
   //FIXME: support parameters request.alpha, request.angle, request.blend
   const Surface* surface = (const Surface*) request.request_data;
-  SDL::Texture *sdltexture = dynamic_cast<SDL::Texture *>(surface->get_texture());
-  SDL::SurfaceData *surface_data = reinterpret_cast<SDL::SurfaceData *>(surface->get_surface_data());
+  SDLTexture *sdltexture = dynamic_cast<SDLTexture *>(surface->get_texture());
+  SDLSurfaceData *surface_data = reinterpret_cast<SDLSurfaceData *>(surface->get_surface_data());
 
   DrawingEffect effect = request.drawing_effect;
   if (surface->get_flipx()) effect = HORIZONTAL_FLIP;
@@ -229,13 +229,13 @@
 }
 
 void
-Renderer::draw_surface_part(const DrawingRequest& request)
+SDLRenderer::draw_surface_part(const DrawingRequest& request)
 {
   const SurfacePartRequest* surfacepartrequest
     = (SurfacePartRequest*) request.request_data;
 
   const Surface* surface = surfacepartrequest->surface;
-  SDL::Texture *sdltexture = dynamic_cast<SDL::Texture *>(surface->get_texture());
+  SDLTexture *sdltexture = dynamic_cast<SDLTexture*>(surface->get_texture());
 
   DrawingEffect effect = request.drawing_effect;
   if (surface->get_flipx()) effect = HORIZONTAL_FLIP;
@@ -320,7 +320,7 @@
 }
 
 void
-Renderer::draw_gradient(const DrawingRequest& request)
+SDLRenderer::draw_gradient(const DrawingRequest& request)
 {
   const GradientRequest* gradientrequest 
     = (GradientRequest*) request.request_data;
@@ -355,7 +355,7 @@
 }
 
 void
-Renderer::draw_filled_rect(const DrawingRequest& request)
+SDLRenderer::draw_filled_rect(const DrawingRequest& request)
 {
   const FillRectRequest* fillrectrequest
     = (FillRectRequest*) request.request_data;
@@ -383,12 +383,12 @@
 }
 
 void
-Renderer::draw_inverse_ellipse(const DrawingRequest&)
+SDLRenderer::draw_inverse_ellipse(const DrawingRequest&)
 {
 }
 
 void 
-Renderer::do_take_screenshot()
+SDLRenderer::do_take_screenshot()
 {
   // [Christoph] TODO: Yes, this method also takes care of the actual disk I/O. Split it?
 
@@ -417,16 +417,15 @@
 }
 
 void
-Renderer::flip()
+SDLRenderer::flip()
 {
   SDL_Flip(screen);
 }
 
 void
-Renderer::resize(int, int)
+SDLRenderer::resize(int, int)
 {
     
 }
-}
 
 /* EOF */

Modified: branches/supertux-milestone2-grumbel/src/video/sdl/sdl_renderer.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/sdl/sdl_renderer.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/sdl/sdl_renderer.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -21,12 +21,11 @@
 
 #include "video/renderer.hpp"
 
-namespace SDL {
-class Renderer : public ::Renderer
+class SDLRenderer : public Renderer
 {
 public:
-  Renderer();
-  ~Renderer();
+  SDLRenderer();
+  ~SDLRenderer();
 
   void draw_surface(const DrawingRequest& request);
   void draw_surface_part(const DrawingRequest& request);
@@ -38,11 +37,11 @@
   void flip();
   void resize(int w, int h);
   void apply_config() {}
+
 private:
   SDL_Surface *screen;
   int numerator, denominator;
 };
-}
 
 #endif
 

Modified: branches/supertux-milestone2-grumbel/src/video/sdl/sdl_surface_data.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/sdl/sdl_surface_data.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/sdl/sdl_surface_data.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -24,15 +24,14 @@
 #include "video/surface.hpp"
 #include "video/texture.hpp"
 
-namespace SDL {
-class SurfaceData
+class SDLSurfaceData
 {
 private:
   const Surface &surface;
   SDL_Rect src_rects[NUM_EFFECTS];
 
 public:
-  SurfaceData(const Surface &surface) :
+  SDLSurfaceData(const Surface &surface) :
     surface(surface)
   {
     int numerator   = 1;
@@ -76,7 +75,6 @@
     return src_rects + effect;
   }
 };
-}
 
 #endif
 

Modified: branches/supertux-milestone2-grumbel/src/video/sdl/sdl_texture.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/sdl/sdl_texture.cpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/sdl/sdl_texture.cpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -25,8 +25,7 @@
 
 #include <SDL.h>
 
-namespace
-{
+namespace {
 #define BILINEAR
 
 #ifdef NAIVE
@@ -86,7 +85,7 @@
     }
     return dst;
   }
-}
+} // namespace
 #endif
 
 #ifdef BILINEAR
@@ -601,8 +600,7 @@
 }
 }
 
-namespace SDL {
-Texture::Texture(SDL_Surface* image)
+SDLTexture::SDLTexture(SDL_Surface* image)
 {
   texture = optimize(image);
   //width = texture->w;
@@ -626,12 +624,13 @@
   cache[NO_EFFECT][Color::WHITE] = scale(texture, numerator, denominator);
 }
 
-Texture::~Texture()
+SDLTexture::~SDLTexture()
 {
   SDL_FreeSurface(texture);
 }
 
-SDL_Surface *Texture::get_transform(const Color &color, DrawingEffect effect)
+SDL_Surface*
+SDLTexture::get_transform(const Color &color, DrawingEffect effect)
 {
   if(cache[NO_EFFECT][color] == 0) {
     assert(cache[NO_EFFECT][Color::WHITE]);
@@ -654,6 +653,5 @@
   }
   return cache[effect][color];
 }
-}
 
 /* EOF */

Modified: branches/supertux-milestone2-grumbel/src/video/sdl/sdl_texture.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/sdl/sdl_texture.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/sdl/sdl_texture.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -25,8 +25,7 @@
 #include "video/color.hpp"
 #include "video/texture.hpp"
 
-namespace SDL {
-class Texture : public ::Texture
+class SDLTexture : public Texture
 {
 protected:
   SDL_Surface *texture;
@@ -82,8 +81,8 @@
   ColorCache cache[NUM_EFFECTS];
 
 public:
-  Texture(SDL_Surface* sdlsurface);
-  virtual ~Texture();
+  SDLTexture(SDL_Surface* sdlsurface);
+  virtual ~SDLTexture();
 
   SDL_Surface *get_transform(const Color &color, DrawingEffect effect);
 
@@ -132,7 +131,6 @@
     return height;
     }*/
 };
-}
 
 #endif
 

Modified: branches/supertux-milestone2-grumbel/src/video/texture_manager.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/texture_manager.cpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/texture_manager.cpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -69,13 +69,13 @@
 
 #ifdef HAVE_OPENGL
 void
-TextureManager::register_texture(GL::Texture* texture)
+TextureManager::register_texture(GLTexture* texture)
 {
   textures.insert(texture);
 }
 
 void
-TextureManager::remove_texture(GL::Texture* texture)
+TextureManager::remove_texture(GLTexture* texture)
 {
   textures.erase(texture);
 }
@@ -168,12 +168,12 @@
   }
   for(ImageTextures::iterator i = image_textures.begin();
       i != image_textures.end(); ++i) {
-    save_texture(dynamic_cast<GL::Texture *>(i->second));
+    save_texture(dynamic_cast<GLTexture *>(i->second));
   }
 }
 
 void
-TextureManager::save_texture(GL::Texture* texture)
+TextureManager::save_texture(GLTexture* texture)
 {
   SavedTexture saved_texture;
   saved_texture.texture = texture;

Modified: branches/supertux-milestone2-grumbel/src/video/texture_manager.hpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/texture_manager.hpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/texture_manager.hpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -27,7 +27,7 @@
 #include "video/glutil.hpp"
 
 class Texture;
-namespace GL { class Texture; }
+class GLTexture;
 
 class TextureManager
 {
@@ -38,8 +38,8 @@
   Texture* get(const std::string& filename);
 
 #ifdef HAVE_OPENGL
-  void register_texture(GL::Texture* texture);
-  void remove_texture(GL::Texture* texture);
+  void register_texture(GLTexture* texture);
+  void remove_texture(GLTexture* texture);
 
   void save_textures();
   void reload_textures();
@@ -55,12 +55,12 @@
   Texture* create_image_texture(const std::string& filename);
 
 #ifdef HAVE_OPENGL
-  typedef std::set<GL::Texture*> Textures;
+  typedef std::set<GLTexture*> Textures;
   Textures textures;
 
   struct SavedTexture
   {
-    GL::Texture* texture;
+    GLTexture* texture;
     GLint width;
     GLint height;
     char* pixels;
@@ -73,7 +73,7 @@
   };
   std::vector<SavedTexture> saved_textures;
 
-  void save_texture(GL::Texture* texture);
+  void save_texture(GLTexture* texture);
 #endif
 };
 

Modified: branches/supertux-milestone2-grumbel/src/video/video_systems.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/src/video/video_systems.cpp	2009-11-16 16:03:10 UTC (rev 5995)
+++ branches/supertux-milestone2-grumbel/src/video/video_systems.cpp	2009-11-16 16:32:53 UTC (rev 5996)
@@ -37,27 +37,27 @@
     case AUTO_VIDEO:
 #ifdef HAVE_OPENGL
       log_info << "new GL renderer\n";
-      return new GL::Renderer();
+      return new GLRenderer();
 #else
       log_warning << "new SDL renderer\n";
-      return new SDL::Renderer();
+      return new SDLRenderer();
 #endif
 #ifdef HAVE_OPENGL
     case OPENGL:
       log_info << "new GL renderer\n";
-      return new GL::Renderer();
+      return new GLRenderer();
 #endif
     case PURE_SDL:
       log_warning << "new SDL renderer\n";
-      return new SDL::Renderer();
+      return new SDLRenderer();
     default:
       assert(0 && "invalid video system in config");
 #ifdef HAVE_OPENGL
       log_info << "new GL renderer\n";
-      return new GL::Renderer();
+      return new GLRenderer();
 #else
       log_warning << "new SDL renderer\n";
-      return new SDL::Renderer();
+      return new SDLRenderer();
 #endif
   }
 }
@@ -68,22 +68,22 @@
   {
     case AUTO_VIDEO:
 #ifdef HAVE_OPENGL
-      return new GL::Lightmap();
+      return new GLLightmap();
 #else
-      return new SDL::Lightmap();
+      return new SDLLightmap();
 #endif
 #ifdef HAVE_OPENGL
     case OPENGL:
-      return new GL::Lightmap();
+      return new GLLightmap();
 #endif
     case PURE_SDL:
-      return new SDL::Lightmap();
+      return new SDLLightmap();
     default:
       assert(0 && "invalid video system in config");
 #ifdef HAVE_OPENGL
-      return new GL::Lightmap();
+      return new GLLightmap();
 #else
-      return new SDL::Lightmap();
+      return new SDLLightmap();
 #endif
   }
 }
@@ -94,22 +94,22 @@
   {
     case AUTO_VIDEO:
 #ifdef HAVE_OPENGL
-      return new GL::Texture(image);
+      return new GLTexture(image);
 #else
-      return new SDL::Texture(image);
+      return new SDLTexture(image);
 #endif
 #ifdef HAVE_OPENGL
     case OPENGL:
-      return new GL::Texture(image);
+      return new GLTexture(image);
 #endif
     case PURE_SDL:
-      return new SDL::Texture(image);
+      return new SDLTexture(image);
     default:
       assert(0 && "invalid video system in config");
 #ifdef HAVE_OPENGL
-      return new GL::Texture(image);
+      return new GLTexture(image);
 #else
-      return new SDL::Texture(image);
+      return new SDLTexture(image);
 #endif
   }
 }
@@ -120,22 +120,22 @@
   {
     case AUTO_VIDEO:
 #ifdef HAVE_OPENGL
-      return new GL::SurfaceData(surface);
+      return new GLSurfaceData(surface);
 #else
-      return new SDL::SurfaceData(surface);
+      return new SDLSurfaceData(surface);
 #endif
 #ifdef HAVE_OPENGL
     case OPENGL:
-      return new GL::SurfaceData(surface);
+      return new GLSurfaceData(surface);
 #endif
     case PURE_SDL:
-      return new SDL::SurfaceData(surface);
+      return new SDLSurfaceData(surface);
     default:
       assert(0 && "invalid video system in config");
 #ifdef HAVE_OPENGL
-      return new GL::SurfaceData(surface);
+      return new GLSurfaceData(surface);
 #else
-      return new SDL::SurfaceData(surface);
+      return new SDLSurfaceData(surface);
 #endif
   }
 }



More information about the Supertux-Commit mailing list