Ejemplo n.º 1
0
 public override void Draw(GLEx g)
 {
     if (!running || !IsOnLoadComplete() || IsClose())
     {
         return;
     }
     if (scrCG == null)
     {
         return;
     }
     if (scrCG.sleep == 0)
     {
         scrCG.Paint(g);
         DrawScreen(g);
         if (desktop != null)
         {
             desktop.CreateUI(g);
         }
         if (sprites != null)
         {
             sprites.CreateUI(g);
         }
     }
     else
     {
         scrCG.sleep--;
         if (color != null)
         {
             float alpha = (float)(scrCG.sleepMax - scrCG.sleep)
                           / scrCG.sleepMax;
             if (alpha > 0 && alpha < 1.0)
             {
                 if (scrCG.getBackgroundCG() != null)
                 {
                     g.DrawTexture(scrCG.getBackgroundCG(), 0, 0);
                 }
                 Color c = g.GetColor();
                 g.SetColor(color.R, color.G, color.B, (byte)(alpha * 255));
                 g.FillRect(0, 0, GetWidth(), GetHeight());
                 g.SetColor(c);
             }
             else
             {
                 Color c = g.GetColor();
                 g.SetColor(color);
                 g.FillRect(0, 0, GetWidth(), GetHeight());
                 g.SetColor(c);
             }
         }
         if (scrCG.sleep <= 0)
         {
             scrCG.sleep = 0;
             color       = null;
         }
         g.SetAlpha(1.0f);
     }
 }
Ejemplo n.º 2
0
        public virtual void DrawRectangle(RectBox rect, float r, float g, float b, float a)
        {
            GLEx gl = GLEx.Self;

            if (gl != null)
            {
                gl.SetColor(r, g, b, a);
                gl.FillRect(rect.x, rect.y, rect.width, rect.height);
                gl.ResetColor();
            }
        }
Ejemplo n.º 3
0
        public void CreateUI(GLEx g)
        {
            if (!visible)
            {
                return;
            }
            if (stop)
            {
                return;
            }
            float op = (currentFrame / time);

            SetOpacity(op);
            if (opacity > 0)
            {
                byte a = (byte)(this.opacity * 255);
                g.FillRect(offsetX + this.X(), offsetY + this.Y(), width, height, new Color(color.R, color.G, color.B, a));
                return;
            }
        }
Ejemplo n.º 4
0
        public void CreateUI(GLEx g)
        {
            if (!visible)
            {
                return;
            }
            if (stop)
            {
                return;
            }
            float alpha = (currentFrame / time);

            SetOpacity(alpha);
            if (alpha > 0f)
            {
                g.SetColor(color.R, color.G, color.B, (byte)(color.A * alpha));
                g.FillRect(offsetX + this.X(), offsetY + this.Y(), width, height);
                g.ResetColor();
            }
        }
Ejemplo n.º 5
0
        private void Step(GLEx g, CycleProgress e, int index, int frame_0,
                          LColor color_1, float alpha_2)
        {
            switch (stepType)
            {
            case 0:
                g.FillOval(X() + e.x - blockHalfWidth, Y() + e.y - blockHalfHeight,
                           blockWidth, blockHeight);
                break;

            case 1:
                g.FillRect(X() + e.x - blockHalfWidth, Y() + e.y - blockHalfHeight,
                           blockWidth, blockHeight);
                break;

            case 2:
                if (last != null)
                {
                    float[] xs = { X() + last.x, X() + e.x };
                    float[] ys = { Y() + last.y, Y() + e.y };
                    g.DrawPolygon(xs, ys, 2);
                }
                last = e;
                break;

            case 3:
                if (last != null)
                {
                    g.DrawLine(X() + last.x, Y() + last.y, X() + e.x, Y() + e.y);
                }
                last = e;
                break;

            case 4:
                Step(g, e.x, e.y, e.progress, index, frame_0, color_1, alpha_2);
                break;
            }
        }
Ejemplo n.º 6
0
 public void CreateUI(GLEx g)
 {
     if (!visible)
     {
         return;
     }
     if (complete)
     {
         return;
     }
     if (alpha > 0 && alpha < 1)
     {
         g.SetAlpha(alpha);
     }
     if (count <= 1)
     {
         g.SetColor(color);
         g.FillRect(X(), Y(), width, height);
         g.ResetColor();
     }
     else
     {
         g.SetColor(color);
         int length = (int)MathUtils.Sqrt(MathUtils.Pow(width / 2, 2.0f)
                                          + MathUtils.Pow(height / 2, 2.0f));
         float x   = X() + (width / 2 - length);
         float y   = Y() + (height / 2 - length);
         float w   = width / 2 + length - x;
         float h   = height / 2 + length - y;
         float deg = 360f / this.div * this.count;
         g.FillArc(x, y, w, h, 0, this.sign[this.turn] * deg);
         g.ResetColor();
     }
     if (alpha > 0 && alpha < 1)
     {
         g.SetAlpha(1f);
     }
 }