예제 #1
0
    /// <summary>
    /// Render, your drawing code should go here.
    /// </summary>
    public void Render()
    {
        RB.Clear(new Color32(127, 213, 221, 255));

        // Print "Hi there" centered in a rectangular area near the top of the screen
        RB.Print(new Rect2i(0, (RB.DisplaySize.height / 2) - 48, RB.DisplaySize.width, 32), Color.black, RB.ALIGN_H_CENTER, "Hi there!");

        // Draw some ground
        RB.DrawEllipseFill(new Vector2i(RB.DisplaySize.width / 2, RB.DisplaySize.height - 24), new Vector2i(RB.DisplaySize.width / 5 * 4, RB.DisplaySize.height / 2), new Color32(74, 198, 138, 255));
        RB.DrawEllipse(new Vector2i(RB.DisplaySize.width / 2, RB.DisplaySize.height - 24), new Vector2i(RB.DisplaySize.width / 5 * 4, RB.DisplaySize.height / 2), new Color32(54, 178, 118, 255));

        // Draw character
        var position    = new Vector2i((RB.DisplaySize.width / 2) - (RB.SpriteSheetGet().grid.cellSize.width / 2), (RB.DisplaySize.height / 2) - 36);
        int spriteIndex = ((int)RB.Ticks / 20) % 2;

        // Draw character shadow
        RB.DrawEllipseFill(position + new Vector2i(RB.SpriteSheetGet().grid.cellSize.width / 2, RB.SpriteSheetGet().grid.cellSize.height - 1), new Vector2i(6 + spriteIndex, 2), new Color32(54, 150, 104, 255));

        // Draw a sprite just below
        RB.DrawSprite(spriteIndex, position);

        // Print some more text
        RB.Print(
            new Rect2i(0, (RB.DisplaySize.height / 2) + 12, RB.DisplaySize.width, 64),
            new Color32(35, 101, 71, 255),
            RB.ALIGN_H_CENTER | RB.TEXT_OVERFLOW_WRAP,
            "Now it's @ffffff@w165your@w000@- time to shine!\n\nPlease enjoy@- @ffffffRetroBlit@-! I sincerely hope it inspires, and enables you\nto create the next great retro game!\n" +
            "\nIf you enjoyed @ffffffRetroBlit@-, and would like to continue supporting its development then please share your review on the @ffffffUnity Asset Store@-!" +
            "\n\nThank you!");
    }
예제 #2
0
    private void RenderCard(int xPos, int w, LobbyPlayer player, bool self)
    {
        int topLeftX = xPos - w / 2 + 2;
        int topLeftY = 32;

        RB.DrawRectFill(new Rect2i(topLeftX - 1, topLeftY - 1, new Vector2i(w, size.height - 90)), Color.black);
        RB.DrawRectFill(new Rect2i(topLeftX - 2, topLeftY - 2, new Vector2i(w, size.height - 90)), Color.green);
        RB.DrawRect(new Rect2i(topLeftX, topLeftY, new Vector2i(w - 4, size.height - 94)), Color.gray);
        if (self)
        {
            if (!nameInput.isVisible)
            {
                nameInput.SetText(player.charName);
            }
            readyButton.isVisible     = true;
            nameInput.isVisible       = true;
            prevClassButton.isVisible = true;
            nextClassButton.isVisible = true;
        }
        else
        {
            RB.Print(new Rect2i(topLeftX + 1, topLeftY + 49, w - 4, 12), Color.black, RB.ALIGN_H_CENTER | RB.ALIGN_V_TOP, player.charName);
            RB.Print(new Rect2i(topLeftX, topLeftY + 48, w - 4, 12), Color.white, RB.ALIGN_H_CENTER | RB.ALIGN_V_TOP, player.charName);
            RB.Print(new Vector2i(xPos - 26, topLeftY + size.height - 115), Color.black, RB.NO_INLINE_COLOR, "Ready?");
            RB.Print(new Vector2i(xPos - 27, topLeftY + size.height - 116), Color.white, "Ready?");
        }

        RB.Print(new Rect2i(topLeftX + 11, topLeftY + 71, w - 24, 20), Color.black, RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, DB.Classes[player.charClass].GetName());
        RB.Print(new Rect2i(topLeftX + 10, topLeftY + 70, w - 24, 20), Color.white, RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, DB.Classes[player.charClass].GetName());
        RB.DrawEllipseFill(new Vector2i(xPos + 16, topLeftY - 2 + size.height - 110), new Vector2i(5, 5), Color.black);
        RB.DrawEllipseFill(new Vector2i(xPos + 15, topLeftY - 3 + size.height - 110), new Vector2i(5, 5), player.ready ? Color.green : Color.red);
        RB.DrawEllipse(new Vector2i(xPos + 15, topLeftY - 3 + size.height - 110), new Vector2i(5, 5), Color.white);
    }
예제 #3
0
        private void DrawGamepadABXY(int x, int y, string label, bool pressed, int color, int colorOutline)
        {
            var demo = (DemoReel)RB.Game;

            int faceColor = pressed ? 5 : color;

            RB.DrawEllipseFill(new Vector2i(x, y), new Vector2i(7, 7), DemoUtil.IndexToRGB(faceColor));
            RB.DrawEllipse(new Vector2i(x, y), new Vector2i(7, 7), DemoUtil.IndexToRGB(colorOutline));
            RB.Print(new Vector2i(x - 2, y - 3), DemoUtil.IndexToRGB(colorOutline), label);
        }
예제 #4
0
        private void DrawPiano(int x, int y)
        {
            var demo = (DemoReel)RB.Game;

            RB.CameraSet(new Vector2i(-x, -y));

            mFormatStr.Set("@C// Play sound at specific volume and pitch\n");
            mFormatStr.Append("@NsoundC5Note.Load(@S\"Demos/Demo/C5Note\"@N);\n");
            mFormatStr.Append("@[email protected](soundC5Note, @L0.@L5f@N, @L1.@L2f@N);\n");

            RB.Print(new Vector2i(0, 0), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr));

            RB.CameraSet(new Vector2i(-x, -y - 35));

            Rect2i pianoRect = mPianoRect;
            Rect2i holeRect  = pianoRect;

            pianoRect = pianoRect.Expand(8);
            holeRect  = holeRect.Expand(2);

            int cornerSize = 8;

            RB.DrawEllipseFill(new Vector2i(pianoRect.x + cornerSize, pianoRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(pianoRect.x + cornerSize, pianoRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(pianoRect.x + cornerSize, pianoRect.y + pianoRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(pianoRect.x + cornerSize, pianoRect.y + pianoRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + pianoRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + pianoRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawRect(new Rect2i(pianoRect.x + cornerSize, pianoRect.y, pianoRect.width - (cornerSize * 2), pianoRect.height), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(pianoRect.x + cornerSize, pianoRect.y + 1, pianoRect.width - (cornerSize * 2), pianoRect.height - 2), DemoUtil.IndexToRGB(3));

            RB.DrawRect(new Rect2i(pianoRect.x, pianoRect.y + cornerSize, cornerSize, pianoRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(pianoRect.x + 1, pianoRect.y + cornerSize, cornerSize - 1, pianoRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(3));

            RB.DrawRect(new Rect2i(pianoRect.x + pianoRect.width - cornerSize, pianoRect.y + cornerSize, cornerSize, pianoRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + cornerSize, cornerSize, pianoRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(3));

            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(2));

            for (int i = 0; i < mPianoButtons.Length; i++)
            {
                mPianoButtons[i].Render();
            }

            RB.CameraReset();
        }
예제 #5
0
        private void DrawSpinner(int x, int y, int spinnerSize)
        {
            var demo = (DemoReel)RB.Game;

            RB.DrawEllipseFill(new Vector2i(x + spinnerSize, y + spinnerSize), new Vector2i(spinnerSize, spinnerSize), DemoUtil.IndexToRGB(1));
            RB.DrawEllipseFill(new Vector2i(x + spinnerSize, y + spinnerSize), new Vector2i(spinnerSize - 6, spinnerSize - 6), DemoUtil.IndexToRGB(4));
            RB.DrawEllipseFill(new Vector2i(x + spinnerSize, y + spinnerSize), new Vector2i(8, 8), DemoUtil.IndexToRGB(1));
            RB.DrawEllipse(new Vector2i(x + spinnerSize, y + spinnerSize), new Vector2i(spinnerSize, spinnerSize), DemoUtil.IndexToRGB(4));

            RB.SpriteSheetSet(mSpriteSheet2);
            RB.DrawCopy(new Rect2i(0, 0, (spinnerSize * 2) + 1, (spinnerSize * 2) + 1), new Rect2i(x, y, (spinnerSize * 2) + 1, (spinnerSize * 2) + 1), new Vector2i(spinnerSize, spinnerSize), mMusicTicks / 50);
            RB.SpriteSheetSet(mSpriteSheet1);
        }
예제 #6
0
        private void DrawGamepadSystem(int x, int y, bool pressed, int color, int colorOutline)
        {
            var demo = (DemoReel)RB.Game;

            int faceColor = pressed ? 5 : color;

            RB.DrawEllipseFill(new Vector2i(x, y), new Vector2i(7, 7), DemoUtil.IndexToRGB(faceColor));
            RB.DrawEllipseFill(new Vector2i(x + 6, y), new Vector2i(7, 7), DemoUtil.IndexToRGB(faceColor));

            RB.DrawEllipse(new Vector2i(x, y), new Vector2i(7, 7), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawEllipse(new Vector2i(x + 6, y), new Vector2i(7, 7), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawRect(new Rect2i(x - 1, y - 7, 10, 15), DemoUtil.IndexToRGB(colorOutline));

            RB.DrawRectFill(new Rect2i(x - 1, y - 6, 10, 13), DemoUtil.IndexToRGB(faceColor));

            RB.Print(new Vector2i(x - 4, y - 3), DemoUtil.IndexToRGB(colorOutline), "SYS");
        }
예제 #7
0
    public override void RenderForeground()
    {
        for (int i = 0; i < battle.rolls.Length; i++)
        {
            if (battle.locks[i])
            {
                RB.DrawSprite("Lock", lockPositions[i] - new Vector2i(6, 6));
                //RB.Print(new Rect2i(lockPositions[i] - new Vector2i(16, 8), new Vector2i(32, 16)), Color.black, RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, "Locked");
            }
        }

        for (int i = 0; i < battle.rollsLeft; i++)
        {
            RB.DrawEllipseFill(new Vector2i(size.x / 5 - 10 + i * 10, size.y / 2 + 44), new Vector2i(4, 4), Color.white);
            RB.DrawEllipse(new Vector2i(size.x / 5 - 10 + i * 10, size.y / 2 + 44), new Vector2i(4, 4), Color.black);
        }

        if (infoPane.GetOpenTabIndex() == 1)
        {
            ElementDisplay[] displays = viewedSpell.GetElementDisplays(battle.BuildContext());
            for (int i = 0; i < displays.Length; i++)
            {
                displays[i].Render(size.width / 2 + 5 + i * 18, size.height - 50);
            }
        }

        if (renderTargeting)
        {
            if (targetPawn != null)
            {
                RB.AlphaSet(96);
                RB.DrawRectFill(new Rect2i(0, 0, size), Color.black);
                RB.AlphaSet(255);
                pawnCards[targetPawn].Render();
                RB.DrawRect(targetRect, Color.yellow);
                RB.DrawPixel(targetPoint - new Vector2i(1, 0), Color.white);
                //RB.DrawRect(targetRect.Offset(new Vector2i(0, 0)).Expand(1), Color.black);
                originButton.Render();
            }
            RB.DrawPixel(originPoint + new Vector2i(1, 0), Color.white);
            //RB.DrawRect(new Rect2i(originButton.pos, originButton.size).Expand(2), Color.black);
            RB.DrawLine(originPoint + new Vector2i(0, 1), targetPoint + new Vector2i(0, 1), Color.yellow);
            RB.DrawLine(originPoint, targetPoint, Color.white);
            RB.DrawLine(originPoint - new Vector2i(0, 1), targetPoint - new Vector2i(0, 1), Color.yellow);
        }
    }
예제 #8
0
        private void DrawGamepad(int x, int y, int playerNum)
        {
            var demo = (DemoReel)RB.Game;

            RB.CameraSet(new Vector2i(-x, -y));

            int color1       = playerNum == RB.PLAYER_ONE ? 22 : 15;
            int color2       = playerNum == RB.PLAYER_ONE ? 21 : 14;
            int colorOutline = 0;

            DrawGamepadShoulder(25, -9, "LS", RB.ButtonDown(RB.BTN_LS, playerNum), color2, colorOutline);
            DrawGamepadShoulder(88, -9, "RS", RB.ButtonDown(RB.BTN_RS, playerNum), color2, colorOutline);

            RB.DrawEllipseFill(new Vector2i(26, 28), new Vector2i(26, 28), DemoUtil.IndexToRGB(color1));
            RB.DrawEllipseFill(new Vector2i(102, 28), new Vector2i(26, 28), DemoUtil.IndexToRGB(color1));

            RB.DrawEllipse(new Vector2i(26, 28), new Vector2i(26, 28), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawEllipse(new Vector2i(102, 28), new Vector2i(26, 28), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawRect(new Rect2i(26, 0, 76, 57), DemoUtil.IndexToRGB(colorOutline));

            RB.DrawRectFill(new Rect2i(26, 1, 76, 55), DemoUtil.IndexToRGB(color1));

#if ABXY_SWITCHED
            DrawGamepadABXY(87, 29, "Y", RB.ButtonDown(RB.BTN_Y, playerNum), color2, colorOutline);
            DrawGamepadABXY(113, 29, "A", RB.ButtonDown(RB.BTN_A, playerNum), color2, colorOutline);
            DrawGamepadABXY(100, 16, "X", RB.ButtonDown(RB.BTN_X, playerNum), color2, colorOutline);
            DrawGamepadABXY(100, 41, "B", RB.ButtonDown(RB.BTN_B, playerNum), color2, colorOutline);
#else
            DrawGamepadABXY(100, 16, "Y", RB.ButtonDown(RB.BTN_Y, playerNum), color2, colorOutline);
            DrawGamepadABXY(100, 41, "A", RB.ButtonDown(RB.BTN_A, playerNum), color2, colorOutline);
            DrawGamepadABXY(87, 29, "X", RB.ButtonDown(RB.BTN_X, playerNum), color2, colorOutline);
            DrawGamepadABXY(113, 29, "B", RB.ButtonDown(RB.BTN_B, playerNum), color2, colorOutline);
#endif

            DrawGamepadMenu(55, 20, RB.ButtonDown(RB.BTN_MENU, playerNum), color2, colorOutline);
            DrawGamepadSystem(57, 37, RB.ButtonDown(RB.BTN_SYSTEM, playerNum), color2, colorOutline);

            DrawGamepadDPad(
                10,
                14,
                (RB.ButtonDown(RB.BTN_UP, playerNum) ? RB.BTN_UP : 0) | (RB.ButtonDown(RB.BTN_DOWN, playerNum) ? RB.BTN_DOWN : 0) | (RB.ButtonDown(RB.BTN_LEFT, playerNum) ? RB.BTN_LEFT : 0) | (RB.ButtonDown(RB.BTN_RIGHT, playerNum) ? RB.BTN_RIGHT : 0),
                color2,
                colorOutline);

            RB.CameraReset();
        }
        /// <summary>
        /// Run the stress test
        /// </summary>
        protected override void StressTest()
        {
            Random.InitState(0);

            for (int i = 0; i < mStressLevel; i++)
            {
                var randPos = mRandomPos[i];
                randPos += GetWiggle();

                int type = mRandomColor[i].r % 2;
                if (type == 0)
                {
                    RB.DrawEllipse(randPos, mRandomRadius[i], mRandomColor[i]);
                }
                else if (type == 1)
                {
                    RB.DrawEllipseFill(randPos, mRandomRadius[i], mRandomColor[i]);
                }
            }
        }
예제 #10
0
        private void DrawPositional(int x, int y)
        {
            RB.CameraSet(new Vector2i(-x, -y));

            mFormatStr.Set("@C// RetroBlit supports positional sounds. Simply\n");
            mFormatStr.Append("@C// set the position of your sound, and the\n");
            mFormatStr.Append("@C// position of the listener!\n");
            mFormatStr.Append("@N\n");
            mFormatStr.Append("@Kvoid@N Init() {\n");
            mFormatStr.Append("   sndRef = @[email protected](waterfallSnd);\n");
            mFormatStr.Append("   @[email protected](sndRef, @Ltrue@N);\n");
            mFormatStr.Append("}\n");
            mFormatStr.Append("\n");
            mFormatStr.Append("@Kvoid@N Update() {\n");
            mFormatStr.Append("   @[email protected](sndRef, @Knew@N @MVector2i@N(@L" + mSoundPos.x + "@N, @L" + mSoundPos.y + "@N));\n");
            mFormatStr.Append("   @[email protected](@Knew@N @MVector2i@N(@L" + mListenerPos.x + "@N, @L" + mListenerPos.y + "@N));\n");
            mFormatStr.Append("}\n");

            RB.Print(new Vector2i(0, 0), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr));

            mPositionalButton.Render();

            for (int i = 0; i < (int)(10 * RB.SoundVolumeGet(mPosSoundRef)); i++)
            {
                int radius = 3;
                RB.DrawEllipse(new Vector2i((i * 23) + 4, mListenerPos.y - 3), new Vector2i(radius, radius), DemoUtil.IndexToRGB(2));
            }

            // Use absolute coordinates for drawing ear/rain drop
            RB.CameraReset();

            var volAlpha = (byte)(RB.SoundVolumeGet(mPosSoundRef) * 255);

            RB.AlphaSet(volAlpha);
            RB.DrawLine(mListenerPos, mSoundPos, DemoUtil.IndexToRGB(17));
            RB.DrawCopy(new Rect2i(0, 224, 14, 24), mListenerPos - new Vector2i(14 / 2, 24 / 2));
            RB.DrawCopy(new Rect2i(14, 224, 14, 24), mSoundPos - new Vector2i(14 / 2, 24 / 2));
            RB.AlphaSet(255);
        }
예제 #11
0
        private void DrawShapes(int x, int y)
        {
            var demo = (DemoReel)RB.Game;

            RB.CameraSet(new Vector2i(-x, -y - 66));

            DemoUtil.DrawOutputFrame(new Rect2i(0, 0, 263, 27), -1, mOutputFrame, mOutputBackground);

            for (int i = 0; i < mShapeSize.Length; i++)
            {
                mShapeSize[i].x = (int)((Mathf.Sin((RB.Ticks / 20.0f) + i) * 6) + 8);
                mShapeSize[i].y = (int)((Mathf.Sin((RB.Ticks / 2 / 20.0f) + i) * 6) + 8);
            }

            RB.DrawRect(new Rect2i(-mShapeSize[0].x + 13, -mShapeSize[0].y + 13, mShapeSize[0].x * 2, mShapeSize[0].y * 2), DemoUtil.IndexToRGB(6));
            RB.DrawRectFill(new Rect2i(40 - mShapeSize[1].x + 13, -mShapeSize[1].y + 13, mShapeSize[1].x * 2, mShapeSize[1].y * 2), DemoUtil.IndexToRGB(27));
            RB.DrawEllipse(new Vector2i(80 + 13, 13), new Vector2i(mShapeSize[2].x, mShapeSize[2].y), DemoUtil.IndexToRGB(8));
            RB.DrawEllipseFill(new Vector2i(120 + 13, 13), new Vector2i(mShapeSize[3].x, mShapeSize[3].y), DemoUtil.IndexToRGB(23));
            RB.DrawEllipseInvertedFill(new Vector2i(160 + 13, 13), new Vector2i(mShapeSize[4].x, mShapeSize[4].y), DemoUtil.IndexToRGB(2));
            Rect2i triRect = new Rect2i(-mShapeSize[5].x + 210, -mShapeSize[5].y + 13, mShapeSize[5].x * 2, mShapeSize[5].y * 2);

            RB.DrawTriangle(new Vector2i(triRect.x + (triRect.width / 2), triRect.y), new Vector2i(triRect.x, triRect.y + triRect.height), new Vector2i(triRect.x + triRect.width, triRect.y + triRect.height), DemoUtil.IndexToRGB(15));
            triRect = new Rect2i(-mShapeSize[6].x + 250, -mShapeSize[6].y + 13, mShapeSize[6].x * 2, mShapeSize[6].y * 2);
            RB.DrawTriangleFill(new Vector2i(triRect.x, triRect.y), new Vector2i(triRect.x + triRect.width, triRect.y), new Vector2i(triRect.x + (triRect.width / 2), triRect.y + triRect.height), DemoUtil.IndexToRGB(9));

            RB.CameraReset();

            mFormatStr.Set("@C// Draw primitive shapes\n");
            mFormatStr.Append("@[email protected](@Knew @MRect2i@N(@L").Append(-mShapeSize[0].x + 13).Append("@N, @L").Append(-mShapeSize[0].y + 13).Append("@N, @L").Append(mShapeSize[0].x * 2).Append("@N, @L").Append(mShapeSize[0].y * 2).Append("@N), @I6);\n");
            mFormatStr.Append("@[email protected](@Knew @MRect2i(@L").Append(40 - mShapeSize[1].x + 13).Append("@N, @L").Append(-mShapeSize[1].y + 13).Append("@N, @L").Append(mShapeSize[1].x * 2).Append("@N, @L").Append(mShapeSize[1].y * 2).Append("@N), @I27);\n");
            mFormatStr.Append("@[email protected](@Knew @MVector2i(@L").Append(80 + 13).Append("@N, @L13@N), @Knew @MVector2i@N(@L").Append(mShapeSize[2].x).Append("@N, @L").Append(mShapeSize[2].y).Append("@N), @I8);\n");
            mFormatStr.Append("@[email protected](@Knew @MVector2i@N(@L").Append(120 + 13).Append("@N, @L13@N), @Knew @MVector2i@N(@L").Append(mShapeSize[3].x).Append("@N, @L").Append(mShapeSize[3].y).Append("@N),\n   @I31);\n");
            mFormatStr.Append("@[email protected](@Knew @MVector2i@N(@L").Append(160 + 13).Append("@N, @L13@N),\n    @Knew @MVector2i@N(@L").Append(mShapeSize[4].x).Append("@N, @L").Append(mShapeSize[4].y).Append("@N), @I2);");

            RB.Print(new Vector2i(x, y), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr));
        }
예제 #12
0
        private void DrawKeyboard(int x, int y)
        {
            var demo = (DemoReel)RB.Game;

            RB.CameraSet(new Vector2i(-x, -y));

            Rect2i keyboardRect = RectBetweenKeys("Esc", "KeypadEnter");

            keyboardRect = keyboardRect.Expand(8);

            int cornerSize = 8;

            RB.DrawEllipseFill(new Vector2i(keyboardRect.x + cornerSize, keyboardRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(keyboardRect.x + cornerSize, keyboardRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(keyboardRect.x + keyboardRect.width - cornerSize - 1, keyboardRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(keyboardRect.x + keyboardRect.width - cornerSize - 1, keyboardRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(keyboardRect.x + cornerSize, keyboardRect.y + keyboardRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(keyboardRect.x + cornerSize, keyboardRect.y + keyboardRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(keyboardRect.x + keyboardRect.width - cornerSize - 1, keyboardRect.y + keyboardRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(keyboardRect.x + keyboardRect.width - cornerSize - 1, keyboardRect.y + keyboardRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawRect(new Rect2i(keyboardRect.x + cornerSize, keyboardRect.y, keyboardRect.width - (cornerSize * 2), keyboardRect.height), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(keyboardRect.x + cornerSize, keyboardRect.y + 1, keyboardRect.width - (cornerSize * 2), keyboardRect.height - 2), DemoUtil.IndexToRGB(3));

            RB.DrawRect(new Rect2i(keyboardRect.x, keyboardRect.y + cornerSize, cornerSize, keyboardRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(keyboardRect.x + 1, keyboardRect.y + cornerSize, cornerSize - 1, keyboardRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(3));

            RB.DrawRect(new Rect2i(keyboardRect.x + keyboardRect.width - cornerSize, keyboardRect.y + cornerSize, cornerSize, keyboardRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(keyboardRect.x + keyboardRect.width - cornerSize - 1, keyboardRect.y + cornerSize, cornerSize, keyboardRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(3));

            int holeColor = 2;

            Rect2i holeRect = RectBetweenKeys("Esc", "Esc");

            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("F1", "F4");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("F5", "F8");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("F9", "F12");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("PrintScreen", "Pause");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("~", "RightCtrl");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("Insert", "PageDown");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("Up", "Up");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("Left", "Right");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            holeRect = RectBetweenKeys("NumLock", "KeypadEnter");
            holeRect = holeRect.Expand(1);
            RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(holeColor));

            foreach (KeyValuePair <string, KeyboardKey> key in mKeys)
            {
                KeyboardKey k = key.Value;

                bool pressed = RB.KeyDown(k.Code1) || RB.KeyDown(k.Code2);

                if (pressed || IsVirtualKeyPressed(k))
                {
                    RB.DrawRectFill(new Rect2i(k.Rect.x + 2, k.Rect.y + 2, k.Rect.width - 2, k.Rect.height - 2), DemoUtil.IndexToRGB(5));
                    RB.Print(new Vector2i(k.Rect.x + 3, k.Rect.y + 3), DemoUtil.IndexToRGB(0), k.Label);
                }
                else
                {
                    RB.DrawRectFill(k.Rect, DemoUtil.IndexToRGB(4));
                    RB.Print(new Vector2i(k.Rect.x + 2, k.Rect.y + 2), DemoUtil.IndexToRGB(0), k.Label);
                    RB.DrawRect(k.Rect, DemoUtil.IndexToRGB(3));
                }
            }

            RB.CameraReset();
        }
예제 #13
0
        private void DrawMouse(int x, int y)
        {
            var demo = (DemoReel)RB.Game;

            RB.CameraSet(new Vector2i(-x, -y));

            int color1       = 4;
            int color2       = 3;
            int colorOutline = 0;

            RB.DrawEllipseFill(new Vector2i(26, 15), new Vector2i(26, 15), DemoUtil.IndexToRGB(color1));
            RB.DrawEllipseFill(new Vector2i(26, 54), new Vector2i(26, 20), DemoUtil.IndexToRGB(color1));
            RB.DrawEllipse(new Vector2i(26, 15), new Vector2i(26, 15), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawEllipse(new Vector2i(26, 54), new Vector2i(26, 20), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawRect(new Rect2i(0, 15, 53, 54 - 15), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawRectFill(new Rect2i(1, 15, 53 - 2, 54 - 15), DemoUtil.IndexToRGB(color1));

            RB.DrawLine(new Vector2i(52 / 3, 2), new Vector2i(52 / 3, 30), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawLine(new Vector2i(52 / 3 * 2, 2), new Vector2i(52 / 3 * 2, 30), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawLine(new Vector2i(0, 30), new Vector2i(52, 30), DemoUtil.IndexToRGB(colorOutline));

            if (RB.ButtonDown(RB.BTN_POINTER_A))
            {
                RB.ClipSet(new Rect2i(-RB.CameraGet().x + 1, -RB.CameraGet().y, (52 / 3) - 1, 30));
                RB.DrawEllipseFill(new Vector2i(26, 16), new Vector2i(26, 15), DemoUtil.IndexToRGB(5));
                RB.DrawEllipse(new Vector2i(26, 15), new Vector2i(26, 15), DemoUtil.IndexToRGB(colorOutline));
                RB.DrawRectFill(new Rect2i(1, 15, 53 - 2, 54 - 15), DemoUtil.IndexToRGB(5));
                RB.ClipReset();
            }

            if (RB.ButtonDown(RB.BTN_POINTER_B))
            {
                RB.ClipSet(new Rect2i(-RB.CameraGet().x + 35, -RB.CameraGet().y, 52 / 3, 30));
                RB.DrawEllipseFill(new Vector2i(26, 16), new Vector2i(26, 15), DemoUtil.IndexToRGB(5));
                RB.DrawEllipse(new Vector2i(26, 15), new Vector2i(26, 15), DemoUtil.IndexToRGB(colorOutline));
                RB.DrawRectFill(new Rect2i(1, 15, 53 - 2, 54 - 15), DemoUtil.IndexToRGB(5));
                RB.ClipReset();
            }

            if (RB.ButtonDown(RB.BTN_POINTER_C))
            {
                RB.ClipSet(new Rect2i(-RB.CameraGet().x + 18, -RB.CameraGet().y, (52 / 3) - 1, 30));
                RB.DrawEllipseFill(new Vector2i(26, 16), new Vector2i(26, 15), DemoUtil.IndexToRGB(5));
                RB.DrawEllipse(new Vector2i(26, 15), new Vector2i(26, 15), DemoUtil.IndexToRGB(colorOutline));
                RB.DrawRectFill(new Rect2i(1, 15, 53 - 2, 54 - 15), DemoUtil.IndexToRGB(5));
                RB.ClipReset();
            }

            if (RB.ButtonDown(RB.BTN_POINTER_A))
            {
                RB.Print(new Vector2i(9, 16), DemoUtil.IndexToRGB(colorOutline), "A");
            }
            else
            {
                RB.Print(new Vector2i(8, 15), DemoUtil.IndexToRGB(colorOutline), "A");
            }

            if (RB.ButtonDown(RB.BTN_POINTER_C))
            {
                RB.Print(new Vector2i(25, 16), DemoUtil.IndexToRGB(colorOutline), "C");
            }
            else
            {
                RB.Print(new Vector2i(24, 15), DemoUtil.IndexToRGB(colorOutline), "C");
            }

            if (RB.ButtonDown(RB.BTN_POINTER_B))
            {
                RB.Print(new Vector2i(41, 16), DemoUtil.IndexToRGB(colorOutline), "B");
            }
            else
            {
                RB.Print(new Vector2i(40, 15), DemoUtil.IndexToRGB(colorOutline), "B");
            }

            RB.DrawRectFill(new Rect2i(23, 36, 8, 24), DemoUtil.IndexToRGB(color2));
            int barSize = (int)(6 * mScrollDeltaAnim / 2.0f);

            barSize = Mathf.Clamp(barSize, -12, 12);

            if (barSize > 0)
            {
                RB.DrawRectFill(new Rect2i(23, 48 - barSize, 8, barSize), DemoUtil.IndexToRGB(5));
            }
            else if (barSize < 0)
            {
                RB.DrawRectFill(new Rect2i(23, 48, 8, -barSize), DemoUtil.IndexToRGB(5));
            }

            RB.DrawRect(new Rect2i(23, 36, 8, 24), DemoUtil.IndexToRGB(colorOutline));
            RB.DrawLine(new Vector2i(24, 48), new Vector2i(29, 48), DemoUtil.IndexToRGB(colorOutline));

            RB.CameraReset();
        }
예제 #14
0
        /// <summary>
        /// Render
        /// </summary>
        public override void Render()
        {
            var demo = (DemoReel)RB.Game;

            RB.Clear(DemoUtil.IndexToRGB(1));

            mFormatStr.Set("@C// Test gamepad input for two players\n");
            mFormatStr.Append("@Kif @N(@[email protected](@MRetroBlit.@NBTN_A, @[email protected]_ONE) {\n");
            mFormatStr.Append("   @C// Handle button A down for player one\n@N");
            mFormatStr.Append("}\n");
            mFormatStr.Append("@Kif @N(@[email protected](@MRetroBlit.@NBTN_LEFT, @[email protected]_TWO) {\n");
            mFormatStr.Append("   @C// Handle button LEFT transitioning from \"up\" to \"down\"\n@N");
            mFormatStr.Append("}\n");
            mFormatStr.Append("@Kif @N(@[email protected](@MRetroBlit.@NBTN_MENU, @[email protected]_ANY) {\n");
            mFormatStr.Append("   @C// Handle button MENU transitioning from \"down\" to \"up\"\n@N");
            mFormatStr.Append("}");

            RB.Print(new Vector2i(4, 4), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr));

            DrawGamepad(260, 15, RB.PLAYER_ONE);
            DrawGamepad(400, 15, RB.PLAYER_TWO);
            DrawMouse(540, 8);

            RB.DrawLine(new Vector2i(16, 85), new Vector2i(RB.DisplaySize.width - 16, 85), DemoUtil.IndexToRGB(2));

            mFormatStr.Set("@C// Test keyboard input\n");
            mFormatStr.Append("@Kif @N(@[email protected](@[email protected])) {\n");
            mFormatStr.Append("   @C// Handle Left Shift down\n@N");
            mFormatStr.Append("}\n\n");
            mFormatStr.Append("@C// Retrieve the string of characters typed since last update\n");
            mFormatStr.Append("@Kstring@n userInput += @[email protected]();");

            RB.Print(new Vector2i(50, 92), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr));

            mFormatStr.Set("@C// Get pointer position (mouse or touch)\n");
            mFormatStr.Append("@[email protected](@L4@N, @[email protected]());\n\n");
            mFormatStr.Append("@C// Test pointer button input\n");
            mFormatStr.Append("@Kif @N(@[email protected](@[email protected]_POINTER_A)) {\n");
            mFormatStr.Append("   @C// Handle Pointer Button A down\n@N");
            mFormatStr.Append("}\n");

            RB.Print(new Vector2i(350, 92), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr));

            DrawKeyboard(mKeyboardOffset.x, mKeyboardOffset.y);
            DrawInputString(14, 155);

            mNextButton.Render();
            mPrevButton.Render();

            if (RB.PointerPosValid())
            {
                RB.DrawSprite(4, RB.PointerPos());
            }

            if (!UnityEngine.Input.mousePresent)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (RB.PointerPosValid(i))
                    {
                        RB.DrawEllipse(RB.PointerPos(i), new Vector2i(64, 64), mTouchColor[i]);
                    }
                }
            }
        }
예제 #15
0
        private void DrawMusicPlayer(int x, int y)
        {
            var demo = (DemoReel)RB.Game;

            RB.Offscreen(mSpriteSheet2);
            RB.Clear(new Color32(0, 0, 0, 0));

            int spinnerSize = 32;

            RB.DrawRectFill(new Rect2i(spinnerSize / 4, spinnerSize - 2, (spinnerSize / 2) - 2, 5), DemoUtil.IndexToRGB(1));
            RB.DrawRectFill(new Rect2i(spinnerSize + (spinnerSize / 4) + 3, spinnerSize - 2, (spinnerSize / 2) - 2, 5), DemoUtil.IndexToRGB(1));
            RB.DrawRectFill(new Rect2i(spinnerSize - 2, spinnerSize / 4, 5, (spinnerSize / 2) - 2), DemoUtil.IndexToRGB(1));
            RB.DrawRectFill(new Rect2i(spinnerSize - 2, spinnerSize + (spinnerSize / 4) + 3, 5, (spinnerSize / 2) - 2), DemoUtil.IndexToRGB(1));

            RB.Onscreen();

            RB.CameraSet(new Vector2i(-x, -y));

            mFormatStr.Set("@C// Load music and play it\n");
            mFormatStr.Append("@NdemoMusic.Load(@S\"Demos/Demo/Music\"@N);\n");
            mFormatStr.Append("\n");
            mFormatStr.Append("@Kif@N (@[email protected](@[email protected]) {\n");
            mFormatStr.Append("   @[email protected](demoMusic);\n");
            mFormatStr.Append("} @Kelse if@N (@[email protected](@[email protected]) {\n");
            mFormatStr.Append("   @[email protected]();\n");
            mFormatStr.Append("}");

            RB.Print(new Vector2i(0, 0), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr));

            RB.CameraSet(new Vector2i(-x, -y - 80));

            int cornerSize = 8;
            var deckRect   = new Rect2i(20, 40, 145, 100);

            RB.DrawEllipseFill(new Vector2i(deckRect.x + cornerSize, deckRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(deckRect.x + cornerSize, deckRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(deckRect.x + deckRect.width - cornerSize - 1, deckRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(deckRect.x + deckRect.width - cornerSize - 1, deckRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(deckRect.x + cornerSize, deckRect.y + deckRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(deckRect.x + cornerSize, deckRect.y + deckRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawEllipseFill(new Vector2i(deckRect.x + deckRect.width - cornerSize - 1, deckRect.y + deckRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3));
            RB.DrawEllipse(new Vector2i(deckRect.x + deckRect.width - cornerSize - 1, deckRect.y + deckRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2));

            RB.DrawRect(new Rect2i(deckRect.x + cornerSize, deckRect.y, deckRect.width - (cornerSize * 2), deckRect.height), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(deckRect.x + cornerSize, deckRect.y + 1, deckRect.width - (cornerSize * 2), deckRect.height - 2), DemoUtil.IndexToRGB(3));

            RB.DrawRect(new Rect2i(deckRect.x, deckRect.y + cornerSize, cornerSize, deckRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(deckRect.x + 1, deckRect.y + cornerSize, cornerSize - 1, deckRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(3));

            RB.DrawRect(new Rect2i(deckRect.x + deckRect.width - cornerSize, deckRect.y + cornerSize, cornerSize, deckRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(2));
            RB.DrawRectFill(new Rect2i(deckRect.x + deckRect.width - cornerSize - 1, deckRect.y + cornerSize, cornerSize, deckRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(3));

            DrawSpinner(0, 0, spinnerSize);
            DrawSpinner(120, 0, spinnerSize);

            mMusicPlayButton.Render();

            RB.CameraReset();
        }
예제 #16
0
        private void DrawTMX(int x, int y)
        {
            var demo = (DemoReel)RB.Game;

            Rect2i clipRect = new Rect2i(x, y, 340, 352);

            if (mMap != null)
            {
                RB.ClipSet(clipRect);
                RB.DrawRectFill(clipRect, DemoUtil.IndexToRGB(22));

                int scrollPos = -(int)RB.Ticks % (mMap.size.width * RB.SpriteSize().width);

                RB.CameraSet(new Vector2i(256, 144));
                RB.DrawMapLayer(1, new Vector2i(scrollPos, 0));
                RB.DrawMapLayer(1, new Vector2i(scrollPos + (mMap.size.width * RB.SpriteSize().width), 0));
                RB.DrawMapLayer(2);
                RB.DrawMapLayer(3);

                var objs = mMap.objectGroups["Objects"].objects;
                for (int i = 0; i < objs.Count; i++)
                {
                    var obj = objs[i];

                    switch (obj.shape)
                    {
                    case TMXObject.Shape.Rectangle:
                        RB.DrawRect(obj.rect, Color.red);
                        RB.Print(obj.rect, Color.red, RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, obj.properties.GetString("name"));
                        break;

                    case TMXObject.Shape.Polyline:
                        for (int j = 0; j < obj.points.Count - 1; j++)
                        {
                            RB.DrawLine(
                                obj.points[j] + new Vector2i(obj.rect.x, obj.rect.y),
                                obj.points[j + 1] + new Vector2i(obj.rect.x, obj.rect.y),
                                Color.green);
                        }

                        break;

                    case TMXObject.Shape.Ellipse:
                        RB.DrawEllipse(obj.rect.center, new Vector2i(obj.rect.width / 2, obj.rect.height / 2), Color.yellow);
                        RB.Print(obj.rect, Color.yellow, RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, obj.properties.GetString("name"));
                        break;
                    }
                }
            }
            else
            {
                RB.CameraReset();
                RB.ClipReset();
                RB.Print(new Vector2i(x + 4, y + 4), DemoUtil.IndexToRGB(14), "Failed to load TMX map.\nPlease try re-importing the map Demos/DemoReel/TilemapProps.tmx in Unity");
            }

            RB.CameraReset();
            RB.DrawRect(clipRect, DemoUtil.IndexToRGB(21));

            RB.ClipReset();

            x += 350;

            mFormatStr.Set("@C// Read shapes and their custom properties from TMX file\n");
            mFormatStr.Append("@NmyMap = @[email protected](@S\"Demos/DemoReel/TilemapProps\"@N);\n");
            mFormatStr.Append("\n");
            mFormatStr.Append("@Kvar@N objs = myMap.objectGroups[@S\"Objects\"@N].objects;\n");
            mFormatStr.Append("@Kfor@N (@Kint@N i = @L0@N; i < objs.Count; i++)\n");
            mFormatStr.Append("{\n");
            mFormatStr.Append("    @Kvar@N obj = obj;\n");
            mFormatStr.Append("\n");
            mFormatStr.Append("    @Kswitch@N (obj.shape)\n");
            mFormatStr.Append("    {\n");
            mFormatStr.Append("        @Kcase@N @[email protected]:\n");
            mFormatStr.Append("            @[email protected](obj.rect, @[email protected]);\n");
            mFormatStr.Append("            @[email protected](obj.rect, @[email protected],\n");
            mFormatStr.Append("               @[email protected]_H_CENTER | @[email protected]_V_CENTER,\n");
            mFormatStr.Append("               obj.properties.GetString(\"name\"));\n");
            mFormatStr.Append("            @Kbreak@N;\n");
            mFormatStr.Append("\n");
            mFormatStr.Append("        @Kcase@N @[email protected]:\n");
            mFormatStr.Append("            @Kfor@N (@Kint@N j = @L0@N; j < obj.points.Count - @L1@N; j++)\n");
            mFormatStr.Append("            {\n");
            mFormatStr.Append("                @[email protected](\n");
            mFormatStr.Append("                   obj.points[j] + @Knew@N @MVector2i@N(obj.rect.x, obj.rect.y),\n");
            mFormatStr.Append("                   obj.points[j + @L1@N] + @Knew@N @MVector2i@N(obj.rect.x, obj.rect.y),\n");
            mFormatStr.Append("                   @[email protected]);\n");
            mFormatStr.Append("            }\n");
            mFormatStr.Append("            @Kbreak@N;\n");
            mFormatStr.Append("\n");
            mFormatStr.Append("        @Kcase@N @[email protected]:\n");
            mFormatStr.Append("            @[email protected](obj.rect.center,\n");
            mFormatStr.Append("               new @MVector2i@N(obj.rect.width / @L2@N, obj.rect.height / @L2@N),\n");
            mFormatStr.Append("               @[email protected]);\n");
            mFormatStr.Append("            @[email protected](obj.rect, @[email protected],\n");
            mFormatStr.Append("               @[email protected]_H_CENTER | RB.ALIGN_V_CENTER,\n");
            mFormatStr.Append("               obj.properties.GetString(@S\"name\"@N));\n");
            mFormatStr.Append("            @Kbreak@N;\n");
            mFormatStr.Append("    }\n");
            mFormatStr.Append("}\n");
            mFormatStr.Append("\n");
            mFormatStr.Append("@C// Also easily read tile custom properties\n");
            mFormatStr.Append("@Kvar@N props = @[email protected]<@MTMXProperties@N>(@L0@N, @Knew@N @MVector2i@N(@L2@N, @L5@N));\n");
            mFormatStr.Append("@Kint@N blocking = tileProps.GetInt(@S\"blocking\"@N);");

            RB.Print(new Vector2i(x, y), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr));
        }