Added a fuckton of changes

New infobox icons, new WIP  port of Snakey, we are getting closer to a
pre-alpha!
This commit is contained in:
FloppyDiskDrive 2017-10-01 09:49:14 -05:00
parent f2ed0c673c
commit c23e42cc39
22 changed files with 496 additions and 320 deletions

Binary file not shown.

View file

@ -92,9 +92,39 @@ namespace ShiftOS.Engine.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
internal static System.Drawing.Bitmap Symbolinfo { internal static System.Drawing.Bitmap symbolError {
get { get {
object obj = ResourceManager.GetObject("Symbolinfo", resourceCulture); object obj = ResourceManager.GetObject("symbolError", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap symbolInfo {
get {
object obj = ResourceManager.GetObject("symbolInfo", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap symbolQuestion {
get {
object obj = ResourceManager.GetObject("symbolQuestion", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap symbolWarning {
get {
object obj = ResourceManager.GetObject("symbolWarning", resourceCulture);
return ((System.Drawing.Bitmap)(obj)); return ((System.Drawing.Bitmap)(obj));
} }
} }

View file

@ -121,13 +121,22 @@
<data name="nullIcon" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="nullIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\nullIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\nullIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Symbolinfo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Symbolinfo1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="iconInfoBox_fw" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="iconInfoBox_fw" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\iconInfoBox.fw.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\iconInfoBox.fw.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="infobox" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="infobox" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\infobox.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>..\Resources\infobox.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="symbolError" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\symbolError.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="symbolInfo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Symbolinfo1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="symbolQuestion" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\symbolQuestion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="symbolWarning" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\symbolWarning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -92,5 +92,14 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\iconInfoBox.fw.png" /> <None Include="Resources\iconInfoBox.fw.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Resources\symbolWarning.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\symbolQuestion.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\symbolError.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View file

@ -1,110 +0,0 @@
namespace ShiftOS.Engine.Templates
{
partial class InfoboxTemplate
{
/// <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.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = global::ShiftOS.Engine.Properties.Resources.Symbolinfo;
this.pictureBox1.Location = new System.Drawing.Point(15, 17);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(80, 70);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Lucida Console", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(114, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(115, 15);
this.label1.TabIndex = 1;
this.label1.Text = "Generic Body";
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Lucida Console", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.Location = new System.Drawing.Point(194, 122);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(116, 27);
this.button2.TabIndex = 3;
this.button2.Text = "No";
this.button2.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Lucida Console", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(51, 122);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(116, 27);
this.button1.TabIndex = 4;
this.button1.Text = "Yes";
this.button1.UseVisualStyleBackColor = true;
//
// InfoboxTemplate
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.button1);
this.Controls.Add(this.button2);
this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBox1);
this.Name = "InfoboxTemplate";
this.Size = new System.Drawing.Size(367, 177);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
}
}

View file

@ -1,35 +0,0 @@
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.Engine.Templates
{
public partial class InfoboxTemplate : UserControl
{
public int buttonResult;
public InfoboxTemplate(buttonType type)
{
InitializeComponent();
switch (type)
{
case buttonType.OK:
button1.Text = "OK";
button2.Visible = false;
button1.Location = new Point(117, 122);
}
}
public enum buttonType
{
YesNo,
OK,
OKCancel,
}
}
}

View file

@ -69,7 +69,7 @@
// //
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.pictureBox1.Image = global::ShiftOS.Engine.Properties.Resources.Symbolinfo; this.pictureBox1.Image = global::ShiftOS.Engine.Properties.Resources.symbolInfo;
this.pictureBox1.Location = new System.Drawing.Point(3, 35); this.pictureBox1.Location = new System.Drawing.Point(3, 35);
this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(80, 70); this.pictureBox1.Size = new System.Drawing.Size(80, 70);
@ -80,7 +80,6 @@
// changeSize // changeSize
// //
this.changeSize.Interval = 1; this.changeSize.Interval = 1;
this.changeSize.Tick += new System.EventHandler(this.changeSize_Tick);
// //
// label1 // label1
// //

View file

@ -11,7 +11,7 @@ namespace ShiftOS.Engine.WindowManager
Stream _str; Stream _str;
private int _buttonChoice; private int _buttonChoice;
private int _buttonSelected; private int _buttonSelected;
public InfoboxTemplate(ButtonType type) public InfoboxTemplate(ButtonType type, ErrorIcon icon)
{ {
InitializeComponent(); InitializeComponent();
@ -34,6 +34,21 @@ namespace ShiftOS.Engine.WindowManager
_buttonChoice = 3; _buttonChoice = 3;
break; break;
} }
switch (icon)
{
case ErrorIcon.Critical:
SetImage(Properties.Resources.symbolError);
break;
case ErrorIcon.Error:
SetImage(Properties.Resources.symbolWarning);
break;
case ErrorIcon.Info:
SetImage(Properties.Resources.symbolInfo);
break;
case ErrorIcon.Question:
SetImage(Properties.Resources.symbolQuestion);
break;
}
} }
public enum ButtonType public enum ButtonType
@ -43,6 +58,13 @@ namespace ShiftOS.Engine.WindowManager
Ok Ok
} }
public enum ErrorIcon
{
Info,
Critical,
Error,
Question
}
private void btnOpt1_Click(object sender, EventArgs e) private void btnOpt1_Click(object sender, EventArgs e)
{ {
switch (btnOpt1.Text) switch (btnOpt1.Text)
@ -82,10 +104,9 @@ namespace ShiftOS.Engine.WindowManager
private void InfoboxTemplate_Load(object sender, EventArgs e) private void InfoboxTemplate_Load(object sender, EventArgs e)
=> Play(); => Play();
private void changeSize_Tick(object sender, EventArgs e) private void SetImage(Image imageType)
{ {
this.Height += label1.Height; pictureBox1.Image = imageType;
this.Width += label1.Width;
} }
} }
} }

View file

@ -28,12 +28,11 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.conversationtimer = new System.Windows.Forms.Timer(this.components); this.conversationtimer = new System.Windows.Forms.Timer();
this.hackeffecttimer = new System.Windows.Forms.Timer(this.components); this.hackeffecttimer = new System.Windows.Forms.Timer();
this.lblHijack = new System.Windows.Forms.Label(); this.lblHijack = new System.Windows.Forms.Label();
this.textgen = new System.Windows.Forms.Timer(this.components); this.textgen = new System.Windows.Forms.Timer();
this.lblhackwords = new System.Windows.Forms.Label(); this.lblhackwords = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //

View file

@ -70,6 +70,12 @@
<Compile Include="ShiftOS\Apps\ShifterStuff\Shifter.Designer.cs"> <Compile Include="ShiftOS\Apps\ShifterStuff\Shifter.Designer.cs">
<DependentUpon>Shifter.cs</DependentUpon> <DependentUpon>Shifter.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="ShiftOS\Apps\Snakey.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ShiftOS\Apps\Snakey.Designer.cs">
<DependentUpon>Snakey.cs</DependentUpon>
</Compile>
<Compile Include="ShiftOS\Apps\TestForm.cs"> <Compile Include="ShiftOS\Apps\TestForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -104,6 +110,9 @@
<EmbeddedResource Include="ShiftOS\Apps\ShifterStuff\Shifter.resx"> <EmbeddedResource Include="ShiftOS\Apps\ShifterStuff\Shifter.resx">
<DependentUpon>Shifter.cs</DependentUpon> <DependentUpon>Shifter.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="ShiftOS\Apps\Snakey.resx">
<DependentUpon>Snakey.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ShiftOS\Apps\TestForm.resx"> <EmbeddedResource Include="ShiftOS\Apps\TestForm.resx">
<DependentUpon>TestForm.cs</DependentUpon> <DependentUpon>TestForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View file

@ -27,12 +27,12 @@ namespace ShiftOS.Main.ShiftOS.Apps
} }
catch(FormatException ex) catch(FormatException ex)
{ {
ShiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.ButtonType.Ok); ShiftWM.StartInfoboxSession("Error!", "Failed to parse integer. Error:\n" + ex, InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Critical);
} }
if (_colorType1 > 255 || _colorType2 > 255 || _colorType3 > 255) if (_colorType1 > 255 || _colorType2 > 255 || _colorType3 > 255)
{ {
ShiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.ButtonType.Ok); ShiftWM.StartInfoboxSession("Error!", "A value cannot be greater than 255!", InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Critical);
} }
else else
{ {
@ -40,12 +40,12 @@ namespace ShiftOS.Main.ShiftOS.Apps
{ {
ShiftWindow sw = new ShiftWindow(); ShiftWindow sw = new ShiftWindow();
_finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3);
BackColor = _finalColor; ShiftWM.SetTitleBarColor(_finalColor);
ShiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + _colorType1.ToString() + ", " + _colorType2.ToString() + ", " + _colorType3.ToString() + ".", InfoboxTemplate.ButtonType.Ok); ShiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + _colorType1.ToString() + ", " + _colorType2.ToString() + ", " + _colorType3.ToString() + ".", InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Info);
} }
catch (Exception) catch (Exception)
{ {
ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok); ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Critical);
} }
} }
} }

View file

@ -0,0 +1,93 @@
namespace ShiftOS.Main.ShiftOS.Apps
{
partial class Snakey
{
/// <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.length = new System.Windows.Forms.Label();
this.speed = new System.Windows.Forms.Label();
this.score = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// length
//
this.length.AutoSize = true;
this.length.BackColor = System.Drawing.Color.Transparent;
this.length.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.length.ForeColor = System.Drawing.Color.White;
this.length.Location = new System.Drawing.Point(573, 18);
this.length.Name = "length";
this.length.Size = new System.Drawing.Size(76, 20);
this.length.TabIndex = 16;
this.length.Text = "Length: 5";
//
// speed
//
this.speed.AutoSize = true;
this.speed.BackColor = System.Drawing.Color.Transparent;
this.speed.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.speed.ForeColor = System.Drawing.Color.White;
this.speed.Location = new System.Drawing.Point(287, 18);
this.speed.Name = "speed";
this.speed.Size = new System.Drawing.Size(73, 20);
this.speed.TabIndex = 15;
this.speed.Text = "Speed: 1";
//
// score
//
this.score.AutoSize = true;
this.score.BackColor = System.Drawing.Color.Transparent;
this.score.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.score.ForeColor = System.Drawing.Color.White;
this.score.Location = new System.Drawing.Point(24, 18);
this.score.Name = "score";
this.score.Size = new System.Drawing.Size(100, 20);
this.score.TabIndex = 14;
this.score.Text = "Total Points: ";
//
// Snakey
//
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.length);
this.Controls.Add(this.speed);
this.Controls.Add(this.score);
this.Name = "Snakey";
this.Size = new System.Drawing.Size(673, 447);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
internal System.Windows.Forms.Label length;
internal System.Windows.Forms.Label speed;
internal System.Windows.Forms.Label score;
}
}

View file

@ -0,0 +1,123 @@
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;
using System.Drawing.Drawing2D;
using ShiftOS.Engine;
using ShiftOS.Main.Properties;
namespace ShiftOS.Main.ShiftOS.Apps
{
public partial class Snakey : UserControl
{
public Snakey()
{
InitializeComponent();
}
private struct structSnake
{
public Rectangle rect;
public int x;
public int y;
}
private enum directions
{
Rightward,
Downward,
Leftward,
Upward
}
#region Various-Objects
private const int INTIAL_SNAKE_RECT_COUNT = 5;
private const int COLUMN_COUNT = 65;
private const int ROW_COUNT = 47;
private int curRecCount;
private Rectangle[,] Rects;
private bool [,] isSnakePart;
private List<structSnake> snake;
private Brush snakeBrush = new SolidBrush(Color.FromArgb(255, 255, 255));
private Brush backBrush = new SolidBrush(Color.FromArgb(1, 1, 1));
private Brush tokenBrush = new SolidBrush(Color.FromArgb(255, 255, 255));
private directions curDirection;
private Bitmap buffer;
private int columnCount;
private int rowCount;
private int snakePoints;
private double snakeSpeed;
private int snakeLength;
private Rectangle token;
#endregion
private int xyIndexToRect(int X, int Y)
{
return (Y * (columnCount)) + X;
}
private void rectToIndexXY(double index, double X, double Y)
{
X = index % (columnCount);
Y = Math.Round(index / columnCount);
}
private void initSnake()
{
int x;
int y;
int index;
snake = new List<structSnake>();
structSnake sSnake = new structSnake();
x = ((columnCount) - 10 / 2);
y = ((rowCount) - 6) / 2;
Point snakePosition = new Point(x, y);
index = xyIndexToRect(x, y);
for (int i = 0; i < INTIAL_SNAKE_RECT_COUNT; i++)
{
rectToIndexXY(index + (i - 1), x, y);
sSnake.rect = Rects[x, y];
sSnake.x = x;
sSnake.y = y;
snake.Add(sSnake);
}
snakeLength = INTIAL_SNAKE_RECT_COUNT;
snakeSpeed = 1;
length.Text = "Length: " + snakeLength.ToString();
speed.Text = "Speed: " + snakeSpeed.ToString();
}
private void selectRectangles()
{
Graphics g = Graphics.FromImage(Resources.snakeyback);
int i;
structSnake sSnake = new structSnake();
for (i = 0; i < INTIAL_SNAKE_RECT_COUNT; i++)
{
sSnake = snake[i];
g.FillRectangle(snakeBrush, sSnake.rect);
isSnakePart[sSnake.x, sSnake.y] = true;
}
buffer = new Bitmap(Resources.snakeyback);
g.Dispose();
Refresh();
}
private void initRectangles()
{
int i;
int j;
columnCount = COLUMN_COUNT;
rowCount = ROW_COUNT;
Rects = new Rectangle[columnCount, rowCount];
isSnakePart = new bool[columnCount, rowCount];
for (j = 0; j < rowCount; j++)
{
for (i = 0; i < columnCount; i++)
{
//TO-DO: I can't really port this over right now. Commiting soon. -FDD
}
}
}
}
}

View file

@ -28,60 +28,57 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox(); this.comboBox1 = new System.Windows.Forms.ComboBox();
this.systemIconsBindingSource = new System.Windows.Forms.BindingSource(this.components); this.systemIconsBindingSource = new System.Windows.Forms.BindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).BeginInit(); this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).BeginInit();
// this.SuspendLayout();
// textBox1 //
// // textBox1
this.textBox1.Location = new System.Drawing.Point(18, 20); //
this.textBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.textBox1.Location = new System.Drawing.Point(12, 13);
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(388, 26); this.textBox1.Size = new System.Drawing.Size(260, 20);
this.textBox1.TabIndex = 0; this.textBox1.TabIndex = 0;
this.textBox1.Text = "Title"; this.textBox1.Text = "Title";
// //
// textBox2 // textBox2
// //
this.textBox2.Location = new System.Drawing.Point(18, 60); this.textBox2.Location = new System.Drawing.Point(12, 39);
this.textBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.textBox2.Name = "textBox2";
this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(260, 20);
this.textBox2.Size = new System.Drawing.Size(388, 26); this.textBox2.TabIndex = 1;
this.textBox2.TabIndex = 1; this.textBox2.Text = "Contents";
this.textBox2.Text = "Contents"; //
// // button1
// button1 //
// this.button1.Location = new System.Drawing.Point(9, 97);
this.button1.Location = new System.Drawing.Point(13, 149); this.button1.Name = "button1";
this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.button1.Size = new System.Drawing.Size(128, 23);
this.button1.Name = "button1"; this.button1.TabIndex = 2;
this.button1.Size = new System.Drawing.Size(192, 35); this.button1.Text = "Create Window";
this.button1.TabIndex = 2; this.button1.UseVisualStyleBackColor = true;
this.button1.Text = "Create Window"; this.button1.Click += new System.EventHandler(this.Button1_Click);
this.button1.UseVisualStyleBackColor = true; //
this.button1.Click += new System.EventHandler(this.Button1_Click); // button2
// //
// button2 this.button2.Location = new System.Drawing.Point(145, 97);
// this.button2.Name = "button2";
this.button2.Location = new System.Drawing.Point(217, 149); this.button2.Size = new System.Drawing.Size(126, 23);
this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.button2.TabIndex = 4;
this.button2.Name = "button2"; this.button2.Text = "Test Shifter";
this.button2.Size = new System.Drawing.Size(189, 35); this.button2.UseVisualStyleBackColor = true;
this.button2.TabIndex = 4; this.button2.Click += new System.EventHandler(this.button2_Click);
this.button2.Text = "Test Shifter"; //
this.button2.UseVisualStyleBackColor = true; // comboBox1
this.button2.Click += new System.EventHandler(this.button2_Click); //
// this.comboBox1.FormattingEnabled = true;
// comboBox1 this.comboBox1.Items.AddRange(new object[] {
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"Application", "Application",
"Asterisk", "Asterisk",
"Error", "Error",
@ -92,31 +89,41 @@
"Shield", "Shield",
"Warning", "Warning",
"WinLogo"}); "WinLogo"});
this.comboBox1.Location = new System.Drawing.Point(18, 104); this.comboBox1.Location = new System.Drawing.Point(12, 68);
this.comboBox1.Name = "comboBox1"; this.comboBox1.Margin = new System.Windows.Forms.Padding(2);
this.comboBox1.Size = new System.Drawing.Size(388, 28); this.comboBox1.Name = "comboBox1";
this.comboBox1.TabIndex = 5; this.comboBox1.Size = new System.Drawing.Size(260, 21);
// this.comboBox1.TabIndex = 5;
// systemIconsBindingSource //
// // systemIconsBindingSource
this.systemIconsBindingSource.DataSource = typeof(System.Drawing.SystemIcons); //
// this.systemIconsBindingSource.DataSource = typeof(System.Drawing.SystemIcons);
// TestForm //
// // panel1
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.panel1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.ClientSize = new System.Drawing.Size(426, 198); this.panel1.Location = new System.Drawing.Point(71, 138);
this.Controls.Add(this.comboBox1); this.panel1.Name = "panel1";
this.Controls.Add(this.button2); this.panel1.Size = new System.Drawing.Size(200, 37);
this.Controls.Add(this.button1); this.panel1.TabIndex = 6;
this.Controls.Add(this.textBox2); this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);
this.Controls.Add(this.textBox1); //
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); // TestForm
this.Name = "TestForm"; //
this.Text = "TestForm"; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).EndInit(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ResumeLayout(false); this.ClientSize = new System.Drawing.Size(284, 175);
this.PerformLayout(); this.Controls.Add(this.panel1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Name = "TestForm";
this.Text = "TestForm";
((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
} }
@ -128,5 +135,6 @@
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.BindingSource systemIconsBindingSource; private System.Windows.Forms.BindingSource systemIconsBindingSource;
} private System.Windows.Forms.Panel panel1;
}
} }

View file

@ -10,6 +10,7 @@ namespace ShiftOS.Main
{ {
public partial class TestForm : Form public partial class TestForm : Form
{ {
Point loc;
public TestForm() public TestForm()
{ {
InitializeComponent(); InitializeComponent();
@ -17,16 +18,25 @@ namespace ShiftOS.Main
private void Button1_Click(object sender, EventArgs e) private void Button1_Click(object sender, EventArgs e)
{ {
ShiftDemo demo = new ShiftDemo {label1 = {Text = textBox2.Text}}; ShiftDemo demo = new ShiftDemo { label1 = { Text = textBox2.Text } };
var item = typeof(SystemIcons).GetProperties() var item = typeof(SystemIcons).GetProperties()
.First(p => p.Name == comboBox1.SelectedItem as string); .First(p => p.Name == comboBox1.SelectedItem as string);
ShiftWM.Init(demo, textBox1.Text, (item.GetMethod.Invoke(null, new object[0]) as Icon)); ShiftWM.Init(demo, textBox1.Text, (item.GetMethod.Invoke(null, new object[0]) as Icon));
ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok); ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Critical);
} }
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
=> ShiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter.ToIcon()); => ShiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter.ToIcon());
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
loc = new Point(Cursor.Position.X, Cursor.Position.Y);
this.Location = loc;
}
}
} }
} }

View file

@ -28,75 +28,78 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.listView1 = new System.Windows.Forms.ListView(); this.listView1 = new System.Windows.Forms.ListView();
this.taskbar = new System.Windows.Forms.ToolStrip(); this.taskbar = new System.Windows.Forms.ToolStrip();
this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
this.taskbarClock = new System.Windows.Forms.ToolStripLabel(); this.taskbarClock = new System.Windows.Forms.ToolStripLabel();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.taskbar.SuspendLayout(); this.taskbar.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// listView1 // listView1
// //
this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listView1.Location = new System.Drawing.Point(0, 0); this.listView1.Location = new System.Drawing.Point(0, 0);
this.listView1.Name = "listView1"; this.listView1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.listView1.Size = new System.Drawing.Size(1962, 1236); this.listView1.Name = "listView1";
this.listView1.TabIndex = 0; this.listView1.Size = new System.Drawing.Size(913, 489);
this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.TabIndex = 0;
// this.listView1.UseCompatibleStateImageBehavior = false;
// taskbar //
// // taskbar
this.taskbar.Dock = System.Windows.Forms.DockStyle.Bottom; //
this.taskbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.taskbar.Dock = System.Windows.Forms.DockStyle.Bottom;
this.taskbar.ImageScalingSize = new System.Drawing.Size(24, 24); this.taskbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.taskbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.taskbar.ImageScalingSize = new System.Drawing.Size(24, 24);
this.taskbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripDropDownButton1, this.toolStripDropDownButton1,
this.taskbarClock}); this.taskbarClock});
this.taskbar.Location = new System.Drawing.Point(0, 1204); this.taskbar.Location = new System.Drawing.Point(0, 458);
this.taskbar.Name = "taskbar"; this.taskbar.Name = "taskbar";
this.taskbar.Size = new System.Drawing.Size(1962, 32); this.taskbar.Size = new System.Drawing.Size(913, 31);
this.taskbar.TabIndex = 1; this.taskbar.TabIndex = 1;
this.taskbar.Text = "toolStrip1"; this.taskbar.Text = "toolStrip1";
// //
// toolStripDropDownButton1 // toolStripDropDownButton1
// //
this.toolStripDropDownButton1.Image = global::ShiftOS.Main.Properties.Resources.iconWebBrowser; this.toolStripDropDownButton1.Image = global::ShiftOS.Main.Properties.Resources.iconWebBrowser;
this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
this.toolStripDropDownButton1.Size = new System.Drawing.Size(131, 29); this.toolStripDropDownButton1.Size = new System.Drawing.Size(95, 28);
this.toolStripDropDownButton1.Tag = ((uint)(0u)); this.toolStripDropDownButton1.Tag = ((uint)(0u));
this.toolStripDropDownButton1.Text = "Programs"; this.toolStripDropDownButton1.Text = "Programs";
// this.toolStripDropDownButton1.Click += new System.EventHandler(this.toolStripDropDownButton1_Click);
// taskbarClock //
// // taskbarClock
this.taskbarClock.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; //
this.taskbarClock.Image = global::ShiftOS.Main.Properties.Resources.iconClock; this.taskbarClock.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.taskbarClock.Name = "taskbarClock"; this.taskbarClock.Image = global::ShiftOS.Main.Properties.Resources.iconClock;
this.taskbarClock.Size = new System.Drawing.Size(70, 29); this.taskbarClock.Name = "taskbarClock";
this.taskbarClock.Tag = ((uint)(0u)); this.taskbarClock.Size = new System.Drawing.Size(52, 28);
this.taskbarClock.Text = "0:00"; this.taskbarClock.Tag = ((uint)(0u));
// this.taskbarClock.Text = "0:00";
// timer1 //
// // timer1
this.timer1.Interval = 1000; //
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Interval = 1000;
// this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// Desktop //
// // Desktop
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.ClientSize = new System.Drawing.Size(1962, 1236); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.taskbar); this.ClientSize = new System.Drawing.Size(913, 489);
this.Controls.Add(this.listView1); this.Controls.Add(this.taskbar);
this.Name = "Desktop"; this.Controls.Add(this.listView1);
this.Text = "Desktop"; this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.taskbar.ResumeLayout(false); this.Name = "Desktop";
this.taskbar.PerformLayout(); this.Text = "Desktop";
this.ResumeLayout(false); this.taskbar.ResumeLayout(false);
this.PerformLayout(); this.taskbar.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
} }

View file

@ -8,6 +8,9 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using ShiftOS.Engine.WindowManager; using ShiftOS.Engine.WindowManager;
using ShiftOS.Main.ShiftOS.Apps;
using ShiftOS.Main.Properties;
using ShiftOS.Engine;
namespace ShiftOS.Main.ShiftOS namespace ShiftOS.Main.ShiftOS
{ {
@ -57,5 +60,10 @@ namespace ShiftOS.Main.ShiftOS
private void timer1_Tick(object sender, EventArgs e) => private void timer1_Tick(object sender, EventArgs e) =>
taskbarClock.Text = $"{DateTime.Now:t}"; taskbarClock.Text = $"{DateTime.Now:t}";
}
private void toolStripDropDownButton1_Click(object sender, EventArgs e)
{
ShiftWM.Init(new Snakey(), "Snakey - WIP", Resources.iconSnakey.ToIcon(), false, true);
}
}
} }