Exemplo n.º 1
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bottomrect = bounds.ToSubRectangleSouth(25);

            {             // background
                SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Clouds);
                SimpleRenderHelper.DrawSimpleRect(sbatch, bottomrect, FlatColors.Concrete);
            }

            {             // name
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 32, _meta?.LevelName ?? _level?.FullName, (_meta == null) ? FlatColors.Silver : FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5, bounds.Top + (bounds.Height - 25) / 2));
            }

            {             // user
                sbatch.DrawCentered(Textures.TexHUDIconGenericUser, new FPoint(bottomrect.Left + 5 + 32 + 5, bottomrect.CenterY), 20, 20, (_meta == null) ? FlatColors.Silver : FlatColors.WetAsphalt);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 20, (_meta == null) ? L10N.T(L10NImpl.STR_INF_YOU) : (_meta.Username ?? "Unknown"), (_meta == null) ? FlatColors.Silver : FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5 + 16, bounds.Bottom - 12.5f));
            }


            if ((_meta != null) && _meta.GridSize != SCCMLevelData.SIZES[0])             // [XL] marker
            {
                var rr = bounds.ToSubRectangleSouthWest(32, 20);
                SimpleRenderHelper.DrawSimpleRect(sbatch, rr, FlatColors.Amethyst);
                FontRenderHelper.DrawSingleLineInBox(sbatch, Textures.HUDFontRegular, "XL", rr, 0, true, FlatColors.Foreground);
            }

            {             // star counter
                var pointPos = new FPoint(bottomrect.Right - 100, bottomrect.CenterY);
                sbatch.DrawCentered(Textures.TexIconStar, pointPos, 20, 20, FlatColors.SunFlower);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 24, (_meta == null) ? "???" : _meta.Stars.ToString(), (_meta == null) ? FlatColors.Silver : FlatColors.MidnightBlue, pointPos + new Vector2(16, 0));
            }

            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);
        }
Exemplo n.º 2
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bgrect = bounds.ToSubRectangleSouth(Height * 2);

            if (_cogMovement > 0)
            {
                sbatch.DrawCentered(Textures.CannonCogBig, bounds.BottomRight - RAD_INSET - PAD_VEC * (1.5f * (1 - _cogMovement)), FONTSIZE, FONTSIZE, FlatColors.Clouds * _fadeOutAlpha * _fadeOutAlpha * _fadeOutAlpha, _rotation);
            }

            SimpleRenderHelper.DrawRoundedRect(sbatch, bgrect.AsDeflated(HUD.PixelWidth * 1), Background * _fadeOutAlpha, CORNER_RADIUS);
            SimpleRenderHelper.DrawRoundedRectOutline(sbatch, bgrect, Outline * _fadeOutAlpha, 12, HUD.PixelWidth * 2, CORNER_RADIUS);

            FontRenderHelper.DrawTextCentered(sbatch, _font, FONTSIZE, _text, Foreground * _fadeOutAlpha, bounds.Center);

            foreach (var particle in _particles)
            {
                if (particle.RemainingLifetime < PARTICLE_LIFETIME_FADE)
                {
                    sbatch.DrawCentered(Textures.TexPixel, particle.Position, particle.Size.Width, particle.Size.Height, particle.Color * (particle.RemainingLifetime / PARTICLE_LIFETIME_FADE), particle.Rotation);
                }
                else
                {
                    sbatch.DrawCentered(Textures.TexPixel, particle.Position, particle.Size.Width, particle.Size.Height, particle.Color, particle.Rotation);
                }
            }
        }
Exemplo n.º 3
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            sbatch.DrawCentered(Textures.TexHUDButtonBase, Center, DIAMETER * ScaleProgress, DIAMETER * ScaleProgress, ColorMath.Blend(FlatColors.Asbestos, FlatColors.Alizarin, OffsetProgress * ScaleProgress));

            sbatch.DrawCentered(GetIcon(), Center, SIZE_ICON * ScaleProgress * IconScale, SIZE_ICON * ScaleProgress * IconScale, IsPressed ? FlatColors.WetAsphalt : FlatColors.Clouds, IconRotation);

            FontRenderHelper.DrawTextVerticallyCenteredWithBackground(sbatch, Textures.HUDFontRegular, SIZE_ICON, ButtonText, FlatColors.Clouds * FontProgress, new FPoint(CenterX + SIZE_ICON, CenterY), Color.Black * 0.5f * FontProgress);
        }
Exemplo n.º 4
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (Image == null) return;
			if (imageBounds.IsEmpty) return;
			
			sbatch.DrawCentered(Image, imageBounds.Center, imageBounds.Width * RenderScaleOverride, imageBounds.Height * RenderScaleOverride, Color, Rotation);
		}
Exemplo n.º 5
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            Color col;

            float alpha = 1;

            if (_diff == FractionDifficulty.NEUTRAL)
            {
                if (_spawnPercentage >= 1)
                {
                    alpha = 1 - (_movementTime * SPEED / (_pipe.Length / 2));
                }
                col = FlatColors.Asbestos;
            }
            else
            {
                col = FractionDifficultyHelper.GetColor(_diff);
            }

            if (alpha < 0)
            {
                return;
            }

            sbatch.DrawCentered(Textures.TexParticle[14], Position, DIAMETER * _spawnPercentage, DIAMETER * _spawnPercentage, col * alpha);
        }
Exemplo n.º 6
0
        private void DrawCog(IBatchRenderer sbatch)
        {
            var health = CannonHealth.ActualValue;

            if (health > 0.99)
            {
                health = 1f;
            }

            sbatch.DrawCentered(
                Textures.TexPixel,
                Position,
                Scale * MINIGUNSTRUCT_DIAMETER,
                Scale * MINIGUNSTRUCT_DIAMETER,
                FlatColors.Clouds,
                FloatMath.RAD_POS_000 - cannonCogRotation);

            sbatch.DrawCentered(
                Textures.TexPixel,
                Position,
                Scale * MINIGUNSTRUCT_DIAMETER,
                Scale * MINIGUNSTRUCT_DIAMETER,
                FlatColors.Clouds,
                FloatMath.RAD_POS_000 + cannonCogRotation);

            if (health < 0.01)
            {
                // nothing
            }
            else if (health < 1)
            {
                var r = FRectangle.CreateByCenter(Position, health * Scale * MINIGUNSTRUCT_DIAMETER, health * Scale * MINIGUNSTRUCT_DIAMETER);

                sbatch.FillRectangleRot(r, Fraction.Color * (1 - health), FloatMath.RAD_POS_000 + cannonCogRotation);
                sbatch.FillRectangleRot(r, Fraction.Color * (1 - health), FloatMath.RAD_POS_000 - cannonCogRotation);

                sbatch.DrawRectangleRot(r, Fraction.Color, FloatMath.RAD_POS_000 + cannonCogRotation, 2f);
                sbatch.DrawRectangleRot(r, Fraction.Color, FloatMath.RAD_POS_000 - cannonCogRotation, 2f);
            }
            else
            {
                var r = FRectangle.CreateByCenter(Position, Scale * MINIGUNSTRUCT_DIAMETER, Scale * MINIGUNSTRUCT_DIAMETER);

                sbatch.DrawRectangleRot(r, Fraction.Color, FloatMath.RAD_POS_000 + cannonCogRotation, 2f);
                sbatch.DrawRectangleRot(r, Fraction.Color, FloatMath.RAD_POS_000 - cannonCogRotation, 2f);
            }
        }
Exemplo n.º 7
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            if (GDOwner.Selection == this)
            {
                if (ObstacleType == ObstacleStubType.MirrorBlock || ObstacleType == ObstacleStubType.GlassBlock)
                {
                    var a = FRotatedRectangle.CreateByCenter(Position, Width, Height, Rotation).GetBoundingRectangle();
                    sbatch.DrawCentered(Textures.TexPixel, Position, a.Width + GDConstants.TILE_WIDTH, a.Height + GDConstants.TILE_WIDTH, Color.Black * 0.333f);
                }
                else
                {
                    sbatch.DrawCentered(Textures.TexPixel, Position, Width + GDConstants.TILE_WIDTH, Height + GDConstants.TILE_WIDTH, Color.Black * 0.333f);
                }
            }

            switch (ObstacleType)
            {
            case ObstacleStubType.BlackHole:
                CommonObstacleRenderer.DrawBlackHole(sbatch, Position, Lifetime, Width, -Power);
                break;

            case ObstacleStubType.WhiteHole:
                CommonObstacleRenderer.DrawBlackHole(sbatch, Position, Lifetime, Width, Power);
                break;

            case ObstacleStubType.GlassBlock:
                CommonObstacleRenderer.DrawGlassBlock(sbatch, FRotatedRectangle.CreateByCenter(Position, Width, Height, Rotation));
                break;

            case ObstacleStubType.MirrorBlock:
                CommonObstacleRenderer.DrawMirrorBlock(sbatch, FRotatedRectangle.CreateByCenter(Position, Width, Height, Rotation));
                break;

            case ObstacleStubType.MirrorCircle:
                CommonObstacleRenderer.DrawMirrorCircle(sbatch, Position, Width);
                break;

            case ObstacleStubType.VoidVircle:
                CommonObstacleRenderer.DrawVoidCircle_BG(sbatch, Position, Width);
                break;

            default:
                SAMLog.Error("LEOS::EnumSwitch_CS_OD", "ObstacleType = " + ObstacleType);
                break;
            }
        }
Exemplo n.º 8
0
        private static void DrawDoubleRect(IBatchRenderer sbatch, FPoint position, float scale, float health, float cogRotation, Color fracColor)
        {
            if (health > 0.99)
            {
                health = 1f;
            }

            sbatch.DrawCentered(
                Textures.TexPixel,
                position,
                scale * Cannon.MINIGUNSTRUCT_DIAMETER,
                scale * Cannon.MINIGUNSTRUCT_DIAMETER,
                FlatColors.Clouds,
                FloatMath.RAD_POS_000 - cogRotation);

            sbatch.DrawCentered(
                Textures.TexPixel,
                position,
                scale * Cannon.MINIGUNSTRUCT_DIAMETER,
                scale * Cannon.MINIGUNSTRUCT_DIAMETER,
                FlatColors.Clouds,
                FloatMath.RAD_POS_000 + cogRotation);

            if (health < 0.01)
            {
                // nothing
            }
            else if (health < 1)
            {
                var r = FRectangle.CreateByCenter(position, health * scale * Cannon.MINIGUNSTRUCT_DIAMETER, health * scale * Cannon.MINIGUNSTRUCT_DIAMETER);

                sbatch.FillRectangleRot(r, fracColor * (1 - health), FloatMath.RAD_POS_000 + cogRotation);
                sbatch.FillRectangleRot(r, fracColor * (1 - health), FloatMath.RAD_POS_000 - cogRotation);

                sbatch.DrawRectangleRot(r, fracColor, FloatMath.RAD_POS_000 + cogRotation, 2f);
                sbatch.DrawRectangleRot(r, fracColor, FloatMath.RAD_POS_000 - cogRotation, 2f);
            }
            else
            {
                var r = FRectangle.CreateByCenter(position, scale * Cannon.MINIGUNSTRUCT_DIAMETER, scale * Cannon.MINIGUNSTRUCT_DIAMETER);

                sbatch.DrawRectangleRot(r, fracColor, FloatMath.RAD_POS_000 + cogRotation, 2f);
                sbatch.DrawRectangleRot(r, fracColor, FloatMath.RAD_POS_000 - cogRotation, 2f);
            }
        }
Exemplo n.º 9
0
 private static void DrawSingleDot(IBatchRenderer sbatch, FPoint position, float scale, Color fracColor)
 {
     sbatch.DrawCentered(
         Textures.TexCircle,
         position,
         scale * Cannon.CANNON_DIAMETER * 0.5f,
         scale * Cannon.CANNON_DIAMETER * 0.5f,
         fracColor);
 }
Exemplo n.º 10
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     sbatch.DrawCentered(
         Textures.TexBullet,
         BulletPosition,
         Scale * BulletExtraScale * BULLET_DIAMETER,
         Scale * BulletExtraScale * BULLET_DIAMETER,
         Fraction.Color * BulletAlpha, BulletRotation);
 }
Exemplo n.º 11
0
 public static void DrawMirrorCircle(IBatchRenderer sbatch, FPoint position, float diameter)
 {
     sbatch.DrawCentered(
         diameter < 96 ? Textures.TexMirrorCircleSmall : Textures.TexMirrorCircleBig,
         position,
         diameter + 2 * MirrorCircle.MARGIN_TEX,
         diameter + 2 * MirrorCircle.MARGIN_TEX,
         Color.White);
 }
Exemplo n.º 12
0
 private void DrawCog(IBatchRenderer sbatch)
 {
     sbatch.DrawCentered(
         Textures.TexCircle,
         Position,
         Scale * CANNON_DIAMETER * 0.5f,
         Scale * CANNON_DIAMETER * 0.5f,
         Fraction.Color);
 }
Exemplo n.º 13
0
 protected override void OnDraw(IBatchRenderer sbatch)
 {
     sbatch.DrawCentered(
         Textures.TexBulletSplitter,
         ShapePosition,
         scale * BaseBullet.BULLET_DIAMETER,
         scale * BaseBullet.BULLET_DIAMETER,
         Fraction.Color * ShapeAlpha, ShapeRotation);
 }
Exemplo n.º 14
0
        private void DrawInfoLine(IBatchRenderer sbatch, FractionDifficulty d, int idx, string strTime, bool colorize)
        {
            var p1 = Position + new Vector2(32, HEADER_HEIGHT + 40 + 56 * idx);
            var p2 = Position + new Vector2(64, HEADER_HEIGHT + 40 + 56 * idx);
            var p3 = Position + new Vector2(224, HEADER_HEIGHT + 40 + 56 * idx);

            var ic = (node.LevelData.HasCompletedOrBetter(d) ? FractionDifficultyHelper.GetColor(d) : FlatColors.Concrete) * progressDisplay;
            var tc = (node.LevelData.HasCompletedOrBetter(d) ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay;

            if (colorize && node.LevelData.Data[d].GlobalBestUserID >= 0 && node.LevelData.Data[d].GlobalBestUserID == MainGame.Inst.Profile.OnlineUserID)
            {
                tc = FlatColors.SunFlower * progressDisplay;
            }

            sbatch.DrawCentered(Textures.TexCircle, p1, 48, 48, FlatColors.WetAsphalt * progressDisplay);
            sbatch.DrawCentered(FractionDifficultyHelper.GetIcon(d), p1, 32, 32, ic);
            FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontRegular, 32, FractionDifficultyHelper.GetDescription(d), tc, p2);
            FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontRegular, 32, strTime, tc, p3);
        }
Exemplo n.º 15
0
        public static void DrawBlackHole(IBatchRenderer sbatch, FPoint position, float animationTimer, float diameter, float power)
        {
            var fillColor = (power < 0) ? Color.Black : Color.White;

            sbatch.DrawCentered(Textures.TexCircle, position, diameter, diameter, fillColor);
            sbatch.DrawCentered(Textures.TexVortex2, position, diameter, diameter, Color.Gray);
            sbatch.DrawCentered(Textures.TexVortex1, position, diameter * 0.666f, diameter * 0.666f, Color.Gray);
            sbatch.DrawCentered(Textures.TexVortex0, position, diameter * 0.333f, diameter * 0.333f, Color.Gray);

            float animProgress = (animationTimer % BlackHole.ANIMATION_DURATION) / BlackHole.ANIMATION_DURATION;

            if (power < 0)
            {
                if (animProgress < 2 / 4f)
                {
                    DrawBlackHoleAnimation0_In(sbatch, position, diameter, animProgress * 2 - 0);
                }
                else if (animProgress < 3 / 4f)
                {
                    DrawBlackHoleAnimation1_In(sbatch, position, diameter, animProgress * 4 - 2);
                }
                else if (animProgress < 4 / 4f)
                {
                    DrawBlackHoleAnimation2_In(sbatch, position, diameter, animProgress * 4 - 3);
                }
            }
            else
            {
                if (animProgress < 1 / 3f)
                {
                    DrawBlackHoleAnimation0_Out(sbatch, position, diameter, animProgress * 3 - 0);
                }
                else if (animProgress < 2 / 3f)
                {
                    DrawBlackHoleAnimation1_Out(sbatch, position, diameter, animProgress * 3 - 1);
                }
                else if (animProgress < 3 / 3f)
                {
                    DrawBlackHoleAnimation2_Out(sbatch, position, diameter, animProgress * 3 - 2);
                }
            }
        }
Exemplo n.º 16
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            var fillColor = (_power < 0) ? Color.Black : Color.White;

            sbatch.DrawCentered(Textures.TexCircle, Position, _diameter, _diameter, fillColor);
            sbatch.DrawCentered(Textures.TexVortex2, Position, _diameter, _diameter, Color.Gray);
            sbatch.DrawCentered(Textures.TexVortex1, Position, _diameter * 0.666f, _diameter * 0.666f, Color.Gray);
            sbatch.DrawCentered(Textures.TexVortex0, Position, _diameter * 0.333f, _diameter * 0.333f, Color.Gray);

            float animProgress = (_animationTimer % ANIMATION_DURATION) / ANIMATION_DURATION;

            if (_power < 0)
            {
                if (animProgress < 2 / 4f)
                {
                    DrawAnimation0_In(sbatch, animProgress * 2 - 0);
                }
                else if (animProgress < 3 / 4f)
                {
                    DrawAnimation1_In(sbatch, animProgress * 4 - 2);
                }
                else if (animProgress < 4 / 4f)
                {
                    DrawAnimation2_In(sbatch, animProgress * 4 - 3);
                }
            }
            else
            {
                if (animProgress < 1 / 3f)
                {
                    DrawAnimation0_Out(sbatch, animProgress * 3 - 0);
                }
                else if (animProgress < 2 / 3f)
                {
                    DrawAnimation1_Out(sbatch, animProgress * 3 - 1);
                }
                else if (animProgress < 3 / 3f)
                {
                    DrawAnimation2_Out(sbatch, animProgress * 3 - 2);
                }
            }
        }
Exemplo n.º 17
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var iconcenter = bounds.Center;

            for (int i = 0; i < 4; i++)
            {
                var pos = _tetroCenters[i].AsScaled(bounds.Width / 4).WithOrigin(iconcenter).RotateAround(iconcenter, _iconrotation);

                sbatch.DrawCentered(Textures.TexPixel, pos, bounds.Width / 4, bounds.Width / 4, Foreground, _iconrotation);
            }
        }
Exemplo n.º 18
0
        protected override void OnDrawGame(IBatchRenderer sbatch)
        {
#if GD_SHADERLESS
            var hh = 4.5f * GDConstants.TILE_WIDTH;
            sbatch.DrawCentered(Textures.TexLogo, _banner.TargetRect.Center, hh * Textures.TexLogo.Width / Textures.TexLogo.Height, hh, Color.White);
#else
            if (!MainGame.Inst.Profile.EffectsEnabled)
            {
                var hh = 4.5f * GDConstants.TILE_WIDTH;
                sbatch.DrawCentered(Textures.TexLogo, _banner.TargetRect.Center, hh * Textures.TexLogo.Width / Textures.TexLogo.Height, hh, Color.White);
            }
#endif

#if DEBUG
            if (DebugSettings.Get("DebugEntityBoundaries"))
            {
                sbatch.DrawRectangle(_banner.TargetRect, Color.DodgerBlue, 3f);
            }
#endif
        }
Exemplo n.º 19
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);
                }
            }
        }
Exemplo n.º 20
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);
            }
        }
Exemplo n.º 21
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bottomrect = bounds.ToSubRectangleSouth(25);

            {             // background
                SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Clouds);
                SimpleRenderHelper.DrawSimpleRect(sbatch, bottomrect, FlatColors.Concrete);
            }

            {             // difficulty
                var tex = (PersonalBest == null) ? Textures.TexDifficultyLineNone : FractionDifficultyHelper.GetIcon(PersonalBest.Value);
                var col = (PersonalBest == null) ? FlatColors.Silver : FractionDifficultyHelper.GetColor(PersonalBest.Value);
                sbatch.DrawCentered(tex, new FPoint(bounds.Left + 5 + 16, bounds.Top + (Height - 25 - 32) / 2 + 16), 32, 32, col);
            }

            {             // name
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 32, _meta.LevelName, FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5, bounds.Top + (bounds.Height - 25) / 2));
            }

            {             // user
                sbatch.DrawCentered(Textures.TexHUDIconGenericUser, new FPoint(bottomrect.Left + 5 + 32 + 5, bottomrect.CenterY), 20, 20, FlatColors.WetAsphalt);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 20, _meta.Username ?? "Unknown", FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5 + 16, bounds.Bottom - 12.5f));
            }


            if (_meta.GridSize != SCCMLevelData.SIZES[0])             // [XL] marker
            {
                var rr = bounds.ToSubRectangleSouthWest(32, 20);
                SimpleRenderHelper.DrawSimpleRect(sbatch, rr, FlatColors.Amethyst);
                FontRenderHelper.DrawSingleLineInBox(sbatch, Textures.HUDFontRegular, "XL", rr, 0, true, FlatColors.Foreground);
            }

            {             // star counter
                var pointPos = new FPoint(bottomrect.Right - 100, bottomrect.CenterY);
                sbatch.DrawCentered(Textures.TexIconStar, pointPos, 20, 20, FlatColors.SunFlower);
                FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 24, _meta.Stars.ToString(), FlatColors.MidnightBlue, pointPos + new Vector2(16, 0));
            }

            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);
        }
Exemplo n.º 22
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);
                }
            }
        }
Exemplo n.º 23
0
        protected void DrawGridGreenLock(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);

            sbatch.DrawCentered(Textures.TexIconLockOpen, innerBounds.Center, INNERSIZE * 0.75f, INNERSIZE * 0.75f, FlatColors.Nephritis);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.TextHUD, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
Exemplo n.º 24
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var icontex = Data.Icon();
            var iconscl = Data.IconScale;
            var iconcol = Data.IconColor();

            sbatch.DrawCentered(Textures.TexCircle, bounds.Center, bounds.Width, bounds.Height, IsPressed ? FlatColors.ButtonPressedHUD : FlatColors.ButtonHUD);

            sbatch.DrawCentered(Textures.TexCircleEmpty, bounds.Center, bounds.Width, bounds.Height, FlatColors.SeperatorHUD);

            if (icontex != null)
            {
                sbatch.DrawCentered(icontex, bounds.Center, bounds.Width * iconscl, bounds.Height * iconscl, iconcol);
            }

            FontRenderHelper.DrawTextCentered(
                sbatch,
                Textures.HUDFontBold,
                48,
                L10N.T(Data.Description),
                FlatColors.TextHUD,
                bounds.Center - new Vector2(0, bounds.Height / 2 + 32));

            var txt = Data.Text();
            var tcc = Data.TextColor();

            if (!string.IsNullOrWhiteSpace(txt))
            {
                FontRenderHelper.DrawTextCentered(
                    sbatch,
                    Textures.HUDFontBold,
                    64,
                    txt,
                    tcc,
                    bounds.Center);
            }
        }
Exemplo n.º 25
0
        protected void DrawLockSwing(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.DrawRectangle(innerBounds, Color.Black);

            var rot = FloatMath.Sin(Lifetime * FloatMath.TAU / _swingPeriode) * FloatMath.RAD_POS_005;

            sbatch.DrawCentered(Textures.TexIconLock, innerBounds.Center, INNERSIZE * 0.75f, INNERSIZE * 0.75f, Color.White, rot);

            FontRenderHelper.DrawTextCentered(sbatch, Textures.HUDFontBold, 0.9f * GDConstants.TILE_WIDTH, L10N.T(_l10ndescription), FlatColors.Asbestos, Position + new Vector2(0, 2.25f * GDConstants.TILE_WIDTH));
        }
Exemplo n.º 26
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            sbatch.DrawCentered(
                Textures.TexBullet,
                BulletPosition,
                Scale * BulletExtraScale * BULLET_DIAMETER,
                Scale * BulletExtraScale * BULLET_DIAMETER,
                Fraction.Color * BulletAlpha, BulletRotation);

#if DEBUG
            if (DebugSettings.Get("DebugMultiplayer"))
            {
                sbatch.DrawCircle(LastRemotePosition, Scale * BulletExtraScale * BULLET_DIAMETER / 2f, 6, ClientPredictionMiss ? Color.Crimson : Color.DeepSkyBlue, 2 * Owner.PixelWidth);
                sbatch.DrawLine(LastRemotePosition, BulletPosition, Color.DeepSkyBlue, Owner.PixelWidth);
            }
#endif
        }
Exemplo n.º 27
0
 private void InternalDraw(IBatchRenderer sbatch, FRectangle bounds, string textBase, string textAlt)
 {
     if (Icon != null)
     {
         var b = Icon.Size().Underfit(bounds.Size, IconPadding);
         sbatch.DrawCentered(Icon, bounds.Center, b.Width, b.Height, HUDKeyboard.COLOR_TEXT);
     }
     else
     {
         if (!string.IsNullOrEmpty(textBase))
         {
             FontRenderHelper.DrawTextCentered(sbatch, HUD.DefaultFont, TextSize, textBase, HUDKeyboard.COLOR_TEXT, bounds.Center);
         }
         if (!string.IsNullOrEmpty(textAlt))
         {
             FontRenderHelper.DrawTextTopRight(sbatch, HUD.DefaultFont, TextSizeAlt, textAlt, HUDKeyboard.COLOR_ALT, bounds.TopRight + new Vector2(-TextAltPadding, 0));
         }
     }
 }
Exemplo n.º 28
0
        private static void DrawShieldCore(IBatchRenderer sbatch, FPoint position, float scale, bool neutral, float health, float coreRotation, float satellites, Color fracColor)
        {
            if (satellites <= 0)
            {
                sbatch.DrawCentered(
                    Textures.TexCircle,
                    position,
                    scale * Cannon.CANNON_DIAMETER * 0.5f,
                    scale * Cannon.CANNON_DIAMETER * 0.5f,
                    FlatColors.Clouds);

                if (!neutral && health > 0)
                {
                    sbatch.DrawCentered(
                        Textures.TexCircle,
                        position,
                        scale * Cannon.CANNON_DIAMETER * 0.5f * health,
                        scale * Cannon.CANNON_DIAMETER * 0.5f * health,
                        fracColor);
                }
            }
            else
            {
                if (neutral)
                {
                    sbatch.DrawCentered(
                        Textures.TexCircle,
                        position,
                        scale * Cannon.CANNON_DIAMETER * 0.5f,
                        scale * Cannon.CANNON_DIAMETER * 0.5f,
                        FlatColors.Clouds);
                }
                else
                {
                    var p1 = position + new Vector2(scale * Cannon.CANNON_DIAMETER * 0.2f * satellites, 0).Rotate(coreRotation + FloatMath.RAD_POS_000);
                    var p2 = position + new Vector2(scale * Cannon.CANNON_DIAMETER * 0.2f * satellites, 0).Rotate(coreRotation + FloatMath.RAD_POS_120);
                    var p3 = position + new Vector2(scale * Cannon.CANNON_DIAMETER * 0.2f * satellites, 0).Rotate(coreRotation + FloatMath.RAD_POS_240);

                    var ws = scale * Cannon.CANNON_DIAMETER * 0.5f;
                    var we = scale * Cannon.CANNON_DIAMETER * 0.5f / 2f;

                    var diam = ws + (we - ws) * satellites;

                    sbatch.DrawCentered(Textures.TexCircle, p1, diam, diam, fracColor);
                    sbatch.DrawCentered(Textures.TexCircle, p2, diam, diam, fracColor);
                    sbatch.DrawCentered(Textures.TexCircle, p3, diam, diam, fracColor);
                }
            }
        }
Exemplo n.º 29
0
        private void DrawCore(IBatchRenderer sbatch)
        {
            if (SatelliteExpansion.ActualValue <= 0)
            {
                sbatch.DrawCentered(
                    Textures.TexCircle,
                    Position,
                    Scale * CANNON_DIAMETER * 0.5f,
                    Scale * CANNON_DIAMETER * 0.5f,
                    FlatColors.Clouds);

                if (!Fraction.IsNeutral && CannonHealth.ActualValue > 0)
                {
                    sbatch.DrawCentered(
                        Textures.TexCircle,
                        Position,
                        Scale * CANNON_DIAMETER * 0.5f * CannonHealth.ActualValue,
                        Scale * CANNON_DIAMETER * 0.5f * CannonHealth.ActualValue,
                        Fraction.Color);
                }
            }
            else
            {
                if (Fraction.IsNeutral)
                {
                    sbatch.DrawCentered(
                        Textures.TexCircle,
                        Position,
                        Scale * CANNON_DIAMETER * 0.5f,
                        Scale * CANNON_DIAMETER * 0.5f,
                        FlatColors.Clouds);
                }
                else
                {
                    var p1 = Position + new Vector2(Scale * CANNON_DIAMETER * 0.2f * SatelliteExpansion.ActualValue, 0).Rotate(_coreRotation + FloatMath.RAD_POS_000);
                    var p2 = Position + new Vector2(Scale * CANNON_DIAMETER * 0.2f * SatelliteExpansion.ActualValue, 0).Rotate(_coreRotation + FloatMath.RAD_POS_120);
                    var p3 = Position + new Vector2(Scale * CANNON_DIAMETER * 0.2f * SatelliteExpansion.ActualValue, 0).Rotate(_coreRotation + FloatMath.RAD_POS_240);

                    var ws = Scale * CANNON_DIAMETER * 0.5f;
                    var we = Scale * CANNON_DIAMETER * 0.5f / 2f;

                    var diam = ws + (we - ws) * SatelliteExpansion.ActualValue;

                    sbatch.DrawCentered(Textures.TexCircle, p1, diam, diam, Fraction.Color);
                    sbatch.DrawCentered(Textures.TexCircle, p2, diam, diam, Fraction.Color);
                    sbatch.DrawCentered(Textures.TexCircle, p3, diam, diam, Fraction.Color);
                }
            }
        }
Exemplo n.º 30
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var bottomrect = bounds.ToSubRectangleSouth(25);

            SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, FlatColors.Clouds);
            SimpleRenderHelper.DrawSimpleRect(sbatch, bottomrect, FlatColors.Concrete);

            FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 32, _data.Name, FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5, bounds.Top + (bounds.Height - 25) / 2));
            FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontBold, 20, MainGame.Inst.Profile.OnlineUsername, FlatColors.Foreground, new FPoint(bounds.Left + 5 + 32 + 5 + 16, bounds.Bottom - 12.5f));

            sbatch.DrawCentered(Textures.TexHUDIconGenericUser, new FPoint(bottomrect.Left + 5 + 32 + 5, bottomrect.CenterY), 20, 20, FlatColors.WetAsphalt);

            if (_data.Size != SCCMLevelData.SIZES[0])
            {
                var rr = bounds.ToSubRectangleSouthWest(32, 20);
                SimpleRenderHelper.DrawSimpleRect(sbatch, rr, FlatColors.Amethyst);
                FontRenderHelper.DrawSingleLineInBox(sbatch, Textures.HUDFontRegular, "XL", rr, 0, true, FlatColors.Foreground);
            }

            SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, HUD.PixelWidth, Color.Black);
        }