-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInsertCoinWarningView.cs
More file actions
28 lines (22 loc) · 911 Bytes
/
InsertCoinWarningView.cs
File metadata and controls
28 lines (22 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Drawing;
using AsteroidsGdiApp.Core;
namespace AsteroidsGdiApp.GameObjects
{
public class InsertCoinWarningView
{
public void Draw(Graphics graphics)
{
Draw(graphics, "PRESS S TO START GAME!", 0);
Draw(graphics, "F to shoot and arrows to move ship", 20);
Draw(graphics, "X to exit game", 40);
}
public void Draw(Graphics graphics, string message, int offset)
{
Font _font = new Font("Courier New", 12);
var messageSize = graphics.MeasureString(message, _font);
Point position = new Point((int)(Constants.CanvasWidth / 2 - messageSize.Width / 2),
(int)(Constants.CanvasWidth / 2 - messageSize.Height / 2 + offset));
graphics.DrawString(message, _font, Brushes.White, position);
}
}
}