mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-02-16 15:22:01 +03:00
Added new options to the fps unlocker
This commit is contained in:
parent
219bac46f1
commit
7d91714d30
7 changed files with 62 additions and 19 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -31,7 +31,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anime-game-core"
|
||||
version = "1.3.0"
|
||||
version = "1.3.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bzip2",
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f6e64a259f438ec34db1e987779f3fa9d700d38c
|
||||
Subproject commit 12daa5b81916f4a9cd34e68d8347a64459aeac3f
|
|
@ -122,14 +122,34 @@ Adw.PreferencesPage page {
|
|||
}
|
||||
|
||||
Adw.ActionRow {
|
||||
title: "Fullscreen";
|
||||
subtitle: "Open game window in fullscreen mode";
|
||||
title: "Monitor";
|
||||
subtitle: "Number of monitor you want to run the game on";
|
||||
|
||||
Gtk.Switch fps_unlocker_fullscreen_switcher {
|
||||
Gtk.SpinButton fps_unlocker_monitor_num {
|
||||
valign: center;
|
||||
|
||||
adjustment: Gtk.Adjustment {
|
||||
value: 1;
|
||||
lower: 1;
|
||||
upper: 10;
|
||||
page-increment: 1;
|
||||
step-increment: 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Adw.ComboRow fps_unlocker_window_mode_combo {
|
||||
title: "Window mode";
|
||||
|
||||
model: Gtk.StringList {
|
||||
strings [
|
||||
"Default",
|
||||
"Popup",
|
||||
"Fullscreen"
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
Adw.ComboRow fps_unlocker_priority_combo {
|
||||
title: "Priority";
|
||||
subtitle: "Game process priority";
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 00a31d87bbac71133a7080a027e02371b511bdef
|
||||
Subproject commit 039d88ab45001cf799c421e58d4669a0596c4d29
|
|
@ -11,7 +11,8 @@ pub mod prelude {
|
|||
pub struct Config {
|
||||
pub fps: u64,
|
||||
pub power_saving: bool,
|
||||
pub fullscreen: bool,
|
||||
pub monitor: u64,
|
||||
pub window_mode: u64,
|
||||
pub priority: u64
|
||||
}
|
||||
|
||||
|
@ -20,7 +21,8 @@ impl Default for Config {
|
|||
Self {
|
||||
fps: 120,
|
||||
power_saving: false,
|
||||
fullscreen: false,
|
||||
monitor: 1,
|
||||
window_mode: 0,
|
||||
priority: 3
|
||||
}
|
||||
}
|
||||
|
@ -41,9 +43,14 @@ impl From<&JsonValue> for Config {
|
|||
None => default.power_saving
|
||||
},
|
||||
|
||||
fullscreen: match value.get("fullscreen") {
|
||||
Some(value) => value.as_bool().unwrap_or(default.fullscreen),
|
||||
None => default.fullscreen
|
||||
monitor: match value.get("monitor") {
|
||||
Some(value) => value.as_u64().unwrap_or(default.monitor),
|
||||
None => default.monitor
|
||||
},
|
||||
|
||||
window_mode: match value.get("window_mode") {
|
||||
Some(value) => value.as_u64().unwrap_or(default.window_mode),
|
||||
None => default.window_mode
|
||||
},
|
||||
|
||||
priority: match value.get("priority") {
|
||||
|
|
|
@ -53,7 +53,9 @@ impl ConfigSchema {
|
|||
Self {
|
||||
FPSTarget: config.fps,
|
||||
UsePowerSave: config.power_saving,
|
||||
Fullscreen: config.fullscreen,
|
||||
PopupWindow: config.window_mode == 1,
|
||||
Fullscreen: config.window_mode == 2,
|
||||
MonitorNum: config.monitor,
|
||||
Priority: config.priority,
|
||||
|
||||
..Self::default()
|
||||
|
|
|
@ -43,7 +43,8 @@ pub struct AppWidgets {
|
|||
pub fps_unlocker_combo: adw::ComboRow,
|
||||
pub fps_unlocker_switcher: gtk::Switch,
|
||||
pub fps_unlocker_power_saving_switcher: gtk::Switch,
|
||||
pub fps_unlocker_fullscreen_switcher: gtk::Switch,
|
||||
pub fps_unlocker_monitor_num: gtk::SpinButton,
|
||||
pub fps_unlocker_window_mode_combo: adw::ComboRow,
|
||||
pub fps_unlocker_priority_combo: adw::ComboRow
|
||||
}
|
||||
|
||||
|
@ -76,7 +77,8 @@ impl AppWidgets {
|
|||
fps_unlocker_combo: get_object(&builder, "fps_unlocker_combo")?,
|
||||
fps_unlocker_switcher: get_object(&builder, "fps_unlocker_switcher")?,
|
||||
fps_unlocker_power_saving_switcher: get_object(&builder, "fps_unlocker_power_saving_switcher")?,
|
||||
fps_unlocker_fullscreen_switcher: get_object(&builder, "fps_unlocker_fullscreen_switcher")?,
|
||||
fps_unlocker_monitor_num: get_object(&builder, "fps_unlocker_monitor_num")?,
|
||||
fps_unlocker_window_mode_combo: get_object(&builder, "fps_unlocker_window_mode_combo")?,
|
||||
fps_unlocker_priority_combo: get_object(&builder, "fps_unlocker_priority_combo")?
|
||||
};
|
||||
|
||||
|
@ -271,10 +273,19 @@ impl App {
|
|||
}
|
||||
});
|
||||
|
||||
// FPS unlocker -> fullscreen swithing
|
||||
self.widgets.fps_unlocker_fullscreen_switcher.connect_state_notify(move |switch| {
|
||||
// FPS unlocker -> monitor number
|
||||
self.widgets.fps_unlocker_monitor_num.connect_changed(move |button| {
|
||||
if let Ok(mut config) = config::get() {
|
||||
config.game.enhancements.fps_unlocker.config.fullscreen = switch.state();
|
||||
config.game.enhancements.fps_unlocker.config.monitor = button.value() as u64;
|
||||
|
||||
config::update(config);
|
||||
}
|
||||
});
|
||||
|
||||
// FPS unlocker -> window mode combo
|
||||
self.widgets.fps_unlocker_window_mode_combo.connect_selected_notify(move |row| {
|
||||
if let Ok(mut config) = config::get() {
|
||||
config.game.enhancements.fps_unlocker.config.window_mode = row.selected() as u64;
|
||||
|
||||
config::update(config);
|
||||
}
|
||||
|
@ -371,8 +382,11 @@ impl App {
|
|||
// Switch FPS unlocker -> power saving
|
||||
self.widgets.fps_unlocker_power_saving_switcher.set_state(config.game.enhancements.fps_unlocker.config.power_saving);
|
||||
|
||||
// Switch FPS unlocker -> fullscreen
|
||||
self.widgets.fps_unlocker_fullscreen_switcher.set_state(config.game.enhancements.fps_unlocker.config.fullscreen);
|
||||
// Switch FPS unlocker -> monitor number
|
||||
self.widgets.fps_unlocker_monitor_num.set_value(config.game.enhancements.fps_unlocker.config.monitor as f64);
|
||||
|
||||
// Switch FPS unlocker -> window mode
|
||||
self.widgets.fps_unlocker_window_mode_combo.set_selected(config.game.enhancements.fps_unlocker.config.window_mode as u32);
|
||||
|
||||
// Switch FPS unlocker -> priority
|
||||
self.widgets.fps_unlocker_priority_combo.set_selected(config.game.enhancements.fps_unlocker.config.priority as u32);
|
||||
|
|
Loading…
Add table
Reference in a new issue