public Anchors(ControlBase control) { m_control = control; TPoint point = control.Rect.Position - new TPoint(Define.AnchorOffset / 2, Define.AnchorOffset / 2); TPoint size = control.Rect.Size + new TPoint(Define.AnchorSize, Define.AnchorSize); Rect = new Rect(point, size.X, size.Y); if (m_control.Sizable) { Generate(control.Rect.Position, control.Rect.RightBottom); } if (m_control is ControlContainer) { m_moveAnchor = new AnchorInfo(new Rect(point + new TPoint(15, -Define.AnchorOffset / 2), 10, 10), FlagPosition.None); } }
public TPoint GetSpritePos( SpriteInfo info, AnchorInfo anchor) { if (anchor.Bmp == null) return new TPoint(0, 0); int index = anchor.Index; ImgData imgData = info.ImgList[index]; TPoint offset = imgData.Pivot; if (anchor.XFlip) { offset.X = anchor.Bmp.Width - imgData.Pivot.X; } if (anchor.YFlip) { offset.Y = anchor.Bmp.Height - imgData.Pivot.Y; } return new TPoint(m_center.X - offset.X, m_center.Y - offset.Y); }
private void btnAddImg_Click(object sender, EventArgs e) { if (listRegion.SelectedIndex < 0) return; AnchorInfo newAnchor = new AnchorInfo( listRegion.SelectedIndex ); m_selectActor.Anchors.Add(newAnchor); m_main.Actors.Modify = true; prevPictrue.UpdateAnchor(); }
public static AnchorInfo Read(XmlNode node) { int index = GenericXmlReader.ReadIntAttribute(node, "index"); AnchorInfo anchor = new AnchorInfo(index); anchor.Position = GenericXmlReader.ReadPointAttribute(node, "offset"); anchor.XFlip = GenericXmlReader.ReadBoolAttribute(node, "xflip"); anchor.YFlip = GenericXmlReader.ReadBoolAttribute(node, "yflip"); anchor.ZOrder = GenericXmlReader.ReadIntAttribute(node, "zorder"); return anchor; }
public void Init(SpriteInfo info, int _index) { m_sprite = info; m_anchor = new AnchorInfo(_index); }
private static int CompareAnchor(AnchorInfo lh, AnchorInfo rh) { if (lh.ZOrder > rh.ZOrder) return 1; if (lh.ZOrder < rh.ZOrder) return -1; return 0; }