From 57453a13e01ae5fcb5578a41cba686efba2d3783 Mon Sep 17 00:00:00 2001 From: lempamo Date: Mon, 27 Feb 2017 18:25:23 -0500 Subject: do more snake stuffs --- ShiftOS.WinForms/Applications/Snakey.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'ShiftOS.WinForms/Applications/Snakey.cs') 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++) -- cgit v1.2.3