public void RenderWipe(DoomApplication app, WipeEffect wipe) { this.RenderApplication(app); var scale = this.screen.Width / 320; for (var i = 0; i < this.wipeBandCount - 1; i++) { var x1 = this.wipeBandWidth * i; var x2 = x1 + this.wipeBandWidth; var y1 = Math.Max(scale * wipe.Y[i], 0); var y2 = Math.Max(scale * wipe.Y[i + 1], 0); var dy = (float)(y2 - y1) / this.wipeBandWidth; for (var x = x1; x < x2; x++) { var y = (int)MathF.Round(y1 + dy * ((x - x1) / 2 * 2)); var copyLength = this.screen.Height - y; if (copyLength > 0) { var srcPos = this.screen.Height * x; var dstPos = this.screen.Height * x + y; Array.Copy(this.wipeBuffer, srcPos, this.screen.Data, dstPos, copyLength); } } } this.RenderMenu(app); this.Display(this.palette[0]); }
public DoomApplication(CommandLineArgs args) { config = new Config(ConfigUtilities.GetConfigPath()); try { config.video_screenwidth = Math.Clamp(config.video_screenwidth, 320, 3200); config.video_screenheight = Math.Clamp(config.video_screenheight, 200, 2000); var videoMode = new VideoMode((uint)config.video_screenwidth, (uint)config.video_screenheight); var style = Styles.Close | Styles.Titlebar; if (config.video_fullscreen) { style = Styles.Fullscreen; } window = new RenderWindow(videoMode, ApplicationInfo.Title, style); window.Clear(new Color(64, 64, 64)); window.Display(); if (args.deh.Present) { DeHackEd.ReadFiles(args.deh.Value); } resource = new CommonResource(GetWadPaths(args)); renderer = new SfmlRenderer(config, window, resource); if (!args.nosound.Present && !args.nosfx.Present) { sound = new SfmlSound(config, resource.Wad); } if (!args.nosound.Present && !args.nomusic.Present) { music = ConfigUtilities.GetSfmlMusicInstance(config, resource.Wad); } userInput = new SfmlUserInput(config, window, !args.nomouse.Present); events = new List <DoomEvent>(); options = new GameOptions(); options.GameVersion = resource.Wad.GameVersion; options.GameMode = resource.Wad.GameMode; options.MissionPack = resource.Wad.MissionPack; options.Renderer = renderer; options.Sound = sound; options.Music = music; options.UserInput = userInput; menu = new DoomMenu(this); opening = new OpeningSequence(resource, options); cmds = new TicCmd[Player.MaxPlayerCount]; for (var i = 0; i < Player.MaxPlayerCount; i++) { cmds[i] = new TicCmd(); } game = new DoomGame(resource, options); wipe = new WipeEffect(renderer.WipeBandCount, renderer.WipeHeight); wiping = false; currentState = ApplicationState.None; nextState = ApplicationState.Opening; needWipe = false; sendPause = false; quit = false; quitMessage = null; CheckGameArgs(args); window.Closed += (sender, e) => window.Close(); window.KeyPressed += KeyPressed; window.KeyReleased += KeyReleased; if (!args.timedemo.Present) { window.SetFramerateLimit(35); } mouseGrabbed = false; } catch (Exception e) { Dispose(); ExceptionDispatchInfo.Throw(e); } }
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); } }
public DoomApplication(CommandLineArgs args, String[] configLines, HttpClient http, Stream wadStream, IJSRuntime jsRuntime, IJSInProcessRuntime jSInProcessRuntime, WebAssemblyJSRuntime webAssemblyJSRuntime, string wadUrl) { Http = http; WadStream = wadStream; JsRuntime = jsRuntime; JSInProcessRuntime = jSInProcessRuntime; WebAssemblyJSRuntime = webAssemblyJSRuntime; configLines = new string[] { "video_screenwidth=320", "video_screenHeight=200", }; config = new Config(configLines); try { config.video_screenwidth = Math.Clamp(config.video_screenwidth, 320, 3200); config.video_screenheight = Math.Clamp(config.video_screenheight, 200, 2000); var videoMode = VideoMode.CanvasMode; var style = Styles.Close | Styles.Titlebar; if (config.video_fullscreen) { style = Styles.Fullscreen; } window = new RenderWindow(videoMode, ApplicationInfo.Title, style); window.Clear(new Color(64, 64, 64)); window.Display(); if (args.deh.Present) { DeHackEd.ReadFiles(args.deh.Value); } // resource = new CommonResource(GetWadPaths(args)); resource = new CommonResource(new string[] { wadUrl }); renderer = new SfmlRenderer(config, window, resource); if (!args.nosound.Present && !args.nosfx.Present) { sound = new SfmlSound(config, resource.Wad); } if (!args.nosound.Present && !args.nomusic.Present) { music = ConfigUtilities.GetSfmlMusicInstance(config, resource.Wad); } userInput = new SfmlUserInput(config, window, !args.nomouse.Present); options = new GameOptions(); options.GameVersion = resource.Wad.GameVersion; options.GameMode = resource.Wad.GameMode; options.MissionPack = resource.Wad.MissionPack; options.Renderer = renderer; options.Sound = sound; options.Music = music; options.UserInput = userInput; menu = new DoomMenu(this); opening = new OpeningSequence(resource, options); cmds = new TicCmd[Player.MaxPlayerCount]; for (var i = 0; i < Player.MaxPlayerCount; i++) { cmds[i] = new TicCmd(); } game = new DoomGame(resource, options); wipe = new WipeEffect(renderer.WipeBandCount, renderer.WipeHeight); wiping = false; currentState = ApplicationState.None; nextState = ApplicationState.Opening; needWipe = false; sendPause = false; quit = false; quitMessage = null; CheckGameArgs(args); } catch (Exception e) { Dispose(); ExceptionDispatchInfo.Throw(e); } }
public Doom(CommandLineArgs args, Config config, GameContent content, IVideo video, ISound sound, IMusic music, IUserInput userInput) { video = video ?? NullVideo.GetInstance(); sound = sound ?? NullSound.GetInstance(); music = music ?? NullMusic.GetInstance(); userInput = userInput ?? NullUserInput.GetInstance(); this.args = args; this.config = config; this.content = content; this.video = video; this.sound = sound; this.music = music; this.userInput = userInput; if (args.deh.Present) { DeHackEd.ReadFiles(args.deh.Value); } if (!args.nodeh.Present) { DeHackEd.ReadDeHackEdLump(content.Wad); } events = new List <DoomEvent>(); options = new GameOptions(); options.GameVersion = content.Wad.GameVersion; options.GameMode = content.Wad.GameMode; options.MissionPack = content.Wad.MissionPack; options.Video = video; options.Sound = sound; options.Music = music; options.UserInput = userInput; menu = new DoomMenu(this); opening = new OpeningSequence(content, options); cmds = new TicCmd[Player.MaxPlayerCount]; for (var i = 0; i < Player.MaxPlayerCount; i++) { cmds[i] = new TicCmd(); } game = new DoomGame(content, options); wipeEffect = new WipeEffect(video.WipeBandCount, video.WipeHeight); wiping = false; currentState = DoomState.None; nextState = DoomState.Opening; needWipe = false; sendPause = false; quit = false; quitMessage = null; mouseGrabbed = false; CheckGameArgs(); }