コード例 #1
0
        // Los pinta abajo centrados en linea
        private static void initializePauseButtons(Button[] buttons)
        {
            int x = WINDOW_WIDTH / 2 - GameButtonList.getPauseNumber() / 2 * GameButtonList.BUTTON_WIDTH -
                    (GameButtonList.getPauseNumber() % 2) * GameButtonList.BUTTON_WIDTH / 2;
            int y = WINDOW_HEIGHT - GameButtonList.BUTTON_HEIGHT - 20;

            foreach (GameButtonList.pauseButton b in Enum.GetValues(typeof(GameButtonList.pauseButton)))
            {
                buttons[(int)b] = new Button(b.ToString(), x, y, GameButtonList.BUTTON_WIDTH, GameButtonList.BUTTON_HEIGHT);
                x += GameButtonList.BUTTON_WIDTH;
            }
        }
コード例 #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);
        }