[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3265 - in trunk/pingus/src: . components display editor gu
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3265 - in trunk/pingus/src: . components display editor gui input input_old screen worldmap worldobjs |
Date: |
Sun, 30 Sep 2007 18:07:13 +0200 |
Author: grumbel
Date: 2007-09-30 18:07:08 +0200 (Sun, 30 Sep 2007)
New Revision: 3265
Added:
trunk/pingus/src/display/cursor.cpp
trunk/pingus/src/display/cursor.hpp
trunk/pingus/src/display/display.cpp
trunk/pingus/src/display/display.hpp
trunk/pingus/src/screen/
trunk/pingus/src/screen/game_delta.hpp
trunk/pingus/src/screen/gui_screen.cpp
trunk/pingus/src/screen/gui_screen.hpp
trunk/pingus/src/screen/input_debug_screen.cpp
trunk/pingus/src/screen/input_debug_screen.hpp
trunk/pingus/src/screen/screen.cpp
trunk/pingus/src/screen/screen.hpp
trunk/pingus/src/screen/screen_manager.cpp
trunk/pingus/src/screen/screen_manager.hpp
trunk/pingus/src/screen/screen_manager_impl.hpp
trunk/pingus/src/screen/screen_ptr.cpp
trunk/pingus/src/screen/screen_ptr.hpp
Removed:
trunk/pingus/src/gui/cursor.cpp
trunk/pingus/src/gui/cursor.hpp
trunk/pingus/src/gui/display.cpp
trunk/pingus/src/gui/display.hpp
trunk/pingus/src/gui/game_delta.hpp
trunk/pingus/src/gui/gui_screen.cpp
trunk/pingus/src/gui/gui_screen.hpp
trunk/pingus/src/gui/input_debug_screen.cpp
trunk/pingus/src/gui/input_debug_screen.hpp
trunk/pingus/src/gui/root_gui_manager.cpp
trunk/pingus/src/gui/root_gui_manager.hpp
trunk/pingus/src/gui/screen.cpp
trunk/pingus/src/gui/screen.hpp
trunk/pingus/src/gui/screen_manager.cpp
trunk/pingus/src/gui/screen_manager.hpp
trunk/pingus/src/gui/screen_manager_impl.hpp
trunk/pingus/src/gui/screen_ptr.cpp
trunk/pingus/src/gui/screen_ptr.hpp
Modified:
trunk/pingus/src/client.cpp
trunk/pingus/src/client.hpp
trunk/pingus/src/components/action_button.cpp
trunk/pingus/src/components/hurry_up.cpp
trunk/pingus/src/components/pingus_counter.cpp
trunk/pingus/src/components/playfield.cpp
trunk/pingus/src/components/smallmap.cpp
trunk/pingus/src/components/time_display.cpp
trunk/pingus/src/console.hpp
trunk/pingus/src/credits.cpp
trunk/pingus/src/credits.hpp
trunk/pingus/src/demo_session.hpp
trunk/pingus/src/display/drawing_context.cpp
trunk/pingus/src/display/scene_context.cpp
trunk/pingus/src/dummy_screen.hpp
trunk/pingus/src/editor/editor_panel.cpp
trunk/pingus/src/editor/editor_screen.cpp
trunk/pingus/src/editor/editor_screen.hpp
trunk/pingus/src/editor/editor_viewport.cpp
trunk/pingus/src/editor/level_head.cpp
trunk/pingus/src/editor/level_objs.cpp
trunk/pingus/src/editor/object_selector.cpp
trunk/pingus/src/editor/panel.cpp
trunk/pingus/src/font.cpp
trunk/pingus/src/font_test_screen.cpp
trunk/pingus/src/font_test_screen.hpp
trunk/pingus/src/fps_counter.hpp
trunk/pingus/src/game_session.cpp
trunk/pingus/src/game_session.hpp
trunk/pingus/src/global_event.cpp
trunk/pingus/src/graphic_context_state.cpp
trunk/pingus/src/gui/gui_manager.cpp
trunk/pingus/src/input/sdl_driver.cpp
trunk/pingus/src/input_old/controller.cpp
trunk/pingus/src/layer_manager.hpp
trunk/pingus/src/pingus_main.cpp
trunk/pingus/src/pingus_menu.cpp
trunk/pingus/src/pingus_menu_manager.cpp
trunk/pingus/src/pingus_sub_menu.hpp
trunk/pingus/src/result_screen.cpp
trunk/pingus/src/result_screen.hpp
trunk/pingus/src/screenshot.cpp
trunk/pingus/src/start_screen.cpp
trunk/pingus/src/start_screen.hpp
trunk/pingus/src/story_screen.cpp
trunk/pingus/src/story_screen.hpp
trunk/pingus/src/world.cpp
trunk/pingus/src/worldmap/level_dot.cpp
trunk/pingus/src/worldmap/manager.cpp
trunk/pingus/src/worldmap/manager.hpp
trunk/pingus/src/worldmap/worldmap.cpp
trunk/pingus/src/worldobjs/solid_color_background.cpp
trunk/pingus/src/worldobjs/surface_background.cpp
Log:
- some directory reorganisation/cleanup, moved screen classes to screen/
subdir and display classes to display/
Modified: trunk/pingus/src/client.cpp
===================================================================
--- trunk/pingus/src/client.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/client.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -27,7 +27,8 @@
#include "components/pingus_counter.hpp"
#include "components/smallmap.hpp"
#include "components/hurry_up.hpp"
-#include "gui/cursor.hpp"
+#include "display/cursor.hpp"
+#include "display/display.hpp"
#include "true_server.hpp"
#include "components/button_panel.hpp"
#include "world.hpp"
Modified: trunk/pingus/src/client.hpp
===================================================================
--- trunk/pingus/src/client.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/client.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -20,7 +20,7 @@
#ifndef HEADER_PINGUS_CLIENT_HXX
#define HEADER_PINGUS_CLIENT_HXX
-#include "gui/gui_screen.hpp"
+#include "screen/gui_screen.hpp"
namespace Input {
struct ButtonEvent;
Modified: trunk/pingus/src/components/action_button.cpp
===================================================================
--- trunk/pingus/src/components/action_button.cpp 2007-09-30 15:43:10 UTC
(rev 3264)
+++ trunk/pingus/src/components/action_button.cpp 2007-09-30 16:07:08 UTC
(rev 3265)
@@ -24,7 +24,7 @@
#include "../true_server.hpp"
#include "../world.hpp"
#include "../display/drawing_context.hpp"
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../fonts.hpp"
#include "../string_util.hpp"
#include "../math/vector3f.hpp"
Modified: trunk/pingus/src/components/hurry_up.cpp
===================================================================
--- trunk/pingus/src/components/hurry_up.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/components/hurry_up.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -19,7 +19,7 @@
#include "../resource.hpp"
#include "../fonts.hpp"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "hurry_up.hpp"
HurryUp::HurryUp (Client* c)
Modified: trunk/pingus/src/components/pingus_counter.cpp
===================================================================
--- trunk/pingus/src/components/pingus_counter.cpp 2007-09-30 15:43:10 UTC
(rev 3264)
+++ trunk/pingus/src/components/pingus_counter.cpp 2007-09-30 16:07:08 UTC
(rev 3265)
@@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../gettext.h"
#include "../resource.hpp"
#include "../world.hpp"
Modified: trunk/pingus/src/components/playfield.cpp
===================================================================
--- trunk/pingus/src/components/playfield.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/components/playfield.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -27,7 +27,7 @@
#include "../server.hpp"
#include "../true_server.hpp"
#include "../pingu.hpp"
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "button_panel.hpp"
#include "playfield.hpp"
Modified: trunk/pingus/src/components/smallmap.cpp
===================================================================
--- trunk/pingus/src/components/smallmap.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/components/smallmap.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../pingu_holder.hpp"
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../display/drawing_context.hpp"
#include "../world.hpp"
#include "../resource.hpp"
Modified: trunk/pingus/src/components/time_display.cpp
===================================================================
--- trunk/pingus/src/components/time_display.cpp 2007-09-30 15:43:10 UTC
(rev 3264)
+++ trunk/pingus/src/components/time_display.cpp 2007-09-30 16:07:08 UTC
(rev 3265)
@@ -20,7 +20,7 @@
#include <assert.h>
#include <stdio.h>
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../globals.hpp"
#include "../resource.hpp"
#include "../world.hpp"
Modified: trunk/pingus/src/console.hpp
===================================================================
--- trunk/pingus/src/console.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/console.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -22,7 +22,7 @@
#include <string>
#include <iostream>
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "font.hpp"
class ConsoleBuffer :
Modified: trunk/pingus/src/credits.cpp
===================================================================
--- trunk/pingus/src/credits.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/credits.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "gui/surface_button.hpp"
#include "gui/gui_manager.hpp"
#include "sound/sound.hpp"
@@ -28,7 +28,7 @@
#include "credits.hpp"
#include "fonts.hpp"
#include "gettext.h"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "blitter.hpp"
class CreditsOkButton
Modified: trunk/pingus/src/credits.hpp
===================================================================
--- trunk/pingus/src/credits.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/credits.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -22,7 +22,7 @@
#include <string>
#include <vector>
-#include "gui/gui_screen.hpp"
+#include "screen/gui_screen.hpp"
#include "font.hpp"
#include "display/scene_context.hpp"
#include "sprite.hpp"
Modified: trunk/pingus/src/demo_session.hpp
===================================================================
--- trunk/pingus/src/demo_session.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/demo_session.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -20,7 +20,7 @@
#ifndef HEADER_PINGUS_DEMO_SESSION_HXX
#define HEADER_PINGUS_DEMO_SESSION_HXX
-#include "gui/gui_screen.hpp"
+#include "screen/gui_screen.hpp"
class Server;
Copied: trunk/pingus/src/display/cursor.cpp (from rev 3252,
trunk/pingus/src/gui/cursor.cpp)
Copied: trunk/pingus/src/display/cursor.hpp (from rev 3252,
trunk/pingus/src/gui/cursor.hpp)
===================================================================
--- trunk/pingus/src/gui/cursor.hpp 2007-09-28 01:35:56 UTC (rev 3252)
+++ trunk/pingus/src/display/cursor.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -0,0 +1,50 @@
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2000 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 2
+// 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, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef HEADER_PINGUS_CURSOR_HXX
+#define HEADER_PINGUS_CURSOR_HXX
+
+#include <string>
+#include "display/display.hpp"
+#include "../sprite.hpp"
+
+/** A simple mouse cursor class and stupid. We can't use the X11/win32
+ nativ mouse cursor because we want also to support non-mouse input
+ devices and because we want to support multiple cursors */
+class Cursor : public DisplayHook
+{
+private:
+ Sprite sprite;
+
+public:
+ Cursor (const std::string& ident);
+ virtual ~Cursor ();
+
+ virtual void update (float delta);
+ virtual void on_event();
+
+private:
+ Cursor (const Cursor&);
+ Cursor& operator= (const Cursor&);
+};
+
+
+#endif
+
+/* EOF */
Copied: trunk/pingus/src/display/display.cpp (from rev 3252,
trunk/pingus/src/gui/display.cpp)
Copied: trunk/pingus/src/display/display.hpp (from rev 3252,
trunk/pingus/src/gui/display.hpp)
Modified: trunk/pingus/src/display/drawing_context.cpp
===================================================================
--- trunk/pingus/src/display/drawing_context.cpp 2007-09-30 15:43:10 UTC
(rev 3264)
+++ trunk/pingus/src/display/drawing_context.cpp 2007-09-30 16:07:08 UTC
(rev 3265)
@@ -22,7 +22,7 @@
#include <algorithm>
#include "drawing_context.hpp"
#include "math.hpp"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "../sprite.hpp"
#include "../font.hpp"
#include "../math/origin.hpp"
Modified: trunk/pingus/src/display/scene_context.cpp
===================================================================
--- trunk/pingus/src/display/scene_context.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/display/scene_context.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "scene_context.hpp"
#define SCALE_FACTOR 8.0f
Modified: trunk/pingus/src/dummy_screen.hpp
===================================================================
--- trunk/pingus/src/dummy_screen.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/dummy_screen.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -20,7 +20,7 @@
#ifndef HEADER_PINGUS_DUMMY_SCREEN_HXX
#define HEADER_PINGUS_DUMMY_SCREEN_HXX
-#include "gui/screen.hpp"
+#include "screen/screen.hpp"
class DrawingContext;
Modified: trunk/pingus/src/editor/editor_panel.cpp
===================================================================
--- trunk/pingus/src/editor/editor_panel.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/editor/editor_panel.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -20,7 +20,7 @@
#include <vector>
#include "../resource.hpp"
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../math/vector3f.hpp"
#include "../display/drawing_context.hpp"
#include "../gui/gui_manager.hpp"
Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/editor/editor_screen.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -20,11 +20,11 @@
#include <iostream>
#include <boost/bind.hpp>
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../system.hpp"
#include "../sound/sound.hpp"
#include "../gui/gui_manager.hpp"
-#include "../gui/screen_manager.hpp"
+#include "../screen/screen_manager.hpp"
#include "../display/drawing_context.hpp"
#include "../res_descriptor.hpp"
#include "../resource.hpp"
Modified: trunk/pingus/src/editor/editor_screen.hpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.hpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/editor/editor_screen.hpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -21,7 +21,7 @@
#ifndef HEADER_PINGUS_EDITOR_SCREEN_HXX
#define HEADER_PINGUS_EDITOR_SCREEN_HXX
-#include "../gui/gui_screen.hpp"
+#include "../screen/gui_screen.hpp"
#include "pathname.hpp"
#include "file_dialog.hpp"
Modified: trunk/pingus/src/editor/editor_viewport.cpp
===================================================================
--- trunk/pingus/src/editor/editor_viewport.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/editor/editor_viewport.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -22,7 +22,7 @@
#include <string>
#include <iostream>
#include "../gui/gui_manager.hpp"
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../display/drawing_context.hpp"
#include "../math/vector3f.hpp"
#include "../graphic_context_state.hpp"
Modified: trunk/pingus/src/editor/level_head.cpp
===================================================================
--- trunk/pingus/src/editor/level_head.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/editor/level_head.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -29,7 +29,7 @@
#include "../gettext.h"
#include "level_head.hpp"
#include "level_impl.hpp"
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "editor_level.hpp"
//#include "editor_panel.hpp"
#include "editor_screen.hpp"
Modified: trunk/pingus/src/editor/level_objs.cpp
===================================================================
--- trunk/pingus/src/editor/level_objs.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/editor/level_objs.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -25,7 +25,7 @@
#include "../blitter.hpp"
#include "../resource.hpp"
#include "../res_descriptor.hpp"
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../display/drawing_context.hpp"
namespace Editor {
Modified: trunk/pingus/src/editor/object_selector.cpp
===================================================================
--- trunk/pingus/src/editor/object_selector.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/editor/object_selector.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <boost/bind.hpp>
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "gui_style.hpp"
#include "sprite.hpp"
#include "gettext.h"
Modified: trunk/pingus/src/editor/panel.cpp
===================================================================
--- trunk/pingus/src/editor/panel.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/editor/panel.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "fonts.hpp"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "display/drawing_context.hpp"
#include "resource.hpp"
#include "sprite.hpp"
Modified: trunk/pingus/src/font.cpp
===================================================================
--- trunk/pingus/src/font.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/font.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -24,7 +24,7 @@
#include "font.hpp"
#include "line_iterator.hpp"
#include "font_description.hpp"
-#include "gui/display.hpp"
+#include "display/display.hpp"
static bool vline_empty(SDL_Surface* surface, int x, Uint8 threshold)
{
Modified: trunk/pingus/src/font_test_screen.cpp
===================================================================
--- trunk/pingus/src/font_test_screen.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/font_test_screen.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -99,7 +99,7 @@
}
void
-FontTestScreen::update (const GameDelta& delta)
+FontTestScreen::update(const GameDelta& delta)
{
const Input::EventLst& events = delta.get_events ();
Modified: trunk/pingus/src/font_test_screen.hpp
===================================================================
--- trunk/pingus/src/font_test_screen.hpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/font_test_screen.hpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -20,7 +20,7 @@
#ifndef HEADER_FONT_TEST_SCREEN_HPP
#define HEADER_FONT_TEST_SCREEN_HPP
-#include "gui/screen.hpp"
+#include "screen/screen.hpp"
#include "font.hpp"
/** */
Modified: trunk/pingus/src/fps_counter.hpp
===================================================================
--- trunk/pingus/src/fps_counter.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/fps_counter.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -20,7 +20,7 @@
#ifndef HEADER_PINGUS_FPS_COUNTER_HXX
#define HEADER_PINGUS_FPS_COUNTER_HXX
-#include "gui/display.hpp"
+#include "display/display.hpp"
///
Modified: trunk/pingus/src/game_session.cpp
===================================================================
--- trunk/pingus/src/game_session.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/game_session.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "client.hpp"
#include "true_server.hpp"
#include "game_session.hpp"
Modified: trunk/pingus/src/game_session.hpp
===================================================================
--- trunk/pingus/src/game_session.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/game_session.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -21,7 +21,7 @@
#define HEADER_PINGUS_GAME_SESSION_HXX
#include <string>
-#include "gui/screen.hpp"
+#include "screen/screen.hpp"
#include "pingus_level.hpp"
Modified: trunk/pingus/src/global_event.cpp
===================================================================
--- trunk/pingus/src/global_event.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/global_event.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -23,7 +23,7 @@
#include "screenshot.hpp"
#include "console.hpp"
#include "fps_counter.hpp"
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "option_menu.hpp"
#include "global_event.hpp"
#include "globals.hpp"
Modified: trunk/pingus/src/graphic_context_state.cpp
===================================================================
--- trunk/pingus/src/graphic_context_state.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/graphic_context_state.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -19,7 +19,7 @@
#include <math.h>
#include "math.hpp"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "graphic_context_state.hpp"
class GraphicContextStateImpl
Deleted: trunk/pingus/src/gui/cursor.cpp
===================================================================
--- trunk/pingus/src/gui/cursor.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/cursor.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,48 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../input/controller.hpp"
-#include "../input/control.hpp"
-#include "../resource.hpp"
-#include "cursor.hpp"
-
-Cursor::Cursor(const std::string& ident)
- : sprite(Resource::load_sprite(ident))
-{
-}
-
-Cursor::~Cursor ()
-{
-}
-
-void
-Cursor::update (float delta)
-{
- sprite.update (delta);
-}
-
-void
-Cursor::on_event()
-{
- Vector2f pos =
Input::Controller::current()->get_pointer(Input::STANDARD_POINTER)->get_pos();
- sprite.draw(pos.x, pos.y, Display::get_screen());
-}
-
-
-/* EOF */
Deleted: trunk/pingus/src/gui/cursor.hpp
===================================================================
--- trunk/pingus/src/gui/cursor.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/cursor.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,50 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_CURSOR_HXX
-#define HEADER_PINGUS_CURSOR_HXX
-
-#include <string>
-#include "display.hpp"
-#include "../sprite.hpp"
-
-/** A simple mouse cursor class and stupid. We can't use the X11/win32
- nativ mouse cursor because we want also to support non-mouse input
- devices and because we want to support multiple cursors */
-class Cursor : public DisplayHook
-{
-private:
- Sprite sprite;
-
-public:
- Cursor (const std::string& ident);
- virtual ~Cursor ();
-
- virtual void update (float delta);
- virtual void on_event();
-
-private:
- Cursor (const Cursor&);
- Cursor& operator= (const Cursor&);
-};
-
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/gui/display.cpp
===================================================================
--- trunk/pingus/src/gui/display.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/display.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,461 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <algorithm>
-#include <stdio.h>
-#include <iostream>
-#include "../globals.hpp"
-#include "../math/vector2i.hpp"
-#include "../math/rect.hpp"
-#include "../math/color.hpp"
-#include "../math.hpp"
-#include "display.hpp"
-
-std::list<DisplayHook*> Display::display_hooks;
-std::vector<SDL_Rect> Display::cliprect_stack;
-SDL_Surface* Display::screen;
-
-namespace {
-SDL_Rect Intersection(SDL_Rect* r1, SDL_Rect* r2)
-{
- SDL_Rect rect;
- rect.x = Math::max(r1->x, r2->x);
- rect.y = Math::max(r1->y, r2->y);
- int endx = Math::min(r1->x + r1->w, r2->x + r2->w);
- rect.w = Math::max(endx - rect.x, 0);
- int endy = Math::min(r1->y + r1->h, r2->y + r2->h);
- rect.h = Math::max(endy - rect.y, 0);
- return rect;
-}
-} // namespace
-
-DisplayHook::DisplayHook() : is_visible(false)
-{
-}
-
-void
-DisplayHook::toggle_display()
-{
- if (is_visible)
- Display::remove_flip_screen_hook(this);
- else
- Display::add_flip_screen_hook(this);
-
- is_visible = !is_visible;
-}
-
-void
-Display::flip_display(bool sync)
-{
- for(std::list<DisplayHook*>::iterator i = display_hooks.begin();
- i != display_hooks.end();
- i++)
- {
- (*i)->on_event();
- }
-
- SDL_Flip(screen);
-}
-
-void
-Display::add_flip_screen_hook(DisplayHook* hook)
-{
- if (std::find(display_hooks.begin(), display_hooks.end(), hook) ==
display_hooks.end())
- display_hooks.push_back(hook);
- else
- std::cout << "Display: Trying to insert a display hook multiple times..."
<< std::endl;
-}
-
-void
-Display::remove_flip_screen_hook(DisplayHook* hook)
-{
- display_hooks.remove(hook);
-}
-
-void
-Display::set_video_mode(int width, int height)
-{
- Uint32 flags = 0;
-
- if (resize_enabled)
- flags |= SDL_RESIZABLE;
-
- if (fullscreen_enabled)
- flags |= SDL_FULLSCREEN;
-
- screen = SDL_SetVideoMode(width, height, 0, flags);
-
- if (screen == NULL)
- {
- std::cout << "Unable to set video mode: " << SDL_GetError() << std::endl;
- exit(1);
- }
-}
-
-int
-Display::get_width()
-{
- return screen->w;
-}
-
-int
-Display::get_height()
-{
- return screen->h;
-}
-
-void
-Display::clear()
-{
- SDL_FillRect(screen, NULL, SDL_MapRGB(Display::get_screen()->format, 0, 0,
0));
-}
-
-static void draw_pixel16(int x, int y, const Color& c)
-{
- Uint32 color = SDL_MapRGBA(Display::get_screen()->format, c.r, c.g, c.b,
c.a);
-
- if (c.a < 255) {
- Uint16 *p;
- unsigned long dp;
- unsigned char alpha;
-
- // Loses precision for speed
- alpha = (255 - c.a) >> 3;
-
- p = &((Uint16 *)Display::get_screen()->pixels)[x + y *
Display::get_screen()->w];
- color = (((color << 16) | color) & 0x07E0F81F);
- dp = *p;
- dp = ((dp << 16) | dp) & 0x07E0F81F;
- dp = ((((dp - color) * alpha) >> 5) + color) & 0x07E0F81F;
- *p = (Uint16)((dp >> 16) | dp);
- } else {
- ((Uint16 *)Display::get_screen()->pixels)[x + y *
Display::get_screen()->w] = color;
- }
-}
-static void draw_pixel32(int x, int y, const Color& c)
-{
- Uint32 color = SDL_MapRGBA(Display::get_screen()->format, c.r, c.g, c.b,
c.a);
-
- if (c.a < 255) {
- Uint32 *p;
- unsigned long sp2;
- unsigned long dp1;
- unsigned long dp2;
- unsigned char alpha;
-
- alpha = 255 - c.a;
-
- p = &((Uint32*)Display::get_screen()->pixels)[x + y *
Display::get_screen()->w];
-
- sp2 = (color & 0xFF00FF00) >> 8;
- color &= 0x00FF00FF;
-
- dp1 = *p;
- dp2 = (dp1 & 0xFF00FF00) >> 8;
- dp1 &= 0x00FF00FF;
-
- dp1 = ((((dp1 - color) * alpha) >> 8) + color) & 0x00FF00FF;
- dp2 = ((((dp2 - sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
- *p = (dp1 | (dp2 << 8));
- } else {
- ((Uint32 *)Display::get_screen()->pixels)[x + y *
Display::get_screen()->w] = color;
- }
-}
-
-typedef void (*draw_pixel_func)(int, int, const Color&);
-static draw_pixel_func get_draw_pixel()
-{
- switch (Display::get_screen()->format->BitsPerPixel)
- {
- case 16:
- return draw_pixel16;
- case 32:
- return draw_pixel32;
- }
- return NULL;
-}
-
-static void draw_vline(int x, int y, int length, const Color& color)
-{
- draw_pixel_func draw_pixel = get_draw_pixel();
- if (!draw_pixel)
- return;
-
- SDL_LockSurface(Display::get_screen());
- for (int i = 0; i < length; ++i) {
- draw_pixel(x, y + i, color);
- }
- SDL_UnlockSurface(Display::get_screen());
-}
-
-static void draw_hline(int x, int y, int length, const Color& color)
-{
- draw_pixel_func draw_pixel = get_draw_pixel();
- if (!draw_pixel)
- return;
-
- SDL_LockSurface(Display::get_screen());
- for (int i = 0; i < length; ++i) {
- draw_pixel(x + i, y, color);
- }
- SDL_UnlockSurface(Display::get_screen());
-}
-
-void
-Display::draw_line(int x1, int y1, int x2, int y2, const Color& color)
-{
- Display::draw_line(Vector2i(x1, y1), Vector2i(x2, y2), color);
-}
-
-static
-void clip(int& i, int min, int max)
-{
- if (i < min)
- i = min;
- else if (i > max)
- i = max;
-}
-
-void
-Display::draw_line(const Vector2i& pos1, const Vector2i& pos2, const Color&
color)
-{
- int x, y, xlen, ylen, incr;
- int sx = pos1.x;
- int sy = pos1.y;
- int dx = pos2.x;
- int dy = pos2.y;
- void (*draw_pixel)(int x, int y, const Color& color);
- int clipx1, clipx2, clipy1, clipy2;
- SDL_Rect rect;
-
- SDL_GetClipRect(Display::get_screen(), &rect);
- clipx1 = rect.x;
- clipx2 = rect.x + rect.w - 1;
- clipy1 = rect.y;
- clipy2 = rect.y + rect.h - 1;
-
- // vertical line
- if (sx == dx) {
- if (sx < clipx1 || sx > clipx2 || (sy < clipy1 && dy < clipy1) || (sy >
clipy2 && dy > clipy2)) {
- return;
- }
- clip(sy, clipy1, clipy2);
- clip(dy, clipy1, clipy2);
- if (sy < dy) {
- draw_vline(sx, sy, dy - sy + 1, color);
- } else {
- draw_vline(dx, dy, sy - dy + 1, color);
- }
- return;
- }
-
- // horizontal
- if (sy == dy) {
- if (sy < clipy1 || sy > clipy2 || (sx < clipx1 && dx < clipx1) || (sx >
clipx2 && dx > clipx2)) {
- return;
- }
- clip(sx, clipx1, clipx2);
- clip(dx, clipx1, clipx2);
- if (sx < dx) {
- draw_hline(sx, sy, dx - sx + 1, color);
- } else {
- draw_hline(dx, dy, sx - dx + 1, color);
- }
- return;
- }
-
- draw_pixel = get_draw_pixel();
- if (!draw_pixel) {
- return;
- }
-
- // exchange coordinates
- if (sy > dy) {
- int t = dx;
- dx = sx;
- sx = t;
- t = dy;
- dy = sy;
- sy = t;
- }
- ylen = dy - sy;
-
- if (sx > dx) {
- xlen = sx - dx;
- incr = -1;
- } else {
- xlen = dx - sx;
- incr = 1;
- }
-
- y = sy;
- x = sx;
-
- if (xlen > ylen) {
- if (sx > dx) {
- int t = sx;
- sx = dx;
- dx = t;
- y = dy;
- }
-
- int p = (ylen << 1) - xlen;
-
- SDL_LockSurface(screen);
- for (x = sx; x < dx; ++x) {
- if (x >= clipx1 && x <= clipx2 && y >= clipy1 && y <= clipy2) {
- draw_pixel(x, y, color);
- }
- if (p >= 0) {
- y += incr;
- p += (ylen - xlen) << 1;
- } else {
- p += (ylen << 1);
- }
- }
- SDL_UnlockSurface(screen);
- return;
- }
-
- if (ylen > xlen) {
- int p = (xlen << 1) - ylen;
-
- SDL_LockSurface(screen);
- for (y = sy; y < dy; ++y) {
- if (x >= clipx1 && x <= clipx2 && y >= clipy1 && y <= clipy2) {
- draw_pixel(x, y, color);
- }
- if (p >= 0) {
- x += incr;
- p += (xlen - ylen) << 1;
- } else {
- p += (xlen << 1);
- }
- }
- SDL_UnlockSurface(screen);
- return;
- }
-
- // Draw a diagonal line
- if (ylen == xlen) {
- SDL_LockSurface(screen);
- while (y != dy) {
- if (x >= clipx1 && x <= clipx2 && y >= clipy1 && y <= clipy2) {
- draw_pixel(x, y, color);
- }
- x += incr;
- ++y;
- }
- SDL_UnlockSurface(screen);
- }
-}
-
-void
-Display::draw_rect(int x1, int y1, int x2, int y2, const Color& color)
-{
- Display::draw_line(Vector2i(x1, y1), Vector2i(x2-1, y1), color);
- Display::draw_line(Vector2i(x1, y2-1), Vector2i(x2-1, y2-1), color);
- Display::draw_line(Vector2i(x1, y1), Vector2i(x1, y2-1), color);
- Display::draw_line(Vector2i(x2-1, y1), Vector2i(x2-1, y2-1), color);
-}
-
-void
-Display::draw_rect(const Rect& rect, const Color& color)
-{
- Display::draw_rect(rect.left, rect.top, rect.right, rect.bottom, color);
-}
-
-void
-Display::fill_rect(const Rect& rect_, const Color& color)
-{
- Rect rect = rect_;
- rect.normalize();
-
- if (color.a == 255)
- {
- SDL_Rect srcrect;
-
- srcrect.x = rect.left;
- srcrect.y = rect.top;
- srcrect.w = rect.get_width();
- srcrect.h = rect.get_height();
-
- SDL_FillRect(screen, &srcrect, SDL_MapRGB(screen->format, color.r,
color.g, color.b));
- }
- else if (color.a != 0)
- {
- int top, bottom, left, right;
- int clipx1, clipx2, clipy1, clipy2;
- SDL_Rect cliprect;
-
- SDL_GetClipRect(Display::get_screen(), &cliprect);
- clipx1 = cliprect.x;
- clipx2 = cliprect.x + cliprect.w - 1;
- clipy1 = cliprect.y;
- clipy2 = cliprect.y + cliprect.h - 1;
-
- if (rect.right < clipx1 || rect.left > clipx2 || rect.bottom < clipy1 ||
rect.top > clipy2)
- return;
-
- top = rect.top < clipy1 ? clipy1 : rect.top;
- bottom = rect.bottom > clipy2 ? clipy2 : rect.bottom;
- left = rect.left < clipx1 ? clipx1 : rect.left;
- right = rect.right > clipx2 ? clipx2 : rect.right;
-
- draw_pixel_func draw_pixel = get_draw_pixel();
- if (!draw_pixel)
- return;
-
- SDL_LockSurface(Display::get_screen());
- for (int j = top; j <= bottom; ++j) {
- for (int i = left; i <= right; ++i) {
- draw_pixel(i, j, color);
- }
- }
- SDL_UnlockSurface(Display::get_screen());
- }
-}
-
-void
-Display::push_cliprect(const Rect& rect)
-{
- SDL_Rect sdl_rect;
- sdl_rect.x = rect.left;
- sdl_rect.y = rect.top;
- sdl_rect.w = rect.get_width();
- sdl_rect.h = rect.get_height();
-
- if (!cliprect_stack.empty())
- sdl_rect = Intersection(&cliprect_stack.back(), &sdl_rect);
-
- cliprect_stack.push_back(sdl_rect);
- SDL_SetClipRect(screen, &cliprect_stack.back());
-}
-
-void
-Display::pop_cliprect()
-{
- cliprect_stack.pop_back();
- if (cliprect_stack.empty())
- SDL_SetClipRect(screen, NULL);
- else
- SDL_SetClipRect(screen, &cliprect_stack.back());
-}
-
-/* EOF */
Deleted: trunk/pingus/src/gui/display.hpp
===================================================================
--- trunk/pingus/src/gui/display.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/display.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,93 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_DISPLAY_HXX
-#define HEADER_PINGUS_DISPLAY_HXX
-
-#include "../pingus.hpp"
-#include "SDL.h"
-#include <list>
-#include <vector>
-
-class Vector2i;
-class Rect;
-class Color;
-class DisplayHook;
-
-/** A flip display hook can be used to attach an event to a
- flip_screen(). An example usage for this is a software mouse
- cursor or a frame counter */
-class DisplayHook
-{
-protected:
- bool is_visible;
-public:
- DisplayHook();
- virtual ~DisplayHook() {}
- /** Called sortly before a flip_display () */
- virtual void on_event() = 0;
- virtual void toggle_display();
-
-private:
- DisplayHook (const DisplayHook&);
- DisplayHook& operator= (const DisplayHook&);
-};
-
-/** This is a kind of wrapper class around CL_Display, it provides
- ways to set the cursor and hooks for flip_display() */
-class Display
-{
-private:
- static std::list<DisplayHook*> display_hooks;
- static std::vector<SDL_Rect> cliprect_stack;
- static SDL_Surface* screen;
-public:
- static void draw_line(int x1, int y1, int x2, int y2, const Color& color);
- static void draw_line(const Vector2i& pos1, const Vector2i& pos2, const
Color& color);
-
- static void draw_rect(int x1, int y1, int x2, int y2, const Color& color);
- static void draw_rect(const Rect& rect, const Color& color);
- static void fill_rect(const Rect& rect, const Color& color);
-
- static void flip_display(bool sync=false);
-
- static void add_flip_screen_hook(DisplayHook*);
- static void remove_flip_screen_hook(DisplayHook*);
-
- static int get_width();
- static int get_height();
-
- static void set_video_mode(int width, int height);
-
- static void clear();
-
- static SDL_Surface* get_screen() { return screen; }
-
- static void push_cliprect(const Rect&);
- static void pop_cliprect();
-private:
- Display ();
- Display (const Display&);
- Display& operator= (const Display&);
-};
-
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/gui/game_delta.hpp
===================================================================
--- trunk/pingus/src/gui/game_delta.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/game_delta.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,68 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GAME_DELTA_HXX
-#define HEADER_PINGUS_GAME_DELTA_HXX
-
-#include <list>
-#include "../delta_manager.hpp"
-#include "../input/event.hpp"
-
-
-/** Input for the game engine */
-class GameDelta
-{
-private:
- /** time delta since the last update */
- const float time_delta;
-
- const unsigned int absolute_time;
-
- /** Reference to the event list from the controller, we must not
- delete the Event* */
- Input::EventLst events;
-
-public:
- /** Construct a GameDelta with both time and events */
- GameDelta (float time_delta_arg,
- unsigned int absolute_time_arg,
- const Input::EventLst& e)
- : time_delta (time_delta_arg),
- absolute_time (absolute_time_arg),
- events (e) {}
-
- /** Return the time that has passed in seconds since the last update() */
- float get_time () const { return time_delta; }
-
- /** @return the time since the application startup in miliseconds
- (1/1000 second) */
- unsigned int get_absolute_time () const { return absolute_time; }
-
- /** Return the events */
- const Input::EventLst& get_events () const { return events; }
-
-private:
- GameDelta (const GameDelta&);
- GameDelta& operator= (const GameDelta&);
-};
-
-
-#endif
-
-/* EOF */
Modified: trunk/pingus/src/gui/gui_manager.cpp
===================================================================
--- trunk/pingus/src/gui/gui_manager.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/gui/gui_manager.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -21,8 +21,8 @@
#include "../debug.hpp"
#include "../globals.hpp"
#include "../input/event.hpp"
-#include "display.hpp"
-#include "game_delta.hpp"
+#include "display/display.hpp"
+#include "screen/game_delta.hpp"
#include "gui_manager.hpp"
using namespace Input;
Deleted: trunk/pingus/src/gui/gui_screen.cpp
===================================================================
--- trunk/pingus/src/gui/gui_screen.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/gui_screen.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,167 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "../globals.hpp"
-#include "../debug.hpp"
-#include "gui_screen.hpp"
-#include "gui_manager.hpp"
-
-
-GUIScreen::GUIScreen()
- : gui_manager (new GUI::GUIManager())
-{
-}
-
-GUIScreen::~GUIScreen ()
-{
- delete gui_manager;
-}
-
-/** Draw this screen */
-bool
-GUIScreen::draw(DrawingContext& gc)
-{
- draw_background(gc);
- gui_manager->draw(gc);
- draw_foreground(gc);
- return true;
-}
-
- /** Pass a delta to the screen */
-void
-GUIScreen::update (const GameDelta& delta)
-{
- // Dispatch the recieved input events
- gui_manager->update (delta);
-
- update(delta.get_time ());
-
- for (Input::EventLst::const_iterator i = delta.get_events ().begin ();
- i != delta.get_events ().end (); ++i)
- {
- switch (i->type)
- {
- case Input::POINTER_EVENT_TYPE:
- {
- // ignored cause this is handled in the gui_manager
- }
- break;
-
- case Input::BUTTON_EVENT_TYPE:
- {
- process_button_event (i->button);
- }
- break;
-
- case Input::AXIS_EVENT_TYPE:
- {
- if (i->axis.name == Input::ACTION_AXIS)
- {
- on_action_axis_move(i->axis.dir);
- }
- }
- break;
-
- case Input::SCROLLER_EVENT_TYPE:
- {
-
- }
- break;
-
- case Input::KEYBOARD_EVENT_TYPE:
- {
-
- }
- break;
-
- default:
- std::cout << "GUIScreen::update (): unhandled event type: " <<
i->type << std::endl;
- break;
- }
- }
-}
-
-void
-GUIScreen::process_button_event (const Input::ButtonEvent& event)
-{
- //std::cout << "GUIScreen::process_button_event (Input::ButtonEvent* event)"
<< std::endl;
-
- if (event.state == Input::BUTTON_PRESSED)
- {
- switch (event.name)
- {
- case Input::PRIMARY_BUTTON:
- // ignoring, handled in the gui_manager
- break;
- case Input::SECONDARY_BUTTON:
- // ignoring, handled in the gui_manager
- break;
- case Input::PAUSE_BUTTON:
- on_pause_press ();
- break;
- case Input::FAST_FORWARD_BUTTON:
- on_fast_forward_press ();
- break;
- case Input::ARMAGEDDON_BUTTON:
- on_armageddon_press ();
- break;
- case Input::ESCAPE_BUTTON:
- on_escape_press ();
- break;
- default:
- perr(PINGUS_DEBUG_GUI) << "GUIScreen: ButtonEvent: unhandled event: "
<< event.name << std::endl;
- break;
- }
- }
- else if (event.state == Input::BUTTON_RELEASED)
- {
- switch (event.name)
- {
- case Input::PRIMARY_BUTTON:
- // ignoring, handled in the gui_manager
- break;
- case Input::SECONDARY_BUTTON:
- // ignoring, handled in the gui_manager
- break;
- case Input::PAUSE_BUTTON:
- on_pause_release ();
- break;
- case Input::FAST_FORWARD_BUTTON:
- on_fast_forward_release ();
- break;
- case Input::ARMAGEDDON_BUTTON:
- on_armageddon_release ();
- break;
- case Input::ESCAPE_BUTTON:
- on_escape_release ();
- break;
- default:
- perr(PINGUS_DEBUG_GUI) << "GUIScreen: ButtonEvent: unhandled event: "
<< event.name << std::endl;
- break;
- }
- }
- else
- {
- perr(PINGUS_DEBUG_GUI) << "GUIScreen::process_button_event: got unknown
event.state: "
- << event.state << std::endl;;
- }
-}
-
-
-/* EOF */
Deleted: trunk/pingus/src/gui/gui_screen.hpp
===================================================================
--- trunk/pingus/src/gui/gui_screen.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/gui_screen.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,76 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUISCREEN_HXX
-#define HEADER_PINGUS_GUISCREEN_HXX
-
-#include "screen.hpp"
-
-
-namespace GUI {
- class GUIManager;
-}
-
-namespace Input {
- struct ButtonEvent;
-}
-
-class GUIScreen : public Screen
-{
-protected:
- GUI::GUIManager* gui_manager;
-
-public:
- GUIScreen ();
- virtual ~GUIScreen ();
-
- /** Draw this screen */
- virtual void draw_foreground (DrawingContext& gc) { UNUSED_ARG(gc); }
- virtual void draw_background (DrawingContext& gc) { UNUSED_ARG(gc); }
- virtual bool draw(DrawingContext& gc);
-
- /** Pass a game delta to the screen */
- virtual void update (const GameDelta& delta);
-
- /** */
- virtual void update (float) {}
-
- virtual void on_pause_press () {}
- virtual void on_fast_forward_press () {}
- virtual void on_armageddon_press () {}
- virtual void on_escape_press () {}
-
- virtual void on_pause_release () {}
- virtual void on_fast_forward_release () {}
- virtual void on_armageddon_release () {}
- virtual void on_escape_release () {}
-
- virtual void on_action_axis_move (float) {}
-
-private:
- void process_button_event (const Input::ButtonEvent& event);
-
- GUIScreen (const GUIScreen&);
- GUIScreen& operator= (const GUIScreen&);
-};
-
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/gui/input_debug_screen.cpp
===================================================================
--- trunk/pingus/src/gui/input_debug_screen.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/gui/input_debug_screen.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -1,101 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include <iostream>
-#include "../input/event.hpp"
-//#include "input/scroll_event.hpp"
-#include "input_debug_screen.hpp"
-
-
-using namespace Input;
-
-InputDebugScreen::InputDebugScreen ()
-{
-}
-
-InputDebugScreen::~InputDebugScreen ()
-{
-}
-
-/** Draw this screen */
-bool
-InputDebugScreen::draw (DrawingContext& gc)
-{
- std::cout << "InputDebugScreen::draw ()" << std::endl;
- CL_System::sleep(100);
- UNUSED_ARG(gc);
- return true;
-}
-
-/** Pass a delta to the screen */
-void
-InputDebugScreen::update (const GameDelta& delta)
-{
- std::cout << "InputDebugScreen::update (" << delta.get_time () << ")" <<
std::endl;
- for (Input::EventLst::const_iterator i = delta.get_events ().begin ();
- i != delta.get_events ().end ();
- ++i)
- {
- switch(i->type)
- {
- case ButtonEventType:
- std::cout << "InputDebugScreen: Button event : " << i->type <<
std::endl;
- break;
-
- case PointerEventType:
- std::cout << "InputDebugScreen: Pointer event : " << i->type <<
std::endl;
- break;
-
- case AxisEventType:
- std::cout << "InputDebugScreen: Axis event : " << i->type <<
std::endl;
-
- break;
- case ScrollEventType:
- {
- std::cout << "InputDebugScreen: Scroll event : "
- << i->scroll.x_delta << " " << i->scroll.y_delta <<
std::endl;
- }
- break;
-
- default:
- std::cout << "InputDebugScreen: Unknown event : " << i->type <<
std::endl;
- break;
- }
- }
-}
-
-/** Called once the screen gets activated and becomes the current
- screen */
-void
-InputDebugScreen::on_startup ()
-{
- std::cout << "InputDebugScreen::on_startup ()" << std::endl;
-}
-
-/** Called once the screen gets replaced or poped or shadowed by a
- newly pushed screen */
-void
-InputDebugScreen::on_shutdown ()
-{
- std::cout << "InputDebugScreen::on_shutdown ()" << std::endl;
-}
-
-
-/* EOF */
Deleted: trunk/pingus/src/gui/input_debug_screen.hpp
===================================================================
--- trunk/pingus/src/gui/input_debug_screen.hpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/gui/input_debug_screen.hpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -1,52 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_INPUT_DEBUG_SCREEN_HXX
-#define HEADER_PINGUS_INPUT_DEBUG_SCREEN_HXX
-
-#include "screen.hpp"
-
-
-class InputDebugScreen : public Screen
-{
-private:
-
-public:
- InputDebugScreen ();
- virtual ~InputDebugScreen ();
-
- /** Draw this screen */
- bool draw (DrawingContext& gc);
-
- /** Pass a delta to the screen */
- void update (const GameDelta& delta);
-
- /** Called once the screen gets activated and becomes the current
- screen */
- void on_startup ();
-
- /** Called once the screen gets replaced or poped or shadowed by a
- newly pushed screen */
- void on_shutdown ();
-};
-
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/gui/root_gui_manager.cpp
===================================================================
--- trunk/pingus/src/gui/root_gui_manager.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/gui/root_gui_manager.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -1,49 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <assert.h>
-#include "root_gui_manager.hpp"
-#include "../input/controller.hpp"
-
-
-using namespace GUI;
-using namespace Input;
-
-RootGUIManager::RootGUIManager (Input::Controller* c)
- : controller(c)
-{
-}
-
-RootGUIManager::~RootGUIManager ()
-{
-}
-
-void
-RootGUIManager::update (float delta)
-{
- assert (!"ERROR RootGUIManager absolete");
- assert (controller);
- //GUIManager::update (delta);
- //process_input (controller->get_events ());
-
- UNUSED_ARG(delta);
-}
-
-
-/* EOF */
Deleted: trunk/pingus/src/gui/root_gui_manager.hpp
===================================================================
--- trunk/pingus/src/gui/root_gui_manager.hpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/gui/root_gui_manager.hpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -1,54 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_GUI_ROOT_GUI_MANAGER_HXX
-#define HEADER_PINGUS_GUI_ROOT_GUI_MANAGER_HXX
-
-#include "gui_manager.hpp"
-
-
-namespace Input {
-class Controller;
-}
-
-namespace GUI {
-
-/** Root GUI manager
- */
-class RootGUIManager : public GUIManager
-{
-private:
- Input::Controller* controller;
-
-public:
- RootGUIManager (Input::Controller* c);
- ~RootGUIManager ();
-
- void update (float delta);
-
-private:
- RootGUIManager (const RootGUIManager&);
- RootGUIManager& operator= (const RootGUIManager&);
-};
-}
-
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/gui/screen.cpp
===================================================================
--- trunk/pingus/src/gui/screen.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/screen.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,22 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "screen.hpp"
-
-/* EOF */
Deleted: trunk/pingus/src/gui/screen.hpp
===================================================================
--- trunk/pingus/src/gui/screen.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/screen.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,67 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREEN_HXX
-#define HEADER_PINGUS_SCREEN_HXX
-
-#include "SDL.h"
-#include "game_delta.hpp"
-
-class Size;
-class DrawingContext;
-
-/** A interface for screens. A screen is a Pingus 'thing' which gets
- complete controll over the display and input. Examples of
- screens are the PingusMenu or a PingusGameSession */
-class Screen
-{
-private:
-
-public:
- Screen () { }
- virtual ~Screen () {}
-
- /** Draw this screen @return true if draw was successfull, false if
- frameskip has taken place ('causes a skip of flip_display) */
- virtual bool draw(DrawingContext& gc) =0;
-
- /** Pass a delta to the screen */
- virtual void update (const GameDelta& delta) =0;
-
- virtual unsigned int time_till_next_update() { return 0; }
-
- /** Called once the screen gets activated and becomes the current
- screen */
- virtual void on_startup () {}
-
- /** Called once the screen gets replaced or poped or shadowed by a
- newly pushed screen */
- virtual void on_shutdown () {}
-
- virtual void resize(const Size&) {}
-
-private:
- Screen (const Screen&);
- Screen& operator= (const Screen&);
-};
-
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/gui/screen_manager.cpp
===================================================================
--- trunk/pingus/src/gui/screen_manager.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/gui/screen_manager.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -1,318 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "SDL.h"
-#include <iostream>
-#include "../globals.hpp"
-#include "math/size.hpp"
-#include "pathname.hpp"
-#include "cursor.hpp"
-#include "display.hpp"
-#include "screen_manager.hpp"
-#include "../path_manager.hpp"
-#include "screenshot.hpp"
-#include "../display/drawing_context.hpp"
-#include "../input/controller.hpp"
-#include "../input/manager.hpp"
-
-ScreenManager* ScreenManager::instance_ = 0;
-
-ScreenManager::ScreenManager()
-{
- display_gc = new DrawingContext();
-
- cached_action = CA_NONE;
-}
-
-ScreenManager::~ScreenManager ()
-{
- delete display_gc;
-}
-
-void
-ScreenManager::display()
-{
- Input::Manager input_manager;
-
- Input::Controller* input_controller = 0;
-
- if (controller_file.empty())
- input_controller =
input_manager.create_controller(Pathname("controller/default.scm",
-
Pathname::DATA_PATH));
- else
- input_controller =
input_manager.create_controller(Pathname(controller_file,
-
Pathname::SYSTEM_PATH));
-
- Cursor* cursor = 0;
- if (swcursor_enabled)
- {
- cursor = new Cursor("core/cursors/animcross");
- Display::add_flip_screen_hook(cursor);
- SDL_ShowCursor(SDL_DISABLE);
- }
-
- DeltaManager delta_manager;
-
- // Main loop for the menu
- while (!screens.empty())
- {
- float time_delta = delta_manager.getset();
-
- if (time_delta > 1.0)
- {
- if (maintainer_mode)
- std::cout << "ScreenManager: detected large delta (" << time_delta
- << "), ignoring and doing frameskip" << std::endl;
- continue;
- }
-
- input_manager.update(time_delta);
-
- // Fill the delta with values
- GameDelta delta(time_delta, delta_manager.get_absolute(),
- input_controller->poll_events());
-
- last_screen = get_current_screen();
-
- // Most likly the screen will get changed in this update call
- get_current_screen()->update (delta);
-
- if (cursor)
- cursor->update(time_delta);
-
- // Last screen has poped, so we are going to end here
- if (screens.empty())
- continue;
-
- while (cached_action != CA_NONE)
- {
- switch (cached_action)
- {
- case CA_POP:
- real_pop_screen();
- break;
- case CA_POP_ALL:
- real_pop_all_screens();
- break;
- case CA_REPLACE:
- real_replace_screen(replace_screen_arg);
- break;
- case CA_CLEAR:
- real_clear();
- break;
- default:
- break;
- }
- }
-
- // FIXME: is there a more gentel way to do that instead of spreading the
checks all around here?
- // Last screen has poped, so we are going to end here
- if (screens.empty())
- continue;
-
- // skip draw if the screen changed to avoid glitches
- if (last_screen == get_current_screen() || fast_mode)
- {
- if (get_current_screen()->draw(*display_gc))
- {
- display_gc->render(Display::get_screen(), Rect(Vector2i(0,0),
Size(Display::get_width(),
-
Display::get_height())));
- Display::flip_display ();
- display_gc->clear();
- }
- }
- else
- {
- //std::cout << "ScreenManager: fading screens" << std::endl;
- fade_over(last_screen, get_current_screen());
- }
-
- // Stupid hack to make this thing take less CPU
- SDL_Delay(1);
- }
-
- Display::remove_flip_screen_hook(cursor);
- delete cursor;
- delete input_controller;
-}
-
-ScreenPtr&
-ScreenManager::get_current_screen()
-{
- assert(!screens.empty());
- return screens.back ();
-}
-
-ScreenManager*
-ScreenManager::instance ()
-{
- if (instance_)
- return instance_;
- else
- return instance_ = new ScreenManager ();
-}
-
-void
-ScreenManager::push_screen (Screen* screen, bool delete_screen)
-{
- if (!screens.empty())
- {
- screens.back ()->on_shutdown ();
- }
-
- screens.push_back (ScreenPtr(screen, delete_screen));
- screen->on_startup ();
-}
-
-void
-ScreenManager::pop_screen ()
-{
- assert (cached_action == CA_NONE || cached_action == CA_POP);
- cached_action = CA_POP;
-}
-
-void
-ScreenManager::pop_all_screens()
-{
- assert(cached_action == CA_NONE);
- cached_action = CA_POP_ALL;
-}
-
-void
-ScreenManager::replace_screen (Screen* screen, bool delete_screen)
-{
- assert (cached_action == CA_NONE);
- cached_action = CA_REPLACE;
- replace_screen_arg = ScreenPtr(screen, delete_screen);
-}
-
-void
-ScreenManager::real_replace_screen (const ScreenPtr& ptr)
-{
- cached_action = CA_NONE;
- screens.back ()->on_shutdown ();
- screens.back () = ptr;
- screens.back ()->on_startup ();
-}
-
-void
-ScreenManager::real_pop_screen ()
-{
- cached_action = CA_NONE;
- ScreenPtr back = screens.back ();
- screens.pop_back();
- back->on_shutdown();
-
- if (!screens.empty ())
- {
- screens.back()->on_startup ();
- }
-}
-
-void
-ScreenManager::real_pop_all_screens()
-{
- cached_action = CA_NONE;
- ScreenPtr back = screens.back();
- screens.pop_back();
- back->on_shutdown();
-
- screens.clear();
-}
-
-void
-ScreenManager::clear()
-{
- cached_action = CA_CLEAR;
-}
-
-void
-ScreenManager::real_clear()
-{
- cached_action = CA_NONE;
- screens.clear();
-}
-
-void
-ScreenManager::fade_over (ScreenPtr& old_screen, ScreenPtr& new_screen)
-{
- DeltaManager delta_manager;
- float passed_time = 0;
-
- float progress = 0.0f;
- while (progress <= 1.0f)
- {
- float time_delta = delta_manager.getset ();
- passed_time += time_delta;
-
- int border_x = int((Display::get_width()/2) * (1.0f - progress));
- int border_y = int((Display::get_height()/2) * (1.0f - progress));
-
- old_screen->draw(*display_gc);
- display_gc->render(Display::get_screen(), Rect(Vector2i(0,0),
Size(Display::get_width(),
-
Display::get_height())));
- display_gc->clear();
-
- Display::push_cliprect(Rect(Vector2i(0 + border_x, 0 + border_y),
- Size(screen_width - 2*border_x,
screen_height - 2*border_y)));
-
- new_screen->draw(*display_gc);
- display_gc->render(Display::get_screen(), Rect(Vector2i(0,0),
Size(Display::get_width(),
-
Display::get_height())));
- display_gc->clear();
-
- //GameDelta delta (time_delta, CL_System::get_time(), events);
- // FIXME: Animation looks nifty but doesn't work all that good
- //new_screen->update (delta);
- //old_screen->update (delta);
-
- Display::pop_cliprect();
- Display::flip_display ();
- display_gc->clear();
-
- progress = passed_time/1.0f;
- }
-}
-
-void
-ScreenManager::resize(const Size& size)
-{
- display_gc->set_rect(Rect(Vector2i(0, 0), size));
-
- // FIXME: Calling this causes horrible flicker, any better way to resize the
screen?
- Display::set_video_mode(size.width, size.height);
-
- get_current_screen()->resize(size);
-
-}
-
-void
-ScreenManager::init()
-{
- instance_ = 0;
-}
-
-void
-ScreenManager::deinit()
-{
- delete instance_;
- instance_ = 0;
-}
-
-/* EOF */
Deleted: trunk/pingus/src/gui/screen_manager.hpp
===================================================================
--- trunk/pingus/src/gui/screen_manager.hpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/gui/screen_manager.hpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -1,106 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREEN_MANAGER_HXX
-#define HEADER_PINGUS_SCREEN_MANAGER_HXX
-
-#include "../pingus.hpp"
-#include <vector>
-
-#include "screen_ptr.hpp"
-
-class Size;
-class DrawingContext;
-class Screen;
-
-class ScreenManager
-{
-private:
- static ScreenManager* instance_;
-
- SDL_Surface* screen;
- DrawingContext* display_gc;
-
- /** Screen stack (first is the screen, second is delete_screen,
- which tells if the screen should be deleted onces it got poped
- or replaced) */
- std::vector<ScreenPtr> screens;
-
- /** the screen that was used in the last update() */
- ScreenPtr last_screen;
-
- enum { CA_NONE, CA_POP, CA_POP_ALL, CA_REPLACE, CA_CLEAR } cached_action;
- ScreenPtr replace_screen_arg;
-
-protected:
- ScreenManager ();
-public:
- ~ScreenManager();
-
- void resize(const Size& size);
-
- /** Start the screen manager and let it take control, this will
- not return until the somebody signals a quit() */
- void display ();
-
- /** Replace the current screen */
- void replace_screen (Screen*, bool delete_screen = false);
-
- /** Add a screen on top of another screen */
- void push_screen (Screen*, bool delete_screen = false);
-
- /** Remove the current screen and fall back to the last one */
- void pop_screen ();
-
- /** Remove all screens */
- void pop_all_screens();
-
- /** Remove all screens from the stack */
- void clear();
-
- /** @return a pointer to the current Screen */
- ScreenPtr& get_current_screen();
-
-private:
- void real_clear();
-
- /** Replace the current screen */
- void real_replace_screen (const ScreenPtr&);
-
- /** Remove the current screen and fall back to the last one */
- void real_pop_screen ();
-
- /** Remove all screens */
- void real_pop_all_screens();
-
- /** FadeOver test*/
- void fade_over (ScreenPtr& old_screen, ScreenPtr& new_screen);
-
-public:
- static ScreenManager* instance ();
- static void init();
- static void deinit();
-private:
- ScreenManager (const ScreenManager&);
- ScreenManager& operator= (const ScreenManager&);
-};
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/gui/screen_manager_impl.hpp
===================================================================
--- trunk/pingus/src/gui/screen_manager_impl.hpp 2007-09-30 15:43:10 UTC
(rev 3264)
+++ trunk/pingus/src/gui/screen_manager_impl.hpp 2007-09-30 16:07:08 UTC
(rev 3265)
@@ -1,44 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2000 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREEN_MANAGER_IMPL_HXX
-#define HEADER_PINGUS_SCREEN_MANAGER_IMPL_HXX
-
-#include "pingus.hpp"
-
-
-class ScreenManagerImpl
-{
-private:
- typedef enum { PINGUSMAIN_MENU } States;
-public:
- ScreenManagerImpl ();
- ~ScreenManagerImpl ();
-
- void display ();
-
-private:
- ScreenManagerImpl (const ScreenManagerImpl&);
- ScreenManagerImpl& operator= (const ScreenManagerImpl&);
-};
-
-
-#endif
-
-/* EOF */
Deleted: trunk/pingus/src/gui/screen_ptr.cpp
===================================================================
--- trunk/pingus/src/gui/screen_ptr.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/screen_ptr.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,59 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include <typeinfo>
-#include <iostream>
-#include "screen_ptr.hpp"
-
-
-void
-ScreenPtr::decrease_refcount()
-{
- //std::cout << "ScreenPtr::decrease_refcount(): " << screen << std::endl;
-
- if (delete_it)
- {
- //std::cout << "*ref_count: " << *ref_count << std::endl;
-
- *ref_count -= 1;
-
- if (*ref_count == 0)
- {
- //std::cout << "XXXXXXXXXXXXXX ScreenPtr: deleting: "
- //<< screen << " = " << typeid(*screen).name() << std::endl;
- delete screen;
- delete ref_count;
- }
- }
-}
-
-void
-ScreenPtr::increase_refcount()
-{
- //std::cout << "ScreenPtr::increase_refcount(): " << screen << std::endl;
-
- if (delete_it)
- {
- //std::cout << "*ref_count: " << *ref_count << std::endl;
- *ref_count += 1;
- }
-}
-
-
-/* EOF */
Deleted: trunk/pingus/src/gui/screen_ptr.hpp
===================================================================
--- trunk/pingus/src/gui/screen_ptr.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/gui/screen_ptr.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -1,110 +0,0 @@
-// $Id$
-//
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 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 2
-// 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, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef HEADER_PINGUS_SCREEN_PTR_HXX
-#define HEADER_PINGUS_SCREEN_PTR_HXX
-
-#include "screen.hpp"
-
-
-/** The ScreenPtr is a simple smart pointer to point at a Screen. It
- either deletes the pointer or not, depending on the value of
- delete_it */
-class ScreenPtr
-{
-private:
- Screen* screen;
- bool delete_it;
- long* ref_count;
-
-public:
- ScreenPtr()
- : screen(0), delete_it(false), ref_count(0)
- {
- }
-
- ScreenPtr(Screen* arg_screen, bool arg_delete_it)
- : screen(arg_screen), delete_it(arg_delete_it)
- {
- if (delete_it)
- {
- ref_count = new long;
- *ref_count = 1;
- }
- else
- {
- ref_count = 0;
- }
- }
-
- ScreenPtr (const ScreenPtr& ptr)
- : screen(ptr.screen), delete_it(ptr.delete_it), ref_count(ptr.ref_count)
- {
- increase_refcount();
- }
-
- bool operator==(const ScreenPtr& ptr)
- {
- return screen == ptr.screen;
- }
-
- ScreenPtr& operator= (const ScreenPtr& ptr)
- {
- if (this != &ptr)
- {
- decrease_refcount();
-
- screen = ptr.screen;
- delete_it = ptr.delete_it;
- ref_count = ptr.ref_count;
-
- increase_refcount();
- }
- return *this;
- }
-
- ~ScreenPtr()
- {
- decrease_refcount();
- }
-
- Screen* operator->()
- {
- return screen;
- }
-
- const Screen& operator*()
- {
- return *screen;
- }
-
- Screen* get()
- {
- return screen;
- }
-
-private:
- void decrease_refcount();
- void increase_refcount();
-};
-
-
-#endif
-
-/* EOF */
Modified: trunk/pingus/src/input/sdl_driver.cpp
===================================================================
--- trunk/pingus/src/input/sdl_driver.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/input/sdl_driver.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -20,7 +20,7 @@
*/
#include "global_event.hpp"
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "math/size.hpp"
#include "file_reader.hpp"
#include "sdl_driver.hpp"
Modified: trunk/pingus/src/input_old/controller.cpp
===================================================================
--- trunk/pingus/src/input_old/controller.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/input_old/controller.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "SDL.h"
-#include "../gui/screen_manager.hpp"
+#include "../screen/screen_manager.hpp"
#include "../debug.hpp"
#include "../pingus_error.hpp"
Modified: trunk/pingus/src/layer_manager.hpp
===================================================================
--- trunk/pingus/src/layer_manager.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/layer_manager.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -23,7 +23,7 @@
#include "pingus.hpp"
#include <cmath>
#include "sprite.hpp"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "display/drawing_context.hpp"
Modified: trunk/pingus/src/pingus_main.cpp
===================================================================
--- trunk/pingus/src/pingus_main.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/pingus_main.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -45,7 +45,7 @@
#include "tinygettext/dictionary_manager.hpp"
#include "command_line.hpp"
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "dummy_screen.hpp"
// #include "gui/input_debug_screen.hpp"
#include "path_manager.hpp"
Modified: trunk/pingus/src/pingus_menu.cpp
===================================================================
--- trunk/pingus/src/pingus_menu.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/pingus_menu.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -29,7 +29,7 @@
#include "story_screen.hpp"
#include "worldmap/worldmap.hpp"
#include "worldmap/manager.hpp"
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "pingus_menu_manager.hpp"
#include "gui/gui_manager.hpp"
#include "plf_res_mgr.hpp"
Modified: trunk/pingus/src/pingus_menu_manager.cpp
===================================================================
--- trunk/pingus/src/pingus_menu_manager.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/pingus_menu_manager.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "sound/sound.hpp"
#include "resource.hpp"
#include "blitter.hpp"
Modified: trunk/pingus/src/pingus_sub_menu.hpp
===================================================================
--- trunk/pingus/src/pingus_sub_menu.hpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/pingus_sub_menu.hpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -20,7 +20,7 @@
#ifndef HEADER_PINGUS_PINGUS_SUB_MENU_HXX
#define HEADER_PINGUS_PINGUS_SUB_MENU_HXX
-#include "gui/gui_screen.hpp"
+#include "screen/gui_screen.hpp"
class PingusMenuManager;
Modified: trunk/pingus/src/result_screen.cpp
===================================================================
--- trunk/pingus/src/result_screen.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/result_screen.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -19,10 +19,10 @@
#include <iostream>
#include "gettext.h"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "gui/surface_button.hpp"
#include "gui/gui_manager.hpp"
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "blitter.hpp"
#include "res_descriptor.hpp"
#include "resource.hpp"
Modified: trunk/pingus/src/result_screen.hpp
===================================================================
--- trunk/pingus/src/result_screen.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/result_screen.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -21,7 +21,7 @@
#define HEADER_PINGUS_RESULT_SCREEN_HXX
#include "result.hpp"
-#include "gui/gui_screen.hpp"
+#include "screen/gui_screen.hpp"
/** */
Copied: trunk/pingus/src/screen/game_delta.hpp (from rev 3252,
trunk/pingus/src/gui/game_delta.hpp)
Copied: trunk/pingus/src/screen/gui_screen.cpp (from rev 3252,
trunk/pingus/src/gui/gui_screen.cpp)
===================================================================
--- trunk/pingus/src/gui/gui_screen.cpp 2007-09-28 01:35:56 UTC (rev 3252)
+++ trunk/pingus/src/screen/gui_screen.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -0,0 +1,167 @@
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2000 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 2
+// 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, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include "../globals.hpp"
+#include "../debug.hpp"
+#include "gui/gui_manager.hpp"
+#include "gui_screen.hpp"
+
+
+GUIScreen::GUIScreen()
+ : gui_manager (new GUI::GUIManager())
+{
+}
+
+GUIScreen::~GUIScreen ()
+{
+ delete gui_manager;
+}
+
+/** Draw this screen */
+bool
+GUIScreen::draw(DrawingContext& gc)
+{
+ draw_background(gc);
+ gui_manager->draw(gc);
+ draw_foreground(gc);
+ return true;
+}
+
+ /** Pass a delta to the screen */
+void
+GUIScreen::update (const GameDelta& delta)
+{
+ // Dispatch the recieved input events
+ gui_manager->update (delta);
+
+ update(delta.get_time ());
+
+ for (Input::EventLst::const_iterator i = delta.get_events ().begin ();
+ i != delta.get_events ().end (); ++i)
+ {
+ switch (i->type)
+ {
+ case Input::POINTER_EVENT_TYPE:
+ {
+ // ignored cause this is handled in the gui_manager
+ }
+ break;
+
+ case Input::BUTTON_EVENT_TYPE:
+ {
+ process_button_event (i->button);
+ }
+ break;
+
+ case Input::AXIS_EVENT_TYPE:
+ {
+ if (i->axis.name == Input::ACTION_AXIS)
+ {
+ on_action_axis_move(i->axis.dir);
+ }
+ }
+ break;
+
+ case Input::SCROLLER_EVENT_TYPE:
+ {
+
+ }
+ break;
+
+ case Input::KEYBOARD_EVENT_TYPE:
+ {
+
+ }
+ break;
+
+ default:
+ std::cout << "GUIScreen::update (): unhandled event type: " <<
i->type << std::endl;
+ break;
+ }
+ }
+}
+
+void
+GUIScreen::process_button_event (const Input::ButtonEvent& event)
+{
+ //std::cout << "GUIScreen::process_button_event (Input::ButtonEvent* event)"
<< std::endl;
+
+ if (event.state == Input::BUTTON_PRESSED)
+ {
+ switch (event.name)
+ {
+ case Input::PRIMARY_BUTTON:
+ // ignoring, handled in the gui_manager
+ break;
+ case Input::SECONDARY_BUTTON:
+ // ignoring, handled in the gui_manager
+ break;
+ case Input::PAUSE_BUTTON:
+ on_pause_press ();
+ break;
+ case Input::FAST_FORWARD_BUTTON:
+ on_fast_forward_press ();
+ break;
+ case Input::ARMAGEDDON_BUTTON:
+ on_armageddon_press ();
+ break;
+ case Input::ESCAPE_BUTTON:
+ on_escape_press ();
+ break;
+ default:
+ perr(PINGUS_DEBUG_GUI) << "GUIScreen: ButtonEvent: unhandled event: "
<< event.name << std::endl;
+ break;
+ }
+ }
+ else if (event.state == Input::BUTTON_RELEASED)
+ {
+ switch (event.name)
+ {
+ case Input::PRIMARY_BUTTON:
+ // ignoring, handled in the gui_manager
+ break;
+ case Input::SECONDARY_BUTTON:
+ // ignoring, handled in the gui_manager
+ break;
+ case Input::PAUSE_BUTTON:
+ on_pause_release ();
+ break;
+ case Input::FAST_FORWARD_BUTTON:
+ on_fast_forward_release ();
+ break;
+ case Input::ARMAGEDDON_BUTTON:
+ on_armageddon_release ();
+ break;
+ case Input::ESCAPE_BUTTON:
+ on_escape_release ();
+ break;
+ default:
+ perr(PINGUS_DEBUG_GUI) << "GUIScreen: ButtonEvent: unhandled event: "
<< event.name << std::endl;
+ break;
+ }
+ }
+ else
+ {
+ perr(PINGUS_DEBUG_GUI) << "GUIScreen::process_button_event: got unknown
event.state: "
+ << event.state << std::endl;;
+ }
+}
+
+
+/* EOF */
Copied: trunk/pingus/src/screen/gui_screen.hpp (from rev 3252,
trunk/pingus/src/gui/gui_screen.hpp)
===================================================================
--- trunk/pingus/src/gui/gui_screen.hpp 2007-09-28 01:35:56 UTC (rev 3252)
+++ trunk/pingus/src/screen/gui_screen.hpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -0,0 +1,75 @@
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2000 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 2
+// 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, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef HEADER_PINGUS_GUISCREEN_HXX
+#define HEADER_PINGUS_GUISCREEN_HXX
+
+#include "screen.hpp"
+
+namespace GUI {
+ class GUIManager;
+}
+
+namespace Input {
+ struct ButtonEvent;
+}
+
+class GUIScreen : public Screen
+{
+protected:
+ GUI::GUIManager* gui_manager;
+
+public:
+ GUIScreen ();
+ virtual ~GUIScreen ();
+
+ /** Draw this screen */
+ virtual void draw_foreground (DrawingContext& gc) { UNUSED_ARG(gc); }
+ virtual void draw_background (DrawingContext& gc) { UNUSED_ARG(gc); }
+ virtual bool draw(DrawingContext& gc);
+
+ /** Pass a game delta to the screen */
+ virtual void update (const GameDelta& delta);
+
+ /** */
+ virtual void update (float) {}
+
+ virtual void on_pause_press () {}
+ virtual void on_fast_forward_press () {}
+ virtual void on_armageddon_press () {}
+ virtual void on_escape_press () {}
+
+ virtual void on_pause_release () {}
+ virtual void on_fast_forward_release () {}
+ virtual void on_armageddon_release () {}
+ virtual void on_escape_release () {}
+
+ virtual void on_action_axis_move (float) {}
+
+private:
+ void process_button_event (const Input::ButtonEvent& event);
+
+ GUIScreen (const GUIScreen&);
+ GUIScreen& operator= (const GUIScreen&);
+};
+
+
+#endif
+
+/* EOF */
Copied: trunk/pingus/src/screen/input_debug_screen.cpp (from rev 3252,
trunk/pingus/src/gui/input_debug_screen.cpp)
Copied: trunk/pingus/src/screen/input_debug_screen.hpp (from rev 3252,
trunk/pingus/src/gui/input_debug_screen.hpp)
Copied: trunk/pingus/src/screen/screen.cpp (from rev 3252,
trunk/pingus/src/gui/screen.cpp)
Copied: trunk/pingus/src/screen/screen.hpp (from rev 3252,
trunk/pingus/src/gui/screen.hpp)
Copied: trunk/pingus/src/screen/screen_manager.cpp (from rev 3255,
trunk/pingus/src/gui/screen_manager.cpp)
===================================================================
--- trunk/pingus/src/gui/screen_manager.cpp 2007-09-28 21:52:01 UTC (rev
3255)
+++ trunk/pingus/src/screen/screen_manager.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -0,0 +1,318 @@
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2000 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 2
+// 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, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include "SDL.h"
+#include <iostream>
+#include "../globals.hpp"
+#include "math/size.hpp"
+#include "pathname.hpp"
+#include "display/cursor.hpp"
+#include "display/display.hpp"
+#include "screen_manager.hpp"
+#include "../path_manager.hpp"
+#include "screenshot.hpp"
+#include "../display/drawing_context.hpp"
+#include "../input/controller.hpp"
+#include "../input/manager.hpp"
+
+ScreenManager* ScreenManager::instance_ = 0;
+
+ScreenManager::ScreenManager()
+{
+ display_gc = new DrawingContext();
+
+ cached_action = CA_NONE;
+}
+
+ScreenManager::~ScreenManager ()
+{
+ delete display_gc;
+}
+
+void
+ScreenManager::display()
+{
+ Input::Manager input_manager;
+
+ Input::Controller* input_controller = 0;
+
+ if (controller_file.empty())
+ input_controller =
input_manager.create_controller(Pathname("controller/default.scm",
+
Pathname::DATA_PATH));
+ else
+ input_controller =
input_manager.create_controller(Pathname(controller_file,
+
Pathname::SYSTEM_PATH));
+
+ Cursor* cursor = 0;
+ if (swcursor_enabled)
+ {
+ cursor = new Cursor("core/cursors/animcross");
+ Display::add_flip_screen_hook(cursor);
+ SDL_ShowCursor(SDL_DISABLE);
+ }
+
+ DeltaManager delta_manager;
+
+ // Main loop for the menu
+ while (!screens.empty())
+ {
+ float time_delta = delta_manager.getset();
+
+ if (time_delta > 1.0)
+ {
+ if (maintainer_mode)
+ std::cout << "ScreenManager: detected large delta (" << time_delta
+ << "), ignoring and doing frameskip" << std::endl;
+ continue;
+ }
+
+ input_manager.update(time_delta);
+
+ // Fill the delta with values
+ GameDelta delta(time_delta, delta_manager.get_absolute(),
+ input_controller->poll_events());
+
+ last_screen = get_current_screen();
+
+ // Most likly the screen will get changed in this update call
+ get_current_screen()->update (delta);
+
+ if (cursor)
+ cursor->update(time_delta);
+
+ // Last screen has poped, so we are going to end here
+ if (screens.empty())
+ continue;
+
+ while (cached_action != CA_NONE)
+ {
+ switch (cached_action)
+ {
+ case CA_POP:
+ real_pop_screen();
+ break;
+ case CA_POP_ALL:
+ real_pop_all_screens();
+ break;
+ case CA_REPLACE:
+ real_replace_screen(replace_screen_arg);
+ break;
+ case CA_CLEAR:
+ real_clear();
+ break;
+ default:
+ break;
+ }
+ }
+
+ // FIXME: is there a more gentel way to do that instead of spreading the
checks all around here?
+ // Last screen has poped, so we are going to end here
+ if (screens.empty())
+ continue;
+
+ // skip draw if the screen changed to avoid glitches
+ if (last_screen == get_current_screen() || fast_mode)
+ {
+ if (get_current_screen()->draw(*display_gc))
+ {
+ display_gc->render(Display::get_screen(), Rect(Vector2i(0,0),
Size(Display::get_width(),
+
Display::get_height())));
+ Display::flip_display ();
+ display_gc->clear();
+ }
+ }
+ else
+ {
+ //std::cout << "ScreenManager: fading screens" << std::endl;
+ fade_over(last_screen, get_current_screen());
+ }
+
+ // Stupid hack to make this thing take less CPU
+ SDL_Delay(1);
+ }
+
+ Display::remove_flip_screen_hook(cursor);
+ delete cursor;
+ delete input_controller;
+}
+
+ScreenPtr&
+ScreenManager::get_current_screen()
+{
+ assert(!screens.empty());
+ return screens.back ();
+}
+
+ScreenManager*
+ScreenManager::instance ()
+{
+ if (instance_)
+ return instance_;
+ else
+ return instance_ = new ScreenManager ();
+}
+
+void
+ScreenManager::push_screen (Screen* screen, bool delete_screen)
+{
+ if (!screens.empty())
+ {
+ screens.back ()->on_shutdown ();
+ }
+
+ screens.push_back (ScreenPtr(screen, delete_screen));
+ screen->on_startup ();
+}
+
+void
+ScreenManager::pop_screen ()
+{
+ assert (cached_action == CA_NONE || cached_action == CA_POP);
+ cached_action = CA_POP;
+}
+
+void
+ScreenManager::pop_all_screens()
+{
+ assert(cached_action == CA_NONE);
+ cached_action = CA_POP_ALL;
+}
+
+void
+ScreenManager::replace_screen (Screen* screen, bool delete_screen)
+{
+ assert (cached_action == CA_NONE);
+ cached_action = CA_REPLACE;
+ replace_screen_arg = ScreenPtr(screen, delete_screen);
+}
+
+void
+ScreenManager::real_replace_screen (const ScreenPtr& ptr)
+{
+ cached_action = CA_NONE;
+ screens.back ()->on_shutdown ();
+ screens.back () = ptr;
+ screens.back ()->on_startup ();
+}
+
+void
+ScreenManager::real_pop_screen ()
+{
+ cached_action = CA_NONE;
+ ScreenPtr back = screens.back ();
+ screens.pop_back();
+ back->on_shutdown();
+
+ if (!screens.empty ())
+ {
+ screens.back()->on_startup ();
+ }
+}
+
+void
+ScreenManager::real_pop_all_screens()
+{
+ cached_action = CA_NONE;
+ ScreenPtr back = screens.back();
+ screens.pop_back();
+ back->on_shutdown();
+
+ screens.clear();
+}
+
+void
+ScreenManager::clear()
+{
+ cached_action = CA_CLEAR;
+}
+
+void
+ScreenManager::real_clear()
+{
+ cached_action = CA_NONE;
+ screens.clear();
+}
+
+void
+ScreenManager::fade_over (ScreenPtr& old_screen, ScreenPtr& new_screen)
+{
+ DeltaManager delta_manager;
+ float passed_time = 0;
+
+ float progress = 0.0f;
+ while (progress <= 1.0f)
+ {
+ float time_delta = delta_manager.getset ();
+ passed_time += time_delta;
+
+ int border_x = int((Display::get_width()/2) * (1.0f - progress));
+ int border_y = int((Display::get_height()/2) * (1.0f - progress));
+
+ old_screen->draw(*display_gc);
+ display_gc->render(Display::get_screen(), Rect(Vector2i(0,0),
Size(Display::get_width(),
+
Display::get_height())));
+ display_gc->clear();
+
+ Display::push_cliprect(Rect(Vector2i(0 + border_x, 0 + border_y),
+ Size(screen_width - 2*border_x,
screen_height - 2*border_y)));
+
+ new_screen->draw(*display_gc);
+ display_gc->render(Display::get_screen(), Rect(Vector2i(0,0),
Size(Display::get_width(),
+
Display::get_height())));
+ display_gc->clear();
+
+ //GameDelta delta (time_delta, CL_System::get_time(), events);
+ // FIXME: Animation looks nifty but doesn't work all that good
+ //new_screen->update (delta);
+ //old_screen->update (delta);
+
+ Display::pop_cliprect();
+ Display::flip_display ();
+ display_gc->clear();
+
+ progress = passed_time/1.0f;
+ }
+}
+
+void
+ScreenManager::resize(const Size& size)
+{
+ display_gc->set_rect(Rect(Vector2i(0, 0), size));
+
+ // FIXME: Calling this causes horrible flicker, any better way to resize the
screen?
+ Display::set_video_mode(size.width, size.height);
+
+ get_current_screen()->resize(size);
+
+}
+
+void
+ScreenManager::init()
+{
+ instance_ = 0;
+}
+
+void
+ScreenManager::deinit()
+{
+ delete instance_;
+ instance_ = 0;
+}
+
+/* EOF */
Copied: trunk/pingus/src/screen/screen_manager.hpp (from rev 3264,
trunk/pingus/src/gui/screen_manager.hpp)
Copied: trunk/pingus/src/screen/screen_manager_impl.hpp (from rev 3252,
trunk/pingus/src/gui/screen_manager_impl.hpp)
Copied: trunk/pingus/src/screen/screen_ptr.cpp (from rev 3252,
trunk/pingus/src/gui/screen_ptr.cpp)
Copied: trunk/pingus/src/screen/screen_ptr.hpp (from rev 3252,
trunk/pingus/src/gui/screen_ptr.hpp)
Modified: trunk/pingus/src/screenshot.cpp
===================================================================
--- trunk/pingus/src/screenshot.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/screenshot.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -23,7 +23,7 @@
#include <stdio.h>
#include <fstream>
#include <iostream>
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "system.hpp"
#include "screenshot.hpp"
#include "gettext.h"
Modified: trunk/pingus/src/start_screen.cpp
===================================================================
--- trunk/pingus/src/start_screen.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/start_screen.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -21,7 +21,7 @@
#include "gui/gui_manager.hpp"
#include "gui/surface_button.hpp"
#include "gui/component.hpp"
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "blitter.hpp"
#include "gettext.h"
#include "game_session.hpp"
@@ -34,7 +34,7 @@
#include "sound/sound.hpp"
#include "pingus_level.hpp"
#include "string_format.hpp"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "string_util.hpp"
class StartScreenComponent : public GUI::Component
Modified: trunk/pingus/src/start_screen.hpp
===================================================================
--- trunk/pingus/src/start_screen.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/start_screen.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -21,7 +21,7 @@
#define HEADER_PINGUS_START_SCREEN_HXX
#include "pingus_level.hpp"
-#include "gui/gui_screen.hpp"
+#include "screen/gui_screen.hpp"
/** */
Modified: trunk/pingus/src/story_screen.cpp
===================================================================
--- trunk/pingus/src/story_screen.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/story_screen.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -23,7 +23,7 @@
#include "resource.hpp"
#include "gui/gui_manager.hpp"
#include "gui/surface_button.hpp"
-#include "gui/screen_manager.hpp"
+#include "screen/screen_manager.hpp"
#include "gui/component.hpp"
#include "math.hpp"
#include "pingus_menu_manager.hpp"
Modified: trunk/pingus/src/story_screen.hpp
===================================================================
--- trunk/pingus/src/story_screen.hpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/story_screen.hpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -22,7 +22,7 @@
#include <string>
#include "res_descriptor.hpp"
-#include "gui/gui_screen.hpp"
+#include "screen/gui_screen.hpp"
#include "worldmap/worldmap_story.hpp"
Modified: trunk/pingus/src/world.cpp
===================================================================
--- trunk/pingus/src/world.cpp 2007-09-30 15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/world.cpp 2007-09-30 16:07:08 UTC (rev 3265)
@@ -29,7 +29,7 @@
#include "particles/rain_particle_holder.hpp"
#include "particles/smoke_particle_holder.hpp"
#include "particles/snow_particle_holder.hpp"
-#include "gui/display.hpp"
+#include "display/display.hpp"
#include "pingu.hpp"
#include "display/scene_context.hpp"
#include "pingus_level.hpp"
Modified: trunk/pingus/src/worldmap/level_dot.cpp
===================================================================
--- trunk/pingus/src/worldmap/level_dot.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/worldmap/level_dot.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -25,7 +25,7 @@
#include "../system.hpp"
#include "../fonts.hpp"
#include "../display/drawing_context.hpp"
-#include "../gui/screen_manager.hpp"
+#include "../screen/screen_manager.hpp"
#include "../resource.hpp"
#include "../path_manager.hpp"
#include "../start_screen.hpp"
Modified: trunk/pingus/src/worldmap/manager.cpp
===================================================================
--- trunk/pingus/src/worldmap/manager.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/worldmap/manager.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -20,8 +20,8 @@
#include <iostream>
#include "../gettext.h"
#include "../fonts.hpp"
-#include "../gui/display.hpp"
-#include "../gui/screen_manager.hpp"
+#include "../display/display.hpp"
+#include "../screen/screen_manager.hpp"
#include "../gui/surface_button.hpp"
#include "../path_manager.hpp"
#include "../res_descriptor.hpp"
Modified: trunk/pingus/src/worldmap/manager.hpp
===================================================================
--- trunk/pingus/src/worldmap/manager.hpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/worldmap/manager.hpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -22,7 +22,7 @@
#include <string>
#include "../gui/gui_manager.hpp"
-#include "../gui/gui_screen.hpp"
+#include "../screen/gui_screen.hpp"
class SceneContext;
Modified: trunk/pingus/src/worldmap/worldmap.cpp
===================================================================
--- trunk/pingus/src/worldmap/worldmap.cpp 2007-09-30 15:43:10 UTC (rev
3264)
+++ trunk/pingus/src/worldmap/worldmap.cpp 2007-09-30 16:07:08 UTC (rev
3265)
@@ -19,7 +19,7 @@
#include <assert.h>
#include <iostream>
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../fonts.hpp"
#include "../path_manager.hpp"
#include "../stat_manager.hpp"
@@ -49,7 +49,7 @@
#include "../stat_manager.hpp"
#include "../story_screen.hpp"
-#include "../gui/screen_manager.hpp"
+#include "../screen/screen_manager.hpp"
namespace WorldMapNS {
Modified: trunk/pingus/src/worldobjs/solid_color_background.cpp
===================================================================
--- trunk/pingus/src/worldobjs/solid_color_background.cpp 2007-09-30
15:43:10 UTC (rev 3264)
+++ trunk/pingus/src/worldobjs/solid_color_background.cpp 2007-09-30
16:07:08 UTC (rev 3265)
@@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "../display/scene_context.hpp"
#include "solid_color_background.hpp"
Modified: trunk/pingus/src/worldobjs/surface_background.cpp
===================================================================
--- trunk/pingus/src/worldobjs/surface_background.cpp 2007-09-30 15:43:10 UTC
(rev 3264)
+++ trunk/pingus/src/worldobjs/surface_background.cpp 2007-09-30 16:07:08 UTC
(rev 3265)
@@ -24,7 +24,7 @@
#include "../resource.hpp"
#include "../globals.hpp"
#include "../blitter.hpp"
-#include "../gui/display.hpp"
+#include "../display/display.hpp"
#include "surface_background.hpp"
namespace WorldObjs {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3265 - in trunk/pingus/src: . components display editor gui input input_old screen worldmap worldobjs,
grumbel at BerliOS <=