mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp
synced 2026-09-01 18:19:52 -04:00
gyro sensitivity option + update range inputs styling
This commit is contained in:
@@ -128,6 +128,7 @@ void save_general_config(const std::filesystem::path& path) {
|
||||
|
||||
recomp::to_json(config_json["targeting_mode"], recomp::get_targeting_mode());
|
||||
config_json["rumble_strength"] = recomp::get_rumble_strength();
|
||||
config_json["gyro_sensitivity"] = recomp::get_gyro_sensitivity();
|
||||
config_json["debug_mode"] = recomp::get_debug_mode_enabled();
|
||||
config_file << std::setw(4) << config_json;
|
||||
}
|
||||
@@ -140,6 +141,7 @@ void load_general_config(const std::filesystem::path& path) {
|
||||
|
||||
recomp::set_targeting_mode(from_or_default(config_json, "targeting_mode", recomp::TargetingMode::Switch));
|
||||
recomp::set_rumble_strength(from_or_default(config_json, "rumble_strength", 25));
|
||||
recomp::set_gyro_sensitivity(from_or_default(config_json, "gyro_sensitivity", 50));
|
||||
recomp::set_debug_mode_enabled(from_or_default(config_json, "debug_mode", false));
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -505,8 +505,9 @@ bool recomp::get_input_digital(const std::span<const recomp::InputField> fields)
|
||||
|
||||
void recomp::get_gyro_deltas(float* x, float* y) {
|
||||
std::array<float, 2> cur_rotation_delta = InputState.rotation_delta;
|
||||
*x = cur_rotation_delta[0];
|
||||
*y = cur_rotation_delta[1];
|
||||
float sensitivity = (float)recomp::get_gyro_sensitivity() / 50.0f;
|
||||
*x = cur_rotation_delta[0] * sensitivity;
|
||||
*y = cur_rotation_delta[1] * sensitivity;
|
||||
}
|
||||
|
||||
bool recomp::game_input_disabled() {
|
||||
|
||||
@@ -211,6 +211,7 @@ void close_config_menu() {
|
||||
|
||||
struct ControlOptionsContext {
|
||||
int rumble_strength = 50; // 0 to 100
|
||||
int gyro_sensitivity = 50; // 0 to 200
|
||||
recomp::TargetingMode targeting_mode = recomp::TargetingMode::Switch;
|
||||
};
|
||||
|
||||
@@ -227,6 +228,17 @@ void recomp::set_rumble_strength(int strength) {
|
||||
}
|
||||
}
|
||||
|
||||
int recomp::get_gyro_sensitivity() {
|
||||
return control_options_context.gyro_sensitivity;
|
||||
}
|
||||
|
||||
void recomp::set_gyro_sensitivity(int sensitivity) {
|
||||
control_options_context.gyro_sensitivity = sensitivity;
|
||||
if (general_model_handle) {
|
||||
general_model_handle.DirtyVariable("gyro_sensitivity");
|
||||
}
|
||||
}
|
||||
|
||||
recomp::TargetingMode recomp::get_targeting_mode() {
|
||||
return control_options_context.targeting_mode;
|
||||
}
|
||||
@@ -672,6 +684,7 @@ public:
|
||||
bind_config_list_events(constructor);
|
||||
|
||||
constructor.Bind("rumble_strength", &control_options_context.rumble_strength);
|
||||
constructor.Bind("gyro_sensitivity", &control_options_context.gyro_sensitivity);
|
||||
bind_option(constructor, "targeting_mode", &control_options_context.targeting_mode);
|
||||
|
||||
general_model_handle = constructor.GetModelHandle();
|
||||
|
||||
Reference in New Issue
Block a user