Esempio n. 1
0
        public void Draw(GLEx gl, long elapsed)
        {
            if (logo == null || finish)
            {
                return;
            }
            if (!logo.isLoaded)
            {
                this.logo.LoadTexture();
                this.centerX = (int)(LSystem.screenRect.width * LSystem.scaleWidth) / 2 - logo.Width / 2;
                this.centerY = (int)(LSystem.screenRect.height * LSystem.scaleHeight) / 2 - logo.Height / 2;
            }
            if (logo == null || !logo.isLoaded)
            {
                finish = true;
                return;
            }
            lock (logo)
            {
                gl.Clear();
                color.A = (byte)(255 * alpha);
                gl.DrawTexture(logo, centerX, centerY, color);
            }
            switch (type)
            {
            case 0:
                if (alpha >= 1f)
                {
                    alpha = 1f;
                    type  = 1;
                }
                if (alpha < 1.0f)
                {
                    if (timer.Action(elapsed))
                    {
                        alpha += 0.015f;
                    }
                }
                break;

            case 1:
                if (timer.Action(elapsed))
                {
                    alpha = 1f;
                    type  = 2;
                }
                break;

            case 2:
                if (alpha > 0.0f)
                {
                    if (timer.Action(elapsed))
                    {
                        alpha -= 0.015f;
                    }
                }
                else if (alpha <= 0f)
                {
                    alpha  = 0;
                    type   = 3;
                    finish = true;
                    if (logo != null)
                    {
                        logo.Destroy();
                        logo = null;
                    }
                    return;
                }
                break;
            }
        }