windstille-devel
[Top][All Lists]
Advanced

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

[Windstille-devel] rev 385 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 385 - trunk/src
Date: Thu, 03 Jun 2004 11:53:46 +0200

Author: grumbel
Date: 2004-06-03 11:53:45 +0200 (Thu, 03 Jun 2004)
New Revision: 385

Modified:
   trunk/src/clanlib.i
   trunk/src/flexlay_wrap.i
   trunk/src/supertux.py
   trunk/src/tile_selection.cxx
   trunk/src/tilemap_select_tool.cxx
   trunk/src/tilemap_select_tool.hxx
Log:
- added resize via select tool
- added repl

Modified: trunk/src/clanlib.i
===================================================================
--- trunk/src/clanlib.i 2004-06-03 00:07:53 UTC (rev 384)
+++ trunk/src/clanlib.i 2004-06-03 09:53:45 UTC (rev 385)
@@ -42,6 +42,8 @@
 
        int get_width() const;
        int get_height() const;
+
+       CL_Size get_size();
 };
 
 class CL_Color

Modified: trunk/src/flexlay_wrap.i
===================================================================
--- trunk/src/flexlay_wrap.i    2004-06-03 00:07:53 UTC (rev 384)
+++ trunk/src/flexlay_wrap.i    2004-06-03 09:53:45 UTC (rev 385)
@@ -108,5 +108,4 @@
 
 %include "netpanzer.hxx" 
 
-
 /* EOF */

Modified: trunk/src/supertux.py
===================================================================
--- trunk/src/supertux.py       2004-06-03 00:07:53 UTC (rev 384)
+++ trunk/src/supertux.py       2004-06-03 09:53:45 UTC (rev 385)
@@ -23,8 +23,17 @@
 import ConfigParser
 import os
 import sys
+import code
 from optparse import OptionParser
 
+def run_python():
+    repl = code.InteractiveConsole()
+    repl.runsource("import readline")
+    repl.runsource("import rlcompleter")
+    repl.runsource("readline.parse_and_bind('tab: complete')")
+    repl.interact("Use Ctrl-D to exit subshell")
+    print "### Interactive Console finished"
+
 game_objects = [["money", "images/shared/jumpy-left-middle-0.png"],
                 ["snowball", "images/shared/snowball-left-0.png"],
                 ["mriceblock", "images/shared/mriceblock-left-0.png"],
@@ -197,8 +206,8 @@
         f.write("  (version 1)\n")
         f.write("  (name   \"%s\")\n" % self.name)
         f.write("  (author \"%s\")\n" % self.author)
-        f.write("  (width  %d)\n"  % self.width)
-        f.write("  (height  %d)\n" % self.height)
+        f.write("  (width  %s)\n"  % self.width)
+        f.write("  (height  %s)\n" % self.height)
 
         f.write("  (music  \"%s\")\n" % self.music)
         f.write("  (time   \"%s\")\n" % self.time)
@@ -227,7 +236,7 @@
             badguy = get_python_object(obj.get_metadata())
             pos    = obj.get_pos()
             if (badguy.type != "resetpoint"):
-                f.write("     (%s (x %d) (y %d))\n" % (badguy.type, pos.x, 
pos.y))
+                f.write("     (%s (x %d) (y %d))\n" % (badguy.type, 
int(pos.x), int(pos.y)))
         f.write("  )\n\n")
 
         f.write("  (reset-points\n")
@@ -235,7 +244,7 @@
             badguy = get_python_object(obj.get_metadata())
             pos    = obj.get_pos()
             if (badguy.type == "resetpoint"):
-                f.write("     (point (x %d) (y %d))\n" % (badguy.type, pos.x, 
pos.y))
+                f.write("     (point (x %d) (y %d))\n" % (int(pos.x), 
int(pos.y)))
         f.write("  )\n\n")
         
         f.write(" )\n\n;; EOF ;;\n")
@@ -610,6 +619,12 @@
         level.resize(CL_Size(w, h), CL_Point(x, y))
     dialog.set_callback(resize_callback)
 
+def gui_resize_level_to_selection():
+    level = workspace.get_map().get_data()
+    rect  = tilemap_select_tool.get_selection_rect()
+    if (rect.get_width() > 2 and rect.get_height() > 2):
+        level.resize(rect.get_size(), CL_Point(-rect.left, -rect.top))
+
 foreground_icon.set_callback(gui_show_foreground)
 interactive_icon.set_callback(gui_show_interactive)
 background_icon.set_callback(gui_show_background)
@@ -644,7 +659,9 @@
 menu.add_item("File/Save As...", gui_level_save_as)
 menu.add_item("File/Quit",  gui.quit)
 
-menu.add_item("Edit/Resize", gui_resize_level)
+menu.add_item("Edit/Resize", lambda: gui_resize_level())
+menu.add_item("Edit/Resize to selection", lambda: 
gui_resize_level_to_selection())
+menu.add_item("Edit/Debug Shell", lambda: run_python())
 
 def gui_set_zoom(zoom):
     gc = editor_map.get_workspace().get_gc_state()

Modified: trunk/src/tile_selection.cxx
===================================================================
--- trunk/src/tile_selection.cxx        2004-06-03 00:07:53 UTC (rev 384)
+++ trunk/src/tile_selection.cxx        2004-06-03 09:53:45 UTC (rev 385)
@@ -131,7 +131,9 @@
 CL_Rect
 TileSelection::get_rect() const
 {
-  return impl->selection; 
+  CL_Rect sel = impl->selection;
+  sel.normalize();
+  return sel;
 }
 
 /* EOF */

Modified: trunk/src/tilemap_select_tool.cxx
===================================================================
--- trunk/src/tilemap_select_tool.cxx   2004-06-03 00:07:53 UTC (rev 384)
+++ trunk/src/tilemap_select_tool.cxx   2004-06-03 09:53:45 UTC (rev 385)
@@ -118,6 +118,12 @@
   return impl->selection.get_brush(*tilemap.get_field());
 }
 
+CL_Rect
+TileMapSelectTool::get_selection_rect() const
+{
+  return impl->selection.get_rect();
+}
+
 Tool
 TileMapSelectTool::to_tool()
 {

Modified: trunk/src/tilemap_select_tool.hxx
===================================================================
--- trunk/src/tilemap_select_tool.hxx   2004-06-03 00:07:53 UTC (rev 384)
+++ trunk/src/tilemap_select_tool.hxx   2004-06-03 09:53:45 UTC (rev 385)
@@ -37,6 +37,8 @@
   /** Convert the selection into a TileBrush */
   TileBrush get_selection() const;
 
+  CL_Rect get_selection_rect() const;
+
   Tool to_tool();
 private:
   SharedPtr<TileMapSelectToolImpl> impl;





reply via email to

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