Beispiel #1
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;
            }
        }
Beispiel #2
0
        private unsafe void UpdateFBO()
        {
            Components.Logics.DelayerLogics l = (Components.Logics.DelayerLogics)parent.Logics;
            bool b = false;

            fixed(Color *a = fboarr)
            {
                for (int x = 0; x < fbo.Width; x++)
                {
                    b = l.signals[x * l.Delay / fbo.Width] > 2.5f;

                    *(a + x) = b ? Color.Red : Color.DarkRed;
                }
            }

            fbo.SetData <Color>(fboarr);
        }