[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3896 - in trunk/pingus/src: . display
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3896 - in trunk/pingus/src: . display |
Date: |
Tue, 22 Jul 2008 22:03:21 +0200 |
Author: grumbel
Date: 2008-07-22 22:03:19 +0200 (Tue, 22 Jul 2008)
New Revision: 3896
Added:
trunk/pingus/src/display/null_framebuffer.cpp
trunk/pingus/src/display/null_framebuffer.hpp
Modified:
trunk/pingus/src/display/display.cpp
trunk/pingus/src/globals.hpp
trunk/pingus/src/pingus_main.cpp
Log:
Added NullFramebuffer to run Pingus without a display
Modified: trunk/pingus/src/display/display.cpp
===================================================================
--- trunk/pingus/src/display/display.cpp 2008-07-22 19:26:05 UTC (rev
3895)
+++ trunk/pingus/src/display/display.cpp 2008-07-22 20:03:19 UTC (rev
3896)
@@ -25,6 +25,7 @@
#include "../screen/screen_manager.hpp"
#include "sdl_framebuffer.hpp"
#include "opengl_framebuffer.hpp"
+#include "null_framebuffer.hpp"
#include "delta_framebuffer.hpp"
#include "display.hpp"
@@ -83,6 +84,10 @@
framebuffer = std::auto_ptr<Framebuffer>(new OpenGLFramebuffer());
break;
+ case NULL_FRAMEBUFFER:
+ framebuffer = std::auto_ptr<Framebuffer>(new NullFramebuffer());
+ break;
+
case DELTA_FRAMEBUFFER:
static_graphics = true;
framebuffer = std::auto_ptr<Framebuffer>(new DeltaFramebuffer());
Added: trunk/pingus/src/display/null_framebuffer.cpp
===================================================================
--- trunk/pingus/src/display/null_framebuffer.cpp 2008-07-22 19:26:05 UTC
(rev 3895)
+++ trunk/pingus/src/display/null_framebuffer.cpp 2008-07-22 20:03:19 UTC
(rev 3896)
@@ -0,0 +1,102 @@
+// 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 <iostream>
+#include "null_framebuffer.hpp"
+
+class NullFramebufferSurfaceImpl : public FramebufferSurfaceImpl
+{
+private:
+ Size size;
+
+public:
+ NullFramebufferSurfaceImpl(const Size& size_) : size(size_) {}
+ ~NullFramebufferSurfaceImpl() {}
+
+ int get_width() const { return size.width; }
+ int get_height() const { return size.height; }
+ Surface to_surface() const { return Surface(); }
+};
+
+NullFramebuffer::NullFramebuffer()
+{
+}
+
+NullFramebuffer::~NullFramebuffer()
+{
+}
+
+FramebufferSurface
+NullFramebuffer::create_surface(const Surface& surface)
+{
+ std::cout << "Creating surface: " << surface.get_size() << std::endl;
+ return FramebufferSurface(new
NullFramebufferSurfaceImpl(surface.get_size()));
+}
+
+void
+NullFramebuffer::set_video_mode(const Size& size_, bool fullscreen)
+{
+ size = size_;
+ std::cout << "Size: " << size.width << "x" << size.height << " fullscreen: "
<< fullscreen << std::endl;
+}
+
+void
+NullFramebuffer::flip()
+{
+}
+
+void
+NullFramebuffer::push_cliprect(const Rect&)
+{
+}
+
+void
+NullFramebuffer::pop_cliprect()
+{
+}
+
+void
+NullFramebuffer::draw_surface(const FramebufferSurface& src, const Vector2i&
pos)
+{
+}
+
+void
+NullFramebuffer::draw_surface(const FramebufferSurface& src, const Rect&
srcrect, const Vector2i& pos)
+{
+}
+
+void
+NullFramebuffer::draw_line(const Vector2i& pos1, const Vector2i& pos2, const
Color& color)
+{
+}
+
+void
+NullFramebuffer::draw_rect(const Rect& rect, const Color& color)
+{
+}
+
+void
+NullFramebuffer::fill_rect(const Rect& rect, const Color& color)
+{
+}
+
+Size
+NullFramebuffer::get_size() const
+{
+ return size;
+}
+
+/* EOF */
Property changes on: trunk/pingus/src/display/null_framebuffer.cpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/pingus/src/display/null_framebuffer.hpp
===================================================================
--- trunk/pingus/src/display/null_framebuffer.hpp 2008-07-22 19:26:05 UTC
(rev 3895)
+++ trunk/pingus/src/display/null_framebuffer.hpp 2008-07-22 20:03:19 UTC
(rev 3896)
@@ -0,0 +1,53 @@
+// 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_NULL_FRAMEBUFFER_HPP
+#define HEADER_NULL_FRAMEBUFFER_HPP
+
+#include "framebuffer.hpp"
+
+/** NullFramebuffer is an empty dummy class for debugging purposes */
+class NullFramebuffer : public Framebuffer
+{
+private:
+ Size size;
+
+public:
+ NullFramebuffer();
+ ~NullFramebuffer();
+
+ FramebufferSurface create_surface(const Surface& surface);
+
+ void set_video_mode(const Size& size, bool fullscreen);
+ void flip();
+
+ void push_cliprect(const Rect&);
+ void pop_cliprect();
+
+ void draw_surface(const FramebufferSurface& src, const Vector2i& pos);
+ void draw_surface(const FramebufferSurface& src, const Rect& srcrect, const
Vector2i& pos);
+
+ void draw_line(const Vector2i& pos1, const Vector2i& pos2, const Color&
color);
+
+ void draw_rect(const Rect& rect, const Color& color);
+ void fill_rect(const Rect& rect, const Color& color);
+
+ Size get_size() const;
+};
+
+#endif
+
+/* EOF */
Property changes on: trunk/pingus/src/display/null_framebuffer.hpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: trunk/pingus/src/globals.hpp
===================================================================
--- trunk/pingus/src/globals.hpp 2008-07-22 19:26:05 UTC (rev 3895)
+++ trunk/pingus/src/globals.hpp 2008-07-22 20:03:19 UTC (rev 3896)
@@ -51,7 +51,7 @@
extern std::string default_language; ///< The default
language, which is used when the env var LANG is not set
extern unsigned int pingus_debug_flags; ///< Set some bits in
this thing to get debug infos
-enum FramebufferType { DELTA_FRAMEBUFFER, SDL_FRAMEBUFFER, OPENGL_FRAMEBUFFER
};
+enum FramebufferType { DELTA_FRAMEBUFFER, SDL_FRAMEBUFFER, NULL_FRAMEBUFFER,
OPENGL_FRAMEBUFFER };
extern FramebufferType framebuffer_type;
enum { PINGUS_DEBUG_ACTIONS = (1 << 0),
Modified: trunk/pingus/src/pingus_main.cpp
===================================================================
--- trunk/pingus/src/pingus_main.cpp 2008-07-22 19:26:05 UTC (rev 3895)
+++ trunk/pingus/src/pingus_main.cpp 2008-07-22 20:03:19 UTC (rev 3896)
@@ -314,6 +314,10 @@
{
framebuffer_type = OPENGL_FRAMEBUFFER;
}
+ else if (argp.get_argument() == "null")
+ {
+ framebuffer_type = NULL_FRAMEBUFFER;
+ }
else if (argp.get_argument() == "sdl")
{
framebuffer_type = SDL_FRAMEBUFFER;
@@ -324,6 +328,7 @@
std::cout << " delta: Software rendering with
dirty-rectangles (default)" << std::endl;
std::cout << " sdl: Software rendering" << std::endl;
std::cout << " opengl: Hardware accelerated graphics" <<
std::endl;
+ std::cout << " null: No rendering at all, for debugging" <<
std::endl;
exit(EXIT_SUCCESS);
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3896 - in trunk/pingus/src: . display,
grumbel at BerliOS <=