Quesion about serioussam909's fork

Mar 1, 2011 at 8:53 AM

Hi there, I seen that there is a fork that adds new object types, and I was wondering if someone could give a tip or a guide about adding/removing more elements (I mean, custom elements for my own game). Which classses to modify, etc.

Thanks.

Mar 1, 2011 at 8:47 PM

Currently this process is pretty ugly -

In MainForm.cs I have added something like this

                ///////////////////////////////////////////////////////////////////////////////////////////////////
                //add custom entities here
                ////////////////////////////////////////////////////////////////////////////////////////////////

            else if (listView2.FocusedItem.Text=="RevoluteJoint")
            {
              
               Editor.Instance.createPrimitiveBrush(PrimitiveType.Circle, typeof(RevoluteJointTemplate));
            }
You should add another if statement - similar to this - only replace "revolutejoint" and revolutejointtemplate with your object names.

next you need to add your object to Level.cs

  //CUSTOM ITEMS
    [XmlInclude(typeof(PObjectTemplate))]

like this.

And then you need to open MainForm's desing view > Primitives tab > right click > edit items, and add your primitive's name there.

I'm currently investigating possibilities to do this automatically - like read all custom elements from Xml - any advice will be greatly appreciated.

Mar 2, 2011 at 8:59 AM

Thanks for the tip! I'll take a look to it, this would be very good to customize the level editor to our own projects :)

Reading the custom elements from an XML would be way better but I understand that it would be hard to implement. Right now I like the way OGMO editor handles the custom properties:

<object name="Cannon" image="cannon.png" width="24" height="24" tile = "true" rotatable="true" originX="12" originY="12">
	<values>
		<number name="ShootFrequency" default="1000" />
		<number name="ScanSpeed" default="5000" />
		<number name="AimSpeed" default="2500" />
	</values>
</object>

Apr 17, 2011 at 8:49 AM

SeriousSam,

Do you know how to go about adding custom properties that are added to items by default?

Thanks.

Apr 17, 2011 at 9:19 PM
Edited Apr 18, 2011 at 2:54 AM

I found one easy way to do it. It's a bit ghetto, but it works. For anyone interested...

In editor.cs.paintTextureBrush(bool continueAfterPaint), just add

i.CustomProperties.Add("custompropname", new CustomProperty("custompropname", "valuehere", typeof(string), " descriptionstringhere"));

That'll add your custompropname to all newly created items. Again, hackish, because it adds a custom property rather than a "real" property like scale, rotation or position that's built into gleed2d. On the other hand, you only have to add 1 line!

Jan 8, 2012 at 2:49 PM

Hi,

I've been rewriting this tool and with the permission of zissakos, I'm now hosting it at http://github.com/stevedunn/gleed2d
This new version is all plug-in based, so it'd be great for one of the first plug-ins to be the physics stuff you branched.
The plug-ins currently there are the basic shapes, textures, and now lighting (using Krypton) and simple 'behaviours'.
Cheers,
Steve
Jan 9, 2012 at 6:08 PM

oh, awesome. Unfortunately I've been too busy to work on my project in a while, but I'll definitely take a look at this.