Move Menus to subfolder

This commit is contained in:
Lorenzooone
2024-05-21 21:23:28 +02:00
parent 4f51c25a24
commit d33e4b2adb
20 changed files with 29 additions and 29 deletions

38
include/Menus/AudioMenu.hpp Executable file
View File

@@ -0,0 +1,38 @@
#ifndef __AUDIOMENU_HPP
#define __AUDIOMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "audio_data.hpp"
enum AudioMenuOutAction{
AUDIO_MENU_NO_ACTION,
AUDIO_MENU_BACK,
AUDIO_MENU_MUTE,
AUDIO_MENU_VOLUME_DEC,
AUDIO_MENU_VOLUME_INC,
AUDIO_MENU_RESTART,
};
class AudioMenu : public OptionSelectionMenu {
public:
AudioMenu(bool font_load_success, sf::Font &text_font);
~AudioMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, AudioData *audio_data);
void insert_data();
AudioMenuOutAction selected_index = AudioMenuOutAction::AUDIO_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;
};
#endif

View File

@@ -0,0 +1,26 @@
#ifndef __CONNECTIONMENU_HPP
#define __CONNECTIONMENU_HPP
#include "OptionSelectionMenu.hpp"
#include "capture_structs.hpp"
#define CONNECTION_MENU_NO_ACTION (-1)
class ConnectionMenu : public OptionSelectionMenu {
public:
ConnectionMenu(bool font_load_success, sf::Font &text_font);
~ConnectionMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y);
void insert_data(DevicesList *devices_list);
int selected_index = CONNECTION_MENU_NO_ACTION;
void reset_output_option();
protected:
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:
DevicesList *devices_list;
};
#endif

30
include/Menus/CropMenu.hpp Executable file
View File

@@ -0,0 +1,30 @@
#ifndef __CROPMENU_HPP
#define __CROPMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
#define CROP_MENU_NO_ACTION -1
#define CROP_MENU_BACK -2
class CropMenu : public OptionSelectionMenu {
public:
CropMenu(bool font_load_success, sf::Font &text_font);
~CropMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, int current_crop);
void insert_data(std::vector<const CropData*>* possible_crops);
int selected_index = CROP_MENU_NO_ACTION;
void reset_output_option();
protected:
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:
std::vector<const CropData*>* possible_crops;
};
#endif

45
include/Menus/MainMenu.hpp Executable file
View File

@@ -0,0 +1,45 @@
#ifndef __MAINMENU_HPP
#define __MAINMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
enum MainMenuOutAction{
MAIN_MENU_NO_ACTION,
MAIN_MENU_OPEN,
MAIN_MENU_CLOSE_MENU,
MAIN_MENU_QUIT_APPLICATION,
MAIN_MENU_FULLSCREEN,
MAIN_MENU_SPLIT,
MAIN_MENU_VIDEO_SETTINGS,
MAIN_MENU_AUDIO_SETTINGS,
MAIN_MENU_SAVE_PROFILES,
MAIN_MENU_LOAD_PROFILES,
MAIN_MENU_STATUS,
MAIN_MENU_LICENSES,
MAIN_MENU_EXTRA_SETTINGS,
MAIN_MENU_SHUTDOWN,
};
class MainMenu : public OptionSelectionMenu {
public:
MainMenu(bool font_load_success, sf::Font &text_font);
~MainMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, bool connected);
void insert_data(ScreenType s_type, bool is_fullscreen);
MainMenuOutAction selected_index = MainMenuOutAction::MAIN_MENU_NO_ACTION;
void reset_output_option();
protected:
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

42
include/Menus/OffsetMenu.hpp Executable file
View File

@@ -0,0 +1,42 @@
#ifndef __OFFSETMENU_HPP
#define __OFFSETMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
enum OffsetMenuOutAction{
OFFSET_MENU_NO_ACTION,
OFFSET_MENU_BACK,
OFFSET_MENU_SMALL_OFFSET_DEC,
OFFSET_MENU_SMALL_OFFSET_INC,
OFFSET_MENU_SMALL_SCREEN_DISTANCE_DEC,
OFFSET_MENU_SMALL_SCREEN_DISTANCE_INC,
OFFSET_MENU_SCREENS_X_POS_DEC,
OFFSET_MENU_SCREENS_X_POS_INC,
OFFSET_MENU_SCREENS_Y_POS_DEC,
OFFSET_MENU_SCREENS_Y_POS_INC,
};
class OffsetMenu : public OptionSelectionMenu {
public:
OffsetMenu(bool font_load_success, sf::Font &text_font);
~OffsetMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info);
void insert_data();
OffsetMenuOutAction selected_index = OffsetMenuOutAction::OFFSET_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;
};
#endif

View File

@@ -0,0 +1,104 @@
#ifndef __OPTIONSELECTIONMENU_HPP
#define __OPTIONSELECTIONMENU_HPP
#include <SFML/Graphics.hpp>
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#define BACK_X_OUTPUT_OPTION -1
#define BAD_ACTION -1
#define DEFAULT_ACTION 0
#define DEC_ACTION 1
#define INC_ACTION 2
class OptionSelectionMenu {
public:
OptionSelectionMenu();
~OptionSelectionMenu();
bool poll(SFEvent &event_data);
void draw(float scaling_factor, sf::RenderTarget &window);
void reset_data();
std::chrono::time_point<std::chrono::high_resolution_clock> last_input_processed_time;
virtual void reset_output_option();
protected:
int num_options_per_screen;
int elements_start_id;
int min_elements_text_scaling_factor;
int width_factor_menu;
int width_divisor_menu;
int base_height_factor_menu;
int base_height_divisor_menu;
float min_text_size;
float max_width_slack;
sf::Color menu_color;
std::string title;
bool show_back_x;
bool show_x;
bool show_title;
virtual bool is_option_inc_dec(int index);
virtual void set_output_option(int index, int action);
virtual int get_num_options();
virtual std::string get_string_option(int index, int action);
virtual void class_setup();
int single_option_multiplier;
int get_num_pages();
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);
struct MenuData {
int page = 0;
int option_selected = -1;
int menu_width;
int menu_height;
int pos_x;
int pos_y;
};
MenuData future_data;
TextRectangle **labels;
bool *future_enabled_labels;
private:
int num_elements_per_screen;
int num_title_back_x_elements;
int num_page_elements;
int num_elements_displayed_per_screen;
int num_vertical_slices;
int title_back_x_start_id;
int page_elements_start_id;
int back_x_id;
int title_id;
int prev_page_id;
int info_page_id;
int next_page_id;
std::chrono::time_point<std::chrono::high_resolution_clock> last_action_time;
const float action_timeout = 0.1;
int loaded_page = 0;
int option_selected = -1;
bool *selectable_labels;
bool *loaded_enabled_labels;
MenuData loaded_data;
sf::RectangleShape menu_rectangle = sf::RectangleShape(sf::Vector2f(1, 1));
void after_class_setup_connected_values();
void prepare_text_slices(int x_multiplier, int x_divisor, int y_multiplier, int y_divisor, int index, float text_scaling_factor, bool center = false);
bool can_execute_action();
void up_code(bool is_simple);
void down_code(bool is_simple);
void left_code();
void right_code();
void option_selection_handling();
bool is_option_location_left(int option);
bool is_option_element(int option);
bool is_option_location_multichoice(int option);
void set_default_cursor_position();
void decrement_selected_option(bool is_simple);
void increment_selected_option(bool is_simple);
};
#endif

32
include/Menus/PARMenu.hpp Executable file
View File

@@ -0,0 +1,32 @@
#ifndef __PARMENU_HPP
#define __PARMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
#define PAR_MENU_NO_ACTION -1
#define PAR_MENU_BACK -2
class PARMenu : public OptionSelectionMenu {
public:
PARMenu(bool font_load_success, sf::Font &text_font);
~PARMenu();
void setup_title(std::string added_name);
void prepare(float scaling_factor, int view_size_x, int view_size_y, int current_crop);
void insert_data(std::vector<const PARData*>* possible_pars);
int selected_index = PAR_MENU_NO_ACTION;
void reset_output_option();
protected:
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:
const std::string base_name = "PAR Settings";
std::vector<const PARData*>* possible_pars;
};
#endif

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

@@ -0,0 +1,40 @@
#ifndef __ROTATIONMENU_HPP
#define __ROTATIONMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
enum RotationMenuOutAction{
ROTATION_MENU_NO_ACTION,
ROTATION_MENU_BACK,
ROTATION_MENU_TOP_ROTATION_DEC,
ROTATION_MENU_TOP_ROTATION_INC,
ROTATION_MENU_BOTTOM_ROTATION_DEC,
ROTATION_MENU_BOTTOM_ROTATION_INC,
ROTATION_MENU_BOTH_ROTATION_DEC,
ROTATION_MENU_BOTH_ROTATION_INC,
};
class RotationMenu : public OptionSelectionMenu {
public:
RotationMenu(bool font_load_success, sf::Font &text_font);
~RotationMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info);
void insert_data();
RotationMenuOutAction selected_index = RotationMenuOutAction::ROTATION_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;
};
#endif

59
include/Menus/VideoMenu.hpp Executable file
View File

@@ -0,0 +1,59 @@
#ifndef __VIDEOMENU_HPP
#define __VIDEOMENU_HPP
#include "OptionSelectionMenu.hpp"
#include <chrono>
#include "TextRectangle.hpp"
#include "sfml_gfx_structs.hpp"
#include "display_structs.hpp"
enum VideoMenuOutAction{
VIDEO_MENU_NO_ACTION,
VIDEO_MENU_BACK,
VIDEO_MENU_VSYNC,
VIDEO_MENU_ASYNC,
VIDEO_MENU_BLUR,
VIDEO_MENU_PADDING,
VIDEO_MENU_CROPPING,
VIDEO_MENU_TOP_PAR,
VIDEO_MENU_BOT_PAR,
VIDEO_MENU_ONE_PAR,
VIDEO_MENU_BOTTOM_SCREEN_POS,
VIDEO_MENU_SMALL_SCREEN_OFFSET_DEC,
VIDEO_MENU_SMALL_SCREEN_OFFSET_INC,
VIDEO_MENU_OFFSET_SETTINGS,
VIDEO_MENU_WINDOW_SCALING_DEC,
VIDEO_MENU_WINDOW_SCALING_INC,
VIDEO_MENU_FULLSCREEN_SCALING_TOP,
VIDEO_MENU_FULLSCREEN_SCALING_BOTTOM,
VIDEO_MENU_BFI_SETTINGS,
VIDEO_MENU_MENU_SCALING_DEC,
VIDEO_MENU_MENU_SCALING_INC,
VIDEO_MENU_RESOLUTION_SETTINGS,
VIDEO_MENU_ROTATION_SETTINGS,
VIDEO_MENU_TOP_ROTATION_DEC,
VIDEO_MENU_TOP_ROTATION_INC,
VIDEO_MENU_BOTTOM_ROTATION_DEC,
VIDEO_MENU_BOTTOM_ROTATION_INC,
};
class VideoMenu : public OptionSelectionMenu {
public:
VideoMenu(bool font_load_success, sf::Font &text_font);
~VideoMenu();
void prepare(float scaling_factor, int view_size_x, int view_size_y, ScreenInfo *info);
void insert_data(ScreenType s_type, bool is_fullscreen);
VideoMenuOutAction selected_index = VideoMenuOutAction::VIDEO_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;
};
#endif