Exemple #1
0
        public void RenderForOrthographicCamera(
            RenderForOrthographicCameraTickEvent evt)
        {
            if (!this.isShieldOut_)
            {
                return;
            }

            var g = evt.Graphics;

            var t = g.Transform;

            var(x, y) = (this.playerRigidbody_.CenterX,
                         this.playerRigidbody_.CenterY);

            var shieldWidth = 32;
            var shieldDepth = 4;

            t.Push()
            .Translate(x, y)
            .Rotate(this.handDeg_)
            .Translate(this.handDis_, 0);
            g.Render2d.Rectangle(-shieldDepth * .5f,
                                 -shieldWidth * .5f,
                                 shieldDepth,
                                 shieldWidth,
                                 true);
            t.Pop();
        }
Exemple #2
0
            private void RenderForOrthographicCamera_(
                RenderForOrthographicCameraTickEvent evt)
            {
                var g = evt.Graphics;

                this.RenderTotalWaveform_(g);
            }
Exemple #3
0
        private void RenderForOrthographicCamera_(
            RenderForOrthographicCameraTickEvent evt)
        {
            var g = evt.Graphics;

            this.levelGridRenderer_.Render(g);
            this.boxPlayerRenderer_.Render(g);
        }
        public void RenderForOrthographicCamera(
            RenderForOrthographicCameraTickEvent evt)
        {
            var g   = evt.Graphics;
            var t   = g.Transform;
            var r2d = g.Render2d;

            var(x, y) = (this.playerRigidbody_.CenterX,
                         this.playerRigidbody_.CenterY);

            t.Push()
            .Translate(x, y)
            .Rotate(this.whipDeg_);

            // TODO: Track these via a state machine instead.
            if (this.isWhipping_)
            {
                var maxWhipLen = this.whipLength_ * this.whipStrength_;

                var whipFractionRads =
                    MathF.Pow(this.whipTimeFraction_, .5f) * .8f * MathF.PI;
                var whipFraction = MathF.Sin(whipFractionRads);

                var whipLength = maxWhipLen * whipFraction;

                var whipPointCount = this.whipPoints_.Length;
                for (var i = 0; i < whipPointCount; ++i)
                {
                    var whipPoint = this.whipPoints_[i];

                    var f          = (1f * i) / (whipPointCount - 1f);
                    var whipPointX = f * whipLength;

                    var whipYRads  = 5 * whipFraction * MathF.PI + f * MathF.PI;
                    var whipPointY = MathF.Sin(f * MathF.PI) *
                                     6 *
                                     MathF.Sin(whipYRads);

                    whipPoint.X = whipPointX;
                    whipPoint.Y = whipPointY;
                }

                r2d.Line(this.whipPoints_);
            }
            else if (this.isStoring_)
            {
                r2d.Circle(-this.whipStrength_ * 16, 0, 4, 8, true);
            }

            t.Pop();
        }
        public void RenderForOrthographicCamera(
            RenderForOrthographicCameraTickEvent evt)
        {
            var g = evt.Graphics;

            var t = g.Transform;

            var(x, y) = (this.playerRigidbody_.CenterX,
                         this.playerRigidbody_.CenterY);

            var bladeLength = this.bladeLength_;
            var bladeWidth  = 12;

            t.Push()
            .Translate(x, y)
            .Rotate(this.handDeg_)
            .Translate(this.handDis_, 0)
            .Rotate(-this.handDeg_ + this.swordDeg_);
            g.Render2d.Rectangle(0, -bladeWidth * .5f, bladeLength, bladeWidth, true);
            t.Pop();
        }
Exemple #6
0
            private void RenderForOrthographicCamera_(
                RenderForOrthographicCameraTickEvent evt)
            {
                evt.Graphics.Primitives.VertexColor(ColorConstants.GREEN);
                evt.Graphics.Render2d.Rectangle(0,
                                                480 - 20,
                                                640 * (float)(.5 + .5 *
                                                              this.circularProgress_
                                                              .NormalX
                                                              ),
                                                20,
                                                true);

                evt.Graphics.Primitives.VertexColor(ColorConstants.WHITE);
                evt.Graphics.Text.Draw(0,
                                       0,
                                       24,
                                       24,
                                       "Hello world.\nLine 2.\nTesting hangydoos.\n  Line 4!");

                var position = this.cursor_.Position;

                if (position != null)
                {
                    float radius = this.cursor_.LeftButton.State switch {
                        ButtonState.PRESSED => 8,
                        ButtonState.DOWN => 15,
                        ButtonState.RELEASED => 50,
                        ButtonState.UP => 30,
                    };

                    evt.Graphics.Primitives.VertexColor(ColorConstants.RED);
                    evt.Graphics.Render2d.Circle(position.X,
                                                 position.Y,
                                                 radius,
                                                 20,
                                                 true);
                }
            }
Exemple #7
0
        private void RenderForOrthographicCamera_(
            RenderForOrthographicCameraTickEvent evt)
        {
            var g   = evt.Graphics;
            var r2d = g.Render2d;
            var t   = g.Transform;

            g.Primitives.VertexColor(ColorConstants.WHITE);

            t.Push()
            .Translate(this.playerRigidbody_.CenterX,
                       this.playerRigidbody_.BottomY - this.legHeight_)
            .Scale(this.xDir_, 1);

            this.ForEachBone_(bone => {
                var transform = bone.Transform;
                r2d.Circle(transform.X, transform.Y, 3, 10, true);

                r2d.Line(bone.Start, bone.End);
            });

            t.Pop();
        }
        private void RenderForOrthographicCamera_(
            RenderForOrthographicCameraTickEvent evt)
        {
            var g = evt.Graphics;

            this.RenderLcd_(g);

            g.Primitives.VertexColor(Color.White);

            var registers   = this.mmu_.Registers;
            var memoryMap   = this.mmu_.MemoryMap;
            var ioAddresses = memoryMap.IoAddresses;

            var lX = 202;
            var bY = 145;

            var t = g.Text;
            var i = 0;

            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   "pc: " + ByteFormatter.ToHex16(registers.Pc.Value));

            i++;
            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   "af: " + ByteFormatter.ToHex16(registers.Af.Value));
            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   "bc: " + ByteFormatter.ToHex16(registers.Bc.Value));
            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   "de: " + ByteFormatter.ToHex16(registers.De.Value));
            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   "hl: " + ByteFormatter.ToHex16(registers.Hl.Value));
            i++;

            lX = 320;
            i  = 0;

            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   "ppu: " + ByteFormatter.ToHex8((byte)this.cpu_.PpuMode));
            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   "ly: " +
                   ByteFormatter.ToHex8(this.mmu_.MemoryMap.IoAddresses.Ly.Value));
            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   "dma: " +
                   ByteFormatter.ToHex16(this.mmu_.MemoryMap.IoAddresses
                                         .LastDmaAddress));
            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   ByteFormatter.ToHex8(ioAddresses.Lcdc.Value));
            t.Draw(lX,
                   20 * i++,
                   16,
                   16,
                   ByteFormatter.ToHex8(this.cpu_.ScanlineLcdc));

            var oam = memoryMap.Oam;

            for (i = 0; i < 40; i++)
            {
                var oamAddress = (ushort)(i * 4);
                var y          = (byte)(oam[oamAddress] - 16);
                var x          = (byte)(oam[(ushort)(oamAddress + 1)] - 8);

                var nPerRow = 7;
                var c       = i % nPerRow;
                var r       = (i - c) / nPerRow;

                t.Draw(c * 90,
                       bY + r * 20,
                       16,
                       16,
                       "(" +
                       ByteFormatter.ToHex8(x) +
                       ", " +
                       ByteFormatter.ToHex8(y) +
                       ")");
            }
        }
 public void RenderForOrthographicCamera(
     RenderForOrthographicCameraTickEvent evt)
 => this.CurrentItem.RenderForOrthographicCamera(evt);