Ejemplo n.º 1
0
 public Table()
 {
     settings     = new TableSettings();
     this.shape   = new FRectangle();
     shape.Height = CommonAttribService.DEFAULT_TABLE_HEIGHT;
     shape.Width  = CommonAttribService.DEFAULT_TABLE_WIDTH;
 }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 3
0
        protected void DrawGridProgress(IBatchRenderer sbatch)
        {
            var outerBounds = FRectangle.CreateByCenter(Position, DrawingBoundingBox);
            var innerBounds = FRectangle.CreateByCenter(Position, new FSize(INNERSIZE, INNERSIZE));

            var scoreRectSize = innerBounds.Width / 8f;

            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);

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    var col = ColorMath.Blend(FlatColors.Background, GetCellColor(x, y), AlphaOverride);
                    sbatch.FillRectangle(new FRectangle(innerBounds.X + scoreRectSize * x, innerBounds.Y + scoreRectSize * y, scoreRectSize, scoreRectSize), col);
                }
            }

            for (int i = 0; i <= 8; i++)
            {
                sbatch.DrawLine(innerBounds.Left, innerBounds.Top + i * scoreRectSize, innerBounds.Right, innerBounds.Top + i * scoreRectSize, Color.Black * AlphaOverride, Owner.PixelWidth);
                sbatch.DrawLine(innerBounds.Left + i * scoreRectSize, innerBounds.Top, innerBounds.Left + i * scoreRectSize, innerBounds.Bottom, Color.Black * AlphaOverride, 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));
        }
Ejemplo n.º 4
0
		public CirclePieceSegment(FPoint center, float radius, float aStart = 0, float aEnd = FloatMath.TAU)
		{
			this.center = center;
			this.radius = radius;

			if (aStart < aEnd)
			{
				direction = CircularDirection.CW;

				angleStart = aStart;
				angleEnd = aEnd;
			}
			else
			{
				direction = CircularDirection.CCW;

				angleStart = aEnd;
				angleEnd = aStart;
			}

			Length = (2 * FloatMath.PI * radius) * (angleEnd - angleStart) / FloatMath.TAU;
			directionZero = new Vector2(radius, 0);
			
			Boundings = GeometryHelper.CalculateEllipseSegmentsBoundingBox(center.X, center.Y, radius, radius, angleStart, angleEnd);
		}
Ejemplo n.º 5
0
		public EllipsePieceSegment(FPoint center, float radiusX, float radiusY, float aStart = 0, float aEnd = FloatMath.TAU, CircularDirection dir = CircularDirection.CW)
		{
			this.center = center;
			this.radiusX = radiusX;
			this.radiusY = radiusY;
			this.direction = dir;

			angleStart = aStart;
			angleEnd = aEnd;

			if (dir == CircularDirection.CW)
			{
				Length = FloatMath.TAU * FloatMath.Sqrt((radiusX * radiusX + radiusY * radiusY) / 2f) * (angleEnd - angleStart) / FloatMath.TAU;

				Boundings = GeometryHelper.CalculateEllipseSegmentsBoundingBox(center.X, center.Y, radiusX, radiusY, angleStart, angleEnd);
			}
			else
			{
				// inverted
				
				Length = FloatMath.TAU * FloatMath.Sqrt((radiusX * radiusX + radiusY * radiusY) / 2f) * (angleStart - angleEnd) / FloatMath.TAU;

				Boundings = GeometryHelper.CalculateEllipseSegmentsBoundingBox(center.X, center.Y, radiusX, radiusY, angleEnd, angleStart);
			}


		}
Ejemplo n.º 6
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     if (progressMove > 0)
     {
         SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, Color.Black * 0.6f);
     }
 }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        public void PlayerAndWall(Player player_, bool isVertical_, float pos_)
        {
            FRectangle hb = player_.MovHB()[0];

            if (isVertical_)
            {
                if (hb.X + hb.Width <= pos_ && pos_ < hb.X + player_.mov.X + hb.Width)
                {
                    player_.mov.X -= hb.X + player_.mov.X + hb.Width - pos_;
                }
                else if (hb.X >= pos_ && pos_ > hb.X + player_.mov.X)
                {
                    player_.mov.X += pos_ - hb.X - player_.mov.X;
                }
            }
            else
            {
                if (hb.Y + hb.Height <= pos_ && pos_ < hb.Y + player_.mov.Y + hb.Height)
                {
                    player_.mov.Y -= hb.Y + player_.mov.Y + hb.Height - pos_;
                }
                else if (hb.Y >= pos_ && pos_ > hb.Y + player_.mov.Y)
                {
                    player_.mov.Y += pos_ - hb.Y - player_.mov.Y;
                }
            }
        }
Ejemplo n.º 9
0
        public void BulletAndWall(Bullet bullet_, bool isVertical_, float pos_)
        {
            FRectangle hb = bullet_.MovHB()[0];

            if (isVertical_)
            {
                if (hb.X + hb.Width <= pos_ && pos_ < hb.X + bullet_.mov.X + hb.Width)
                {
                    bullet_.mov.X -= hb.X + bullet_.mov.X + hb.Width - pos_; bullet_.Bounce(true);
                }
                else if (hb.X >= pos_ && pos_ > hb.X + bullet_.mov.X)
                {
                    bullet_.mov.X += pos_ - hb.X - bullet_.mov.X; bullet_.Bounce(true);
                }
            }
            else
            {
                if (hb.Y + hb.Height <= pos_ && pos_ < hb.Y + bullet_.mov.Y + hb.Height)
                {
                    bullet_.mov.Y -= hb.Y + bullet_.mov.Y + hb.Height - pos_; bullet_.Bounce(false);
                }
                else if (hb.Y >= pos_ && pos_ > hb.Y + bullet_.mov.Y)
                {
                    bullet_.mov.Y += pos_ - hb.Y - bullet_.mov.Y; bullet_.Bounce(false);
                }
            }
        }
Ejemplo n.º 10
0
        //public Rectangle BoundingRectangle => new Rectangle(0, 0, VirtualWidth, VirtualHeight);
        //public Point Center => BoundingRectangle.Center;

        public FRectangle ScreenToRect(FRectangle point)         // virtual to real
        {
            var p1 = ScreenToPoint(point.TopLeft);
            var p2 = ScreenToPoint(point.BottomRight);

            return(new FRectangle(p1, p2));
        }
Ejemplo n.º 11
0
        public TSAImageObject AddImage(TextureRegion2D tex, FRectangle r, Color c)
        {
            var obj = new TSAImageObject(tex, r, c, 0f, Elements.Any() ? Elements.Last().Order + 1 : 1);

            AddElement(obj);
            return(obj);
        }
Ejemplo n.º 12
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (Alignment == HUDAlignment.CENTER || Alignment == HUDAlignment.CENTERLEFT || Alignment == HUDAlignment.CENTERRIGHT)
			{
				sbatch.DrawString(
					Font, 
					_textCache, 
					new Vector2(bounds.Left, bounds.Top + _fontVOffset), 
					TextColor, 
					0, 
					Vector2.Zero, 
					_fontScale, 
					SpriteEffects.None, 
					0);
			}
			else
			{
				sbatch.DrawString(
					Font, 
					_textCache, 
					bounds.VectorTopLeft, 
					TextColor, 
					0,
					Vector2.Zero, 
					_fontScale, 
					SpriteEffects.None, 
					0);
			}
		}
Ejemplo n.º 13
0
        protected override void OnInit(GDWorldMapScreen screen)
        {
            vp = screen.VAdapterGame;

            rectStart = screen.GuaranteedMapViewport;
            rectFinal = screen.Graph.BoundingViewport;
        }
Ejemplo n.º 14
0
        private void AddEdgeMarker()
        {
            var mw = MapFullBounds.Width;
            var mh = MapFullBounds.Height;
            var ex = 2 * GDConstants.TILE_WIDTH;

            var rn = new FRectangle(-ex, -ex, mw + 2 * ex, ex);
            var re = new FRectangle(+mw, -ex, ex, mh + 2 * ex);
            var rs = new FRectangle(-ex, +mh, mw + 2 * ex, ex);
            var rw = new FRectangle(-ex, -ex, ex, mh + 2 * ex);

            var dn = new MarkerCollisionBorder {
                Side = FlatAlign4.NN
            };
            var de = new MarkerCollisionBorder {
                Side = FlatAlign4.EE
            };
            var ds = new MarkerCollisionBorder {
                Side = FlatAlign4.SS
            };
            var dw = new MarkerCollisionBorder {
                Side = FlatAlign4.WW
            };

            var bn = BodyFactory.CreateBody(GetPhysicsWorld(), ConvertUnits2.ToSimUnits(rn.Center), 0, BodyType.Static, dn);
            var be = BodyFactory.CreateBody(GetPhysicsWorld(), ConvertUnits2.ToSimUnits(re.Center), 0, BodyType.Static, de);
            var bs = BodyFactory.CreateBody(GetPhysicsWorld(), ConvertUnits2.ToSimUnits(rs.Center), 0, BodyType.Static, ds);
            var bw = BodyFactory.CreateBody(GetPhysicsWorld(), ConvertUnits2.ToSimUnits(rw.Center), 0, BodyType.Static, dw);

            var fn = FixtureFactory.AttachRectangle(ConvertUnits.ToSimUnits(rn.Width), ConvertUnits.ToSimUnits(rn.Height), 1, Vector2.Zero, bn, dn);
            var fe = FixtureFactory.AttachRectangle(ConvertUnits.ToSimUnits(re.Width), ConvertUnits.ToSimUnits(re.Height), 1, Vector2.Zero, be, de);
            var fs = FixtureFactory.AttachRectangle(ConvertUnits.ToSimUnits(rs.Width), ConvertUnits.ToSimUnits(rs.Height), 1, Vector2.Zero, bs, ds);
            var fw = FixtureFactory.AttachRectangle(ConvertUnits.ToSimUnits(rw.Width), ConvertUnits.ToSimUnits(rw.Height), 1, Vector2.Zero, bw, dw);
        }
Ejemplo n.º 15
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));
            }
        }
Ejemplo n.º 16
0
 public TSAImageObject(TextureRegion2D tex, FRectangle rectInitial, Color colInitial, float rotInitial, int order) : base(order)
 {
     _texture = tex;
     _rect0   = rectInitial;
     _col0    = colInitial;
     _rot0    = rotInitial;
 }
Ejemplo n.º 17
0
 protected override void OnProgress(OverworldNode_SCCM node, float progress, SAMTime gameTime, InputState istate)
 {
     node.Blocks[0].Item1 = FRectangle.CreateByCenter(
         node.Blocks[0].Item1.Center,
         FloatMath.FunctionEaseInOutCubic(progress) * node.NonTranslatedBounds.Width / 5f,
         FloatMath.FunctionEaseInOutCubic(progress) * node.NonTranslatedBounds.Width / 5f);
 }
Ejemplo n.º 18
0
 internal void Remove(FRectangle boundingBox, Entity entity)
 {
     foreach (List <Entity> entityList in GetHashList(boundingBox))
     {
         entityList.Remove(entity);
     }
 }
Ejemplo n.º 19
0
        public void FillCircle(FPoint center, float radius, int sides, Color color)
        {
#if DEBUG
            IncRenderSpriteCount(sides);
#endif

            float angle      = FloatMath.TAU / sides;
            float sideWidth  = FloatMath.Asin(angle / 2) * 2 * radius;
            float rectHeight = FloatMath.Sin(FloatMath.RAD_POS_090 - angle / 2) * radius;


            var r = new FRectangle(center.X - sideWidth / 2, center.Y, sideWidth, rectHeight);

            for (int i = 0; i < sides; i++)
            {
                internalBatch.Draw(
                    StaticTextures.SinglePixel.Texture,
                    null,
                    r.Round(),
                    StaticTextures.SinglePixel.Bounds,
                    new Vector2(0.5f, 0),
                    angle * i,
                    Vector2.One,
                    color);
            }
        }
Ejemplo n.º 20
0
        void CheckMax()
        {
            if (SpList.Count == 0)
            {
                return;
            }
            //if(Max == null)
            FRectangle max = SpList[0].GetSize();

            for (int i = 1; i < SpList.Count; i++)
            {
                max.Unite(SpList[i].GetSize());
            }

            if (Max == null)
            {
                Max = max;
            }
            else
            {
                Max.SetupY(max.YFrom, max.YTo);
            }

            if (View == null)
            {
                View = new FRectangle(Max);
            }
            else
            {
                View.SetupY(Max.YFrom, Max.YTo);// View.FitIn(Max);
            }
        }
Ejemplo n.º 21
0
		public static void DrawRoundedBlurPanel(IBatchRenderer sbatch, FRectangle bounds, Color color, float scale = 1f)
		{
			StaticTextures.ThrowIfNotInitialized();

			DrawRoundedBlurPanelBackgroundPart(sbatch, bounds, scale);
			DrawRoundedBlurPanelSolidPart(sbatch, bounds, color, scale);
		}
Ejemplo n.º 22
0
        private void Initialize()
        {
            MapFullBounds = CreateMapFullBounds();
            VAdapterGame  = CreateViewport();
            VAdapterHUD   = CreateViewport();           // later perhaps diff adapters

            InternalBatch   = new SpriteBatch(Graphics.GraphicsDevice);
            FixedBatch      = new SpriteBatchWrapper(InternalBatch);
            TranslatedBatch = new SpriteBatchWrapper(InternalBatch);

            InputStateMan = new InputStateManager(VAdapterGame, VAdapterHUD, MapOffsetX, MapOffsetY);
            GameHUD       = CreateHUD();
            Background    = CreateBackground();

            Entities = CreateEntityManager();

            DebugDisp = new DummyDebugTextDisplay();

            GameHUD.Validate();

#if DEBUG
            FPSCounter = new RealtimeAPSCounter();
            UPSCounter = new RealtimeAPSCounter();
            GCMonitor  = new GCMonitor();

            DebugMap = CreateDebugMinimap();
#endif
        }
Ejemplo n.º 23
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (Image == null) return;
			if (imageBounds.IsEmpty) return;
			
			sbatch.Draw(Image.Texture, imageBounds, Image.Bounds, Color.White);
		}
Ejemplo n.º 24
0
        private void DrawScreenDebug(IBatchRenderer sbatch)
        {
            if (DebugSettings.Get("DebugBackground"))
            {
                DebugRenderHelper.DrawCrossedCircle(sbatch, Color.Red, MapViewportCenter, 8, 2);
                DebugRenderHelper.DrawHalfCrossedCircle(sbatch, Color.Red, MapOffset.Negate(), 8, 2);

                var rTop = new FRectangle(CompleteMapViewport.X, CompleteMapViewport.Y, CompleteMapViewport.Width, GuaranteedMapViewport.Y - CompleteMapViewport.Y);
                var rBot = new FRectangle(CompleteMapViewport.X, GuaranteedMapViewport.Bottom, CompleteMapViewport.Width, CompleteMapViewport.Bottom - GuaranteedMapViewport.Bottom);
                var rLef = new FRectangle(CompleteMapViewport.X, CompleteMapViewport.Y, GuaranteedMapViewport.X - CompleteMapViewport.X, CompleteMapViewport.Height);
                var rRig = new FRectangle(GuaranteedMapViewport.Right, CompleteMapViewport.Y, CompleteMapViewport.Right - GuaranteedMapViewport.Right, CompleteMapViewport.Height);

                if (rTop.Area > 0.001f)
                {
                    sbatch.FillRectangle(rTop, Color.DarkRed * 0.35f);
                }
                if (rBot.Area > 0.001f)
                {
                    sbatch.FillRectangle(rBot, Color.DarkRed * 0.35f);
                }
                if (rLef.Area > 0.001f)
                {
                    sbatch.FillRectangle(rLef, Color.DarkRed * 0.35f);
                }
                if (rRig.Area > 0.001f)
                {
                    sbatch.FillRectangle(rRig, Color.DarkRed * 0.35f);
                }

                sbatch.DrawRectangle(GuaranteedMapViewport, Color.Red * 0.8f, 1f);
            }
        }
Ejemplo n.º 25
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     if (Alignment == HUDAlignment.CENTER || Alignment == HUDAlignment.CENTERLEFT || Alignment == HUDAlignment.CENTERRIGHT)
     {
         sbatch.DrawString(
             Font,
             _textCache,
             new FPoint(bounds.Left, bounds.Top + _fontVOffset),
             TextColor * Alpha,
             0,
             FPoint.Zero,
             _fontScale,
             SpriteEffects.None,
             0);
     }
     else
     {
         sbatch.DrawString(
             Font,
             _textCache,
             bounds.TopLeft,
             TextColor * Alpha,
             0,
             FPoint.Zero,
             _fontScale,
             SpriteEffects.None,
             0);
     }
 }
Ejemplo n.º 26
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);
                }
            }
        }
Ejemplo n.º 27
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);
            }
        }
Ejemplo n.º 28
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (BackgroundColor != Color.Transparent)
			{
				SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, BackgroundColor);
			}
		}
Ejemplo n.º 29
0
        public CirclePieceSegment(FPoint center, float radius, float aStart = 0, float aEnd = FloatMath.TAU)
        {
            this.center = center;
            this.radius = radius;

            if (aStart < aEnd)
            {
                direction = CircularDirection.CW;

                angleStart = aStart;
                angleEnd   = aEnd;
            }
            else
            {
                direction = CircularDirection.CCW;

                angleStart = aEnd;
                angleEnd   = aStart;
            }

            Length        = (2 * FloatMath.PI * radius) * (angleEnd - angleStart) / FloatMath.TAU;
            directionZero = new Vector2(radius, 0);

            Boundings = EllipseHelper.CalculateEllipseSegmentsBoundingBox(center.X, center.Y, radius, radius, angleStart, angleEnd);
        }
Ejemplo n.º 30
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);
		}
Ejemplo n.º 31
0
        public EllipsePieceSegment(FPoint center, float radiusX, float radiusY, float aStart = 0, float aEnd = FloatMath.TAU, CircularDirection dir = CircularDirection.CW)
        {
            this.center    = center;
            this.radiusX   = radiusX;
            this.radiusY   = radiusY;
            this.direction = dir;

            angleStart = aStart;
            angleEnd   = aEnd;

            if (dir == CircularDirection.CW)
            {
                Length = FloatMath.TAU * FloatMath.Sqrt((radiusX * radiusX + radiusY * radiusY) / 2f) * (angleEnd - angleStart) / FloatMath.TAU;

                Boundings = EllipseHelper.CalculateEllipseSegmentsBoundingBox(center.X, center.Y, radiusX, radiusY, angleStart, angleEnd);
            }
            else
            {
                // inverted

                Length = FloatMath.TAU * FloatMath.Sqrt((radiusX * radiusX + radiusY * radiusY) / 2f) * (angleStart - angleEnd) / FloatMath.TAU;

                Boundings = EllipseHelper.CalculateEllipseSegmentsBoundingBox(center.X, center.Y, radiusX, radiusY, angleEnd, angleStart);
            }
        }
Ejemplo n.º 32
0
        public static void DrawRoundedBlurPanel(IBatchRenderer sbatch, FRectangle bounds, Color color, float cornerSize = 16f)
        {
            StaticTextures.ThrowIfNotInitialized();

            DrawRoundedBlurPanelBackgroundPart(sbatch, bounds, cornerSize);
            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, color, cornerSize);
        }
Ejemplo n.º 33
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			sbatch.Draw(
				Textures.TexHUDButtonBase.Texture,
				Center,
				Textures.TexHUDButtonBase.Bounds,
				ColorMath.Blend(FlatColors.Flamingo, FlatColors.Asbestos, openingProgress),
				0f,
				Textures.TexHUDButtonBase.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
			
			sbatch.Draw(
				Textures.TexHUDButtonSpeedClock.Texture,
				Center,
				Textures.TexHUDButtonSpeedClock.Bounds,
				FlatColors.Clouds,
				0f,
				Textures.TexHUDButtonSpeedClock.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);

			sbatch.Draw(
				Textures.TexHUDButtonSpeedHand.Texture,
				Center,
				Textures.TexHUDButtonSpeedHand.Bounds,
				FlatColors.Clouds,
				rotation,
				Textures.TexHUDButtonSpeedHand.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
Ejemplo n.º 34
0
        /// <summary>
        /// Recalculate size of the game board based on the size of the window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tablePanel_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            // handle view
            tablePanel.tableAreaPanel.Width            = tablePanel.tableAreaPanel.Width + e.NewSize.Width - e.PreviousSize.Width;
            tablePanel.tableAreaPanel.Height           = tablePanel.tableAreaPanel.Height + e.NewSize.Height - e.PreviousSize.Height;
            tablePanel.tableAreaPanel.tableGrid.Width  = tablePanel.tableAreaPanel.tableGrid.Width + (e.NewSize.Width - e.PreviousSize.Width);
            tablePanel.tableAreaPanel.tableGrid.Height = tablePanel.tableAreaPanel.tableGrid.Height + (e.NewSize.Height - e.PreviousSize.Height);


            // handle model
            FRectangle tableRect = ((FRectangle)((Table)tableManager.TableDepositor.table).Shape);

            tableRect.Width  = tablePanel.tableAreaPanel.tableGrid.Width;
            tableRect.Height = tablePanel.tableAreaPanel.tableGrid.Height;

            // set margins of all stones
            foreach (Image img in rockImages)
            {
                img.Margin =
                    new Thickness(img.Margin.Left * ((CommonAttribService.ACTUAL_TABLE_WIDTH / CommonAttribService.ACTUAL_TABLE_SIZE_MULTIPLIER) / tableRect.Width),
                                  img.Margin.Top / ((CommonAttribService.ACTUAL_TABLE_HEIGHT / CommonAttribService.ACTUAL_TABLE_SIZE_MULTIPLIER) / tableRect.Height), 0, 0);

                ((A_Rock)img.DataContext).Position =
                    PointHelper.TransformPointToEuc(new FPoint(img.Margin.Left * CommonAttribService.ACTUAL_TABLE_SIZE_MULTIPLIER + img.Width / 2,
                                                               img.Margin.Top * CommonAttribService.ACTUAL_TABLE_SIZE_MULTIPLIER + img.Height / 2), tableRect.Width, tableRect.Height);
            }

            CommonAttribService.ACTUAL_TABLE_WIDTH  = (int)(tablePanel.tableAreaPanel.tableGrid.Width * CommonAttribService.ACTUAL_TABLE_SIZE_MULTIPLIER);
            CommonAttribService.ACTUAL_TABLE_HEIGHT = (int)(tablePanel.tableAreaPanel.tableGrid.Height * CommonAttribService.ACTUAL_TABLE_SIZE_MULTIPLIER);
        }
Ejemplo n.º 35
0
        public override void OnInitialize(EntityManager manager)
        {
            clickAreaThis = AddClickMouseArea(FRectangle.CreateByCenter(0, 0, DIAMETER, DIAMETER), OnClick, OnDown, OnUp);

            var cfg = new ParticleEmitterConfig.ParticleEmitterConfigBuilder
            {
                // red fire
                TextureIndex         = 12,
                SpawnRate            = 20,
                ParticleLifetimeMin  = 1.0f,
                ParticleLifetimeMax  = 2.5f,
                ParticleVelocityMin  = 24f,
                ParticleVelocityMax  = 32f,
                ParticleSizeInitial  = 64,
                ParticleSizeFinalMin = 32,
                ParticleSizeFinalMax = 48,
                ParticleAlphaInitial = 1f,
                ParticleAlphaFinal   = 0f,
                ColorInitial         = Color.DarkOrange,
                ColorFinal           = Color.DarkRed,
            }.Build(Textures.TexParticle);

            emitter = new PointCPUParticleEmitter(Owner, Position, cfg, GDConstants.ORDER_MAP_NODEPARTICLES);

            manager.AddEntity(emitter);
        }
Ejemplo n.º 36
0
        public Portal(GDGameScreen scrn, PortalBlueprint blueprint) : base(scrn, GDConstants.ORDER_GAME_PORTAL)
        {
            var pos = new FPoint(blueprint.X, blueprint.Y);

            Normal       = FloatMath.DegreesToRadians * blueprint.Normal;
            VecNormal    = Vector2.UnitX.Rotate(Normal);
            Length       = blueprint.Length;
            VecDirection = VecNormal.RotateWithLength(FloatMath.RAD_POS_090, blueprint.Length / 2f);
            Color        = COLORS[blueprint.Group];
            _group       = blueprint.Group;
            _side        = blueprint.Side;

            Position = pos;

            DrawingBoundingBox = new Vector2(Length, 0).Rotate(Normal + FloatMath.RAD_POS_090).ToAbsFSize().AtLeast(WIDTH, WIDTH);

            this.GDOwner().GDBackground.RegisterBlockedLine(pos - Vector2.UnitX.RotateWithLength(Normal + FloatMath.RAD_POS_090, Length / 2f), pos + Vector2.UnitX.RotateWithLength(Normal + FloatMath.RAD_POS_090, Length / 2f));

            _rectFull     = FRectangle.CreateByCenter(pos, Length, WIDTH);
            _rectHorizon  = FRectangle.CreateByCenter(pos + VecNormal.WithLength(WIDTH / 4f), Length, WIDTH / 2f);
            _rectGradient = FRectangle.CreateByCenter(pos + VecNormal.WithLength(WIDTH / 2f), Length, WIDTH);
            _rectDropTop  = FRectangle.CreateByCenter(pos - VecDirection.WithLength(Length / 2f), 24, 16);
            _rectDropMid  = FRectangle.CreateByCenter(pos, 24, Length - 16);
            _rectDropBot  = FRectangle.CreateByCenter(pos + VecDirection.WithLength(Length / 2f), 24, 16);
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Checks if Two Entities are intersecting each other assuming the specified states, gameTime and group filter.
        /// This check is actually rather ineffecient. O(n^2) time complexity. In reality though, we would be smart about
        /// what to compare - hence the group and state filters. The number of comparasins between drawables should be kept
        /// to a minimum in order to maintain performance.
        /// </summary>
        public static bool IntersectsWith(
            Entity entity1, string entity1State, string entity1Group,
            Entity entity2, string entity2State, string entity2Group,
            GameTime gameTime
            )
        {
            HashSet <GameDrawableInstance> entity1Instances = entity1.Drawables.GetByState(entity1State);
            HashSet <GameDrawableInstance> entity2Instances = entity2.Drawables.GetByState(entity2State);

            if (entity1Instances == null || entity2Instances == null)
            {
                return(false);
            }

            foreach (GameDrawableInstance instanceForEntity1 in entity1Instances)
            {
                if (entity1Group == null || instanceForEntity1._associatedGroup == entity1Group)
                {
                    Rectangle sourceRectangleEntity1 = instanceForEntity1.GetSourceRectangle(gameTime);

                    float entity1SourceWidth  = sourceRectangleEntity1.Width * entity1.ScaleX;
                    float entity1SourceHeight = sourceRectangleEntity1.Height * entity1.ScaleY;

                    FRectangle absBoundingRectEntity1 = new FRectangle(
                        entity1.Pos.X - entity1SourceWidth * instanceForEntity1.Drawable.Origin.X,
                        entity1.Pos.Y - entity1SourceHeight * instanceForEntity1.Drawable.Origin.Y,
                        entity1SourceWidth,
                        entity1SourceHeight
                        );

                    foreach (GameDrawableInstance instanceForEntity2 in entity2Instances)
                    {
                        if (entity2Group == null || instanceForEntity2._associatedGroup == entity2Group)
                        {
                            Rectangle sourceRectangleEntity2 = instanceForEntity2.GetSourceRectangle(gameTime);

                            float entity2SourceWidth  = sourceRectangleEntity2.Width * entity2.ScaleX;
                            float entity2SourceHeight = sourceRectangleEntity2.Height * entity2.ScaleY;

                            FRectangle absBoundingRectEntity2 = new FRectangle(
                                entity2.Pos.X - entity2SourceWidth * instanceForEntity2.Drawable.Origin.X,
                                entity2.Pos.Y - entity2SourceHeight * instanceForEntity2.Drawable.Origin.Y,
                                entity2SourceWidth,
                                entity2SourceHeight
                                );

                            // Check if the two bounding boxes intersect
                            if (absBoundingRectEntity1.Intersects(absBoundingRectEntity2))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            // No Intersection tests passed.
            return(false);
        }
Ejemplo n.º 38
0
		protected override void RecalculatePosition()
		{
			if (HUD == null) return;

			Size = new FSize(HUD.Width, HUD.Height);
			Position = new FPoint(HUD.Left, HUD.Top);
			BoundingRectangle = new FRectangle(Position, Size);
			
			PositionInvalidated = false;
		}
Ejemplo n.º 39
0
		public LineSegment(FPoint start, FPoint end)
		{
			startPoint = start;
			endPoint = end;

			direction = (end - start).NormalizedCopy();

			Length = (end - start).Length();
			Boundings = new FRectangle(FloatMath.Min(startPoint.X, endPoint.X), FloatMath.Min(startPoint.Y, endPoint.Y), FloatMath.Abs(startPoint.X - endPoint.X), FloatMath.Abs(startPoint.Y - endPoint.Y));
		}
Ejemplo n.º 40
0
		public VectorPath(List<VectorPathSegment> seg)
		{
			segments = seg;
			Length = segments.Sum(p => p.Length);

			float top = segments.Min(p => p.Boundings.Top);
			float bot = segments.Max(p => p.Boundings.Bottom);
			float lef = segments.Min(p => p.Boundings.Left);
			float rig = segments.Max(p => p.Boundings.Right);

			Boundings = new FRectangle(lef, top, rig-lef, bot-top);
		}
Ejemplo n.º 41
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (IsPointerDownOnElement)
			{
				sbatch.Draw(Textures.TexCircle, bounds, BackgroundColor.Darken());
			}
			else
			{
				sbatch.Draw(Textures.TexCircle, bounds, BackgroundColor);
			}

			sbatch.Draw(icon, bounds.AsDeflated(24, 24).AsScaled(IconScale), ForegroundColor);
		}
Ejemplo n.º 42
0
		protected override void DoDrawBackground(IBatchRenderer sbatch, FRectangle bounds)
		{
			sbatch.Draw(
				Textures.TexHUDButtonBase.Texture,
				Center,
				Textures.TexHUDButtonBase.Bounds,
				Highlighted ? FlatColors.Emerald : FlatColors.Flamingo,
				0f,
				Textures.TexHUDButtonBase.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
Ejemplo n.º 43
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			var texture = GetTexture();
				
			sbatch.Draw(
				texture.Texture,
				Center,
				texture.Bounds,
				(this.GDHUD().GDOwner.GameSpeedMode == speed) ? FlatColors.MidnightBlue : FlatColors.Clouds,
				0f,
				texture.Center(),
				Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
Ejemplo n.º 44
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			var texScale = bounds.Width / (Textures.TexHUDButtonBase.Width * Textures.DEFAULT_TEXTURE_SCALE.X);

			TextureRegion2D texIcon;

			if (FloatMath.IsZero(animationProgress))
			{
				texIcon = Textures.TexHUDButtonPause[0];
			}
			else if (FloatMath.IsOne(animationProgress))
			{
				texIcon = Textures.TexHUDButtonPause[Textures.ANIMATION_HUDBUTTONPAUSE_SIZE - 1];
			}
			else
			{
				texIcon = Textures.TexHUDButtonPause[(int)(Textures.ANIMATION_HUDBUTTONPAUSE_SIZE * animationProgress)];
			}
			
			sbatch.Draw(
				Textures.TexHUDButtonBase.Texture,
				Center,
				Textures.TexHUDButtonBase.Bounds,
				FlatColors.Asbestos,
				0f,
				Textures.TexHUDButtonBase.Center(),
				texScale * Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);

			sbatch.Draw(
				texIcon.Texture,
				Center,
				texIcon.Bounds,
				FlatColors.Clouds,
				0f,
				texIcon.Center(),
				texScale * Textures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None,
				0);
		}
Ejemplo n.º 45
0
		public WorldMapDragAgent(GDWorldMapScreen scrn) : base(scrn)
		{
			bounding = scrn.MapFullBounds;
		}
Ejemplo n.º 46
0
		public abstract void DrawEllipse(FRectangle rectangle, int sides, Color color, float thickness = 1);
Ejemplo n.º 47
0
		public abstract void Draw(TextureRegion2D textureRegion, FRectangle destinationRectangle, Color color);
Ejemplo n.º 48
0
		public abstract void DrawRectangle(FRectangle rectangle, Color color, float thickness = 1);
Ejemplo n.º 49
0
		public abstract void FillRectangle(FRectangle rectangle, Color color);
Ejemplo n.º 50
0
		public abstract void Draw(Texture2D texture, FRectangle destinationRectangle, Rectangle? sourceRectangle, Color color);
		public override void Draw(TextureRegion2D textureRegion, FRectangle destinationRectangle, Color color)
		{
#if DEBUG
			IncRenderSpriteCount();
#endif

			internalBatch.Draw(textureRegion.Texture, destinationRectangle.Truncate(), textureRegion.Bounds, color);
		}
Ejemplo n.º 52
0
		public static void DrawRoundedBlurPanelSolidPart(IBatchRenderer sbatch, FRectangle bounds, Color color, float scale = 1f)
		{
			StaticTextures.ThrowIfNotInitialized();

			#region Fill Center

			sbatch.Draw(
				StaticTextures.SinglePixel.Texture,
				bounds.AsDeflated(CROP_CORNER_SIZE * scale, 0),
				StaticTextures.SinglePixel.Bounds,
				color);

			sbatch.Draw(
				StaticTextures.SinglePixel.Texture,
				bounds.AsDeflated(0, CROP_CORNER_SIZE * scale),
				StaticTextures.SinglePixel.Bounds,
				color);

			#endregion

			#region Corners

			sbatch.Draw(
				StaticTextures.PanelCorner.Texture,
				bounds.VectorTopLeft,
				StaticTextures.PanelCorner.Bounds,
				color,
				0 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelCorner.Texture,
				bounds.VectorTopRight,
				StaticTextures.PanelCorner.Bounds,
				color,
				90 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelCorner.Texture,
				bounds.VectorBottomRight,
				StaticTextures.PanelCorner.Bounds,
				color,
				180 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelCorner.Texture,
				bounds.VectorBottomLeft,
				StaticTextures.PanelCorner.Bounds,
				color,
				270 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			#endregion
		}
Ejemplo n.º 53
0
		public static void DrawOutlinesBlurRectangle(IBatchRenderer sbatch, FRectangle bounds, float borderWidth, Color cInner, Color cBorder, float blurOuterWidth, float blurInset)
		{
			StaticTextures.ThrowIfNotInitialized();

			DrawDropShadow(sbatch, bounds, blurOuterWidth, blurInset);

			SimpleRenderHelper.DrawSimpleRect(sbatch, bounds.AsDeflated(borderWidth / 2f, borderWidth / 2f), cInner);
			
			SimpleRenderHelper.DrawSimpleRectOutline(sbatch, bounds, borderWidth, cBorder);
		}
Ejemplo n.º 54
0
		public static void DrawDropShadow(IBatchRenderer sbatch, FRectangle bounds, float sOutset, float sInset)
		{
			StaticTextures.ThrowIfNotInitialized();

			var r_tl = new FRectangle(
				bounds.Left - sOutset,
				bounds.Top - sOutset,
				sOutset + sInset,
				sOutset + sInset).Round();

			var r_tr = new FRectangle(
				bounds.Right - sInset,
				bounds.Top - sOutset,
				sOutset + sInset,
				sOutset + sInset).Round();

			var r_br = new FRectangle(
				bounds.Right - sInset,
				bounds.Bottom - sInset,
				sOutset + sInset,
				sOutset + sInset).Round();

			var r_bl = new FRectangle(
				bounds.Left - sOutset,
				bounds.Bottom - sInset,
				sOutset + sInset,
				sOutset + sInset).Round();

			var r_l = new Rectangle(r_tl.Left, r_tl.Bottom, r_tl.Width, r_bl.Top - r_tl.Bottom);

			var r_t = new Rectangle(r_tl.Right, r_tl.Top, r_tr.Left - r_tl.Right, r_tl.Height);

			var r_r = new Rectangle(r_tr.Left, r_tr.Bottom, r_tr.Width, r_br.Top - r_tr.Bottom);

			var r_b = new Rectangle(r_bl.Right, r_bl.Top, r_br.Left - r_bl.Right, r_bl.Height);
			
			// Top
			sbatch.DrawRot000(StaticTextures.PanelBlurEdge.Texture, r_t, StaticTextures.PanelBlurEdge.Bounds, Color.White, 0);

			// Right
			sbatch.DrawRot090(StaticTextures.PanelBlurEdge.Texture, r_r, StaticTextures.PanelBlurEdge.Bounds, Color.White, 0);

			// Bottom
			sbatch.DrawRot180(StaticTextures.PanelBlurEdge.Texture, r_b, StaticTextures.PanelBlurEdge.Bounds, Color.White, 0);

			// Left
			sbatch.DrawRot270(StaticTextures.PanelBlurEdge.Texture, r_l, StaticTextures.PanelBlurEdge.Bounds, Color.White, 0);
			
			// TL
			sbatch.DrawRot000(StaticTextures.PanelBlurCorner.Texture, r_tl, StaticTextures.PanelBlurCorner.Bounds, Color.White, 0);

			// TR
			sbatch.DrawRot090(StaticTextures.PanelBlurCorner.Texture, r_tr, StaticTextures.PanelBlurCorner.Bounds, Color.White, 0);

			// BR
			sbatch.DrawRot180(StaticTextures.PanelBlurCorner.Texture, r_br, StaticTextures.PanelBlurCorner.Bounds, Color.White, 0);

			// BL
			sbatch.DrawRot270(StaticTextures.PanelBlurCorner.Texture, r_bl, StaticTextures.PanelBlurCorner.Bounds, Color.White, 0);
		}
		public override void DrawEllipse(FRectangle rectangle, int sides, Color color, float thickness = 1f)
		{
			DrawPolygon(rectangle.Center, CreateEllipse(rectangle.Width, rectangle.Height, sides), color, true, thickness);
		}
Ejemplo n.º 56
0
		public abstract void Draw(Texture2D texture, FRectangle destinationRectangle, Rectangle? sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth);
Ejemplo n.º 57
0
		public static void DrawRoundedBlurPanelBackgroundPart(IBatchRenderer sbatch, FRectangle bounds, float scale = 1f)
		{
			StaticTextures.ThrowIfNotInitialized();

			var cornerSize = (int) (scale * CROP_CORNER_SIZE);

			#region Blur Edges

			sbatch.Draw(
				StaticTextures.PanelBlurEdge.Texture,
				new FRectangle(
					bounds.Left + cornerSize,
					bounds.Top - cornerSize,
					bounds.Width - 2 * cornerSize,
					2 * cornerSize),
				StaticTextures.PanelBlurEdge.Bounds,
				Color.White,
				0 * FloatMath.DegreesToRadians,
				Vector2.Zero, SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurEdge.Texture,
				new FRectangle(
					bounds.Right - cornerSize + (2 * cornerSize),
					bounds.Top + cornerSize,
					bounds.Height - 2 * cornerSize,
					2 * cornerSize
					),
				StaticTextures.PanelBlurEdge.Bounds,
				Color.White,
				90 * FloatMath.DegreesToRadians,
				Vector2.Zero, SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurEdge.Texture,
				new FRectangle(
					bounds.Left + cornerSize + (bounds.Width - 2 * cornerSize),
					bounds.Bottom - cornerSize + (2 * cornerSize),
					bounds.Width - 2 * cornerSize,
					2 * cornerSize),
				StaticTextures.PanelBlurEdge.Bounds,
				Color.White,
				180 * FloatMath.DegreesToRadians,
				Vector2.Zero, SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurEdge.Texture,
				new FRectangle(
					bounds.Left - cornerSize,
					bounds.Top + cornerSize + (bounds.Height - 2 * cornerSize),
					bounds.Height - 2 * cornerSize,
					2 * cornerSize),
				StaticTextures.PanelBlurEdge.Bounds,
				Color.White,
				270 * FloatMath.DegreesToRadians,
				Vector2.Zero, SpriteEffects.None, 0);

			#endregion

			#region Blur Corners

			sbatch.Draw(
				StaticTextures.PanelBlurCorner.Texture,
				bounds.VectorTopLeft + scale * CORNER_VECTOR_TL,
				StaticTextures.PanelBlurCorner.Bounds,
				Color.White,
				0 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurCorner.Texture,
				bounds.VectorTopRight + scale * CORNER_VECTOR_TR,
				StaticTextures.PanelBlurCorner.Bounds,
				Color.White,
				90 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurCorner.Texture,
				bounds.VectorBottomRight + scale * CORNER_VECTOR_BR,
				StaticTextures.PanelBlurCorner.Bounds,
				Color.White,
				180 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			sbatch.Draw(
				StaticTextures.PanelBlurCorner.Texture,
				bounds.VectorBottomLeft + scale * CORNER_VECTOR_BL,
				StaticTextures.PanelBlurCorner.Bounds,
				Color.White,
				270 * FloatMath.DegreesToRadians,
				Vector2.Zero,
				scale * StaticTextures.DEFAULT_TEXTURE_SCALE,
				SpriteEffects.None, 0);

			#endregion
		}
		public override void FillCircle(Vector2 center, float radius, int sides, Color color)
		{
#if DEBUG
			IncRenderSpriteCount(sides);
#endif

			float angle = FloatMath.TAU / sides;
			float sideWidth = FloatMath.Asin(angle / 2) * 2 * radius;
			float rectHeight = FloatMath.Sin(FloatMath.RAD_POS_090 - angle / 2) * radius;

			
			var r = new FRectangle(center.X - sideWidth/2, center.Y, sideWidth, rectHeight);
			
			for (int i = 0; i < sides; i++)
			{
				internalBatch.Draw(
					StaticTextures.SinglePixel.Texture,
					null,
					r.Round(),
					StaticTextures.SinglePixel.Bounds,
					new Vector2(0.5f, 0),
					angle * i,
					Vector2.One, 
					color);
			}
		}
Ejemplo n.º 59
0
		public abstract void Draw(Texture2D texture, Vector2? position = null, FRectangle? destinationRectangle = null, Rectangle? sourceRectangle = null, Vector2? origin = null, float rotation = 0, Vector2? scale = null, Color? color = null, SpriteEffects effects = SpriteEffects.None, float layerDepth = 0);
Ejemplo n.º 60
0
		protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
		{
			if (Color == Color.Transparent) return;

			SimpleRenderHelper.DrawSimpleRect(sbatch, bounds, Color);
		}