Exemplo n.º 1
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _pixel       = new Texture2D(GraphicsDevice, 1, 1);
            _pixel.SetData(new Color[] { Color.White }.AsSpan());

            _font = Content.Load <SpriteFont>("arial");

            _watch = new Stopwatch();

            _watch.Restart();
            _song1        = Content.Load <Song>("sinus");
            _song1.Volume = 0.2f;
            _song1.Pitch  = 1.5f;
            _watch.Stop();
            Console.WriteLine("sinus Load Time: " + _watch.ElapsedMilliseconds + "ms");

            _winJingle = Content.Load <SoundEffect>("Win Jingle");

            _testTexture = Content.Load <Texture2D>("test");

            using (var fs = File.OpenRead("risgrot.png"))
                using (var img = Texture2D.LoadImage(fs))
                    _grotCursor = MouseCursor.FromImage(img, new Point(img.Width - 1, img.Height / 2));
            Mouse.SetCursor(_grotCursor);

            //w.Restart();
            //_song2 = Content.Load<Song>("Win Jingle");
            //_song2.Volume = 0.2f;
            //w.Stop();
            //Console.WriteLine("Song Load Time: " + w.ElapsedMilliseconds + "ms");

            //w.Restart();
            //_hitReflectSound = Content.Load<SoundEffect>("hit_reflect_0");
            //w.Stop();
            //Console.WriteLine("Load Time: " + w.ElapsedMilliseconds + "ms");

            //testMusicStream = new FileStream("test.raw", FileMode.Open);
            _dynamicSound = new DynamicSoundEffectInstance(44100, AudioChannels.Stereo);
            _dynamicSound.BufferNeeded += DynamicSound_BufferNeeded;
            _dynamicSound.Pitch         = 2;
            //_dynamicSound.Play();
        }