windstille-devel
[Top][All Lists]
Advanced

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

[Windstille-devel] rev 404 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 404 - trunk/src
Date: Wed, 09 Jun 2004 13:12:36 +0200

Author: grumbel
Date: 2004-06-09 13:12:36 +0200 (Wed, 09 Jun 2004)
New Revision: 404

Modified:
   trunk/src/clanlib.i
   trunk/src/editor_map_component.cxx
   trunk/src/gui.rb
   trunk/src/supertux.rb
   trunk/src/tile_selector.cxx
   trunk/src/tile_selector.hxx
   trunk/src/tileset.cxx
   trunk/src/tileset.hxx
Log:
- fixed parenting issue with scrollbar and minimap
- some tileset stuff

Modified: trunk/src/clanlib.i
===================================================================
--- trunk/src/clanlib.i 2004-06-08 09:05:50 UTC (rev 403)
+++ trunk/src/clanlib.i 2004-06-09 11:12:36 UTC (rev 404)
@@ -10,6 +10,7 @@
                bool is_visible(bool check_parents = true);
        void set_size(int new_width, int new_height);
        void set_position(int new_x, int new_y);
+       const CL_Rect& get_position();
 };
 
 class CL_Size

Modified: trunk/src/editor_map_component.cxx
===================================================================
--- trunk/src/editor_map_component.cxx  2004-06-08 09:05:50 UTC (rev 403)
+++ trunk/src/editor_map_component.cxx  2004-06-09 11:12:36 UTC (rev 404)
@@ -60,15 +60,15 @@
 
   current_ = this;
 
-  impl->scrollbar_v = new Scrollbar(CL_Rect(CL_Point(rect.get_width() - 14, 
2), 
+  impl->scrollbar_v = new Scrollbar(CL_Rect(CL_Point(rect.get_width() - 14, 2) 
+ CL_Point(rect.left, rect.top), 
                                             CL_Size(12, rect.get_height() - 4 
- 14)),
                                     Scrollbar::VERTICAL,
-                                    this);
+                                    parent);
 
-  impl->scrollbar_h = new Scrollbar(CL_Rect(CL_Point(2, rect.get_height() - 
14), 
+  impl->scrollbar_h = new Scrollbar(CL_Rect(CL_Point(2, rect.get_height() - 
14) + CL_Point(rect.left, rect.top), 
                                             CL_Size(rect.get_width() - 4 - 14, 
12)),
                                     Scrollbar::HORIZONTAL,
-                                    this);
+                                    parent);
 
   impl->slots.connect(impl->scrollbar_h->sig_scrollbar_move(), this, 
&EditorMapComponent::move_to_x);
   impl->slots.connect(impl->scrollbar_v->sig_scrollbar_move(), this, 
&EditorMapComponent::move_to_y);

Modified: trunk/src/gui.rb
===================================================================
--- trunk/src/gui.rb    2004-06-08 09:05:50 UTC (rev 403)
+++ trunk/src/gui.rb    2004-06-09 11:12:36 UTC (rev 404)
@@ -11,7 +11,7 @@
                                  $gui.get_component())
     @tileselector = TileSelector.new(CL_Rect.new(CL_Point.new(3, 3), 
CL_Size.new(128, 552)), @selector_window)
     @tileselector.set_tileset(tileset)
-    @tileselector.set_tiles((1..100).to_a)
+    @tileselector.set_tiles((1..150).to_a)
     @tileselector.show(false)
     
     @objectselector = ObjectSelector.new(CL_Rect.new(0, 0, 128, 256), 42, 42, 
@selector_window)

Modified: trunk/src/supertux.rb
===================================================================
--- trunk/src/supertux.rb       2004-06-08 09:05:50 UTC (rev 403)
+++ trunk/src/supertux.rb       2004-06-09 11:12:36 UTC (rev 404)
@@ -45,19 +45,33 @@
   $recent_files_menu.add_item($mysprite, filename, proc{ 
supertux_load_level(filename) })
 end
 
-$minimap = Minimap.new($editor_map, CL_Rect.new(CL_Point.new(3, 488+3-14), 
-                                               CL_Size.new(794-134-16, 50)), 
$editor_map)
 
+$minimap = Minimap.new($editor_map, CL_Rect.new(CL_Point.new(3 + myrect.left, 
+                                                             488+3-14  + 
myrect.top), 
+                                                CL_Size.new(794-134-16, 50)), 
+                       $gui.get_component())
+
 require "gui.rb"
 
 class Config
-  attr_reader :datadir;
+  attr_accessor :datadir, :recent_files
 
   def initialize()
-    @datadir = "/home/ingo/cvs/supertux/supertux/data/"
-    end
+    @datadir      = "/home/ingo/cvs/supertux/supertux/data/"
+    @recent_files = []
+  end
+
+  def save(filename)
+    filename = File.expand_path("~/.flexlay/supertux.rb")
+    f = File.new(filename, "w")
+    f.write("# Autogenerated Script, don't edit by hand!\n\n")
+    f.write("$datadir      = " + $datadir.inspect() + "\n")
+    f.write("$recent_files = " + $recent_files.inspect() + "\n")
+    f.write("\n# EOF #\n")
+  end
 end
 
+$config  = Config.new()
 $datadir = "/home/ingo/cvs/supertux/supertux/data/"
 
 class DisplayProperties
@@ -69,7 +83,7 @@
     @show_all     = false
     @current_only = false
   end
-    
+  
   def set(map)
 
     if @current_only
@@ -107,30 +121,32 @@
 end
 
 # Load game tiles from filename into tileset
-def Tileset_load(tileset, filename)
-  tree = sexpr_read_from_file(filename)
-  tree = tree[1..-1]
-  for i in tree
-    if i[0] == "tile"
-      data  = i[1..-1]
-      id    = get_value_from_tree(['id', '_'], data, -1)
-      image = get_value_from_tree(['editor-images', '_'], data, false)
-      
-      if not(image)
-        image = get_value_from_tree(['images', '_'], data, "notile.png")
+class Tileset
+  def load(filename)
+    tree = sexpr_read_from_file(filename)
+    tree = tree[1..-1]
+    for i in tree
+      if i[0] == "tile"
+        data  = i[1..-1]
+        id    = get_value_from_tree(['id', '_'], data, -1)
+        image = get_value_from_tree(['editor-images', '_'], data, false)
+        
+        if not(image)
+          image = get_value_from_tree(['images', '_'], data, "notile.png")
+        end
+        
+        if id != 0 # leave tile 0 transparent
+          add_tile(id,
+                   Tile.new($datadir + 'images/tilesets/' + image,
+                            CL_Color.new(255,   0,   0, 128)))
+        end
       end
-      
-      if id != 0 # leave tile 0 transparent
-        tileset.add_tile(id,
-                         Tile.new($datadir + 'images/tilesets/' + image,
-                                  CL_Color.new(255,   0,   0, 128)))
-      end
     end
   end
 end
 
 $tileset = Tileset.new(32)
-Tileset_load($tileset, $datadir + "images/tilesets/supertux.stgt")
+$tileset.load($datadir + "images/tilesets/supertux.stgt")
 
 $game_objects = [
   ["money", "images/shared/jumpy-left-middle-0.png", proc{|data| 
BadGuy.new("money")}],
@@ -153,6 +169,9 @@
 require "gui2.rb"
 
 $gui.run()
+
+$config.save("~/.flexlay/supertux.rb")
+
 flexlay.deinit()
 
 # EOF #

Modified: trunk/src/tile_selector.cxx
===================================================================
--- trunk/src/tile_selector.cxx 2004-06-08 09:05:50 UTC (rev 403)
+++ trunk/src/tile_selector.cxx 2004-06-09 11:12:36 UTC (rev 404)
@@ -155,6 +155,12 @@
   scale = s;
 }
 
+TileSelector::Tiles
+TileSelector::get_tiles() const
+{
+  return tiles;
+}
+
 void
 TileSelector::set_tileset(Tileset t)
 {

Modified: trunk/src/tile_selector.hxx
===================================================================
--- trunk/src/tile_selector.hxx 2004-06-08 09:05:50 UTC (rev 403)
+++ trunk/src/tile_selector.hxx 2004-06-09 11:12:36 UTC (rev 404)
@@ -55,6 +55,7 @@
 
   void set_tileset(Tileset t);
   void set_tiles(const Tiles& t);
+  Tiles get_tiles() const;
   
   /** Set the factor by which tiles are scaled down in the selector
       widged (ie. for better overview) */

Modified: trunk/src/tileset.cxx
===================================================================
--- trunk/src/tileset.cxx       2004-06-08 09:05:50 UTC (rev 403)
+++ trunk/src/tileset.cxx       2004-06-09 11:12:36 UTC (rev 404)
@@ -92,4 +92,16 @@
   return impl->tile_size; 
 }
 
+std::vector<int> 
+Tileset::get_tiles() const
+{
+  std::vector<int> ret;
+  for(Tiles::size_type i = 0; i < impl->tiles.size(); ++i) 
+    {
+      if (impl->tiles[i] != 0)
+        ret.push_back(i);
+    }
+  return ret;
+}
+
 /* EOF */

Modified: trunk/src/tileset.hxx
===================================================================
--- trunk/src/tileset.hxx       2004-06-08 09:05:50 UTC (rev 403)
+++ trunk/src/tileset.hxx       2004-06-09 11:12:36 UTC (rev 404)
@@ -53,6 +53,9 @@
   
   void add_tile(int id, const Tile& tile);
 
+  /** Return the tiles which are available in this tileset */
+  std::vector<int> get_tiles() const;
+
 private:
   CL_SharedPtr<TilesetImpl> impl;
 };





reply via email to

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