Structure storing the state of a digital (on/off) button
Esempio n. 1
0
        private void DrawButton(VirtualGamePadButtonSkin buttonSkin, TouchMap touchMap, Button button, float elapsedTime)
        {
            if (buttonSkin.SensibleVisibility || touchMap.Id != -1)
            {
                buttonSkin.Opacity = buttonSkin.MaxOpacity;
            }
            else
            {
                buttonSkin.Opacity -= elapsedTime;
                if (buttonSkin.Opacity < buttonSkin.MinOpacity)
                    buttonSkin.Opacity = buttonSkin.MinOpacity;
            }

            if (button.IsDown)
            {
                if (buttonSkin.PressedTexture != null && touchMap.TouchArea != Rectangle.Empty)
                {
                    _virtualGamePadRenderer.Draw(
                        buttonSkin.PressedTexture,
                        touchMap.TouchArea,
                        Color.White*buttonSkin.Opacity);
                }
            }
            else
            {
                if (buttonSkin.NormalTexture != null && touchMap.TouchArea != Rectangle.Empty)
                {
                    _virtualGamePadRenderer.Draw(
                        buttonSkin.NormalTexture,
                        touchMap.TouchArea,
                        Color.White*buttonSkin.Opacity);
                }
            }
        }
Esempio n. 2
0
 internal KeyState(Button[] buttons)
 {
     this._buttons = buttons;
 }