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);
     }
 }