Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
 public void DrawWidth(GLEx g, int x, int y)
 {
     try {
         if (drawTexWidth == null)
         {
             LImage    img = LImage.CreateImage(width, height, true);
             LGraphics gl  = img.GetLGraphics();
             for (int i = 0; i < width; i++)
             {
                 gl.SetColor(
                     (start.GetRed() * (width - i)) / width
                     + (end.GetRed() * i) / width,
                     (start.GetGreen() * (width - i)) / width
                     + (end.GetGreen() * i) / width,
                     (start.GetBlue() * (width - i)) / width
                     + (end.GetBlue() * i) / width, alpha);
                 gl.DrawLine(i, 0, i, height);
             }
             drawTexWidth = new LTexture(GLLoader.GetTextureData(img),
                                         Loon.Core.Graphics.Opengl.LTexture.Format.SPEED);
             gl.Dispose();
             gl = null;
         }
         g.DrawTexture(drawTexWidth, x, y);
     } catch (Exception) {
         for (int i = 0; i < width; i++)
         {
             g.SetColorValue(
                 (start.GetRed() * (width - i)) / width
                 + (end.GetRed() * i) / width,
                 (start.GetGreen() * (width - i)) / width
                 + (end.GetGreen() * i) / width,
                 (start.GetBlue() * (width - i)) / width
                 + (end.GetBlue() * i) / width, alpha);
             g.DrawLine(i + x, y, i + x, y + height);
         }
     }
 }
Exemplo n.º 3
0
 public void DrawHeight(GLEx g, int x, int y)
 {
     try {
         if (drawTexHeight == null)
         {
             LImage    img = LImage.CreateImage(width, height, true);
             LGraphics gl  = img.GetLGraphics();
             for (int i = 0; i < height; i++)
             {
                 gl.SetColor(
                     (start.GetRed() * (height - i)) / height
                     + (end.GetRed() * i) / height,
                     (start.GetGreen() * (height - i)) / height
                     + (end.GetGreen() * i) / height,
                     (start.GetBlue() * (height - i)) / height
                     + (end.GetBlue() * i) / height, alpha);
                 gl.DrawLine(0, i, width, i);
             }
             drawTexHeight = new LTexture(GLLoader.GetTextureData(img),
                                          Loon.Core.Graphics.Opengl.LTexture.Format.SPEED);
             gl.Dispose();
             gl = null;
         }
         g.DrawTexture(drawTexHeight, x, y);
     } catch (Exception) {
         for (int i = 0; i < height; i++)
         {
             g.SetColorValue(
                 (start.GetRed() * (height - i)) / height
                 + (end.GetRed() * i) / height,
                 (start.GetGreen() * (height - i)) / height
                 + (end.GetGreen() * i) / height,
                 (start.GetBlue() * (height - i)) / height
                 + (end.GetBlue() * i) / height, alpha);
             g.DrawLine(x, i + y, x + width, i + y);
         }
     }
 }
Exemplo n.º 4
0
 public void DrawWidth(GLEx g, int x, int y)
 {
     try
     {
         if (drawTexWidth == null)
         {
             LPixmap img = new LPixmap(width, height, true);
             for (int i = 0; i < width; i++)
             {
                 img.SetColor(
                     (byte)((start.R * (width - i)) / width
                            + (end.R * i) / width),
                     (byte)((start.G * (width - i)) / width
                            + (end.G * i) / width),
                     (byte)((start.B * (width - i)) / width
                            + (end.B * i) / width), (byte)alpha);
                 img.DrawLine(i, 0, i, height);
             }
             drawTexWidth = img.Texture;
         }
         g.DrawTexture(drawTexWidth, x, y);
     }
     catch
     {
         for (int i = 0; i < width; i++)
         {
             g.SetColor(
                 (byte)((start.R * (width - i)) / width
                        + (end.R * i) / width),
                 (byte)((start.G * (width - i)) / width
                        + (end.G * i) / width),
                 (byte)((start.B * (width - i)) / width
                        + (end.B * i) / width), (byte)alpha);
             g.DrawLine(i + x, y, i + x, y + height);
         }
     }
 }
Exemplo n.º 5
0
 public void DrawHeight(GLEx g, int x, int y)
 {
     try
     {
         if (drawTexHeight == null)
         {
             LPixmap img = new LPixmap(width, height, true);
             for (int i = 0; i < height; i++)
             {
                 img.SetColor((byte)(
                                  (start.R * (height - i)) / height
                                  + (end.R * i) / height),
                              (byte)((start.G * (height - i)) / height
                                     + (end.G * i) / height),
                              (byte)((start.B * (height - i)) / height
                                     + (end.B * i) / height), (byte)(alpha));
                 img.DrawLine(0, i, width, i);
             }
             drawTexHeight = img.Texture;
         }
         g.DrawTexture(drawTexHeight, x, y);
     }
     catch
     {
         for (int i = 0; i < height; i++)
         {
             g.SetColor(
                 (byte)((start.R * (height - i)) / height
                        + (end.R * i) / height),
                 (byte)((start.G * (height - i)) / height
                        + (end.G * i) / height),
                 (byte)((start.B * (height - i)) / height
                        + (end.B * i) / height), (byte)alpha);
             g.DrawLine(x, i + y, x + width, i + y);
         }
     }
 }