windstille-devel
[Top][All Lists]
Advanced

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

[Windstille-devel] rev 341 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 341 - trunk/src
Date: Mon, 17 May 2004 17:06:24 +0200

Author: grumbel
Date: 2004-05-17 17:06:24 +0200 (Mon, 17 May 2004)
New Revision: 341

Modified:
   trunk/src/SConstruct
   trunk/src/editor_map.cxx
   trunk/src/editor_map.hxx
   trunk/src/shared_ptr.hxx
   trunk/src/sharedptrtest.cxx
   trunk/src/sharedptrtest.hxx
   trunk/src/simpleed.cxx
   trunk/src/supertux.py
Log:
- switched to boost pointers again...

Modified: trunk/src/SConstruct
===================================================================
--- trunk/src/SConstruct        2004-05-17 14:07:36 UTC (rev 340)
+++ trunk/src/SConstruct        2004-05-17 15:06:24 UTC (rev 341)
@@ -130,7 +130,7 @@
     'workspace.cxx',
     'zoom_tool.cxx'],
     CPPPATH=['/home/ingo/run/ClanLib-0.7-current//include/ClanLib-0.7/',
-             '/usr/include/python2.3/',
+             '/usr/include/python2.2/',
              '..'],
     LIBPATH=['/home/ingo/run/ClanLib-0.7-current//lib/'],
     LIBS=['clanCore',

Modified: trunk/src/editor_map.cxx
===================================================================
--- trunk/src/editor_map.cxx    2004-05-17 14:07:36 UTC (rev 340)
+++ trunk/src/editor_map.cxx    2004-05-17 15:06:24 UTC (rev 341)
@@ -58,7 +58,7 @@
 }
 
 void
-EditorMap::add_layer(Layer layer)
+EditorMap::add_layer(const Layer& layer)
 {
   impl->layers.push_back(layer);
   impl->serial += 1;

Modified: trunk/src/editor_map.hxx
===================================================================
--- trunk/src/editor_map.hxx    2004-05-17 14:07:36 UTC (rev 340)
+++ trunk/src/editor_map.hxx    2004-05-17 15:06:24 UTC (rev 341)
@@ -42,7 +42,7 @@
 
   void draw(EditorMapComponent* parent);
 
-  void add_layer(Layer layer);
+  void add_layer(const Layer& layer);
 
   bool is_modified() const;
   void set_unmodified();

Modified: trunk/src/shared_ptr.hxx
===================================================================
--- trunk/src/shared_ptr.hxx    2004-05-17 14:07:36 UTC (rev 340)
+++ trunk/src/shared_ptr.hxx    2004-05-17 15:06:24 UTC (rev 341)
@@ -20,6 +20,10 @@
 #ifndef HEADER_SHARED_PTR_HXX
 #define HEADER_SHARED_PTR_HXX
 
+#if 1
+#include <boost/shared_ptr.hpp>
+#define SharedPtr boost::shared_ptr
+#else
 #include <iostream>
 #include <typeinfo>
  
@@ -47,7 +51,8 @@
   }  
 
   void del() {
-    delete ptr;
+    if (ptr)
+      delete ptr;
     ptr = 0;
   }
 };
@@ -60,6 +65,8 @@
   int* ref_count;
 
   void inc() {
+    std::cout << "inc: " << (ref_count ? *ref_count : -45) << std::endl;
+
     if (ref_count)
       {
         *ref_count += 1;
@@ -67,6 +74,8 @@
   }
   
   void dec() {
+    std::cout << "dec: " << (ref_count ? *ref_count : -45) << std::endl;
+
     if (ref_count)
       {
         *ref_count -= 1;
@@ -110,7 +119,7 @@
   
   template<class Base>
   SharedPtr(const SharedPtr<Base>& copy)
-    : deleter(), ref_count(0)
+    : deleter(0), ref_count(0)
   {
     if (copy.deleter)
       {
@@ -136,6 +145,7 @@
   template<class Base>
   SharedPtr<T>& operator= (const SharedPtr<Base>& copy) 
   {
+    std::cout << "SharedPtr<T>& operator= (const SharedPtr<Base>& copy)" << 
std::endl;
     if (ref_count != copy.ref_count)
       {
         dec();
@@ -162,7 +172,7 @@
 
     return *this;
   }
-#if 0
+
   SharedPtr<T>& operator= (const SharedPtr<T>& copy) 
   {
     if (this != &copy)
@@ -205,7 +215,6 @@
 
     return *this;
   }
-#endif 
   
   ~SharedPtr()
   {
@@ -230,6 +239,7 @@
       return 0; 
   }
 };
+#endif
 
 #endif
 

Modified: trunk/src/sharedptrtest.cxx
===================================================================
--- trunk/src/sharedptrtest.cxx 2004-05-17 14:07:36 UTC (rev 340)
+++ trunk/src/sharedptrtest.cxx 2004-05-17 15:06:24 UTC (rev 341)
@@ -19,13 +19,21 @@
 
 #include <iostream>
 #include <ClanLib/Core/System/sharedptr.h>
+#include <boost/shared_ptr.hpp>
 #include "sharedptrtest.hxx"
 
+#define SharedPtr boost::shared_ptr
+
 class B
 {
 public:
   B() { std::cout << "B(" << this << ")" << std::endl; }
   virtual ~B() { std::cout << "~B(" << this << ")" << std::endl; }
+
+  virtual void do_something()
+  {
+    std::cout << "B: do_something" << std::endl;
+  }
 };
 
 class A : public B
@@ -33,6 +41,11 @@
 public:
   A() { std::cout << "A(" << this << ")" << std::endl; }
   virtual ~A() { std::cout << "~A(" << this << ")" << std::endl; }
+  
+  void do_something()
+  {
+    std::cout << "A: do_something" << std::endl;
+  }
 };
 
 class C;
@@ -61,6 +74,20 @@
       }
     }
   }
+
+  std::cout << "\nInteresting part: " << std::endl;
+  {
+    std::cout << "### SharedPtr<A> p1;" << std::endl;
+    SharedPtr<B> p1;
+    {
+      std::cout << "### SharedPtr<A> p(new A());" << std::endl;
+      SharedPtr<A> p(new A());
+      std::cout << "### p1 = p;" << std::endl;
+      p1 = p;
+    }
+    std::cout << "### p1->do_something()" << std::endl;
+    p1->do_something();
+  }
 }
 
 /* EOF */

Modified: trunk/src/sharedptrtest.hxx
===================================================================
--- trunk/src/sharedptrtest.hxx 2004-05-17 14:07:36 UTC (rev 340)
+++ trunk/src/sharedptrtest.hxx 2004-05-17 15:06:24 UTC (rev 341)
@@ -20,7 +20,6 @@
 #ifndef HEADER_SHAREDPTRTEST_HXX
 #define HEADER_SHAREDPTRTEST_HXX
 
-#include "shared_ptr.hxx"
 
 #endif
 

Modified: trunk/src/simpleed.cxx
===================================================================
--- trunk/src/simpleed.cxx      2004-05-17 14:07:36 UTC (rev 340)
+++ trunk/src/simpleed.cxx      2004-05-17 15:06:24 UTC (rev 341)
@@ -17,11 +17,17 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include <iostream>
 #include <string>
 #include <ClanLib/core.h>
 #include <ClanLib/gui.h>
 #include "editor.hxx"
+#include "workspace.hxx"
+#include "tileset.hxx"
+#include "editor_map_component.hxx"
 #include "gui_manager.hxx"
+#include "layer.hxx"
+#include "tilemap_layer.hxx"
 #include "flexlay.hxx"
 
 int main()
@@ -33,12 +39,34 @@
 
   GUIManager* gui = editor.get_gui_manager();
 
+  EditorMap m;
+  Tileset tileset(32);
+
+    std::cout << "\nTilemapLayer: start" << std::endl;
+    TilemapLayer tilemap(tileset, 20, 10);
+    std::cout << "bound1: " << tilemap.get_bounding_rect() << std::endl;
+    Layer l = tilemap.to_layer();
+    Layer l2 = l;
+    std::cout << "bound2: " << l2.get_bounding_rect() << std::endl;
+    std::cout << "adding layer " << std::endl;
+    m.add_layer(l2);
+    std::cout << "layer added" << std::endl;
+    std::cout << "bound4: " << l.get_bounding_rect() << std::endl;
+
+  std::cout << "TilemapLayer: end\n" << std::endl;
+
+
+  EditorMapComponent editor_map(CL_Rect(0, 0, 799, 599), gui->get_component());
+  Workspace workspace(799, 599);
+  editor_map.set_workspace(workspace);
+  workspace.set_current_map(m);
+ 
   CL_Button* button = new CL_Button(CL_Rect(CL_Point(50, 50), 
                                             CL_Size(100, 25)),
                                     "Hello World", gui->get_component());
 
   gui->run();
-
+ 
   flexlay.deinit();
 }
 

Modified: trunk/src/supertux.py
===================================================================
--- trunk/src/supertux.py       2004-05-17 14:07:36 UTC (rev 340)
+++ trunk/src/supertux.py       2004-05-17 15:06:24 UTC (rev 341)
@@ -131,7 +131,7 @@
 tilemap = TilemapLayer(tileset, 20, 10)
 m.add_layer(tilemap.to_layer())
 
-# window = CL_Window(CL_Rect(50, 50, 350, 300), "My Window", 
gui.get_component())
+window = CL_Window(CL_Rect(50, 50, 350, 300), "My Window", gui.get_component())
     
 print "Launching GUI"
 gui.run()





reply via email to

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