/// <summary> /// Constructor, initalizes all the needed elements /// </summary> /// <param name="display"></param> /// <param name="button"></param> /// <param name="joystick"></param> public ModeSelection(Gadgeteer.Modules.Module.DisplayModule display, Gadgeteer.Modules.GHIElectronics.Joystick joystick, EventHandler handler) { this.display = display; this.joystick = joystick; this.pos_joystick = new Gadgeteer.Modules.GHIElectronics.Joystick.Position(); display.SimpleGraphics.Clear(); inputFinished = handler; }
public void startSelection(GT.Timer timer) { pos_joystick = joystick.GetPosition(); if (pos_joystick.Y > 0.2) { dir = direction.UP; display.SimpleGraphics.Clear(); display.SimpleGraphics.DisplayText("Please pick a mode", font, Gadgeteer.Color.White, 20, 10); display.SimpleGraphics.DisplayRectangle(GT.Color.Cyan, 2, GT.Color.DarkGray, 18, 50, 80, 30); display.SimpleGraphics.DisplayTextInRectangle("One Player", 20, 50, 100, 50, Gadgeteer.Color.Yellow, font); display.SimpleGraphics.DisplayTextInRectangle("Two Player", 20, 80, 100, 50, Gadgeteer.Color.Yellow, font); } if (pos_joystick.Y < -0.2) { dir = direction.DOWN; display.SimpleGraphics.Clear(); display.SimpleGraphics.DisplayText("Please pick a mode", font, Gadgeteer.Color.White, 20, 10); display.SimpleGraphics.DisplayRectangle(GT.Color.Cyan, 2, GT.Color.DarkGray, 18, 80, 80, 30); display.SimpleGraphics.DisplayTextInRectangle("One Player", 20, 50, 100, 50, Gadgeteer.Color.Yellow, font); display.SimpleGraphics.DisplayTextInRectangle("Two Player", 20, 80, 100, 50, Gadgeteer.Color.Yellow, font); } }