started work on the pong, implemented "ShiftToolStrip". (note: pong is very buggy)

This commit is contained in:
Richie Moch 2018-12-23 19:15:07 -06:00
parent d94c79dbf5
commit bca879db94
37 changed files with 586 additions and 353 deletions

View file

@ -84,7 +84,7 @@
<Compile Include="UI\ShiftButton.Designer.cs">
<DependentUpon>ShiftButton.cs</DependentUpon>
</Compile>
<Compile Include="UI\ShiftStripRenderer.cs" />
<Compile Include="UI\ShiftToolStrip.cs" />
<Compile Include="WindowManager\InfoboxTemplate.cs">
<SubType>UserControl</SubType>
</Compile>

View file

@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShiftOS.Engine.UI
{
public class ShiftStripRenderer : ToolStripRenderer
{
SolidBrush sb;
protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
{
if (!e.Item.Selected)
{
base.OnRenderButtonBackground(e);
}
else
{
sb = new SolidBrush(Color.FromArgb(64, 64, 64));
Rectangle rectangle = new Rectangle(0, 0, e.Item.Size.Width - 1, e.Item.Size.Height - 1);
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(64,64,64)), rectangle);
e.Graphics.DrawRectangle(new Pen(sb, 1F), rectangle);
}
}
}
}

View file

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShiftOS.Engine.UI
{
public partial class ShiftToolStrip : ToolStripProfessionalRenderer
{
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
{
if (!e.Item.Selected) base.OnRenderMenuItemBackground(e);
else
{
var rc = new Rectangle(Point.Empty, e.Item.Size);
e.Graphics.FillRectangle(Brushes.Gray, rc);
e.Graphics.DrawRectangle(Pens.White, 1, 0, rc.Width - 2, rc.Height - 1);
}
}
}
}

View file

@ -1,6 +1,6 @@
using System.Windows.Forms;
namespace ShiftOS.Main.ShiftOS.Apps
namespace ShiftOS.Main.Apps
{
partial class FileSkimmer
{

View file

@ -8,7 +8,7 @@ using ShiftOS.Engine.WindowManager;
using System.Linq;
using ShiftOS.Engine.UI;
namespace ShiftOS.Main.ShiftOS.Apps
namespace ShiftOS.Main.Apps
{
public partial class FileSkimmer : UserControl, IShiftWindowExtensions
{

100
ShiftOS.Main/Apps/Pong.Designer.cs generated Normal file
View file

@ -0,0 +1,100 @@
namespace ShiftOS.Main.Apps
{
partial class Pong
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.playerPaddle = new System.Windows.Forms.PictureBox();
this.cpuPaddle = new System.Windows.Forms.PictureBox();
this.ball = new System.Windows.Forms.PictureBox();
this.gameTimer = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.playerPaddle)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cpuPaddle)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ball)).BeginInit();
this.SuspendLayout();
//
// playerPaddle
//
this.playerPaddle.BackColor = System.Drawing.Color.White;
this.playerPaddle.Location = new System.Drawing.Point(27, 153);
this.playerPaddle.Name = "playerPaddle";
this.playerPaddle.Size = new System.Drawing.Size(22, 103);
this.playerPaddle.TabIndex = 0;
this.playerPaddle.TabStop = false;
//
// cpuPaddle
//
this.cpuPaddle.BackColor = System.Drawing.Color.White;
this.cpuPaddle.Location = new System.Drawing.Point(751, 153);
this.cpuPaddle.Name = "cpuPaddle";
this.cpuPaddle.Size = new System.Drawing.Size(22, 103);
this.cpuPaddle.TabIndex = 1;
this.cpuPaddle.TabStop = false;
//
// ball
//
this.ball.BackColor = System.Drawing.Color.White;
this.ball.Location = new System.Drawing.Point(390, 201);
this.ball.Name = "ball";
this.ball.Size = new System.Drawing.Size(18, 18);
this.ball.TabIndex = 2;
this.ball.TabStop = false;
//
// gameTimer
//
this.gameTimer.Interval = 20;
this.gameTimer.Tick += new System.EventHandler(this.gameTimer_Tick);
//
// Pong
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.Controls.Add(this.ball);
this.Controls.Add(this.cpuPaddle);
this.Controls.Add(this.playerPaddle);
this.ForeColor = System.Drawing.Color.White;
this.Name = "Pong";
this.Size = new System.Drawing.Size(801, 470);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Pong_KeyDown);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Pong_KeyUp);
((System.ComponentModel.ISupportInitialize)(this.playerPaddle)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cpuPaddle)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ball)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox playerPaddle;
private System.Windows.Forms.PictureBox cpuPaddle;
private System.Windows.Forms.PictureBox ball;
private System.Windows.Forms.Timer gameTimer;
}
}

72
ShiftOS.Main/Apps/Pong.cs Normal file
View file

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShiftOS.Main.Apps
{
public partial class Pong : UserControl
{
bool goUp = false;
bool goDown = false;
int speed = 5;
float ballX = 5;
float ballY = 5;
public Pong()
{
InitializeComponent();
gameTimer.Start();
ResetToRest();
}
void ResetToRest()
{
ball.Location = new Point((int)Math.Round(this.Width / 2d, 0), (int)Math.Round(this.Height / 2d, 0));
playerPaddle.Location = new Point(playerPaddle.Location.X, (int)Math.Round(this.Height / 2d, 0));
cpuPaddle.Location = new Point(cpuPaddle.Location.X, (int)Math.Round(this.Height / 2d, 0));
}
private void Pong_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.W) goUp = true;
if (e.KeyCode == Keys.S) goDown = true;
}
private void Pong_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.W) goUp = false;
if (e.KeyCode == Keys.S) goDown = false;
}
private void gameTimer_Tick(object sender, EventArgs e)
{
ball.Top -= (int)ballY;
ball.Left -= (int)ballX;
cpuPaddle.Top += speed;
if (cpuPaddle.Top < 0 || cpuPaddle.Top > this.Height) speed = -speed;
if (ball.Left < 0)
{
ResetToRest();
ballX = -ballX;
}
if (ball.Left + ball.Width > this.Height)
{
ResetToRest();
ballX = -ballX;
}
if (ball.Top < 0 || ball.Top + ball.Height > this.Height) ballY = -ballY;
if (ball.Bounds.IntersectsWith(playerPaddle.Bounds) || ball.Bounds.IntersectsWith(cpuPaddle.Bounds)) ballX = -ballX;
if (goUp && playerPaddle.Top > 0) playerPaddle.Top -= 8;
if (goDown && playerPaddle.Top < this.Height) playerPaddle.Top += 8;
}
}
}

123
ShiftOS.Main/Apps/Pong.resx Normal file
View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="gameTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -1,4 +1,4 @@
namespace ShiftOS.Main.ShiftOS.Apps
namespace ShiftOS.Main.Apps
{
partial class Terminal
{

View file

@ -9,7 +9,7 @@ using System.IO;
using ShiftOS.Main.Properties;
using Whoa;
namespace ShiftOS.Main.ShiftOS.Apps
namespace ShiftOS.Main.Apps
{
public partial class Terminal : UserControl
{

View file

@ -1,4 +1,4 @@
namespace ShiftOS.Main.ShiftOS.Apps
namespace ShiftOS.Main.Apps
{
partial class TextPad
{

View file

@ -4,7 +4,7 @@ using System;
using System.IO;
using System.Windows.Forms;
namespace ShiftOS.Main.ShiftOS.Apps
namespace ShiftOS.Main.Apps
{
public partial class TextPad : UserControl
{

138
ShiftOS.Main/Desktop.Designer.cs generated Normal file
View file

@ -0,0 +1,138 @@
namespace ShiftOS.Main
{
partial class Desktop
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.applicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.terminalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileSkimmerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.textPadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pongToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.shifterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// contextMenuStrip1
//
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.applicationsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(933, 24);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
// applicationsToolStripMenuItem
//
this.applicationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.terminalToolStripMenuItem,
this.fileSkimmerToolStripMenuItem,
this.textPadToolStripMenuItem,
this.pongToolStripMenuItem,
this.shifterToolStripMenuItem});
this.applicationsToolStripMenuItem.Font = new System.Drawing.Font("Courier New", 9F);
this.applicationsToolStripMenuItem.ForeColor = System.Drawing.Color.White;
this.applicationsToolStripMenuItem.Name = "applicationsToolStripMenuItem";
this.applicationsToolStripMenuItem.Size = new System.Drawing.Size(103, 20);
this.applicationsToolStripMenuItem.Text = "Applications";
//
// terminalToolStripMenuItem
//
this.terminalToolStripMenuItem.Name = "terminalToolStripMenuItem";
this.terminalToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.terminalToolStripMenuItem.Text = "Terminal";
this.terminalToolStripMenuItem.Click += new System.EventHandler(this.terminalToolStripMenuItem_Click);
//
// fileSkimmerToolStripMenuItem
//
this.fileSkimmerToolStripMenuItem.Name = "fileSkimmerToolStripMenuItem";
this.fileSkimmerToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.fileSkimmerToolStripMenuItem.Text = "File Skimmer";
this.fileSkimmerToolStripMenuItem.Click += new System.EventHandler(this.fileSkimmerToolStripMenuItem_Click);
//
// textPadToolStripMenuItem
//
this.textPadToolStripMenuItem.Name = "textPadToolStripMenuItem";
this.textPadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.textPadToolStripMenuItem.Text = "TextPad";
this.textPadToolStripMenuItem.Click += new System.EventHandler(this.textPadToolStripMenuItem_Click);
//
// pongToolStripMenuItem
//
this.pongToolStripMenuItem.Name = "pongToolStripMenuItem";
this.pongToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.pongToolStripMenuItem.Text = "Pong";
this.pongToolStripMenuItem.Click += new System.EventHandler(this.pongToolStripMenuItem_Click);
//
// shifterToolStripMenuItem
//
this.shifterToolStripMenuItem.Name = "shifterToolStripMenuItem";
this.shifterToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shifterToolStripMenuItem.Text = "Shifter";
//
// Desktop
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(933, 485);
this.Controls.Add(this.menuStrip1);
this.Font = new System.Drawing.Font("Courier New", 8.25F);
this.ForeColor = System.Drawing.Color.White;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Desktop";
this.Text = "Desktop";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem applicationsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem terminalToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fileSkimmerToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem textPadToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pongToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem shifterToolStripMenuItem;
}
}

51
ShiftOS.Main/Desktop.cs Normal file
View file

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine.UI;
using ShiftOS.Engine.WindowManager;
namespace ShiftOS.Main
{
public partial class Desktop : Form
{
public Desktop()
{
InitializeComponent();
foreach (var menuItem in applicationsToolStripMenuItem.DropDownItems.OfType<ToolStripMenuItem>())
{
menuItem.BackColor = Color.FromArgb(64,64,64);
menuItem.ForeColor = Color.White;
}
menuStrip1.RenderMode = ToolStripRenderMode.ManagerRenderMode;
ToolStripManager.Renderer = new ShiftToolStrip();
this.FormClosed += (o, a) => Application.Exit();
}
private void terminalToolStripMenuItem_Click(object sender, EventArgs e)
{
ShiftWM.Init(new Apps.Terminal(), "Terminal", Properties.Resources.iconTerminal);
}
private void fileSkimmerToolStripMenuItem_Click(object sender, EventArgs e)
{
ShiftWM.Init(new Apps.FileSkimmer(), "FileSkimmer", Properties.Resources.iconFileSkimmer);
}
private void textPadToolStripMenuItem_Click(object sender, EventArgs e)
{
ShiftWM.Init(new Apps.TextPad(), "TextPad", Properties.Resources.iconTextPad);
}
private void pongToolStripMenuItem_Click(object sender, EventArgs e)
{
ShiftWM.Init(new Apps.Pong(), "Pong", null);
}
}
}

View file

@ -117,10 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>219, 17</value>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>172, 17</value>
</metadata>
</root>

View file

@ -1,186 +0,0 @@
namespace ShiftOS.Main.ShiftOS
{
partial class Desktop
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.taskbar = new System.Windows.Forms.Panel();
this.clockPanel = new System.Windows.Forms.Panel();
this.lblClock = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.applicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.shifterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.terminalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.textPadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileSkimmerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.taskbar.SuspendLayout();
this.clockPanel.SuspendLayout();
this.panel2.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// taskbar
//
this.taskbar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.taskbar.Controls.Add(this.clockPanel);
this.taskbar.Controls.Add(this.panel2);
this.taskbar.Dock = System.Windows.Forms.DockStyle.Top;
this.taskbar.Location = new System.Drawing.Point(0, 0);
this.taskbar.Name = "taskbar";
this.taskbar.Size = new System.Drawing.Size(640, 24);
this.taskbar.TabIndex = 0;
//
// clockPanel
//
this.clockPanel.Controls.Add(this.lblClock);
this.clockPanel.Dock = System.Windows.Forms.DockStyle.Right;
this.clockPanel.Location = new System.Drawing.Point(574, 0);
this.clockPanel.Name = "clockPanel";
this.clockPanel.Size = new System.Drawing.Size(66, 24);
this.clockPanel.TabIndex = 1;
//
// lblClock
//
this.lblClock.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.lblClock.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblClock.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblClock.ForeColor = System.Drawing.Color.White;
this.lblClock.Location = new System.Drawing.Point(0, 0);
this.lblClock.Name = "lblClock";
this.lblClock.Size = new System.Drawing.Size(66, 24);
this.lblClock.TabIndex = 1;
this.lblClock.Text = "00:00:00";
this.lblClock.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel2
//
this.panel2.Controls.Add(this.menuStrip1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Left;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(102, 24);
this.panel2.TabIndex = 0;
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.menuStrip1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None;
this.menuStrip1.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.applicationsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(231, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "Applications";
this.menuStrip1.MenuActivate += new System.EventHandler(this.menuStrip1_MenuActivate);
//
// applicationsToolStripMenuItem
//
this.applicationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.shifterToolStripMenuItem,
this.terminalToolStripMenuItem,
this.textPadToolStripMenuItem,
this.fileSkimmerToolStripMenuItem});
this.applicationsToolStripMenuItem.ForeColor = System.Drawing.Color.White;
this.applicationsToolStripMenuItem.Name = "applicationsToolStripMenuItem";
this.applicationsToolStripMenuItem.Size = new System.Drawing.Size(103, 20);
this.applicationsToolStripMenuItem.Text = "Applications";
//
// shifterToolStripMenuItem
//
this.shifterToolStripMenuItem.Name = "shifterToolStripMenuItem";
this.shifterToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.shifterToolStripMenuItem.Text = "Shifter";
this.shifterToolStripMenuItem.Click += new System.EventHandler(this.shifterToolStripMenuItem_Click);
//
// terminalToolStripMenuItem
//
this.terminalToolStripMenuItem.Name = "terminalToolStripMenuItem";
this.terminalToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.terminalToolStripMenuItem.Text = "Terminal";
this.terminalToolStripMenuItem.Click += new System.EventHandler(this.terminalToolStripMenuItem_Click);
//
// textPadToolStripMenuItem
//
this.textPadToolStripMenuItem.Name = "textPadToolStripMenuItem";
this.textPadToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.textPadToolStripMenuItem.Text = "TextPad";
this.textPadToolStripMenuItem.Click += new System.EventHandler(this.textPadToolStripMenuItem_Click);
//
// fileSkimmerToolStripMenuItem
//
this.fileSkimmerToolStripMenuItem.Name = "fileSkimmerToolStripMenuItem";
this.fileSkimmerToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.fileSkimmerToolStripMenuItem.Text = "File Skimmer";
this.fileSkimmerToolStripMenuItem.Click += new System.EventHandler(this.fileSkimmerToolStripMenuItem_Click);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Desktop
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(640, 480);
this.Controls.Add(this.taskbar);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "Desktop";
this.Text = "Desktop";
this.Load += new System.EventHandler(this.Desktop_Load);
this.taskbar.ResumeLayout(false);
this.clockPanel.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel taskbar;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel clockPanel;
private System.Windows.Forms.Label lblClock;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem applicationsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem shifterToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem terminalToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem textPadToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fileSkimmerToolStripMenuItem;
}
}

View file

@ -1,72 +0,0 @@
using System;
using System.Windows.Forms;
using ShiftOS.Engine.WindowManager;
using ShiftOS.Main.Properties;
using ShiftOS.Main.ShiftOS.Apps;
using System.IO;
using ShiftOS.Engine;
using System.Drawing;
using ShiftOS.Engine.UI;
namespace ShiftOS.Main.ShiftOS
{
// testing github because git hates me
public partial class Desktop : Form
{
public Desktop()
{
InitializeComponent();
foreach (object t in applicationsToolStripMenuItem.DropDownItems)
{
var appList = t as ToolStripItem;
if (t == null) continue;
appList.BackColor = Color.FromArgb(64, 64, 64);
appList.ForeColor = Color.White;
}
timer1.Start();
Closed += (sender, args) => { Application.Exit(); };
}
private void shifterToolStripMenuItem_Click(object sender, EventArgs e)
{
Apps.ShifterStuff.Shifter app = new Apps.ShifterStuff.Shifter();
ShiftWM.Init(app, "Shifter", Resources.iconShifter);
}
private void Desktop_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
}
private void terminalToolStripMenuItem_Click(object sender, EventArgs e)
{
var t = new Apps.Terminal();
ShiftWM.Init(t, "Terminal", Resources.iconTerminal, false);
}
private void textPadToolStripMenuItem_Click(object sender, EventArgs e)
{
var t = new TextPad();
ShiftWM.Init(t, "TextPad", Resources.iconTextPad);
}
private void fileSkimmerToolStripMenuItem_Click(object sender, EventArgs e)
{
var fs = new FileSkimmer();
ShiftWM.Init(fs, "File Skimmer", Resources.iconFileSkimmer);
}
private void timer1_Tick(object sender, EventArgs e)
{
lblClock.Text = DateTime.Now.ToString("hh:mm:ss");
}
private void menuStrip1_MenuActivate(object sender, EventArgs e)
{
menuStrip1.BackColor = Color.FromArgb(64, 64, 64);
}
}
}

View file

@ -1,6 +1,5 @@
using System;
using System.Windows.Forms;
using ShiftOS.Main.ShiftOS;
namespace ShiftOS.Main
{
@ -21,7 +20,7 @@ namespace ShiftOS.Main
if (terminalMode)
{
Form terminalForm = new Form();
ShiftOS.Apps.Terminal term = new ShiftOS.Apps.Terminal();
Main.Apps.Terminal term = new Main.Apps.Terminal();
terminalForm.Controls.Add(term);
terminalForm.FormBorderStyle = FormBorderStyle.None;
terminalForm.WindowState = FormWindowState.Maximized;

View file

@ -52,44 +52,50 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MainGame\Apps\FileSkimmer.cs">
<Compile Include="Apps\Pong.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="MainGame\Apps\FileSkimmer.Designer.cs">
<DependentUpon>FileSkimmer.cs</DependentUpon>
<Compile Include="Apps\Pong.Designer.cs">
<DependentUpon>Pong.cs</DependentUpon>
</Compile>
<Compile Include="MainGame\Apps\ShifterStuff\SelectColor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="MainGame\Apps\ShifterStuff\SelectColor.Designer.cs">
<DependentUpon>SelectColor.cs</DependentUpon>
</Compile>
<Compile Include="MainGame\Apps\ShifterStuff\Shifter.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="MainGame\Apps\ShifterStuff\Shifter.Designer.cs">
<DependentUpon>Shifter.cs</DependentUpon>
</Compile>
<Compile Include="MainGame\Apps\Terminal.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="MainGame\Apps\Terminal.Designer.cs">
<DependentUpon>Terminal.cs</DependentUpon>
</Compile>
<Compile Include="MainGame\Apps\TextPad.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="MainGame\Apps\TextPad.Designer.cs">
<DependentUpon>TextPad.cs</DependentUpon>
</Compile>
<Compile Include="MainGame\Desktop.cs">
<Compile Include="Desktop.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainGame\Desktop.Designer.cs">
<Compile Include="Desktop.Designer.cs">
<DependentUpon>Desktop.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Apps\FileSkimmer.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Apps\FileSkimmer.Designer.cs">
<DependentUpon>FileSkimmer.cs</DependentUpon>
</Compile>
<Compile Include="Apps\ShifterStuff\SelectColor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Apps\ShifterStuff\SelectColor.Designer.cs">
<DependentUpon>SelectColor.cs</DependentUpon>
</Compile>
<Compile Include="Apps\ShifterStuff\Shifter.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Apps\ShifterStuff\Shifter.Designer.cs">
<DependentUpon>Shifter.cs</DependentUpon>
</Compile>
<Compile Include="Apps\Terminal.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Apps\Terminal.Designer.cs">
<DependentUpon>Terminal.cs</DependentUpon>
</Compile>
<Compile Include="Apps\TextPad.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Apps\TextPad.Designer.cs">
<DependentUpon>TextPad.cs</DependentUpon>
</Compile>
<Compile Include="Terminal\Commands\codepoints.cs" />
<Compile Include="Terminal\Commands\startx.cs" />
<Compile Include="Terminal\Commands\Clear.cs" />
@ -101,6 +107,12 @@
<Compile Include="Terminal\Commands\upgrade.cs" />
<Compile Include="Terminal\TerminalBackend.cs" />
<Compile Include="Terminal\TerminalCommand.cs" />
<EmbeddedResource Include="Apps\Pong.resx">
<DependentUpon>Pong.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Desktop.resx">
<DependentUpon>Desktop.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -111,24 +123,21 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="MainGame\Apps\FileSkimmer.resx">
<EmbeddedResource Include="Apps\FileSkimmer.resx">
<DependentUpon>FileSkimmer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainGame\Apps\ShifterStuff\SelectColor.resx">
<EmbeddedResource Include="Apps\ShifterStuff\SelectColor.resx">
<DependentUpon>SelectColor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainGame\Apps\ShifterStuff\Shifter.resx">
<EmbeddedResource Include="Apps\ShifterStuff\Shifter.resx">
<DependentUpon>Shifter.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainGame\Apps\Terminal.resx">
<EmbeddedResource Include="Apps\Terminal.resx">
<DependentUpon>Terminal.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainGame\Apps\TextPad.resx">
<EmbeddedResource Include="Apps\TextPad.resx">
<DependentUpon>TextPad.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainGame\Desktop.resx">
<DependentUpon>Desktop.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -152,9 +161,7 @@
<Name>ShiftOS.Engine</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="MainGame\Upgrades\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Resources\Apps\Artpad\ArtPadsave.png" />
<Content Include="Resources\Audio\infobox.wav" />

View file

@ -7,7 +7,8 @@ using System.Threading.Tasks;
using ShiftOS.Engine;
using static ShiftOS.Engine.CodepointUpgrade;
using static ShiftOS.Engine.SaveSystem;
using ShiftOS.Main;
using System.Windows.Forms;
namespace ShiftOS.Main.Terminal.Commands
{
@ -15,12 +16,12 @@ namespace ShiftOS.Main.Terminal.Commands
{
private bool hasGUI = false;
private bool autostart = false;
private Timer timer = new Timer();
public override string Name { get; } = "startx";
public override string Summary { get; } = "Starts the ShiftX driver.";
public override string Usage { get; } = "startx";
public override bool Unlocked { get; set; } = false;
public int codePoints { get; set; } = 150;
public override void Run(params string[] args)
{
if (args.Length > 0)
@ -43,13 +44,16 @@ namespace ShiftOS.Main.Terminal.Commands
}
if (!hasGUI)
{
var d = new Desktop();
d.Show();
WriteLine("[startx] starting driver...");
new System.Threading.ManualResetEvent(false).WaitOne(1500);
new Desktop().Show();
hasGUI = true;
return;
}
if (hasGUI == true)
if (hasGUI)
{
WriteLine("The ShiftX driver has already been intialized.");
WriteLine("startx: the ShiftX driver has already been intialized.");
return;
}
}

View file

@ -5,6 +5,7 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Main.Apps;
namespace ShiftOS.Main.Terminal
{
@ -15,7 +16,7 @@ namespace ShiftOS.Main.Terminal
.Where(t => t.IsSubclassOf(typeof(TerminalCommand)) && t.GetConstructor(Type.EmptyTypes) != null)
.Select(t => Activator.CreateInstance(t) as TerminalCommand);
public static List<ShiftOS.Apps.Terminal> trm = new List<ShiftOS.Apps.Terminal>();
public static List<Main.Apps.Terminal> trm = new List<Main.Apps.Terminal>();
public static int trmTopID = 0;
public static Stack<string> commandBuffer = new Stack<string>();
/// <summary>

View file

@ -43,7 +43,7 @@ namespace ShiftOS.Main.Terminal
/// <param name="textClr"><summary>The color the text is written in.</summary></param>
public virtual void WriteLine(string value, Color textClr)
{
ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
Main.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
int startPoint = trm.termmain.Text.Length;
trm.termmain.AppendText($" {value} \n");
@ -59,7 +59,7 @@ namespace ShiftOS.Main.Terminal
public virtual void Write(string value, Color textClr)
{
ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
Main.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
int startPoint = trm.termmain.Text.Length;
trm.termmain.AppendText($" {value}");
@ -94,7 +94,7 @@ namespace ShiftOS.Main.Terminal
/// </summary>
public virtual void Clear()
{
ShiftOS.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
Main.Apps.Terminal trm = Array.Find(TerminalBackend.trm.ToArray(), w => w.TerminalID == TermID);
trm.Clear();
}