Create Video Settings submenu

This commit is contained in:
Lorenzooone
2024-05-14 18:56:11 +02:00
parent daa7137872
commit ae93229394
8 changed files with 410 additions and 224 deletions

View File

@@ -51,29 +51,11 @@ static const MainMenuOptionInfo split_screens_option = {
.active_joint_screen = OPTION_SPLIT, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_SPLIT};
static const MainMenuOptionInfo vsync_option = {
.base_name = "Turn VSync Off", .false_name = "Turn VSync On",
static const MainMenuOptionInfo video_settings_option = {
.base_name = "Video Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_VSYNC};
static const MainMenuOptionInfo async_option = {
.base_name = "Turn Async Off", .false_name = "Turn Async On",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_ASYNC};
static const MainMenuOptionInfo blur_option = {
.base_name = "Turn Blur Off", .false_name = "Turn Blur On",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_BLUR};
static const MainMenuOptionInfo padding_option = {
.base_name = "Turn Padding Off", .false_name = "Turn Padding On",
.active_fullscreen = false, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_PADDING};
.out_action = MAIN_MENU_VIDEO_SETTINGS};
static const MainMenuOptionInfo quit_option = {
.base_name = "Quit Application", .false_name = "",
@@ -87,90 +69,6 @@ static const MainMenuOptionInfo shutdown_option = {
.active_joint_screen = OPTION_SHUTDOWN, .active_top_screen = OPTION_SHUTDOWN, .active_bottom_screen = OPTION_SHUTDOWN,
.out_action = MAIN_MENU_SHUTDOWN};
static const MainMenuOptionInfo crop_option = {
.base_name = "Crop Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_CROPPING};
static const MainMenuOptionInfo top_par_option = {
.base_name = "Top Screen PAR", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_TOP_PAR};
static const MainMenuOptionInfo bot_par_option = {
.base_name = "Bottom Screen PAR", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_BOT_PAR};
static const MainMenuOptionInfo one_par_option = {
.base_name = "Screen PAR", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = false, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_ONE_PAR};
static const MainMenuOptionInfo bottom_screen_pos_option = {
.base_name = "Bottom Screen Pos.", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_BOTTOM_SCREEN_POS};
static const MainMenuOptionInfo small_screen_offset_option = {
.base_name = "Smaller Screen Offset", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_SMALL_SCREEN_OFFSET};
static const MainMenuOptionInfo subscreen_distance_option = {
.base_name = "Sub-Screen Distance", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_SMALL_SCREEN_DISTANCE};
static const MainMenuOptionInfo canvas_x_pos_option = {
.base_name = "Canvas X Position", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_SCREENS_X_POS};
static const MainMenuOptionInfo canvas_y_pos_option = {
.base_name = "Canvas Y Position", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_SCREENS_Y_POS};
static const MainMenuOptionInfo window_scaling_option = {
.base_name = "Scaling Factor", .false_name = "",
.active_fullscreen = false, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_WINDOW_SCALING};
static const MainMenuOptionInfo fullscreen_scaling_option = {
.base_name = "Screens Scaling", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = false,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_FULLSCREEN_SCALING};
static const MainMenuOptionInfo bfi_settings_option = {
.base_name = "BFI Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_BFI_SETTINGS};
static const MainMenuOptionInfo menu_scaling_option = {
.base_name = "Menu Scaling", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_MENU_SCALING};
static const MainMenuOptionInfo resolution_settings_option = {
.base_name = "Resolution Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = false,
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
.out_action = MAIN_MENU_RESOLUTION_SETTINGS};
static const MainMenuOptionInfo audio_settings_option = {
.base_name = "Audio Settings", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
@@ -207,58 +105,13 @@ static const MainMenuOptionInfo extra_settings_option = {
.active_joint_screen = OPTION_EXTRA, .active_top_screen = OPTION_EXTRA, .active_bottom_screen = OPTION_EXTRA,
.out_action = MAIN_MENU_EXTRA_SETTINGS};
static const MainMenuOptionInfo top_rotation_option = {
.base_name = "Top Screen Rot.", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_TOP_ROTATION};
static const MainMenuOptionInfo bottom_rotation_option = {
.base_name = "Bottom Screen Rot.", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = true, .active_top_screen = false, .active_bottom_screen = false,
.out_action = MAIN_MENU_BOTTOM_ROTATION};
static const MainMenuOptionInfo top_one_rotation_option = {
.base_name = "Screen Rotation", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = false, .active_top_screen = true, .active_bottom_screen = false,
.out_action = MAIN_MENU_TOP_ROTATION};
static const MainMenuOptionInfo bottom_one_rotation_option = {
.base_name = "Screen Rotation", .false_name = "",
.active_fullscreen = true, .active_windowed_screen = true,
.active_joint_screen = false, .active_top_screen = false, .active_bottom_screen = true,
.out_action = MAIN_MENU_BOTTOM_ROTATION};
static const MainMenuOptionInfo* pollable_options[] = {
&connect_option,
&windowed_option,
&fullscreen_option,
&join_screens_option,
&split_screens_option,
&crop_option,
&top_par_option,
&bot_par_option,
&one_par_option,
&vsync_option,
&async_option,
&blur_option,
&bottom_screen_pos_option,
&small_screen_offset_option,
&subscreen_distance_option,
&canvas_x_pos_option,
&canvas_y_pos_option,
&top_rotation_option,
&bottom_rotation_option,
&top_one_rotation_option,
&bottom_one_rotation_option,
&window_scaling_option,
&fullscreen_scaling_option,
&menu_scaling_option,
&resolution_settings_option,
&padding_option,
&bfi_settings_option,
&video_settings_option,
&audio_settings_option,
&save_profiles_option,
&load_profiles_option,
@@ -342,23 +195,7 @@ static std::string setTextOptionBool(int option_index, bool value) {
return pollable_options[option_index]->false_name;
}
static std::string setTextOptionFloat(int option_index, float value) {
return pollable_options[option_index]->base_name + ": " + get_float_str_decimals(value, 1);
}
static std::string setTextOptionInt(int option_index, int value) {
return pollable_options[option_index]->base_name + ": " + std::to_string(value);
}
static std::string setTextOptionDualPercentage(int option_index, int value_1, int value_2) {
int sum = value_1 + value_2;
value_1 = ((value_1 * 100) + (sum / 2)) / sum;
value_2 = ((value_2 * 100) + (sum / 2)) / sum;
value_1 += 100 - (value_1 + value_2);
return pollable_options[option_index]->base_name + ": " + std::to_string(value_1) + " - " + std::to_string(value_2);
}
void MainMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, bool connected) {
void MainMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size_y, bool connected) {
int num_pages = this->get_num_pages();
if(this->future_data.page >= num_pages)
this->future_data.page = num_pages - 1;
@@ -372,33 +209,6 @@ void MainMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size
case MAIN_MENU_OPEN:
this->labels[index]->setText(setTextOptionBool(option_index, connected));
break;
case MAIN_MENU_VSYNC:
this->labels[index]->setText(setTextOptionBool(option_index, info->v_sync_enabled));
break;
case MAIN_MENU_ASYNC:
this->labels[index]->setText(setTextOptionBool(option_index, info->async));
break;
case MAIN_MENU_BLUR:
this->labels[index]->setText(setTextOptionBool(option_index, info->is_blurred));
break;
case MAIN_MENU_PADDING:
this->labels[index]->setText(setTextOptionBool(option_index, info->rounded_corners_fix));
break;
case MAIN_MENU_WINDOW_SCALING:
this->labels[index]->setText(setTextOptionFloat(option_index, info->scaling));
break;
case MAIN_MENU_MENU_SCALING:
this->labels[index]->setText(setTextOptionFloat(option_index, info->menu_scaling_factor));
break;
case MAIN_MENU_FULLSCREEN_SCALING:
this->labels[index]->setText(setTextOptionDualPercentage(option_index, info->top_scaling, info->bot_scaling));
break;
case MAIN_MENU_TOP_ROTATION:
this->labels[index]->setText(setTextOptionInt(option_index, info->top_rotation));
break;
case MAIN_MENU_BOTTOM_ROTATION:
this->labels[index]->setText(setTextOptionInt(option_index, info->bot_rotation));
break;
default:
break;
}