示例#1
0
        // Los pinta centrados en vertical
        private static void initializeMenuButtons(Button[] buttons)
        {
            int x = WINDOW_WIDTH / 2 - GameButtonList.BUTTON_WIDTH / 2;
            int y = WINDOW_HEIGHT / 2 - GameButtonList.getMenuNumber() / 2 * GameButtonList.BUTTON_HEIGHT -
                    (GameButtonList.getMenuNumber() % 2) * GameButtonList.BUTTON_HEIGHT / 2;

            foreach (GameButtonList.menuButton b in Enum.GetValues(typeof(GameButtonList.menuButton)))
            {
                buttons[(int)b] = new Button(b.ToString(), x, y, GameButtonList.BUTTON_WIDTH, GameButtonList.BUTTON_HEIGHT);
                y += GameButtonList.BUTTON_HEIGHT;
            }
        }
示例#2
0
        public GameCore(GraphicsDevice graphicsDevice)
        {
            this.gameScreen         = new GameScreen(graphicsDevice);
            this.nextScreenState    = screenState.INIT;
            this.nextPlayState      = playState.INIT;
            this.playerSkeleton     = null;
            this.gamePostures       = null;
            this.gameScores         = new Dictionary <PostureInformation, double>();
            this.menuButtons        = new Button[GameButtonList.getMenuNumber()];
            this.scoreButtons       = new Button[GameButtonList.getScoreNumber()];
            this.gameButtons        = new Button[GameButtonList.getGameNumber()];
            this.pauseButtons       = new Button[GameButtonList.getPauseNumber()];
            this.drawPostureTimeOut = Stopwatch.StartNew();
            this.holdPostureTimeOut = Stopwatch.StartNew();
            this.scoreTimeOut       = Stopwatch.StartNew();

            // Crea los botones del juego
            // por ahora les asignamos su posicion en pantalla con esos metodos...
            initializeMenuButtons(this.menuButtons);
            initializeScoreButtons(this.scoreButtons);
            initializeGameButtons(this.gameButtons);
            initializePauseButtons(this.pauseButtons);
        }