Esempio n. 1
0
        public virtual void CreateUI(GLEx g)
        {
            if (!visible)
            {
                return;
            }
            image = animation.GetSpriteImage();
            if (image == null)
            {
                return;
            }
            float width  = (image.GetWidth() * scaleX);
            float height = (image.GetHeight() * scaleY);

            if (filterColor == null)
            {
                if (alpha > 0 && alpha < 1)
                {
                    g.SetAlpha(alpha);
                }
                if (LTrans.TRANS_NONE == transform)
                {
                    g.DrawTexture(image, X(), Y(), width, height, rotation);
                }
                else
                {
                    g.DrawRegion(image, 0, 0, GetWidth(), GetHeight(), transform,
                                 X(), Y(), LTrans.TOP | LTrans.LEFT);
                }
                if (alpha > 0 && alpha < 1)
                {
                    g.SetAlpha(1);
                }
                return;
            }
            else
            {
                Color old = g.GetColor();
                if (alpha > 0 && alpha < 1)
                {
                    g.SetAlpha(alpha);
                }
                g.SetColor(filterColor);
                if (LTrans.TRANS_NONE == transform)
                {
                    g.DrawTexture(image, X(), Y(), width, height, rotation);
                }
                else
                {
                    g.DrawRegion(image, 0, 0, GetWidth(), GetHeight(), transform,
                                 X(), Y(), LTrans.TOP | LTrans.LEFT);
                }
                g.SetColor(old);
                if (alpha > 0 && alpha < 1)
                {
                    g.SetAlpha(1);
                }
                return;
            }
        }