remove some magic values from scoreRenderer
parent
17bed9c60b
commit
670ac8e247
|
@ -43,7 +43,10 @@ namespace PongFE
|
|||
WhitePixel = new Texture2D(GraphicsDevice, 1, 1);
|
||||
WhitePixel.SetData(new Color[] { Color.White });
|
||||
|
||||
ScoreFont = DynamicSpriteFont.FromTtf(File.ReadAllBytes(@"Content/Fonts/SquaredDisplay.ttf"), 128);
|
||||
ScoreFont = DynamicSpriteFont.FromTtf(
|
||||
File.ReadAllBytes(@"Content/Fonts/SquaredDisplay.ttf"),
|
||||
128
|
||||
);
|
||||
|
||||
WorldBuilder.AddEngine(new InputEngine());
|
||||
WorldBuilder.AddEngine(new PaddleMovementEngine());
|
||||
|
|
|
@ -11,6 +11,8 @@ namespace PongFE.Renderers
|
|||
{
|
||||
public SpriteBatch SpriteBatch { get; }
|
||||
public DynamicSpriteFont Font { get; }
|
||||
public int SpacingFromCenter { get; } = 240;
|
||||
public int SpacingFromTop { get; } = 20;
|
||||
|
||||
public ScoreRenderer(SpriteBatch spriteBatch, DynamicSpriteFont font)
|
||||
{
|
||||
|
@ -43,7 +45,7 @@ namespace PongFE.Renderers
|
|||
SpriteBatch.DrawString(
|
||||
Font,
|
||||
playerOneScore.Value.ToString(),
|
||||
new Vector2(400, 20),
|
||||
new Vector2(640 - SpacingFromCenter, SpacingFromTop),
|
||||
Color.White
|
||||
);
|
||||
}
|
||||
|
@ -53,7 +55,7 @@ namespace PongFE.Renderers
|
|||
SpriteBatch.DrawString(
|
||||
Font,
|
||||
playerTwoScore.Value.ToString(),
|
||||
new Vector2(880 - 64, 20),
|
||||
new Vector2(640 + SpacingFromCenter - (Font.Size / 2), SpacingFromTop),
|
||||
Color.White
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue