Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 private SpriteBatch GetSpriteBatchForComponent(IRenderAwareComponent component)
 {
     if (component.RenderPass == RenderPass.BackgroundPass)
     {
         return(_nonTransformedSpriteBatch);
     }
     else
     {
         return(_spriteBatch);
     }
 }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 private SpriteBatch GetSpriteBatchForComponent(IRenderAwareComponent component)
 {
     if (component.RenderPass == RenderPass.BackgroundPass)
     {
         return _nonTransformedSpriteBatch;
     }
     else
     {
         return _spriteBatch;
     }
 }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
        }