Skip to content

Commit

Permalink
Add argument for no-vsync (#185)
Browse files Browse the repository at this point in the history
Default is vsync on
  • Loading branch information
PhilipK authored Jul 18, 2022
1 parent e377224 commit 4bafe86
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod amazon;
mod config;
mod egs;
mod flatpak;
mod gog;
mod heroic;
mod itch;
Expand All @@ -15,19 +16,18 @@ mod steamgriddb;
mod sync;
mod ui;
mod uplay;
mod flatpak;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
ensure_config_folder();
migration::migrate_config();

let mut args = std::env::args();
if args.len() > 1 && args.nth(1).unwrap_or_default() == "--no-ui" {
let args: Vec<String> = std::env::args().collect();
if args.contains(&"--no-ui".to_string()) {
ui::run_sync();
Ok(())
} else {
ui::run_ui()
ui::run_ui(args)
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/ui/uiapp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::error::Error;
use std::{env::Args, error::Error};

use eframe::{egui, App, Frame};
use egui::{ImageButton, Rounding, Stroke, TextureHandle};
Expand Down Expand Up @@ -253,12 +253,13 @@ pub fn 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 no_v_sync = args.contains(&"--no-vsync".to_string());
let native_options = eframe::NativeOptions {
initial_window_size: Some(egui::Vec2 { x: 800., y: 500. }),
icon_data: Some(get_logo_icon()),
vsync: !no_v_sync,
..Default::default()
};
eframe::run_native(
Expand Down

0 comments on commit 4bafe86

Please sign in to comment.