diff --git a/.vs/ShiftOS/v15/sqlite3/storage.ide b/.vs/ShiftOS/v15/sqlite3/storage.ide index 3be5453..d58d29e 100644 Binary files a/.vs/ShiftOS/v15/sqlite3/storage.ide and b/.vs/ShiftOS/v15/sqlite3/storage.ide differ diff --git a/ShiftOS.Engine/Properties/Resources.Designer.cs b/ShiftOS.Engine/Properties/Resources.Designer.cs index db83dd9..470100c 100644 --- a/ShiftOS.Engine/Properties/Resources.Designer.cs +++ b/ShiftOS.Engine/Properties/Resources.Designer.cs @@ -92,9 +92,39 @@ namespace ShiftOS.Engine.Properties { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap Symbolinfo { + internal static System.Drawing.Bitmap symbolError { get { - object obj = ResourceManager.GetObject("Symbolinfo", resourceCulture); + object obj = ResourceManager.GetObject("symbolError", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap symbolInfo { + get { + object obj = ResourceManager.GetObject("symbolInfo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap symbolQuestion { + get { + object obj = ResourceManager.GetObject("symbolQuestion", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap symbolWarning { + get { + object obj = ResourceManager.GetObject("symbolWarning", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } diff --git a/ShiftOS.Engine/Properties/Resources.resx b/ShiftOS.Engine/Properties/Resources.resx index db3d27b..7c6edde 100644 --- a/ShiftOS.Engine/Properties/Resources.resx +++ b/ShiftOS.Engine/Properties/Resources.resx @@ -121,13 +121,22 @@ ..\Resources\nullIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Symbolinfo1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\iconInfoBox.fw.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\infobox.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\symbolError.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Symbolinfo1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\symbolQuestion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\symbolWarning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.Engine/Resources/Symbolinfo - Copy.png b/ShiftOS.Engine/Resources/Symbolinfo - Copy.png deleted file mode 100644 index 659d9b3..0000000 Binary files a/ShiftOS.Engine/Resources/Symbolinfo - Copy.png and /dev/null differ diff --git a/ShiftOS.Engine/Resources/symbolError.png b/ShiftOS.Engine/Resources/symbolError.png new file mode 100644 index 0000000..83c210d Binary files /dev/null and b/ShiftOS.Engine/Resources/symbolError.png differ diff --git a/ShiftOS.Engine/Resources/symbolQuestion.png b/ShiftOS.Engine/Resources/symbolQuestion.png new file mode 100644 index 0000000..f6f9325 Binary files /dev/null and b/ShiftOS.Engine/Resources/symbolQuestion.png differ diff --git a/ShiftOS.Engine/Resources/symbolWarning.png b/ShiftOS.Engine/Resources/symbolWarning.png index f8805f6..1ea4287 100644 Binary files a/ShiftOS.Engine/Resources/symbolWarning.png and b/ShiftOS.Engine/Resources/symbolWarning.png differ diff --git a/ShiftOS.Engine/ShiftOS.Engine.csproj b/ShiftOS.Engine/ShiftOS.Engine.csproj index 2b436c1..6da50d0 100644 --- a/ShiftOS.Engine/ShiftOS.Engine.csproj +++ b/ShiftOS.Engine/ShiftOS.Engine.csproj @@ -92,5 +92,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/ShiftOS.Engine/Templates/InfoboxTemplate.Designer.cs b/ShiftOS.Engine/Templates/InfoboxTemplate.Designer.cs deleted file mode 100644 index ca37891..0000000 --- a/ShiftOS.Engine/Templates/InfoboxTemplate.Designer.cs +++ /dev/null @@ -1,110 +0,0 @@ -namespace ShiftOS.Engine.Templates -{ - partial class InfoboxTemplate - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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; - } -} diff --git a/ShiftOS.Engine/Templates/InfoboxTemplate.cs b/ShiftOS.Engine/Templates/InfoboxTemplate.cs deleted file mode 100644 index bfc91a6..0000000 --- a/ShiftOS.Engine/Templates/InfoboxTemplate.cs +++ /dev/null @@ -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, - } - } -} diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs index a076c2a..2675935 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.Designer.cs @@ -69,7 +69,7 @@ // this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 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.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(80, 70); @@ -80,7 +80,6 @@ // changeSize // this.changeSize.Interval = 1; - this.changeSize.Tick += new System.EventHandler(this.changeSize_Tick); // // label1 // diff --git a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs index a5be129..c5e49de 100644 --- a/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs +++ b/ShiftOS.Engine/WindowManager/InfoboxTemplate.cs @@ -11,7 +11,7 @@ namespace ShiftOS.Engine.WindowManager Stream _str; private int _buttonChoice; private int _buttonSelected; - public InfoboxTemplate(ButtonType type) + public InfoboxTemplate(ButtonType type, ErrorIcon icon) { InitializeComponent(); @@ -34,6 +34,21 @@ namespace ShiftOS.Engine.WindowManager _buttonChoice = 3; 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 @@ -43,6 +58,13 @@ namespace ShiftOS.Engine.WindowManager Ok } + public enum ErrorIcon + { + Info, + Critical, + Error, + Question + } private void btnOpt1_Click(object sender, EventArgs e) { switch (btnOpt1.Text) @@ -82,10 +104,9 @@ namespace ShiftOS.Engine.WindowManager private void InfoboxTemplate_Load(object sender, EventArgs e) => Play(); - private void changeSize_Tick(object sender, EventArgs e) + private void SetImage(Image imageType) { - this.Height += label1.Height; - this.Width += label1.Width; + pictureBox1.Image = imageType; } } } diff --git a/ShiftOS.Main/HijackScreen.Designer.cs b/ShiftOS.Main/HijackScreen.Designer.cs index fab31dc..c0e5de9 100644 --- a/ShiftOS.Main/HijackScreen.Designer.cs +++ b/ShiftOS.Main/HijackScreen.Designer.cs @@ -28,12 +28,11 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); - this.conversationtimer = new System.Windows.Forms.Timer(this.components); - this.hackeffecttimer = new System.Windows.Forms.Timer(this.components); + this.conversationtimer = new System.Windows.Forms.Timer(); + this.hackeffecttimer = new System.Windows.Forms.Timer(); 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.SuspendLayout(); // diff --git a/ShiftOS.Main/ShiftOS.Main.csproj b/ShiftOS.Main/ShiftOS.Main.csproj index c814c14..84d64ab 100644 --- a/ShiftOS.Main/ShiftOS.Main.csproj +++ b/ShiftOS.Main/ShiftOS.Main.csproj @@ -70,6 +70,12 @@ Shifter.cs + + UserControl + + + Snakey.cs + Form @@ -104,6 +110,9 @@ Shifter.cs + + Snakey.cs + TestForm.cs diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs index 697e22e..5eb5faa 100644 --- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs +++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs @@ -27,12 +27,12 @@ namespace ShiftOS.Main.ShiftOS.Apps } 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) { - 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 { @@ -40,12 +40,12 @@ namespace ShiftOS.Main.ShiftOS.Apps { ShiftWindow sw = new ShiftWindow(); _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3); - BackColor = _finalColor; - ShiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + _colorType1.ToString() + ", " + _colorType2.ToString() + ", " + _colorType3.ToString() + ".", InfoboxTemplate.ButtonType.Ok); + ShiftWM.SetTitleBarColor(_finalColor); + ShiftWM.StartInfoboxSession("Success!", "Changed color to:\n" + _colorType1.ToString() + ", " + _colorType2.ToString() + ", " + _colorType3.ToString() + ".", InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Info); } 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); } } } diff --git a/ShiftOS.Main/ShiftOS/Apps/Snakey.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/Snakey.Designer.cs new file mode 100644 index 0000000..bef7a6b --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Apps/Snakey.Designer.cs @@ -0,0 +1,93 @@ +namespace ShiftOS.Main.ShiftOS.Apps +{ + partial class Snakey + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} diff --git a/ShiftOS.Main/ShiftOS/Apps/Snakey.cs b/ShiftOS.Main/ShiftOS/Apps/Snakey.cs new file mode 100644 index 0000000..d8d4a98 --- /dev/null +++ b/ShiftOS.Main/ShiftOS/Apps/Snakey.cs @@ -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 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 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 + } + } + } + } +} + diff --git a/ShiftOS.Engine/Templates/InfoboxTemplate.resx b/ShiftOS.Main/ShiftOS/Apps/Snakey.resx similarity index 100% rename from ShiftOS.Engine/Templates/InfoboxTemplate.resx rename to ShiftOS.Main/ShiftOS/Apps/Snakey.resx diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs index 50bcb58..53765bd 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs @@ -28,60 +28,57 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.systemIconsBindingSource = new System.Windows.Forms.BindingSource(this.components); - ((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).BeginInit(); - this.SuspendLayout(); - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(18, 20); - this.textBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(388, 26); - this.textBox1.TabIndex = 0; - this.textBox1.Text = "Title"; - // - // textBox2 - // - this.textBox2.Location = new System.Drawing.Point(18, 60); - this.textBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(388, 26); - this.textBox2.TabIndex = 1; - this.textBox2.Text = "Contents"; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(13, 149); - this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(192, 35); - this.button1.TabIndex = 2; - this.button1.Text = "Create Window"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.Button1_Click); - // - // button2 - // - this.button2.Location = new System.Drawing.Point(217, 149); - this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(189, 35); - this.button2.TabIndex = 4; - this.button2.Text = "Test Shifter"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // comboBox1 - // - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Items.AddRange(new object[] { + this.components = new System.ComponentModel.Container(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.systemIconsBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.panel1 = new System.Windows.Forms.Panel(); + ((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).BeginInit(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(12, 13); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(260, 20); + this.textBox1.TabIndex = 0; + this.textBox1.Text = "Title"; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(12, 39); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(260, 20); + this.textBox2.TabIndex = 1; + this.textBox2.Text = "Contents"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(9, 97); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(128, 23); + this.button1.TabIndex = 2; + this.button1.Text = "Create Window"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(145, 97); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(126, 23); + this.button2.TabIndex = 4; + this.button2.Text = "Test Shifter"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { "Application", "Asterisk", "Error", @@ -92,31 +89,41 @@ "Shield", "Warning", "WinLogo"}); - this.comboBox1.Location = new System.Drawing.Point(18, 104); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(388, 28); - this.comboBox1.TabIndex = 5; - // - // systemIconsBindingSource - // - this.systemIconsBindingSource.DataSource = typeof(System.Drawing.SystemIcons); - // - // TestForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(426, 198); - 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.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.Name = "TestForm"; - this.Text = "TestForm"; - ((System.ComponentModel.ISupportInitialize)(this.systemIconsBindingSource)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + this.comboBox1.Location = new System.Drawing.Point(12, 68); + this.comboBox1.Margin = new System.Windows.Forms.Padding(2); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(260, 21); + this.comboBox1.TabIndex = 5; + // + // systemIconsBindingSource + // + this.systemIconsBindingSource.DataSource = typeof(System.Drawing.SystemIcons); + // + // panel1 + // + this.panel1.BackColor = System.Drawing.SystemColors.ControlDarkDark; + this.panel1.Location = new System.Drawing.Point(71, 138); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(200, 37); + this.panel1.TabIndex = 6; + this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove); + // + // TestForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 175); + 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.ComboBox comboBox1; private System.Windows.Forms.BindingSource systemIconsBindingSource; - } + private System.Windows.Forms.Panel panel1; + } } \ No newline at end of file diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs index 1fd3b18..e8360e0 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs @@ -10,6 +10,7 @@ namespace ShiftOS.Main { public partial class TestForm : Form { + Point loc; public TestForm() { InitializeComponent(); @@ -17,16 +18,25 @@ namespace ShiftOS.Main 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() - .First(p => p.Name == comboBox1.SelectedItem as string); + var item = typeof(SystemIcons).GetProperties() + .First(p => p.Name == comboBox1.SelectedItem as string); - ShiftWM.Init(demo, textBox1.Text, (item.GetMethod.Invoke(null, new object[0]) as Icon)); - ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok); + ShiftWM.Init(demo, textBox1.Text, (item.GetMethod.Invoke(null, new object[0]) as Icon)); + ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok, InfoboxTemplate.ErrorIcon.Critical); } - private void button2_Click(object sender, EventArgs e) - => ShiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter.ToIcon()); + private void button2_Click(object sender, EventArgs e) + => 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; + } + } } } diff --git a/ShiftOS.Main/ShiftOS/Desktop.Designer.cs b/ShiftOS.Main/ShiftOS/Desktop.Designer.cs index dac30c6..35cf33e 100644 --- a/ShiftOS.Main/ShiftOS/Desktop.Designer.cs +++ b/ShiftOS.Main/ShiftOS/Desktop.Designer.cs @@ -28,75 +28,78 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.listView1 = new System.Windows.Forms.ListView(); - this.taskbar = new System.Windows.Forms.ToolStrip(); - this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); - this.taskbarClock = new System.Windows.Forms.ToolStripLabel(); - this.timer1 = new System.Windows.Forms.Timer(this.components); - this.taskbar.SuspendLayout(); - this.SuspendLayout(); - // - // listView1 - // - this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; - this.listView1.Location = new System.Drawing.Point(0, 0); - this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(1962, 1236); - this.listView1.TabIndex = 0; - this.listView1.UseCompatibleStateImageBehavior = false; - // - // taskbar - // - this.taskbar.Dock = System.Windows.Forms.DockStyle.Bottom; - this.taskbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.taskbar.ImageScalingSize = new System.Drawing.Size(24, 24); - this.taskbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.components = new System.ComponentModel.Container(); + this.listView1 = new System.Windows.Forms.ListView(); + this.taskbar = new System.Windows.Forms.ToolStrip(); + this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); + this.taskbarClock = new System.Windows.Forms.ToolStripLabel(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.taskbar.SuspendLayout(); + this.SuspendLayout(); + // + // listView1 + // + this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.Location = new System.Drawing.Point(0, 0); + this.listView1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(913, 489); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + // + // taskbar + // + this.taskbar.Dock = System.Windows.Forms.DockStyle.Bottom; + this.taskbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.taskbar.ImageScalingSize = new System.Drawing.Size(24, 24); + this.taskbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripDropDownButton1, this.taskbarClock}); - this.taskbar.Location = new System.Drawing.Point(0, 1204); - this.taskbar.Name = "taskbar"; - this.taskbar.Size = new System.Drawing.Size(1962, 32); - this.taskbar.TabIndex = 1; - this.taskbar.Text = "toolStrip1"; - // - // toolStripDropDownButton1 - // - this.toolStripDropDownButton1.Image = global::ShiftOS.Main.Properties.Resources.iconWebBrowser; - this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; - this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; - this.toolStripDropDownButton1.Size = new System.Drawing.Size(131, 29); - this.toolStripDropDownButton1.Tag = ((uint)(0u)); - this.toolStripDropDownButton1.Text = "Programs"; - // - // taskbarClock - // - this.taskbarClock.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this.taskbarClock.Image = global::ShiftOS.Main.Properties.Resources.iconClock; - this.taskbarClock.Name = "taskbarClock"; - this.taskbarClock.Size = new System.Drawing.Size(70, 29); - this.taskbarClock.Tag = ((uint)(0u)); - this.taskbarClock.Text = "0:00"; - // - // timer1 - // - this.timer1.Interval = 1000; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); - // - // Desktop - // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1962, 1236); - this.Controls.Add(this.taskbar); - this.Controls.Add(this.listView1); - this.Name = "Desktop"; - this.Text = "Desktop"; - this.taskbar.ResumeLayout(false); - this.taskbar.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); + this.taskbar.Location = new System.Drawing.Point(0, 458); + this.taskbar.Name = "taskbar"; + this.taskbar.Size = new System.Drawing.Size(913, 31); + this.taskbar.TabIndex = 1; + this.taskbar.Text = "toolStrip1"; + // + // toolStripDropDownButton1 + // + this.toolStripDropDownButton1.Image = global::ShiftOS.Main.Properties.Resources.iconWebBrowser; + this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; + this.toolStripDropDownButton1.Size = new System.Drawing.Size(95, 28); + this.toolStripDropDownButton1.Tag = ((uint)(0u)); + this.toolStripDropDownButton1.Text = "Programs"; + this.toolStripDropDownButton1.Click += new System.EventHandler(this.toolStripDropDownButton1_Click); + // + // taskbarClock + // + this.taskbarClock.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.taskbarClock.Image = global::ShiftOS.Main.Properties.Resources.iconClock; + this.taskbarClock.Name = "taskbarClock"; + this.taskbarClock.Size = new System.Drawing.Size(52, 28); + this.taskbarClock.Tag = ((uint)(0u)); + this.taskbarClock.Text = "0:00"; + // + // timer1 + // + this.timer1.Interval = 1000; + 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.ClientSize = new System.Drawing.Size(913, 489); + this.Controls.Add(this.taskbar); + this.Controls.Add(this.listView1); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Name = "Desktop"; + this.Text = "Desktop"; + this.taskbar.ResumeLayout(false); + this.taskbar.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/ShiftOS.Main/ShiftOS/Desktop.cs b/ShiftOS.Main/ShiftOS/Desktop.cs index 494222a..1ea4183 100644 --- a/ShiftOS.Main/ShiftOS/Desktop.cs +++ b/ShiftOS.Main/ShiftOS/Desktop.cs @@ -8,6 +8,9 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ShiftOS.Engine.WindowManager; +using ShiftOS.Main.ShiftOS.Apps; +using ShiftOS.Main.Properties; +using ShiftOS.Engine; namespace ShiftOS.Main.ShiftOS { @@ -57,5 +60,10 @@ namespace ShiftOS.Main.ShiftOS private void timer1_Tick(object sender, EventArgs e) => taskbarClock.Text = $"{DateTime.Now:t}"; - } + + private void toolStripDropDownButton1_Click(object sender, EventArgs e) + { + ShiftWM.Init(new Snakey(), "Snakey - WIP", Resources.iconSnakey.ToIcon(), false, true); + } + } }