Add argument for no-vsync (#185)

Default is vsync on
This commit is contained in:
Philip Kristoffersen
2022-07-18 09:23:46 +02:00
committed by GitHub
parent e377224573
commit 4bafe868cc
3 changed files with 14 additions and 7 deletions
+6
View File
@@ -53,3 +53,9 @@ enabled = true #If false, the whole download of custom art will be skipped.
auth_key="<your steamgrid db auth key>" #This value is mandatory if you have steamgrid_db enabled. auth_key="<your steamgrid db auth key>" #This value is mandatory if you have steamgrid_db enabled.
prefer_animated = false #If true, animated images will be prefered over static images when downloading art. prefer_animated = false #If true, animated images will be prefered over static images when downloading art.
``` ```
## No Vsync
BoilR runs with Vsync Enabled, to limit its resource use.
This can be a problem for some setups that run Linux, Wayland and Nvidia (but not all).
If BoilR just crashes when you start it, try to add `--no-vsync` as an argument when you launch boilr.
+4 -4
View File
@@ -1,6 +1,7 @@
mod amazon; mod amazon;
mod config; mod config;
mod egs; mod egs;
mod flatpak;
mod gog; mod gog;
mod heroic; mod heroic;
mod itch; mod itch;
@@ -15,19 +16,18 @@ mod steamgriddb;
mod sync; mod sync;
mod ui; mod ui;
mod uplay; mod uplay;
mod flatpak;
use std::error::Error; use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
ensure_config_folder(); ensure_config_folder();
migration::migrate_config(); migration::migrate_config();
let mut args = std::env::args(); let args: Vec<String> = std::env::args().collect();
if args.len() > 1 && args.nth(1).unwrap_or_default() == "--no-ui" { if args.contains(&"--no-ui".to_string()) {
ui::run_sync(); ui::run_sync();
Ok(()) Ok(())
} else { } else {
ui::run_ui() ui::run_ui(args)
} }
} }
+4 -3
View File
@@ -1,4 +1,4 @@
use std::error::Error; use std::{env::Args, error::Error};
use eframe::{egui, App, Frame}; use eframe::{egui, App, Frame};
use egui::{ImageButton, Rounding, Stroke, TextureHandle}; use egui::{ImageButton, Rounding, Stroke, TextureHandle};
@@ -253,12 +253,13 @@ pub fn run_sync() {
app.run_sync(); app.run_sync();
} }
pub fn run_ui() -> Result<(), Box<dyn Error>> { pub fn run_ui(args: Vec<String>) -> Result<(), Box<dyn Error>> {
let app = MyEguiApp::new(); let app = MyEguiApp::new();
let no_v_sync = args.contains(&"--no-vsync".to_string());
let native_options = eframe::NativeOptions { let native_options = eframe::NativeOptions {
initial_window_size: Some(egui::Vec2 { x: 800., y: 500. }), initial_window_size: Some(egui::Vec2 { x: 800., y: 500. }),
icon_data: Some(get_logo_icon()), icon_data: Some(get_logo_icon()),
vsync: !no_v_sync,
..Default::default() ..Default::default()
}; };
eframe::run_native( eframe::run_native(