pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3830 - trunk/pingus/src/display


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3830 - trunk/pingus/src/display
Date: Wed, 16 Jul 2008 09:28:40 +0200

Author: grumbel
Date: 2008-07-16 09:28:39 +0200 (Wed, 16 Jul 2008)
New Revision: 3830

Added:
   trunk/pingus/src/display/framebuffer_surface.cpp
   trunk/pingus/src/display/framebuffer_surface.hpp
   trunk/pingus/src/display/sdl_framebuffer_surface_impl.cpp
   trunk/pingus/src/display/sdl_framebuffer_surface_impl.hpp
Modified:
   trunk/pingus/src/display/delta_framebuffer.cpp
   trunk/pingus/src/display/delta_framebuffer.hpp
   trunk/pingus/src/display/framebuffer.hpp
   trunk/pingus/src/display/sdl_framebuffer.cpp
   trunk/pingus/src/display/sdl_framebuffer.hpp
Log:
Added FramebufferSurface class

Modified: trunk/pingus/src/display/delta_framebuffer.cpp
===================================================================
--- trunk/pingus/src/display/delta_framebuffer.cpp      2008-07-15 20:43:29 UTC 
(rev 3829)
+++ trunk/pingus/src/display/delta_framebuffer.cpp      2008-07-16 07:28:39 UTC 
(rev 3830)
@@ -150,6 +150,12 @@
 {
 }
 
+FramebufferSurface
+DeltaFramebuffer::create_surface(SDL_Surface* surface)
+{
+  return framebuffer->create_surface(surface);
+}
+
 void
 DeltaFramebuffer::set_video_mode(const Size& size, bool fullscreen)
 {

Modified: trunk/pingus/src/display/delta_framebuffer.hpp
===================================================================
--- trunk/pingus/src/display/delta_framebuffer.hpp      2008-07-15 20:43:29 UTC 
(rev 3829)
+++ trunk/pingus/src/display/delta_framebuffer.hpp      2008-07-16 07:28:39 UTC 
(rev 3830)
@@ -35,6 +35,8 @@
 public:
   DeltaFramebuffer();
 
+  FramebufferSurface create_surface(SDL_Surface* surface);
+
   void set_video_mode(const Size& size, bool fullscreen);
   void flip();
 

Modified: trunk/pingus/src/display/framebuffer.hpp
===================================================================
--- trunk/pingus/src/display/framebuffer.hpp    2008-07-15 20:43:29 UTC (rev 
3829)
+++ trunk/pingus/src/display/framebuffer.hpp    2008-07-16 07:28:39 UTC (rev 
3830)
@@ -23,10 +23,13 @@
 #include "math/vector2i.hpp"
 #include "math/size.hpp"
 #include "math/rect.hpp"
+#include "framebuffer_surface.hpp"
 
 class Framebuffer
 {
 public:
+  virtual FramebufferSurface create_surface(SDL_Surface* surface) =0;
+
   virtual void set_video_mode(const Size& size, bool fullscreen) =0;
   virtual void flip() =0;
 

Added: trunk/pingus/src/display/framebuffer_surface.cpp
===================================================================
--- trunk/pingus/src/display/framebuffer_surface.cpp    2008-07-15 20:43:29 UTC 
(rev 3829)
+++ trunk/pingus/src/display/framebuffer_surface.cpp    2008-07-16 07:28:39 UTC 
(rev 3830)
@@ -0,0 +1,21 @@
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 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 "framebuffer_surface.hpp"
+
+
+
+/* EOF */


Property changes on: trunk/pingus/src/display/framebuffer_surface.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/display/framebuffer_surface.hpp
===================================================================
--- trunk/pingus/src/display/framebuffer_surface.hpp    2008-07-15 20:43:29 UTC 
(rev 3829)
+++ trunk/pingus/src/display/framebuffer_surface.hpp    2008-07-16 07:28:39 UTC 
(rev 3830)
@@ -0,0 +1,45 @@
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 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_FRAMEBUFFER_SURFACE_HPP
+#define HEADER_FRAMEBUFFER_SURFACE_HPP
+
+#include <boost/smart_ptr.hpp>
+
+class FramebufferSurfaceImpl
+{
+public:
+  virtual int get_width()  const =0;
+  virtual int get_height() const =0;
+};
+
+/** */
+class FramebufferSurface
+{
+public:
+  FramebufferSurface(FramebufferSurfaceImpl* impl) : impl(impl) {}
+  ~FramebufferSurface() {}
+
+  int get_width()  const { return impl->get_width();  }
+  int get_height() const { return impl->get_height(); }
+
+private:
+  boost::shared_ptr<FramebufferSurfaceImpl> impl;
+};
+
+#endif
+
+/* EOF */


Property changes on: trunk/pingus/src/display/framebuffer_surface.hpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: trunk/pingus/src/display/sdl_framebuffer.cpp
===================================================================
--- trunk/pingus/src/display/sdl_framebuffer.cpp        2008-07-15 20:43:29 UTC 
(rev 3829)
+++ trunk/pingus/src/display/sdl_framebuffer.cpp        2008-07-16 07:28:39 UTC 
(rev 3830)
@@ -18,6 +18,7 @@
 #include "../math.hpp"
 #include "display.hpp"
 #include "sdl_framebuffer.hpp"
+#include "sdl_framebuffer_surface_impl.hpp"
 
 namespace {
 
@@ -145,6 +146,12 @@
 {
 }
 
+FramebufferSurface
+SDLFramebuffer::create_surface(SDL_Surface* surface)
+{
+  return FramebufferSurface(new SDLFramebufferSurfaceImpl(surface));
+}
+
 void
 SDLFramebuffer::draw_surface(SDL_Surface* src, const Vector2i& pos)
 {

Modified: trunk/pingus/src/display/sdl_framebuffer.hpp
===================================================================
--- trunk/pingus/src/display/sdl_framebuffer.hpp        2008-07-15 20:43:29 UTC 
(rev 3829)
+++ trunk/pingus/src/display/sdl_framebuffer.hpp        2008-07-16 07:28:39 UTC 
(rev 3830)
@@ -34,6 +34,8 @@
   SDLFramebuffer();
   ~SDLFramebuffer();
 
+  FramebufferSurface create_surface(SDL_Surface* surface);
+
   void set_video_mode(const Size& size, bool fullscreen);
   void flip();
   void update_rects(const std::vector<Rect>& rects);

Added: trunk/pingus/src/display/sdl_framebuffer_surface_impl.cpp
===================================================================
--- trunk/pingus/src/display/sdl_framebuffer_surface_impl.cpp   2008-07-15 
20:43:29 UTC (rev 3829)
+++ trunk/pingus/src/display/sdl_framebuffer_surface_impl.cpp   2008-07-16 
07:28:39 UTC (rev 3830)
@@ -0,0 +1,30 @@
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 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 "sdl_framebuffer_surface_impl.hpp"
+
+SDLFramebufferSurfaceImpl::SDLFramebufferSurfaceImpl(SDL_Surface* src)
+{
+  surface = SDL_DisplayFormat(src);
+  //surface = SDL_DisplayFormatAlpha();;
+}
+
+SDLFramebufferSurfaceImpl::~SDLFramebufferSurfaceImpl()
+{
+  SDL_FreeSurface(surface);
+}
+
+/* EOF */


Property changes on: trunk/pingus/src/display/sdl_framebuffer_surface_impl.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/pingus/src/display/sdl_framebuffer_surface_impl.hpp
===================================================================
--- trunk/pingus/src/display/sdl_framebuffer_surface_impl.hpp   2008-07-15 
20:43:29 UTC (rev 3829)
+++ trunk/pingus/src/display/sdl_framebuffer_surface_impl.hpp   2008-07-16 
07:28:39 UTC (rev 3830)
@@ -0,0 +1,39 @@
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 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_SDL_FRAMEBUFFER_SURFACE_IMPL_HPP
+#define HEADER_SDL_FRAMEBUFFER_SURFACE_IMPL_HPP
+
+#include "SDL.h"
+#include "framebuffer_surface.hpp"
+
+/** */
+class SDLFramebufferSurfaceImpl : public FramebufferSurfaceImpl
+{
+private:
+  SDL_Surface* surface;
+  
+public:
+  SDLFramebufferSurfaceImpl(SDL_Surface* src);
+  ~SDLFramebufferSurfaceImpl(); 
+
+  int get_width()  const { return surface->w; }
+  int get_height() const { return surface->h; }
+};
+
+#endif
+
+/* EOF */


Property changes on: trunk/pingus/src/display/sdl_framebuffer_surface_impl.hpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native





reply via email to

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