Beispiel #1
0
        public override void CreateUI(GLEx g, int x, int y, LComponent component,
                                      LTexture[] buttonImage)
        {
            LButton button = (LButton)component;

            if (buttonImage != null)
            {
                if (!button.IsEnabled())
                {
                    g.DrawTexture(buttonImage[3], x, y);
                }
                else if (button.IsTouchPressed())
                {
                    g.DrawTexture(buttonImage[2], x, y);
                }
                else if (button.IsTouchOver())
                {
                    g.DrawTexture(buttonImage[1], x, y);
                }
                else
                {
                    if (type == 1)
                    {
                        g.DrawTexture(buttonImage[0], x, y, LColor.gray);
                    }
                    else
                    {
                        g.DrawTexture(buttonImage[0], x, y);
                    }
                }
            }
            if (text != null)
            {
                LFont old = g.GetFont();
                g.SetFont(font);
                g.SetColor(fontColor);
                g.DrawString(
                    text,
                    x + button.GetOffsetLeft()
                    + (button.GetWidth() - font.StringWidth(text)) / 2,
                    y + button.GetOffsetTop()
                    + (button.GetHeight() - font.GetLineHeight()) / 2
                    + font.GetLineHeight());
                g.SetFont(old);
                g.ResetColor();
            }
        }