Example #1
0
 public override void DrawGhost(int x, int y, MicroWorld.Graphics.Renderer renderer, Component.Rotation rotation)
 {
     if (texture0cw == null) return;
     switch (rotation)
     {
         case Component.Rotation.cw0:
             renderer.Draw(texture0cw, new Rectangle(x, y, (int)GetSizeRotated(rotation).X, (int)GetSizeRotated(rotation).Y),
                 new Color(1f, 1f, 1f, 0.5f));
             break;
         case Component.Rotation.cw90:
             renderer.Draw(texture90cw, new Rectangle(x, y, (int)GetSizeRotated(rotation).X, (int)GetSizeRotated(rotation).Y),
                 new Color(1f, 1f, 1f, 0.5f));
             break;
         case Component.Rotation.cw180:
             renderer.Draw(texture180cw, new Rectangle(x, y, (int)GetSizeRotated(rotation).X, (int)GetSizeRotated(rotation).Y),
                 new Color(1f, 1f, 1f, 0.5f));
             break;
         case Component.Rotation.cw270:
             renderer.Draw(texture270cw, new Rectangle(x, y, (int)GetSizeRotated(rotation).X, (int)GetSizeRotated(rotation).Y),
                 new Color(1f, 1f, 1f, 0.5f));
             break;
         default:
             renderer.Draw(texture0cw, new Vector2(x, y) + GetCenter(parent.ComponentRotation), null,
                 new Color(1f, 1f, 1f, 0.5f), rotation.GetHashCode() * (float)Math.PI / 2f,
                 GetCenter(parent.ComponentRotation), 1);
             break;
     }
 }
Example #2
0
 public override void DrawGhost(int x, int y, MicroWorld.Graphics.Renderer renderer, Component.Rotation rotation)
 {
     if (texture0cw == null) return;
     switch (rotation)
     {
         case Component.Rotation.cw0:
             renderer.Draw(texture0cw, new Rectangle(x, y, 48, 24), new Color(1f, 1f, 1f, 0.5f));
             renderer.Draw(textureCenter0cw, new Rectangle(x, y, 48, 24), new Color(0.8f, 0f, 0f, 0.5f));
             break;
         case Component.Rotation.cw90:
             renderer.Draw(texture90cw, new Rectangle(x, y, 24, 48), new Color(1f, 1f, 1f, 0.5f));
             renderer.Draw(textureCenter90cw, new Rectangle(x, y, 24, 48), new Color(0.8f, 0f, 0f, 0.5f));
             break;
         case Component.Rotation.cw180:
             renderer.Draw(texture180cw, new Rectangle(x, y, 48, 24), new Color(1f, 1f, 1f, 0.5f));
             renderer.Draw(textureCenter180cw, new Rectangle(x, y, 48, 24), new Color(0.8f, 0f, 0f, 0.5f));
             break;
         case Component.Rotation.cw270:
             renderer.Draw(texture270cw, new Rectangle(x, y, 24, 48), new Color(1f, 1f, 1f, 0.5f));
             renderer.Draw(textureCenter270cw, new Rectangle(x, y, 24, 48), new Color(0.8f, 0f, 0f, 0.5f));
             break;
         default:
             break;
     }
 }
Example #3
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Components.Logics.PulseCoreLogics l = (Components.Logics.PulseCoreLogics)parent.Logics;
            Color c = l.IsComplete ? Color.Lime : l.LastActiveFor > 0 ? Color.Red : Color.DarkRed;

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, Color.White);
                    renderer.Draw(textureCenter0cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, c);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, Color.White);
                    renderer.Draw(textureCenter90cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, c);
                    break;
                case Component.Rotation.cw180:
                    renderer.Draw(texture180cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, Color.White);
                    renderer.Draw(textureCenter180cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, c);
                    break;
                case Component.Rotation.cw270:
                    renderer.Draw(texture270cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, Color.White);
                    renderer.Draw(textureCenter270cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, c);
                    break;
                default:
                    break;
            }
        }
Example #4
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Resistor p = parent as Resistor;
            Components.Logics.ResistorLogics l = (Components.Logics.ResistorLogics)parent.Logics;

            String pr = "Ω";
            double tr = p.Resistance;
            if (tr > 1000000)//m
            {
                pr = "m" + pr;
                tr /= 1000000;
            }
            else if (tr > 1000)
            {
                pr = "k" + pr;
                tr /= 1000;
            }
            tr = Math.Round(tr, 1);
            if (parent.ComponentRotation == Component.Rotation.cw0)
                pr = tr.ToString() + " " + pr;
            else
            {
                String t = tr.ToString();
                for (int i = 2; i < t.Length; i += 4)
                    t = t.Insert(i, "\r\n");
                pr = t + "\r\n" + pr;
            }
            var a = font.MeasureString(pr);

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    //text
                    renderer.DrawString(font, pr, Position + (GetSizeRotated(parent.ComponentRotation) - a) / 2, Color.White, MicroWorld.Graphics.Renderer.TextAlignment.Center);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    //text
                    renderer.DrawString(font, pr, Position + (GetSizeRotated(parent.ComponentRotation) - a) / 2, Color.White, MicroWorld.Graphics.Renderer.TextAlignment.Center);
                    break;
                case Component.Rotation.cw180:
                    break;
                case Component.Rotation.cw270:
                    break;
                default:
                    break;
            }

            //renderer.DrawStringLeft(MicroWorld.Graphics.GUI.Elements.TextBox.defaultFont, ((Resistor)parent).Resistance.ToString(),
            //    Position, Color.White);
        }
Example #5
0
        public override void DrawGhost(int x, int y, MicroWorld.Graphics.Renderer renderer, Component.Rotation rotation)
        {
            if (texture0cw == null) return;

            renderer.Draw(texture0cw, new Rectangle(x, y, (int)GetSizeRotated(rotation).X, (int)GetSizeRotated(rotation).Y),
                new Color(1f, 1f, 1f, 0.5f));
        }
Example #6
0
 public static void DrawBorder(List<Vector2> p, MicroWorld.Graphics.Renderer renderer)
 {
     #region Dotted Lines
     MicroWorld.Graphics.RenderHelper.DrawDottedLinesToBorders(
         p.ToArray(), Color.White, renderer, true);
     #endregion
 }
Example #7
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            ReedSwitch d = parent as ReedSwitch;

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(d.W.IsConnected ? textureConnected0cw : texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(d.W.IsConnected ? textureConnected90cw : texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw180:
                    break;
                case Component.Rotation.cw270:
                    break;
                default:
                    break;
            }
        }
Example #8
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (textureBg == null) return;
            if (!CanDraw()) return;
            Hub d = parent as Hub;

            renderer.Draw(textureBg,
                new Rectangle((int)Position.X, (int)Position.Y,
                    (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                    Color.White);

            if (d.ConnectedLeft)
                renderer.Draw(textureLeft,
                    new Rectangle((int)Position.X, (int)Position.Y,
                        (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                        Color.White);

            if (d.ConnectedUp)
                renderer.Draw(textureUp,
                    new Rectangle((int)Position.X, (int)Position.Y,
                        (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                        Color.White);

            if (d.ConnectedRight)
                renderer.Draw(textureRight,
                    new Rectangle((int)Position.X, (int)Position.Y,
                        (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                        Color.White);

            if (d.ConnectedDown)
                renderer.Draw(textureDown,
                    new Rectangle((int)Position.X, (int)Position.Y,
                        (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                        Color.White);
        }
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Photoresistor p = parent as Photoresistor;

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw180:
                case Component.Rotation.cw270:
                default:
                    break;
            }
        }
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Resistor p = parent as Resistor;
            Components.Logics.ResistorLogics l = (Components.Logics.ResistorLogics)parent.Logics;

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw180:
                    break;
                case Component.Rotation.cw270:
                    break;
                default:
                    break;
            }

            //renderer.DrawStringLeft(MicroWorld.Graphics.GUI.Elements.TextBox.defaultFont, ((Resistor)parent).Resistance.ToString(),
            //    Position, Color.White);
        }
Example #11
0
 public static MusicType GetMusicType(MicroWorld.Sound.EffectInstance e)
 {
     //if (e.parent == Sounds.main1 || e.parent == Sounds.main2) return MusicType.GUI;
     if (e.parent == Sounds.main1) return MusicType.GUI;
     if (e.parent == Sounds.game1 || e.parent == Sounds.game2 || e.parent == Sounds.game3) return MusicType.Game;
     return MusicType.FX;
 }
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Components.Logics.VoltageGraphLogics l = (Components.Logics.VoltageGraphLogics)parent.Logics;

            UpdateFBO();

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw180:
                    renderer.Draw(texture180cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw270:
                    renderer.Draw(texture270cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                default:
                    break;
            }

            if (parent.ComponentRotation == Component.Rotation.cw0 || parent.ComponentRotation == Component.Rotation.cw180)
                renderer.Draw(fbo, new Rectangle((int)Position.X + 15, (int)Position.Y + 11, 39, 23), null, Color.White);
            else
                renderer.Draw(fbo, new Rectangle((int)Position.X + 29, (int)Position.Y + 15, 39, 23), null, Color.White, (float)Math.PI / 2, Vector2.Zero);

            renderer.End();
            renderer.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone,
                null, Matrix.CreateScale(0.25f), true);
            if (parent.ComponentRotation == Component.Rotation.cw0 || parent.ComponentRotation == Component.Rotation.cw180)
            {
                renderer.DrawStringRight(font, l.max.ToString(), new Rectangle((int)Position.X * 4 + 42, (int)Position.Y * 4 + 47, 12, 8), Color.Gray);
                renderer.DrawStringRight(font, l.min.ToString(), new Rectangle((int)Position.X * 4 + 42, (int)Position.Y * 4 + 125, 12, 8), Color.Gray);
            }
            else
            {
                renderer.DrawStringLeft(font, l.min.ToString(), Position * 4 + new Vector2(26, 44), Color.Gray);
                renderer.DrawStringRight(font, l.max.ToString(), new Rectangle((int)Position.X * 4 + 102, (int)Position.Y * 4 + 44, 12, 8), Color.Gray);
            }
            renderer.End();
            renderer.Begin();
        }
Example #13
0
        public override void DrawBorder(MicroWorld.Graphics.Renderer renderer)
        {
            base.DrawBorder(renderer);

            float a = (float)((Main.Ticks % 1200) * Math.PI / 600f);
            float r = (parent.Logics as Logics.TeslaCoilLogics).Range;
            MicroWorld.Graphics.RenderHelper.DrawDottedCircle(r, Center, (int)(r / 2), a, renderer, Color.White);
        }
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;

            renderer.Draw(texture0cw,
                new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, Color.White);
        }
        public override void DrawBorder(MicroWorld.Graphics.Renderer renderer)
        {
            base.DrawBorder(renderer);

            var p = parent as MovementDetector;
            MicroWorld.Graphics.RenderHelper.DrawDottedCircle(p.Range, Position + GetSize() / 2, (int)(p.Range / 2),
                (float)((Main.Ticks % 40) * 2 * Math.PI / 40f / (int)(p.Range / 4)), renderer, Color.White);
        }
 public override void DrawBorder(MicroWorld.Graphics.Renderer renderer)
 {
     var p = parent as RotatableConnector;
     if (p.ConnectedComponent1 != null && p.ConnectedComponent2 != null)
         DrawBorder(p.ConnectedComponent1.Graphics.Position + p.ConnectedComponent1.Graphics.GetSize() / 2,
             p.ConnectedComponent2.Graphics.Position + p.ConnectedComponent2.Graphics.GetSize() / 2,
             renderer);
 }
Example #17
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Components.Logics.AccumulatorLogics l = (Components.Logics.AccumulatorLogics)parent.Logics;

            UpdateFBO();

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(fbo, new Rectangle((int)Position.X + 8, (int)Position.Y + 4, 48, 16), null, Color.White);
                    renderer.Draw(arrow0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(fbo, new Rectangle((int)Position.X + 20, (int)Position.Y + 8, 48, 16), null, Color.White, (float)Math.PI / 2, Vector2.Zero);
                    renderer.Draw(arrow90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw180:
                    renderer.Draw(texture180cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(fbo, new Rectangle((int)Position.X + 56, (int)Position.Y + 20, 48, 16), null, Color.White, (float)Math.PI, Vector2.Zero);
                    renderer.Draw(arrow180cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw270:
                    renderer.Draw(texture270cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(fbo, new Rectangle((int)Position.X + 4, (int)Position.Y + 56, 48, 16), null, Color.White, 3 * (float)Math.PI / 2, Vector2.Zero);
                    renderer.Draw(arrow270cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                default:
                    break;
            }
        }
Example #18
0
 public override void Draw(MicroWorld.Graphics.Renderer renderer)
 {
     if (texture0cw == null) return;
     if (!CanDraw()) return;
     LED p = parent as LED;
     Components.Logics.LEDLogics l = (Components.Logics.LEDLogics)parent.Logics;
     if (!wasAOEDrawn && AOEOpacity > 0 && !MicroWorld.Graphics.GraphicsEngine.IsSelectedGlowPass)
     {
         DrawAOE(renderer, 0.6f);
         wasAOEDrawn = false;
     }
     switch (parent.ComponentRotation)
     {
         case Component.Rotation.cw0:
             renderer.Draw(texture0cw,
                 new Rectangle((int)Position.X, (int)Position.Y,
                     (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                     Color.White);
             renderer.Draw(textureOn0cw,
                 new Rectangle((int)Position.X, (int)Position.Y,
                     (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                     LEDColor * (float)(l.Brightness));
             break;
         case Component.Rotation.cw90:
             renderer.Draw(texture90cw,
                 new Rectangle((int)Position.X, (int)Position.Y,
                     (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                     Color.White);
             renderer.Draw(textureOn90cw,
                 new Rectangle((int)Position.X, (int)Position.Y,
                     (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                     LEDColor * (float)(l.Brightness));
             break;
         case Component.Rotation.cw180:
             renderer.Draw(texture180cw,
                 new Rectangle((int)Position.X, (int)Position.Y,
                     (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                     Color.White);
             renderer.Draw(textureOn180cw,
                 new Rectangle((int)Position.X, (int)Position.Y,
                     (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                     LEDColor * (float)(l.Brightness));
             break;
         case Component.Rotation.cw270:
             renderer.Draw(texture270cw,
                 new Rectangle((int)Position.X, (int)Position.Y,
                     (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                     Color.White);
             renderer.Draw(textureOn270cw,
                 new Rectangle((int)Position.X, (int)Position.Y,
                     (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                     LEDColor * (float)(l.Brightness));
             break;
         default:
             break;
     }
 }
Example #19
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (!CanDraw()) return;
            var p = parent as Blocker;

            if (p.fbo != null)
                renderer.Draw(p.fbo, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), Color.White);
            //DrawBlocker((int)Position.X, (int)Position.Y, (int)(Position.X + Size.X), (int)(Position.Y + Size.Y), renderer, 1f, true);
        }
Example #20
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;

            renderer.Draw(texture0cw,
                new Rectangle((int)Position.X, (int)Position.Y,
                    (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                    Color.White);
        }
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (!CanDraw()) return;

            var p = parent as RotatableConnector;
            DrawConnector(
                (int)(p.ConnectedComponent1.Graphics.Position.X + p.ConnectedComponent1.Graphics.GetSize().X / 2),
                (int)(p.ConnectedComponent1.Graphics.Position.Y + p.ConnectedComponent1.Graphics.GetSize().Y / 2),
                (int)(p.ConnectedComponent2.Graphics.Position.X + p.ConnectedComponent2.Graphics.GetSize().X / 2),
                (int)(p.ConnectedComponent2.Graphics.Position.Y + p.ConnectedComponent2.Graphics.GetSize().Y / 2),
                renderer, 1f);
        }
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            DoubleSwitch d = parent as DoubleSwitch;

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(d.connection == DoubleSwitch.Connection.Connection1 ? textureConnected1_0cw : textureConnected2_0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(d.connection == DoubleSwitch.Connection.Connection1 ? textureConnected1_90cw : textureConnected2_90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw180:
                    renderer.Draw(texture180cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(d.connection == DoubleSwitch.Connection.Connection1 ? textureConnected1_180cw : textureConnected2_180cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw270:
                    renderer.Draw(texture270cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(d.connection == DoubleSwitch.Connection.Connection1 ? textureConnected1_270cw : textureConnected2_270cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                default:
                    break;
            }
        }
Example #23
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Components.Swapper p = (Components.Swapper)parent;
            Components.Logics.SwapperLogics l = (Components.Logics.SwapperLogics)parent.Logics;

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    if (p.Swapped)
                        renderer.Draw(textureConnection2_0cw,
                            new Rectangle((int)Position.X, (int)Position.Y,
                                (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                                Color.Red);
                    else
                        renderer.Draw(textureConnection1_0cw,
                            new Rectangle((int)Position.X, (int)Position.Y,
                                (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                                Color.Red);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    if (p.Swapped)
                        renderer.Draw(textureConnection2_90cw,
                            new Rectangle((int)Position.X, (int)Position.Y,
                                (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                                Color.Red);
                    else
                        renderer.Draw(textureConnection1_90cw,
                            new Rectangle((int)Position.X, (int)Position.Y,
                                (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                                Color.Red);
                    break;
                case Component.Rotation.cw180:
                    break;
                case Component.Rotation.cw270:
                    break;
                default:
                    break;
            }
        }
Example #24
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (jointbg == null) return;
            if (!CanDraw()) return;
            if (!Visible) return;
            renderer.Draw(jointbg, new Rectangle((int)Position.X, (int)Position.Y, 8, 8), Color.White);
            renderer.Draw(jointoverlay, new Rectangle((int)Position.X, (int)Position.Y, 8, 8), Color.Red * (float)((parent as Joint).Voltage / 5f));

            //renderer.DrawString(MicroWorld.Graphics.GUI.GUIEngine.font, Math.Round((parent as Joint).Voltage, 2).ToString(), Position, Color.Red, MicroWorld.Graphics.Renderer.TextAlignment.Left);
            /*
            String s = Math.Round(((Joint)parent).Voltage, 2).ToString();

            renderer.DrawString(MicroWorld.Graphics.GUI.Elements.TextBox.defaultFont, s,
                Position, Color.White);//*/
        }
Example #25
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (!CanDraw()) return;
            var p = parent as Frame;

            if (Settings.GameState != Settings.GameStates.Stopped && p.origPos.HasValue)
                renderer.Draw(p.fbo, new Rectangle((int)p.origPos.Value.X, (int)p.origPos.Value.Y, (int)(Size.X), (int)(Size.Y)), Color.White * 0.4f);

            DrawFrame((int)Position.X, (int)Position.Y, (int)(Position.X + Size.X), (int)(Position.Y + Size.Y), renderer, 1f, true);

            for (int i = 0; i < p.containsComponents.Length; i++)
            {
                p.containsComponents[i].Graphics.IgnoreNextDraw = true;
                ComponentsManager.DrawComponent(p.containsComponents[i]);
            }
        }
Example #26
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Components.Logics.PulseFormerLogics l = (Components.Logics.PulseFormerLogics)parent.Logics;
            UpdateProgressBar();

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y), null, Color.White);
                    renderer.Draw(progressbar, new Rectangle((int)Position.X + 11, (int)Position.Y + 8, 34, 8), null, Color.White);
                    break;
                default:
                    break;
            }
        }
Example #27
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Components.Logics.CapacitorLogics l = (Components.Logics.CapacitorLogics)parent.Logics;

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(texturePlateLeft0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            (l.CurCharge > 0 ? Color.Blue : Color.Red) * (float)Math.Abs(l.CurCharge / l.Capacitance));
                    renderer.Draw(texturePlateRight0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            (l.CurCharge < 0 ? Color.Blue : Color.Red) * (float)Math.Abs(l.CurCharge / l.Capacitance));
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(texturePlateLeft90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            (l.CurCharge > 0 ? Color.Blue : Color.Red) * (float)Math.Abs(l.CurCharge / l.Capacitance));
                    renderer.Draw(texturePlateRight90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            (l.CurCharge < 0 ? Color.Blue : Color.Red) * (float)Math.Abs(l.CurCharge / l.Capacitance));
                    break;
                case Component.Rotation.cw180:
                case Component.Rotation.cw270:
                default:
                    break;
            }

            //renderer.DrawStringLeft(MicroWorld.Graphics.GUI.GUIEngine.font, l.CurCharge.ToString(), Position, Color.Red);
        }
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture == null) return;
            if (!CanDraw()) return;
            Components.old.SegmentDisplay4 p = (Components.old.SegmentDisplay4)parent;
            Logics.SegmentDisplay4Logics l = p.Logics as Logics.SegmentDisplay4Logics;

            if (!wasAOEDrawn && AOEOpacity > 0 && !MicroWorld.Graphics.GraphicsEngine.IsSelectedGlowPass)
            {
                DrawAOE(renderer, 1f);
                wasAOEDrawn = false;
            }

            renderer.Draw(texture, new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y),
                new Rectangle(0, 0, (int)Size.X*4, (int)Size.Y*4), Color.White);
            //curnumbers
            for (int j = 0; j < 4; j++)
            {
                for (int i = 0; i < 8; i++)
                {
                    if ((l.digits[j] & (1 << i)) != 0)
                        renderer.Draw(mask,
                            new Rectangle((int)Position.X + DigitsPositions[j], (int)Position.Y + 7, (int)DigitSize.X, (int)DigitSize.Y),
                            new Rectangle(i * 44, 0, (int)DigitSize.X*4, (int)DigitSize.Y*4),
                            DisplayColor * ((float)p.W[i*4+j].VoltageDropAbs / 5f));
                }
            }
            //last
            for (int c = 0; c < l.digitsold.Length; c++)
            {
                if (l.digitsold[c] == null) break;
                for (int j = 0; j < 4; j++)
                {
                    for (int i = 0; i < 8; i++)
                    {
                        if ((l.digitsold[c][j] & (1 << i)) != 0)
                            renderer.Draw(mask,
                                new Rectangle((int)Position.X + DigitsPositions[j], (int)Position.Y + 7, (int)DigitSize.X, (int)DigitSize.Y),
                                new Rectangle(i * 44, 0, (int)DigitSize.X*4, (int)DigitSize.Y*4),
                                DisplayColor * 0.1f);
                    }
                }
            }
        }
 public override void DrawGhost(int x, int y, MicroWorld.Graphics.Renderer renderer, Component.Rotation rotation)
 {
     if (texture0cw == null) return;
     switch (rotation)
     {
         case Component.Rotation.cw0:
             renderer.Draw(texture0cw, new Rectangle(x, y, (int)GetSizeRotated(rotation).X, (int)GetSizeRotated(rotation).Y),
                 new Color(1f, 1f, 1f, 0.5f));
             break;
         case Component.Rotation.cw90:
             renderer.Draw(texture90cw, new Rectangle(x, y, (int)GetSizeRotated(rotation).X, (int)GetSizeRotated(rotation).Y),
                 new Color(1f, 1f, 1f, 0.5f));
             break;
         case Component.Rotation.cw180:
         case Component.Rotation.cw270:
         default:
             break;
     }
 }
Example #30
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Components.Logics.DelayerLogics l = (Components.Logics.DelayerLogics)parent.Logics;

            UpdateFBO();

            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(fbo, new Rectangle((int)Position.X + 12, (int)Position.Y + 7, 24, 10), null, Color.White);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(fbo, new Rectangle((int)Position.X + 17, (int)Position.Y + 12, 24, 10), null, Color.White, (float)Math.PI / 2, Vector2.Zero);
                    break;
                case Component.Rotation.cw180:
                    renderer.Draw(texture180cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(fbo, new Rectangle((int)Position.X + 36, (int)Position.Y + 17, 24, 10), null, Color.White, (float)Math.PI, Vector2.Zero);
                    break;
                case Component.Rotation.cw270:
                    renderer.Draw(texture270cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    renderer.Draw(fbo, new Rectangle((int)Position.X + 7, (int)Position.Y + 36, 24, 10), null, Color.White, (float)-Math.PI / 2, Vector2.Zero);
                    break;
                default:
                    break;
            }
        }