Add BFI Settings Menu

This commit is contained in:
Lorenzooone
2024-05-21 23:28:41 +02:00
parent d33e4b2adb
commit e27db15bfd
19 changed files with 418 additions and 94 deletions

40
include/Menus/BFIMenu.hpp Executable file
View File

@@ -0,0 +1,40 @@
#ifndef __BFIMENU_HPP
#define __BFIMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
enum BFIMenuOutAction{
BFI_MENU_NO_ACTION,
BFI_MENU_BACK,
BFI_MENU_TOGGLE,
BFI_MENU_DIVIDER_DEC,
BFI_MENU_DIVIDER_INC,
BFI_MENU_AMOUNT_DEC,
BFI_MENU_AMOUNT_INC,
};
class BFIMenu : public OptionSelectionMenu {
public:
BFIMenu(bool font_load_success, sf::Font &text_font);
~BFIMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info);
void insert_data();
BFIMenuOutAction selected_index = BFIMenuOutAction::BFI_MENU_NO_ACTION;
void reset_output_option();
protected:
bool is_option_selectable(int index, int action);
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;
};
#endif

View File

@@ -13,6 +13,7 @@
#define DEFAULT_ACTION 0
#define DEC_ACTION 1
#define INC_ACTION 2
#define FALSE_ACTION 3
class OptionSelectionMenu {
public:
@@ -39,6 +40,7 @@ protected:
bool show_x;
bool show_title;
virtual bool is_option_selectable(int index, int action);
virtual bool is_option_inc_dec(int index);
virtual void set_output_option(int index, int action);
virtual int get_num_options();
@@ -51,6 +53,9 @@ protected:
void initialize(bool font_load_success, sf::Font &text_font);
void prepare_options();
void base_prepare(float menu_scaling_factor, int view_size_x, int view_size_y);
std::string setTextOptionInt(int index, int value);
std::string setTextOptionBool(int index, bool value);
std::string setTextOptionFloat(int index, float value);
struct MenuData {
int page = 0;

View File

@@ -55,5 +55,6 @@ protected:
private:
int *options_indexes;
int num_enabled_options;
std::string setTextOptionDualPercentage(int index, int value_1, int value_2);
};
#endif

View File

@@ -6,7 +6,7 @@
enum ScreenType { TOP, BOTTOM, JOINT };
enum BottomRelativePosition { UNDER_TOP, LEFT_TOP, ABOVE_TOP, RIGHT_TOP, BOT_REL_POS_END };
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 };
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 };
struct ScreenInfo {
bool is_blurred;
@@ -21,7 +21,8 @@ struct ScreenInfo {
bool async;
int top_scaling, bot_scaling;
bool bfi;
double bfi_divider;
int bfi_divider;
int bfi_amount;
double menu_scaling_factor;
bool rounded_corners_fix;
int top_par;

View File

@@ -20,6 +20,7 @@
#include "RotationMenu.hpp"
#include "OffsetMenu.hpp"
#include "AudioMenu.hpp"
#include "BFIMenu.hpp"
#include "display_structs.hpp"
class WindowScreen {
@@ -90,6 +91,7 @@ private:
RotationMenu *rotation_menu;
OffsetMenu *offset_menu;
AudioMenu *audio_menu;
BFIMenu *bfi_menu;
std::vector<const CropData*> possible_crops;
std::vector<const PARData*> possible_pars;
@@ -141,6 +143,7 @@ private:
void window_scaling_change(bool positive);
void rotation_change(int &value, bool right);
void ratio_change(bool top_priority);
void bfi_change();
void poll_window();
bool common_poll(SFEvent &event_data);
bool main_poll(SFEvent &event_data);
@@ -176,6 +179,14 @@ private:
void setup_offset_menu();
void setup_rotation_menu();
void setup_audio_menu();
void setup_bfi_menu();
void setup_load_menu();
void setup_save_menu();
void setup_resolution_menu();
void setup_extra_menu();
void setup_status_menu();
void setup_licenses_menu();
void setup_relative_pos_menu();
void update_connection();
};