Beispiel #1
0
 public virtual void CreateUI(GLEx g)
 {
     if (visible)
     {
         LFont oldFont = g.GetFont();
         Color oldColor = g.GetColor();
         g.SetFont(font);
         g.SetColor(color);
         this.width = font.StringWidth(label);
         this.height = font.GetSize();
         if (alpha > 0 && alpha < 1)
         {
             g.SetAlpha(alpha);
             g.DrawString(label, X(), Y() - font.GetAscent());
             g.SetAlpha(1.0F);
         }
         else
         {
             g.DrawString(label, X(), Y() - font.GetAscent());
         }
         g.SetFont(oldFont);
         g.SetColor(oldColor);
     }
 }
Beispiel #2
0
 public void Draw(GLEx g, int x, int y)
 {
     switch (style)
     {
         case 0:
         Color oldColor = g.GetColor();
         g.SetColor(color);
         float alpha = 0.0f;
         int nx = x + width / 2 - (int) r * 4,
         ny = y + height / 2 - (int) r * 4;
         g.Translate(nx, ny);
         for (IEnumerator<RectBox> it = list.GetEnumerator(); it.MoveNext();) {
             RectBox s = it.Current;
             alpha = alpha + 0.1f;
             g.SetAlpha(alpha);
             g.FillOval(s.x, s.y, s.width, s.height);
         }
         g.SetAlpha(1.0F);
         g.Translate(-nx, -ny);
         g.SetColor(oldColor);
             break;
         case 1:
             g.SetLineWidth(10);
             g.Translate(x, y);
             g.FillOval(0, 0, width, height, fill.Color);
             int sa = angle % 360;
             g.FillArc(x + (width - paintWidth) / 2, y
                     + (height - paintHeight) / 2, paintWidth, paintHeight,
                     sa, sa + ANGLE_STEP,Color.Red);
             g.Translate(-x, -y);
             g.ResetLineWidth();
             break;
     }
 }
Beispiel #3
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);
     }
 }
Beispiel #4
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;
     }
 }