Exemplo n.º 1
0
        /// <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)
        {
            // TODO: Add your update logic here

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            InputManager.Update();

            AudioManager.Update(InputManager.mouseState); //también a la función Update de AudioManager
            ChordListManager.Update(gameTime, InputManager.mouseState);
            ChordPlayingManager.Update(gameTime, InputManager.mouseState);
            ChordAnsweringManager.Update(gameTime, InputManager.mouseState);
            ScoreManager.Update(gameTime, InputManager.mouseState);

            base.Update(gameTime);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);


            // TODO: Add your drawing code here
            spriteBatch.Begin();
            spriteBatch.Draw(background, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);

            LayoutManager.Draw(spriteBatch);
            AudioManager.Draw(spriteBatch);
            ChordListManager.Draw(spriteBatch);
            ChordPlayingManager.Draw(spriteBatch);
            ChordAnsweringManager.Draw(spriteBatch);
            ScoreManager.Draw(spriteBatch);

            spriteBatch.End();

            base.Draw(gameTime);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            //Cambio el tamaño de la ventana
            graphics.PreferredBackBufferWidth  = (int)windowSize.X; //el Vector2 trabaja con floats, así que acá preciso castear a Int
            graphics.PreferredBackBufferHeight = (int)windowSize.Y; //el Vector2 trabaja con floats, así que acá preciso castear a Int
            graphics.ApplyChanges();


            Dictionaries.CreateDictionaries(); //llamo a la función "CreateDictionaries" (que está en la Class "Dictionaries", y que crea los diccionarios (pares de integers y strings) con los nombres e índices correspondientes de tipos de acorde y demás (


            IsMouseVisible = true; //pongo esto así puedo ver el mouse sobre la aplicación

            base.Initialize();     //esto llama a la función "LoadContent"

            LayoutManager.Initialize();
            AudioManager.Initialize();     //llamo a la función "Initialize" del Audio Manager, que es necesario hacerlo luego de cargar contenido, así puedo acceder al fontDefault (obs.: como AudioManager es static no es necesario inicializar una instancia)
            ChordListManager.Initialize(); //llamo a la función "Initialize" del Audio Manager, que es necesario hacerlo luego de cargar contenido, así puedo acceder al fontDefault (obs.: como AudioManager es static no es necesario inicializar una instancia)
            ChordPlayingManager.Initialize();
            ChordAnsweringManager.Initialize();
            ScoreManager.Initialize();
        }