public static void DrawGlassWall(IBatchRenderer sbatch, FRotatedRectangle rect) { SimpleRenderHelper.Draw9Patch( sbatch, rect, Color.White, Color.White, Color.White, Textures.TexGlassEdge, Textures.TexGlassCorner, Textures.TexGlassFill, GlassBlock.CORNER_SIZE); }
public static void DrawMirrorWall(IBatchRenderer sbatch, FRotatedRectangle rect) { SimpleRenderHelper.Draw9Patch( sbatch, rect, Color.White, Color.White, FlatColors.Concrete, Textures.TexMirrorBlockEdge, Textures.TexMirrorBlockCorner, Textures.TexPixel, MirrorBlock.CORNER_SIZE); }
public void DrawRectangle(FRotatedRectangle rectangle, Color color, float thickness = 1f) { var tl = rectangle.TopLeft; var tr = rectangle.TopRight; var bl = rectangle.BottomLeft; var br = rectangle.BottomRight; DrawLine(tl, tr, color, thickness); DrawLine(tr, br, color, thickness); DrawLine(br, bl, color, thickness); DrawLine(bl, tl, color, thickness); }
public MirrorBlock(GDGameScreen scrn, MirrorBlockBlueprint blueprint) : base(scrn, GDConstants.ORDER_GAME_WALL) { var pos = new FPoint(blueprint.X, blueprint.Y); _width = blueprint.Width; _height = blueprint.Height; _rotation = FloatMath.ToRadians(blueprint.Rotation); _bounds = new FRotatedRectangle(pos, _width, _height, _rotation); Position = pos; DrawingBoundingBox = _bounds.OuterSize; this.GDOwner().GDBackground.RegisterBlockedBlock(_bounds.WithNoRotation(), _rotation); }
public BackgroundText(GDGameScreen scrn, BackgroundTextBlueprint blueprint) : base(scrn, GDConstants.ORDER_GAME_BACKGROUNDTEXT) { var pos = new FPoint(blueprint.X, blueprint.Y); Blueprint = blueprint; _rotation = FloatMath.ToRadians(blueprint.Rotation); _bounds = new FRotatedRectangle(pos, blueprint.Width, blueprint.Height, _rotation); Position = pos; DrawingBoundingBox = _bounds.OuterSize; _text = FontRenderHelper.MakeTextSafe(Textures.LevelBackgroundFont, L10N.T(blueprint.L10NText), '_'); _scale = FontRenderHelper.GetFontScale(Textures.LevelBackgroundFont, _text, _bounds.Size); if ((Blueprint.Config & BackgroundTextBlueprint.CONFIG_SHAKE) == BackgroundTextBlueprint.CONFIG_SHAKE) { AddOperation(new ShakeTextOperation()); } if ((Blueprint.Config & BackgroundTextBlueprint.CONFIG_ONLYD1) == BackgroundTextBlueprint.CONFIG_ONLYD1) { if (scrn.Difficulty != FractionDifficulty.DIFF_0) { Alive = false; } } if ((Blueprint.Config & BackgroundTextBlueprint.CONFIG_ONLY_UNCLEARED) == BackgroundTextBlueprint.CONFIG_ONLY_UNCLEARED) { if (MainGame.Inst.Profile.GetLevelData(scrn.Blueprint).HasCompletedOrBetter(scrn.Difficulty)) { Alive = false; } } if ((Blueprint.Config & BackgroundTextBlueprint.CONFIG_REDFLASH) == BackgroundTextBlueprint.CONFIG_REDFLASH) { AddOperation(new RedFlashTextOperation()); } if (scrn.IsPreview) { Alive = false; } }
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; } }
public FRotatedRectangle GetArea() { switch (WallType) { case WallStubType.Void: return(FRotatedRectangle.CreateByCenter(FPoint.MiddlePoint(Point1, Point2), (Point2 - Point1).Length(), VoidWallBlueprint.DEFAULT_WIDTH, (Point2 - Point1).ToAngle())); case WallStubType.Glass: return(FRotatedRectangle.CreateByCenter(FPoint.MiddlePoint(Point1, Point2), (Point2 - Point1).Length(), GlassBlockBlueprint.DEFAULT_WIDTH, (Point2 - Point1).ToAngle())); case WallStubType.Mirror: return(FRotatedRectangle.CreateByCenter(FPoint.MiddlePoint(Point1, Point2), (Point2 - Point1).Length(), MirrorBlockBlueprint.DEFAULT_WIDTH, (Point2 - Point1).ToAngle())); default: SAMLog.Error("LEWS::EnumSwitch_GA", "WallType = " + WallType); return(default(FRotatedRectangle)); } }
public FRotatedRectangle GetShortenedArea() { return(FRotatedRectangle.CreateByCenter(Center, Length - 17, Portal.WIDTH, Normal + FloatMath.RAD_NEG_090)); }
public IFShape GetClickArea() { return(FRotatedRectangle.CreateByCenter(Center, Length + GDConstants.TILE_WIDTH, Portal.WIDTH + GDConstants.TILE_WIDTH, Normal + FloatMath.RAD_NEG_090)); }
public static void Draw9Patch(IBatchRenderer sbatch, FRotatedRectangle bounds, Color colEdge, Color colCorner, Color colFill, TextureRegion2D texEdge, TextureRegion2D texCorner, TextureRegion2D texFill, float cornerSize) { Draw9Patch(sbatch, bounds.WithNoRotation(), colEdge, colCorner, colFill, texEdge, texCorner, texFill, cornerSize, bounds.Rotation); }