campaign and sandbox buttons
This commit is contained in:
parent
6114fe5af6
commit
214fe4deaf
1 changed files with 56 additions and 3 deletions
|
@ -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));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue