コード例 #1
0
ファイル: Game1.cs プロジェクト: timrisi/MonoPong
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            keyboardState = Keyboard.GetState ();

            if (activeScreen == startScreen) {
                if (CheckKey (Keys.Enter)) {
                    activeScreen.Hide ();
                    actionScreen.NumPlayers = startScreen.SelectedIndex + 1;
                    actionScreen.NewGame ();
                    activeScreen = actionScreen;
                    activeScreen.Show ();
                }
            }

            if (activeScreen == actionScreen) {
                if (CheckKey (Keys.Escape) || (CheckKey (Keys.Space) && actionScreen.GameOver)) {
                    activeScreen.Hide ();
                    activeScreen = startScreen;
                    activeScreen.Show ();
                }
            }

            base.Update (gameTime);

            oldKeyboardState = keyboardState;
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: timrisi/MonoPong
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be use to draw textures.
            spriteBatch = new SpriteBatch (graphics.GraphicsDevice);

            font = Content.Load<SpriteFont> ("SpriteFont1");
            rectangle = Content.Load<Texture2D> ("WhiteSquare");

            startScreen = new StartScreen (this, spriteBatch, font);
            startScreen.Hide ();
            Components.Add (startScreen);

            actionScreen = new ActionScreen (this, spriteBatch, Content, font, rectangle);
            actionScreen.Hide ();
            Components.Add (actionScreen);

            activeScreen = startScreen;
            activeScreen.Show ();

            base.LoadContent ();
        }
コード例 #3
0
ファイル: 466a-Pong1.cs プロジェクト: jkh9/sv2017-programming
        static void Main(string[] args)
        {
            GameScreen game = new GameScreen();

            game.Run();
        }