コード例 #1
0
ファイル: GameScreen.cs プロジェクト: KimRestad/Bubbles
        /// <summary>
        /// Create the game screen and its contents.
        /// </summary>
        public GameScreen()
        {
            // Load textures and fonts.
            mPanelBG = Core.Content.Load<Texture2D>(@"Textures\bricks");
            mChalkBoard = Core.Content.Load<Texture2D>(@"Textures\chalkBoard");
            mProgressBar = Core.Content.Load<Texture2D>(@"Textures\wallTop");
            mChalkFont = Core.Content.Load<SpriteFont>(@"Fonts\chalk");

            // Set up state variables.
            mBounds = new Rectangle(0, 0, Core.ClientBounds.Width - 400, Core.ClientBounds.Height);
            mNextLvlScreen = new NextLevelScreen();
            mPauseScreen = new PauseScreen();
            UnPause();

            // Set up panel (chalk board, progress bar and button).
            int padding = 30;
            int boardwidth = (Core.ClientBounds.Width - (mBounds.X + mBounds.Width)) - padding * 2;
            int boardheight = (int)(mChalkBoard.Height / ((float)mChalkBoard.Width / boardwidth));
            int textHeight = (int)mChalkFont.MeasureString("Score").Y;
            mChalkBoardPosition = new Rectangle(mBounds.X + mBounds.Width + padding, 100, boardwidth, boardheight);
            mProgressPosition = new Rectangle(mChalkBoardPosition.X, 500, 200, 50);
            mInfoPosition = new Vector2(mChalkBoardPosition.X + padding, mChalkBoardPosition.Y + padding);
            mScorePosition = new Vector2(mChalkBoardPosition.X + padding,
                                         mChalkBoardPosition.Y + mChalkBoardPosition.Height - padding - textHeight);

            mBtnMenu = new Button(BtnMenuClick, new Rectangle(mChalkBoardPosition.X, 660, mChalkBoardPosition.Width, 64), "Return to menu");
        }