mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-08-11 19:35:59 -05:00
Add title and back or X option
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#define OPTION_JOIN true
|
||||
#define OPTION_SPLIT true
|
||||
#define OPTION_EXTRA false
|
||||
#define OPTION_QUIT true
|
||||
#define OPTION_SHUTDOWN false
|
||||
|
||||
struct MainMenuOptionInfo {
|
||||
const std::string base_name;
|
||||
@@ -73,18 +75,18 @@ static const MainMenuOptionInfo padding_option = {
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.out_action = MAIN_MENU_PADDING};
|
||||
|
||||
static const MainMenuOptionInfo close_option = {
|
||||
.base_name = "Close Menu", .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_CLOSE_MENU};
|
||||
|
||||
static const MainMenuOptionInfo quit_option = {
|
||||
.base_name = "Quit Application", .false_name = "",
|
||||
.active_fullscreen = true, .active_windowed_screen = true,
|
||||
.active_joint_screen = true, .active_top_screen = true, .active_bottom_screen = true,
|
||||
.active_fullscreen = OPTION_QUIT, .active_windowed_screen = OPTION_QUIT,
|
||||
.active_joint_screen = OPTION_QUIT, .active_top_screen = OPTION_QUIT, .active_bottom_screen = OPTION_QUIT,
|
||||
.out_action = MAIN_MENU_QUIT_APPLICATION};
|
||||
|
||||
static const MainMenuOptionInfo shutdown_option = {
|
||||
.base_name = "Shutdown", .false_name = "",
|
||||
.active_fullscreen = OPTION_SHUTDOWN, .active_windowed_screen = OPTION_SHUTDOWN,
|
||||
.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,
|
||||
@@ -263,8 +265,8 @@ static const MainMenuOptionInfo* pollable_options[] = {
|
||||
&extra_settings_option,
|
||||
&status_option,
|
||||
&licenses_option,
|
||||
&close_option,
|
||||
&quit_option
|
||||
&quit_option,
|
||||
&shutdown_option
|
||||
};
|
||||
|
||||
MainMenu::MainMenu(bool font_load_success, sf::Font &text_font) : OptionSelectionMenu(){
|
||||
@@ -279,21 +281,18 @@ MainMenu::~MainMenu() {
|
||||
|
||||
void MainMenu::class_setup() {
|
||||
this->num_elements_per_screen = 5;
|
||||
this->num_page_elements = 3;
|
||||
this->num_elements_displayed_per_screen = num_elements_per_screen + num_page_elements;
|
||||
this->num_vertical_slices = (num_elements_displayed_per_screen - (num_page_elements - 1));
|
||||
this->num_elements_start_id = 0;
|
||||
this->num_page_elements_start_id = num_elements_per_screen + num_elements_start_id;
|
||||
this->prev_page_id = num_page_elements_start_id;
|
||||
this->info_page_id = num_page_elements_start_id + 1;
|
||||
this->next_page_id = num_page_elements_start_id + 2;
|
||||
this->min_elements_text_scaling_factor = this->num_vertical_slices;
|
||||
this->min_elements_text_scaling_factor = num_elements_per_screen + 2;
|
||||
this->width_factor_menu = 16;
|
||||
this->width_divisor_menu = 9;
|
||||
this->base_height_factor_menu = 12;
|
||||
this->base_height_divisor_menu = 6;
|
||||
this->min_text_size = 0.3;
|
||||
this->max_width_slack = 1.1;
|
||||
this->menu_color = sf::Color(30, 30, 60, 192);
|
||||
this->title = "Main Menu";
|
||||
this->show_back_x = true;
|
||||
this->show_x = true;
|
||||
this->show_title = true;
|
||||
}
|
||||
|
||||
void MainMenu::insert_data(ScreenType s_type, bool is_fullscreen) {
|
||||
@@ -323,7 +322,10 @@ void MainMenu::reset_output_option() {
|
||||
}
|
||||
|
||||
void MainMenu::set_output_option(int index) {
|
||||
this->selected_index = pollable_options[this->options_indexes[index]]->out_action;
|
||||
if(index == -1)
|
||||
this->selected_index = MAIN_MENU_CLOSE_MENU;
|
||||
else
|
||||
this->selected_index = pollable_options[this->options_indexes[index]]->out_action;
|
||||
}
|
||||
|
||||
int MainMenu::get_num_options() {
|
||||
@@ -357,44 +359,45 @@ static std::string setTextOptionDualPercentage(int option_index, int value_1, in
|
||||
}
|
||||
|
||||
void MainMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info, bool connected) {
|
||||
int num_pages = 1 + ((this->get_num_options() - 1) / this->num_elements_per_screen);
|
||||
int num_pages = this->get_num_pages();
|
||||
if(this->future_data.page >= num_pages)
|
||||
this->future_data.page = num_pages - 1;
|
||||
int start = this->future_data.page * this->num_elements_per_screen;
|
||||
for(int i = 0; i < this->num_elements_per_screen; i++) {
|
||||
if(!this->future_enabled_labels[i])
|
||||
int index = i + this->elements_start_id;
|
||||
if(!this->future_enabled_labels[index])
|
||||
continue;
|
||||
int option_index = this->options_indexes[start + i];
|
||||
switch(pollable_options[option_index]->out_action) {
|
||||
case MAIN_MENU_OPEN:
|
||||
this->labels[i]->setText(setTextOptionBool(option_index, connected));
|
||||
this->labels[index]->setText(setTextOptionBool(option_index, connected));
|
||||
break;
|
||||
case MAIN_MENU_VSYNC:
|
||||
this->labels[i]->setText(setTextOptionBool(option_index, info->v_sync_enabled));
|
||||
this->labels[index]->setText(setTextOptionBool(option_index, info->v_sync_enabled));
|
||||
break;
|
||||
case MAIN_MENU_ASYNC:
|
||||
this->labels[i]->setText(setTextOptionBool(option_index, info->async));
|
||||
this->labels[index]->setText(setTextOptionBool(option_index, info->async));
|
||||
break;
|
||||
case MAIN_MENU_BLUR:
|
||||
this->labels[i]->setText(setTextOptionBool(option_index, info->is_blurred));
|
||||
this->labels[index]->setText(setTextOptionBool(option_index, info->is_blurred));
|
||||
break;
|
||||
case MAIN_MENU_PADDING:
|
||||
this->labels[i]->setText(setTextOptionBool(option_index, info->rounded_corners_fix));
|
||||
this->labels[index]->setText(setTextOptionBool(option_index, info->rounded_corners_fix));
|
||||
break;
|
||||
case MAIN_MENU_WINDOW_SCALING:
|
||||
this->labels[i]->setText(setTextOptionFloat(option_index, info->scaling));
|
||||
this->labels[index]->setText(setTextOptionFloat(option_index, info->scaling));
|
||||
break;
|
||||
case MAIN_MENU_MENU_SCALING:
|
||||
this->labels[i]->setText(setTextOptionFloat(option_index, info->menu_scaling_factor));
|
||||
this->labels[index]->setText(setTextOptionFloat(option_index, info->menu_scaling_factor));
|
||||
break;
|
||||
case MAIN_MENU_FULLSCREEN_SCALING:
|
||||
this->labels[i]->setText(setTextOptionDualPercentage(option_index, info->top_scaling, info->bot_scaling));
|
||||
this->labels[index]->setText(setTextOptionDualPercentage(option_index, info->top_scaling, info->bot_scaling));
|
||||
break;
|
||||
case MAIN_MENU_TOP_ROTATION:
|
||||
this->labels[i]->setText(setTextOptionInt(option_index, info->top_rotation));
|
||||
this->labels[index]->setText(setTextOptionInt(option_index, info->top_rotation));
|
||||
break;
|
||||
case MAIN_MENU_BOTTOM_ROTATION:
|
||||
this->labels[i]->setText(setTextOptionInt(option_index, info->bot_rotation));
|
||||
this->labels[index]->setText(setTextOptionInt(option_index, info->bot_rotation));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user