mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-09-07 16:15:18 -05:00
Implement RPi basic version-special code
This commit is contained in:
28
include/ExtraButtons.hpp
Executable file
28
include/ExtraButtons.hpp
Executable file
@@ -0,0 +1,28 @@
|
||||
#ifndef __EXTRABUTTONS_HPP
|
||||
#define __EXTRABUTTONS_HPP
|
||||
|
||||
#include <chrono>
|
||||
#include "sfml_gfx_structs.hpp"
|
||||
|
||||
class ExtraButton {
|
||||
public:
|
||||
void initialize(int pi_value, int id, sf::Keyboard::Key corresponding_key, bool is_power, float first_re_press_time, float later_re_press_time);
|
||||
int get_pi_value();
|
||||
void poll(std::queue<SFEvent> &events_queue);
|
||||
private:
|
||||
bool initialized = false;
|
||||
int id;
|
||||
sf::Keyboard::Key corresponding_key;
|
||||
bool is_power;
|
||||
int pi_value;
|
||||
bool started;
|
||||
bool after_first;
|
||||
float first_re_press_time;
|
||||
float later_re_press_time;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_press_time;
|
||||
bool is_time_valid;
|
||||
|
||||
bool is_pressed();
|
||||
bool is_valid();
|
||||
};
|
||||
#endif
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
void reset_output_option();
|
||||
protected:
|
||||
void set_output_option(int index, int action);
|
||||
bool is_option_selectable(int index, int action);
|
||||
int get_num_options();
|
||||
std::string get_string_option(int index, int action);
|
||||
void class_setup();
|
||||
|
||||
@@ -30,7 +30,7 @@ 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);
|
||||
void insert_data(ScreenType s_type, bool is_fullscreen, bool mono_app_mode);
|
||||
MainMenuOutAction selected_index = MainMenuOutAction::MAIN_MENU_NO_ACTION;
|
||||
void reset_output_option();
|
||||
protected:
|
||||
|
||||
@@ -34,6 +34,7 @@ struct ScreenInfo {
|
||||
|
||||
struct DisplayData {
|
||||
bool split;
|
||||
bool mono_app_mode;
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
@@ -131,6 +131,9 @@ private:
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_draw_time;
|
||||
FPSArray poll_fps;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_poll_time;
|
||||
bool triggered_poweroff;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_poweroff_time;
|
||||
const float poweroff_timeout = 30.0;
|
||||
|
||||
sf::Texture in_tex;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ struct out_rect_data {
|
||||
};
|
||||
|
||||
struct SFEvent {
|
||||
SFEvent(sf::Event::EventType type, sf::Keyboard::Key code, uint32_t unicode, uint32_t joystickId, uint32_t joy_button, sf::Joystick::Axis axis, float position, sf::Mouse::Button mouse_button, int mouse_x, int mouse_y) : type(type), code(code), unicode(unicode), joystickId(joystickId), joy_button(joy_button), axis(axis), position(position), mouse_button(mouse_button), mouse_x(mouse_x), mouse_y(mouse_y) {}
|
||||
SFEvent(sf::Event::EventType type, sf::Keyboard::Key code, uint32_t unicode, uint32_t joystickId, uint32_t joy_button, sf::Joystick::Axis axis, float position, sf::Mouse::Button mouse_button, int mouse_x, int mouse_y, bool poweroff_cmd) : type(type), code(code), unicode(unicode), joystickId(joystickId), joy_button(joy_button), axis(axis), position(position), mouse_button(mouse_button), mouse_x(mouse_x), mouse_y(mouse_y), poweroff_cmd(poweroff_cmd) {}
|
||||
|
||||
sf::Event::EventType type;
|
||||
sf::Keyboard::Key code;
|
||||
@@ -25,10 +25,14 @@ struct SFEvent {
|
||||
sf::Mouse::Button mouse_button;
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
bool poweroff_cmd;
|
||||
};
|
||||
|
||||
void joystick_axis_poll(std::queue<SFEvent> &events_queue);
|
||||
JoystickDirection get_joystick_direction(uint32_t joystickId, sf::Joystick::Axis axis, float position);
|
||||
JoystickAction get_joystick_action(uint32_t joystickId, uint32_t joy_button);
|
||||
void init_extra_buttons_poll(int page_up_id, int page_down_id, int enter_id, int power_id);
|
||||
void end_extra_buttons_poll();
|
||||
void extra_buttons_poll(std::queue<SFEvent> &events_queue);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user