pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3256 - in trunk/pingus: . data/controller src/editor


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3256 - in trunk/pingus: . data/controller src/editor
Date: Sat, 29 Sep 2007 15:02:50 +0200

Author: grumbel
Date: 2007-09-29 15:02:50 +0200 (Sat, 29 Sep 2007)
New Revision: 3256

Added:
   trunk/pingus/src/editor/minimap.cpp
   trunk/pingus/src/editor/minimap.hpp
Modified:
   trunk/pingus/NEWS
   trunk/pingus/SConstruct
   trunk/pingus/TODO
   trunk/pingus/data/controller/default.scm
   trunk/pingus/src/editor/editor_screen.cpp
   trunk/pingus/src/editor/editor_screen.hpp
Log:
- added simple minimap to the editor

Modified: trunk/pingus/NEWS
===================================================================
--- trunk/pingus/NEWS   2007-09-28 21:52:01 UTC (rev 3255)
+++ trunk/pingus/NEWS   2007-09-29 13:02:50 UTC (rev 3256)
@@ -1,3 +1,9 @@
+0.7.2 (23/Sep/2007)
+===================
+* added window resize support to the editor (use --allow-resize)
+* added minimap to editor  
+
+
 0.7.1 (23/Sep/2007)
 ===================
 * faster sprite drawing, so more overall fps

Modified: trunk/pingus/SConstruct
===================================================================
--- trunk/pingus/SConstruct     2007-09-28 21:52:01 UTC (rev 3255)
+++ trunk/pingus/SConstruct     2007-09-29 13:02:50 UTC (rev 3256)
@@ -89,6 +89,7 @@
 'src/editor/file_dialog.cpp',
 'src/editor/editor_screen.cpp',
 'src/editor/combobox.cpp', 
+'src/editor/minimap.cpp', 
 'src/editor/editor_viewport.cpp', 
 'src/editor/level_objs.cpp',
 'src/editor/inputbox.cpp',

Modified: trunk/pingus/TODO
===================================================================
--- trunk/pingus/TODO   2007-09-28 21:52:01 UTC (rev 3255)
+++ trunk/pingus/TODO   2007-09-29 13:02:50 UTC (rev 3256)
@@ -144,7 +144,7 @@
   Enable Autoscrolling: [always, only in fullscreen, never]
   ----------------------------------
 
-- add dynamic resize for the game
+- add dynamic resize for the game and editor file dialog
 
 - resource system needs a review/rewrite
 
@@ -237,7 +237,7 @@
 
 - add yes/no question when creating a new level
 
-- added overwrite warning to file dialog
+- add overwrite warning to file dialog
 
 - add pixel perfect object selection
 

Modified: trunk/pingus/data/controller/default.scm
===================================================================
--- trunk/pingus/data/controller/default.scm    2007-09-28 21:52:01 UTC (rev 
3255)
+++ trunk/pingus/data/controller/default.scm    2007-09-29 13:02:50 UTC (rev 
3256)
@@ -6,6 +6,7 @@
     (sdl:mouse-pointer))
 
   (standard-scroller
+   (evdev:scroller (device "/dev/input/spacenavigator") (x 0) (y 1))
    (core:button-scroller
     (up    (sdl:keyboard-button (key "up")))
     (down  (sdl:keyboard-button (key "down")))
@@ -13,10 +14,12 @@
     (right (sdl:keyboard-button (key "right")))))
 
   (primary-button
-    (sdl:mouse-button (button 1)))
+    (sdl:mouse-button (button 1))
+    (evdev:button (device "/dev/input/spacenavigator") (button 256)))
 
   (secondary-button
-    (sdl:mouse-button (button 3)))
+    (sdl:mouse-button (button 3))
+    (evdev:button (device "/dev/input/spacenavigator") (button 257)))
 
   (pause-button
    (sdl:keyboard-button (key "p")))

Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp   2007-09-28 21:52:01 UTC (rev 
3255)
+++ trunk/pingus/src/editor/editor_screen.cpp   2007-09-29 13:02:50 UTC (rev 
3256)
@@ -38,6 +38,7 @@
 #include "editor_level.hpp"
 #include "panel.hpp"
 #include "panel.hpp"
+#include "minimap.hpp"
 #include "editor_screen.hpp"
 #include "editor_viewport.hpp"
 #include "level_objs.hpp"
@@ -69,9 +70,13 @@
   //      Size(240, Display::get_height() - (600 - 495))),
 
   object_selector   = new ObjectSelector(this, Rect(Display::get_width()-244, 
38,
-                                                    Display::get_width(), 
Display::get_height()));
+                                                    Display::get_width(), 
Display::get_height() - 183));
   gui_manager->add(object_selector, true);
 
+  minimap = new Minimap(this, Rect(Vector2i(Display::get_width()-244, 
Display::get_height()-183),
+                                   Size(244, 183)));
+  gui_manager->add(minimap, true);
+
   object_properties = new ObjectProperties(this, 
Rect(Vector2i(0,Display::get_height()-150), Size(200, 150)));
   gui_manager->add(object_properties, true);
 
@@ -102,6 +107,7 @@
   level_properties->set_level(plf);
   action_properties->set_level(plf);
   gui_manager->add(level_properties, true);
+
   viewport->refresh();
 }
 

Modified: trunk/pingus/src/editor/editor_screen.hpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.hpp   2007-09-28 21:52:01 UTC (rev 
3255)
+++ trunk/pingus/src/editor/editor_screen.hpp   2007-09-29 13:02:50 UTC (rev 
3256)
@@ -40,6 +40,7 @@
 class ObjectProperties;
 class ActionProperties;
 class LevelProperties;
+class Minimap;
 
 /** This class is the screen that contains all of the
     editor objects */
@@ -52,9 +53,11 @@
   Panel* panel;
   EditorViewport*   viewport;
   ObjectSelector*   object_selector;
+  Minimap*          minimap;
   ObjectProperties* object_properties;
   ActionProperties* action_properties;
   LevelProperties*  level_properties;
+
   FileDialog*       file_load_dialog;
   FileDialog*       file_save_dialog;
   

Added: trunk/pingus/src/editor/minimap.cpp
===================================================================
--- trunk/pingus/src/editor/minimap.cpp 2007-09-28 21:52:01 UTC (rev 3255)
+++ trunk/pingus/src/editor/minimap.cpp 2007-09-29 13:02:50 UTC (rev 3256)
@@ -0,0 +1,102 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 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 "editor_level.hpp"
+#include "editor_screen.hpp"
+#include "editor_viewport.hpp"
+#include "level_objs.hpp"
+#include "gui_style.hpp"
+#include "minimap.hpp"
+
+namespace Editor {
+
+Minimap::Minimap(EditorScreen* editor_, const Rect& rect)
+  : RectComponent(rect),
+    editor(editor_),
+    drawing_context(new DrawingContext(rect.grow(-3)))
+{
+}
+
+Minimap::~Minimap()
+{
+}
+
+void
+Minimap::draw(DrawingContext& gc)
+{
+  GUIStyle::draw_raised_box(gc, rect);
+
+  DrawingContext& dc = *drawing_context;
+
+  dc.clear();
+  Rect minimap_rect = dc.get_rect();
+  dc.draw_fillrect(Rect(Vector2i(0, 0), Size(minimap_rect.get_width(), 
minimap_rect.get_height())),
+                   Color(0,0,0), -100000.0f);
+
+  // FIXME: add current viewport and scrolling
+  // editor->get_viewport()->get_rect();
+
+  std::vector<LevelObj*>& objects = *editor->get_viewport()->get_objects();
+  Size levelsize = editor->get_level()->get_size();
+
+  for(std::vector<LevelObj*>::iterator i = objects.begin(); i != 
objects.end(); ++i)
+    {
+      Rect r = (*i)->get_rect();
+
+      // Translate the object into minimap-co-space
+      r.left  = r.left  * minimap_rect.get_width() / levelsize.width;
+      r.right = r.right * minimap_rect.get_width() / levelsize.width;
+
+      r.top    = r.top    * minimap_rect.get_height() / levelsize.height;
+      r.bottom = r.bottom * minimap_rect.get_height() / levelsize.height;
+
+      unsigned attr = (*i)->get_attribs();
+
+      Color color;
+
+      if (attr & HAS_OWNER) // entrance & exit
+        color = Color(255,255,0);
+      else if (attr & HAS_GPTYPE) // groundpiece
+        color = Color(0,255,0);
+      else if (attr & HAS_REPEAT) 
+        color = Color(0,0,255); // liquid
+      else // hotspot, background, etc.
+        color = Color(255,0,0);
+
+      dc.draw_fillrect(r, color, (*i)->get_pos().z);
+    }
+
+  gc.draw(dc);
+}
+
+void
+Minimap::update (float delta)
+{
+  
+}
+
+void
+Minimap::update_layout()
+{
+  drawing_context->set_rect(rect.grow(-3));
+}
+
+} // namespace Editor
+
+/* EOF */


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

Added: trunk/pingus/src/editor/minimap.hpp
===================================================================
--- trunk/pingus/src/editor/minimap.hpp 2007-09-28 21:52:01 UTC (rev 3255)
+++ trunk/pingus/src/editor/minimap.hpp 2007-09-29 13:02:50 UTC (rev 3256)
@@ -0,0 +1,50 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 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_EDITOR_MINIMAP_HPP
+#define HEADER_PINGUS_EDITOR_MINIMAP_HPP
+
+#include "gui/rect_component.hpp"
+
+namespace Editor {
+
+class EditorScreen;
+
+/** */
+class Minimap : public GUI::RectComponent
+{
+private:
+  EditorScreen* editor;
+  DrawingContext* drawing_context;
+  
+public:
+  Minimap(EditorScreen*, const Rect& );
+  ~Minimap();
+
+  void draw (DrawingContext& gc);
+  void update (float delta);
+
+  void update_layout();
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */


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





reply via email to

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