Render text onscreen

This commit is contained in:
Michael 2017-07-02 13:31:39 -04:00
parent 345c144686
commit dad09c9e7c
25 changed files with 1072 additions and 48 deletions

View file

@ -0,0 +1,15 @@
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:DesktopGL
/config:
/profile:Reach
/compress:False
#-------------------------------- References --------------------------------#
#---------------------------------- Content ---------------------------------#

View file

@ -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
}
}
}

View file

@ -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; }
}
}

View file

@ -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
}
}

View file

@ -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;
}
}
}

BIN
ShiftOS.Frontend/Icon.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

BIN
ShiftOS.Frontend/Icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

View file

@ -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();
}
}
}

View file

@ -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")]

View file

@ -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>

117
ShiftOS.Frontend/ShiftOS.cs Normal file
View file

@ -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);
}
}
}

View file

@ -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();
}
}
}

View file

@ -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>

View file

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ShiftOS.Objects</RootNamespace>
<AssemblyName>ShiftOS.Objects</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

View file

@ -50,7 +50,6 @@ namespace ShiftOS.WinForms
Application.SetCompatibleTextRenderingDefault(false);
//if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael
SkinEngine.SetPostProcessor(new DitheringSkinPostProcessor());
LoginManager.Init(new GUILoginFrontend());
CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly());
SkinEngine.SetIconProber(new ShiftOSIconProvider());
TerminalBackend.TerminalRequested += () =>

6
ShiftOS/App.config Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

15
ShiftOS/Program.cs Normal file
View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShiftOS
{
class Program
{
static void Main(string[] args)
{
}
}
}

View file

@ -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")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShiftOS")]
[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("518dae89-d558-4118-bd21-71246f356caf")]
// 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")]

60
ShiftOS/ShiftOS.csproj Normal file
View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{518DAE89-D558-4118-BD21-71246F356CAF}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ShiftOS</RootNamespace>
<AssemblyName>ShiftOS</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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>

4
ShiftOS/packages.config Normal file
View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MonoGame.Framework.WindowsDX" version="3.6.0.1625" targetFramework="net452" />
</packages>

View file

@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModLauncher", "ModLauncher\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.Updater", "ShiftOS.Updater\ShiftOS.Updater.csproj", "{36BC512F-6FD4-4139-AED7-565FC8D5BCBC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.Frontend", "ShiftOS.Frontend\ShiftOS.Frontend.csproj", "{4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -63,6 +65,10 @@ Global
{36BC512F-6FD4-4139-AED7-565FC8D5BCBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36BC512F-6FD4-4139-AED7-565FC8D5BCBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36BC512F-6FD4-4139-AED7-565FC8D5BCBC}.Release|Any CPU.Build.0 = Release|Any CPU
{4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DFC3088-1B08-4A0E-A9F5-483A7B9811FD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true" />
<loadFromRemoteSources enabled="true"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1000.0" newVersion="3.0.1000.0" />
<assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.1000.0" newVersion="3.0.1000.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Scripting" publicKeyToken="7f709c5b713576e1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.1.2.22" newVersion="1.1.2.22" />
<assemblyIdentity name="Microsoft.Scripting" publicKeyToken="7f709c5b713576e1" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.1.2.22" newVersion="1.1.2.22"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="IronPython" publicKeyToken="7f709c5b713576e1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.7.7.0" newVersion="2.7.7.0" />
<assemblyIdentity name="IronPython" publicKeyToken="7f709c5b713576e1" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.7.7.0" newVersion="2.7.7.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>

View file

@ -82,7 +82,17 @@ namespace ShiftOS.Engine.Properties {
}
/// <summary>
/// Looks up a localized string similar to .
/// Looks up a localized string similar to /*
/// * MIT License
/// *
/// * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
/// *
/// * Permission is hereby granted, free of charge, to any person obtaining a copy
/// * of this software and associated documentation files (the &quot;Software&quot;), to deal
/// * in the Software without restriction, including without limitation the rights
/// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// * copies of the Software, and to permit persons to whom the Software is
/// * furnished to do so, sub [rest of string was truncated]&quot;;.
/// </summary>
internal static string pywintemplate {
get {
@ -108,8 +118,7 @@ namespace ShiftOS.Engine.Properties {
/// {
/// Name: &quot;WM 4 Windows&quot;,
/// Cost: 150,
/// Description: &quot;Display up to 4 simultaneous windows on-screen in a 2x2 grid.&quot;,
/// [rest of string was truncated]&quot;;.
/// Description: &quot;Display up to 4 simultaneous windows on-screen i [rest of string was truncated]&quot;;.
/// </summary>
internal static string Shiftorium {
get {
@ -138,8 +147,7 @@ namespace ShiftOS.Engine.Properties {
///Eine kurze Erklärung wie du das Terminal benutzt lautet wiefolgt. Du kannst das command &apos;sos.help&apos; benutzen um eine Liste aller commands aufzurufen. Schreib es
///einfach in das Terminal und drücke &lt;enter&gt; um alle commands anzuzeigen.
///
///Commands können mit argumenten versehen werden, indem du ein key-value Paar in einem {} Block hinter dem command angibst. Zum Beispiel:
/// [rest of string was truncated]&quot;;.
///Commands können mit argumenten versehen werden, indem du ein key-value Paar in einem {} Block hinter dem command angibst. Zum Be [rest of string was truncated]&quot;;.
/// </summary>
internal static string strings_de {
get {
@ -158,8 +166,7 @@ namespace ShiftOS.Engine.Properties {
///Commands can be sent arguments by specifying a key-value pair inside a {} block at the end of the command. For example:
///
///some.command{print:\&quot;hello\&quot;}
///math.add{op1:1,op2:2}
/// [rest of string was truncated]&quot;;.
///math.add{op1 [rest of string was truncated]&quot;;.
/// </summary>
internal static string strings_en {
get {
@ -177,7 +184,7 @@ namespace ShiftOS.Engine.Properties {
/// &quot;Before you can begin with ShiftOS, you&apos;ll need to know a few things about it.&quot;,
/// &quot;One: Terminal command syntax.&quot;,
/// &quot;Inside ShiftOS, the bulk of your time is going to be spent within the Terminal.&quot;,
/// &quot;The Terminal is an application that starts up when you turn on your computer. It allows you to execute system commands, open program [rest of string was truncated]&quot;;.
/// &quot;The Terminal is an application that starts up when you turn on your computer. It allows you to execute system commands, ope [rest of string was truncated]&quot;;.
/// </summary>
internal static string sys_shiftoriumstory {
get {

View file

@ -1,28 +1,4 @@
/*
* MIT License
*
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000

View file

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ShiftOS.Engine</RootNamespace>
<AssemblyName>ShiftOS.Engine</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PublishUrl>publish\</PublishUrl>
@ -27,6 +27,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>