Ejemplo n.º 1
0
Archivo: Game.cs Proyecto: bosoni/csat
        public override void Init()
        {
            Settings.TextureDir = "../../data/texture/";
            string AudioDir = "../../data/";

            back = Texture2D.Load("bg.jpg");
            img[0] = Texture2D.Load("head.png", true);
            img[1] = Texture2D.Load("ball.png", true);
            crosshair = Texture2D.Load("cross.png", true);

            font = BitmapFont.Load("fonts/comic12.png");

            BaseGame.Instance.CursorVisible = false; // hide mouse cursor
            //System.Windows.Forms.Cursor.Hide();

            if (player == null)
            {
                player = new OggPlayerFBN();
                player.SetCurrentFile(AudioDir + "music.ogg");

            }
            player.Play();

            snd1 = new AudioClip(AudioDir + "snd2.ogg");
            snd2 = new AudioClip(AudioDir + "snd1.ogg");

            Camera.Set2D();
            base.Init();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            OggPlaylist playlist = new OggPlaylist();

            // Add the guitar sound
            OggFile guitarFile = new OggFile("GuitarSample.ogg");
            OggPlaylistFile guitarPlayList = new OggPlaylistFile(guitarFile, 0);
            playlist.Add(guitarPlayList);

            // Add the boing sound after the guitar
            OggFile boingFile = new OggFile("BoingSample.ogg");
            OggPlaylistFile boingPlayList = new OggPlaylistFile(boingFile, -1);
            playlist.Add(boingPlayList);

            OggPlayerFBN player = new OggPlayerFBN();

            // Keep playing until our playlist is empty
            while(true)
            {
                while (player.PlayerState != OggPlayerStatus.Waiting
                    && player.PlayerState != OggPlayerStatus.Stopped)
                {
                    Thread.Sleep(5);
                }

                if (playlist.GetNextFile() != null)
                {
                    playlist.CurrentFile.File.ResetFile();
                    player.SetCurrentFile(playlist.CurrentFile.File);
                    player.Play();
                }
                else
                {
                    break;
                }
            }
        }