示例#1
0
        public Sound(IPlatform platform, SoundSettings soundSettings)
        {
            soundEngine = platform.CreateSound(soundSettings.Device);

            if (soundSettings.Mute)
            {
                MuteAudio();
            }
        }
示例#2
0
文件: Sound.cs 项目: OpenRA/OpenRA
        public Sound(IPlatform platform, SoundSettings soundSettings)
        {
            soundEngine = platform.CreateSound(soundSettings.Device);

            if (soundSettings.Mute)
                MuteAudio();
        }
示例#3
0
        public DoomApplication(IPlatform platform, CommandLineArgs args)
        {
            DoomApplication.Instance = this;

            this.FileSystem = new VirtualFileSystem();

            var wads = this.GetWadPaths(args);

            foreach (var wad in wads)
            {
                this.FileSystem.Add(new WadFileSystem(this.FileSystem.Read(wad)));
            }

            this.config = new Config(platform, "managed-doom.cfg");

            try
            {
                this.config.video_screenwidth  = Math.Clamp(this.config.video_screenwidth, 320, 3200);
                this.config.video_screenheight = Math.Clamp(this.config.video_screenheight, 200, 2000);

                this.window = platform.CreateWindow(ApplicationInfo.Title, this.config);
                this.window.Clear(Color.FromArgb(64, 64, 64));
                this.window.Display();

                this.Resource = new CommonResource();

                this.renderer = platform.CreateRenderer(this.config, this.window, this.Resource);

                if (!args.nosound.Present && !args.nosfx.Present)
                {
                    this.sound = platform.CreateSound(this.config);
                }

                if (!args.nosound.Present && !args.nomusic.Present)
                {
                    this.music = platform.CreateMusic(this.config);
                }

                this.userInput = platform.CreateUserInput(this.config, this.window, args.nomouse.Present);

                this.events = new List <DoomEvent>();

                this.options           = new GameOptions();
                this.options.Renderer  = this.renderer;
                this.options.Sound     = this.sound;
                this.options.Music     = this.music;
                this.options.UserInput = this.userInput;

                this.menu = new DoomMenu(this);

                this.opening = new OpeningSequence(this.options);

                this.cmd = new TicCmd();

                this.game = new DoomGame(this.Resource, this.options);

                this.wipe   = new WipeEffect(this.renderer.WipeBandCount, this.renderer.WipeHeight);
                this.wiping = false;

                this.currentState = ApplicationState.None;
                this.nextState    = ApplicationState.Opening;
                this.needWipe     = false;

                this.sendPause = false;

                this.quit        = false;
                this.quitMessage = null;

                this.CheckGameArgs(args);

                this.window.Closed      += (sender, e) => this.window.Close();
                this.window.KeyPressed  += this.KeyPressed;
                this.window.KeyReleased += this.KeyReleased;

                this.window.SetFramerateLimit(35);
            }
            catch (Exception e)
            {
                this.Dispose();
                ExceptionDispatchInfo.Throw(e);
            }
        }