aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/Snakey.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms/Applications/Snakey.cs')
-rw-r--r--ShiftOS.WinForms/Applications/Snakey.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/Snakey.cs b/ShiftOS.WinForms/Applications/Snakey.cs
index 855e25e..b8b1ece 100644
--- a/ShiftOS.WinForms/Applications/Snakey.cs
+++ b/ShiftOS.WinForms/Applications/Snakey.cs
@@ -18,6 +18,7 @@ namespace ShiftOS.WinForms.Applications
public partial class Snakey : UserControl, IShiftOSWindow
{
private int[,] snakemap;
+ private int snakedirection = 0; // 0 - Left, 1 - Down, 2 - Right, 3 - Up
public Snakey()
{
@@ -29,6 +30,31 @@ namespace ShiftOS.WinForms.Applications
makeGrid();
}
+ private void OnKeyPress(object sender, KeyPressEventArgs e)
+ {
+ switch (e.KeyChar)
+ {
+ case (char)Keys.Up:
+ snakedirection = 3;
+ break;
+
+ case (char)Keys.Down:
+ snakedirection = 1;
+ break;
+
+ case (char)Keys.Left:
+ snakedirection = 0;
+ break;
+
+ case (char)Keys.Right:
+ snakedirection = 2;
+ break;
+
+ default:
+ break;
+ }
+ }
+
private void makeGrid()
{
for (int x = 0; x < 10; x++)