diff options
| author | Michael <[email protected]> | 2017-07-25 21:41:57 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-07-25 21:41:57 -0400 |
| commit | 214fe4deafa25021a528483cac23a6b37176d551 (patch) | |
| tree | 67af08e3a0357f9bb2a614273192ef6b6cfc787f /ShiftOS.Frontend/MainMenu.cs | |
| parent | 6114fe5af6faa679c477cf8eb9fccb95029df3b5 (diff) | |
| download | shiftos_thereturn-214fe4deafa25021a528483cac23a6b37176d551.tar.gz shiftos_thereturn-214fe4deafa25021a528483cac23a6b37176d551.tar.bz2 shiftos_thereturn-214fe4deafa25021a528483cac23a6b37176d551.zip | |
campaign and sandbox buttons
Diffstat (limited to 'ShiftOS.Frontend/MainMenu.cs')
| -rw-r--r-- | ShiftOS.Frontend/MainMenu.cs | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/ShiftOS.Frontend/MainMenu.cs b/ShiftOS.Frontend/MainMenu.cs index 0d2b1ef..9d11177 100644 --- a/ShiftOS.Frontend/MainMenu.cs +++ b/ShiftOS.Frontend/MainMenu.cs @@ -12,12 +12,66 @@ namespace ShiftOS.Frontend { public class MainMenu : GUI.Control { + private TextControl _mainTitle = new TextControl(); + private TextControl _menuTitle = new TextControl(); + private Button _campaign = new Button(); + private Button _sandbox = new Button(); + public MainMenu() { X = 0; Y = 0; Width = UIManager.Viewport.Width; Height = UIManager.Viewport.Height; + + AddControl(_mainTitle); + AddControl(_menuTitle); + AddControl(_campaign); + AddControl(_sandbox); + + _campaign.Text = "Campaign"; + _campaign.Font = new System.Drawing.Font("Lucida Console", 10F); + _campaign.Width = 200; + _campaign.Height = 6 + _campaign.Font.Height; + _campaign.X = 30; + + _sandbox.Text = "Sandbox"; + _sandbox.Width = 200; + _sandbox.Height = 6 + _campaign.Font.Height; + _sandbox.Font = _campaign.Font; + _sandbox.X = 30; + + _mainTitle.X = 30; + _mainTitle.Y = 30; + _mainTitle.Font = new System.Drawing.Font("Lucida Console", 48F); + _mainTitle.AutoSize = true; + _mainTitle.Text = "ShiftOS"; + + _menuTitle.Text = "Main menu"; + _menuTitle.Font = new System.Drawing.Font(_menuTitle.Font.Name, 16F); + _menuTitle.X = 30; + _menuTitle.Y = _mainTitle.Y + _mainTitle.Font.Height + 10; + + _campaign.Y = _menuTitle.Y + _menuTitle.Font.Height + 15; + _sandbox.Y = _campaign.Y + _campaign.Font.Height + 15; + _campaign.Click += () => + { + SaveSystem.IsSandbox = false; + SaveSystem.Begin(false); + Close(); + }; + _sandbox.Click += () => + { + SaveSystem.IsSandbox = true; + SaveSystem.Begin(false); + Close(); + }; + + } + + public void Close() + { + UIManager.StopHandling(this); } private Color _redbg = new Color(127, 0, 0, 255); @@ -28,7 +82,7 @@ namespace ShiftOS.Frontend protected override void OnLayout(GameTime gameTime) { if (_lerpdir == 1) - _bglerp += 0.001f; + _bglerp += 0.0001f; else _bglerp -= 0.001f; if (_bglerp <= 0.0) @@ -41,8 +95,7 @@ namespace ShiftOS.Frontend protected override void OnPaint(GraphicsContext gfx) { gfx.DrawRectangle(0, 0, Width, Height, Color.Lerp(_redbg, _bluebg, _bglerp)); - gfx.DrawString("ShiftOS", 30, 30, Color.White, new System.Drawing.Font("Consolas", 48f)); - + } } } |
