Esempio n. 1
0
 public override void Paint(GLEx g)
 {
     if (selectTurret == 3)
     {
         g.SetColor(LColor.red);
         g.DrawRect(2, 2, this.GetWidth() - 4,
                    this.GetHeight() - 4);
         g.ResetColor();
     }
 }
Esempio n. 2
0
        public virtual void DrawRectangle(RectBox rect, float r, float g, float b, float a)
        {
            GLEx gl = GLEx.Self;

            if (gl != null)
            {
                gl.SetColor(r, g, b, a);
                gl.FillRect(rect.x, rect.y, rect.width, rect.height);
                gl.ResetColor();
            }
        }
Esempio n. 3
0
 public override void DrawScreen(GLEx g)
 {
     switch (type)
     {
     case 1:
         g.SetAntiAlias(true);
         g.DrawSixStart(LColor.yellow, 130, 100, 100);
         g.SetAntiAlias(false);
         break;
     }
     g.ResetColor();
 }
Esempio n. 4
0
 public override void CreateUI(GLEx g, int x, int y, LComponent component,
                               LTexture[] buttonImage)
 {
     if (visible && goalPath != null)
     {
         g.SetLineWidth(lineWidth);
         g.SetColor(color);
         g.Draw(goalPath);
         g.ResetLineWidth();
         g.ResetColor();
     }
 }
Esempio n. 5
0
 public void CreateUI(GLEx g)
 {
     if (!visible)
     {
         return;
     }
     if (complete)
     {
         return;
     }
     if (alpha > 0 && alpha < 1)
     {
         g.SetAlpha(alpha);
     }
     if (count <= 1)
     {
         g.SetColor(color);
         g.FillRect(X(), Y(), width, height);
         g.ResetColor();
     }
     else
     {
         g.SetColor(color);
         int length = (int)MathUtils.Sqrt(MathUtils.Pow(width / 2, 2.0f)
                                          + MathUtils.Pow(height / 2, 2.0f));
         float x   = X() + (width / 2 - length);
         float y   = Y() + (height / 2 - length);
         float w   = width / 2 + length - x;
         float h   = height / 2 + length - y;
         float deg = 360f / this.div * this.count;
         g.FillArc(x, y, w, h, 0, this.sign[this.turn] * deg);
         g.ResetColor();
     }
     if (alpha > 0 && alpha < 1)
     {
         g.SetAlpha(1f);
     }
 }
Esempio n. 6
0
 public override void Draw(GLEx g)
 {
     if (selected)
     {
         g.SetColor(255, 0, 0, 100);
         g.FillOval(-(range * 2 - Field.GetTileWidth()) / 2,
                    -(range * 2 - Field.GetTileHeight()) / 2,
                    this.range * 2 - 1, this.range * 2 - 1);
         g.SetColor(LColor.red);
         g.DrawOval(-(range * 2 - Field.GetTileWidth()) / 2,
                    -(range * 2 - Field.GetTileHeight()) / 2,
                    this.range * 2 - 1, this.range * 2 - 1);
         g.ResetColor();
     }
 }
Esempio n. 7
0
        public override void CreateUI(GLEx g, int x, int y, LComponent component,
                                      LTexture[] buttonImage)
        {
            LButton button = (LButton)component;

            if (buttonImage != null)
            {
                if (!button.IsEnabled())
                {
                    g.DrawTexture(buttonImage[3], x, y);
                }
                else if (button.IsTouchPressed())
                {
                    g.DrawTexture(buttonImage[2], x, y);
                }
                else if (button.IsTouchOver())
                {
                    g.DrawTexture(buttonImage[1], x, y);
                }
                else
                {
                    if (type == 1)
                    {
                        g.DrawTexture(buttonImage[0], x, y, LColor.gray);
                    }
                    else
                    {
                        g.DrawTexture(buttonImage[0], x, y);
                    }
                }
            }
            if (text != null)
            {
                LFont old = g.GetFont();
                g.SetFont(font);
                g.SetColor(fontColor);
                g.DrawString(
                    text,
                    x + button.GetOffsetLeft()
                    + (button.GetWidth() - font.StringWidth(text)) / 2,
                    y + button.GetOffsetTop()
                    + (button.GetHeight() - font.GetLineHeight()) / 2
                    + font.GetLineHeight());
                g.SetFont(old);
                g.ResetColor();
            }
        }
Esempio n. 8
0
        public void CreateUI(GLEx g)
        {
            if (!visible)
            {
                return;
            }
            if (stop)
            {
                return;
            }
            float alpha = (currentFrame / time);

            SetOpacity(alpha);
            if (alpha > 0f)
            {
                g.SetColor(color.R, color.G, color.B, (byte)(color.A * alpha));
                g.FillRect(offsetX + this.X(), offsetY + this.Y(), width, height);
                g.ResetColor();
            }
        }
Esempio n. 9
0
 public virtual void CreateUI(GLEx g)
 {
     if (!visible)
     {
         return;
     }
     if (alpha > 0 && alpha < 1)
     {
         g.SetAlpha(alpha);
     }
     g.SetColor(color);
     for (int i = 0; i < drops.Length; ++i)
     {
         g.FillOval((int)drops[i].x, (int)drops[i].y, 2, 2);
     }
     g.ResetColor();
     if (alpha > 0 && alpha < 1)
     {
         g.SetAlpha(1);
     }
 }
Esempio n. 10
0
        protected override void CreateCustomUI(GLEx g, int x, int y, int w,
                                               int h)
        {
            if (!visible)
            {
                return;
            }
            LFont oldFont = g.GetFont();

            g.SetFont(messageFont);
            print.Draw(g, fontColor);
            g.SetFont(oldFont);
            if (print.IsComplete() && animation != null)
            {
                if (animation.GetSpriteImage() != null)
                {
                    g.SetAlpha(1.0F);
                    UpdateIcon();
                    g.DrawTexture(animation.GetSpriteImage(), dx, dy);
                }
            }
            g.ResetColor();
        }
Esempio n. 11
0
        public virtual void CreateUI(GLEx g)
        {
            if (!isVisible)
            {
                return;
            }

            this.Setup();

            int pointsLength = points.Count;

            CycleProgress point;
            int           index;
            int           frameD;
            int           indexD;

            float size = (pointsLength * this.trailLength);

            for (float i = -1, l = size; ++i < l && !this.stopped;)
            {
                index = (int)(frame + i);
                if (index < pointsLength)
                {
                    point = points[index];
                }
                else
                {
                    point = points[index - pointsLength];
                }
                this.alpha = (i / (l - 1));
                frameD     = frame / (pointsLength - 1);
                indexD     = (int)alpha;
                if (lineWidth > 0)
                {
                    g.SetLineWidth(lineWidth);
                }
                if (scaleX != 1 || scaleY != 1)
                {
                    g.Scale(scaleX, scaleY);
                }
                if (alpha > 0 && alpha < 1)
                {
                    g.SetAlpha(alpha);
                }
                g.SetColor(color);
                Step(g, point, indexD, frameD, color, alpha);
                g.ResetColor();
                if (alpha > 0 && alpha < 1)
                {
                    g.SetAlpha(1);
                }
                if (lineWidth > 0)
                {
                    g.ResetLineWidth();
                }
                if (scaleX != 1 || scaleY != 1)
                {
                    g.Restore();
                }
            }
        }
Esempio n. 12
0
        public void Render(GLEx g, float x, float y)
        {
            if (!visible)
            {
                return;
            }

            if ((sprite == null) && (defaultImageName != null))
            {
                LoadSystemParticleImage();
            }


            g.Translate(x, y);

            if (blendingMode == BLEND_ADDITIVE)
            {
                //GLEx.self.setBlendMode(GL.MODE_ALPHA_ONE);
            }
            if (UsePoints())
            {
                //GLEx.gl10.glEnable(GL.GL_POINT_SMOOTH);
                //g.glTex2DDisable();
            }

            for (int emitterIdx = 0; emitterIdx < emitters.Count; emitterIdx++)
            {
                ParticleEmitter emitter = emitters[emitterIdx];

                if (!emitter.IsEnabled())
                {
                    continue;
                }

                if (emitter.UseAdditive())
                {
                    //g.setBlendMode(GL.MODE_ALPHA_ONE);
                }

                ParticlePool pool  = particlesByEmitter[emitter];
                LTexture     image = emitter.GetImage();
                if (image == null)
                {
                    image = this.sprite;
                }

                if (!emitter.IsOriented() && !emitter.UsePoints(this))
                {
                    image.GLBegin();
                }

                for (int i = 0; i < pool.particles.Length; i++)
                {
                    if (pool.particles[i].InUse())
                    {
                        pool.particles[i].Render();
                    }
                }

                if (!emitter.IsOriented() && !emitter.UsePoints(this))
                {
                    image.GLEnd();
                }

                if (emitter.UseAdditive())
                {
                    //g.setBlendMode(GL.MODE_NORMAL);
                }
            }

            if (UsePoints())
            {
                //GLEx.gl10.glDisable(GL.GL_POINT_SMOOTH);
            }
            if (blendingMode == BLEND_ADDITIVE)
            {
                //g.setBlendMode(GL.MODE_NORMAL);
            }

            g.ResetColor();
            g.Translate(-x, -y);
        }
Esempio n. 13
0
        public void Render(GLEx g, float x, float y)
        {
            if (!visible)
            {
                return;
            }

            if ((sprite == null) && (defaultImageName != null))
            {
                LoadSystemParticleImage();
            }

            g.Translate(x, y);

            if (blendingMode == BLEND_ADDITIVE)
            {
                //GLEx.self.setBlendMode(GL.MODE_ALPHA_ONE);
            }
            if (UsePoints())
            {
                //GLEx.gl10.glEnable(GL.GL_POINT_SMOOTH);
                //g.glTex2DDisable();
            }

            for (int emitterIdx = 0; emitterIdx < emitters.Count; emitterIdx++)
            {

                ParticleEmitter emitter = emitters[emitterIdx];

                if (!emitter.IsEnabled())
                {
                    continue;
                }

                if (emitter.UseAdditive())
                {
                    //g.setBlendMode(GL.MODE_ALPHA_ONE);
                }

                ParticlePool pool = particlesByEmitter[emitter];
                LTexture image = emitter.GetImage();
                if (image == null)
                {
                    image = this.sprite;
                }

                if (!emitter.IsOriented() && !emitter.UsePoints(this))
                {
                    image.GLBegin();
                }

                for (int i = 0; i < pool.particles.Length; i++)
                {
                    if (pool.particles[i].InUse())
                    {
                        pool.particles[i].Render();
                    }
                }

                if (!emitter.IsOriented() && !emitter.UsePoints(this))
                {
                    image.GLEnd();
                }

                if (emitter.UseAdditive())
                {
                    //g.setBlendMode(GL.MODE_NORMAL);
                }
            }

            if (UsePoints())
            {
                //GLEx.gl10.glDisable(GL.GL_POINT_SMOOTH);
            }
            if (blendingMode == BLEND_ADDITIVE)
            {
                //g.setBlendMode(GL.MODE_NORMAL);
            }

            g.ResetColor();
            g.Translate(-x, -y);
        }