public bool Remove(UITransform transform) { lock (SyncRoot) { return(RemoveInternal(transform)); } }
public void Add(UITransform transform) { transform.Manager = this; Transforms.Add(transform); transform.OnMarkedDirty += Transform_MarkedDirty; FlagForSort(); }
public void Add(UITransform transform) { _transforms.Add(transform); transform.Container = this; transform.OnMarkedDirty += Transform_MarkedDirty; _boundsNeedUpdate = true; }
private void Transform_MarkedDirty(UITransform transform, DirtMarkType type) { if (type.HasFlags(DirtMarkType.DrawOrder)) { FlagForSort(); } }
private void Transform_MarkedDirty(UITransform transform, DirtMarkType marks) { if (marks.HasFlags(DirtMarkType.Boundaries, DirtMarkType.Enabled)) { _boundsNeedUpdate = true; } }
public void Add(UITransform transform) { lock (SyncRoot) { AddInternal(transform); _needsBoundsUpdate = true; } }
public void Add(UITransform transform) { lock (SyncRoot) { Transforms.Add(transform); transform.MarkedDirty += Transform_MarkedDirty; FlagForSort(); } }
private void AddInternal(UITransform transform) { _transforms.Add(transform); lock (transform.SyncRoot) { transform.SetContainer(this); transform.MarkedDirty += Transform_MarkedDirty; } }
public bool Remove(UITransform transform) { int index = Transforms.FindIndex((x) => x == transform); if (index != -1) { Transforms.GetAndRemoveAt(index).OnMarkedDirty -= Transform_MarkedDirty; return(true); } return(false); }
public bool Remove(UITransform transform) { if (transform.Container == this) { transform.Container = null; } transform.OnMarkedDirty -= Transform_MarkedDirty; _transforms.Remove(transform); _boundsNeedUpdate = true; return(false); }
internal bool RemoveInternal(UITransform transform) { int index = Transforms.FindIndex((x) => x == transform); if (index == -1) { return(false); } else { Transforms.GetAndRemoveAt(index).MarkedDirty -= Transform_MarkedDirty; return(true); } }
public bool Remove(UITransform transform) { lock (SyncRoot) { for (int i = 0, count = _transforms.Count; i < count; i++) { if (RemoveInternal(transform, _transforms[i], i)) { return(true); } } _needsBoundsUpdate = true; return(false); } }
public bool GetElement(float x, float y, out UIElement output) { for (int i = 0, count = Transforms.Count; i < count; i++) { UITransform transform = Transforms[i]; if (transform.IsActive && transform is UIElement element) { if (element.Boundaries.Contains(new PointF(x, y))) { output = element; return(true); } } } output = null; return(false); }
private bool RemoveInternal(UITransform original, UITransform candidate, int i) { lock (original.SyncRoot) { if (original.Container == this) { original.SetContainer(null); } original.MarkedDirty -= Transform_MarkedDirty; } if (candidate.TransformKey == original.TransformKey) { _transforms.RemoveAt(i); return(true); } return(false); }
public IEnumerable <UIElement> GetInputSensitiveElements() { lock (SyncRoot) { ListArray <UITransform> transforms = GetSortedTransformList(); for (int i = 0, length = transforms.Count; i < length; i++) { UITransform transform = transforms[i]; if (transform.IsActive && transform is UIElement element) { if (IsElementInputSensitive(element)) { yield return(element); } } } } }
public virtual void Draw(GameTime time, SpriteBatch spriteBatch) { lock (Manager.SyncRoot) { bool isBatching = false; SamplingMode lastSampling = SamplingMode.LinearClamp; var transforms = Manager.GetSortedTransformList(); for (int i = 0, count = transforms.Count; i < count; i++) { UITransform transform = transforms[i]; if (transform.IsActive == false || !transform.IsDrawable) { continue; } if (lastSampling != transform.PreferredSampling) { if (isBatching) { spriteBatch.End(); isBatching = false; } lastSampling = transform.PreferredSampling; } if (!isBatching) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, GetSamplerState(lastSampling)); isBatching = true; } transform.Draw(time, spriteBatch); } spriteBatch.End(); } }
public static void Draw(this SpriteBatch batch, GameTime time, UITransform transform) { transform.Draw(time, batch); }