pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3078 - in trunk/pingus: . data/data data/images/core/edito


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3078 - in trunk/pingus: . data/data data/images/core/editor src src/editor src/gui src/math
Date: Wed, 5 Sep 2007 02:17:41 +0200

Author: grumbel
Date: 2007-09-05 02:17:37 +0200 (Wed, 05 Sep 2007)
New Revision: 3078

Added:
   trunk/pingus/src/editor/panel.cpp
   trunk/pingus/src/editor/panel.hpp
Modified:
   trunk/pingus/TODO
   trunk/pingus/data/data/core.res
   trunk/pingus/data/images/core/editor/separator.png
   trunk/pingus/src/SConscript
   trunk/pingus/src/editor/context_menu.hpp
   trunk/pingus/src/editor/editor_level.cpp
   trunk/pingus/src/editor/editor_level.hpp
   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_impl.hpp
   trunk/pingus/src/editor/level_objs.cpp
   trunk/pingus/src/editor/panel_buttons.cpp
   trunk/pingus/src/editor/panel_buttons.hpp
   trunk/pingus/src/gui/component.hpp
   trunk/pingus/src/gui/gui_manager.cpp
   trunk/pingus/src/math/vector3f.cpp
   trunk/pingus/src/math/vector3f.hpp
   trunk/pingus/src/pingus_level.cpp
   trunk/pingus/src/sprite.cpp
   trunk/pingus/src/sprite.hpp
Log:
- added new editor button panel (no function on the buttons at the moment)

Modified: trunk/pingus/TODO
===================================================================
--- trunk/pingus/TODO   2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/TODO   2007-09-05 00:17:37 UTC (rev 3078)
@@ -67,6 +67,10 @@
 Important:
 ==========
 
+- update ChangeLog
+
+- enable default fullscreen for release
+
 - fix level loading from command line
 
 - add some SConscript checks (for compiler missing)
@@ -82,6 +86,14 @@
   get updated when the mouse isn't in the window (need to switch from
   event to polling?!)
 
+- action-axis doesn't handle analog
+
+- fix memory leaks in input2/
+
+- menu crashes when you click a little wildely
+
+- 404 image use
+
 Nice to Have:
 =============
 

Modified: trunk/pingus/data/data/core.res
===================================================================
--- trunk/pingus/data/data/core.res     2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/data/data/core.res     2007-09-05 00:17:37 UTC (rev 3078)
@@ -1,3 +1,4 @@
+;; -*- scheme -*-
 ;; core.xml
 (pingus-resources
   (section (name "core")
@@ -45,6 +46,50 @@
 
     (section (name "editor")
       (sprite
+        (name "object-bottom")
+        (image-file "../images/core/editor/object-bottom.png"))
+
+      (sprite
+        (name "object-top")
+        (image-file "../images/core/editor/object-top.png"))
+
+      (sprite
+        (name "object-up")
+        (image-file "../images/core/editor/object-up.png"))
+
+      (sprite
+        (name "object-down")
+        (image-file "../images/core/editor/object-down.png"))
+
+                              (sprite
+        (name "object-flip-horizontal")
+        (image-file "../images/core/editor/object-flip_horizontal.png"))
+
+      (sprite
+        (name "object-flip-vertical")
+        (image-file "../images/core/editor/object-flip_vertical.png"))
+
+      (sprite
+        (name "document-new")
+        (image-file "../images/core/editor/document-new.png"))
+
+      (sprite
+        (name "document-open")
+        (image-file "../images/core/editor/document-open.png"))
+
+      (sprite
+        (name "document-save")
+        (image-file "../images/core/editor/document-save.png"))
+
+      (sprite
+        (name "document-save-as")
+        (image-file "../images/core/editor/document-save-as.png"))
+
+      (sprite
+        (name "separator")
+        (image-file "../images/core/editor/separator.png"))
+
+      (sprite
         (name "start_pos")
         (image-file "../images/core/editor/start_pos.png"))
 
@@ -117,6 +162,14 @@
         (image-file "../images/core/editor/button.png"))
 
       (sprite
+        (name "button-raised")
+        (image-file "../images/core/editor/button-raised.png"))
+
+      (sprite
+        (name "button-pressed")
+        (image-file "../images/core/editor/button-pressed.png"))
+
+      (sprite
         (name "button_pressed")
         (image-file "../images/core/editor/button_pressed.png"))
 

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

Modified: trunk/pingus/src/SConscript
===================================================================
--- trunk/pingus/src/SConscript 2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/SConscript 2007-09-05 00:17:37 UTC (rev 3078)
@@ -22,8 +22,8 @@
 
 env = Environment(
     # ENV = {'PKG_CONFIG_PATH' : os.getenv('PKG_CONFIG_PATH')},
-    CXX = "g++-4.2",
-    CCFLAGS = ['-O2', '-Wall', '-Werror', '-g'],
+    # CXX = "g++-4.2",
+    CCFLAGS = ['-O0', '-Wall', '-Werror', '-g'],
     CPPDEFINES = ['ENABLE_BINRELOC', 'HAVE_CWIID'],
     CPPPATH = ['..', '.'],
     LIBS = ['cwiid', 'Xi']) # FIXME: Make this configurable
@@ -91,12 +91,10 @@
 
 'editor/context_menu.cpp',
 'editor/editor_level.cpp', 
-'editor/editor_panel.cpp', 
+'editor/panel.cpp', 
 'editor/editor_screen.cpp', 
 'editor/editor_viewport.cpp', 
-'editor/level_head.cpp', 
 'editor/level_objs.cpp', 
-'editor/panel_buttons.cpp', 
 
 'command_line.cpp',
 'command_line_generic.cpp',

Modified: trunk/pingus/src/editor/context_menu.hpp
===================================================================
--- trunk/pingus/src/editor/context_menu.hpp    2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/context_menu.hpp    2007-09-05 00:17:37 UTC (rev 
3078)
@@ -117,9 +117,9 @@
   ContextMenu (const ContextMenu&);
   ContextMenu& operator= (const ContextMenu&);
 
-};     // ContextMenu class
+};
 
-}      // Editor namespace
+}  // Editor namespace
 
 #endif
 

Modified: trunk/pingus/src/editor/editor_level.cpp
===================================================================
--- trunk/pingus/src/editor/editor_level.cpp    2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/editor_level.cpp    2007-09-05 00:17:37 UTC (rev 
3078)
@@ -128,17 +128,17 @@
   PingusLevel existing_level("", filename);
        
   // Assign all of the level information to our LevelImpl
-  impl->levelname = existing_level.get_levelname();
-  impl->description = existing_level.get_description();
-  impl->ambient_light = existing_level.get_ambient_light();
-  impl->size = existing_level.get_size();
+  impl->levelname        = existing_level.get_levelname();
+  impl->description      = existing_level.get_description();
+  impl->ambient_light    = existing_level.get_ambient_light();
+  impl->size             = existing_level.get_size();
   impl->number_of_pingus = existing_level.get_number_of_pingus();
-  impl->number_to_save = existing_level.get_number_to_save();
-  impl->actions = existing_level.get_actions();
-  impl->time = existing_level.get_time();
-  impl->difficulty = existing_level.get_difficulty();
-  impl->author = existing_level.get_author();
-  impl->music = existing_level.get_music();
+  impl->number_to_save   = existing_level.get_number_to_save();
+  impl->actions          = existing_level.get_actions();
+  impl->time             = existing_level.get_time();
+  impl->difficulty       = existing_level.get_difficulty();
+  impl->author           = existing_level.get_author();
+  impl->music            = existing_level.get_music();
        
   // Temporary objects
   unsigned attribs;

Modified: trunk/pingus/src/editor/editor_level.hpp
===================================================================
--- trunk/pingus/src/editor/editor_level.hpp    2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/editor_level.hpp    2007-09-05 00:17:37 UTC (rev 
3078)
@@ -30,11 +30,7 @@
 
 class EditorLevel
 {
-private:
-  LevelImpl* impl;
-
 public:
-
   /** Construct new blank level */
   EditorLevel();
 
@@ -58,14 +54,16 @@
        
   /** Return LevelImpl */
   LevelImpl* get_level_impl() { return impl; }
-       
 
 private:
+  LevelImpl* impl;
+
+private:
   EditorLevel (const EditorLevel&);
   EditorLevel& operator= (const EditorLevel&);
-};     // EditorLevel class
+};
 
-}              // Editor namespace
+} // Editor namespace
 
 #endif
 

Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp   2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/editor_screen.cpp   2007-09-05 00:17:37 UTC (rev 
3078)
@@ -31,12 +31,12 @@
 #include "../file_dialog.hpp"
 #include "../path_manager.hpp"
 #include "editor_level.hpp"
-#include "editor_panel.hpp"
+#include "panel.hpp"
+#include "panel.hpp"
 #include "editor_screen.hpp"
 #include "editor_viewport.hpp"
 #include "level_objs.hpp"
 
-
 namespace Editor {
 
 // Default constructor
@@ -67,10 +67,7 @@
   gui_manager->add(viewport, true);    
        
   // Create the panel for the buttons
-  panel = new EditorPanel(this);
-  gui_manager->add(panel, true);
-  panel->init();
-
+  panel = new Panel(this);
 }
 
 // Close the current screen
@@ -112,7 +109,7 @@
 {
   close_dialog = true;
   plf->save_level(file);
-  panel->set_selected_button(0);
+  //panel->set_selected_button(0);
 }
 
 // Load a new level
@@ -122,7 +119,7 @@
   close_dialog = true;
   plf->load_level(file);
   viewport->refresh();
-  panel->set_selected_button(0);
+  //panel->set_selected_button(0);
 }
 
 // Play the current level (save to a temporary file 
@@ -187,5 +184,8 @@
     add_object(*it);
 }
 
-} // Editor namespace
+} // namespace Editor 
 
+/* EOF */
+
+

Modified: trunk/pingus/src/editor/editor_screen.hpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.hpp   2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/editor_screen.hpp   2007-09-05 00:17:37 UTC (rev 
3078)
@@ -33,19 +33,20 @@
 
 class EditorLevel;
 class LevelObj;
-class EditorPanel;
+class Panel;
 class EditorViewport;
 
 /** This class is the screen that contains all of the
     editor objects */
-class EditorScreen : public GUIScreen, public FileDialogListener
+class EditorScreen : public GUIScreen, 
+                     public FileDialogListener
 {
 private:
   /** The level currently being edited */
   EditorLevel* plf;
 
   /** Panel which contains all of the buttons for each action */
-  EditorPanel* panel;
+  Panel* panel;
 
   /** Viewport which holds all of the level images and data */
   EditorViewport* viewport;

Modified: trunk/pingus/src/editor/editor_viewport.cpp
===================================================================
--- trunk/pingus/src/editor/editor_viewport.cpp 2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/editor_viewport.cpp 2007-09-05 00:17:37 UTC (rev 
3078)
@@ -215,8 +215,10 @@
 bool
 EditorViewport::is_at(int x, int y)
 {
-  // FIXME: Should return true everywhere except for on the panel
-  return true;
+  if (y >= 38) // FIXME: Could be done more flexible
+    return true;
+  else 
+    return false;
 }
 
 void

Modified: trunk/pingus/src/editor/level_head.cpp
===================================================================
--- trunk/pingus/src/editor/level_head.cpp      2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/level_head.cpp      2007-09-05 00:17:37 UTC (rev 
3078)
@@ -30,9 +30,8 @@
 #include "level_head.hpp"
 #include "level_impl.hpp"
 #include "../gui/display.hpp"
-#include "panel_buttons.hpp"
 #include "editor_level.hpp"
-#include "editor_panel.hpp"
+//#include "editor_panel.hpp"
 #include "editor_screen.hpp"
 
 namespace Editor {
@@ -63,7 +62,7 @@
 
   void on_click()
   {
-    head->get_head_button()->remove_head();
+    //head->get_head_button()->remove_head();
   }
 
   void on_pointer_enter()
@@ -128,11 +127,11 @@
 {
   UNUSED_ARG(delta);
   // FIXME:  Should only update this information if it has changed. 
-  impl->levelname = name->get_string();
+  impl->levelname   = name->get_string();
   impl->description = desc->get_string(); 
 }   
   
           
-}      // Editor
+} // namespace Editor
 
 /* EOF */

Modified: trunk/pingus/src/editor/level_impl.hpp
===================================================================
--- trunk/pingus/src/editor/level_impl.hpp      2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/level_impl.hpp      2007-09-05 00:17:37 UTC (rev 
3078)
@@ -27,7 +27,6 @@
 #include <algorithm>
 #include "level_objs.hpp"
 
-
 namespace Editor {
 
 static bool LevelObjSort(LevelObj *a, LevelObj *b)
@@ -87,7 +86,7 @@
   LevelImpl& operator= (const LevelImpl&);
 };     // LevelImpl class
 
-}              // Editor namespace
+} // namespace Editor
 
 #endif
 

Modified: trunk/pingus/src/editor/level_objs.cpp
===================================================================
--- trunk/pingus/src/editor/level_objs.cpp      2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/level_objs.cpp      2007-09-05 00:17:37 UTC (rev 
3078)
@@ -27,7 +27,6 @@
 #include "../gui/display.hpp"
 #include "../display/drawing_context.hpp"
 
-
 namespace Editor {
 
 // Default constructor
@@ -72,12 +71,15 @@
     {
       // If selected, draw a highlighted box around it
       if (selected)
-        gc.draw_rect(translated_pos.x, translated_pos.y, translated_pos.x 
-                     + sprite.get_width(), translated_pos.y + 
sprite.get_height(), 
-                     Color(255,255,255,150), 5000);
+        {
+          gc.draw_rect(translated_pos.x, translated_pos.y, translated_pos.x 
+                       + sprite.get_width(), translated_pos.y + 
sprite.get_height(), 
+                       Color(255,255,255,150), 5000);
+        }
+
       if (attribs & HAS_WIDTH)
         {
-          for(int x = static_cast<int>(pos.x); x < pos.x + width;      x += 
sprite.get_width())
+          for(int x = int(pos.x); x < pos.x + width; x += sprite.get_width())
             gc.draw(sprite, Vector3f(static_cast<float>(x), pos.y, pos.z));
         }
       else if(attribs & HAS_STRETCH)
@@ -88,7 +90,9 @@
               gc.draw(sprite, Vector3f((float)x, (float)y, pos.z));
         }
       else
-        gc.draw(sprite, pos);
+        {
+          gc.draw(sprite, pos);
+        }
     }
 }
 
@@ -99,13 +103,13 @@
     {
       return (x > translated_pos.x && x < translated_pos.x + sprite.get_width()
               && y > translated_pos.y && y < translated_pos.y + 
sprite.get_height());
-    }
+}
   else
     return false;
 }
 
-void
-LevelObj::set_stretch_x(const bool s)
+  void
+  LevelObj::set_stretch_x(const bool s)
 { 
   stretch_x = s;
 }
@@ -316,6 +320,6 @@
   set_translated_pos();
 }
 
-}              // Editor namespace
+} // namespace Editor 
 
 /* EOF */

Added: trunk/pingus/src/editor/panel.cpp
===================================================================
--- trunk/pingus/src/editor/panel.cpp   2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/editor/panel.cpp   2007-09-05 00:17:37 UTC (rev 3078)
@@ -0,0 +1,191 @@
+/*  $Id$
+**   __      __ __             ___        __   __ __   __
+**  /  \    /  \__| ____    __| _/_______/  |_|__|  | |  |   ____
+**  \   \/\/   /  |/    \  / __ |/  ___/\   __\  |  | |  | _/ __ \
+**   \        /|  |   |  \/ /_/ |\___ \  |  | |  |  |_|  |_\  ___/
+**    \__/\  / |__|___|  /\____ /____  > |__| |__|____/____/\___  >
+**         \/          \/      \/    \/                         \/
+**  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 "gui/display.hpp" 
+#include "display/drawing_context.hpp"
+#include "resource.hpp"
+#include "sprite.hpp"
+#include "math/vector2i.hpp"
+#include "editor_screen.hpp"
+#include "gui/gui_manager.hpp"
+#include "panel.hpp"
+
+namespace Editor {
+
+class PanelSeparator : public GUI::Component
+{
+private:
+  Sprite sprite;
+  Vector2i pos;
+
+public:
+  PanelSeparator(const Vector2i& pos_)
+    : sprite(Resource::load_sprite("core/editor/separator")),
+      pos(pos_)
+  {
+  }
+  
+  void draw (DrawingContext& gc)
+  {
+    gc.draw(sprite, pos);
+  } 
+  
+  int get_width() const { return sprite.get_width(); }
+};
+
+class PanelButton : public GUI::Component
+{
+private:
+  Sprite button_raised;
+  Sprite button_pressed;
+  Sprite sprite;
+  bool   mouse_over;
+  bool   mouse_down;
+  Vector2i pos;
+
+public:
+  PanelButton(const Vector2i& pos_, const std::string& name)
+    : 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_)
+  {
+  }
+
+  void draw (DrawingContext& gc)
+  {
+    if (mouse_down)
+      gc.draw(button_pressed, pos);
+    else if (mouse_over)
+      gc.draw(button_raised, pos);
+
+    gc.draw(sprite, pos + Vector2i(5,5));
+  }
+
+  /** Emmitted when pointer enters the region of the component */
+  void on_pointer_enter () 
+  {
+    mouse_over = true;
+  }
+
+  /** Emmitted when pointer leaves the region of the component */
+  void on_pointer_leave () 
+  {
+    mouse_over = false;
+  }
+  
+  void on_primary_button_press (int x, int y) 
+  {
+    mouse_down = true;
+  }
+
+  void on_primary_button_release (int x, int y) { 
+    mouse_down = false;
+  }
+  
+  bool is_at(int x, int y)
+  {
+    return (pos.x <= x && pos.x + 34 > x &&
+            pos.y <= y && pos.y + 34 > y);
+  }
+
+  void update (float delta)
+  {
+    sprite.update();
+  }
+  
+  int get_width() const {
+    return 34;
+  }
+};
+
+Panel::Panel(EditorScreen* editor_)
+  : editor(editor_),
+    logo(Resource::load_sprite("core/editor/logo")),
+    pos(2,2)
+{  
+  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_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_separator();
+  add_button("core/editor/object-flip-horizontal");
+  add_button("core/editor/object-flip-vertical");
+}
+
+Panel::~Panel()
+{
+}
+
+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);
+}
+
+void
+Panel::update (float delta)
+{
+  
+}
+
+void
+Panel::add_button(const std::string& image)
+{
+  PanelButton* comp = new PanelButton(pos, image);
+  pos.x += comp->get_width();
+  editor->get_gui_manager()->add(comp, true);
+}
+
+void
+Panel::add_toggle_button(const std::string& image)
+{
+  PanelButton* comp = new PanelButton(pos, image);
+  pos.x += comp->get_width();
+  editor->get_gui_manager()->add(comp, true);
+}
+
+void
+Panel::add_separator()
+{
+  PanelSeparator* comp = new PanelSeparator(pos);
+  pos.x += comp->get_width();
+  editor->get_gui_manager()->add(comp, true);
+}
+
+} // namespace Editor
+
+/* EOF */


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

Added: trunk/pingus/src/editor/panel.hpp
===================================================================
--- trunk/pingus/src/editor/panel.hpp   2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/editor/panel.hpp   2007-09-05 00:17:37 UTC (rev 3078)
@@ -0,0 +1,61 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2007 Jason Green <address@hidden>,
+//                     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_PANEL_HXX
+#define HEADER_PINGUS_EDITOR_PANEL_HXX
+
+#include <string>
+#include "sprite.hpp"
+#include "math/vector2i.hpp"
+#include "../gui/component.hpp"
+
+namespace Editor {
+
+class EditorScreen;
+
+/** */
+class Panel : public GUI::Component
+{
+private:
+  EditorScreen* editor;
+  Sprite logo;
+  Vector2i pos;
+
+public:
+  Panel(EditorScreen* e);
+  ~Panel();
+
+  void draw (DrawingContext& gc);
+  void update (float delta);
+
+  void add_button(const std::string& image);
+  void add_toggle_button(const std::string& image);
+  void add_separator();
+  
+private:
+  Panel (const Panel&);
+  Panel& operator= (const Panel&);
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */


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

Modified: trunk/pingus/src/editor/panel_buttons.cpp
===================================================================
--- trunk/pingus/src/editor/panel_buttons.cpp   2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/panel_buttons.cpp   2007-09-05 00:17:37 UTC (rev 
3078)
@@ -27,21 +27,20 @@
 #include "../resource.hpp"
 #include "panel_buttons.hpp"
 #include "editor_level.hpp"
-#include "editor_panel.hpp"
+//#include "editor_panel.hpp"
 #include "editor_screen.hpp"
 #include "level_objs.hpp"
 #include "level_head.hpp"
 
-
 class Resource;
 
 namespace Editor {
 
 // Constructor
-PanelButton::PanelButton(EditorPanel* p) :
-  hover(false),
-  panel(p),
-  is_selected(false)
+PanelButton::PanelButton(EditorPanel* p) 
+ : hover(false),
+   panel(p),
+   is_selected(false)
 {
   button = Resource::load_sprite("core/editor/button");
   button_pressed = Resource::load_sprite("core/editor/button_pressed");
@@ -81,8 +80,8 @@
 }
 
 // Something all buttons should do.
-  void
-  PanelButton::on_primary_button_click(int x, int y)
+void
+PanelButton::on_primary_button_click(int x, int y)
 {
   UNUSED_ARG(x);
   UNUSED_ARG(y);
@@ -155,6 +154,7 @@
   panel->get_combobox(1)->set_label("Type");
   panel->get_combobox(2)->set_label("Subtype");
   panel->get_combobox(3)->set_label("Groundpiece");
+
   std::vector<std::string> groundpieces; //// = 
Resource::get_sections("groundpieces");
   for (unsigned i = 0; i < groundpieces.size(); i++)
     {

Modified: trunk/pingus/src/editor/panel_buttons.hpp
===================================================================
--- trunk/pingus/src/editor/panel_buttons.hpp   2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/editor/panel_buttons.hpp   2007-09-05 00:17:37 UTC (rev 
3078)
@@ -203,11 +203,10 @@
   PanelButtonHead ();
   PanelButtonHead (const PanelButtonHead&);
   PanelButtonHead& operator= (const PanelButtonHead&);
-};    // PanelButtonHead class
+};
 
-}              // Editor namespace
+} // Editor namespace
 
-
 #endif
 
 /* EOF */

Modified: trunk/pingus/src/gui/component.hpp
===================================================================
--- trunk/pingus/src/gui/component.hpp  2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/gui/component.hpp  2007-09-05 00:17:37 UTC (rev 3078)
@@ -22,7 +22,6 @@
 
 #include "../pingus.hpp"
 
-
 class DrawingContext;
 
 namespace GUI {
@@ -34,13 +33,13 @@
 private:
        
 protected:
-       bool has_focus;
+  bool has_focus;
 
 public:
   Component () : has_focus(false) { }
   virtual ~Component() {}
 
-       virtual void set_focus(bool val) { has_focus = val; }
+  virtual void set_focus(bool val) { has_focus = val; }
        
   virtual void draw (DrawingContext& gc) =0;
   virtual void update (float delta) { UNUSED_ARG(delta);}
@@ -85,7 +84,7 @@
 
   /** true if mouse is currently over, FIXME: these seem to be
       unimplementable without renaming on_pointer_enter() and wrapp them */
-  bool pointer_over ();
+  bool pointer_over();
 
 private:
   Component (const Component&);

Modified: trunk/pingus/src/gui/gui_manager.cpp
===================================================================
--- trunk/pingus/src/gui/gui_manager.cpp        2007-09-04 15:23:13 UTC (rev 
3077)
+++ trunk/pingus/src/gui/gui_manager.cpp        2007-09-05 00:17:37 UTC (rev 
3078)
@@ -120,7 +120,7 @@
 }
 
 Component*
-GUIManager::component_at (int x, int y)
+GUIManager::component_at(int x, int y)
 {
   // we travel reversly through the component list, so that we get the
   // top most component at first

Modified: trunk/pingus/src/math/vector3f.cpp
===================================================================
--- trunk/pingus/src/math/vector3f.cpp  2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/math/vector3f.cpp  2007-09-05 00:17:37 UTC (rev 3078)
@@ -22,18 +22,22 @@
 #include "vector3f.hpp"
 #include "vector2f.hpp"
 
-Vector3f::Vector3f (float x_, float y_, float z_) : x(x_), y(y_), z(z_)
+Vector3f::Vector3f(float x_, float y_, float z_) : x(x_), y(y_), z(z_)
 {
 }
 
-Vector3f::Vector3f (const Vector3f& old) : x(old.x), y(old.y), z(old.z)
+Vector3f::Vector3f(const Vector3f& old) : x(old.x), y(old.y), z(old.z)
 {
 }
 
-Vector3f::Vector3f (const Vector2f& old) : x(old.x), y(old.y), z(0)
+Vector3f::Vector3f(const Vector2f& old) : x(old.x), y(old.y), z(0)
 {
 }
 
+Vector3f::Vector3f(const Vector2i& old) : x(int(old.x)), y(int(old.y)), z(0)
+{
+}
+
 Vector3f&
 Vector3f::operator= (const Vector3f& old)
 {

Modified: trunk/pingus/src/math/vector3f.hpp
===================================================================
--- trunk/pingus/src/math/vector3f.hpp  2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/math/vector3f.hpp  2007-09-05 00:17:37 UTC (rev 3078)
@@ -24,7 +24,7 @@
 #include "../pingus.hpp"
 
 class Vector2f;
-
+class Vector2i;
 class Vector3f
 {
 public:
@@ -37,6 +37,7 @@
 
   Vector3f (const Vector3f& old);
   Vector3f (const Vector2f& old);
+  Vector3f (const Vector2i& old);
   Vector3f& operator= (const Vector3f& old);
 
   Vector3f operator- () const;

Modified: trunk/pingus/src/pingus_level.cpp
===================================================================
--- trunk/pingus/src/pingus_level.cpp   2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/pingus_level.cpp   2007-09-05 00:17:37 UTC (rev 3078)
@@ -31,7 +31,6 @@
 {
 }
 
-
 PingusLevel::PingusLevel(const std::string& resname,
                          const std::string& filename)
   : impl(new PingusLevelImpl())

Modified: trunk/pingus/src/sprite.cpp
===================================================================
--- trunk/pingus/src/sprite.cpp 2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/sprite.cpp 2007-09-05 00:17:37 UTC (rev 3078)
@@ -207,6 +207,13 @@
   
 }
 
+Sprite::Sprite(const std::string& name)
+{
+  SpriteDescription desc;
+  desc.filename = name;
+  impl = boost::shared_ptr<SpriteImpl>(new SpriteImpl(desc));
+}
+
 Sprite::Sprite(const PixelBuffer& pixelbuffer)
   : impl(new SpriteImpl(pixelbuffer))
 {
@@ -230,7 +237,7 @@
 }
 
 int
-Sprite::get_width()
+Sprite::get_width() const
 {
   if (impl.get()) 
     return impl->frame_size.width;
@@ -239,7 +246,7 @@
 }
 
 int
-Sprite::get_height()
+Sprite::get_height() const
 {
   if (impl.get()) 
     return impl->frame_size.height;

Modified: trunk/pingus/src/sprite.hpp
===================================================================
--- trunk/pingus/src/sprite.hpp 2007-09-04 15:23:13 UTC (rev 3077)
+++ trunk/pingus/src/sprite.hpp 2007-09-05 00:17:37 UTC (rev 3078)
@@ -34,12 +34,13 @@
 {
 public:
   Sprite();
+  Sprite(const std::string& name);
   Sprite(const SpriteDescription& desc);
   Sprite(const PixelBuffer& pixelbuffer);
   ~Sprite();
 
-  int get_width();
-  int get_height();
+  int get_width()  const;
+  int get_height() const;
 
   void update(float delta = 0.033f);
 





reply via email to

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