diff --git a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs index 331018f..e75b00d 100644 --- a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs +++ b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs @@ -118,7 +118,7 @@ namespace ShiftOS.Frontend.GraphicsSubsystem x += _startx; y += _starty; var tex2 = new Texture2D(_graphicsDevice, 1, 1, false, SurfaceFormat.Color); - byte[] colordata = new byte[] { color.B, color.G, color.R, color.A }; + byte[] colordata = new byte[] { 255, 255, 255, 255 }; tex2.SetData(colordata); _spritebatch.Draw(tex2, new Rectangle(x, y, width, height), color); } diff --git a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs index b45b2ff..7bb534e 100644 --- a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs +++ b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs @@ -104,8 +104,8 @@ namespace ShiftOS.Frontend.GraphicsSubsystem { _target = new RenderTarget2D( graphics, - ctrl.Width, - ctrl.Height, + Math.Max(1,ctrl.Width), + Math.Max(1,ctrl.Height), false, graphics.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); diff --git a/ShiftOS.Frontend/MainMenu.cs b/ShiftOS.Frontend/MainMenu.cs new file mode 100644 index 0000000..0d2b1ef --- /dev/null +++ b/ShiftOS.Frontend/MainMenu.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; +using ShiftOS.Frontend.GUI; +using ShiftOS.Frontend.GraphicsSubsystem; +using Microsoft.Xna.Framework; + +namespace ShiftOS.Frontend +{ + public class MainMenu : GUI.Control + { + public MainMenu() + { + X = 0; + Y = 0; + Width = UIManager.Viewport.Width; + Height = UIManager.Viewport.Height; + } + + private Color _redbg = new Color(127, 0, 0, 255); + private Color _bluebg = new Color(0, 0, 127, 255); + private float _bglerp = 0.0f; + private int _lerpdir = 1; + + protected override void OnLayout(GameTime gameTime) + { + if (_lerpdir == 1) + _bglerp += 0.001f; + else + _bglerp -= 0.001f; + if (_bglerp <= 0.0) + _lerpdir = 1; + else if (_bglerp >= 1) + _lerpdir = -1; + Invalidate(); + } + + 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)); + + } + } +} diff --git a/ShiftOS.Frontend/ShiftOS.Frontend.csproj b/ShiftOS.Frontend/ShiftOS.Frontend.csproj index 0a417a9..8512511 100644 --- a/ShiftOS.Frontend/ShiftOS.Frontend.csproj +++ b/ShiftOS.Frontend/ShiftOS.Frontend.csproj @@ -64,6 +64,7 @@ + diff --git a/ShiftOS.Frontend/ShiftOS.cs b/ShiftOS.Frontend/ShiftOS.cs index 4a563c2..cf52b64 100644 --- a/ShiftOS.Frontend/ShiftOS.cs +++ b/ShiftOS.Frontend/ShiftOS.cs @@ -96,9 +96,10 @@ namespace ShiftOS.Frontend FileSkimmerBackend.Init(new MGFSLayer()); - //We'll use sandbox mode - SaveSystem.IsSandbox = false; - SaveSystem.Begin(true); + + //Create a main menu + var mm = new MainMenu(); + UIManager.AddTopLevel(mm); base.Initialize();