public List<Staff> registeredListeners; //TODO: change list type to accept any objects that implement a listening interface

        #endregion Fields

        #region Constructors

        public KeyboardManager(Staff aStaff)
        {
            possibleKeys = new Dictionary<Keys,bool>();
            registeredListeners = new List<Staff>();
            registeredListeners.Add(aStaff);
            SetupWithComputerKeyboard();
        }
예제 #2
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
            //Set the screen height and width
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.IsFullScreen = true;

            //Apply the changes made to the device
            graphics.ApplyChanges();

            staff = new Staff();

            const float EPOS = 251.0f;
            const float DPOS = 251.0f + 27.0f;
            const float CPOS = 251.0f + 54.0f;

            const Keys E_KEY = Keys.D;
            const Keys D_KEY = Keys.S;
            const Keys C_KEY = Keys.A;

            //BEGIN MARY HAD A LITTLE LAMB

            //dsasddd-sss-ddd- dsasddddssdsa a= middle C s = D d =E on piano

            staff.AddNote(new Note(new Vector2(2050.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(2550.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(3050.0f, CPOS), 0.0f, 0.0f, NoteType.quarter, C_KEY)); //C
            staff.AddNote(new Note(new Vector2(3550.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(4050.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(4550.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(5050.0f, EPOS), 0.0f, 0.0f, NoteType.half, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(6050.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(6550.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(7050.0f, DPOS), 0.0f, 0.0f, NoteType.half, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(8050.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(8550.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(9050.0f, EPOS), 0.0f, 0.0f, NoteType.half, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(10050.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(10550.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(11050.0f, CPOS), 0.0f, 0.0f, NoteType.quarter, C_KEY)); //C
            staff.AddNote(new Note(new Vector2(11550.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(12051.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(12550.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(13050.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(13550.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(14050.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(14550.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(15050.0f, EPOS), 0.0f, 0.0f, NoteType.quarter, E_KEY)); //E
            staff.AddNote(new Note(new Vector2(15550.0f, DPOS), 0.0f, 0.0f, NoteType.quarter, D_KEY)); //D
            staff.AddNote(new Note(new Vector2(16050.0f, CPOS), 0.0f, 0.0f, NoteType.whole, C_KEY)); //C
            //END MARY HAD A LITTLE LAMB

            keyboardManager = new KeyboardManager(staff);

            base.Initialize();
        }