コード例 #1
0
ファイル: Cycle.cs プロジェクト: hellogithubtesting/LGame
        public virtual void CreateUI(GLEx g)
        {
            if (!isVisible)
            {
                return;
            }

            this.Setup();

            int pointsLength = points.Count;

            CycleProgress point;
            int index;
            int frameD;
            int indexD;

            float size = (pointsLength * this.trailLength);

            for (float i = -1, l = size; ++i < l && !this.stopped; )
            {
                index = (int)(frame + i);
                if (index < pointsLength)
                {
                    point = points[index];
                }
                else
                {
                    point = points[index - pointsLength];
                }
                this.alpha = (i / (l - 1));
                frameD = frame / (pointsLength - 1);
                indexD = (int)alpha;
                if (lineWidth > 0)
                {
                    g.SetLineWidth(lineWidth);
                }
                if (scaleX != 1 || scaleY != 1)
                {
                    g.Scale(scaleX, scaleY);
                }
                if (alpha > 0 && alpha < 1)
                {
                    g.SetAlpha(alpha);
                }
                g.SetColor(color);
                Step(g, point, indexD, frameD, color, alpha);
                g.ResetColor();
                if (alpha > 0 && alpha < 1)
                {
                    g.SetAlpha(1);
                }
                if (lineWidth > 0)
                {
                    g.ResetLineWidth();
                }
                if (scaleX != 1 || scaleY != 1)
                {
                    g.Restore();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// ��Ⱦ��ǰ���������ָ����ͼ��֮��
        /// </summary>
        ///
        /// <param name="g"></param>
        public virtual void CreateUI(GLEx g)
        {
            if (isClose)
            {
                return;
            }
            if (!this.visible)
            {
                return;
            }
            int width = this.GetWidth();
            int height = this.GetHeight();

            if (rotation != 0)
            {
                float centerX = this.screenX + width / 2;
                float centerY = this.screenY + height / 2;
                g.Rotate(centerX, centerY, rotation);
            }
            else if (!(scaleX == 1f && scaleY == 1f))
            {
                g.Scale(scaleX, scaleY);
            }
            else if (this.elastic)
            {
                g.SetClip(this.screenX, this.screenY, width, height);
            }
            // ���͸����
            if (alpha > 0.1f && alpha < 1.0f)
            {
                g.SetAlpha(alpha);
                if (background != null)
                {
                    g.DrawTexture(background, this.screenX, this.screenY,
                            this.width, this.height);
                }
                if (this.customRendering)
                {
                    this.CreateCustomUI(g, this.screenX, this.screenY, this.width,
                            this.height);
                }
                else
                {
                    this.CreateUI(g, this.screenX, this.screenY, this, this.imageUI);

                }
                g.SetAlpha(1.0F);
                // �����
            }
            else
            {
                if (background != null)
                {
                    g.DrawTexture(background, this.screenX, this.screenY,
                            this.width, this.height);
                }
                if (this.customRendering)
                {
                    this.CreateCustomUI(g, this.screenX, this.screenY, this.width,
                            this.height);
                }
                else
                {
                    this.CreateUI(g, this.screenX, this.screenY, this, this.imageUI);

                }
            }
            if (rotation != 0 || !(scaleX == 1f && scaleY == 1f))
            {
                g.Restore();
            }
            else if (this.elastic)
            {
                g.ClearClip();
            }
        }