mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-03-21 17:55:00 -05:00
Add option for system-specified resolution
This commit is contained in:
parent
2c2d3a89b8
commit
f75e0a86ff
|
|
@ -15,7 +15,7 @@ class ResolutionMenu : public OptionSelectionMenu {
|
|||
public:
|
||||
ResolutionMenu(bool font_load_success, sf::Font &text_font);
|
||||
~ResolutionMenu();
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, sf::VideoMode *curr_desk_mode);
|
||||
void prepare(float scaling_factor, int view_size_x, int view_size_y, int fullscreen_mode_width, int fullscreen_mode_height);
|
||||
void insert_data(std::vector<sf::VideoMode>* possible_resolutions);
|
||||
int selected_index = RESOLUTION_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
|
|
|
|||
|
|
@ -49,10 +49,14 @@ sf::VideoMode ResolutionMenu::get_resolution(int index) {
|
|||
|
||||
std::string ResolutionMenu::get_string_option(int index, int action) {
|
||||
sf::VideoMode mode = this->get_resolution(index);
|
||||
if((mode.width == 0) && (mode.height == 0)) {
|
||||
mode = sf::VideoMode::getDesktopMode();
|
||||
return "System Preference (" + std::to_string(mode.width) + " x " + std::to_string(mode.height)+")";
|
||||
}
|
||||
return std::to_string(mode.width) + " x " + std::to_string(mode.height);
|
||||
}
|
||||
|
||||
void ResolutionMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size_y, sf::VideoMode *curr_desk_mode) {
|
||||
void ResolutionMenu::prepare(float menu_scaling_factor, int view_size_x, int view_size_y, int fullscreen_mode_width, int fullscreen_mode_height) {
|
||||
int num_pages = this->get_num_pages();
|
||||
if(this->future_data.page >= num_pages)
|
||||
this->future_data.page = num_pages - 1;
|
||||
|
|
@ -63,7 +67,7 @@ void ResolutionMenu::prepare(float menu_scaling_factor, int view_size_x, int vie
|
|||
continue;
|
||||
int mode_index = start + i;
|
||||
sf::VideoMode mode = this->get_resolution(mode_index);
|
||||
if((mode.width == curr_desk_mode->width) && (mode.height == curr_desk_mode->height))
|
||||
if((mode.width == fullscreen_mode_width) && (mode.height == fullscreen_mode_height))
|
||||
this->labels[index]->setText("<" + this->get_string_option(mode_index, DEFAULT_ACTION) + ">");
|
||||
else
|
||||
this->labels[index]->setText(this->get_string_option(mode_index, DEFAULT_ACTION));
|
||||
|
|
|
|||
|
|
@ -777,9 +777,10 @@ void WindowScreen::setup_resolution_menu(bool reset_data) {
|
|||
this->possible_resolutions.clear();
|
||||
std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
|
||||
if(modes.size() > 0) {
|
||||
this->possible_resolutions.push_back(sf::VideoMode(0, 0, 0));
|
||||
this->possible_resolutions.push_back(modes[0]);
|
||||
for(int i = 1; i < modes.size(); ++i)
|
||||
if(this->possible_resolutions[0].bitsPerPixel == modes[i].bitsPerPixel)
|
||||
if(modes[0].bitsPerPixel == modes[i].bitsPerPixel)
|
||||
this->possible_resolutions.push_back(modes[i]);
|
||||
}
|
||||
else {
|
||||
|
|
@ -1958,7 +1959,7 @@ void WindowScreen::prepare_menu_draws(int view_size_x, int view_size_y) {
|
|||
this->relpos_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, this->loaded_info.bottom_pos);
|
||||
break;
|
||||
case RESOLUTION_MENU_TYPE:
|
||||
this->resolution_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, &this->curr_desk_mode);
|
||||
this->resolution_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y, this->loaded_info.fullscreen_mode_width, this->loaded_info.fullscreen_mode_height);
|
||||
break;
|
||||
case SAVE_MENU_TYPE:
|
||||
this->fileconfig_menu->prepare(this->loaded_info.menu_scaling_factor, view_size_x, view_size_y);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user