/// <summary> /// constructor - set up the input /// </summary> /// <param name="x"> x coordinate where to draw the input mask</param> /// <param name="y">y coordinate where to draw the input mask</param> /// <param name="radius"> how big the input mask should be</param> /// <param name="display"> display module</param> /// <param name="joystick"> joystick module</param> /// <param name="finishedHandler"> event handler which indicates if an input was finished</param> public ColorCodeInput(int x, int y, int radius, Gadgeteer.Modules.Module.DisplayModule display, Gadgeteer.Modules.GHIElectronics.Joystick joystick, EventHandler finishedHandler) { this.pos_x = x; this.pos_y = y; this.radius = radius; this.display = display; this.joystick = joystick; this.pos_code = 0; this.finishedHandler = finishedHandler; this.code = new ColorCode(); this.view = new ColorCodeView(pos_x,pos_y,radius,display,code); this.pos_joystick = new Joystick.Position(); }
public MenuDisplayer(Gadgeteer.Modules.GHIElectronics.Joystick joystick, DisplayT35 display) { this.joystick = joystick; this.joystick.JoystickReleased += joystick_JoystickReleased; this.display = display; displayWidth = (uint)display.Width - 7; displayHeight = (uint)display.Height - 7; cursor = new Bitmap(15, 15); cursor.Clear(); cursor.MakeTransparent(Color.Black); cursor.DrawLine(Color.White, 1, 7, 0, 7, 14); cursor.DrawLine(Color.White, 1, 0, 7, 15, 7); }
/// <summary> /// constructor, gets all peripherals needed for the UI /// </summary> /// <param name="inputFinished">an EventHandler which will be called when the input in a round is completed successfully</param> public GameView(MasterMind masterMind, Gadgeteer.Modules.Module.DisplayModule display, Gadgeteer.Modules.GHIElectronics.Joystick joystick, Gadgeteer.Modules.GHIElectronics.MulticolorLED led, EventHandler inputFinished) { this.masterMind = masterMind; //store Gadgeteer device references for later use this.display = display; this.joystick = joystick; this.led = led; //event handler which will be invoked when the user finished his input..we just pass this to the current ColorCodeInput this.inputFinished = inputFinished; //start with the first round! display.SimpleGraphics.Clear(); display.SimpleGraphics.DisplayText("Mastermind - good luck!", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.White, CODE_X_POS, WELCOME_Y_POS); createColorCodeInput(0); }