pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3079 - in trunk/pingus: data/controller data/data data/ima


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3079 - in trunk/pingus: data/controller data/data data/images/core/editor src src/editor
Date: Wed, 5 Sep 2007 03:35:18 +0200

Author: grumbel
Date: 2007-09-05 03:35:15 +0200 (Wed, 05 Sep 2007)
New Revision: 3079

Added:
   trunk/pingus/data/controller/xinput.scm
   trunk/pingus/data/images/core/editor/objects.png
Modified:
   trunk/pingus/data/data/core.res
   trunk/pingus/src/editor/context_menu.cpp
   trunk/pingus/src/editor/editor_screen.cpp
   trunk/pingus/src/editor/editor_screen.hpp
   trunk/pingus/src/editor/panel.cpp
   trunk/pingus/src/editor/panel.hpp
   trunk/pingus/src/pingus_main.cpp
Log:
- fixed editor start with level from command line
- some more panel work

Added: trunk/pingus/data/controller/xinput.scm
===================================================================
--- trunk/pingus/data/controller/xinput.scm     2007-09-05 00:17:37 UTC (rev 
3078)
+++ trunk/pingus/data/controller/xinput.scm     2007-09-05 01:35:15 UTC (rev 
3079)
@@ -0,0 +1,33 @@
+(pingus-controller
+ (standard-pointer
+  (xinput:pointer (device "gstylus")))
+
+ (primary-button
+  )
+
+ (secondary-button
+  )
+
+ (pause-button
+  )
+
+ (fast-forward-button
+  )
+
+ (armageddon-button
+  )
+
+ (escape-button
+  (sdl:keyboard-button (key "escape")))
+
+ (action-axis
+  )
+
+ (action-up-button
+  )
+
+ (action-down-button
+  )
+ )
+
+;; EOF ;;

Modified: trunk/pingus/data/data/core.res
===================================================================
--- trunk/pingus/data/data/core.res     2007-09-05 00:17:37 UTC (rev 3078)
+++ trunk/pingus/data/data/core.res     2007-09-05 01:35:15 UTC (rev 3079)
@@ -53,7 +53,24 @@
         (name "object-top")
         (image-file "../images/core/editor/object-top.png"))
 
+
       (sprite
+        (name "document-properties")
+        (image-file "../images/core/editor/document-properties.png"))
+
+      (sprite
+        (name "objects")
+        (image-file "../images/core/editor/objects.png"))
+
+      (sprite
+        (name "object-properties")
+        (image-file "../images/core/editor/object-properties.png"))
+
+      (sprite
+        (name "snap-grid")
+        (image-file "../images/core/editor/snap-grid.png"))
+
+      (sprite
         (name "object-up")
         (image-file "../images/core/editor/object-up.png"))
 
@@ -66,6 +83,18 @@
         (image-file "../images/core/editor/object-flip_horizontal.png"))
 
       (sprite
+        (name "play")
+        (image-file "../images/core/editor/play.png"))
+
+      (sprite
+        (name "object-rotate-right")
+        (image-file "../images/core/editor/object-rotate_right.png"))
+
+      (sprite
+        (name "object-rotate-left")
+        (image-file "../images/core/editor/object-rotate_left.png"))
+
+      (sprite
         (name "object-flip-vertical")
         (image-file "../images/core/editor/object-flip_vertical.png"))
 
@@ -135,11 +164,11 @@
 
       (sprite
         (name "help")
-        (image-file "../images/core/editor/tb_help.png"))
+        (image-file "../images/core/editor/help.png"))
 
       (sprite
         (name "delete")
-        (image-file "../images/core/editor/tb_trash.png"))
+        (image-file "../images/core/editor/edit-delete.png"))
 
       (sprite
         (name "index")

Added: trunk/pingus/data/images/core/editor/objects.png
===================================================================
(Binary files differ)


Property changes on: trunk/pingus/data/images/core/editor/objects.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: trunk/pingus/src/editor/context_menu.cpp
===================================================================
--- trunk/pingus/src/editor/context_menu.cpp    2007-09-05 00:17:37 UTC (rev 
3078)
+++ trunk/pingus/src/editor/context_menu.cpp    2007-09-05 01:35:15 UTC (rev 
3079)
@@ -35,7 +35,7 @@
     pos(p),
     selected_action_offset(0),
     displayed_child(0),
-    item_height(Fonts::pingus_small.get_height())
+    item_height(Fonts::courier_small.get_height())
 {
   if (base_menu)
     {
@@ -90,7 +90,7 @@
 
       // Draw the action names
       for (unsigned i = 0; i < actions.size(); i++)
-        gc.print_left(Fonts::pingus_small, pos.x, pos.y + 
+        gc.print_left(Fonts::courier_small, pos.x, pos.y + 
                       (i * item_height), actions[i].friendly_name);
     }
 }

Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp   2007-09-05 00:17:37 UTC (rev 
3078)
+++ trunk/pingus/src/editor/editor_screen.cpp   2007-09-05 01:35:15 UTC (rev 
3079)
@@ -40,14 +40,19 @@
 namespace Editor {
 
 // Default constructor
-EditorScreen::EditorScreen(EditorLevel* level)
-  : plf(level), 
+EditorScreen::EditorScreen()
+  : plf(new EditorLevel()), 
     panel(0),
     viewport(0),
     filedialog(0),
     close_dialog(false)
 {
-  if (!plf) plf = new EditorLevel();
+  // Create the viewport for the images and data
+  viewport = new EditorViewport(this);
+  gui_manager->add(viewport, true);    
+       
+  // Create the panel for the buttons
+  panel = new Panel(this);
 }
 
 // Destructor
@@ -58,18 +63,6 @@
     delete filedialog;
 }
 
-// Startup code
-void
-EditorScreen::on_startup()
-{
-  // Create the viewport for the images and data
-  viewport = new EditorViewport(this);
-  gui_manager->add(viewport, true);    
-       
-  // Create the panel for the buttons
-  panel = new Panel(this);
-}
-
 // Close the current screen
 void
 EditorScreen::close_screen()
@@ -105,7 +98,7 @@
 
 // Save the current level
 void 
-EditorScreen::save(const std::string &file, const std::string &filemask)
+EditorScreen::save(const std::string &file)
 {
   close_dialog = true;
   plf->save_level(file);
@@ -114,7 +107,7 @@
 
 // Load a new level
 void 
-EditorScreen::load(const std::string &file, const std::string &filemask)
+EditorScreen::load(const std::string &file)
 {
   close_dialog = true;
   plf->load_level(file);

Modified: trunk/pingus/src/editor/editor_screen.hpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.hpp   2007-09-05 00:17:37 UTC (rev 
3078)
+++ trunk/pingus/src/editor/editor_screen.hpp   2007-09-05 01:35:15 UTC (rev 
3079)
@@ -58,14 +58,11 @@
 
 public:
   /** Default constructor */
-  EditorScreen(EditorLevel* level = 0);
+  EditorScreen();
 
   /** Destructor */
   ~EditorScreen();
 
-  /** Code that runs when the screen first opens */
-  void on_startup();
-
   /** Closes the current screen */
   void close_screen();
 
@@ -98,11 +95,13 @@
   void cancel();
 
   /** Saves the currently loaded level */
-  void save(const std::string &file, const std::string &filemask);
+  void save(const std::string &file);
 
   /** Load a new level */
-  void load(const std::string &file, const std::string &filemask);
+  void load(const std::string &file);
 
+  void load_level(const std::string& file);
+
   /** Plays the currently loaded level */
   void play_level();
 

Modified: trunk/pingus/src/editor/panel.cpp
===================================================================
--- trunk/pingus/src/editor/panel.cpp   2007-09-05 00:17:37 UTC (rev 3078)
+++ trunk/pingus/src/editor/panel.cpp   2007-09-05 01:35:15 UTC (rev 3079)
@@ -23,6 +23,7 @@
 **  02111-1307, USA.
 */
 
+#include "fonts.hpp"
 #include "gui/display.hpp" 
 #include "display/drawing_context.hpp"
 #include "resource.hpp"
@@ -63,16 +64,18 @@
   Sprite sprite;
   bool   mouse_over;
   bool   mouse_down;
-  Vector2i pos;
+  Vector2i    pos;
+  std::string tooltip;
 
 public:
-  PanelButton(const Vector2i& pos_, const std::string& name)
+  PanelButton(const Vector2i& pos_, const std::string& name, const 
std::string& tooltip_)
     : button_raised(Resource::load_sprite("core/editor/button-raised")),
       button_pressed(Resource::load_sprite("core/editor/button-pressed")),
       sprite(Resource::load_sprite(name)),
       mouse_over(false),
       mouse_down(false),
-      pos(pos_)
+      pos(pos_),
+      tooltip(tooltip_)
   {
   }
 
@@ -84,6 +87,11 @@
       gc.draw(button_raised, pos);
 
     gc.draw(sprite, pos + Vector2i(5,5));
+
+    if (mouse_over)
+      {
+        gc.print_center(Fonts::courier_small, pos.x + 17, pos.y + 38, tooltip);
+      }
   }
 
   /** Emmitted when pointer enters the region of the component */
@@ -130,18 +138,34 @@
 {  
   editor->get_gui_manager()->add(this, true);
 
-  add_button("core/editor/document-new");
-  add_button("core/editor/document-open");
-  add_button("core/editor/document-save");
-  add_button("core/editor/document-save-as");
+  add_button("core/editor/document-new",  "New level");
+  add_button("core/editor/document-open", "Open level...");
+  add_button("core/editor/document-save", "Save level...");
+  add_button("core/editor/document-save-as", "Save level as...");
   add_separator();
-  add_button("core/editor/object-top");
-  add_button("core/editor/object-up");
-  add_button("core/editor/object-down");
-  add_button("core/editor/object-bottom");
+  add_button("core/editor/play", "Play level...");
   add_separator();
-  add_button("core/editor/object-flip-horizontal");
-  add_button("core/editor/object-flip-vertical");
+  add_button("core/editor/actions", "Configure actions");
+  add_button("core/editor/document-properties", "Configure level");
+  add_button("core/editor/object-properties", "Display object properties");
+  add_separator();
+  add_button("core/editor/delete", "Delete the selected objects");
+  add_separator();
+  add_button("core/editor/object-top",    "Raise object to top");
+  add_button("core/editor/object-up",     "Raise object");
+  add_button("core/editor/object-down",   "Lower object");
+  add_button("core/editor/object-bottom", "Lower object to bottom");
+  add_separator();
+  add_button("core/editor/object-flip-horizontal", "Flip object horizontally");
+  add_button("core/editor/object-flip-vertical", "Flip object vertically");
+  add_separator();
+  add_button("core/editor/object-rotate-left", "Rotate object 90 degree");
+  add_button("core/editor/object-rotate-right", "Rotate object -90 degree");
+  add_separator();
+  add_button("core/editor/snap-grid", "Snap objects to grid");
+  add_button("core/editor/objects", "Show object insertion window");
+  add_separator();
+  add_button("core/editor/help", "Display help");
 }
 
 Panel::~Panel()
@@ -151,9 +175,10 @@
 void
 Panel::draw (DrawingContext& gc)
 {
-  // FIXME: Should handle resize
-  gc.draw_fillrect(0, 0, Display::get_width(), 38, Color(237, 233, 227));
-  gc.draw(logo, Display::get_width() - logo.get_width(), 0);
+  // FIXME: Could use draw_line
+  gc.draw_fillrect(0, 0, Display::get_width(), 38, Color(255, 255, 255));
+  gc.draw_fillrect(1, 1, Display::get_width(), 38, Color(169, 157, 140));
+  gc.draw_fillrect(1, 1, Display::get_width()-1, 37, Color(237, 233, 227));
 }
 
 void
@@ -163,9 +188,9 @@
 }
 
 void
-Panel::add_button(const std::string& image)
+Panel::add_button(const std::string& image, const std::string& tooltip)
 {
-  PanelButton* comp = new PanelButton(pos, image);
+  PanelButton* comp = new PanelButton(pos, image, tooltip);
   pos.x += comp->get_width();
   editor->get_gui_manager()->add(comp, true);
 }
@@ -173,7 +198,7 @@
 void
 Panel::add_toggle_button(const std::string& image)
 {
-  PanelButton* comp = new PanelButton(pos, image);
+  PanelButton* comp = new PanelButton(pos, image, "");
   pos.x += comp->get_width();
   editor->get_gui_manager()->add(comp, true);
 }

Modified: trunk/pingus/src/editor/panel.hpp
===================================================================
--- trunk/pingus/src/editor/panel.hpp   2007-09-05 00:17:37 UTC (rev 3078)
+++ trunk/pingus/src/editor/panel.hpp   2007-09-05 01:35:15 UTC (rev 3079)
@@ -45,7 +45,7 @@
   void draw (DrawingContext& gc);
   void update (float delta);
 
-  void add_button(const std::string& image);
+  void add_button(const std::string& image, const std::string& tooltip = "");
   void add_toggle_button(const std::string& image);
   void add_separator();
   

Modified: trunk/pingus/src/pingus_main.cpp
===================================================================
--- trunk/pingus/src/pingus_main.cpp    2007-09-05 00:17:37 UTC (rev 3078)
+++ trunk/pingus/src/pingus_main.cpp    2007-09-05 01:35:15 UTC (rev 3079)
@@ -684,7 +684,7 @@
   }
 
   if (print_fps)
-      Display::add_flip_screen_hook(&fps_counter);
+    Display::add_flip_screen_hook(&fps_counter);
 
   if (!render_preview)
     {
@@ -718,33 +718,25 @@
     {
       ScreenManager::instance()->push_screen(Credits::instance(), false);
     }
-  else if (!levelfile.empty ()) 
+  else if (editor == true)
     {
-      bool successfull = true;
-      if (!System::exist(levelfile))
+      Editor::EditorScreen* editor = new Editor::EditorScreen();
+      if (!levelfile.empty())
         {
-          if (System::exist(levelfile + ".pingus"))
-            levelfile += ".pingus";
-          else if (System::exist("levels/" + levelfile + ".pingus"))
-            levelfile = "levels/" + levelfile + ".pingus";
-          else
-            {
-              pout << _("PingusMain: Levelfile not found, ignoring: ") << 
levelfile << std::endl;
-              successfull = false;
-            }
+          editor->load(levelfile);
         }
-
-      if (successfull)
-        {
-          ScreenManager::instance()->push_screen
-          (new StartScreen(PLFResMgr::load_plf_from_filename(levelfile)),
-          true);
-          if (0)
-            ScreenManager::instance()->push_screen
-              (new 
PingusGameSession(PLFResMgr::load_plf_from_filename(levelfile), false),
-               true);
-        }
+      ScreenManager::instance()->push_screen (editor, true);
     }
+  else if (!levelfile.empty ()) 
+    {
+      ScreenManager::instance()->push_screen
+        (new StartScreen(PLFResMgr::load_plf_from_filename(levelfile)),
+         true);
+      if (0)
+        ScreenManager::instance()->push_screen
+          (new PingusGameSession(PLFResMgr::load_plf_from_filename(levelfile), 
false),
+           true);
+    }
   else if (!demo_file.empty()) // start a demo
     {
       //ScreenManager::instance()->push_screen(new DemoSession (demo_file));
@@ -754,10 +746,6 @@
       WorldMapNS::WorldMapManager::instance()->load(worldmapfile);
       
ScreenManager::instance()->push_screen(WorldMapNS::WorldMapManager::instance());
     }
-  else if (editor == true)
-    {
-      ScreenManager::instance()->push_screen (new Editor::EditorScreen(), 
true);
-    }
   else // start a normal game
     {
       pout(PINGUS_DEBUG_LOADING) << "starting normal game" << std::endl;





reply via email to

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