2023-11-05 19:34:20 +00:00
|
|
|
#ifndef __RECOMP_UI__
|
|
|
|
#define __RECOMP_UI__
|
|
|
|
|
2023-11-11 22:42:07 +00:00
|
|
|
#include <memory>
|
2024-01-02 03:36:06 +00:00
|
|
|
#include <string>
|
2023-11-11 22:42:07 +00:00
|
|
|
|
2023-11-05 19:34:20 +00:00
|
|
|
#include "SDL.h"
|
|
|
|
|
2023-11-11 22:42:07 +00:00
|
|
|
namespace Rml {
|
|
|
|
class ElementDocument;
|
|
|
|
class EventListenerInstancer;
|
2024-01-01 05:09:14 +00:00
|
|
|
class Context;
|
2024-01-02 03:36:06 +00:00
|
|
|
class Event;
|
2023-11-11 22:42:07 +00:00
|
|
|
}
|
|
|
|
|
2023-11-24 22:10:21 +00:00
|
|
|
namespace recomp {
|
2024-01-02 03:36:06 +00:00
|
|
|
class UiEventListenerInstancer;
|
|
|
|
|
|
|
|
class MenuController {
|
|
|
|
public:
|
|
|
|
virtual ~MenuController() {}
|
|
|
|
virtual Rml::ElementDocument* load_document(Rml::Context* context) = 0;
|
|
|
|
virtual void register_events(UiEventListenerInstancer& listener) = 0;
|
|
|
|
virtual void make_bindings(Rml::Context* context) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<MenuController> create_launcher_menu();
|
|
|
|
std::unique_ptr<MenuController> create_config_menu();
|
|
|
|
|
2024-01-07 07:03:12 +00:00
|
|
|
using event_handler_t = void(const std::string& param, Rml::Event&);
|
2023-11-24 22:10:21 +00:00
|
|
|
|
|
|
|
void queue_event(const SDL_Event& event);
|
|
|
|
bool try_deque_event(SDL_Event& out);
|
2023-11-11 22:42:07 +00:00
|
|
|
|
2024-01-02 03:36:06 +00:00
|
|
|
std::unique_ptr<UiEventListenerInstancer> make_event_listener_instancer();
|
|
|
|
void register_event(UiEventListenerInstancer& listener, const std::string& name, event_handler_t* handler);
|
2023-11-11 22:42:07 +00:00
|
|
|
|
2023-11-24 22:10:21 +00:00
|
|
|
enum class Menu {
|
|
|
|
Launcher,
|
2023-12-29 21:49:26 +00:00
|
|
|
Config,
|
2023-11-24 22:10:21 +00:00
|
|
|
None
|
|
|
|
};
|
|
|
|
|
|
|
|
void set_current_menu(Menu menu);
|
2024-01-08 08:38:05 +00:00
|
|
|
Menu get_current_menu();
|
2024-01-08 06:28:50 +00:00
|
|
|
|
|
|
|
enum class ConfigSubmenu {
|
2024-03-15 16:13:29 +00:00
|
|
|
General,
|
2024-01-08 06:28:50 +00:00
|
|
|
Controls,
|
2024-03-15 16:13:29 +00:00
|
|
|
Graphics,
|
2024-01-08 06:28:50 +00:00
|
|
|
Audio,
|
2024-03-15 16:13:29 +00:00
|
|
|
Debug,
|
2024-01-08 06:28:50 +00:00
|
|
|
Count
|
|
|
|
};
|
|
|
|
|
|
|
|
void set_config_submenu(ConfigSubmenu submenu);
|
|
|
|
|
2023-11-24 22:10:21 +00:00
|
|
|
void destroy_ui();
|
2024-01-06 21:08:15 +00:00
|
|
|
void apply_color_hack();
|
2024-02-18 03:12:23 +00:00
|
|
|
void get_window_size(int& width, int& height);
|
2024-03-12 04:27:20 +00:00
|
|
|
void set_cursor_visible(bool visible);
|
2024-04-01 07:19:16 +00:00
|
|
|
void update_supported_options();
|
|
|
|
void toggle_fullscreen();
|
2023-11-24 22:10:21 +00:00
|
|
|
}
|
2023-11-11 22:42:07 +00:00
|
|
|
|
2023-11-05 19:34:20 +00:00
|
|
|
#endif
|