private bool PointerOverComponent(IRenderAwareComponent component, Vector2 pointerLocation) { // Need to convert pixel coordinates from mouse into screen coordinates if (component.Transform != null) { return(component.Transform.Bounds.Contains((float)pointerLocation.X, (float)pointerLocation.Y)); } return(false); }
public void AddComponent(IRenderAwareComponent component) { _renderComponents[component.RenderPass].Add(component); if (!_gameObjectLookup.ContainsKey(component.GameObjectId)) { _gameObjectLookup.Add(component.GameObjectId, new List <IRenderAwareComponent>()); } _gameObjectLookup[component.GameObjectId].Add(component); }
public void AddComponent(IRenderAwareComponent component) { _renderComponents[component.RenderPass].Add(component); if (!_gameObjectLookup.ContainsKey(component.GameObjectId)) { _gameObjectLookup.Add(component.GameObjectId, new List<IRenderAwareComponent>()); } _gameObjectLookup[component.GameObjectId].Add(component); }
private SpriteBatch GetSpriteBatchForComponent(IRenderAwareComponent component) { if (component.RenderPass == RenderPass.BackgroundPass) { return(_nonTransformedSpriteBatch); } else { return(_spriteBatch); } }
private void DrawDebugVisuals(SpriteBatch batch, IRenderAwareComponent component, GameTime gameTime) { var topLeft = new Vector2(component.Transform.Bounds.Left, component.Transform.Bounds.Top); var bottomLeft = new Vector2(component.Transform.Bounds.Left, component.Transform.Bounds.Bottom); var topRight = new Vector2(component.Transform.Bounds.Right, component.Transform.Bounds.Top); var bottomRight = new Vector2(component.Transform.Bounds.Right, component.Transform.Bounds.Bottom); batch.DrawLine(2f, Color.Fuchsia, topLeft, topRight); batch.DrawLine(2f, Color.Fuchsia, topRight, bottomRight); batch.DrawLine(2f, Color.Fuchsia, bottomRight, bottomLeft); batch.DrawLine(2f, Color.Fuchsia, bottomLeft, topLeft); }
public void RemoveComponent(IRenderAwareComponent component) { System.Diagnostics.Debug.Assert(_gameObjectLookup.Keys.Contains(component.GameObjectId)); #if WINDOWS_PHONE foreach (var val in EnumHelper.GetValues <RenderPass>()) #else foreach (var val in Enum.GetValues(typeof(RenderPass))) #endif { _renderComponents[(RenderPass)val].Remove(component); } _gameObjectLookup[component.GameObjectId].Remove(component); }
private bool PointerOverComponent(IRenderAwareComponent component, Vector2 pointerLocation) { // Need to convert pixel coordinates from mouse into screen coordinates if (component.Transform != null) { return component.Transform.Bounds.Contains((float)pointerLocation.X, (float)pointerLocation.Y); } return false; }
private SpriteBatch GetSpriteBatchForComponent(IRenderAwareComponent component) { if (component.RenderPass == RenderPass.BackgroundPass) { return _nonTransformedSpriteBatch; } else { return _spriteBatch; } }
private void DrawDebugVisuals(SpriteBatch batch, IRenderAwareComponent component, GameTime gameTime) { var topLeft = new Vector2(component.Transform.Bounds.Left, component.Transform.Bounds.Top); var bottomLeft = new Vector2(component.Transform.Bounds.Left, component.Transform.Bounds.Bottom); var topRight = new Vector2(component.Transform.Bounds.Right, component.Transform.Bounds.Top); var bottomRight = new Vector2(component.Transform.Bounds.Right, component.Transform.Bounds.Bottom); batch.DrawLine(2f, Color.Fuchsia, topLeft, topRight); batch.DrawLine(2f, Color.Fuchsia, topRight, bottomRight); batch.DrawLine(2f, Color.Fuchsia, bottomRight, bottomLeft); batch.DrawLine(2f, Color.Fuchsia, bottomLeft, topLeft); }
public void RemoveComponent(IRenderAwareComponent component) { System.Diagnostics.Debug.Assert(_gameObjectLookup.Keys.Contains(component.GameObjectId)); #if WINDOWS_PHONE foreach (var val in EnumHelper.GetValues<RenderPass>()) #else foreach (var val in Enum.GetValues(typeof(RenderPass))) #endif { _renderComponents[(RenderPass)val].Remove(component); } _gameObjectLookup[component.GameObjectId].Remove(component); }