Пример #1
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            if (!MainGame.Inst.Profile.GetLevelData(Levels.LEVEL_TUTORIAL.UniqueID).HasAnyCompleted())
            {
                var iconBounds = FRectangle.CreateByCenter(Position, new FSize(ICONSIZE + ICONSIZESWIGGLE * FloatMath.Sin(Lifetime), ICONSIZE + ICONSIZESWIGGLE * FloatMath.Sin(Lifetime)));

                FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
                SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

                sbatch.FillRectangle(innerBounds, FlatColors.Background);

                sbatch.DrawStretched(Textures.TexIconTutorial, iconBounds, Color.White * AlphaOverride);

                FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
            }
            else
            {
                var iconBounds = FRectangle.CreateByCenter(Position, new FSize(ICONSIZE, ICONSIZE));

                FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
                SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

                sbatch.FillRectangle(innerBounds, FlatColors.Background);

                sbatch.DrawStretched(Textures.TexIconTutorial, iconBounds, FlatColors.Emerald * AlphaOverride);

                FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
            }
        }
Пример #2
0
        private void DrawSimple(IBatchRenderer sbatch)
        {
            int offX = TILE_WIDTH * (int)(Owner.MapOffsetX / TILE_WIDTH);
            int offY = TILE_WIDTH * (int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
            int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

            int countX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedWidth / TILE_WIDTH);
            int countY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedHeight / TILE_WIDTH);

            sbatch.DrawStretched(
                Textures.TexPixel,
                new FRectangle(
                    -extensionX * TILE_WIDTH - offX,
                    -extensionY * TILE_WIDTH - offY,
                    (countX + 2 * extensionX) * TILE_WIDTH,
                    (countY + 2 * extensionY) * TILE_WIDTH),
                FlatColors.Background);

            if (GridLineAlpha >= 1)
            {
                for (int x = -extensionX; x < countX + extensionX; x++)
                {
                    for (int y = -extensionY; y < countY + extensionY; y++)
                    {
                        sbatch.DrawStretched(Textures.TexTileBorder, new FRectangle(x * TILE_WIDTH - offX, y * TILE_WIDTH - offY, TILE_WIDTH, TILE_WIDTH), Color.White * GridLineAlpha);
                    }
                }
            }
        }
Пример #3
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            switch (_mode)
            {
            case 0:
                sbatch.DrawStretched(Textures.TexHUDIconTouchUp, bounds, Color.White * _progress);
                break;

            case 1:
                sbatch.DrawStretched(Textures.TexHUDIconTouchUp, bounds, Color.White);
                break;

            case 2:
                sbatch.DrawStretched(Textures.TexHUDIconTouchDown, bounds, Color.White);
                break;

            case 3:
                sbatch.DrawStretched(Textures.TexHUDIconTouchUp, bounds, Color.White);
                break;

            case 4:
                sbatch.DrawStretched(Textures.TexHUDIconTouchUp, bounds, Color.White * (1 - _progress));
                break;

            case 5:
                //
                break;

            default:
                SAMLog.Error("HTA::EnumSwitch_DD", "value: " + _mode);
                break;
            }
        }
Пример #4
0
        public override void DrawOverlay(IBatchRenderer sbatch)
        {
            int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
            int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

            if (_wrapMode == GameWrapMode.Donut || _wrapMode == GameWrapMode.Reflect)
            {
                var fextx = extensionX * TILE_WIDTH;
                var fexty = extensionY * TILE_WIDTH;

                var rn = new FRectangle(-fextx, -fexty, Owner.MapFullBounds.Width + 2 * fextx, fexty);
                var re = new FRectangle(Owner.MapFullBounds.Width, -fexty, fextx, Owner.MapFullBounds.Height + 2 * fexty);
                var rs = new FRectangle(-fextx, Owner.MapFullBounds.Height, Owner.MapFullBounds.Width + 2 * fextx, fexty);
                var rw = new FRectangle(-fextx, -fexty, fextx, Owner.MapFullBounds.Height + 2 * fexty);

                sbatch.DrawStretched(Textures.TexPixel, rn, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, re, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, rs, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, rw, FlatColors.Clouds);

                FlatRenderHelper.DrawForegroundDropShadow(sbatch, Owner.MapFullBounds, GDConstants.TILE_WIDTH / 2f, GDConstants.TILE_WIDTH / 2f);

                sbatch.DrawRectangle(Owner.MapFullBounds, Color.White, 3f);
            }
        }
Пример #5
0
        public static void DrawVoidWall_FG(IBatchRenderer sbatch, float len, float rotation, FRectangle[] rects)
        {
            var renderPartCount = FloatMath.Round(len / GDConstants.TILE_WIDTH);

            if (renderPartCount <= 1)
            {
                sbatch.DrawStretched(Textures.TexVoidWall_FG_L1, rects[0], Color.White, rotation);
            }
            else if (renderPartCount == 2)
            {
                sbatch.DrawStretched(Textures.TexVoidWall_FG_L2, rects[0], Color.White, rotation);
            }
            else
            {
                for (int i = 0; i < renderPartCount; i++)
                {
                    if (i == 0)
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_FG_End, rects[i], Color.White, rotation + FloatMath.RAD_POS_180);
                    }
                    else if (i + 1 < renderPartCount)
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_FG_Middle, rects[i], Color.White, rotation);
                    }
                    else
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_FG_End, rects[i], Color.White, rotation);
                    }
                }
            }
        }
Пример #6
0
 protected override void OnDrawOrderedForegroundLayer(IBatchRenderer sbatch)
 {
     if (_renderPartCount <= 1)
     {
         sbatch.DrawStretched(Textures.TexVoidWall_FG_L1, _rectsUnrotated[0], Color.White, _rotation);
     }
     else if (_renderPartCount == 2)
     {
         sbatch.DrawStretched(Textures.TexVoidWall_FG_L2, _rectsUnrotated[0], Color.White, _rotation);
     }
     else
     {
         for (int i = 0; i < _renderPartCount; i++)
         {
             if (i == 0)
             {
                 sbatch.DrawStretched(Textures.TexVoidWall_FG_End, _rectsUnrotated[i], Color.White, _rotation + FloatMath.RAD_POS_180);
             }
             else if (i + 1 < _renderPartCount)
             {
                 sbatch.DrawStretched(Textures.TexVoidWall_FG_Middle, _rectsUnrotated[i], Color.White, _rotation);
             }
             else
             {
                 sbatch.DrawStretched(Textures.TexVoidWall_FG_End, _rectsUnrotated[i], Color.White, _rotation);
             }
         }
     }
 }
Пример #7
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            if (IsPointerDownOnElement)
            {
                sbatch.DrawStretched(Textures.TexCircle, bounds, BackgroundColor.Darken());
            }
            else
            {
                sbatch.DrawStretched(Textures.TexCircle, bounds, BackgroundColor);
            }

            sbatch.DrawStretched(icon, bounds.AsDeflated(24, 24).AsScaled(IconScale), ForegroundColor);
        }
Пример #8
0
        private void DrawColoredNormal(IBatchRenderer sbatch)
        {
            sbatch.FillRectangle(VAdapter.VirtualTotalBoundingBox, FlatColors.Background);

            int offX = (int)(Owner.MapOffsetX / TILE_WIDTH);
            int offY = (int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
            int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

            int countX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedWidth / TILE_WIDTH);
            int countY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedHeight / TILE_WIDTH);

            for (int x = -extensionX; x < countX + extensionX; x++)
            {
                for (int y = -extensionY; y < countY + extensionY; y++)
                {
                    var color = FlatColors.Background;

                    var rx = x - offX;
                    var ry = y - offY;

                    float perc;
                    if (_tileValues.TryGetValue(100000 * rx + ry, out perc))
                    {
                        color = ColorMath.Blend(FlatColors.Background, FlatColors.BackgroundGreen, (((int)(perc * GRADIENT_RESOLUTION) * 1f) / GRADIENT_RESOLUTION) * BackgroundPercentageOverride);
                    }

                    sbatch.DrawStretched(
                        Textures.TexPixel,
                        new FRectangle(
                            rx * GDConstants.TILE_WIDTH,
                            ry * GDConstants.TILE_WIDTH,
                            GDConstants.TILE_WIDTH,
                            GDConstants.TILE_WIDTH),
                        color);

                    if (GridLineAlpha > 0)
                    {
                        sbatch.DrawStretched(
                            Textures.TexTileBorder,
                            new FRectangle(
                                rx * GDConstants.TILE_WIDTH,
                                ry * GDConstants.TILE_WIDTH,
                                GDConstants.TILE_WIDTH,
                                GDConstants.TILE_WIDTH),
                            Color.White * GridLineAlpha);
                    }
                }
            }
        }
Пример #9
0
        public override void Draw(IBatchRenderer sbatch)
        {
            int offX = TILE_WIDTH * (int)(Owner.MapOffsetX / TILE_WIDTH);
            int offY = TILE_WIDTH * (int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
            int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

            int countX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedWidth / TILE_WIDTH);
            int countY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedHeight / TILE_WIDTH);

            if (MainGame.Inst.Profile.EffectsEnabled)
            {
                for (int x = -(extensionX + 1); x < countX + extensionX; x++)
                {
                    for (int y = -(extensionY + 1); y < countY + extensionY; y++)
                    {
                        int cx = ARRAY_EXTEND + x;
                        int cy = ARRAY_EXTEND + y;

                        var color = FlatColors.Background;

                        if (cx >= 0 && cy >= 0 && cx < CELL_W && cy < CELL_H)
                        {
                            var c = _cells[cx, cy];
                            if (c.Power > 0)
                            {
                                color = ColorMath.Blend(FlatColors.Background, FlatColors.BackgroundGreen, FloatMath.FunctionEaseInOutCubic(c.Power));
                            }
                        }

                        sbatch.DrawStretched(Textures.TexPixel, new FRectangle(x * GDConstants.TILE_WIDTH - offX, y * GDConstants.TILE_WIDTH - offY, GDConstants.TILE_WIDTH, GDConstants.TILE_WIDTH), color);
                        sbatch.DrawStretched(Textures.TexTileBorder, new FRectangle(x * GDConstants.TILE_WIDTH - offX, y * GDConstants.TILE_WIDTH - offY, GDConstants.TILE_WIDTH, GDConstants.TILE_WIDTH), Color.White);
                    }
                }
            }
            else
            {
                var r = new FRectangle(-extensionX * TILE_WIDTH - offX, -extensionY * TILE_WIDTH - offY, (countX + 2 * extensionX) * TILE_WIDTH, (countY + 2 * extensionY) * TILE_WIDTH);

                sbatch.DrawStretched(Textures.TexPixel, r, FlatColors.Background);

                for (int x = -extensionX; x < countX + extensionX; x++)
                {
                    for (int y = -extensionY; y < countY + extensionY; y++)
                    {
                        sbatch.DrawStretched(Textures.TexTileBorder, new FRectangle(x * TILE_WIDTH - offX, y * TILE_WIDTH - offY, TILE_WIDTH, TILE_WIDTH), Color.White);
                    }
                }
            }
        }
Пример #10
0
        public static void DrawRoundedRectOutline(IBatchRenderer sbatch, FRectangle bounds, Color color, bool tl, bool tr, bool bl, bool br, int sides = 8, float lineWidth = 1f, float cornerSize = 16f)
        {
            StaticTextures.ThrowIfNotInitialized();

            // LEFT
            sbatch.DrawStretched(
                StaticTextures.SinglePixel,
                new FRectangle(bounds.Left, bounds.Top + (tl ? cornerSize : 0), lineWidth, bounds.Height - (tl ? cornerSize : 0) - (bl ? cornerSize : 0)),
                color);

            // TOP
            sbatch.DrawStretched(
                StaticTextures.SinglePixel,
                new FRectangle(bounds.Left + (tl ? cornerSize : 0), bounds.Top, bounds.Width - (tl ? cornerSize : 0) - (tr ? cornerSize : 0), lineWidth),
                color);

            // RIGHT
            sbatch.DrawStretched(
                StaticTextures.SinglePixel,
                new FRectangle(bounds.Right - lineWidth, bounds.Top + (tr ? cornerSize : 0), lineWidth, bounds.Height - (tr ? cornerSize : 0) - (br ? cornerSize : 0)),
                color);

            // BOTTOM
            sbatch.DrawStretched(
                StaticTextures.SinglePixel,
                new FRectangle(bounds.Left + (bl ? cornerSize : 0), bounds.Bottom - lineWidth, bounds.Width - (bl ? cornerSize : 0) - (br ? cornerSize : 0), lineWidth),
                color);

            if (br)
            {
                sbatch.DrawCirclePiece(new FPoint(bounds.Right - cornerSize, bounds.Bottom - cornerSize), cornerSize, FloatMath.RAD_POS_000, FloatMath.RAD_POS_090, sides, color, lineWidth);
            }

            if (bl)
            {
                sbatch.DrawCirclePiece(new FPoint(bounds.Left + cornerSize, bounds.Bottom - cornerSize), cornerSize, FloatMath.RAD_POS_090, FloatMath.RAD_POS_180, sides, color, lineWidth);
            }

            if (tl)
            {
                sbatch.DrawCirclePiece(new FPoint(bounds.Left + cornerSize, bounds.Top + cornerSize), cornerSize, FloatMath.RAD_POS_180, FloatMath.RAD_POS_270, sides, color, lineWidth);
            }

            if (tr)
            {
                sbatch.DrawCirclePiece(new FPoint(bounds.Right - cornerSize, bounds.Top + cornerSize), cornerSize, FloatMath.RAD_POS_270, FloatMath.RAD_POS_360, sides, color, lineWidth);
            }
        }
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var back = Selected ? FlatColors.BackgroundHUD2 : FlatColors.ButtonHUD;
            var fore = Active ? FlatColors.SunFlower : FlatColors.BackgroundHUD;

            if (IsPointerDownOnElement)
            {
                sbatch.DrawStretched(Textures.TexCircle, bounds, back.Darken());
            }
            else
            {
                sbatch.DrawStretched(Textures.TexCircle, bounds, back);
            }

            sbatch.DrawStretched(icon, bounds.AsDeflated(24, 24).AsScaled(IconScale), fore);
        }
Пример #12
0
        public static void DrawSimpleRect(IBatchRenderer sbatch, FRectangle bounds, Color color)
        {
            StaticTextures.ThrowIfNotInitialized();

            sbatch.DrawStretched(
                StaticTextures.SinglePixel,
                bounds,
                color);
        }
Пример #13
0
        public override void Draw(IBatchRenderer sbatch)
        {
            var gridArea = FRectangle.CreateByTopLeft(
                0,
                0,
                GDOwner.LevelData.Width * TILE_WIDTH,
                GDOwner.LevelData.Height * TILE_WIDTH);

            sbatch.DrawStretched(Textures.TexPixel, GDOwner.CompleteMapViewport, FlatColors.MidnightBlue);

            sbatch.DrawStretched(Textures.TexPixel, gridArea, FlatColors.Background);

            for (int x = 0; x < GDOwner.LevelData.Width + 1; x++)
            {
                sbatch.DrawCentered(Textures.TexPixel, new FPoint(gridArea.X + x * TILE_WIDTH, gridArea.CenterY), 2 * Owner.PixelWidth, gridArea.Height, FlatColors.BackgroundHighlight);
            }
            for (int y = 0; y < GDOwner.LevelData.Height + 1; y++)
            {
                sbatch.DrawCentered(Textures.TexPixel, new FPoint(gridArea.CenterX, gridArea.Y + y * TILE_WIDTH), gridArea.Width, 2 * Owner.PixelWidth, FlatColors.BackgroundHighlight);
            }
        }
Пример #14
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            if (_renderPartCount <= 1)
            {
                sbatch.DrawStretched(Textures.TexVoidWall_BG_L1, _rectsUnrotated[0], Color.White, _rotation);
            }
            else if (_renderPartCount == 2)
            {
                sbatch.DrawStretched(Textures.TexVoidWall_BG_L2, _rectsUnrotated[0], Color.White, _rotation);
            }
            else
            {
                for (int i = 0; i < _renderPartCount; i++)
                {
                    if (i == 0)
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_BG_End, _rectsUnrotated[i], Color.White, _rotation + FloatMath.RAD_POS_180);
                    }
                    else if (i + 1 < _renderPartCount)
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_BG_Middle, _rectsUnrotated[i], Color.White, _rotation);
                    }
                    else
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_BG_End, _rectsUnrotated[i], Color.White, _rotation);
                    }
                }
            }

#if DEBUG
            if (DebugSettings.Get("DebugEntityBoundaries"))
            {
                foreach (var r in _rectsUnrotated)
                {
                    sbatch.DrawRectangleRot(r, Color.Cyan, _rotation);
                }
            }
#endif
        }
Пример #15
0
        public override void DrawOverlay(IBatchRenderer sbatch)
        {
            if (wrapMode == GameWrapMode.Donut || wrapMode == GameWrapMode.Reflect)
            {
                int real_extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
                int real_extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

                var fextx = real_extensionX * TILE_WIDTH;
                var fexty = real_extensionY * TILE_WIDTH;

                var rn = new FRectangle(-fextx, -fexty, Owner.MapFullBounds.Width + 2 * fextx, fexty);
                var re = new FRectangle(Owner.MapFullBounds.Width, -fexty, fextx, Owner.MapFullBounds.Height + 2 * fexty);
                var rs = new FRectangle(-fextx, Owner.MapFullBounds.Height, Owner.MapFullBounds.Width + 2 * fextx, fexty);
                var rw = new FRectangle(-fextx, -fexty, fextx, Owner.MapFullBounds.Height + 2 * fexty);

                sbatch.DrawStretched(Textures.TexPixel, rn, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, re, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, rs, FlatColors.Clouds);
                sbatch.DrawStretched(Textures.TexPixel, rw, FlatColors.Clouds);

                FlatRenderHelper.DrawForegroundDropShadow(sbatch, Owner.MapFullBounds, GDConstants.TILE_WIDTH / 2f, GDConstants.TILE_WIDTH / 2f);

                for (int ox = 0; ox < Owner.MapFullBounds.Width / TILE_WIDTH; ox++)
                {
                    var px = ox * TILE_WIDTH + TILE_WIDTH / 2f;

                    sbatch.DrawCentered(Textures.TexDotLine, new FPoint(px, 0), 3f, TILE_WIDTH, Color.White, FloatMath.RAD_POS_090);
                    sbatch.DrawCentered(Textures.TexDotLine, new FPoint(px, Owner.MapFullBounds.Height), 3f, TILE_WIDTH, Color.White, FloatMath.RAD_POS_090);
                }
                for (int oy = 0; oy < Owner.MapFullBounds.Height / TILE_WIDTH; oy++)
                {
                    var py = oy * TILE_WIDTH + TILE_WIDTH / 2f;

                    sbatch.DrawCentered(Textures.TexDotLine, new FPoint(0, py), 3f, TILE_WIDTH, Color.White, FloatMath.RAD_POS_000);
                    sbatch.DrawCentered(Textures.TexDotLine, new FPoint(Owner.MapFullBounds.Width, py), 3f, TILE_WIDTH, Color.White, FloatMath.RAD_POS_000);
                }
            }
        }
Пример #16
0
        public override void Draw(IBatchRenderer sbatch)
        {
            int offX = TILE_WIDTH * (int)(Owner.MapOffsetX / TILE_WIDTH);
            int offY = TILE_WIDTH * (int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
            int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

            int countX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedWidth / TILE_WIDTH);
            int countY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedHeight / TILE_WIDTH);

            var r = new FRectangle(-extensionX * TILE_WIDTH - offX, -extensionY * TILE_WIDTH - offY, (countX + 2 * extensionX) * TILE_WIDTH, (countY + 2 * extensionY) * TILE_WIDTH);

            sbatch.DrawStretched(Textures.TexPixel, r, FlatColors.Background);
        }
Пример #17
0
        public static void DrawPortal(IBatchRenderer sbatch, FRectangle[] renderRects, Color color, float normal)
        {
            sbatch.DrawStretched(Textures.TexPortalDropEnd1, renderRects[3], Color.White, normal);
            sbatch.DrawStretched(Textures.TexPortalDropMid, renderRects[4], Color.White, normal);
            sbatch.DrawStretched(Textures.TexPortalDropEnd2, renderRects[5], Color.White, normal);

            sbatch.DrawStretched(Textures.TexGradient, renderRects[2], color, normal - FloatMath.RAD_POS_090);
            sbatch.DrawStretched(Textures.TexPixel, renderRects[0], FlatColors.Clouds, normal - FloatMath.RAD_POS_090);
            sbatch.DrawStretched(Textures.TexPixel, renderRects[1], color, normal - FloatMath.RAD_POS_090);
        }
Пример #18
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            FlatRenderHelper.DrawRoundedBlurPanel(sbatch, outerBounds, clickArea.IsMouseDown() ? FlatColors.ButtonPressedHUD : FlatColors.Asbestos, 0.5f * GDConstants.TILE_WIDTH);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, outerBounds.AsInflated(1f, 1f), FlatColors.MidnightBlue, 8, 2f, 0.5f * GDConstants.TILE_WIDTH);

            sbatch.FillRectangle(innerBounds, FlatColors.Background);

            var scoreRectSize = innerBounds.Width / 8f;

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    var bc = ((x % 2 == 0) ^ (y % 2 == 0)) ? FlatColors.Background : FlatColors.BackgroundLight;

                    if (_ustate == WorldUnlockState.OpenAndUnlocked)
                    {
                        var d = FloatMath.Sqrt((x - 3.5f) * (x - 3.5f) + (y - 3.5f) * (y - 3.5f));

                        var p = 1 - (d / 4.5f);
                        if (p < 0)
                        {
                            p = 0;
                        }

                        p *= FloatMath.PercSin(_pulseTimer * FloatMath.TAU * 0.25f);

                        bc = ColorMath.Blend(bc, FlatColors.PeterRiver, p);
                    }

                    var col = ColorMath.Blend(FlatColors.Background, bc, AlphaOverride);
                    sbatch.FillRectangle(new FRectangle(innerBounds.X + scoreRectSize * x, innerBounds.Y + scoreRectSize * y, scoreRectSize, scoreRectSize), col);
                }
            }

            sbatch.DrawStretched(Textures.TexIconNetworkBase, innerBounds, Color.White);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex1, innerBounds, Color.White, VertexRotations[0]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex2, innerBounds, Color.White, VertexRotations[1]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex3, innerBounds, Color.White, VertexRotations[2]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex4, innerBounds, Color.White, VertexRotations[3]);
            sbatch.DrawStretched(Textures.TexIconNetworkVertex5, innerBounds, Color.White, VertexRotations[4]);

            sbatch.DrawRectangle(innerBounds, Color.Black, Owner.PixelWidth);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
Пример #19
0
        public static void DrawAligned9Patch(IBatchRenderer sbatch, FRectangle bounds, Color colEdge, Color colCorner, Color colFill, TextureRegion2D texEdge, TextureRegion2D texCorner, TextureRegion2D texFill, float cornerSize)
        {
            var r_tl = new FRectangle(bounds.Left - cornerSize, bounds.Top - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_tr = new FRectangle(bounds.Right - cornerSize, bounds.Top - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_br = new FRectangle(bounds.Right - cornerSize, bounds.Bottom - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_bl = new FRectangle(bounds.Left - cornerSize, bounds.Bottom - cornerSize, 2 * cornerSize, 2 * cornerSize);

            var r_l = new FRectangle(r_tl.Left, r_tl.Bottom, r_tl.Width, r_bl.Top - r_tl.Bottom);
            var r_t = new FRectangle(r_tl.Right, r_tl.Top, r_tr.Left - r_tl.Right, r_tl.Height);
            var r_r = new FRectangle(r_tr.Left, r_tr.Bottom, r_tr.Width, r_br.Top - r_tr.Bottom);
            var r_b = new FRectangle(r_bl.Right, r_bl.Top, r_br.Left - r_bl.Right, r_bl.Height);

            var r_c = new FRectangle(bounds.Left + cornerSize, bounds.Top + cornerSize, bounds.Width - 2 * cornerSize, bounds.Height - 2 * cornerSize);

            // Top
            sbatch.DrawRot000(texEdge, r_t, colEdge, 0);

            // Right
            sbatch.DrawRot090(texEdge, r_r, colEdge, 0);

            // Bottom
            sbatch.DrawRot180(texEdge, r_b, colEdge, 0);

            // Left
            sbatch.DrawRot270(texEdge, r_l, colEdge, 0);

            // TL
            sbatch.DrawRot000(texCorner, r_tl, colCorner, 0);

            // TR
            sbatch.DrawRot090(texCorner, r_tr, colCorner, 0);

            // BR
            sbatch.DrawRot180(texCorner, r_br, colCorner, 0);

            // BL
            sbatch.DrawRot270(texCorner, r_bl, colCorner, 0);

            // Center
            sbatch.DrawStretched(texFill, r_c, colFill, 0);
        }
Пример #20
0
        public override void Draw(IBatchRenderer sbatch)
        {
            int offX = TILE_WIDTH * (int)(Owner.MapOffsetX / TILE_WIDTH);
            int offY = TILE_WIDTH * (int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
            int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

            int countX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedWidth / TILE_WIDTH);
            int countY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedHeight / TILE_WIDTH);

            var r = new FRectangle(-extensionX * TILE_WIDTH - offX, -extensionY * TILE_WIDTH - offY, (countX + 2 * extensionX) * TILE_WIDTH, (countY + 2 * extensionY) * TILE_WIDTH);

            sbatch.DrawStretched(Textures.TexPixel, r, FlatColors.Background);


            if (_animationTime < ANIMATION_DURATION + 0.5f)
            {
                foreach (var e in _elements)
                {
                    if (_animationTime < e.StartTime)
                    {
                        continue;
                    }

                    sbatch.DrawCentered(Textures.TexPixel, e.Center, (_animationTime - e.StartTime) * e.Speed, 2, FlatColors.BackgroundHighlight, e.Rotation);
                }
            }
            else
            {
                for (int x = -extensionX; x < countX + extensionX; x++)
                {
                    sbatch.DrawCentered(Textures.TexPixel, new FPoint(x * TILE_WIDTH, r.CenterY), 2, r.Height, FlatColors.BackgroundHighlight);
                }

                for (int y = -extensionY; y < countY + extensionY; y++)
                {
                    sbatch.DrawCentered(Textures.TexPixel, new FPoint(r.CenterX, y * TILE_WIDTH), r.Width, 2, FlatColors.BackgroundHighlight);
                }
            }
        }
Пример #21
0
        public override void Draw(IBatchRenderer sbatch, FPoint offset, float scale, float time)
        {
            FRectangle stateBounds;
            Color      stateColor;
            float      stateRotation;

            GetState(time, out stateBounds, out stateColor, out stateRotation);

            stateBounds = stateBounds.AsScaledAndTranslated(scale, offset);

            if (stateBounds.IsEmpty)
            {
                return;
            }
            if (stateColor.A == 0)
            {
                return;
            }

            sbatch.DrawStretched(_texture, stateBounds, stateColor, stateRotation);
        }
Пример #22
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            sbatch.DrawStretched(Textures.TexPortalDropEnd1, _rectDropTop, Color.White, Normal);
            sbatch.DrawStretched(Textures.TexPortalDropMid, _rectDropMid, Color.White, Normal);
            sbatch.DrawStretched(Textures.TexPortalDropEnd2, _rectDropBot, Color.White, Normal);

            sbatch.DrawStretched(Textures.TexGradient, _rectGradient, Color, Normal - FloatMath.RAD_POS_090);
            sbatch.DrawStretched(Textures.TexPixel, _rectFull, FlatColors.Clouds, Normal - FloatMath.RAD_POS_090);
            sbatch.DrawStretched(Textures.TexPixel, _rectHorizon, Color, Normal - FloatMath.RAD_POS_090);

#if DEBUG
            if (DebugSettings.Get("DebugEntityBoundaries"))
            {
                sbatch.FillCircle(Position, 4, 16, Color.Turquoise);
                sbatch.DrawLine(Position, Position + Vector2.UnitX.RotateWithLength(Normal, 32), Color.Turquoise, 2);
            }
#endif
        }
Пример #23
0
        public override void Draw(IBatchRenderer sbatch)
        {
            int ioffX = -(int)(Owner.MapOffsetX / TILE_WIDTH);
            int ioffY = -(int)(Owner.MapOffsetY / TILE_WIDTH);

            int extensionX = MathHelper.Min(MAX_EXTENSION_X, FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH));
            int extensionY = MathHelper.Min(MAX_EXTENSION_Y, FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH));

            int countX = FloatMath.Ceiling(VAdapter.VirtualTotalWidth / TILE_WIDTH) + 1;
            int countY = FloatMath.Ceiling(VAdapter.VirtualTotalHeight / TILE_WIDTH) + 1;

            for (int ox = ioffX - extensionX; ox < ioffX + countX + extensionX; ox++)
            {
                for (int oy = ioffY - extensionY; oy < ioffY + countY + extensionY; oy++)
                {
                    var x = ox + MAX_EXTENSION_X;                     // real coords -> array coords
                    var y = oy + MAX_EXTENSION_Y;

                    if (x < 0)
                    {
                        continue;
                    }
                    if (y < 0)
                    {
                        continue;
                    }
                    if (x >= tileCountX)
                    {
                        continue;
                    }
                    if (y >= tileCountY)
                    {
                        continue;
                    }

                    var color = GetGridColor(x, y);

                    var rect = new FRectangle(ox * TILE_WIDTH, oy * TILE_WIDTH, TILE_WIDTH, TILE_WIDTH);

                    sbatch.DrawStretched(Textures.TexPixel, rect, color);
                    sbatch.DrawStretched(Textures.TexTileBorder, rect, Color.White);

#if DEBUG
                    if (DebugSettings.Get("DebugBackground"))
                    {
                        var tx = rect.X + 8;
                        var ty = rect.Y + 8;

                        sbatch.DrawString(
                            Textures.DebugFontSmall,
                            string.Format("({4}|{5})\n{0,2}: {1:000}\n[{2}]{3}", _grid[x, y].Fraction?.ToString() ?? "##", _grid[x, y].PowerCurr * 100, _grid[x, y].SourceDistance, _grid[x, y].IsNeutralDraining ? "D" : "", ox, oy),
                            new FPoint(tx, ty),
                            _grid[x, y].Fraction?.Color ?? Color.Black);

                        if (_grid[x, y].SpawnSource != null)
                        {
                            SimpleRenderHelper.DrawCross(sbatch, rect, _grid[x, y].SpawnSource.Fraction.Color * 0.5f, 2);
                        }

                        var v4tl = new Vector2(+5, +5);
                        var v4tr = new Vector2(-5, +5);
                        var v4br = new Vector2(-5, -5);
                        var v4bl = new Vector2(+5, -5);

                        if (_grid[x, y].BlockNorth)
                        {
                            sbatch.DrawLine(rect.TopLeft + v4tl, rect.TopRight + v4tr, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockEast)
                        {
                            sbatch.DrawLine(rect.TopRight + v4tr, rect.BottomRight + v4br, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockSouth)
                        {
                            sbatch.DrawLine(rect.BottomRight + v4br, rect.BottomLeft + v4bl, Color.Yellow * 0.6f, 4);
                        }

                        if (_grid[x, y].BlockWest)
                        {
                            sbatch.DrawLine(rect.BottomLeft + v4bl, rect.TopLeft + v4tl, Color.Yellow * 0.6f, 4);
                        }
                    }
#endif
                }
            }
        }
Пример #24
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     sbatch.DrawStretched(Textures.TexVoidCircle_BG, _renderRect, Color.White);
 }
Пример #25
0
        public static void Draw9Patch(IBatchRenderer sbatch, FRectangle bounds, Color colEdge, Color colCorner, Color colFill, TextureRegion2D texEdge, TextureRegion2D texCorner, TextureRegion2D texFill, float cornerSize, float rotation)
        {
            rotation = FloatMath.NormalizeAngle(rotation);

            if (FloatMath.EpsilonEquals(rotation, FloatMath.RAD_POS_000))
            {
                DrawAligned9Patch(sbatch, bounds.AsRotated(PerpendicularRotation.DEGREE_CW_000), colEdge, colCorner, colFill, texEdge, texCorner, texFill, cornerSize); return;
            }
            if (FloatMath.EpsilonEquals(rotation, FloatMath.RAD_POS_090))
            {
                DrawAligned9Patch(sbatch, bounds.AsRotated(PerpendicularRotation.DEGREE_CW_090), colEdge, colCorner, colFill, texEdge, texCorner, texFill, cornerSize); return;
            }
            if (FloatMath.EpsilonEquals(rotation, FloatMath.RAD_POS_180))
            {
                DrawAligned9Patch(sbatch, bounds.AsRotated(PerpendicularRotation.DEGREE_CW_180), colEdge, colCorner, colFill, texEdge, texCorner, texFill, cornerSize); return;
            }
            if (FloatMath.EpsilonEquals(rotation, FloatMath.RAD_POS_270))
            {
                DrawAligned9Patch(sbatch, bounds.AsRotated(PerpendicularRotation.DEGREE_CW_270), colEdge, colCorner, colFill, texEdge, texCorner, texFill, cornerSize); return;
            }
            if (FloatMath.EpsilonEquals(rotation, FloatMath.RAD_POS_360))
            {
                DrawAligned9Patch(sbatch, bounds.AsRotated(PerpendicularRotation.DEGREE_CW_360), colEdge, colCorner, colFill, texEdge, texCorner, texFill, cornerSize); return;
            }

            var ctr = bounds.Center;

            var r_tl = new FRectangle(bounds.Left - cornerSize, bounds.Top - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_tr = new FRectangle(bounds.Right - cornerSize, bounds.Top - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_br = new FRectangle(bounds.Right - cornerSize, bounds.Bottom - cornerSize, 2 * cornerSize, 2 * cornerSize);
            var r_bl = new FRectangle(bounds.Left - cornerSize, bounds.Bottom - cornerSize, 2 * cornerSize, 2 * cornerSize);

            var r_t = new FRectangle(bounds.Left + cornerSize, bounds.Top - cornerSize, bounds.Width - 2 * cornerSize, 2 * cornerSize);
            var r_b = new FRectangle(bounds.Left + cornerSize, bounds.Bottom - cornerSize, bounds.Width - 2 * cornerSize, 2 * cornerSize);

            var r_r = FRectangle.CreateByCenter(bounds.Right, bounds.CenterY, bounds.Height - 2 * cornerSize, 2 * cornerSize);
            var r_l = FRectangle.CreateByCenter(bounds.Left, bounds.CenterY, bounds.Height - 2 * cornerSize, 2 * cornerSize);

            var r_c = new FRectangle(bounds.Left + cornerSize, bounds.Top + cornerSize, bounds.Width - 2 * cornerSize, bounds.Height - 2 * cornerSize);

            r_tl = r_tl.AsRotateCenterAround(ctr, rotation);
            r_tr = r_tr.AsRotateCenterAround(ctr, rotation);
            r_br = r_br.AsRotateCenterAround(ctr, rotation);
            r_bl = r_bl.AsRotateCenterAround(ctr, rotation);

            r_t = r_t.AsRotateCenterAround(ctr, rotation);
            r_r = r_r.AsRotateCenterAround(ctr, rotation);
            r_b = r_b.AsRotateCenterAround(ctr, rotation);
            r_l = r_l.AsRotateCenterAround(ctr, rotation);

            sbatch.DrawStretched(texEdge, r_t, colEdge, FloatMath.RAD_POS_000 + rotation);
            sbatch.DrawStretched(texEdge, r_r, colEdge, FloatMath.RAD_POS_090 + rotation);
            sbatch.DrawStretched(texEdge, r_b, colEdge, FloatMath.RAD_POS_180 + rotation);
            sbatch.DrawStretched(texEdge, r_l, colEdge, FloatMath.RAD_POS_270 + rotation);

            sbatch.DrawStretched(texCorner, r_tl, colCorner, FloatMath.RAD_POS_000 + rotation);
            sbatch.DrawStretched(texCorner, r_tr, colCorner, FloatMath.RAD_POS_090 + rotation);
            sbatch.DrawStretched(texCorner, r_br, colCorner, FloatMath.RAD_POS_180 + rotation);
            sbatch.DrawStretched(texCorner, r_bl, colCorner, FloatMath.RAD_POS_270 + rotation);

            sbatch.DrawStretched(texFill, r_c, colFill, rotation);
        }
Пример #26
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            float nepX = RootExpansionProgress;
            float lepX = 1 - RootExpansionProgress;

            float iep0 = 1 - FloatMath.FunctionEaseOutCubic(ExpansionProgress[0]);
            float lep0 = 1 - ExpansionProgress[0];
            float nep0 = ExpansionProgress[0];

            float iep1 = 1 - FloatMath.FunctionEaseOutCubic(ExpansionProgress[1]);
            float lep1 = 1 - ExpansionProgress[1];
            float nep1 = ExpansionProgress[1];

            float iep2 = 1 - FloatMath.FunctionEaseOutCubic(ExpansionProgress[2]);
            float lep2 = 1 - ExpansionProgress[2];
            float nep2 = ExpansionProgress[2];

            float iep3 = 1 - FloatMath.FunctionEaseOutCubic(ExpansionProgress[3]);
            float lep3 = 1 - ExpansionProgress[3];
            float nep3 = ExpansionProgress[3];

            #region Expander

            if (State[(int)FractionDifficulty.DIFF_0] != BistateProgress.Closed)
            {
                FlatRenderHelper.DrawOutlinesBlurRectangle(
                    sbatch,
                    rectExpanderNorth.AsTranslated(0, HEIGHT_EXTENDER * iep0).LimitSingleCoordSouth(Position.Y),
                    2,
                    LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_0) ? FractionDifficultyHelper.COLOR_DIFFICULTY_0 : COLOR_DEACTIVATED,
                    COLOR_BORDER,
                    8,
                    10);
            }

            if (State[(int)FractionDifficulty.DIFF_1] != BistateProgress.Closed)
            {
                FlatRenderHelper.DrawOutlinesBlurRectangle(
                    sbatch,
                    rectExpanderEast.AsTranslated(-HEIGHT_EXTENDER * iep1, 0).LimitSingleCoordWest(Position.X),
                    2,
                    LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_1) ? FractionDifficultyHelper.COLOR_DIFFICULTY_1 : COLOR_DEACTIVATED,
                    COLOR_BORDER,
                    8,
                    10);
            }

            if (State[(int)FractionDifficulty.DIFF_2] != BistateProgress.Closed)
            {
                FlatRenderHelper.DrawOutlinesBlurRectangle(
                    sbatch,
                    rectExpanderSouth.AsTranslated(0, -HEIGHT_EXTENDER * iep2).LimitSingleCoordNorth(Position.Y),
                    2,
                    LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_2) ? FractionDifficultyHelper.COLOR_DIFFICULTY_2 : COLOR_DEACTIVATED,
                    COLOR_BORDER,
                    8,
                    10);
            }

            if (State[(int)FractionDifficulty.DIFF_3] != BistateProgress.Closed)
            {
                FlatRenderHelper.DrawOutlinesBlurRectangle(
                    sbatch,
                    rectExpanderWest.AsTranslated(HEIGHT_EXTENDER * iep3, 0).LimitSingleCoordEast(Position.X),
                    2,
                    LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_3) ? FractionDifficultyHelper.COLOR_DIFFICULTY_3 : COLOR_DEACTIVATED,
                    COLOR_BORDER,
                    8,
                    10);
            }

            #endregion

            #region Icons

            if (State[(int)FractionDifficulty.DIFF_0] != BistateProgress.Closed)
            {
                sbatch.DrawStretched(
                    Textures.TexDifficultyLine0,
                    rectExpanderNorth
                    .ToSquare(ICON_SIZE, FlatAlign9.NORTH)
                    .AsTranslated(0, +ICON_OFFSET)
                    .AsTranslated(0, HEIGHT_EXTENDER * iep0),
                    clickAreaD0.IsMouseDown() ? FlatColors.WetAsphalt : Color.White);
            }

            if (State[(int)FractionDifficulty.DIFF_1] != BistateProgress.Closed)
            {
                sbatch.DrawStretched(
                    Textures.TexDifficultyLine1,
                    rectExpanderEast
                    .ToSquare(ICON_SIZE, FlatAlign9.EAST)
                    .AsTranslated(-ICON_OFFSET, 0)
                    .AsTranslated(-HEIGHT_EXTENDER * iep1, 0),
                    clickAreaD1.IsMouseDown() ? FlatColors.WetAsphalt : Color.White);
            }

            if (State[(int)FractionDifficulty.DIFF_2] != BistateProgress.Closed)
            {
                sbatch.DrawStretched(
                    Textures.TexDifficultyLine2,
                    rectExpanderSouth
                    .ToSquare(ICON_SIZE, FlatAlign9.SOUTH)
                    .AsTranslated(0, -ICON_OFFSET)
                    .AsTranslated(0, -HEIGHT_EXTENDER * iep2),
                    clickAreaD2.IsMouseDown() ? FlatColors.WetAsphalt : Color.White);
            }

            if (State[(int)FractionDifficulty.DIFF_3] != BistateProgress.Closed)
            {
                sbatch.DrawStretched(
                    Textures.TexDifficultyLine3,
                    rectExpanderWest
                    .ToSquare(ICON_SIZE, FlatAlign9.WEST)
                    .AsTranslated(+ICON_OFFSET, 0)
                    .AsTranslated(HEIGHT_EXTENDER * iep3, 0),
                    clickAreaD3.IsMouseDown() ? FlatColors.WetAsphalt : Color.White);
            }

            #endregion

            #region Ground

            if (NodeEnabled)
            {
                sbatch.DrawCentered(Textures.TexCircle, Position, DIAMETER, DIAMETER, FlatColors.Asbestos);
            }
            else
            {
                sbatch.DrawCentered(Textures.TexCircle, Position, DIAMETER, DIAMETER, FlatColors.Silver);
            }

            #endregion

            #region Segments

            sbatch.DrawCentered(
                Textures.TexLevelNodeSegment,
                Position,
                DIAMETER,
                DIAMETER,
                LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_0) ? FractionDifficultyHelper.COLOR_DIFFICULTY_0.BlendTo(COLOR_DEACTIVATED, 0.3f * lepX) : COLOR_DEACTIVATED, FloatMath.RAD_POS_000 + FloatMath.TAU * nepX);

            sbatch.DrawCentered(
                Textures.TexLevelNodeSegment,
                Position,
                DIAMETER,
                DIAMETER,
                LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_1) ? FractionDifficultyHelper.COLOR_DIFFICULTY_1.BlendTo(COLOR_DEACTIVATED, 0.3f * lepX) : COLOR_DEACTIVATED, FloatMath.RAD_POS_090 + FloatMath.TAU * nepX);

            sbatch.DrawCentered(
                Textures.TexLevelNodeSegment,
                Position,
                DIAMETER,
                DIAMETER,
                LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_2) ? FractionDifficultyHelper.COLOR_DIFFICULTY_2.BlendTo(COLOR_DEACTIVATED, 0.3f * lepX) : COLOR_DEACTIVATED, FloatMath.RAD_POS_180 + FloatMath.TAU * nepX);

            sbatch.DrawCentered(
                Textures.TexLevelNodeSegment,
                Position,
                DIAMETER,
                DIAMETER,
                LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_3) ? FractionDifficultyHelper.COLOR_DIFFICULTY_3.BlendTo(COLOR_DEACTIVATED, 0.3f * lepX) : COLOR_DEACTIVATED, FloatMath.RAD_POS_270 + FloatMath.TAU * nepX);

            #endregion

            #region Structure

            sbatch.DrawCentered(Textures.TexLevelNodeStructure, Position, DIAMETER, DIAMETER, FlatColors.MidnightBlue, FloatMath.TAU * nepX);

            #endregion

            #region Text

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, FONTSIZE, Blueprint.Name, ColorMath.Blend(FlatColors.Clouds, FlatColors.MidnightBlue, nepX), Position);

            #endregion
        }
Пример #27
0
 protected override void OnDrawOrderedForegroundLayer(IBatchRenderer sbatch)
 {
     sbatch.DrawStretched(Textures.TexVoidCircle_FG, _renderRect, Color.White);
 }
Пример #28
0
        private void DrawColoredPartitions(IBatchRenderer sbatch)
        {
            sbatch.FillRectangle(VAdapter.VirtualTotalBoundingBox.RelativeTo(Owner.MapOffset), FlatColors.Background);

            if (FloatMath.IsEpsilonOne(BackgroundPercentageOverride))
            {
                foreach (var pt in partitions)
                {
                    sbatch.DrawStretched(Textures.TexPixel, pt.Item2, pt.Item1);
                }
            }
            else
            {
                foreach (var pt in partitions)
                {
                    var color = ColorMath.Blend(FlatColors.Background, pt.Item1, BackgroundPercentageOverride);

                    sbatch.DrawStretched(Textures.TexPixel, pt.Item2, color);
                }
            }

            if (GridLineAlpha > 0)
            {
                int offX = (int)(Owner.MapOffsetX / TILE_WIDTH);
                int offY = (int)(Owner.MapOffsetY / TILE_WIDTH);

                int extensionX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetX / TILE_WIDTH) + 2;
                int extensionY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedBoundingsOffsetY / TILE_WIDTH) + 2;

                int countX = FloatMath.Ceiling(VAdapter.VirtualGuaranteedWidth / TILE_WIDTH);
                int countY = FloatMath.Ceiling(VAdapter.VirtualGuaranteedHeight / TILE_WIDTH);

                for (int x = -extensionX; x < countX + extensionX; x++)
                {
                    for (int y = -extensionY; y < countY + extensionY; y++)
                    {
                        var rx = x - offX;
                        var ry = y - offY;

                        sbatch.DrawStretched(
                            Textures.TexTileBorder,
                            new FRectangle(
                                rx * GDConstants.TILE_WIDTH,
                                ry * GDConstants.TILE_WIDTH,
                                GDConstants.TILE_WIDTH,
                                GDConstants.TILE_WIDTH),
                            Color.White * GridLineAlpha);
                    }
                }
            }

#if DEBUG
            if (DebugSettings.Get("DebugBackground"))
            {
                foreach (var pt in partitions)
                {
                    sbatch.FillRectangle(pt.Item2.AsDeflated(GDConstants.TILE_WIDTH / 6, GDConstants.TILE_WIDTH / 6), Color.Blue * 0.1f);
                    sbatch.DrawRectangle(pt.Item2.AsDeflated(GDConstants.TILE_WIDTH / 6, GDConstants.TILE_WIDTH / 6), Color.Blue, Owner.PixelWidth);
                }
            }
#endif
        }
Пример #29
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     sbatch.DrawStretched(_tex, _renderRect, Color.White);
 }
Пример #30
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     sbatch.DrawStretched(Textures.TexHUDIconArrow, bounds, Color.White, _rotation + FloatMath.RAD_POS_090);
 }