pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r2579 - trunk/src/editor


From: jave27
Subject: [Pingus-CVS] r2579 - trunk/src/editor
Date: Thu, 5 Jan 2006 23:06:51 +0100

Author: jave27
Date: 2006-01-05 23:06:47 +0100 (Thu, 05 Jan 2006)
New Revision: 2579

Modified:
   trunk/src/editor/context_menu.cxx
   trunk/src/editor/context_menu.hxx
   trunk/src/editor/level_objs.cxx
Log:
Added ability to change owner in editor (for exits at least).

TODO:  Account for translation origin in sprites, and also look at entrance 
code - combine a hotspot w/ and entrance instead of making them 2 separate 
objects?

Modified: trunk/src/editor/context_menu.cxx
===================================================================
--- trunk/src/editor/context_menu.cxx   2006-01-05 20:30:28 UTC (rev 2578)
+++ trunk/src/editor/context_menu.cxx   2006-01-05 22:06:47 UTC (rev 2579)
@@ -18,6 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <ClanLib/Display/sprite.h>
+#include <ClanLib/Core/System/clanstring.h>
 #include "context_menu.hxx"
 #include "level_objs.hxx"
 #include "editor_viewport.hxx"
@@ -41,7 +42,7 @@
                if (base_menu)
                {
                        // Create all available child menus
-                       width = 80;
+                       width = 110;
                        show = true;
                        create_child_menus();
                }
@@ -124,6 +125,9 @@
                                case (ROTATE) :
                                        
objs[i]->set_modifier(actions[selected_action_offset].parameter);
                                        break;
+                               case (SETOWNER) :
+                                       
objs[i]->set_owner(CL_String::to_int(actions[selected_action_offset].parameter));
+                                       break;
                                default :
                                        break;
                                }
@@ -163,8 +167,19 @@
                        menu->add_action(ContextItem("90 Degrees + Flip", 
"ROT90FLIP", ROTATE, 0));
                        menu->add_action(ContextItem("180 Degrees + Flip", 
"ROT180FLIP", ROTATE, 0));
                        menu->add_action(ContextItem("270 Degrees + Flip", 
"ROT270FLIP", ROTATE, 0));
-                       add_action(ContextItem("Rotate", "", ROTATE, menu));
+                       add_action(ContextItem("Rotate >", "", ROTATE, menu));
                }
+               if (available_attribs & HAS_OWNER)
+               {
+                       menu = new ContextMenu(objs, Vector(pos.x + width, 
pos.y), viewport, false);
+                       viewport->get_screen()->get_gui_manager()->add(menu);
+                       menu->add_action(ContextItem("0", "0", SETOWNER, 0));
+                       menu->add_action(ContextItem("1", "1", SETOWNER, 0));
+                       menu->add_action(ContextItem("2", "2", SETOWNER, 0));
+                       menu->add_action(ContextItem("3", "3", SETOWNER, 0));
+                       add_action(ContextItem("Set Owner >", "", SETOWNER, 
menu));
+               }
+               // TODO - Add more menu options here
        }
 
        void

Modified: trunk/src/editor/context_menu.hxx
===================================================================
--- trunk/src/editor/context_menu.hxx   2006-01-05 20:30:28 UTC (rev 2578)
+++ trunk/src/editor/context_menu.hxx   2006-01-05 22:06:47 UTC (rev 2579)
@@ -32,7 +32,7 @@
        class EditorViewport;
        class ContextMenu;
 
-       typedef enum ItemModifier { REMOVE, ROTATE, STRETCH };
+       typedef enum ItemModifier { REMOVE, ROTATE, SETOWNER, STRETCH };
 
        class ContextItem {
        public:

Modified: trunk/src/editor/level_objs.cxx
===================================================================
--- trunk/src/editor/level_objs.cxx     2006-01-05 20:30:28 UTC (rev 2578)
+++ trunk/src/editor/level_objs.cxx     2006-01-05 22:06:47 UTC (rev 2579)
@@ -78,8 +78,7 @@
                }
                else if(attribs & HAS_STRETCH)
                {
-                       // Surface Background - tile it or stretch
-                       // FIXME: Make stretch code happen.
+                       // Surface Background - tile it
                        for (int x = 0; x < level->size.width; x += 
sprite.get_width())
                                for (int y = 0; y < level->size.height; y += 
sprite.get_height())
                                        gc.draw(sprite, Vector((float)x, 
(float)y));
@@ -159,6 +158,10 @@
                CL_SpriteDescription sprite_desc;
                sprite_desc.add_frame(pb);
                sprite = CL_Sprite(sprite_desc);
+               
+               // FIXME: The above method doesn't take translation origins 
into account.
+               // FIXME: This means that some objects (entrances & exits, for 
example)
+               // FIXME: are drawn incorrectly.
        }
 }
 





reply via email to

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