示例#1
0
        public void Render(DoomMenu menu)
        {
            var selectable = menu.Current as SelectableMenu;

            if (selectable != null)
            {
                this.DrawSelectableMenu(selectable);
            }

            var save = menu.Current as SaveMenu;

            if (save != null)
            {
                this.DrawSaveMenu(save);
            }

            var load = menu.Current as LoadMenu;

            if (load != null)
            {
                this.DrawLoadMenu(load);
            }

            var yesNo = menu.Current as YesNoConfirm;

            if (yesNo != null)
            {
                this.DrawText(yesNo.Text);
            }

            var pressAnyKey = menu.Current as PressAnyKey;

            if (pressAnyKey != null)
            {
                this.DrawText(pressAnyKey.Text);
            }

            var quit = menu.Current as QuitConfirm;

            if (quit != null)
            {
                this.DrawText(quit.Text);
            }

            var help = menu.Current as HelpScreen;

            if (help != null)
            {
                this.DrawHelp(help);
            }
        }
示例#2
0
    void StartGame(IwadInfo info)
    {
        mapBuilder = new MapBuilder();

        if (args.warp == "")
        {
            title.Build(wad);
            PlayMidi(info.titleMusic);
        }
        else
        {
            title.DisableCamera();
            menuActive = false;
            BuildMap(args.warp);
        }
        menu = new DoomMenu(wad);
    }
示例#3
0
        public void Render(DoomMenu menu)
        {
            var current = menu.Current;

            for (var i = 0; i < current.Name.Count; i++)
            {
                DrawMenuPatch(current.Name[i], current.TitleX[i], current.TitleY[i]);
            }

            foreach (var item in current.Items)
            {
                DrawMenuItem(menu, item);
            }

            var choice = current.Choice;
            var skull  = menu.Tics / 8 % 2 == 0 ? "M_SKULL1" : "M_SKULL2";

            DrawMenuPatch(skull, choice.SkullX, choice.SkullY);
        }
示例#4
0
 void SetupMenu()
 {
     menu        = new DoomMenu(wad);
     menu.onQuit = MenuQuit;
     menu.onPlay = MenuPlay;
 }
示例#5
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);
            }
        }