aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/Snakey.cs
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-02-27 18:25:23 -0500
committerlempamo <[email protected]>2017-02-27 18:25:23 -0500
commit57453a13e01ae5fcb5578a41cba686efba2d3783 (patch)
tree943d3006d4512220bbed2d7fddb56862e885e17f /ShiftOS.WinForms/Applications/Snakey.cs
parent7525f0a0d08479043ab467cacd3fd18cbc2a9259 (diff)
downloadshiftos_thereturn-57453a13e01ae5fcb5578a41cba686efba2d3783.tar.gz
shiftos_thereturn-57453a13e01ae5fcb5578a41cba686efba2d3783.tar.bz2
shiftos_thereturn-57453a13e01ae5fcb5578a41cba686efba2d3783.zip
do more snake stuffs
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++)