pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r4043 - in trunk/pingus/src: editor engine/display engine/d


From: grumbel at BerliOS
Subject: [Pingus-CVS] r4043 - in trunk/pingus/src: editor engine/display engine/display/opengl engine/gui engine/screen pingus pingus/actions pingus/components pingus/particles pingus/worldmap pingus/worldobjs
Date: Fri, 6 Nov 2009 00:10:52 +0100

Author: grumbel
Date: 2009-11-06 00:10:49 +0100 (Fri, 06 Nov 2009)
New Revision: 4043

Added:
   trunk/pingus/src/engine/display/sprite.cpp
   trunk/pingus/src/engine/display/sprite.hpp
   trunk/pingus/src/engine/display/sprite_description.hpp
   trunk/pingus/src/engine/display/sprite_impl.cpp
   trunk/pingus/src/engine/display/sprite_impl.hpp
   trunk/pingus/src/engine/display/surface.cpp
   trunk/pingus/src/engine/display/surface.hpp
Removed:
   trunk/pingus/src/pingus/sprite.cpp
   trunk/pingus/src/pingus/sprite.hpp
   trunk/pingus/src/pingus/sprite_description.hpp
   trunk/pingus/src/pingus/sprite_impl.cpp
   trunk/pingus/src/pingus/sprite_impl.hpp
   trunk/pingus/src/pingus/surface.cpp
   trunk/pingus/src/pingus/surface.hpp
Modified:
   trunk/pingus/src/editor/combobox.hpp
   trunk/pingus/src/editor/file_list.hpp
   trunk/pingus/src/editor/level_objs.hpp
   trunk/pingus/src/editor/object_selector.cpp
   trunk/pingus/src/editor/object_selector_list.hpp
   trunk/pingus/src/editor/panel.cpp
   trunk/pingus/src/editor/panel.hpp
   trunk/pingus/src/engine/display/drawing_context.cpp
   trunk/pingus/src/engine/display/framebuffer_surface.hpp
   trunk/pingus/src/engine/display/opengl/opengl_framebuffer.cpp
   trunk/pingus/src/engine/display/sdl_framebuffer.cpp
   trunk/pingus/src/engine/gui/surface_button.hpp
   trunk/pingus/src/engine/screen/screen_manager.hpp
   trunk/pingus/src/pingus/actions/angel.hpp
   trunk/pingus/src/pingus/actions/digger.hpp
   trunk/pingus/src/pingus/actions/floater.hpp
   trunk/pingus/src/pingus/actions/smashed.cpp
   trunk/pingus/src/pingus/actions/smashed.hpp
   trunk/pingus/src/pingus/actions/splashed.hpp
   trunk/pingus/src/pingus/actions/superman.cpp
   trunk/pingus/src/pingus/actions/superman.hpp
   trunk/pingus/src/pingus/actions/waiter.hpp
   trunk/pingus/src/pingus/addon_menu.hpp
   trunk/pingus/src/pingus/blitter_impl.hpp
   trunk/pingus/src/pingus/capture_rectangle.hpp
   trunk/pingus/src/pingus/collision_map.cpp
   trunk/pingus/src/pingus/collision_mask.hpp
   trunk/pingus/src/pingus/components/button_panel.hpp
   trunk/pingus/src/pingus/components/menu_button.hpp
   trunk/pingus/src/pingus/components/pingus_counter.hpp
   trunk/pingus/src/pingus/components/smallmap.hpp
   trunk/pingus/src/pingus/components/time_display.hpp
   trunk/pingus/src/pingus/credits.hpp
   trunk/pingus/src/pingus/font.cpp
   trunk/pingus/src/pingus/ground_map.hpp
   trunk/pingus/src/pingus/layer_manager.hpp
   trunk/pingus/src/pingus/level_menu.hpp
   trunk/pingus/src/pingus/levelset.hpp
   trunk/pingus/src/pingus/option_menu.hpp
   trunk/pingus/src/pingus/particles/explosive_particle.hpp
   trunk/pingus/src/pingus/particles/pingu_particle_holder.hpp
   trunk/pingus/src/pingus/particles/rain_particle_holder.hpp
   trunk/pingus/src/pingus/particles/smoke_particle_holder.hpp
   trunk/pingus/src/pingus/particles/snow_particle_holder.hpp
   trunk/pingus/src/pingus/pingu_action.hpp
   trunk/pingus/src/pingus/pingus_menu.hpp
   trunk/pingus/src/pingus/resource.cpp
   trunk/pingus/src/pingus/resource.hpp
   trunk/pingus/src/pingus/resource_manager.cpp
   trunk/pingus/src/pingus/smallmap_image.hpp
   trunk/pingus/src/pingus/state_sprite.hpp
   trunk/pingus/src/pingus/worldmap/level_dot.hpp
   trunk/pingus/src/pingus/worldmap/sprite_drawable.hpp
   trunk/pingus/src/pingus/worldmap/worldmap.hpp
   trunk/pingus/src/pingus/worldmap/worldmap_screen.hpp
   trunk/pingus/src/pingus/worldobj.hpp
   trunk/pingus/src/pingus/worldobjs/laser_exit.hpp
   trunk/pingus/src/pingus/worldobjs/starfield_background_stars.hpp
Log:
Moved Surface and Sprite to engine/display/

Modified: trunk/pingus/src/editor/combobox.hpp
===================================================================
--- trunk/pingus/src/editor/combobox.hpp        2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/editor/combobox.hpp        2009-11-05 23:10:49 UTC (rev 
4043)
@@ -21,7 +21,7 @@
 #include <vector>
 #include <string>
 #include <boost/signal.hpp>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/gui/component.hpp"
 #include "engine/gui/rect_component.hpp"
 

Modified: trunk/pingus/src/editor/file_list.hpp
===================================================================
--- trunk/pingus/src/editor/file_list.hpp       2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/editor/file_list.hpp       2009-11-05 23:10:49 UTC (rev 
4043)
@@ -19,7 +19,7 @@
 
 #include <boost/signal.hpp>
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/gui/rect_component.hpp"
 #include "util/system.hpp"
 

Modified: trunk/pingus/src/editor/level_objs.hpp
===================================================================
--- trunk/pingus/src/editor/level_objs.hpp      2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/editor/level_objs.hpp      2009-11-05 23:10:49 UTC (rev 
4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_EDITOR_LEVEL_OBJS_HPP
 #define HEADER_PINGUS_EDITOR_LEVEL_OBJS_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "math/color.hpp"
 #include "math/origin.hpp"
 #include "math/rect.hpp"

Modified: trunk/pingus/src/editor/object_selector.cpp
===================================================================
--- trunk/pingus/src/editor/object_selector.cpp 2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/editor/object_selector.cpp 2009-11-05 23:10:49 UTC (rev 
4043)
@@ -21,7 +21,7 @@
 
 #include "engine/display/display.hpp"
 #include "editor/gui_style.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/gettext.h"
 #include "math/vector2i.hpp"
 #include "editor/editor_screen.hpp"

Modified: trunk/pingus/src/editor/object_selector_list.hpp
===================================================================
--- trunk/pingus/src/editor/object_selector_list.hpp    2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/editor/object_selector_list.hpp    2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -19,7 +19,7 @@
 
 #include <vector>
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/gui/rect_component.hpp"
 
 class DrawingContext;

Modified: trunk/pingus/src/editor/panel.cpp
===================================================================
--- trunk/pingus/src/editor/panel.cpp   2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/editor/panel.cpp   2009-11-05 23:10:49 UTC (rev 4043)
@@ -24,7 +24,7 @@
 #include "pingus/fonts.hpp"
 #include "pingus/gettext.h"
 #include "pingus/resource.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 namespace Editor {
 

Modified: trunk/pingus/src/editor/panel.hpp
===================================================================
--- trunk/pingus/src/editor/panel.hpp   2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/editor/panel.hpp   2009-11-05 23:10:49 UTC (rev 4043)
@@ -20,7 +20,7 @@
 
 #include <string>
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "math/vector2i.hpp"
 #include "engine/gui/component.hpp"
 

Modified: trunk/pingus/src/engine/display/drawing_context.cpp
===================================================================
--- trunk/pingus/src/engine/display/drawing_context.cpp 2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/engine/display/drawing_context.cpp 2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -22,7 +22,7 @@
 #include "math/math.hpp"
 #include "engine/display/framebuffer.hpp"
 #include "engine/display/display.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/font.hpp"
 #include "math/origin.hpp"
 

Modified: trunk/pingus/src/engine/display/framebuffer_surface.hpp
===================================================================
--- trunk/pingus/src/engine/display/framebuffer_surface.hpp     2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/engine/display/framebuffer_surface.hpp     2009-11-05 
23:10:49 UTC (rev 4043)
@@ -19,7 +19,7 @@
 
 #include <boost/smart_ptr.hpp>
 
-#include "pingus/surface.hpp"
+#include "engine/display/surface.hpp"
 #include "math/size.hpp"
 
 class FramebufferSurfaceImpl

Modified: trunk/pingus/src/engine/display/opengl/opengl_framebuffer.cpp
===================================================================
--- trunk/pingus/src/engine/display/opengl/opengl_framebuffer.cpp       
2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/engine/display/opengl/opengl_framebuffer.cpp       
2009-11-05 23:10:49 UTC (rev 4043)
@@ -21,8 +21,8 @@
 #include <stdexcept>
 
 #include "engine/display/opengl/opengl_framebuffer_surface_impl.hpp"
+#include "engine/display/surface.hpp"
 #include "math/math.hpp"
-#include "pingus/surface.hpp"
 
 OpenGLFramebuffer::OpenGLFramebuffer() :
   screen(),

Modified: trunk/pingus/src/engine/display/sdl_framebuffer.cpp
===================================================================
--- trunk/pingus/src/engine/display/sdl_framebuffer.cpp 2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/engine/display/sdl_framebuffer.cpp 2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 
 #include <iostream>
 #include "math/math.hpp"
-#include "pingus/surface.hpp"
+#include "engine/display/surface.hpp"
 #include "engine/display/display.hpp"
 #include "engine/display/sdl_framebuffer_surface_impl.hpp"
 

Copied: trunk/pingus/src/engine/display/sprite.cpp (from rev 4037, 
trunk/pingus/src/pingus/sprite.cpp)
===================================================================
--- trunk/pingus/src/pingus/sprite.cpp  2009-11-05 19:22:47 UTC (rev 4037)
+++ trunk/pingus/src/engine/display/sprite.cpp  2009-11-05 23:10:49 UTC (rev 
4043)
@@ -0,0 +1,222 @@
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2005 Ingo Ruhnke <address@hidden>
+//
+//  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
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  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, see <http://www.gnu.org/licenses/>.
+
+#include "engine/display/sprite.hpp"
+
+#include <iostream>
+#include <sstream>
+#include <assert.h>
+#include "SDL.h"
+
+#include "math/origin.hpp"
+#include "math/vector2i.hpp"
+#include "SDL_image.h"
+#include "pingus/blitter.hpp"
+#include "engine/display/surface.hpp"
+#include "util/pathname.hpp"
+#include "pingus/resource.hpp"
+#include "engine/display/sprite_impl.hpp"
+#include "engine/display/sprite_description.hpp"
+
+Sprite::Sprite() :
+  impl()
+{
+}
+
+Sprite::Sprite(const std::string& name) :
+  impl()
+{
+  SpriteDescription* desc = Resource::load_sprite_desc(name);
+  if (desc)
+    {
+      impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(*desc));
+    }
+  else
+    {
+      SpriteDescription desc_;
+      desc_.filename = Pathname("images/core/misc/404.png", 
Pathname::DATA_PATH);
+      impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(desc_));
+    }
+}
+
+Sprite::Sprite(const ResDescriptor& res_desc) :
+  impl()
+{
+  SpriteDescription* desc = Resource::load_sprite_desc(res_desc.res_name);
+  if (desc)
+    {
+      impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(*desc, 
res_desc.modifier));
+    }
+  else
+    {
+      SpriteDescription desc_;
+      desc_.filename = Pathname("images/core/misc/404.png", 
Pathname::DATA_PATH);
+      impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(desc_));
+    } 
+}
+
+Sprite::Sprite(const Pathname& name) :
+  impl()
+{
+  SpriteDescription desc;
+  desc.filename = name;
+  impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(desc));
+}
+
+Sprite::Sprite(const Surface& surface)
+  : impl(new SpriteImpl(surface))
+{  
+}
+
+Sprite::Sprite(const SpriteDescription& desc, 
ResourceModifierNS::ResourceModifier mod)
+  : impl(new SpriteImpl(desc, mod))
+{
+}
+
+Sprite::~Sprite()
+{
+}
+
+void
+Sprite::render(int x, int y, Framebuffer& fb)
+{
+  if (impl.get())
+    impl->render(x, y, fb);
+}
+
+int
+Sprite::get_width() const
+{
+  if (impl.get()) 
+    return impl->frame_size.width;
+  else
+    return 0;
+}
+
+int
+Sprite::get_height() const
+{
+  if (impl.get()) 
+    return impl->frame_size.height;
+  else
+    return 0;
+}
+
+Sprite::operator bool() const
+{
+  return (impl.get() != 0);
+}
+
+void
+Sprite::update(float delta)
+{
+  if (impl.get())
+    impl->update(delta);
+}
+
+void
+Sprite::set_frame(int i)
+{
+  if (impl.get())
+    impl->frame = i;
+}
+
+int
+Sprite::get_frame_count() const
+{
+  if (impl.get())
+    return (impl->array.width * impl->array.height);
+  else
+    return 0;
+}
+
+bool
+Sprite::is_finished() const
+{
+  if (impl.get())
+    return impl->finished;
+  else
+    return true;
+}
+
+bool
+Sprite::is_looping() const
+{
+  if (impl.get())
+    return impl->loop_last_cycle;
+  else
+    return false;
+}
+
+void
+Sprite::set_play_loop(bool loop)
+{
+  if (impl.get())
+    impl->loop = loop;
+}
+
+int
+Sprite::get_current_frame() const
+{
+  if (impl.get())
+    return impl->frame;
+  else
+    return 0;
+}
+
+void
+Sprite::restart()
+{
+  if (impl.get())
+    impl->restart();
+}
+
+void
+Sprite::finish()
+{
+  if (impl.get())
+    impl->finish();
+}
+
+Vector2i
+Sprite::get_offset() const
+{
+  if (impl.get())
+    return impl->offset;
+  else
+    return Vector2i();
+}
+
+void
+Sprite::set_hotspot(Origin origin, int x, int y)
+{
+  if (impl.get())
+    {
+      // FIXME: offset and other stuff should be member of the Sprite, not the 
SpriteImpl
+      impl->offset = calc_origin(origin, impl->frame_size) - Vector2i(x, y);
+    }
+}
+
+Surface
+Sprite::to_surface() const
+{
+  if (impl.get())
+    return impl->to_surface();
+  else
+    return Surface();
+}
+
+/* EOF */

Copied: trunk/pingus/src/engine/display/sprite.hpp (from rev 4038, 
trunk/pingus/src/pingus/sprite.hpp)

Copied: trunk/pingus/src/engine/display/sprite_description.hpp (from rev 4037, 
trunk/pingus/src/pingus/sprite_description.hpp)

Copied: trunk/pingus/src/engine/display/sprite_impl.cpp (from rev 4041, 
trunk/pingus/src/pingus/sprite_impl.cpp)
===================================================================
--- trunk/pingus/src/pingus/sprite_impl.cpp     2009-11-05 22:48:38 UTC (rev 
4041)
+++ trunk/pingus/src/engine/display/sprite_impl.cpp     2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -0,0 +1,203 @@
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2005-2008 Ingo Ruhnke <address@hidden>
+//
+//  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
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  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, see <http://www.gnu.org/licenses/>.
+
+#include "engine/display/sprite_impl.hpp"
+
+#include <map>
+#include "engine/display/framebuffer.hpp"
+#include "engine/display/display.hpp"
+#include "engine/display/sprite_description.hpp"
+
+typedef std::map<std::string, FramebufferSurface> SurfaceCache;
+SurfaceCache surface_cache;
+
+FramebufferSurface load_framebuffer_surface(const Pathname& filename, 
ResourceModifierNS::ResourceModifier mod)
+{
+  SurfaceCache::iterator i = surface_cache.find(filename.get_sys_path());
+  
+  if (i == surface_cache.end())
+    {
+
+      Surface surface(filename);
+      if (mod != ResourceModifierNS::ROT0)
+        surface = surface.mod(mod);
+
+      if (!surface)
+        {
+          std::cout << "Error: Sprite: couldn't load '" << filename << "'" << 
std::endl;
+          surface = Surface(Pathname("images/core/misc/404.png", 
Pathname::DATA_PATH));
+          if (!surface) assert(!"Surface Couldn't find 404");
+        }
+
+      FramebufferSurface framebuffer_surface = 
Display::get_framebuffer().create_surface(surface);
+
+      surface_cache[filename.get_sys_path()] = framebuffer_surface;
+
+      return framebuffer_surface;
+    }
+  else
+    {
+      //std::cout << "Sharing: " << filename.get_sys_path() << std::endl;
+      return i->second;
+    }
+}
+
+void delete_framebuffer_surface(const Pathname& filename)
+{
+  SurfaceCache::iterator i = surface_cache.find(filename.get_sys_path());
+  if (i != surface_cache.end())
+    {
+      //std::cout << "UseCount for " << filename << ": " << 
i->second.use_count() << std::endl;
+      if (i->second.use_count() == 1)
+        {
+          surface_cache.erase(i);
+        }
+    }
+}
+
+SpriteImpl::SpriteImpl() :
+  filename(),
+  framebuffer_surface(),
+  offset(),
+  frame_pos(),
+  frame_size(),
+  frame_delay(),
+  array(),
+  loop(),
+  loop_last_cycle(),
+  finished(),
+  frame(),
+  tick_count()
+{
+}
+
+SpriteImpl::SpriteImpl(const SpriteDescription& desc, 
ResourceModifierNS::ResourceModifier mod) :
+  filename(desc.filename),
+  framebuffer_surface(),
+  offset(),
+  frame_pos(),
+  frame_size(),
+  frame_delay(),
+  array(),
+  loop(),
+  loop_last_cycle(),
+  finished(false),
+  frame(0),
+  tick_count(0)
+{
+  framebuffer_surface = load_framebuffer_surface(filename, mod);
+
+  frame_pos = desc.frame_pos;
+
+  array = desc.array;
+
+  frame_size.width  = (desc.frame_size.width  == -1) ? 
framebuffer_surface.get_width()/array.width   : desc.frame_size.width;
+  frame_size.height = (desc.frame_size.height == -1) ? 
framebuffer_surface.get_height()/array.height : desc.frame_size.height;
+
+  frame_delay  = desc.speed;
+
+  loop = desc.loop;
+  loop_last_cycle = false;
+
+  offset = calc_origin(desc.origin, frame_size) - desc.offset;
+    
+}
+
+SpriteImpl::SpriteImpl(const Surface& surface) :
+  filename(),
+  framebuffer_surface(Display::get_framebuffer().create_surface(surface)),
+  offset(0,0),
+  frame_pos(0,0),
+  frame_size(surface.get_width(), surface.get_height()),
+  frame_delay(0),
+  array(1,1),
+  loop(true),
+  loop_last_cycle(false),
+  finished(false),
+  frame(0),
+  tick_count(0)
+{
+}
+
+SpriteImpl::~SpriteImpl()
+{
+  if (!filename.empty())
+    {
+      framebuffer_surface = FramebufferSurface();
+      delete_framebuffer_surface(filename);
+    }
+}
+
+void
+SpriteImpl::update(float delta)
+{
+  if (finished)
+    return;
+
+  int total_time = frame_delay * (array.width * array.height);
+  tick_count += int(delta * 1000.0f);
+  if (tick_count >= total_time)
+    {
+      if (loop)
+        {
+          loop_last_cycle = true;
+          tick_count = tick_count % total_time;
+          frame = tick_count / frame_delay;
+        }
+      else
+        {
+          finished = true;
+        }
+    }
+  else
+    {
+      loop_last_cycle = false;
+      frame = tick_count / frame_delay;
+    }
+}
+
+void 
+SpriteImpl::render(int x, int y, Framebuffer& fb)
+{
+  fb.draw_surface(framebuffer_surface,
+                  Rect(frame_pos + Vector2i(frame_size.width  * 
(frame%array.width),
+                                            frame_size.height * 
(frame/array.width)),
+                       frame_size),
+                  Vector2i(x - offset.x, y - offset.y));
+}
+
+void
+SpriteImpl::restart()
+{
+  finished = false;
+  loop_last_cycle = false;
+  frame = 0;
+  tick_count = 0;
+}
+
+void
+SpriteImpl::finish()
+{
+  finished = true;
+}
+
+Surface
+SpriteImpl::to_surface() const
+{
+  return framebuffer_surface.to_surface();
+}
+
+/* EOF */

Copied: trunk/pingus/src/engine/display/sprite_impl.hpp (from rev 4041, 
trunk/pingus/src/pingus/sprite_impl.hpp)
===================================================================
--- trunk/pingus/src/pingus/sprite_impl.hpp     2009-11-05 22:48:38 UTC (rev 
4041)
+++ trunk/pingus/src/engine/display/sprite_impl.hpp     2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -0,0 +1,69 @@
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2005-2008 Ingo Ruhnke <address@hidden>
+//
+//  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
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  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, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_PINGUS_PINGUS_SPRITE_IMPL_HPP
+#define HEADER_PINGUS_PINGUS_SPRITE_IMPL_HPP
+
+#include "engine/display/surface.hpp"
+#include "engine/display/framebuffer_surface.hpp"
+#include "math/vector2i.hpp"
+
+class SpriteDescription;
+class Framebuffer;
+
+class SpriteImpl
+{
+private:
+  friend class Sprite;
+
+  Pathname filename;
+  FramebufferSurface framebuffer_surface;
+
+  Vector2i offset;
+
+  Vector2i frame_pos;
+  Size     frame_size;
+  int      frame_delay;
+
+  Size     array;
+
+  bool     loop;
+  bool     loop_last_cycle;
+  bool     finished;
+
+  /** Current frame */
+  int frame; 
+  int tick_count;
+
+public:
+  SpriteImpl();
+  SpriteImpl(const SpriteDescription& desc, 
ResourceModifierNS::ResourceModifier mod = ResourceModifierNS::ROT0);
+  SpriteImpl(const Surface& surface_);
+  ~SpriteImpl();
+
+  void update(float delta);
+
+  void render(int x, int y, Framebuffer& fb);
+
+  void restart();
+  void finish();
+
+  Surface to_surface() const;
+};
+
+#endif
+
+/* EOF */

Copied: trunk/pingus/src/engine/display/surface.cpp (from rev 4037, 
trunk/pingus/src/pingus/surface.cpp)
===================================================================
--- trunk/pingus/src/pingus/surface.cpp 2009-11-05 19:22:47 UTC (rev 4037)
+++ trunk/pingus/src/engine/display/surface.cpp 2009-11-05 23:10:49 UTC (rev 
4043)
@@ -0,0 +1,372 @@
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2005 Ingo Ruhnke <address@hidden>
+//
+//  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
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  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, see <http://www.gnu.org/licenses/>.
+
+#include "engine/display/surface.hpp"
+
+#include "SDL_image.h"
+#include <boost/format.hpp>
+#include <sstream>
+#include <iostream>
+
+#include "math/rect.hpp"
+#include "pingus/debug.hpp"
+#include "pingus/blitter.hpp"
+
+class SurfaceImpl
+{
+public:
+  SDL_Surface* surface;
+
+  SurfaceImpl()
+    : surface(0)
+  {}
+
+  SurfaceImpl(SDL_Surface* surface_) :
+    surface(surface_)
+  {}
+  
+  ~SurfaceImpl() 
+  {
+    if (surface)
+      SDL_FreeSurface(surface);
+  }
+
+private:
+  SurfaceImpl(const SurfaceImpl&);
+  SurfaceImpl & operator=(const SurfaceImpl&);
+};
+
+Surface::Surface() :
+  impl()
+{
+}
+
+Surface::Surface(boost::shared_ptr<SurfaceImpl> impl_) :
+  impl(impl_)
+{
+}
+
+Surface::Surface(const Pathname& pathname) :
+  impl()
+{
+  SDL_Surface* surface = IMG_Load(pathname.get_sys_path().c_str());
+  if (surface)
+    {
+      impl = boost::shared_ptr<SurfaceImpl>(new SurfaceImpl(surface));
+    }
+}
+
+Surface::Surface(int width, int height, SDL_Palette* palette, int colorkey)
+  : impl(new SurfaceImpl())
+{
+  if (colorkey == -1)
+    {
+      impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 8,
+                                           0, 0, 0 ,0);
+    }
+  else
+    {
+      impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCCOLORKEY, 
width, height, 8,
+                                           0, 0, 0 ,0);
+      SDL_SetColorKey(impl->surface, SDL_SRCCOLORKEY, colorkey);
+    }
+
+  SDL_SetColors(impl->surface, palette->colors, 0, palette->ncolors);
+}
+
+Surface::Surface(int width, int height)
+  : impl(new SurfaceImpl())
+{
+  impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, width, 
height, 32,
+                                       0x000000ff,
+                                       0x0000ff00,
+                                       0x00ff0000,
+                                       0xff000000);
+  //SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 0, 0, 0, 0));
+}
+
+Surface::Surface(SDL_Surface* surface)
+  : impl(new SurfaceImpl(surface))
+{
+}
+
+Surface::~Surface()
+{
+}
+
+void
+Surface::blit(const Surface& src, int x, int y)
+{
+  if (!get_surface())
+    {
+      std::cout << "Surface: Trying to blit to empty surface" << std::endl;
+    }
+  else if (!src.get_surface())
+    {
+      std::cout << "Surface: Trying to blit with an empty surface" << 
std::endl;
+    }
+  else
+    {
+      SDL_Rect dstrect;
+
+      dstrect.x = static_cast<Sint16>(x);
+      dstrect.y = static_cast<Sint16>(y);
+
+      SDL_BlitSurface(src.get_surface(), NULL, get_surface(), &dstrect);
+    }
+}
+
+void
+Surface::lock()
+{
+  SDL_LockSurface(get_surface());
+}
+
+void
+Surface::unlock()
+{
+  SDL_UnlockSurface(get_surface());
+}
+
+uint8_t*
+Surface::get_data() const
+{
+  return static_cast<uint8_t*>(get_surface()->pixels);
+}
+
+Size
+Surface::get_size()  const
+{
+  if (get_surface())
+    return Size(impl->surface->w, impl->surface->h);
+  else
+    return Size();
+}
+
+int
+Surface::get_width()  const
+{
+  if (get_surface())
+    return get_surface()->w;
+  else
+    return 0;
+}
+
+int
+Surface::get_height() const
+{
+  if (get_surface())
+    return get_surface()->h;
+  else
+    return 0;
+}
+
+int
+Surface::get_pitch() const
+{
+  if (get_surface())
+    return get_surface()->pitch;
+  else
+    return 0;
+}
+
+SDL_Surface* 
+Surface::get_surface() const
+{
+  return impl ? impl->surface : 0;
+}
+
+Surface::operator bool() const
+{
+  return impl ? impl->surface != NULL : false;
+}
+
+Color
+Surface::get_pixel(int x, int y) const
+{
+  Uint8 *p = (Uint8 *)get_surface()->pixels + y * get_surface()->pitch + x * 
get_surface()->format->BytesPerPixel;
+  Uint32 pixel;
+
+  switch(get_surface()->format->BytesPerPixel)
+    {
+    case 1:
+      pixel = *p;
+    case 2: /* This will cause some problems ... */
+      pixel = *(Uint16 *)p;
+    case 3:
+      if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
+       pixel = p[0] << 16 | p[1] << 8 | p[2];
+      else
+       pixel = p[0] | p[1] << 8 | p[2] << 16;
+    case 4:
+      pixel = *(Uint32 *)p;
+    default:
+      pixel = 0;       /* shouldn't happen, but avoids warnings */
+    } 
+
+  Color color;
+  SDL_GetRGBA(pixel, get_surface()->format, &color.r, &color.g, &color.b, 
&color.a);
+  return color;
+}
+
+Surface
+Surface::mod(ResourceModifierNS::ResourceModifier modifier)
+{
+  switch(modifier)
+    {
+      case ResourceModifierNS::ROT0:
+        return this->clone();
+
+      case ResourceModifierNS::ROT90:
+        return Blitter::rotate_90(*this);
+
+      case ResourceModifierNS::ROT180:
+        return Blitter::rotate_180(*this);
+
+      case ResourceModifierNS::ROT270:
+        return Blitter::rotate_270(*this);
+
+      case ResourceModifierNS::ROT0FLIP:
+        return Blitter::flip_horizontal(*this);
+
+      case ResourceModifierNS::ROT90FLIP:
+        return Blitter::rotate_90_flip(*this);
+
+      case ResourceModifierNS::ROT180FLIP:
+        return Blitter::rotate_180_flip(*this);
+
+      case ResourceModifierNS::ROT270FLIP:
+        return Blitter::rotate_270_flip(*this);
+
+      default:
+        perr << "Surface: unhandled modifier: " << modifier << std::endl;
+        return *this;
+    }
+}
+
+Surface
+Surface::scale(int w, int h)
+{
+  return Surface(boost::shared_ptr<SurfaceImpl>
+                 (new SurfaceImpl(Blitter::scale_surface(impl->surface, w, 
h))));
+}
+
+Surface
+Surface::clone() const
+{
+  SDL_Surface* new_surface = 
Blitter::create_surface_from_format(impl->surface, 
+                                                                 
impl->surface->w, impl->surface->h);
+  if (impl->surface->flags & SDL_SRCALPHA)
+    {
+      Uint8 alpha = impl->surface->format->alpha;
+      SDL_SetAlpha(impl->surface, 0, 0);
+      SDL_BlitSurface(impl->surface, NULL, new_surface, NULL);
+      SDL_SetAlpha(impl->surface, SDL_SRCALPHA, alpha);
+    }
+  else
+    {
+      SDL_BlitSurface(impl->surface, NULL, new_surface, NULL);
+    }
+ 
+  return Surface(boost::shared_ptr<SurfaceImpl>(new SurfaceImpl(new_surface)));
+}
+
+Surface
+Surface::subsection(const Rect& rect) const
+{
+  SDL_Surface* new_surface;
+  new_surface = Blitter::create_surface_from_format(impl->surface,
+                                                    rect.get_width(), 
rect.get_height());
+  SDL_Rect dst_rect;
+  dst_rect.x = static_cast<Sint16>(rect.left);
+  dst_rect.y = static_cast<Sint16>(rect.top);
+
+  if (impl->surface->format->palette)
+    SDL_SetPalette(new_surface, SDL_LOGPAL, 
impl->surface->format->palette->colors, 
+                   0, impl->surface->format->palette->ncolors);
+
+  if (impl->surface->flags & SDL_SRCCOLORKEY)
+    SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY, 
impl->surface->format->colorkey);
+
+  SDL_BlitSurface(impl->surface, NULL, new_surface, &dst_rect);
+
+  return Surface(boost::shared_ptr<SurfaceImpl>(new SurfaceImpl(new_surface)));
+}
+
+void
+Surface::fill(const Color& color)
+{
+  // FIXME: Couldn't get this to work with a RGBA surface for some
+  // reason, something to do with tmp format and impl->surface
+  // matching up maybe, anyway with RGB it works and it saves a
+  // little bit of space to
+  // FIXME: sould/should use a proper RGBA rect_fill function, this is just a 
work around
+  SDL_Surface* tmp = Blitter::create_surface_rgb(impl->surface->w, 
impl->surface->h);
+  SDL_FillRect(tmp, NULL, SDL_MapRGBA(tmp->format, color.r, color.g, color.b, 
255));
+  SDL_SetAlpha(tmp, SDL_SRCALPHA, color.a);
+          
+  SDL_BlitSurface(tmp, NULL, impl->surface, NULL);
+
+  SDL_FreeSurface(tmp);
+}
+
+void
+Surface::print(std::ostream& out)
+{
+  out << boost::format("Pointer: 0x%p\n"
+                       "Rmask:   0x%08x\n"
+                       "Gmask:   0x%08x\n"
+                       "Bmask:   0x%08x\n"
+                       "Amask:   0x%08x\n"
+                       "Flags:   0x%08x -> %s%s%s%s\n"
+                       "Palette: 0x%08x\n"
+                       "BitsPerPixel: %d\n"
+                       )
+    % impl->surface
+    % impl->surface->format->Rmask
+    % impl->surface->format->Gmask
+    % impl->surface->format->Bmask
+    % impl->surface->format->Amask
+    % impl->surface->flags
+    % ((impl->surface->flags & SDL_HWSURFACE) ? "HWSURFACE " : "")
+    % ((impl->surface->flags & SDL_SWSURFACE) ? "SWSURFACE " : "")
+    % ((impl->surface->flags & SDL_SRCCOLORKEY) ? "SRCCOLORKEY " : "")
+    % ((impl->surface->flags & SDL_SRCALPHA) ? "SRCALPHA " : "")
+    % impl->surface->format->palette
+    % static_cast<int>(impl->surface->format->BitsPerPixel);
+
+  if (impl->surface->flags & SDL_SRCCOLORKEY)
+    out << "Colorkey: " << (int)impl->surface->format->colorkey << std::endl;
+
+  if (impl->surface->flags & SDL_SRCALPHA)
+    out << "Alpha: " << (int)impl->surface->format->alpha << std::endl;
+
+  if (0)
+    {
+      SDL_LockSurface(impl->surface);
+      Uint8* pixels = static_cast<Uint8*>(impl->surface->pixels);
+      for(int i = 0; i < impl->surface->pitch * impl->surface->h; i += 4)
+        out << boost::format("(%3d %3d %3d %3d) ")
+          % (int)pixels[i+0]
+          % (int)pixels[i+1]
+          % (int)pixels[i+2]
+          % (int)pixels[i+3];
+      out << std::endl;
+      SDL_UnlockSurface(impl->surface);
+    }
+}
+
+/* EOF */

Copied: trunk/pingus/src/engine/display/surface.hpp (from rev 4037, 
trunk/pingus/src/pingus/surface.hpp)

Modified: trunk/pingus/src/engine/gui/surface_button.hpp
===================================================================
--- trunk/pingus/src/engine/gui/surface_button.hpp      2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/engine/gui/surface_button.hpp      2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_GUI_SURFACE_BUTTON_HPP
 #define HEADER_PINGUS_GUI_SURFACE_BUTTON_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/gui/component.hpp"
 
 namespace GUI {

Modified: trunk/pingus/src/engine/screen/screen_manager.hpp
===================================================================
--- trunk/pingus/src/engine/screen/screen_manager.hpp   2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/engine/screen/screen_manager.hpp   2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -22,7 +22,7 @@
 #include <boost/smart_ptr.hpp>
 #include <vector>
 #include "math/vector2f.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 namespace Input {
 class Manager;

Modified: trunk/pingus/src/pingus/actions/angel.hpp
===================================================================
--- trunk/pingus/src/pingus/actions/angel.hpp   2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/actions/angel.hpp   2009-11-05 23:10:49 UTC (rev 
4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_ACTIONS_ANGEL_HPP
 
 #include "pingus/pingu_action.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 namespace Actions {
 

Modified: trunk/pingus/src/pingus/actions/digger.hpp
===================================================================
--- trunk/pingus/src/pingus/actions/digger.hpp  2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/actions/digger.hpp  2009-11-05 23:10:49 UTC (rev 
4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_ACTIONS_DIGGER_HPP
 #define HEADER_PINGUS_ACTIONS_DIGGER_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/pingu_action.hpp"
 
 namespace Actions {

Modified: trunk/pingus/src/pingus/actions/floater.hpp
===================================================================
--- trunk/pingus/src/pingus/actions/floater.hpp 2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/actions/floater.hpp 2009-11-05 23:10:49 UTC (rev 
4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_ACTIONS_FLOATER_HPP
 
 #include "pingus/pingu_action.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 namespace Actions {
 

Modified: trunk/pingus/src/pingus/actions/smashed.cpp
===================================================================
--- trunk/pingus/src/pingus/actions/smashed.cpp 2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/actions/smashed.cpp 2009-11-05 23:10:49 UTC (rev 
4043)
@@ -19,7 +19,7 @@
 #include "math/vector3f.hpp"
 #include "engine/display/scene_context.hpp"
 #include "pingus/pingu.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 namespace Actions {
 

Modified: trunk/pingus/src/pingus/actions/smashed.hpp
===================================================================
--- trunk/pingus/src/pingus/actions/smashed.hpp 2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/actions/smashed.hpp 2009-11-05 23:10:49 UTC (rev 
4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_ACTIONS_SMASHED_HPP
 #define HEADER_PINGUS_ACTIONS_SMASHED_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/pingu_action.hpp"
 
 namespace Actions {

Modified: trunk/pingus/src/pingus/actions/splashed.hpp
===================================================================
--- trunk/pingus/src/pingus/actions/splashed.hpp        2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/actions/splashed.hpp        2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_ACTIONS_SPLASHED_HPP
 
 #include "pingus/pingu_action.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 namespace Actions {
 

Modified: trunk/pingus/src/pingus/actions/superman.cpp
===================================================================
--- trunk/pingus/src/pingus/actions/superman.cpp        2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/actions/superman.cpp        2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 
 #include "engine/display/scene_context.hpp"
 #include "pingus/pingu.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 namespace Actions {
 

Modified: trunk/pingus/src/pingus/actions/superman.hpp
===================================================================
--- trunk/pingus/src/pingus/actions/superman.hpp        2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/actions/superman.hpp        2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_ACTIONS_SUPERMAN_HPP
 #define HEADER_PINGUS_ACTIONS_SUPERMAN_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/pingu_action.hpp"
 
 namespace Actions {

Modified: trunk/pingus/src/pingus/actions/waiter.hpp
===================================================================
--- trunk/pingus/src/pingus/actions/waiter.hpp  2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/actions/waiter.hpp  2009-11-05 23:10:49 UTC (rev 
4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_ACTIONS_WAITER_HPP
 #define HEADER_PINGUS_ACTIONS_WAITER_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/pingu_action.hpp"
 
 namespace Actions {

Modified: trunk/pingus/src/pingus/addon_menu.hpp
===================================================================
--- trunk/pingus/src/pingus/addon_menu.hpp      2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/addon_menu.hpp      2009-11-05 23:10:49 UTC (rev 
4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_PINGUS_ADDON_MENU_HPP
 #define HEADER_PINGUS_PINGUS_ADDON_MENU_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/screen/gui_screen.hpp"
 
 /** */

Modified: trunk/pingus/src/pingus/blitter_impl.hpp
===================================================================
--- trunk/pingus/src/pingus/blitter_impl.hpp    2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/blitter_impl.hpp    2009-11-05 23:10:49 UTC (rev 
4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PINGUS_BLITTER_IMPL_HPP
 
 #include <iostream>
-#include "pingus/surface.hpp"
+#include "engine/display/surface.hpp"
 #include "pingus/pingus.hpp"
 
 /** A collection of helper functions for the blitter class */

Modified: trunk/pingus/src/pingus/capture_rectangle.hpp
===================================================================
--- trunk/pingus/src/pingus/capture_rectangle.hpp       2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/capture_rectangle.hpp       2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PINGUS_CAPTURE_RECTANGLE_HPP
 
 #include "pingus/font.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 class Font;
 class Pingu;

Modified: trunk/pingus/src/pingus/collision_map.cpp
===================================================================
--- trunk/pingus/src/pingus/collision_map.cpp   2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/collision_map.cpp   2009-11-05 23:10:49 UTC (rev 
4043)
@@ -24,7 +24,7 @@
 #include "pingus/pingus_error.hpp"
 #include "math/math.hpp"
 #include "pingus/gettext.h"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 CollisionMap::CollisionMap(int w, int h)
   : serial(0),

Modified: trunk/pingus/src/pingus/collision_mask.hpp
===================================================================
--- trunk/pingus/src/pingus/collision_mask.hpp  2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/collision_mask.hpp  2009-11-05 23:10:49 UTC (rev 
4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PINGUS_COLLISION_MASK_HPP
 
 #include <string>
-#include "pingus/surface.hpp"
+#include "engine/display/surface.hpp"
 #include "pingus/res_descriptor.hpp"
 
 /** */

Modified: trunk/pingus/src/pingus/components/button_panel.hpp
===================================================================
--- trunk/pingus/src/pingus/components/button_panel.hpp 2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/components/button_panel.hpp 2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_COMPONENTS_BUTTON_PANEL_HPP
 
 #include <vector>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/gui/rect_component.hpp"
 #include "pingus/components/action_button.hpp"
 

Modified: trunk/pingus/src/pingus/components/menu_button.hpp
===================================================================
--- trunk/pingus/src/pingus/components/menu_button.hpp  2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/components/menu_button.hpp  2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_COMPONENTS_MENU_BUTTON_HPP
 
 #include <string>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/font.hpp"
 #include "math/vector2i.hpp"
 #include "engine/gui/component.hpp"

Modified: trunk/pingus/src/pingus/components/pingus_counter.hpp
===================================================================
--- trunk/pingus/src/pingus/components/pingus_counter.hpp       2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/components/pingus_counter.hpp       2009-11-05 
23:10:49 UTC (rev 4043)
@@ -19,7 +19,7 @@
 
 #include "engine/gui/component.hpp"
 #include "pingus/font.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 class DrawingContext;
 class World;

Modified: trunk/pingus/src/pingus/components/smallmap.hpp
===================================================================
--- trunk/pingus/src/pingus/components/smallmap.hpp     2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/components/smallmap.hpp     2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_COMPONENTS_SMALLMAP_HPP
 #define HEADER_PINGUS_COMPONENTS_SMALLMAP_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/gui/rect_component.hpp"
 
 class Playfield;

Modified: trunk/pingus/src/pingus/components/time_display.hpp
===================================================================
--- trunk/pingus/src/pingus/components/time_display.hpp 2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/components/time_display.hpp 2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_COMPONENTS_TIME_DISPLAY_HPP
 
 #include "engine/gui/component.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/font.hpp"
 
 class Font;

Modified: trunk/pingus/src/pingus/credits.hpp
===================================================================
--- trunk/pingus/src/pingus/credits.hpp 2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/credits.hpp 2009-11-05 23:10:49 UTC (rev 4043)
@@ -22,7 +22,7 @@
 #include "engine/screen/gui_screen.hpp"
 #include "pingus/font.hpp"
 #include "engine/display/scene_context.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 class Credits : public GUIScreen
 {

Modified: trunk/pingus/src/pingus/font.cpp
===================================================================
--- trunk/pingus/src/pingus/font.cpp    2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/font.cpp    2009-11-05 23:10:49 UTC (rev 4043)
@@ -21,7 +21,7 @@
 #include <map>
 #include "SDL.h"
 #include "SDL_image.h"
-#include "pingus/surface.hpp"
+#include "engine/display/surface.hpp"
 #include "pingus/line_iterator.hpp"
 #include "util/utf8.hpp"
 #include "pingus/font_description.hpp"

Modified: trunk/pingus/src/pingus/ground_map.hpp
===================================================================
--- trunk/pingus/src/pingus/ground_map.hpp      2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/ground_map.hpp      2009-11-05 23:10:49 UTC (rev 
4043)
@@ -21,7 +21,7 @@
 #include "pingus/globals.hpp"
 #include "pingus/worldobj.hpp"
 #include "pingus/ground_map.hpp"
-#include "pingus/surface.hpp"
+#include "engine/display/surface.hpp"
 
 class SceneContext;
 class CollisionMap;

Modified: trunk/pingus/src/pingus/layer_manager.hpp
===================================================================
--- trunk/pingus/src/pingus/layer_manager.hpp   2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/layer_manager.hpp   2009-11-05 23:10:49 UTC (rev 
4043)
@@ -20,7 +20,7 @@
 #include "math/math.hpp"
 #include "pingus/globals.hpp"
 #include "pingus/pingus.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/display/display.hpp"
 #include "engine/display/drawing_context.hpp"
 

Modified: trunk/pingus/src/pingus/level_menu.hpp
===================================================================
--- trunk/pingus/src/pingus/level_menu.hpp      2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/level_menu.hpp      2009-11-05 23:10:49 UTC (rev 
4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PINGUS_LEVEL_MENU_HPP
 
 #include "pingus/levelset.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/screen/gui_screen.hpp"
 
 namespace GUI {

Modified: trunk/pingus/src/pingus/levelset.hpp
===================================================================
--- trunk/pingus/src/pingus/levelset.hpp        2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/levelset.hpp        2009-11-05 23:10:49 UTC (rev 
4043)
@@ -21,7 +21,7 @@
 #include <vector>
 #include "pingus/pingus_level.hpp"
 #include "util/pathname.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 /** */
 class Levelset

Modified: trunk/pingus/src/pingus/option_menu.hpp
===================================================================
--- trunk/pingus/src/pingus/option_menu.hpp     2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/option_menu.hpp     2009-11-05 23:10:49 UTC (rev 
4043)
@@ -20,7 +20,7 @@
 #include <vector>
 #include <map>
 #include <boost/signals.hpp>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/screen/gui_screen.hpp"
 #include "pingus/components/label.hpp"
 #include "engine/gui/rect_component.hpp"

Modified: trunk/pingus/src/pingus/particles/explosive_particle.hpp
===================================================================
--- trunk/pingus/src/pingus/particles/explosive_particle.hpp    2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/particles/explosive_particle.hpp    2009-11-05 
23:10:49 UTC (rev 4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_PARTICLES_EXPLOSIVE_PARTICLE_HPP
 #define HEADER_PINGUS_PARTICLES_EXPLOSIVE_PARTICLE_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/particles/particle.hpp"
 
 class ExplosiveParticle

Modified: trunk/pingus/src/pingus/particles/pingu_particle_holder.hpp
===================================================================
--- trunk/pingus/src/pingus/particles/pingu_particle_holder.hpp 2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/particles/pingu_particle_holder.hpp 2009-11-05 
23:10:49 UTC (rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PARTICLES_PINGU_PARTICLE_HOLDER_HPP
 
 #include <vector>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "math/vector3f.hpp"
 #include "pingus/worldobj.hpp"
 

Modified: trunk/pingus/src/pingus/particles/rain_particle_holder.hpp
===================================================================
--- trunk/pingus/src/pingus/particles/rain_particle_holder.hpp  2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/particles/rain_particle_holder.hpp  2009-11-05 
23:10:49 UTC (rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PARTICLES_RAIN_PARTICLE_HOLDER_HPP
 
 #include <vector>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "math/vector3f.hpp"
 #include "pingus/worldobj.hpp"
 

Modified: trunk/pingus/src/pingus/particles/smoke_particle_holder.hpp
===================================================================
--- trunk/pingus/src/pingus/particles/smoke_particle_holder.hpp 2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/particles/smoke_particle_holder.hpp 2009-11-05 
23:10:49 UTC (rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PARTICLES_SMOKE_PARTICLE_HOLDER_HPP
 
 #include <vector>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "math/vector3f.hpp"
 #include "pingus/worldobj.hpp"
 

Modified: trunk/pingus/src/pingus/particles/snow_particle_holder.hpp
===================================================================
--- trunk/pingus/src/pingus/particles/snow_particle_holder.hpp  2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/particles/snow_particle_holder.hpp  2009-11-05 
23:10:49 UTC (rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PARTICLES_SNOW_PARTICLE_HOLDER_HPP
 
 #include <vector>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "math/vector3f.hpp"
 #include "pingus/worldobj.hpp"
 

Modified: trunk/pingus/src/pingus/pingu_action.hpp
===================================================================
--- trunk/pingus/src/pingus/pingu_action.hpp    2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/pingu_action.hpp    2009-11-05 23:10:49 UTC (rev 
4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PINGUS_PINGU_ACTION_HPP
 
 #include "pingus/pingu_enums.hpp"
-#include "pingus/surface.hpp"
+#include "engine/display/surface.hpp"
 #include "pingus/collision_mask.hpp"
 
 class ActionHolder;

Modified: trunk/pingus/src/pingus/pingus_menu.hpp
===================================================================
--- trunk/pingus/src/pingus/pingus_menu.hpp     2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/pingus_menu.hpp     2009-11-05 23:10:49 UTC (rev 
4043)
@@ -21,7 +21,7 @@
 #include <memory>
 
 #include "pingus/fonts.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/screen/gui_screen.hpp"
 
 namespace GUI {

Modified: trunk/pingus/src/pingus/resource.cpp
===================================================================
--- trunk/pingus/src/pingus/resource.cpp        2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/resource.cpp        2009-11-05 23:10:49 UTC (rev 
4043)
@@ -24,7 +24,7 @@
 #include "pingus/font_description.hpp"
 #include "pingus/res_descriptor.hpp"
 #include "pingus/blitter.hpp"
-#include "pingus/sprite_description.hpp"
+#include "engine/display/sprite_description.hpp"
 #include "pingus/debug.hpp"
 
 ResourceManager Resource::resmgr;

Modified: trunk/pingus/src/pingus/resource.hpp
===================================================================
--- trunk/pingus/src/pingus/resource.hpp        2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/resource.hpp        2009-11-05 23:10:49 UTC (rev 
4043)
@@ -19,8 +19,8 @@
 
 #include <map>
 #include <vector>
-#include "pingus/sprite.hpp"
-#include "pingus/surface.hpp"
+#include "engine/display/sprite.hpp"
+#include "engine/display/surface.hpp"
 #include "pingus/res_descriptor.hpp"
 #include "pingus/resource_manager.hpp"
 #include "pingus/collision_mask.hpp"

Modified: trunk/pingus/src/pingus/resource_manager.cpp
===================================================================
--- trunk/pingus/src/pingus/resource_manager.cpp        2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/resource_manager.cpp        2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -22,7 +22,7 @@
 #include "lisp/lisp.hpp"
 #include "lisp/parser.hpp"
 #include "util/string_util.hpp"
-#include "pingus/sprite_description.hpp"
+#include "engine/display/sprite_description.hpp"
 #include "util/sexpr_file_reader.hpp"
 
 ResourceManager::ResourceManager() :

Modified: trunk/pingus/src/pingus/smallmap_image.hpp
===================================================================
--- trunk/pingus/src/pingus/smallmap_image.hpp  2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/smallmap_image.hpp  2009-11-05 23:10:49 UTC (rev 
4043)
@@ -18,8 +18,8 @@
 #define HEADER_PINGUS_PINGUS_SMALLMAP_IMAGE_HPP
 
 #include "pingus/pingus.hpp"
-#include "pingus/sprite.hpp"
-#include "pingus/surface.hpp"
+#include "engine/display/sprite.hpp"
+#include "engine/display/surface.hpp"
 
 class Server;
 

Deleted: trunk/pingus/src/pingus/sprite.cpp
===================================================================
--- trunk/pingus/src/pingus/sprite.cpp  2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/sprite.cpp  2009-11-05 23:10:49 UTC (rev 4043)
@@ -1,222 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-//  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
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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, see <http://www.gnu.org/licenses/>.
-
-#include "pingus/sprite.hpp"
-
-#include <iostream>
-#include <sstream>
-#include <assert.h>
-#include "SDL.h"
-
-#include "math/origin.hpp"
-#include "math/vector2i.hpp"
-#include "SDL_image.h"
-#include "pingus/blitter.hpp"
-#include "pingus/surface.hpp"
-#include "util/pathname.hpp"
-#include "pingus/resource.hpp"
-#include "pingus/sprite_impl.hpp"
-#include "pingus/sprite_description.hpp"
-
-Sprite::Sprite() :
-  impl()
-{
-}
-
-Sprite::Sprite(const std::string& name) :
-  impl()
-{
-  SpriteDescription* desc = Resource::load_sprite_desc(name);
-  if (desc)
-    {
-      impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(*desc));
-    }
-  else
-    {
-      SpriteDescription desc_;
-      desc_.filename = Pathname("images/core/misc/404.png", 
Pathname::DATA_PATH);
-      impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(desc_));
-    }
-}
-
-Sprite::Sprite(const ResDescriptor& res_desc) :
-  impl()
-{
-  SpriteDescription* desc = Resource::load_sprite_desc(res_desc.res_name);
-  if (desc)
-    {
-      impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(*desc, 
res_desc.modifier));
-    }
-  else
-    {
-      SpriteDescription desc_;
-      desc_.filename = Pathname("images/core/misc/404.png", 
Pathname::DATA_PATH);
-      impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(desc_));
-    } 
-}
-
-Sprite::Sprite(const Pathname& name) :
-  impl()
-{
-  SpriteDescription desc;
-  desc.filename = name;
-  impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(desc));
-}
-
-Sprite::Sprite(const Surface& surface)
-  : impl(new SpriteImpl(surface))
-{  
-}
-
-Sprite::Sprite(const SpriteDescription& desc, 
ResourceModifierNS::ResourceModifier mod)
-  : impl(new SpriteImpl(desc, mod))
-{
-}
-
-Sprite::~Sprite()
-{
-}
-
-void
-Sprite::render(int x, int y, Framebuffer& fb)
-{
-  if (impl.get())
-    impl->render(x, y, fb);
-}
-
-int
-Sprite::get_width() const
-{
-  if (impl.get()) 
-    return impl->frame_size.width;
-  else
-    return 0;
-}
-
-int
-Sprite::get_height() const
-{
-  if (impl.get()) 
-    return impl->frame_size.height;
-  else
-    return 0;
-}
-
-Sprite::operator bool() const
-{
-  return (impl.get() != 0);
-}
-
-void
-Sprite::update(float delta)
-{
-  if (impl.get())
-    impl->update(delta);
-}
-
-void
-Sprite::set_frame(int i)
-{
-  if (impl.get())
-    impl->frame = i;
-}
-
-int
-Sprite::get_frame_count() const
-{
-  if (impl.get())
-    return (impl->array.width * impl->array.height);
-  else
-    return 0;
-}
-
-bool
-Sprite::is_finished() const
-{
-  if (impl.get())
-    return impl->finished;
-  else
-    return true;
-}
-
-bool
-Sprite::is_looping() const
-{
-  if (impl.get())
-    return impl->loop_last_cycle;
-  else
-    return false;
-}
-
-void
-Sprite::set_play_loop(bool loop)
-{
-  if (impl.get())
-    impl->loop = loop;
-}
-
-int
-Sprite::get_current_frame() const
-{
-  if (impl.get())
-    return impl->frame;
-  else
-    return 0;
-}
-
-void
-Sprite::restart()
-{
-  if (impl.get())
-    impl->restart();
-}
-
-void
-Sprite::finish()
-{
-  if (impl.get())
-    impl->finish();
-}
-
-Vector2i
-Sprite::get_offset() const
-{
-  if (impl.get())
-    return impl->offset;
-  else
-    return Vector2i();
-}
-
-void
-Sprite::set_hotspot(Origin origin, int x, int y)
-{
-  if (impl.get())
-    {
-      // FIXME: offset and other stuff should be member of the Sprite, not the 
SpriteImpl
-      impl->offset = calc_origin(origin, impl->frame_size) - Vector2i(x, y);
-    }
-}
-
-Surface
-Sprite::to_surface() const
-{
-  if (impl.get())
-    return impl->to_surface();
-  else
-    return Surface();
-}
-
-/* EOF */

Deleted: trunk/pingus/src/pingus/sprite.hpp
===================================================================
--- trunk/pingus/src/pingus/sprite.hpp  2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/sprite.hpp  2009-11-05 23:10:49 UTC (rev 4043)
@@ -1,71 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-//  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
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_PINGUS_SPRITE_HPP
-#define HEADER_PINGUS_PINGUS_SPRITE_HPP
-
-#include <string>
-#include <boost/shared_ptr.hpp>
-
-#include "math/origin.hpp"
-#include "pingus/resource_modifier.hpp"
-
-class Color;
-class Surface;
-class Pathname;
-class SpriteImpl;
-class SpriteDescription;
-class ResDescriptor;
-class Framebuffer;
-
-class Sprite
-{
-public:
-  Sprite();
-  Sprite(const std::string&   name);
-  Sprite(const ResDescriptor& desc);
-  Sprite(const Pathname& name);
-  Sprite(const SpriteDescription& desc, ResourceModifierNS::ResourceModifier 
mod = ResourceModifierNS::ROT0);
-  Sprite(const Surface& surface);
-  ~Sprite();
-
-  int get_width()  const;
-  int get_height() const;
-
-  void render(int x, int y, Framebuffer& target);
-  void update(float delta = 0.033f);
-
-  void set_hotspot(Origin origin, int x, int y);
-  Vector2i get_offset() const;
-  void set_frame(int i);
-  int  get_frame_count() const;
-  int  get_current_frame() const;
-  bool is_finished() const;
-  bool is_looping() const;
-  void set_play_loop(bool loop = true);
-  void restart();
-  void finish();
-  operator bool() const;
-
-  Surface to_surface() const;
-
-private:
-  boost::shared_ptr<SpriteImpl> impl;
-};
-
-#endif
-
-/* EOF */

Deleted: trunk/pingus/src/pingus/sprite_description.hpp
===================================================================
--- trunk/pingus/src/pingus/sprite_description.hpp      2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/sprite_description.hpp      2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -1,86 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-//  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
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_PINGUS_SPRITE_DESCRIPTION_HPP
-#define HEADER_PINGUS_PINGUS_SPRITE_DESCRIPTION_HPP
-
-#include <iostream>
-#include "math/vector2i.hpp"
-#include "math/size.hpp"
-#include "math/origin.hpp"
-#include "util/file_reader.hpp"
-#include "util/pathname.hpp"
-
-/** */
-class SpriteDescription
-{
-public:
-  Pathname    filename;
-  Vector2i    offset;
-  Origin      origin;
-
-  bool        loop;
-  int         speed; 
-  Size        array;
-  Vector2i    frame_pos;
-  Size        frame_size;  
-
-  SpriteDescription() :
-    filename(),
-    offset(),
-    origin(origin_top_left),
-    loop(true),
-    speed(100),
-    array(1, 1),
-    frame_pos(),
-    frame_size(-1, -1)
-  {}
-
-  SpriteDescription(const FileReader& reader) :
-    filename(),
-    offset(),
-    origin(origin_top_left),
-    loop(true),
-    speed(100),
-    array(1, 1),
-    frame_pos(),
-    frame_size(-1, -1)
-  {
-    reader.read_int   ("speed",  speed);
-    reader.read_bool  ("loop",   loop);
-    reader.read_vector2i("offset", offset);
-
-    reader.read_enum("origin", origin, string2origin);
-    
-    if (!reader.read_path("image-file",  filename))
-      {
-        std::cout << "Error: SpriteDescription: " << reader.get_name() << " 
'image-file' missing" << std::endl;
-      }    
-
-    filename = Pathname("data/" + filename.get_raw_path(), 
filename.get_type()); // FIXME: Hack
-    reader.read_size("image-array", array);
-    reader.read_vector2i("image-pos",   frame_pos);
-    reader.read_size("image-size",  frame_size);
-  }
-
-  ~SpriteDescription()
-  {  
-  }
-};
-
-#endif
-
-/* EOF */

Deleted: trunk/pingus/src/pingus/sprite_impl.cpp
===================================================================
--- trunk/pingus/src/pingus/sprite_impl.cpp     2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/sprite_impl.cpp     2009-11-05 23:10:49 UTC (rev 
4043)
@@ -1,203 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2005-2008 Ingo Ruhnke <address@hidden>
-//
-//  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
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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, see <http://www.gnu.org/licenses/>.
-
-#include "pingus/sprite_impl.hpp"
-
-#include <map>
-#include "engine/display/framebuffer.hpp"
-#include "engine/display/display.hpp"
-#include "pingus/sprite_description.hpp"
-
-typedef std::map<std::string, FramebufferSurface> SurfaceCache;
-SurfaceCache surface_cache;
-
-FramebufferSurface load_framebuffer_surface(const Pathname& filename, 
ResourceModifierNS::ResourceModifier mod)
-{
-  SurfaceCache::iterator i = surface_cache.find(filename.get_sys_path());
-  
-  if (i == surface_cache.end())
-    {
-
-      Surface surface(filename);
-      if (mod != ResourceModifierNS::ROT0)
-        surface = surface.mod(mod);
-
-      if (!surface)
-        {
-          std::cout << "Error: Sprite: couldn't load '" << filename << "'" << 
std::endl;
-          surface = Surface(Pathname("images/core/misc/404.png", 
Pathname::DATA_PATH));
-          if (!surface) assert(!"Surface Couldn't find 404");
-        }
-
-      FramebufferSurface framebuffer_surface = 
Display::get_framebuffer().create_surface(surface);
-
-      surface_cache[filename.get_sys_path()] = framebuffer_surface;
-
-      return framebuffer_surface;
-    }
-  else
-    {
-      //std::cout << "Sharing: " << filename.get_sys_path() << std::endl;
-      return i->second;
-    }
-}
-
-void delete_framebuffer_surface(const Pathname& filename)
-{
-  SurfaceCache::iterator i = surface_cache.find(filename.get_sys_path());
-  if (i != surface_cache.end())
-    {
-      //std::cout << "UseCount for " << filename << ": " << 
i->second.use_count() << std::endl;
-      if (i->second.use_count() == 1)
-        {
-          surface_cache.erase(i);
-        }
-    }
-}
-
-SpriteImpl::SpriteImpl() :
-  filename(),
-  framebuffer_surface(),
-  offset(),
-  frame_pos(),
-  frame_size(),
-  frame_delay(),
-  array(),
-  loop(),
-  loop_last_cycle(),
-  finished(),
-  frame(),
-  tick_count()
-{
-}
-
-SpriteImpl::SpriteImpl(const SpriteDescription& desc, 
ResourceModifierNS::ResourceModifier mod) :
-  filename(desc.filename),
-  framebuffer_surface(),
-  offset(),
-  frame_pos(),
-  frame_size(),
-  frame_delay(),
-  array(),
-  loop(),
-  loop_last_cycle(),
-  finished(false),
-  frame(0),
-  tick_count(0)
-{
-  framebuffer_surface = load_framebuffer_surface(filename, mod);
-
-  frame_pos = desc.frame_pos;
-
-  array = desc.array;
-
-  frame_size.width  = (desc.frame_size.width  == -1) ? 
framebuffer_surface.get_width()/array.width   : desc.frame_size.width;
-  frame_size.height = (desc.frame_size.height == -1) ? 
framebuffer_surface.get_height()/array.height : desc.frame_size.height;
-
-  frame_delay  = desc.speed;
-
-  loop = desc.loop;
-  loop_last_cycle = false;
-
-  offset = calc_origin(desc.origin, frame_size) - desc.offset;
-    
-}
-
-SpriteImpl::SpriteImpl(const Surface& surface) :
-  filename(),
-  framebuffer_surface(Display::get_framebuffer().create_surface(surface)),
-  offset(0,0),
-  frame_pos(0,0),
-  frame_size(surface.get_width(), surface.get_height()),
-  frame_delay(0),
-  array(1,1),
-  loop(true),
-  loop_last_cycle(false),
-  finished(false),
-  frame(0),
-  tick_count(0)
-{
-}
-
-SpriteImpl::~SpriteImpl()
-{
-  if (!filename.empty())
-    {
-      framebuffer_surface = FramebufferSurface();
-      delete_framebuffer_surface(filename);
-    }
-}
-
-void
-SpriteImpl::update(float delta)
-{
-  if (finished)
-    return;
-
-  int total_time = frame_delay * (array.width * array.height);
-  tick_count += int(delta * 1000.0f);
-  if (tick_count >= total_time)
-    {
-      if (loop)
-        {
-          loop_last_cycle = true;
-          tick_count = tick_count % total_time;
-          frame = tick_count / frame_delay;
-        }
-      else
-        {
-          finished = true;
-        }
-    }
-  else
-    {
-      loop_last_cycle = false;
-      frame = tick_count / frame_delay;
-    }
-}
-
-void 
-SpriteImpl::render(int x, int y, Framebuffer& fb)
-{
-  fb.draw_surface(framebuffer_surface,
-                  Rect(frame_pos + Vector2i(frame_size.width  * 
(frame%array.width),
-                                            frame_size.height * 
(frame/array.width)),
-                       frame_size),
-                  Vector2i(x - offset.x, y - offset.y));
-}
-
-void
-SpriteImpl::restart()
-{
-  finished = false;
-  loop_last_cycle = false;
-  frame = 0;
-  tick_count = 0;
-}
-
-void
-SpriteImpl::finish()
-{
-  finished = true;
-}
-
-Surface
-SpriteImpl::to_surface() const
-{
-  return framebuffer_surface.to_surface();
-}
-
-/* EOF */

Deleted: trunk/pingus/src/pingus/sprite_impl.hpp
===================================================================
--- trunk/pingus/src/pingus/sprite_impl.hpp     2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/sprite_impl.hpp     2009-11-05 23:10:49 UTC (rev 
4043)
@@ -1,69 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2005-2008 Ingo Ruhnke <address@hidden>
-//
-//  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
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_PINGUS_SPRITE_IMPL_HPP
-#define HEADER_PINGUS_PINGUS_SPRITE_IMPL_HPP
-
-#include "pingus/surface.hpp"
-#include "engine/display/framebuffer_surface.hpp"
-#include "math/vector2i.hpp"
-
-class SpriteDescription;
-class Framebuffer;
-
-class SpriteImpl
-{
-private:
-  friend class Sprite;
-
-  Pathname filename;
-  FramebufferSurface framebuffer_surface;
-
-  Vector2i offset;
-
-  Vector2i frame_pos;
-  Size     frame_size;
-  int      frame_delay;
-
-  Size     array;
-
-  bool     loop;
-  bool     loop_last_cycle;
-  bool     finished;
-
-  /** Current frame */
-  int frame; 
-  int tick_count;
-
-public:
-  SpriteImpl();
-  SpriteImpl(const SpriteDescription& desc, 
ResourceModifierNS::ResourceModifier mod = ResourceModifierNS::ROT0);
-  SpriteImpl(const Surface& surface_);
-  ~SpriteImpl();
-
-  void update(float delta);
-
-  void render(int x, int y, Framebuffer& fb);
-
-  void restart();
-  void finish();
-
-  Surface to_surface() const;
-};
-
-#endif
-
-/* EOF */

Modified: trunk/pingus/src/pingus/state_sprite.hpp
===================================================================
--- trunk/pingus/src/pingus/state_sprite.hpp    2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/state_sprite.hpp    2009-11-05 23:10:49 UTC (rev 
4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_PINGUS_STATE_SPRITE_HPP
 
 #include <map>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 /** Simple Wrapper class around Sprite that allows to have multiple
     sprites for different states (running, walking, left, right) */

Deleted: trunk/pingus/src/pingus/surface.cpp
===================================================================
--- trunk/pingus/src/pingus/surface.cpp 2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/surface.cpp 2009-11-05 23:10:49 UTC (rev 4043)
@@ -1,371 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-//  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
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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, see <http://www.gnu.org/licenses/>.
-
-#include "pingus/surface.hpp"
-
-#include "SDL_image.h"
-#include <boost/format.hpp>
-#include <sstream>
-#include <iostream>
-#include "math/rect.hpp"
-#include "pingus/debug.hpp"
-#include "pingus/blitter.hpp"
-
-class SurfaceImpl
-{
-public:
-  SDL_Surface* surface;
-
-  SurfaceImpl()
-    : surface(0)
-  {}
-
-  SurfaceImpl(SDL_Surface* surface_) :
-    surface(surface_)
-  {}
-  
-  ~SurfaceImpl() 
-  {
-    if (surface)
-      SDL_FreeSurface(surface);
-  }
-
-private:
-  SurfaceImpl(const SurfaceImpl&);
-  SurfaceImpl & operator=(const SurfaceImpl&);
-};
-
-Surface::Surface() :
-  impl()
-{
-}
-
-Surface::Surface(boost::shared_ptr<SurfaceImpl> impl_) :
-  impl(impl_)
-{
-}
-
-Surface::Surface(const Pathname& pathname) :
-  impl()
-{
-  SDL_Surface* surface = IMG_Load(pathname.get_sys_path().c_str());
-  if (surface)
-    {
-      impl = boost::shared_ptr<SurfaceImpl>(new SurfaceImpl(surface));
-    }
-}
-
-Surface::Surface(int width, int height, SDL_Palette* palette, int colorkey)
-  : impl(new SurfaceImpl())
-{
-  if (colorkey == -1)
-    {
-      impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 8,
-                                           0, 0, 0 ,0);
-    }
-  else
-    {
-      impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCCOLORKEY, 
width, height, 8,
-                                           0, 0, 0 ,0);
-      SDL_SetColorKey(impl->surface, SDL_SRCCOLORKEY, colorkey);
-    }
-
-  SDL_SetColors(impl->surface, palette->colors, 0, palette->ncolors);
-}
-
-Surface::Surface(int width, int height)
-  : impl(new SurfaceImpl())
-{
-  impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, width, 
height, 32,
-                                       0x000000ff,
-                                       0x0000ff00,
-                                       0x00ff0000,
-                                       0xff000000);
-  //SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 0, 0, 0, 0));
-}
-
-Surface::Surface(SDL_Surface* surface)
-  : impl(new SurfaceImpl(surface))
-{
-}
-
-Surface::~Surface()
-{
-}
-
-void
-Surface::blit(const Surface& src, int x, int y)
-{
-  if (!get_surface())
-    {
-      std::cout << "Surface: Trying to blit to empty surface" << std::endl;
-    }
-  else if (!src.get_surface())
-    {
-      std::cout << "Surface: Trying to blit with an empty surface" << 
std::endl;
-    }
-  else
-    {
-      SDL_Rect dstrect;
-
-      dstrect.x = static_cast<Sint16>(x);
-      dstrect.y = static_cast<Sint16>(y);
-
-      SDL_BlitSurface(src.get_surface(), NULL, get_surface(), &dstrect);
-    }
-}
-
-void
-Surface::lock()
-{
-  SDL_LockSurface(get_surface());
-}
-
-void
-Surface::unlock()
-{
-  SDL_UnlockSurface(get_surface());
-}
-
-uint8_t*
-Surface::get_data() const
-{
-  return static_cast<uint8_t*>(get_surface()->pixels);
-}
-
-Size
-Surface::get_size()  const
-{
-  if (get_surface())
-    return Size(impl->surface->w, impl->surface->h);
-  else
-    return Size();
-}
-
-int
-Surface::get_width()  const
-{
-  if (get_surface())
-    return get_surface()->w;
-  else
-    return 0;
-}
-
-int
-Surface::get_height() const
-{
-  if (get_surface())
-    return get_surface()->h;
-  else
-    return 0;
-}
-
-int
-Surface::get_pitch() const
-{
-  if (get_surface())
-    return get_surface()->pitch;
-  else
-    return 0;
-}
-
-SDL_Surface* 
-Surface::get_surface() const
-{
-  return impl ? impl->surface : 0;
-}
-
-Surface::operator bool() const
-{
-  return impl ? impl->surface != NULL : false;
-}
-
-Color
-Surface::get_pixel(int x, int y) const
-{
-  Uint8 *p = (Uint8 *)get_surface()->pixels + y * get_surface()->pitch + x * 
get_surface()->format->BytesPerPixel;
-  Uint32 pixel;
-
-  switch(get_surface()->format->BytesPerPixel)
-    {
-    case 1:
-      pixel = *p;
-    case 2: /* This will cause some problems ... */
-      pixel = *(Uint16 *)p;
-    case 3:
-      if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
-       pixel = p[0] << 16 | p[1] << 8 | p[2];
-      else
-       pixel = p[0] | p[1] << 8 | p[2] << 16;
-    case 4:
-      pixel = *(Uint32 *)p;
-    default:
-      pixel = 0;       /* shouldn't happen, but avoids warnings */
-    } 
-
-  Color color;
-  SDL_GetRGBA(pixel, get_surface()->format, &color.r, &color.g, &color.b, 
&color.a);
-  return color;
-}
-
-Surface
-Surface::mod(ResourceModifierNS::ResourceModifier modifier)
-{
-  switch(modifier)
-    {
-      case ResourceModifierNS::ROT0:
-        return this->clone();
-
-      case ResourceModifierNS::ROT90:
-        return Blitter::rotate_90(*this);
-
-      case ResourceModifierNS::ROT180:
-        return Blitter::rotate_180(*this);
-
-      case ResourceModifierNS::ROT270:
-        return Blitter::rotate_270(*this);
-
-      case ResourceModifierNS::ROT0FLIP:
-        return Blitter::flip_horizontal(*this);
-
-      case ResourceModifierNS::ROT90FLIP:
-        return Blitter::rotate_90_flip(*this);
-
-      case ResourceModifierNS::ROT180FLIP:
-        return Blitter::rotate_180_flip(*this);
-
-      case ResourceModifierNS::ROT270FLIP:
-        return Blitter::rotate_270_flip(*this);
-
-      default:
-        perr << "Surface: unhandled modifier: " << modifier << std::endl;
-        return *this;
-    }
-}
-
-Surface
-Surface::scale(int w, int h)
-{
-  return Surface(boost::shared_ptr<SurfaceImpl>
-                 (new SurfaceImpl(Blitter::scale_surface(impl->surface, w, 
h))));
-}
-
-Surface
-Surface::clone() const
-{
-  SDL_Surface* new_surface = 
Blitter::create_surface_from_format(impl->surface, 
-                                                                 
impl->surface->w, impl->surface->h);
-  if (impl->surface->flags & SDL_SRCALPHA)
-    {
-      Uint8 alpha = impl->surface->format->alpha;
-      SDL_SetAlpha(impl->surface, 0, 0);
-      SDL_BlitSurface(impl->surface, NULL, new_surface, NULL);
-      SDL_SetAlpha(impl->surface, SDL_SRCALPHA, alpha);
-    }
-  else
-    {
-      SDL_BlitSurface(impl->surface, NULL, new_surface, NULL);
-    }
- 
-  return Surface(boost::shared_ptr<SurfaceImpl>(new SurfaceImpl(new_surface)));
-}
-
-Surface
-Surface::subsection(const Rect& rect) const
-{
-  SDL_Surface* new_surface;
-  new_surface = Blitter::create_surface_from_format(impl->surface,
-                                                    rect.get_width(), 
rect.get_height());
-  SDL_Rect dst_rect;
-  dst_rect.x = static_cast<Sint16>(rect.left);
-  dst_rect.y = static_cast<Sint16>(rect.top);
-
-  if (impl->surface->format->palette)
-    SDL_SetPalette(new_surface, SDL_LOGPAL, 
impl->surface->format->palette->colors, 
-                   0, impl->surface->format->palette->ncolors);
-
-  if (impl->surface->flags & SDL_SRCCOLORKEY)
-    SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY, 
impl->surface->format->colorkey);
-
-  SDL_BlitSurface(impl->surface, NULL, new_surface, &dst_rect);
-
-  return Surface(boost::shared_ptr<SurfaceImpl>(new SurfaceImpl(new_surface)));
-}
-
-void
-Surface::fill(const Color& color)
-{
-  // FIXME: Couldn't get this to work with a RGBA surface for some
-  // reason, something to do with tmp format and impl->surface
-  // matching up maybe, anyway with RGB it works and it saves a
-  // little bit of space to
-  // FIXME: sould/should use a proper RGBA rect_fill function, this is just a 
work around
-  SDL_Surface* tmp = Blitter::create_surface_rgb(impl->surface->w, 
impl->surface->h);
-  SDL_FillRect(tmp, NULL, SDL_MapRGBA(tmp->format, color.r, color.g, color.b, 
255));
-  SDL_SetAlpha(tmp, SDL_SRCALPHA, color.a);
-          
-  SDL_BlitSurface(tmp, NULL, impl->surface, NULL);
-
-  SDL_FreeSurface(tmp);
-}
-
-void
-Surface::print(std::ostream& out)
-{
-  out << boost::format("Pointer: 0x%p\n"
-                       "Rmask:   0x%08x\n"
-                       "Gmask:   0x%08x\n"
-                       "Bmask:   0x%08x\n"
-                       "Amask:   0x%08x\n"
-                       "Flags:   0x%08x -> %s%s%s%s\n"
-                       "Palette: 0x%08x\n"
-                       "BitsPerPixel: %d\n"
-                       )
-    % impl->surface
-    % impl->surface->format->Rmask
-    % impl->surface->format->Gmask
-    % impl->surface->format->Bmask
-    % impl->surface->format->Amask
-    % impl->surface->flags
-    % ((impl->surface->flags & SDL_HWSURFACE) ? "HWSURFACE " : "")
-    % ((impl->surface->flags & SDL_SWSURFACE) ? "SWSURFACE " : "")
-    % ((impl->surface->flags & SDL_SRCCOLORKEY) ? "SRCCOLORKEY " : "")
-    % ((impl->surface->flags & SDL_SRCALPHA) ? "SRCALPHA " : "")
-    % impl->surface->format->palette
-    % static_cast<int>(impl->surface->format->BitsPerPixel);
-
-  if (impl->surface->flags & SDL_SRCCOLORKEY)
-    out << "Colorkey: " << (int)impl->surface->format->colorkey << std::endl;
-
-  if (impl->surface->flags & SDL_SRCALPHA)
-    out << "Alpha: " << (int)impl->surface->format->alpha << std::endl;
-
-  if (0)
-    {
-      SDL_LockSurface(impl->surface);
-      Uint8* pixels = static_cast<Uint8*>(impl->surface->pixels);
-      for(int i = 0; i < impl->surface->pitch * impl->surface->h; i += 4)
-        out << boost::format("(%3d %3d %3d %3d) ")
-          % (int)pixels[i+0]
-          % (int)pixels[i+1]
-          % (int)pixels[i+2]
-          % (int)pixels[i+3];
-      out << std::endl;
-      SDL_UnlockSurface(impl->surface);
-    }
-}
-
-/* EOF */

Deleted: trunk/pingus/src/pingus/surface.hpp
===================================================================
--- trunk/pingus/src/pingus/surface.hpp 2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/surface.hpp 2009-11-05 23:10:49 UTC (rev 4043)
@@ -1,84 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2005 Ingo Ruhnke <address@hidden>
-//
-//  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
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_PINGUS_SURFACE_HPP
-#define HEADER_PINGUS_PINGUS_SURFACE_HPP
-
-#include "SDL.h"
-#include <string>
-#include <boost/shared_ptr.hpp>
-#include "math/size.hpp"
-#include "pingus/resource_modifier.hpp"
-#include "util/pathname.hpp"
-#include "math/color.hpp"
-
-class Rect;
-class Pathname;
-class SurfaceImpl;
-
-class Surface
-{
-public:
-  Surface();
-
-  Surface(boost::shared_ptr<SurfaceImpl> impl);
-
-  Surface(const Pathname& name);
-
-  /** Create an empty RGBA Surface */
-  Surface(int width, int height);
-
-  /** Create an empty Indexed Surface (8bit) */
-  Surface(int width, int height, SDL_Palette* palette, int colorkey = -1);
-
-  /** Create a Surface from a SDL_Surface */
-  Surface(SDL_Surface* surface);
-
-  ~Surface();
-
-  uint8_t* get_data() const;
-  void lock();
-  void unlock();
-
-  Size get_size()   const;
-  int  get_width()  const;
-  int  get_height() const;
-  int  get_pitch()  const;
-
-  void blit(const Surface& src, int x, int y);
-
-  Color get_pixel(int x, int y) const;
-
-  void fill(const Color& color);
-
-  Surface scale(int w, int h);
-  Surface mod(ResourceModifierNS::ResourceModifier mod);
-  Surface clone() const;
-  Surface subsection(const Rect& rect) const;
-
-  SDL_Surface* get_surface() const;
-
-  operator bool() const;
-
-  void print(std::ostream& out);
-
-protected:
-  boost::shared_ptr<SurfaceImpl> impl;
-};
-
-#endif
-
-/* EOF */

Modified: trunk/pingus/src/pingus/worldmap/level_dot.hpp
===================================================================
--- trunk/pingus/src/pingus/worldmap/level_dot.hpp      2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/worldmap/level_dot.hpp      2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_WORLDMAP_LEVEL_DOT_HPP
 #define HEADER_PINGUS_WORLDMAP_LEVEL_DOT_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/pingus_level.hpp"
 #include "pingus/worldmap/dot.hpp"
 

Modified: trunk/pingus/src/pingus/worldmap/sprite_drawable.hpp
===================================================================
--- trunk/pingus/src/pingus/worldmap/sprite_drawable.hpp        2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/worldmap/sprite_drawable.hpp        2009-11-05 
23:10:49 UTC (rev 4043)
@@ -17,7 +17,7 @@
 #ifndef HEADER_PINGUS_WORLDMAP_SPRITE_DRAWABLE_HPP
 #define HEADER_PINGUS_WORLDMAP_SPRITE_DRAWABLE_HPP
 
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "math/vector3f.hpp"
 #include "pingus/worldmap/drawable.hpp"
 

Modified: trunk/pingus/src/pingus/worldmap/worldmap.hpp
===================================================================
--- trunk/pingus/src/pingus/worldmap/worldmap.hpp       2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/worldmap/worldmap.hpp       2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_WORLDMAP_WORLDMAP_HPP
 
 #include <vector>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "util/file_reader.hpp"
 #include "engine/display/drawing_context.hpp"
 #include "pingus/graphic_context_state.hpp"

Modified: trunk/pingus/src/pingus/worldmap/worldmap_screen.hpp
===================================================================
--- trunk/pingus/src/pingus/worldmap/worldmap_screen.hpp        2009-11-05 
23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/worldmap/worldmap_screen.hpp        2009-11-05 
23:10:49 UTC (rev 4043)
@@ -19,7 +19,7 @@
 
 #include <string>
 #include <memory>
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "engine/gui/gui_manager.hpp"
 #include "engine/screen/gui_screen.hpp"
 

Modified: trunk/pingus/src/pingus/worldobj.hpp
===================================================================
--- trunk/pingus/src/pingus/worldobj.hpp        2009-11-05 23:04:44 UTC (rev 
4042)
+++ trunk/pingus/src/pingus/worldobj.hpp        2009-11-05 23:10:49 UTC (rev 
4043)
@@ -19,7 +19,7 @@
 
 #include "pingus/pingus.hpp"
 #include "util/file_reader.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "pingus/collision_mask.hpp"
 
 class FileReader;

Modified: trunk/pingus/src/pingus/worldobjs/laser_exit.hpp
===================================================================
--- trunk/pingus/src/pingus/worldobjs/laser_exit.hpp    2009-11-05 23:04:44 UTC 
(rev 4042)
+++ trunk/pingus/src/pingus/worldobjs/laser_exit.hpp    2009-11-05 23:10:49 UTC 
(rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_WORLDOBJS_LASER_EXIT_HPP
 
 #include "pingus/worldobj.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 #include "math/vector3f.hpp"
 
 namespace WorldObjsData {

Modified: trunk/pingus/src/pingus/worldobjs/starfield_background_stars.hpp
===================================================================
--- trunk/pingus/src/pingus/worldobjs/starfield_background_stars.hpp    
2009-11-05 23:04:44 UTC (rev 4042)
+++ trunk/pingus/src/pingus/worldobjs/starfield_background_stars.hpp    
2009-11-05 23:10:49 UTC (rev 4043)
@@ -18,7 +18,7 @@
 #define HEADER_PINGUS_WORLDOBJS_STARFIELD_BACKGROUND_STARS_HPP
 
 #include "pingus/worldobj.hpp"
-#include "pingus/sprite.hpp"
+#include "engine/display/sprite.hpp"
 
 namespace WorldObjs {
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]