Add screen separator and settings for it

This commit is contained in:
Lorenzooone
2025-03-03 02:05:15 +01:00
parent cdcb1ba297
commit 166ccab6b8
11 changed files with 445 additions and 79 deletions

View File

@@ -0,0 +1,43 @@
#ifndef __SEPARATORMENU_HPP
#define __SEPARATORMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
enum SeparatorMenuOutAction{
SEPARATOR_MENU_NO_ACTION,
SEPARATOR_MENU_BACK,
SEPARATOR_MENU_SIZE_DEC_1,
SEPARATOR_MENU_SIZE_INC_1,
SEPARATOR_MENU_SIZE_DEC_10,
SEPARATOR_MENU_SIZE_INC_10,
SEPARATOR_MENU_WINDOW_MUL_DEC,
SEPARATOR_MENU_WINDOW_MUL_INC,
SEPARATOR_MENU_FULLSCREEN_MUL_DEC,
SEPARATOR_MENU_FULLSCREEN_MUL_INC,
};
class SeparatorMenu : public OptionSelectionMenu {
public:
SeparatorMenu(bool font_load_success, sf::Font &text_font);
~SeparatorMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info);
void insert_data(bool is_fullscreen);
SeparatorMenuOutAction selected_index = SeparatorMenuOutAction::SEPARATOR_MENU_NO_ACTION;
void reset_output_option();
protected:
bool is_option_inc_dec(int index);
void set_output_option(int index, int action);
int get_num_options();
std::string get_string_option(int index, int action);
void class_setup();
private:
int *options_indexes;
int num_enabled_options;
std::string get_name_multiplier(int index, float value, bool is_fullscreen);
};
#endif

View File

@@ -40,6 +40,7 @@ enum VideoMenuOutAction{
VIDEO_MENU_SCALING_RATIO_SETTINGS,
VIDEO_MENU_CHANGE_TITLEBAR,
VIDEO_MENU_VIDEO_EFFECTS_SETTINGS,
VIDEO_MENU_SEPARATOR_SETTINGS,
};
class VideoMenu : public OptionSelectionMenu {

View File

@@ -16,10 +16,16 @@
#define MAX_WINDOW_SCALING_VALUE 45.0
#define WINDOW_SCALING_CHANGE 0.5
#define SEP_FOLLOW_SCALING_MULTIPLIER WINDOW_SCALING_CHANGE
#define SEP_WINDOW_SCALING_MIN_MULTIPLIER SEP_FOLLOW_SCALING_MULTIPLIER
#define SEP_FULLSCREEN_SCALING_MIN_MULTIPLIER DEFAULT_WINDOW_SCALING_VALUE
#define DEFAULT_SEP_SIZE 0
#define MAX_SEP_SIZE 1000
enum ScreenType { TOP, BOTTOM, JOINT };
enum BottomRelativePosition { UNDER_TOP, LEFT_TOP, ABOVE_TOP, RIGHT_TOP, BOT_REL_POS_END };
enum NonIntegerScalingModes { SMALLER_PRIORITY, INVERSE_PROPORTIONAL_PRIORITY, EQUAL_PRIORITY, PROPORTIONAL_PRIORITY, BIGGER_PRIORITY, END_NONINT_SCALE_MODES };
enum CurrMenuType { DEFAULT_MENU_TYPE, CONNECT_MENU_TYPE, MAIN_MENU_TYPE, VIDEO_MENU_TYPE, AUDIO_MENU_TYPE, CROP_MENU_TYPE, TOP_PAR_MENU_TYPE, BOTTOM_PAR_MENU_TYPE, ROTATION_MENU_TYPE, OFFSET_MENU_TYPE, BFI_MENU_TYPE, LOAD_MENU_TYPE, SAVE_MENU_TYPE, RESOLUTION_MENU_TYPE, EXTRA_MENU_TYPE, STATUS_MENU_TYPE, LICENSES_MENU_TYPE, RELATIVE_POS_MENU_TYPE, SHORTCUTS_MENU_TYPE, ACTION_SELECTION_MENU_TYPE, SCALING_RATIO_MENU_TYPE, ISN_MENU_TYPE, VIDEO_EFFECTS_MENU_TYPE, INPUT_MENU_TYPE, AUDIO_DEVICE_MENU_TYPE };
enum CurrMenuType { DEFAULT_MENU_TYPE, CONNECT_MENU_TYPE, MAIN_MENU_TYPE, VIDEO_MENU_TYPE, AUDIO_MENU_TYPE, CROP_MENU_TYPE, TOP_PAR_MENU_TYPE, BOTTOM_PAR_MENU_TYPE, ROTATION_MENU_TYPE, OFFSET_MENU_TYPE, BFI_MENU_TYPE, LOAD_MENU_TYPE, SAVE_MENU_TYPE, RESOLUTION_MENU_TYPE, EXTRA_MENU_TYPE, STATUS_MENU_TYPE, LICENSES_MENU_TYPE, RELATIVE_POS_MENU_TYPE, SHORTCUTS_MENU_TYPE, ACTION_SELECTION_MENU_TYPE, SCALING_RATIO_MENU_TYPE, ISN_MENU_TYPE, VIDEO_EFFECTS_MENU_TYPE, INPUT_MENU_TYPE, AUDIO_DEVICE_MENU_TYPE, SEPARATOR_MENU_TYPE };
enum InputColorspaceMode { FULL_COLORSPACE, DS_COLORSPACE, GBA_COLORSPACE, INPUT_COLORSPACE_END };
enum FrameBlendingMode { NO_FRAME_BLENDING, FULL_FRAME_BLENDING, DS_3D_BOTH_SCREENS_FRAME_BLENDING, FRAME_BLENDING_END };
@@ -44,6 +50,9 @@ struct ScreenInfo {
bool v_sync_enabled;
bool async;
int top_scaling, bot_scaling;
int separator_pixel_size;
float separator_windowed_multiplier;
float separator_fullscreen_multiplier;
bool force_same_scaling;
float non_integer_top_scaling, non_integer_bot_scaling;
bool bfi;

View File

@@ -34,6 +34,7 @@
#include "VideoEffectsMenu.hpp"
#include "InputMenu.hpp"
#include "AudioDeviceMenu.hpp"
#include "SeparatorMenu.hpp"
#include "display_structs.hpp"
#include "event_structs.hpp"
#include "shaders_list.hpp"
@@ -155,6 +156,7 @@ private:
VideoEffectsMenu *video_effects_menu;
InputMenu *input_menu;
AudioDeviceMenu *audio_device_menu;
SeparatorMenu *separator_menu;
std::vector<const CropData*> possible_crops;
std::vector<const CropData*> possible_crops_ds;
std::vector<const CropData*> possible_crops_with_games;
@@ -251,6 +253,10 @@ private:
void titlebar_change();
void input_colorspace_mode_change(bool positive);
void frame_blending_mode_change(bool positive);
void separator_size_change(int change);
void separator_multiplier_change(bool positive, float& multiplier_to_check, float lower_limit, float upper_limit);
void separator_windowed_multiplier_change(bool positive);
void separator_fullscreen_multiplier_change(bool positive);
bool query_reset_request();
void reset_held_times(bool force = true);
void poll_window(bool do_everything);
@@ -269,8 +275,8 @@ private:
void window_bg_processing();
void display_data_to_window(bool actually_draw, bool is_debug = false);
void window_render_call();
void set_position_screens(sf::Vector2f &curr_top_screen_size, sf::Vector2f &curr_bot_screen_size, int offset_x, int offset_y, int max_x, int max_y, bool do_work = true);
float get_max_float_screen_multiplier(ResizingScreenData *own_screen, int width_limit, int height_limit, int other_rotation);
void set_position_screens(sf::Vector2f &curr_top_screen_size, sf::Vector2f &curr_bot_screen_size, int offset_x, int offset_y, int max_x, int max_y, int separator_size_x, int separator_size_y, bool do_work = true);
float get_max_float_screen_multiplier(ResizingScreenData *own_screen, int width_limit, int height_limit, int other_rotation, bool is_two_screens_merged = false);
int prepare_screen_ratio(ResizingScreenData *own_screen, int width_limit, int height_limit, int other_rotation);
float get_ratio_compared_other_screen(ResizingScreenData *own_screen, ResizingScreenData* other_screen, float other_scaling);
bool can_non_integerly_scale();
@@ -283,8 +289,8 @@ private:
void merge_screens_data(ResizingScreenData* top_screen_resize_data, ResizingScreenData* bot_screen_resize_data, ResizingScreenData* merged_screen_resize_data, BottomRelativePosition bottom_pos);
bool prepare_screens_same_scaling_factor(ResizingScreenData* top_screen_resize_data, ResizingScreenData* bot_screen_resize_data);
void prepare_size_ratios(bool top_increase, bool bot_increase, bool cycle = false);
int get_fullscreen_offset_x(int top_width, int top_height, int bot_width, int bot_height);
int get_fullscreen_offset_y(int top_width, int top_height, int bot_width, int bot_height);
int get_fullscreen_offset_x(int top_width, int top_height, int bot_width, int bot_height, int separator_contribute);
int get_fullscreen_offset_y(int top_width, int top_height, int bot_width, int bot_height, int separator_contribute);
void resize_window_and_out_rects(bool do_work = true);
void create_window(bool re_prepare_size, bool reset_text = true);
std::string title_factory();
@@ -320,6 +326,7 @@ private:
void setup_is_nitro_menu(bool reset_data = true);
void setup_video_effects_menu(bool reset_data = true);
void setup_input_menu(bool reset_data = true);
void setup_separator_menu(bool reset_data = true);
void update_connection();
};
@@ -349,7 +356,6 @@ std::string save_screen_info(std::string base, const ScreenInfo &info);
const PARData* get_base_par();
void get_par_size(int &width, int &height, float multiplier_factor, const PARData *correction_factor);
void get_par_size(float &width, float &height, float multiplier_factor, const PARData *correction_factor);
float get_par_mult_factor(float width, float height, float max_width, float max_height, const PARData *correction_factor, bool is_rotated);
void update_output(FrontendData* frontend_data, double frame_time = 0.0, VideoOutputData *out_buf = NULL);
void update_connected_3ds_ds(FrontendData* frontend_data, const CaptureDevice &old_cc_device, const CaptureDevice &new_cc_device);
void update_connected_specific_settings(FrontendData* frontend_data, const CaptureDevice &cc_device);