windstille-devel
[Top][All Lists]
Advanced

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

[Windstille-devel] rev 366 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 366 - trunk/src
Date: Sun, 30 May 2004 02:07:42 +0200

Author: grumbel
Date: 2004-05-30 02:07:42 +0200 (Sun, 30 May 2004)
New Revision: 366

Modified:
   trunk/src/clanlib.i
   trunk/src/editor.py
   trunk/src/icon.cxx
   trunk/src/layer_impl.hxx
   trunk/src/object_layer.cxx
   trunk/src/object_layer.hxx
   trunk/src/object_selector.cxx
   trunk/src/object_selector.hxx
   trunk/src/supertux.py
   trunk/src/tilemap_layer.cxx
Log:
- fixed objectlayer

Modified: trunk/src/clanlib.i
===================================================================
--- trunk/src/clanlib.i 2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/clanlib.i 2004-05-30 00:07:42 UTC (rev 366)
@@ -54,6 +54,7 @@
        ~CL_Component();
 public:
        CL_Component(CL_Component* parent, CL_StyleManager* style = NULL);
+        void show(bool show = true);
 };
 
 class CL_Window : public CL_Component

Modified: trunk/src/editor.py
===================================================================
--- trunk/src/editor.py 2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/editor.py 2004-05-30 00:07:42 UTC (rev 366)
@@ -37,6 +37,45 @@
 del Editor_redo
 del Editor_undo
 
+# class FileDialog:
+#     window = None
+
+#     def __init__(self):
+        
+
+#     def show(self, filename, func):
+#         window = Window(CL_Rect(50, 50, 450, 400), "My Window", 
gui.get_component())
+        
+
+# (define (simple-file-dialog title filename func)
+#   (let ((window (gui-create-window 200 100 460 125 title)))
+#     (gui-push-component (gui-window-get-client-area window))
+#     (gui-create-label 10 10 "Filename: ")
+#     (let ((ok       (gui-create-button 390 60 50 25 "Ok"))
+#           (cancel   (gui-create-button 330 60 50 25 "Cancel"))
+#           (filename (gui-create-inputbox 10 30 435 30 filename))
+#           ;;(browse   (gui-create-button 190 30 50 20 "Browse..."))
+#           )
+
+#       (gui-component-on-click ok 
+#                               (lambda ()   
+#                                 (func (gui-inputbox-get-text filename))
+#                                 (gui-hide-component window)))
+
+#       (gui-component-on-click cancel
+#                               (lambda () 
+#                                 (gui-hide-component window)))
+
+#       ;;      (gui-component-on-click browse
+#       ;;                              (lambda ()
+#       ;;                                (gui-file-dialog 
(gui-inputbox-get-text filename)
+#       ;;                                                (lambda (filename)
+#       ;;                                                   
(gui-inputbox-set-text filename)))))
+
+#       (gui-pop-component)
+#       window)))
+   
+
 myrect = CL_Rect(CL_Point(0, 56), CL_Size(665, 488))
 editor_map = EditorMapComponent(myrect, gui.get_component())
 workspace  = Workspace(myrect.get_width(), myrect.get_height())
@@ -143,6 +182,7 @@
     select.set_up()
     zoom.set_up()
     object.set_up()
+    supertux.show_tiles()
 
 def set_tilemap_select_tool():
     workspace.set_tool(tilemap_select_tool.to_tool())
@@ -150,6 +190,7 @@
     select.set_down()
     zoom.set_up()
     object.set_up()
+    supertux.show_none()
     
 def set_zoom_tool():
     workspace.set_tool(zoom_tool.to_tool())
@@ -157,6 +198,7 @@
     select.set_up()
     zoom.set_down()
     object.set_up()
+    supertux.show_none()
     
 def set_objmap_select_tool():
     workspace.set_tool(objmap_select_tool.to_tool())
@@ -164,6 +206,7 @@
     select.set_up()
     zoom.set_up()
     object.set_down()
+    supertux.show_objects()
 
 toolbar = Panel(CL_Rect(CL_Point(0, 23+33), CL_Size(33, 32*4+2)), 
gui.get_component())
 
@@ -203,12 +246,16 @@
 def menu_file_save():
     print "File/Save"
 
+def menu_file_save_commands():
+    print "File/Save As"
+    
 def menu_file_save_as():
     print "File/Save As"
 
 menu = CL_Menu(gui.get_component())
 menu.add_item("File/Open...", menu_file_open)
 menu.add_item("File/Save...", menu_file_save)
+menu.add_item("File/Save Commands...", menu_file_save_commands)
 menu.add_item("File/Save As...", menu_file_save_as)
 menu.add_item("File/Quit",  do_quit)
 
@@ -255,7 +302,7 @@
 
 mysprite = make_sprite("../data/images/icons16/stock_paste-16.png")
 
-mymenu = Menu(CL_Point(100, 100), gui.get_component())
+mymenu = Menu(CL_Point(134, 54), gui.get_component())
 mymenu.add_item(mysprite, "Foobar aeuaeu", None)
 mymenu.add_item(mysprite, "blub", do_something)
 mymenu.add_item(mysprite, "bla", None)
@@ -267,7 +314,7 @@
 def show_menu():
     mymenu.run()
 
-copy_icon.set_callback(show_menu)
+paste_icon.set_callback(show_menu)
 
 minimap_panel = Panel(CL_Rect(CL_Point(0, 600-56), CL_Size(800-134, 56)), 
gui.get_component())
 minimap = Minimap(editor_map, CL_Rect(CL_Point(3, 3), CL_Size(794-134, 50)), 
minimap_panel)

Modified: trunk/src/icon.cxx
===================================================================
--- trunk/src/icon.cxx  2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/icon.cxx  2004-05-30 00:07:42 UTC (rev 366)
@@ -60,6 +60,7 @@
   impl->tooltip      = tooltip;
   impl->draw_tooltip = true;
   impl->down         = false;
+  impl->is_down      = false;
   impl->is_enabled   = true;
 
   impl->slots.push_back(sig_paint().connect(impl.get(), &IconImpl::draw));

Modified: trunk/src/layer_impl.hxx
===================================================================
--- trunk/src/layer_impl.hxx    2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/layer_impl.hxx    2004-05-30 00:07:42 UTC (rev 366)
@@ -30,7 +30,7 @@
 public:
   virtual void draw(EditorMapComponent* parent) =0;
   virtual bool has_bounding_rect() const =0;
-  virtual CL_Rect get_bounding_rect() =0;
+  virtual CL_Rect get_bounding_rect() { return CL_Rect(); }
 };
 
 #endif

Modified: trunk/src/object_layer.cxx
===================================================================
--- trunk/src/object_layer.cxx  2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/object_layer.cxx  2004-05-30 00:07:42 UTC (rev 366)
@@ -24,16 +24,23 @@
 #include "objmap_object.hxx"
 #include "objmap_sprite_object.hxx"
 #include "object_layer.hxx"
+#include "layer_impl.hxx"
 
 extern CL_ResourceManager* resources;
 ObjectLayer ObjectLayer::current_;
 
-class ObjectLayerImpl
+class ObjectLayerImpl : public LayerImpl
 {
 public:
+  ObjectLayerImpl() {}
+  virtual ~ObjectLayerImpl() {}
+
   ObjectLayer::Objs objects;
   int handle_count;
   CL_SlotContainer slots;
+
+  void draw(EditorMapComponent* parent);
+  bool has_bounding_rect() const { return false; }
 };
 
 ObjectLayer::ObjectLayer()
@@ -47,9 +54,9 @@
 }
 
 void
-ObjectLayer::draw(EditorMapComponent* parent)
+ObjectLayerImpl::draw(EditorMapComponent* parent)
 {
-  for(Objs::iterator i = impl->objects.begin(); i != impl->objects.end(); ++i)
+  for(ObjectLayer::Objs::iterator i = objects.begin(); i != objects.end(); ++i)
     {
       (*i)->draw();
     }
@@ -152,8 +159,7 @@
 Layer
 ObjectLayer::to_layer()
 {
-  //return Layer(impl);
-  return Layer();
+  return Layer(impl);
 }
 
 /* EOF */

Modified: trunk/src/object_layer.hxx
===================================================================
--- trunk/src/object_layer.hxx  2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/object_layer.hxx  2004-05-30 00:07:42 UTC (rev 366)
@@ -26,6 +26,7 @@
 #include <ClanLib/Core/Math/point.h>
 #include "meta_data.hxx"
 #include "layer.hxx"
+#include "shared_ptr.hxx"
 
 class ObjMapObject;
 class ObjectLayerImpl;
@@ -47,8 +48,6 @@
   ObjectLayer();
   ~ObjectLayer();
 
-  void draw(EditorMapComponent* parent);
-
   /** Add an object to the map and return a handle to it */
   int  add_object(const CL_Sprite& sprite, const CL_Point& pos, const 
MetaData& data);
 
@@ -65,7 +64,7 @@
   Layer to_layer();
 
 private:
-  CL_SharedPtr<ObjectLayerImpl> impl;
+  SharedPtr<ObjectLayerImpl> impl;
 };
 
 #endif

Modified: trunk/src/object_selector.cxx
===================================================================
--- trunk/src/object_selector.cxx       2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/object_selector.cxx       2004-05-30 00:07:42 UTC (rev 366)
@@ -27,18 +27,11 @@
 #include "object_add_command.hxx"
 #include "objmap_sprite_object.hxx"
 
-ObjectSelector::ObjectSelector(const CL_Point& p,
-                               int width, int height, 
+ObjectSelector::ObjectSelector(const CL_Rect& rect, 
                                int obj_w, int obj_h,
                                CL_Component* parent)
-  // FIXME: Component size should be configurable in a sane way,
-  // however for the moment it is easier to simply expand it to its
-  // full parent size
-  : CL_Component(CL_Rect(CL_Point(0,30), 
-                         CL_Size(parent->get_width(),
-                                 parent->get_height()-30)), //p, CL_Size(width 
* obj_w, height * obj_h)),
-                 parent),
-    width(width), height(height),
+  : CL_Component(rect, parent),
+    width(rect.get_width()/obj_w), height(rect.get_height()/obj_h),
     obj_width(obj_w), obj_height(obj_h)
 {
   index = 0;

Modified: trunk/src/object_selector.hxx
===================================================================
--- trunk/src/object_selector.hxx       2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/object_selector.hxx       2004-05-30 00:07:42 UTC (rev 366)
@@ -50,7 +50,7 @@
   ObjectBrush drag_obj;
   
 public:
-  ObjectSelector(const CL_Point& p, int w, int h, int obj_w, int obj_h, 
CL_Component* parent);
+  ObjectSelector(const CL_Rect& rect, int obj_w, int obj_h, CL_Component* 
parent);
   ~ObjectSelector();
 
   void draw();

Modified: trunk/src/supertux.py
===================================================================
--- trunk/src/supertux.py       2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/supertux.py       2004-05-30 00:07:42 UTC (rev 366)
@@ -88,6 +88,10 @@
 
     def activate(self, workspace):
         workspace.set_map(self.editormap)
+        TilemapLayer.set_current(self.interactive)
+        print "ObjectLayerCurrent: ", ObjectLayer.current()
+        ObjectLayer.set_current(self.objects)
+        print "ObjectLayerCurrent: ", ObjectLayer.current()
         #(tilemap-paint-tool-set-tilemap (supertux:interactive-tm stlv))
         #(editor-tilemap-set-current     (supertux:interactive-tm stlv))
         #(editor-objectmap-set-current   (supertux:objmap stlv))
@@ -131,17 +135,45 @@
 class SuperTuxGUI:
     quit_button = None
     menu        = None
-    tileselector_window = None
-    tileselector = None
+    
+    selector_window = None
+    tileselector    = None
+    objectselector  = None
 
     def __init__(self, tileset, gui):
-        self.tileselector_window = Panel(CL_Rect(CL_Point(800-134, 23+33), 
CL_Size(128 + 6, 558)),
+        self.selector_window = Panel(CL_Rect(CL_Point(800-134, 23+33), 
CL_Size(128 + 6, 558)),
                                          gui.get_component())
         self.tileselector = TileSelector(CL_Rect(CL_Point(3, 3), CL_Size(128, 
552)),
-                                         6, 3, self.tileselector_window)
+                                         6, 3, self.selector_window)
         self.tileselector.set_tileset(tileset)
         self.tileselector.set_tiles(range(1,100))
+        self.tileselector.show(False)
 
+        self.objectselector = ObjectSelector(CL_Rect(0, 0, 128, 256), 42, 42, 
self.selector_window)
+        self.objectselector.show(True)
+        
self.objectselector.add_brush(ObjectBrush(make_sprite("../data/images/tools/stock-tool-pencil-22.png"),
+                                                  make_metadata(None)))
+        
self.objectselector.add_brush(ObjectBrush(make_sprite("../data/images/tools/stock-tool-pencil-22.png"),
+                                                  make_metadata(None)))
+        
self.objectselector.add_brush(ObjectBrush(make_sprite("../data/images/tools/stock-tool-pencil-22.png"),
+                                                  make_metadata(None)))        
+        
self.objectselector.add_brush(ObjectBrush(make_sprite("../data/images/tools/stock-tool-pencil-22.png"),
+                                                  make_metadata(None)))
+        
self.objectselector.add_brush(ObjectBrush(make_sprite("../data/images/tools/stock-tool-pencil-22.png"),
+                                                  make_metadata(None)))
+
+    def show_objects(self):
+        self.tileselector.show(False)        
+        self.objectselector.show(True)
+
+    def show_tiles(self):
+        self.tileselector.show(True)        
+        self.objectselector.show(False)
+
+    def show_none(self):
+        self.tileselector.show(False)        
+        self.objectselector.show(False)
+        
 def load_supertux_tiles():
     tileset = Tileset(32)
     load_game_tiles(tileset, 
"/home/ingo/cvs/supertux/supertux/data/images/tilesets/supertux.stgt")

Modified: trunk/src/tilemap_layer.cxx
===================================================================
--- trunk/src/tilemap_layer.cxx 2004-05-29 19:29:13 UTC (rev 365)
+++ trunk/src/tilemap_layer.cxx 2004-05-30 00:07:42 UTC (rev 366)
@@ -76,8 +76,6 @@
 TilemapLayer::TilemapLayer(Tileset tileset_, int w,  int h)
   : impl(new TilemapLayerImpl())
 {
-  current_ = *this;
-
   impl->field = Field<int>(w, h);
 
   // FIXME: Move this to the widget or to some more generic
@@ -418,8 +416,7 @@
 Layer
 TilemapLayer::to_layer()
 {
-  std::cout << " TilemapLayer::to_layer()" << std::endl;
-  return Layer(impl);
+   return Layer(impl);
 }
 
 /* EOF */





reply via email to

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