コード例 #1
0
ファイル: Game1.cs プロジェクト: JamieRWright/Musical-Medley
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     // TODO: use this.Content to load your game content here
     StaveRec         = new Rectangle(10, 10, 1000, 200);
     PauseButtonRec   = new Rectangle(500, 300, 70, 45);
     Metronome        = new Rectangle(500, 400, 70, 45);
     UpArrowRec       = new Rectangle(1, 1, 30, 20);
     DownArrowRec     = new Rectangle(1, 25, 30, 20);
     Index            = 0;
     Counter          = 0;
     PressedNotes     = "";
     _OctaveVariation = Note.TOctaveIndex.Octave_3;
     IsGameActive     = true;
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: JamieRWright/Musical-Medley
        public void OctaveToggle()
        {
            bool OctavesUp   = _CurrentKey.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Up) && _PriorKey.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Up);
            bool OctavesDown = _CurrentKey.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Down) && _PriorKey.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Down);
            bool OctaveClick = CurrentButton.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed && PriorButton.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released;

            _OctaveVariation = (Note.TOctaveIndex)((int)_OctaveVariation % 9);
            if (OctavesUp || (OctaveClick && UpArrowRec.Contains(CurrentButton.X, CurrentButton.Y)))
            {
                _OctaveVariation++;
            }
            if (OctavesDown || (OctaveClick && DownArrowRec.Contains(CurrentButton.X, CurrentButton.Y)))
            {
                if (_OctaveVariation == 0)
                {
                    _OctaveVariation = Note.TOctaveIndex.Octave_8;
                }
                else
                {
                    _OctaveVariation--;
                }
            }
        }