コード例 #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);
     }
 }
コード例 #2
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;
            }
        }
コード例 #3
0
        protected internal override void CreateCustomUI(GLEx g, int x, int y, int w, int h)
        {
            if (!visible)
            {
                return;
            }
            LColor oldColor = g.GetColor();
            LFont  oldFont  = g.GetFont();

            g.SetColor(fontColor);
            g.SetFont(messageFont);
            sizeFont       = messageFont.GetSize();
            doubleSizeFont = sizeFont * 2;
            if (doubleSizeFont == 0)
            {
                doubleSizeFont = 20;
            }
            messageLeft = (x + doubleSizeFont + sizeFont / 2) + tmpOffset + left
                          + doubleSizeFont;
            // g.setAntiAlias(true);
            if (message != null)
            {
                messageTop = y + doubleSizeFont + top + 2;
                g.DrawString(message, messageLeft, messageTop);
            }
            else
            {
                messageTop = y + top + 2;
            }

            nTop = messageTop;
            if (selects != null)
            {
                nLeft = messageLeft - sizeFont / 4;
                for (int i = 0; i < selects.Length; i++)
                {
                    nTop    += 30;
                    type     = i + 1;
                    isSelect = (type == ((selectFlag > 0) ? selectFlag : 1));
                    if ((buoyage != null) && isSelect)
                    {
                        g.SetAlpha(autoAlpha);
                        g.DrawTexture(buoyage, nLeft,
                                      nTop - (int)(buoyage.GetHeight() / 1.5f));
                        g.SetAlpha(1.0F);
                    }
                    g.DrawString(selects[i], messageLeft, nTop);
                    if ((cursor != null) && isSelect)
                    {
                        g.DrawTexture(cursor, nLeft, nTop - cursor.GetHeight() / 2, LColor.white);
                    }
                }
            }
            // g.setAntiAlias(false);
            g.SetColor(oldColor);
            g.SetFont(oldFont);
        }
コード例 #4
0
            public void Draw(GLEx g, int x, int y)
            {
                LColor oldColor = g.GetColor();

                g.SetColor(color);
                switch (style)
                {
                case 0:
                    float alpha = 0.0f;
                    int   nx    = x + width / 2 - (int)r * 4,
                          ny    = y + height / 2 - (int)r * 4;
                    g.Translate(nx, ny);
                    for (IIterator it = new IteratorAdapter(list.GetEnumerator()); it.HasNext();)
                    {
                        RectBox s = (RectBox)it.Next();
                        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);
                    break;

                case 1:
                    g.SetLineWidth(10);
                    g.Translate(x, y);
                    g.SetColor(Fill);
                    g.DrawOval(0, 0, width, height);
                    int sa = angle % 360;
                    g.FillArc(x + (width - paintWidth) / 2, y
                              + (height - paintHeight) / 2, paintWidth, paintHeight,
                              sa, sa + ANGLE_STEP);
                    g.Translate(-x, -y);
                    g.ResetLineWidth();
                    break;
                }
                g.SetColor(oldColor);
            }
コード例 #5
0
ファイル: Label.cs プロジェクト: vb0067/LGame
 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);
     }
 }
コード例 #6
0
ファイル: WaitSprite.cs プロジェクト: vb0067/LGame
            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;
                }
            }