Exemplo n.º 1
0
 /// <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();
 }
Exemplo n.º 2
0
        /// <summary>
        /// displays the right code and win/loose message at the end of the game
        /// also controls the LED
        /// </summary>
        /// <param name="rightCode">the right (secret) code</param>
        /// <param name="gameWon">true if the game was won, false if the player lost</param>
        public void gameFinished(ColorCode rightCode, bool gameWon)
        {
            display.SimpleGraphics.DisplayText("The right code was:", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, FINAL_CODE_X_POS, FINAL_CODE_Y_POS + TEXT_SIZE);
            ColorCodeView rightCodeView = new ColorCodeView(FINAL_CODE_X_POS+10, FINAL_CODE_Y_POS + CODE_SIZE*2 + TEXT_SIZE*2, CODE_SIZE, display, rightCode);
            rightCodeView.drawColorCode();

            if (gameWon)
            {
                display.SimpleGraphics.DisplayText("You won!", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Green, FINAL_CODE_X_POS, FINAL_CODE_Y_POS);
                led.FadeRepeatedly(GT.Color.Green);
            }
            else
            {
                display.SimpleGraphics.DisplayText("You lost!", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, FINAL_CODE_X_POS, FINAL_CODE_Y_POS);
                led.FadeRepeatedly(GT.Color.Red);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// initializes and draws everything (new input field, last result code) for a new round
 /// </summary>
 /// <param name="lastResultCode">result code (correct colors, correct positions) of the last round</param>
 public void nextRound(ColorCode lastResultCode)
 {
     int round = masterMind.getCurrentRound();
     ColorCodeView resultView = new ColorCodeView(RESULT_X_POS, (round + 2) * CODE_SIZE_SPACING * 2, CODE_SIZE, display, lastResultCode);
     resultView.drawColorCode();
     createColorCodeInput(round);
 }