Beispiel #1
0
        internal protected virtual void InternalUpdate(InterfaceManager manager, GameTime time)
        {
            if (state != ComponentState.Default || parent == null)
            {
                Component topmost = null;

                foreach (Component c in children)
                {
                    if (c.Contains(manager.Input.Cursor))
                    {
                        topmost = c;
                        break;
                    }
                }

                state = ComponentState.Default;
                if (topmost != null)
                {
                    topmost.state = (manager.Input.MouseDown(MouseButton.Primary) ? ComponentState.Active : ComponentState.Hovered);
                }
                else if (Contains(manager.Input.Cursor))
                {
                    state = (manager.Input.MouseDown(MouseButton.Primary) ? ComponentState.Active : ComponentState.Hovered);
                }
            }
        }
Beispiel #2
0
        public virtual void Draw(InterfaceManager manager, GameTime time)
        {
            InternalDraw(manager, time);

            foreach (Component c in children)
            {
                c.Draw(manager, time);
            }
        }
Beispiel #3
0
        public virtual void Update(InterfaceManager manager, GameTime time)
        {
            InternalUpdate(manager, time);

            foreach (Component c in children)
            {
                c.Update(manager, time);
            }
        }
            public RootComponent(InterfaceManager manager) : base()
            {
                if (manager == null)
                {
                    throw new ArgumentNullException();
                }

                this.manager = manager;
                //BackgroundColor = Color.Black;
            }
Beispiel #5
0
        internal protected virtual void InternalDraw(InterfaceManager manager, GameTime time)
        {
            if (pixel == null)
            {
                pixel = new Texture2D(manager.GraphicsDevice, 1, 1);
                pixel.SetData(new Color[] { Color.White });
            }

            manager.Batch.Draw(pixel, bounds, backgroundColor);//Hovered ? Color.Yellow : (Active ? Color.Red : backgroundColor));
        }