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);
        }
        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;
            }
        }
示例#3
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;
            }
        }
示例#4
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;
            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();
        }
示例#6
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;
     }
 }
        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;
            }
        }
示例#8
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;
            }
        }
示例#9
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;
            }
        }
示例#10
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)Size.X, (int)Size.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;
     }
 }
示例#11
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);//*/
        }
示例#12
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;
     }
 }
示例#13
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);
        }
示例#14
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));
        }
示例#15
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)Size.X, (int)Size.Y), null, Color.White);
        }
示例#16
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;
            }
        }
示例#17
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);
        }
示例#18
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);
        }
示例#19
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:
         case Component.Rotation.cw270:
         default:
             break;
     }
 }
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Components.Logics.SignalSplitterLogics l = (Components.Logics.SignalSplitterLogics)parent.Logics;

            renderer.Draw(texture0cw,
                new Rectangle((int)Position.X, (int)Position.Y,
                    (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                    Color.White);
            //topbg
            renderer.Draw(textureTop0cw,
                new Rectangle((int)Position.X, (int)Position.Y,
                    (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                    Color.DarkRed);
            //bottombg
            renderer.Draw(textureBottom0cw,
                new Rectangle((int)Position.X, (int)Position.Y,
                    (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                    Color.DarkRed);
            if (Settings.GameState != Settings.GameStates.Stopped)
            {
                //top
                if (l.IsTopActive)
                {
                    renderer.Draw(textureTop0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.Red * (float)(l.v1 / 5));
                }
                //bottom
                if (l.IsBottomActive)
                {
                    renderer.Draw(textureBottom0cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.Red * (float)(l.v1 / 5));
                }
            }
        }
示例#21
0
 public override void Draw(MicroWorld.Graphics.Renderer renderer)
 {
     if (texture0cw == null) return;
     if (!CanDraw()) return;
     Magnet p = parent as Magnet;
     if (!wasAOEDrawn && AOEOpacity > 0 && !MicroWorld.Graphics.GraphicsEngine.IsSelectedGlowPass)
     {
         DrawAOE(renderer, 1f);
         wasAOEDrawn = false;
     }
     switch (parent.ComponentRotation)
     {
         case Component.Rotation.cw0:
             renderer.Draw(p.pole == MagnetPole.S ? textureB0cw : 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(p.pole == MagnetPole.S ? textureB90cw : 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(p.pole == MagnetPole.S ? textureB180cw : 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(p.pole == MagnetPole.S ? textureB270cw : 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;
     }
 }
示例#22
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;
            }
        }
示例#23
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;

            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;
            }
        }
示例#24
0
        public void DrawBlocker(int x1, int y1, int x2, int y2, MicroWorld.Graphics.Renderer renderer, float opacity, bool safe = false)
        {
            if (!safe)
            {
                if (x1 > x2)
                {
                    int t = x1;
                    x1 = x2;
                    x2 = t;
                }
                if (y1 > y2)
                {
                    int t = y1;
                    y1 = y2;
                    y2 = t;
                }
                if (x2 - x1 < 8 || y2 - y1 < 8)
                    return;
            }

            bool b = renderer.IsDrawing;
            if (b)
                renderer.End();

            renderer.Begin(SpriteSortMode.Immediate, null, SamplerState.PointWrap, null, null);
            Color c = Color.White * opacity;
            int sx = x2 - x1;
            int sy = y2 - y1;

            renderer.Draw(bg, new Rectangle(x1, y1, sx, sy), new Rectangle(0, 0, sx * 4, sy * 4), c * 0.6f);
            renderer.Draw(Shortcuts.pixel, new Vector2(x1, y1), null, c, 0, Vector2.Zero, new Vector2(0.25f, sy), SpriteEffects.None, 0);

            renderer.End();
            if (b)
                renderer.Begin();
        }
示例#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]);
            }
        }
示例#26
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;
            }
        }
        public void DrawConnector(int x1, int y1, int x2, int y2, MicroWorld.Graphics.Renderer renderer, float opacity)
        {
            Color c = new Color(1f, 1f, 1f) * opacity;

            renderer.Draw(MicroWorld.Graphics.GraphicsEngine.circle,
                new Rectangle(x1 - CONNECTION_CIRCLE_SIZE, y1 - CONNECTION_CIRCLE_SIZE,
                    CONNECTION_CIRCLE_SIZE * 2, CONNECTION_CIRCLE_SIZE * 2), c);
            renderer.Draw(MicroWorld.Graphics.GraphicsEngine.circle,
                new Rectangle(x2 - CONNECTION_CIRCLE_SIZE, y2 - CONNECTION_CIRCLE_SIZE,
                    CONNECTION_CIRCLE_SIZE * 2, CONNECTION_CIRCLE_SIZE * 2), c);

            VertexPositionColorTexture[] arr = new VertexPositionColorTexture[12];

            arr[0] = new VertexPositionColorTexture(new Vector3(x1 - 2, y1 - 2, 0), c, new Vector2());
            arr[1] = new VertexPositionColorTexture(new Vector3(x2 - 2, y2 - 2, 0), c, new Vector2());
            arr[2] = new VertexPositionColorTexture(new Vector3(x1 + 2, y1 + 2, 0), c, new Vector2());

            arr[3] = new VertexPositionColorTexture(new Vector3(x1 + 2, y1 + 2, 0), c, new Vector2());
            arr[4] = new VertexPositionColorTexture(new Vector3(x2 - 2, y2 - 2, 0), c, new Vector2());
            arr[5] = new VertexPositionColorTexture(new Vector3(x2 + 2, y2 + 2, 0), c, new Vector2());

            arr[6] = new VertexPositionColorTexture(new Vector3(x1 + 2, y1 - 2, 0), c, new Vector2());
            arr[7] = new VertexPositionColorTexture(new Vector3(x2 + 2, y2 - 2, 0), c, new Vector2());
            arr[8] = new VertexPositionColorTexture(new Vector3(x1 - 2, y1 + 2, 0), c, new Vector2());

            arr[9] = new VertexPositionColorTexture(new Vector3(x1 - 2, y1 + 2, 0), c, new Vector2());
            arr[10] = new VertexPositionColorTexture(new Vector3(x2 + 2, y2 - 2, 0), c, new Vector2());
            arr[11] = new VertexPositionColorTexture(new Vector3(x2 - 2, y2 + 2, 0), c, new Vector2());

            Main.renderer.Draw(MicroWorld.Graphics.GraphicsEngine.pixel, new Rectangle(0, 0, 0, 0), Color.White);
            bool a = renderer.IsDrawing;
            bool b = renderer.IsScaeld;
            if (renderer.IsDrawing) renderer.End();

            renderer.GraphicsDevice.PresentationParameters.MultiSampleCount = 4;
            renderer.GraphicsDevice.DrawUserPrimitives<VertexPositionColorTexture>(PrimitiveType.TriangleList,
                arr, 0, 4);

            if (a) renderer.Begin(b);
        }
示例#28
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);
        }
示例#29
0
        public override void Draw(MicroWorld.Graphics.Renderer renderer)
        {
            if (texture0cw == null) return;
            if (!CanDraw()) return;
            Motor p = parent as Motor;
            //Components.Logics.MotorLogics l = (Components.Logics.MotorLogics)parent.Logics;

            var s = GetSizeRotated(parent.ComponentRotation);
            switch (parent.ComponentRotation)
            {
                case Component.Rotation.cw0:
                    renderer.Draw(cog, new Rectangle((int)Position.X + 16, (int)Position.Y, 32, 32), null, Color.White, cogRotation, new Vector2(64.5f, 64.5f));
                    renderer.Draw(texture0cw,
                        new Rectangle((int)Position.X, (int)Position.Y - 16,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y + 16), null,
                            Color.White);
                    break;
                case Component.Rotation.cw90:
                    renderer.Draw(cog, new Rectangle((int)Position.X + 32, (int)Position.Y + 16, 32, 32), null, Color.White, cogRotation, new Vector2(64.5f, 64.5f));
                    renderer.Draw(texture90cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X + 16, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                case Component.Rotation.cw180:
                    renderer.Draw(cog, new Rectangle((int)Position.X + 16, (int)Position.Y + 32, 32, 32), null, Color.White, cogRotation, new Vector2(64.5f, 64.5f));
                    renderer.Draw(texture180cw,
                        new Rectangle((int)Position.X, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X, (int)GetSizeRotated(parent.ComponentRotation).Y + 16), null,
                            Color.White);
                    break;
                case Component.Rotation.cw270:
                    renderer.Draw(cog, new Rectangle((int)Position.X, (int)Position.Y + 16, 32, 32), null, Color.White, cogRotation, new Vector2(64.5f, 64.5f));
                    renderer.Draw(texture270cw,
                        new Rectangle((int)Position.X - 16, (int)Position.Y,
                            (int)GetSizeRotated(parent.ComponentRotation).X + 16, (int)GetSizeRotated(parent.ComponentRotation).Y), null,
                            Color.White);
                    break;
                default:
                    break;
            }
        }
示例#30
0
 public void DrawAOE(MicroWorld.Graphics.Renderer renderer, float opacityMultiplier)
 {
     var p = parent as LED;
     MicroWorld.Graphics.RenderHelper.DrawDottedCircle(p.Luminosity, Position + GetSize() / 2, (int)(p.Luminosity / 2),
         (float)((Main.Ticks % 40) * 2 * Math.PI / 40f / (int)(p.Luminosity / 4)), renderer, Color.White);
     return;
     if (wasAOEDrawn) return;
     wasAOEDrawn = true;
     var s = GetSizeRotated(parent.ComponentRotation) / 2;
     renderer.Draw(LECAOE, new Rectangle((int)(Position.X + s.X - p.Luminosity), (int)(Position.Y + s.Y - p.Luminosity),
         (int)(p.Luminosity * 2), (int)(p.Luminosity * 2)),
         Color.Yellow * 0.6f * opacityMultiplier * AOEOpacity);
 }