Display "Paused" message when paused.
Add a new "Banner" style font for the pause message. GitOrigin-RevId: 62f9537574351b961d7a2bd74f12e218f1047062
This commit is contained in:
parent
544b8d2464
commit
f8fa66385d
@ -45,7 +45,7 @@ namespace SemiColinGames {
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public void Draw(World world, Player player, LinesOfSight linesOfSight) {
|
||||
public void Draw(World world, Player player, LinesOfSight linesOfSight, bool paused) {
|
||||
graphics.SetRenderTarget(null);
|
||||
graphics.Clear(backgroundColor);
|
||||
if (!Enabled) {
|
||||
@ -94,6 +94,28 @@ namespace SemiColinGames {
|
||||
// Draw debug rects & lines on top.
|
||||
Debug.Draw(graphics, basicEffect);
|
||||
|
||||
// Draw in-world UI on top of everything.
|
||||
// TODO: make a Text.cs file and move things like "black outlined text" there.
|
||||
if (paused) {
|
||||
string text = "Paused";
|
||||
Vector2 size = Textures.BannerFont.MeasureString(text);
|
||||
Vector2 position = new Vector2((camera.Width - size.X) / 2, (camera.Height - size.Y) / 2);
|
||||
|
||||
spriteBatch.Begin(
|
||||
SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null, null, null);
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
if (i == 0 && j == 0) {
|
||||
continue;
|
||||
}
|
||||
Vector2 stencilPos = new Vector2(position.X + i, position.Y + j);
|
||||
spriteBatch.DrawString(Textures.BannerFont, text, stencilPos, Color.Black);
|
||||
}
|
||||
}
|
||||
spriteBatch.DrawString(Textures.BannerFont, text, position, Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
// Get ready to draw sceneTarget to screen.
|
||||
graphics.SetRenderTarget(null);
|
||||
|
||||
|
@ -133,6 +133,7 @@ namespace SemiColinGames {
|
||||
drawTimer.Start();
|
||||
|
||||
// Enable the scene after we've gotten enough non-slow frames.
|
||||
// TODO: the Scene should handle this, really.
|
||||
if (framesToSuppress > 0 && !gameTime.IsRunningSlowly) {
|
||||
framesToSuppress--;
|
||||
if (framesToSuppress == 0) {
|
||||
@ -151,7 +152,7 @@ namespace SemiColinGames {
|
||||
|
||||
Debug.SetFpsText(fpsText);
|
||||
|
||||
scene.Draw(world, player, linesOfSight);
|
||||
scene.Draw(world, player, linesOfSight, paused);
|
||||
|
||||
base.Draw(gameTime);
|
||||
drawTimer.Stop();
|
||||
|
@ -31,6 +31,7 @@ namespace SemiColinGames {
|
||||
class Textures {
|
||||
|
||||
public static SpriteFont DebugFont;
|
||||
public static SpriteFont BannerFont;
|
||||
|
||||
public static TextureRef Player = new TextureRef("sprites/ccg/ninja_female");
|
||||
|
||||
@ -54,7 +55,8 @@ namespace SemiColinGames {
|
||||
public static TextureRef Village = new TextureRef("tiles/anokolisa/village");
|
||||
|
||||
public static void Load(ContentManager content) {
|
||||
DebugFont = content.Load<SpriteFont>("font");
|
||||
DebugFont = content.Load<SpriteFont>("fonts/debug");
|
||||
BannerFont = content.Load<SpriteFont>("fonts/banner");
|
||||
TextureRef.LoadAll(content);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user