コード例 #1
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;
     }
 }
コード例 #2
0
ファイル: Screen.cs プロジェクト: hellogithubtesting/LGame
 public virtual void CreateUI(GLEx g)
 {
     if (isClose)
     {
     return;
     }
     if (replaceLoading)
     {
     if (replaceDstScreen == null
             || !replaceDstScreen.IsOnLoadComplete())
     {
         Repaint(g);
     }
     else if (replaceDstScreen.IsOnLoadComplete())
     {
         if (isScreenFrom)
         {
             Repaint(g);
             if (replaceDstScreen.color != null)
             {
                 g.SetColor(replaceDstScreen.color);
                 g.FillRect(dstPos.X(), dstPos.Y(), GetWidth(),
                         GetHeight());
                 g.ResetColor();
             }
             if (replaceDstScreen.currentScreen != null)
             {
                 g.DrawTexture(replaceDstScreen.currentScreen,
                         dstPos.X(), dstPos.Y(), GetWidth(), GetHeight());
             }
             if (dstPos.X() != 0 || dstPos.Y() != 0)
             {
                 g.SetClip(dstPos.X(), dstPos.Y(), GetWidth(),
                         GetHeight());
                 g.Translate(dstPos.X(), dstPos.Y());
             }
             replaceDstScreen.CreateUI(g);
             if (dstPos.X() != 0 || dstPos.Y() != 0)
             {
                 g.Translate(-dstPos.X(), -dstPos.Y());
                 g.ClearClip();
             }
         }
         else
         {
             if (replaceDstScreen.color != null)
             {
                 g.SetColor(replaceDstScreen.color);
                 g.FillRect(0, 0, GetWidth(), GetHeight());
                 g.ResetColor();
             }
             if (replaceDstScreen.currentScreen != null)
             {
                 g.DrawTexture(replaceDstScreen.currentScreen, 0, 0,
                         GetWidth(), GetHeight());
             }
             replaceDstScreen.CreateUI(g);
             if (color != null)
             {
                 g.SetColor(color);
                 g.FillRect(dstPos.X(), dstPos.Y(), GetWidth(),
                         GetHeight());
                 g.ResetColor();
             }
             if (GetBackground() != null)
             {
                 g.DrawTexture(currentScreen, dstPos.X(), dstPos.Y(),
                         GetWidth(), GetHeight());
             }
             if (dstPos.X() != 0 || dstPos.Y() != 0)
             {
                 g.SetClip(dstPos.X(), dstPos.Y(), GetWidth(),
                         GetHeight());
                 g.Translate(dstPos.X(), dstPos.Y());
             }
             Repaint(g);
             if (dstPos.X() != 0 || dstPos.Y() != 0)
             {
                 g.Translate(-dstPos.X(), -dstPos.Y());
                 g.ClearClip();
             }
         }
     }
     }
     else
     {
     Repaint(g);
     }
 }
コード例 #3
0
ファイル: Screen.cs プロジェクト: hellogithubtesting/LGame
 private void Repaint(GLEx g)
 {
     if (isTranslate) {
     g.Translate(tx, ty);
     }
     if (isCamera) {
     if (camera != null) {
         g.Translate(-camera.cameraX, -camera.cameraY);
     }
     }
     AfterUI(g);
     if (fristPaintFlag) {
     fristOrder.Paint(g);
     }
     if (secondPaintFlag) {
     secondOrder.Paint(g);
     }
     if (lastPaintFlag) {
     lastOrder.Paint(g);
     }
     BeforeUI(g);
     if (isCamera) {
     if (camera != null) {
         g.Translate(camera.cameraX, camera.cameraY);
     }
     }
     if (isTranslate) {
     g.Translate(-tx, -ty);
     }
 }
コード例 #4
0
ファイル: LLayer.cs プロジェクト: hellogithubtesting/LGame
 protected override void CreateCustomUI(GLEx g, int x, int y, int w, int h)
 {
     if (!visible)
     {
         return;
     }
     PaintObjects(g, x, y, x + w, y + h);
     if (x == 0 && y == 0)
     {
         Paint(g);
     }
     else
     {
         g.Translate(x, y);
         Paint(g);
         g.Translate(-x, -y);
     }
 }
コード例 #5
0
ファイル: LLayer.cs プロジェクト: hellogithubtesting/LGame
        public void PaintObjects(GLEx g, int minX, int minY, int maxX, int maxY)
        {
            lock (objects)
            {
                g.BeginBatch();
                IIterator it = objects.Iterator();
                for (; it.HasNext(); )
                {
                    thing = (Actor)it.Next();
                    if (!thing.visible)
                    {
                        continue;
                    }
                    isListener = (thing.actorListener != null);

                    if (isVSync)
                    {
                        if (isListener)
                        {
                            thing.actorListener.Update(elapsedTime);
                        }
                        thing.Update(elapsedTime);
                    }

                    RectBox rect = thing.GetRectBox();
                    actorX = minX + thing.GetX();
                    actorY = minY + thing.GetY();
                    actorWidth = rect.width;
                    actorHeight = rect.height;
                    if (actorX + actorWidth < minX || actorX > maxX
                            || actorY + actorHeight < minY || actorY > maxY)
                    {
                        continue;
                    }
                    LTexture actorImage = thing.GetImage();
                    if (actorImage != null)
                    {
                        width = (actorImage.GetWidth() * thing.scaleX);
                        height = (actorImage.GetHeight() * thing.scaleY);
                        isBitmapFilter = (thing.filterColor != null);
                        thing.SetLastPaintSeqNum(paintSeq++);
                        angle = thing.GetRotation();
                        colorAlpha = thing.alpha;

                        if (isBitmapFilter)
                        {
                            g.DrawBatch(actorImage, actorX, actorY, width,
                                    height, angle, thing.filterColor.Color);
                        }
                        else
                        {
                            if (colorAlpha != 1f)
                            {
                                g.SetAlpha(colorAlpha);
                            }
                            g.DrawBatch(actorImage, actorX, actorY, width,
                                    height, angle);
                            if (colorAlpha != 1f)
                            {
                                g.SetAlpha(1f);
                            }
                        }
                    }
                    if (actorX == 0 && actorY == 0)
                    {
                        thing.Draw(g);
                        if (isListener)
                        {
                            thing.actorListener.Draw(g);
                        }
                    }
                    else
                    {
                        g.Translate(actorX, actorY);
                        thing.Draw(g);
                        if (isListener)
                        {
                            thing.actorListener.Draw(g);
                        }
                        g.Translate(-actorX, -actorY);
                    }
                }
                g.EndBatch();
            }
        }
コード例 #6
0
ファイル: TileMap.cs プロジェクト: hellogithubtesting/LGame
 public void CreateUI(GLEx g)
 {
     if (!visible)
     {
         return;
     }
     if (GetX() != 0 || GetY() != 0)
     {
         g.Translate(GetX(), GetY());
     }
     Draw(g);
     if (GetX() != 0 || GetY() != 0)
     {
         g.Translate(-GetX(), -GetY());
     }
 }