aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.Frontend')
-rw-r--r--ShiftOS.Frontend/Content/Content.mgcb15
-rw-r--r--ShiftOS.Frontend/Desktop/WindowManager.cs92
-rw-r--r--ShiftOS.Frontend/GUI/Control.cs271
-rw-r--r--ShiftOS.Frontend/GUI/TextControl.cs72
-rw-r--r--ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs82
-rw-r--r--ShiftOS.Frontend/Icon.bmpbin0 -> 262282 bytes
-rw-r--r--ShiftOS.Frontend/Icon.icobin0 -> 147541 bytes
-rw-r--r--ShiftOS.Frontend/Program.cs20
-rw-r--r--ShiftOS.Frontend/Properties/AssemblyInfo.cs36
-rw-r--r--ShiftOS.Frontend/ShiftOS.Frontend.csproj134
-rw-r--r--ShiftOS.Frontend/ShiftOS.cs117
-rw-r--r--ShiftOS.Frontend/Window.cs32
-rw-r--r--ShiftOS.Frontend/app.manifest42
13 files changed, 913 insertions, 0 deletions
diff --git a/ShiftOS.Frontend/Content/Content.mgcb b/ShiftOS.Frontend/Content/Content.mgcb
new file mode 100644
index 0000000..ddc4c36
--- /dev/null
+++ b/ShiftOS.Frontend/Content/Content.mgcb
@@ -0,0 +1,15 @@
+
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin/$(Platform)
+/intermediateDir:obj/$(Platform)
+/platform:DesktopGL
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+
+#---------------------------------- Content ---------------------------------#
+
diff --git a/ShiftOS.Frontend/Desktop/WindowManager.cs b/ShiftOS.Frontend/Desktop/WindowManager.cs
new file mode 100644
index 0000000..d17cd37
--- /dev/null
+++ b/ShiftOS.Frontend/Desktop/WindowManager.cs
@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ShiftOS.Engine;
+using ShiftOS.Frontend.GraphicsSubsystem;
+
+namespace ShiftOS.Frontend.Desktop
+{
+ public class WindowManager : Engine.WindowManager
+ {
+ public override void Close(IShiftOSWindow win)
+ {
+
+ }
+
+ public override void InvokeAction(Action act)
+ {
+ act?.Invoke();
+ }
+
+ public override void Maximize(IWindowBorder border)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void Minimize(IWindowBorder border)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void SetTitle(IShiftOSWindow win, string title)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void SetupDialog(IShiftOSWindow win)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void SetupWindow(IShiftOSWindow win)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class WindowBorder : GUI.Control, IWindowBorder
+ {
+ private string _text = "ShiftOS window";
+ private GUI.Control _hostedwindow = null;
+
+ public IShiftOSWindow ParentWindow
+ {
+ get
+ {
+ return (IShiftOSWindow)_hostedwindow;
+ }
+
+ set
+ {
+ _hostedwindow = (GUI.Control)value;
+ }
+ }
+
+ public string Text
+ {
+ get
+ {
+ return _text;
+ }
+
+ set
+ {
+ _text = value;
+ }
+ }
+
+ public void Close()
+ {
+ Visible = false;
+ UIManager.StopHandling(this);
+ }
+
+ public override void MouseStateChanged()
+ {
+ //todo: close, minimize, maximize, drag, resize
+
+ }
+ }
+}
diff --git a/ShiftOS.Frontend/GUI/Control.cs b/ShiftOS.Frontend/GUI/Control.cs
new file mode 100644
index 0000000..975c69a
--- /dev/null
+++ b/ShiftOS.Frontend/GUI/Control.cs
@@ -0,0 +1,271 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+
+namespace ShiftOS.Frontend.GUI
+{
+ public abstract class Control
+ {
+ private int _x = 0;
+ private int _y = 0;
+ private int _w = 0;
+ private int _h = 0;
+ private Control _parent = null;
+ private List<Control> _children = new List<Control>();
+ private bool _wasMouseInControl = false;
+ private bool _leftState = false;
+ private bool _rightState = false;
+ private bool _middleState = false;
+ private bool _visible = true;
+
+ public bool Visible
+ {
+ get
+ {
+ return _visible;
+ }
+ set
+ {
+ _visible = value;
+ }
+ }
+
+ public void AddControl(Control ctrl)
+ {
+ if (!_children.Contains(ctrl))
+ {
+ ctrl._parent = this;
+ _children.Add(ctrl);
+ }
+ }
+
+ public bool MouseLeftDown
+ {
+ get
+ {
+ return _leftState;
+ }
+ }
+
+ public bool MouseMiddleDown
+ {
+ get
+ {
+ return _middleState;
+ }
+ }
+
+ public bool MouseRightDown
+ {
+ get
+ {
+ return _rightState;
+ }
+ }
+
+
+
+ public int X
+ {
+ get
+ {
+ return _x;
+ }
+ set
+ {
+ _x = value;
+ }
+ }
+
+ public int Y
+ {
+ get
+ {
+ return _y;
+ }
+ set
+ {
+ _y = value;
+ }
+ }
+
+ public int Width
+ {
+ get
+ {
+ return _w;
+ }
+ set
+ {
+ _w = value;
+ }
+ }
+
+ public int Height
+ {
+ get
+ {
+ return _h;
+ }
+ set
+ {
+ _h = value;
+ }
+ }
+
+ public Control Parent
+ {
+ get
+ {
+ return _parent;
+ }
+ }
+
+ public Control[] Children
+ {
+ get
+ {
+ return _children.ToArray();
+ }
+ }
+
+ public Point PointToParent(int x, int y)
+ {
+ return new Point(x + _x, y + _y);
+ }
+
+ public Point PointToScreen(int x, int y)
+ {
+ var parentCoords = PointToParent(x, y);
+ Control parent = this._parent;
+ while(parent != null)
+ {
+ parentCoords = parent.PointToParent(parentCoords.X, parentCoords.Y);
+ parent = parent.Parent;
+ }
+ return parentCoords;
+ }
+
+ public Point PointToLocal(int x, int y)
+ {
+ return new GUI.Point(x - _x, y - _y);
+ }
+
+ public virtual void MouseStateChanged() { }
+
+ public virtual void Paint(System.Drawing.Graphics gfx)
+ {
+ if (_visible == true)
+ {
+ if (_children.Count > 0)
+ {
+ foreach (var child in _children)
+ {
+ using (var cBmp = new System.Drawing.Bitmap(child.Width, child.Height))
+ {
+ child.Paint(System.Drawing.Graphics.FromImage(cBmp));
+ gfx.DrawImage(cBmp, new System.Drawing.Point(child.X, child.Y));
+ }
+ }
+ }
+ }
+ }
+
+ public virtual bool ProcessMouseState(MouseState state)
+ {
+ //If we aren't rendering the control, we aren't accepting input.
+ if (_visible == false)
+ return false;
+
+
+ //Firstly, we get the mouse coordinates in the local space
+ var coords = PointToLocal(state.Position.X, state.Position.Y);
+ //Now we check if the mouse is within the bounds of the control
+ if(coords.X > 0 && coords.Y > 0 && coords.X <= _w && coords.Y <= _h)
+ {
+ //We're in the local space. Let's fire the MouseMove event.
+ MouseMove?.Invoke(coords);
+ //Also, if the mouse hasn't been in the local space last time it moved, fire MouseEnter.
+ if(_wasMouseInControl == false)
+ {
+ _wasMouseInControl = true;
+ MouseEnter?.Invoke();
+ }
+
+ //Things are going to get a bit complicated.
+ //Firstly, we need to find out if we have any children.
+ bool _requiresMoreWork = true;
+ if(_children.Count > 0)
+ {
+ //We do. We're going to iterate through them all and process the mouse state.
+ foreach(var control in _children)
+ {
+
+ //If the process method returns true, then we do not need to do anything else on our end.
+
+ //We need to first create a new mousestate object with the new coordinates
+
+ var nstate = new MouseState(coords.X, coords.Y, state.ScrollWheelValue, state.LeftButton, state.MiddleButton, state.RightButton, state.XButton1, state.XButton2);
+ //pass that state to the process method, and set the _requiresMoreWork value to the opposite of the return value
+ _requiresMoreWork = !control.ProcessMouseState(nstate);
+ //If it's false, break the loop.
+ if (_requiresMoreWork == false)
+ break;
+ }
+ }
+
+ //If we need to do more work...
+ if(_requiresMoreWork == true)
+ {
+ bool fire = false; //so we know to fire a MouseStateChanged method
+ //Let's get the state values of each button
+ bool ld = state.LeftButton == ButtonState.Pressed;
+ bool md = state.MiddleButton == ButtonState.Pressed;
+ bool rd = state.RightButton == ButtonState.Pressed;
+ if(ld != _leftState || md != _middleState || rd != _rightState)
+ {
+ fire = true;
+ }
+ _leftState = ld;
+ _middleState = md;
+ _rightState = rd;
+ if (fire)
+ MouseStateChanged();
+ }
+ return true;
+ }
+ else
+ {
+ //If the mouse was in local space before, fire MouseLeave
+ if(_wasMouseInControl == true)
+ {
+ _wasMouseInControl = false;
+ MouseLeave?.Invoke();
+ }
+ }
+ //Mouse is not in the local space, don't do anything.
+ return false;
+ }
+
+ public event Action<Point> MouseMove;
+ public event Action MouseEnter;
+ public event Action MouseLeave;
+ }
+
+ public struct Point
+ {
+ public Point(int x, int y)
+ {
+ X = x;
+ Y = y;
+ }
+
+ public int X { get; set; }
+ public int Y { get; set; }
+ }
+
+}
diff --git a/ShiftOS.Frontend/GUI/TextControl.cs b/ShiftOS.Frontend/GUI/TextControl.cs
new file mode 100644
index 0000000..06d8233
--- /dev/null
+++ b/ShiftOS.Frontend/GUI/TextControl.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShiftOS.Frontend.GUI
+{
+ public class TextControl : Control
+ {
+ private string _text = "Text Control";
+ private TextAlign _textAlign = TextAlign.TopLeft;
+ private Font _font = new Font("Tahoma", 9f);
+
+ public override void Paint(Graphics gfx)
+ {
+ var sMeasure = gfx.MeasureString(_text, _font);
+ PointF loc = new PointF(2, 2);
+ float centerH = (Width - sMeasure.Width) / 2;
+ float centerV = (Height - sMeasure.Height) / 2;
+ switch (_textAlign)
+ {
+ case TextAlign.TopCenter:
+ loc.X = centerH;
+ break;
+ case TextAlign.TopRight:
+ loc.X = Width - sMeasure.Width;
+ break;
+ case TextAlign.MiddleLeft:
+ loc.Y = centerV;
+ break;
+ case TextAlign.MiddleCenter:
+ loc.Y = centerV;
+ loc.X = centerH;
+ break;
+ case TextAlign.MiddleRight:
+ loc.Y = centerV;
+ loc.X = (Width - sMeasure.Width);
+ break;
+ case TextAlign.BottomLeft:
+ loc.Y = (Height - sMeasure.Height);
+ break;
+ case TextAlign.BottomCenter:
+ loc.Y = (Height - sMeasure.Height);
+ loc.X = centerH;
+ break;
+ case TextAlign.BottomRight:
+ loc.Y = (Height - sMeasure.Height);
+ loc.X = (Width - sMeasure.Width);
+ break;
+
+
+ }
+
+ gfx.DrawString(_text, _font, new SolidBrush(Color.White), new RectangleF(loc.X, loc.Y, sMeasure.Width, sMeasure.Height));
+ }
+ }
+
+ public enum TextAlign
+ {
+ TopLeft,
+ TopCenter,
+ TopRight,
+ MiddleLeft,
+ MiddleCenter,
+ MiddleRight,
+ BottomLeft,
+ BottomCenter,
+ BottomRight
+ }
+}
diff --git a/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs
new file mode 100644
index 0000000..fdd5f99
--- /dev/null
+++ b/ShiftOS.Frontend/GraphicsSubsystem/UIManager.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using ShiftOS.Engine;
+using ShiftOS.Frontend.Desktop;
+
+namespace ShiftOS.Frontend.GraphicsSubsystem
+{
+ public static class UIManager
+ {
+ private static List<GUI.Control> topLevels = new List<GUI.Control>();
+
+ public static void DrawControls(GraphicsDevice graphics, SpriteBatch batch)
+ {
+ foreach (var ctrl in topLevels)
+ {
+ using(var bmp = new System.Drawing.Bitmap(ctrl.Width, ctrl.Height))
+ {
+ var gfx = System.Drawing.Graphics.FromImage(bmp);
+ ctrl.Paint(gfx);
+ //get the bits of the bitmap
+ var data = bmp.LockBits(new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ byte[] rgb = new byte[Math.Abs(data.Stride) * data.Height];
+ Marshal.Copy(data.Scan0, rgb, 0, rgb.Length);
+ bmp.UnlockBits(data);
+ var tex2 = new Texture2D(graphics, bmp.Width, bmp.Height);
+ tex2.SetData<byte>(rgb);
+ batch.Draw(tex2, new Rectangle(ctrl.X, ctrl.Y, ctrl.Width, ctrl.Height), Color.White);
+ }
+ }
+ }
+
+ public static void AddTopLevel(GUI.Control ctrl)
+ {
+ if (!topLevels.Contains(ctrl))
+ topLevels.Add(ctrl);
+ }
+
+ public static void ProcessMouseState(MouseState state)
+ {
+ foreach(var ctrl in topLevels)
+ {
+ if (ctrl.ProcessMouseState(state) == true)
+ break;
+ }
+ }
+
+
+
+ public static void DrawBackgroundLayer(GraphicsDevice graphics, SpriteBatch batch, int width, int height)
+ {
+ if (SkinEngine.LoadedSkin == null)
+ SkinEngine.Init();
+ graphics.Clear(SkinEngine.LoadedSkin.DesktopColor.ToMonoColor());
+ var desktopbg = SkinEngine.GetImage("desktopbackground");
+ if(desktopbg != null)
+ {
+ var tex2 = new Texture2D(graphics, desktopbg.Width, desktopbg.Height);
+ tex2.SetData<byte>(SkinEngine.LoadedSkin.DesktopBackgroundImage);
+ batch.Draw(tex2, new Rectangle(0, 0, width, height), Color.White);
+ }
+ }
+
+ public static Color ToMonoColor(this System.Drawing.Color color)
+ {
+ return new Color(color.R, color.G, color.B, color.A);
+ }
+
+ internal static void StopHandling(GUI.Control ctrl)
+ {
+ if (topLevels.Contains(ctrl))
+ topLevels.Remove(ctrl);
+ ctrl = null;
+ }
+ }
+}
diff --git a/ShiftOS.Frontend/Icon.bmp b/ShiftOS.Frontend/Icon.bmp
new file mode 100644
index 0000000..2b48165
--- /dev/null
+++ b/ShiftOS.Frontend/Icon.bmp
Binary files differ
diff --git a/ShiftOS.Frontend/Icon.ico b/ShiftOS.Frontend/Icon.ico
new file mode 100644
index 0000000..7d9dec1
--- /dev/null
+++ b/ShiftOS.Frontend/Icon.ico
Binary files differ
diff --git a/ShiftOS.Frontend/Program.cs b/ShiftOS.Frontend/Program.cs
new file mode 100644
index 0000000..031b2ab
--- /dev/null
+++ b/ShiftOS.Frontend/Program.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace ShiftOS.Frontend
+{
+ /// <summary>
+ /// The main class.
+ /// </summary>
+ public static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ using (var game = new ShiftOS())
+ game.Run();
+ }
+ }
+}
diff --git a/ShiftOS.Frontend/Properties/AssemblyInfo.cs b/ShiftOS.Frontend/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..f25b1d7
--- /dev/null
+++ b/ShiftOS.Frontend/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ShiftOS.Frontend")]
+[assembly: AssemblyProduct("ShiftOS.Frontend")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("13e2a4c8-a6cc-405b-a4ec-5d39531993c2")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ShiftOS.Frontend/ShiftOS.Frontend.csproj b/ShiftOS.Frontend/ShiftOS.Frontend.csproj
new file mode 100644
index 0000000..672024b
--- /dev/null
+++ b/ShiftOS.Frontend/ShiftOS.Frontend.csproj
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ShiftOS.Frontend</RootNamespace>
+ <AssemblyName>ShiftOS.Frontend</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <MonoGamePlatform>DesktopGL</MonoGamePlatform>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;LINUX</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <Prefer32Bit>false</Prefer32Bit>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
+ <OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
+ <DefineConstants>TRACE;LINUX</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <Prefer32Bit>false</Prefer32Bit>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ApplicationIcon>Icon.ico</ApplicationIcon>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ApplicationManifest>app.manifest</ApplicationManifest>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="Desktop\WindowManager.cs" />
+ <Compile Include="GraphicsSubsystem\UIManager.cs" />
+ <Compile Include="GUI\Control.cs" />
+ <Compile Include="GUI\TextControl.cs" />
+ <Compile Include="ShiftOS.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Window.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="MonoGame.Framework">
+ <HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Icon.ico" />
+ <EmbeddedResource Include="Icon.bmp" />
+ </ItemGroup>
+ <ItemGroup>
+ <MonoGameContentReference Include="Content\Content.mgcb" />
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x86\SDL2.dll">
+ <Link>x86\SDL2.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x64\SDL2.dll">
+ <Link>x64\SDL2.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x86\soft_oal.dll">
+ <Link>x86\soft_oal.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x64\soft_oal.dll">
+ <Link>x64\soft_oal.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x86\libSDL2-2.0.so.0">
+ <Link>x86\libSDL2-2.0.so.0</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x64\libSDL2-2.0.so.0">
+ <Link>x64\libSDL2-2.0.so.0</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x86\libopenal.so.1">
+ <Link>x86\libopenal.so.1</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x64\libopenal.so.1">
+ <Link>x64\libopenal.so.1</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\libSDL2-2.0.0.dylib">
+ <Link>libSDL2-2.0.0.dylib</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\libopenal.1.dylib">
+ <Link>libopenal.1.dylib</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll.config">
+ <Link>MonoGame.Framework.dll.config</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="app.manifest" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\ShiftOS.Objects\ShiftOS.Objects.csproj">
+ <Project>{a069089a-8962-4607-b2b2-4cf4a371066e}</Project>
+ <Name>ShiftOS.Objects</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\ShiftOS_TheReturn\ShiftOS.Engine.csproj">
+ <Project>{7c979b07-0585-4033-a110-e5555b9d6651}</Project>
+ <Name>ShiftOS.Engine</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup />
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/ShiftOS.Frontend/ShiftOS.cs b/ShiftOS.Frontend/ShiftOS.cs
new file mode 100644
index 0000000..90ebb4b
--- /dev/null
+++ b/ShiftOS.Frontend/ShiftOS.cs
@@ -0,0 +1,117 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using ShiftOS.Frontend.GraphicsSubsystem;
+
+namespace ShiftOS.Frontend
+{
+ /// <summary>
+ /// This is the main type for your game.
+ /// </summary>
+ public class ShiftOS : Game
+ {
+ GraphicsDeviceManager GraphicsDevice;
+ SpriteBatch spriteBatch;
+
+ public ShiftOS()
+ {
+ GraphicsDevice = new GraphicsDeviceManager(this);
+ Content.RootDirectory = "Content";
+ //Make the mouse cursor visible.
+ this.IsMouseVisible = true;
+
+ //Don't allow ALT+F4
+ this.Window.AllowAltF4 = false;
+
+ //Make window borderless
+ Window.IsBorderless = true;
+
+ //Set the title
+ Window.Title = "ShiftOS";
+
+
+
+ //Fullscreen
+ GraphicsDevice.IsFullScreen = true;
+
+ }
+
+ /// <summary>
+ /// Allows the game to perform any initialization it needs to before starting to run.
+ /// This is where it can query for any required services and load any non-graphic
+ /// related content. Calling base.Initialize will enumerate through any components
+ /// and initialize them as well.
+ /// </summary>
+ protected override void Initialize()
+ {
+ //We'll start by initializing the BARE FUNDAMENTALS of the ShiftOS engine.
+ //This'll be enough to do skinning, fs, windowmanagement etc
+ //so that we can make the main menu and yeah
+
+ //Let's add a control to test something
+ var textControl = new GUI.TextControl();
+ textControl.Width = 640;
+ textControl.Height = 480;
+ UIManager.AddTopLevel(textControl);
+
+
+ base.Initialize();
+
+ }
+
+ /// <summary>
+ /// LoadContent will be called once per game and is the place to load
+ /// all of your content.
+ /// </summary>
+ protected override void LoadContent()
+ {
+ // Create a new SpriteBatch, which can be used to draw textures.
+ this.spriteBatch = new SpriteBatch(base.GraphicsDevice);
+
+ // TODO: use this.Content to load your game content here
+ }
+
+ /// <summary>
+ /// UnloadContent will be called once per game and is the place to unload
+ /// game-specific content.
+ /// </summary>
+ protected override void UnloadContent()
+ {
+ // TODO: Unload any non ContentManager content here
+ }
+
+ /// <summary>
+ /// Allows the game to run logic such as updating the world,
+ /// checking for collisions, gathering input, and playing audio.
+ /// </summary>
+ /// <param name="gameTime">Provides a snapshot of timing values.</param>
+ protected override void Update(GameTime gameTime)
+ {
+ //Let's get the mouse state
+ var mouseState = Mouse.GetState(this.Window);
+
+ //Now let's process it.
+ UIManager.ProcessMouseState(mouseState);
+
+ base.Update(gameTime);
+ }
+
+ /// <summary>
+ /// This is called when the game should draw itself.
+ /// </summary>
+ /// <param name="gameTime">Provides a snapshot of timing values.</param>
+ protected override void Draw(GameTime gameTime)
+ {
+ this.spriteBatch.Begin();
+ //Draw the desktop BG.
+ var graphics = GraphicsDevice.GraphicsDevice;
+ UIManager.DrawBackgroundLayer(graphics, spriteBatch, 640, 480);
+
+ //The desktop is drawn, now we can draw the UI.
+ UIManager.DrawControls(graphics, spriteBatch);
+
+ spriteBatch.End();
+ base.Draw(gameTime);
+ }
+ }
+}
diff --git a/ShiftOS.Frontend/Window.cs b/ShiftOS.Frontend/Window.cs
new file mode 100644
index 0000000..4fd08a5
--- /dev/null
+++ b/ShiftOS.Frontend/Window.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ShiftOS.Engine;
+
+namespace ShiftOS.Frontend
+{
+ public abstract class Window : IShiftOSWindow
+ {
+ public void OnLoad()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnSkinLoad()
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool OnUnload()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnUpgrade()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/ShiftOS.Frontend/app.manifest b/ShiftOS.Frontend/app.manifest
new file mode 100644
index 0000000..048d329
--- /dev/null
+++ b/ShiftOS.Frontend/app.manifest
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+ <assemblyIdentity version="1.0.0.0" name="ShiftOS.Frontend"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+ <requestedExecutionLevel level="asInvoker" uiAccess="false" />
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- A list of the Windows versions that this application has been tested on and is
+ is designed to work with. Uncomment the appropriate elements and Windows will
+ automatically selected the most compatible environment. -->
+
+ <!-- Windows Vista -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
+
+ <!-- Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
+
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
+
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
+
+ <!-- Windows 10 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
+
+ </application>
+ </compatibility>
+
+ <application xmlns="urn:schemas-microsoft-com:asm.v3">
+ <windowsSettings>
+ <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
+ </windowsSettings>
+ </application>
+
+</assembly>