windstille-devel
[Top][All Lists]
Advanced

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

[Windstille-devel] rev 336 - in trunk/src: . scripting


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 336 - in trunk/src: . scripting
Date: Sun, 16 May 2004 04:56:45 +0200

Author: grumbel
Date: 2004-05-16 04:56:45 +0200 (Sun, 16 May 2004)
New Revision: 336

Modified:
   trunk/src/SConstruct
   trunk/src/editor.py
   trunk/src/hellopy.cxx
   trunk/src/layer.cxx
   trunk/src/layer.hxx
   trunk/src/minimap.cxx
   trunk/src/paint_command.hxx
   trunk/src/python_functor.hxx
   trunk/src/scripting/editor.cxx
   trunk/src/scripting/editor.hxx
   trunk/src/tilemap_layer.cxx
   trunk/src/tilemap_layer.hxx
   trunk/src/tilemap_paint_tool.cxx
   trunk/src/tilemap_paint_tool.hxx
   trunk/src/tilemap_select_tool.cxx
   trunk/src/workspace.hxx
Log:


Modified: trunk/src/SConstruct
===================================================================
--- trunk/src/SConstruct        2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/SConstruct        2004-05-16 02:56:45 UTC (rev 336)
@@ -85,7 +85,6 @@
           'clanGL',
           'clanSignals',
           'clanGUI',
-          'clanGUIStyleSilver',
-          'boost_python'])
+          'clanGUIStyleSilver'])
 
 # EOF #

Modified: trunk/src/editor.py
===================================================================
--- trunk/src/editor.py 2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/editor.py 2004-05-16 02:56:45 UTC (rev 336)
@@ -131,7 +131,6 @@
     m.add_layer(tilemap.to_layer())
         
     TilemapLayer_set_current(tilemap)
-    tilemap_paint_tool_set_tilemap(tilemap)
     
     editor_set_brush_tile(1)
     
@@ -209,16 +208,8 @@
     a = menu.add_item("File/Save...", menu_file_save)
     a = menu.add_item("File/Save As...", menu_file_save_as)
 
-    print "- entering main loop"
     gui.run()
 
-    del button1
-    del button2
-    del button3
-    del button4
-    del window
-    print "- exit main loop"
-
 do_editor()
 
 flexlay.deinit()

Modified: trunk/src/hellopy.cxx
===================================================================
--- trunk/src/hellopy.cxx       2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/hellopy.cxx       2004-05-16 02:56:45 UTC (rev 336)
@@ -1,5 +1,5 @@
 #include <Python.h>
-#include <boost/python.hpp>
+#include <ClanLib/Core/System/sharedptr.h>
 #include <iostream>
 
 struct Callback

Modified: trunk/src/layer.cxx
===================================================================
--- trunk/src/layer.cxx 2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/layer.cxx 2004-05-16 02:56:45 UTC (rev 336)
@@ -26,10 +26,14 @@
 }
 
 Layer::Layer()
-  : impl(0)
 {  
 }
 
+Layer::Layer(CL_SharedPtr<LayerImpl> i)
+  : impl(i)
+{
+}
+
 void
 Layer::draw(EditorMapComponent* parent) 
 { 

Modified: trunk/src/layer.hxx
===================================================================
--- trunk/src/layer.hxx 2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/layer.hxx 2004-05-16 02:56:45 UTC (rev 336)
@@ -37,6 +37,7 @@
 public:
   Layer();
   Layer(LayerImpl* i);
+  Layer(CL_SharedPtr<LayerImpl> i);
   
   void draw(EditorMapComponent* parent);
   bool has_bounding_rect() const;

Modified: trunk/src/minimap.cxx
===================================================================
--- trunk/src/minimap.cxx       2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/minimap.cxx       2004-05-16 02:56:45 UTC (rev 336)
@@ -65,18 +65,18 @@
     }
 
   // FIXME: This doesn't work all that well
-  TilemapLayer* tilemap = TilemapLayer::current();
-  int tile_size = tilemap->get_tileset()->get_tile_size();
+  TilemapLayer tilemap = TilemapLayer::current();
+  int tile_size = tilemap.get_tileset()->get_tile_size();
 
-  if (tilemap && tilemap->get_height() != 0 && tilemap->get_width() != 0)
+  if (!tilemap.is_null() && tilemap.get_height() != 0 && tilemap.get_width() 
!= 0)
     {
-      int map_width  = tilemap->get_width()  * tile_size;
-      int map_height = tilemap->get_height() * tile_size;
+      int map_width  = tilemap.get_width()  * tile_size;
+      int map_height = tilemap.get_height() * tile_size;
 
       CL_Size small_tile(tile_size * get_width() / map_width + 1,
                          tile_size * get_height() / map_height + 1);
 
-      Field<int>* field = tilemap->get_field();
+      Field<int>* field = tilemap.get_field();
 
       if (0)
         {
@@ -113,17 +113,17 @@
 Minimap::update_minimap_surface()
 {
   // FIXME: This doesn't work all that well
-  TilemapLayer* tilemap = TilemapLayer::current();
-
-  if (tilemap)
+  TilemapLayer tilemap = TilemapLayer::current();
+  
+  if (!tilemap.is_null())
     {
-      Field<int>* field = tilemap->get_field();
+      Field<int>* field = tilemap.get_field();
 
-      CL_PixelBuffer buffer(tilemap->get_width(), tilemap->get_height(), 
-                            tilemap->get_width()*4, CL_PixelFormat::rgba8888);
+      CL_PixelBuffer buffer(tilemap.get_width(), tilemap.get_height(), 
+                            tilemap.get_width()*4, CL_PixelFormat::rgba8888);
   
-      int map_width  = tilemap->get_width();
-      int map_height = tilemap->get_height();
+      int map_width  = tilemap.get_width();
+      int map_height = tilemap.get_height();
 
       unsigned char* buf = static_cast<unsigned char*>(buffer.get_data());
       for(int y = 0; y < map_height; ++y)
@@ -154,10 +154,10 @@
 Minimap::mouse_move(const CL_InputEvent& event)
 {
   // FIXME: This doesn't work all that well
-  TilemapLayer* tilemap = TilemapLayer::current();
-  int tile_size  = tilemap->get_tileset()->get_tile_size();
-  int map_width  = tilemap->get_width()  * tile_size;
-  int map_height = tilemap->get_height() * tile_size;
+  TilemapLayer tilemap = TilemapLayer::current();
+  int tile_size  = tilemap.get_tileset()->get_tile_size();
+  int map_width  = tilemap.get_width()  * tile_size;
+  int map_height = tilemap.get_height() * tile_size;
 
   if (drag_active)
     parent->move_to(event.mouse_pos.x * map_width / get_width(),
@@ -168,10 +168,10 @@
 Minimap::mouse_down(const CL_InputEvent& event)
 {
   // FIXME: This doesn't work all that well
-  TilemapLayer* tilemap = TilemapLayer::current();
-  int tile_size  = tilemap->get_tileset()->get_tile_size();
-  int map_width  = tilemap->get_width()  * tile_size;
-  int map_height = tilemap->get_height() * tile_size;
+  TilemapLayer tilemap = TilemapLayer::current();
+  int tile_size  = tilemap.get_tileset()->get_tile_size();
+  int map_width  = tilemap.get_width()  * tile_size;
+  int map_height = tilemap.get_height() * tile_size;
 
   parent->move_to(event.mouse_pos.x * map_width / get_width(),
                   event.mouse_pos.y * map_height / get_height());

Modified: trunk/src/paint_command.hxx
===================================================================
--- trunk/src/paint_command.hxx 2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/paint_command.hxx 2004-05-16 02:56:45 UTC (rev 336)
@@ -20,6 +20,7 @@
 #ifndef HEADER_PAINT_COMMAND_HXX
 #define HEADER_PAINT_COMMAND_HXX
 
+#include <ClanLib/Core/System/sharedptr.h>
 #include <ClanLib/Core/Math/point.h>
 #include "tile_brush.hxx"
 #include "tilemap_layer.hxx"

Modified: trunk/src/python_functor.hxx
===================================================================
--- trunk/src/python_functor.hxx        2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/python_functor.hxx        2004-05-16 02:56:45 UTC (rev 336)
@@ -20,7 +20,7 @@
 #ifndef HEADER_PYTHON_FUNCTOR_HXX
 #define HEADER_PYTHON_FUNCTOR_HXX
 
-#include <boost/python.hpp>
+#include <ClanLib/Core/System/sharedptr.h>
 #include "Python.h"
 
 /** */

Modified: trunk/src/scripting/editor.cxx
===================================================================
--- trunk/src/scripting/editor.cxx      2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/scripting/editor.cxx      2004-05-16 02:56:45 UTC (rev 336)
@@ -927,7 +927,7 @@
 
 void connect(CL_Signal_v0& sig, PyObject* obj)
 {
-  std::cout << "Connecting functor: " << std::endl;
+  //std::cout << "Connecting functor: " << std::endl;
   new CL_Slot(sig.connect_functor(PythonFunctor(obj)));
 }
 
@@ -971,9 +971,4 @@
                        EditorMapComponent::current()->get_height());
 }
 
-void tilemap_paint_tool_set_tilemap(TilemapLayer tilemap)
-{
-  TileMapPaintTool::current()->set_tilemap(tilemap);
-}
-
 /* EOF */

Modified: trunk/src/scripting/editor.hxx
===================================================================
--- trunk/src/scripting/editor.hxx      2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/scripting/editor.hxx      2004-05-16 02:56:45 UTC (rev 336)
@@ -69,7 +69,6 @@
 CL_Component* editor_add_tileeditor(int x, int y, int w, int h);
 
 void tileeditor_set_tile(CL_Component* comp, int id);
-void tilemap_paint_tool_set_tilemap(TilemapLayer tilemap);
 
 int  screen_get_width();
 int  screen_get_height();

Modified: trunk/src/tilemap_layer.cxx
===================================================================
--- trunk/src/tilemap_layer.cxx 2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/tilemap_layer.cxx 2004-05-16 02:56:45 UTC (rev 336)
@@ -36,16 +36,16 @@
 #include "editor_map_component.hxx"
 #include "tilemap_layer.hxx"
 
-TilemapLayer* TilemapLayer::current_ = 0;
+TilemapLayerImpl* TilemapLayer::current_ = 0;
 
 class TilemapLayerImpl : public LayerImpl
 {
 public:
   TilemapLayerImpl() {
-    std::cout << "TilemapLayerImpl()" << std::endl;
+    std::cout << "TilemapLayerImpl(" << this << ")" << std::endl;
   }
   virtual ~TilemapLayerImpl() {
-    std::cout << "~TilemapLayerImpl()" << std::endl;
+    std::cout << "~TilemapLayerImpl(" << this << ")" << std::endl;
   }
 
   Tileset* tileset;
@@ -68,10 +68,15 @@
 {
 }
 
+TilemapLayer::TilemapLayer(TilemapLayerImpl* i)
+  : impl(i)
+{
+}
+
 TilemapLayer::TilemapLayer(Tileset* tileset_, int w,  int h)
   : impl(new TilemapLayerImpl())
 {
-  current_ = this;
+  current_ = impl.get();
 
   impl->field = Field<int>(w, h);
 
@@ -347,16 +352,16 @@
   return &impl->field; 
 }
 
-TilemapLayer*
+TilemapLayer
 TilemapLayer::current()
 {
-  return current_; 
+  return TilemapLayer(current_); 
 }
 
 void
-TilemapLayer::set_current(TilemapLayer* t) 
+TilemapLayer::set_current(TilemapLayer t) 
 {
-  current_ = t; 
+  current_ = t.impl.get();
 }
 
 Tileset*
@@ -416,7 +421,8 @@
 Layer
 TilemapLayer::to_layer()
 {
-  return Layer(impl);
+  // FIXME: BUG!!!!!
+  return Layer(impl.get());
 }
 
 /* EOF */

Modified: trunk/src/tilemap_layer.hxx
===================================================================
--- trunk/src/tilemap_layer.hxx 2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/tilemap_layer.hxx 2004-05-16 02:56:45 UTC (rev 336)
@@ -34,12 +34,13 @@
 class TilemapLayer
 {
 private:
-  static TilemapLayer* current_;
+  static TilemapLayerImpl* current_;
 public:
-  static TilemapLayer* current();
-  static void set_current(TilemapLayer* t);
+  static TilemapLayer current();
+  static void set_current(TilemapLayer t);
 
   TilemapLayer();
+  TilemapLayer(TilemapLayerImpl* i);
   TilemapLayer(Tileset* tileset, int w,  int h);
   ~TilemapLayer();
 
@@ -91,7 +92,7 @@
       coordinate */
   CL_Point world2tile(const CL_Point& pos) const;
 
-  bool is_null() const { return impl.is_null(); }
+  bool is_null() const { return !impl.get(); }
 
   Layer to_layer();
 

Modified: trunk/src/tilemap_paint_tool.cxx
===================================================================
--- trunk/src/tilemap_paint_tool.cxx    2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/tilemap_paint_tool.cxx    2004-05-16 02:56:45 UTC (rev 336)
@@ -113,6 +113,8 @@
 void
 TileMapPaintTool::on_mouse_down(const CL_InputEvent& event)
 {
+  tilemap = TilemapLayer::current();
+
   if (!tilemap.is_null())
     {
       EditorMapComponent* parent = EditorMapComponent::current();

Modified: trunk/src/tilemap_paint_tool.hxx
===================================================================
--- trunk/src/tilemap_paint_tool.hxx    2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/tilemap_paint_tool.hxx    2004-05-16 02:56:45 UTC (rev 336)
@@ -52,7 +52,6 @@
   const TileBrush& get_brush() { return brush; }
   void set_brush(const TileBrush& b);
   void draw();
-  void set_tilemap(TilemapLayer t) { tilemap = t; }
 
 private:
   void on_mouse_down(const CL_InputEvent& event);

Modified: trunk/src/tilemap_select_tool.cxx
===================================================================
--- trunk/src/tilemap_select_tool.cxx   2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/tilemap_select_tool.cxx   2004-05-16 02:56:45 UTC (rev 336)
@@ -57,7 +57,7 @@
       creating_selection = false;
       parent->release_mouse();
 
-      
selection.update(TilemapLayer::current()->world2tile(parent->screen2world(event.mouse_pos)));
+      
selection.update(TilemapLayer::current().world2tile(parent->screen2world(event.mouse_pos)));
       break;
     }
 }
@@ -73,8 +73,8 @@
       {
         creating_selection = true;
         parent->capture_mouse();
-        TilemapLayer* tilemap = TilemapLayer::current();
-        selection.start(*tilemap, 
tilemap->world2tile(parent->screen2world(event.mouse_pos)));
+        TilemapLayer tilemap = TilemapLayer::current();
+        selection.start(tilemap, 
tilemap.world2tile(parent->screen2world(event.mouse_pos)));
       }
       break;
       
@@ -92,15 +92,15 @@
 
   if (creating_selection)
     {
-      
selection.update(TilemapLayer::current()->world2tile(parent->screen2world(event.mouse_pos)));
+      
selection.update(TilemapLayer::current().world2tile(parent->screen2world(event.mouse_pos)));
     }
 }
 
 TileBrush
 TileMapSelectTool::get_selection() const
 {
-  TilemapLayer* tilemap = TilemapLayer::current();
-  return selection.get_brush(*tilemap->get_field());
+  TilemapLayer tilemap = TilemapLayer::current();
+  return selection.get_brush(*tilemap.get_field());
 }
 
 /* EOF */

Modified: trunk/src/workspace.hxx
===================================================================
--- trunk/src/workspace.hxx     2004-05-16 00:23:54 UTC (rev 335)
+++ trunk/src/workspace.hxx     2004-05-16 02:56:45 UTC (rev 336)
@@ -20,6 +20,7 @@
 #ifndef HEADER_WORKSPACE_HXX
 #define HEADER_WORKSPACE_HXX
 
+#include <ClanLib/Core/System/sharedptr.h>
 #include <ClanLib/Display/input_event.h>
 #include "graphic_context_state.hxx"
 #include "editor_map.hxx"





reply via email to

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