pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r2881 - branches/pingus_sdl/src/components


From: grumbel at BerliOS
Subject: [Pingus-CVS] r2881 - branches/pingus_sdl/src/components
Date: Mon, 13 Aug 2007 04:45:56 +0200

Author: grumbel
Date: 2007-08-13 04:45:55 +0200 (Mon, 13 Aug 2007)
New Revision: 2881

Modified:
   branches/pingus_sdl/src/components/playfield.cpp
Log:
- little just-for-fun hack to allow direct drawing onto the level (enable 
maintainer mode with Ctrl-m, use 'b', 'r' and 'g' to draw different ground types

Modified: branches/pingus_sdl/src/components/playfield.cpp
===================================================================
--- branches/pingus_sdl/src/components/playfield.cpp    2007-08-13 02:32:43 UTC 
(rev 2880)
+++ branches/pingus_sdl/src/components/playfield.cpp    2007-08-13 02:45:55 UTC 
(rev 2881)
@@ -31,7 +31,6 @@
 #include "button_panel.hpp"
 #include "playfield.hpp"
 
-
 Playfield::Playfield (Client* client_, const Rect& rect_)
   : rect(rect_),
     client(client_),
@@ -183,7 +182,7 @@
 }
 
 void
-Playfield::on_secondary_button_press (int x, int y)
+Playfield::on_secondary_button_press(int x, int y)
 {
   mouse_scrolling = true;
   scroll_center.x = x;
@@ -207,6 +206,37 @@
   // FIXME: useless stuff, but currently the controller doesn't have a state
   mouse_pos.x = x;
   mouse_pos.y = y;
+
+  if (maintainer_mode)
+    {
+      Uint8 *keystate = SDL_GetKeyState(NULL);
+      if (keystate[SDLK_r])
+        {
+          CollisionMask mask("other/bash_radius_gfx");
+          Vector2f p = state.screen2world(mouse_pos);
+          server->get_world()->remove(mask, 
+                                      int(p.x - mask.get_width()/2), 
+                                      int(p.y - mask.get_height()/2));
+        }
+      else if (keystate[SDLK_g])
+        {
+          CollisionMask mask("other/bash_radius_gfx");
+          Vector2f p = state.screen2world(mouse_pos);
+          server->get_world()->put(mask, 
+                                   int(p.x - mask.get_width()/2), 
+                                   int(p.y - mask.get_height()/2),
+                                   Groundtype::GP_GROUND);
+        }
+      else if (keystate[SDLK_b])
+        {
+          CollisionMask mask("other/bash_radius_gfx");
+          Vector2f p = state.screen2world(mouse_pos);
+          server->get_world()->put(mask, 
+                                   int(p.x - mask.get_width()/2), 
+                                   int(p.y - mask.get_height()/2),
+                                   Groundtype::GP_BRIDGE);
+        }
+    }
 }
 
 void





reply via email to

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