コード例 #1
0
ファイル: ScenePixelStress.cs プロジェクト: svwilke/Spellzee
        /// <summary>
        /// Run the stress test
        /// </summary>
        protected override void StressTest()
        {
            for (int i = 0; i < mStressLevel; i++)
            {
                var randPos = mRandomPos[i];
                randPos += GetWiggle();

                RB.DrawPixel(randPos, mRandomColor[i]);
            }
        }
コード例 #2
0
        /// <summary>
        /// Render the effect
        /// </summary>
        public override void Render()
        {
            var globalAlpha = mFramesRemaining <= FADE_FRAMES ? (mFramesRemaining / (float)FADE_FRAMES) : 1.0f;

            RB.AlphaSet((byte)(globalAlpha * 255));
            RB.TintColorSet(Color.white);

            for (int i = 0; i < mParticles.Count; i++)
            {
                RB.DrawPixel(mParticles[i].pos, mParticles[i].color);
            }

            RB.AlphaSet(255);
        }
コード例 #3
0
ファイル: BattleScreen.cs プロジェクト: svwilke/Spellzee
    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);
        }
    }
コード例 #4
0
        private void DrawPixels(int x, int y)
        {
            var demo = (DemoReel)RB.Game;

            RB.CameraSet(new Vector2i(-x, -y - 41));
            DemoUtil.DrawOutputFrame(new Rect2i(0, 0, 256, 12), -1, mOutputFrame, mOutputBackground);

            for (int i = 0; i < 32; i++)
            {
                RB.DrawPixel(new Vector2i((int)(Mathf.Sin((RB.Ticks / 100.0f) + (i / 10.0f)) * 128) + 128, (int)(Mathf.Sin((RB.Ticks / 10.0f) + (i / 2.0f)) * 6) + 6), DemoUtil.IndexToRGB(i));
            }

            RB.CameraReset();

            mFormatStr.Set("@C// Draw individual pixels\n");
            mFormatStr.Append("@Kfor @N(@Kint @Ni = @L0@N; i < @L32@N; i++) {\n");
            mFormatStr.Append("    @[email protected](@Knew @MVector2i@N(@[email protected](@L").Append(RB.Ticks / 100.0f, 2).Append("f@N + i / @L10.0f@N) * @L128@N + @L128@N,\n");
            mFormatStr.Append("         @[email protected](@L").Append(RB.Ticks / 10.0f, 2).Append("f@N + i / @L2.0f@N) * @L6@N + @L6@N), MyRGBColor(i));\n}");

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