コード例 #1
0
ファイル: RectangleItemEditor.cs プロジェクト: Andrea/Gleed2D
        public RectangleItemEditor( )
        {
            _properties= new RectangleItemProperties(  );

            _properties = fromRectangle(Rectangle.Empty);
            _properties.Position = Vector2.Zero;
            _properties.Visible = true;
            _properties.FillColor = Constants.Instance.ColorPrimitives;
            _properties.Width = _properties.Height = 100 ;
        }
コード例 #2
0
 public virtual void LoadRectangleItem(RectangleItemProperties rectangleitem, Layer l)
 {
     if (l.Properties.CustomProperties.Keys.Contains("Collision") && (bool)l.Properties.CustomProperties["Collision"].Value)
     {
         Body b = BodyFactory.CreateRectangle(this.World, ConvertUnits.ToSimUnits(rectangleitem.Width), ConvertUnits.ToSimUnits(rectangleitem.Height), 1f);
         b.Position = rectangleitem.getSimPosition();
         //b.Position.X +=
         b.IsStatic = true;
         b.BodyType = BodyType.Static;
         b.UserData = this;
     }
 }
コード例 #3
0
ファイル: RectangleItemEditor.cs プロジェクト: Andrea/Gleed2D
        public virtual void CreateReadyForDroppingOntoCanvas(LayerEditor parentLayer, IEntityCreationProperties creationProperties)
        {
            ParentLayer = parentLayer ;

            _properties = fromRectangle( Rectangle.Empty ) ;

            _properties.Position = MouseStatus.WorldPosition ;

            Vector2 size = calculateDefaultSizeOfNewlyCreatedItem();

            _properties.Width = size.X;
            _properties.Height = size.Y;
            _properties.Visible = true ;
            _properties.FillColor = Constants.Instance.ColorPrimitives ;

            summonMainForm(  ).SetToolStripStatusLabel1(Resource1.Rectangle_DragDrop);

            WhenUpdatedByUi();
        }
コード例 #4
0
ファイル: RectangleItemEditor.cs プロジェクト: Andrea/Gleed2D
        public override void RecreateFromXml( LayerEditor parentLayer, XElement xml )
        {
            ParentLayer = parentLayer ;

            _properties = xml.Element( @"RectangleItemProperties" ).DeserializedAs<RectangleItemProperties>( ) ;

            //todo: don't like having to call the base - use the Prototype
            base.RecreateFromXml( parentLayer, xml );

            WhenUpdatedByUi(  );
        }
コード例 #5
0
ファイル: RectangleItemEditor.cs プロジェクト: Andrea/Gleed2D
        public override void CreateInDesignMode(LayerEditor parentLayer, IEntityCreationProperties creationProperties)
        {
            ParentLayer = parentLayer ;

            _properties = fromRectangle( Rectangle.Empty ) ;

            if (creationProperties.TriggeredBy == UiAction.Dragging)
            {
                var size = calculateDefaultSizeOfNewlyCreatedItem();
                _properties.Width = size.X;
                _properties.Height = size.Y;
            }

            _properties.Position = MouseStatus.WorldPosition ;

            _properties.Visible = true ;
            _properties.FillColor = Constants.Instance.ColorPrimitives ;

            summonMainForm(  ).SetToolStripStatusLabel1(Resource1.Rectangle_Started);

            WhenUpdatedByUi();
        }