| 428 | } |
| 429 | |
| 430 | void Game_Config::LoadFromArgs(CmdlineParser& cp) { |
| 431 | font_path.clear(); |
| 432 | soundfont_path.clear(); |
| 433 | |
| 434 | while (!cp.Done()) { |
| 435 | CmdlineArg arg; |
| 436 | long li_value = 0; |
| 437 | std::string str_value; |
| 438 | |
| 439 | if (cp.ParseNext(arg, 0, {"--vsync", "--no-vsync"})) { |
| 440 | video.vsync.Set(arg.ArgIsOn()); |
| 441 | continue; |
| 442 | } |
| 443 | if (cp.ParseNext(arg, 1, "--fps-limit")) { |
| 444 | if (arg.ParseValue(0, li_value)) { |
| 445 | video.fps_limit.Set(li_value); |
| 446 | } |
| 447 | continue; |
| 448 | } |
| 449 | if (cp.ParseNext(arg, 0, "--no-fps-limit")) { |
| 450 | video.fps_limit.Set(0); |
| 451 | continue; |
| 452 | } |
| 453 | if (cp.ParseNext(arg, 0, "--show-fps")) { |
| 454 | video.fps.Set(ConfigEnum::ShowFps::ON); |
| 455 | continue; |
| 456 | } |
| 457 | if (cp.ParseNext(arg, 0, "--no-show-fps")) { |
| 458 | video.fps.Set(ConfigEnum::ShowFps::OFF); |
| 459 | continue; |
| 460 | } |
| 461 | if (cp.ParseNext(arg, 0, "--fps-render-window")) { |
| 462 | video.fps.Set(ConfigEnum::ShowFps::Overlay); |
| 463 | continue; |
| 464 | } |
| 465 | if (cp.ParseNext(arg, 0, "--pause-focus-lost")) { |
| 466 | video.pause_when_focus_lost.Set(true); |
| 467 | continue; |
| 468 | } |
| 469 | if (cp.ParseNext(arg, 0, "--no-pause-focus-lost")) { |
| 470 | video.pause_when_focus_lost.Set(false); |
| 471 | continue; |
| 472 | } |
| 473 | if (cp.ParseNext(arg, 0, "--window")) { |
| 474 | video.fullscreen.Set(false); |
| 475 | continue; |
| 476 | } |
| 477 | if (cp.ParseNext(arg, 0, "--fullscreen")) { |
| 478 | video.fullscreen.Set(true); |
| 479 | continue; |
| 480 | } |
| 481 | if (cp.ParseNext(arg, 1, "--window-zoom")) { |
| 482 | if (arg.ParseValue(0, li_value)) { |
| 483 | video.window_zoom.Set(li_value); |
| 484 | } |
| 485 | continue; |
| 486 | } |
| 487 | if (cp.ParseNext(arg, 0, {"--stretch", "--no-stretch"})) { |