Пример #1
0
 public PlayingSoundEffect PlaySound(int soundIndex, bool repeat = false, float volume = 1.0f) //TODO: Allow the user to specify a value to send to AudioResponse when the sound finishes playing
 {
     lock (PlayingSounds)
     {
         PlayingSoundEffect t = new PlayingSoundEffect(LoadedSounds[soundIndex], repeat, volume);
         PlayingSounds.Add(t);
         return(t);
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please start from the main method of a game class.");

            //Test timing code
            var me   = new Core(1);
            var akey = me.RegisterInput(Keys.A);
            var bkey = me.RegisterInput(Keys.B);

            var testSound = me.RegisterSound("../../assets/sounds/testSound.wav");
            PlayingSoundEffect playingSound = null;

            me.MenuLoop = () => {
                //Console.WriteLine("Proc " + me.frameCounter);
                Console.WriteLine(me.GetInputState(akey));
                if (me.GetInputState(bkey) == InputState.JustPressed)
                {
                    Console.WriteLine("B just pressed");
                }
                if (me.GetInputState(bkey) == InputState.JustReleased)
                {
                    Console.WriteLine("B just released");
                }
                //Play some sounds (3x at start and 60bpm)
                //if (me.frameCounter == 30 || me.frameCounter == 60 || me.frameCounter % 120 == 0) me.PlaySound(testSound);
                //if (me.frameCounter > 300) me.Exit();
                //if (me.frameCounter == 1) playingSound = me.PlaySound(testSound, true);
                //if (me.frameCounter == 600) playingSound.stopSound();
            };
            me.MenuDraw = () => {
                //Console.WriteLine("Draw " + me.frameCounter);
            };
            me.Begin();
            //Cleanup goes here
            Console.ReadKey();
        }