ASAPCabinetFE
 
Loading...
Searching...
No Matches
input_manager.h
Go to the documentation of this file.
1
11#ifndef INPUT_MANAGER_H
12#define INPUT_MANAGER_H
13
17#include "sound/isound_manager.h"
19#include "tables/table_data.h"
21#include "config/ui/config_ui.h"
24#include <map>
25#include <vector>
26#include <unordered_map>
27#include <functional>
28
40public:
48 InputManager(IKeybindProvider* keybindProvider);
49
58 void handleEvent(const SDL_Event& event) override;
59
65 void registerActions() override;
66
83 void setDependencies(IAssetManager* assets, ISoundManager* sound, IConfigService* settings,
84 size_t& currentIndex, std::vector<TableData>& tables,
85 bool& showConfig, bool& showEditor, bool& showVpsdb, const std::string& exeDir, IScreenshotManager* screenshotManager,
86 IWindowManager* windowManager, std::atomic<bool>& isLoadingTables, ITableLauncher* tableLauncher,
87 ITableCallbacks* tableCallbacks) override;
88
94 bool isConfigActive() const override { return *showConfig_; }
95
101 bool isEditorActive() const override { return *showEditor_; }
102
108 bool isCatalogActive() const override { return *showVpsdb_; }
109
115 bool shouldQuit() const override { return quit_; }
116
124 void setRuntimeEditor(ConfigUI* editor) override { runtimeEditor_ = editor; }
125
126private:
130 using ActionHandler = std::function<void()>;
131
140 void handleRegularEvents(const SDL_Event& event);
141
149 void handleDoubleClick(const SDL_Event& event);
150
151 IKeybindProvider* keybindProvider_;
152 IAssetManager* assets_;
153 ISoundManager* soundManager_;
154 IConfigService* settingsManager_;
155 IWindowManager* windowManager_;
156 size_t* currentIndex_;
157 std::vector<TableData>* tables_;
158 bool* showConfig_;
159 bool* showEditor_;
160 bool* showVpsdb_;
161 std::string exeDir_;
162 IScreenshotManager* screenshotManager_;
163 ConfigUI* runtimeEditor_;
164 std::map<std::string, ActionHandler> actionHandlers_;
165 std::map<char, size_t> letterIndex_;
166 bool quit_;
167 bool screenshotModeActive_;
168 std::unordered_map<Uint32, Uint32> lastClickTimes_;
169 bool inExternalAppMode_;
170 Uint32 lastExternalAppReturnTime_;
171 static const Uint32 EXTERNAL_APP_DEBOUNCE_TIME_MS = 500;
172 std::atomic<bool>* isLoadingTables_;
173 ITableLauncher* tableLauncher_;
174 ITableCallbacks* tableCallbacks_ = nullptr;
175};
176
177#endif // INPUT_MANAGER_H
Manages the ImGui-based configuration UI.
Definition config_ui.h:35
The IAssetManager interface provides methods to manage and access various assets used in the applicat...
Definition iasset_manager.h:36
Interface for configuration services (forward declaration).
Definition iconfig_service.h:30
Interface for managing user input and associated actions.
Definition iinput_manager.h:71
Interface for keybind providers (forward declaration).
Definition ikeybind_provider.h:30
Interface for managing screenshot capture operations.
Definition iscreenshot_manager.h:24
Interface for managing sound operations.
Definition isound_manager.h:14
Interface for managing ASAP index file operations.
Definition itable_callbacks.h:26
Interface for launching VPX tables.
Definition itable_launcher.h:21
Interface for managing SDL windows and renderers.
Definition iwindow_manager.h:27
Processes SDL input events and triggers application actions.
Definition input_manager.h:39
bool isConfigActive() const override
Checks if the configuration UI is active.
Definition input_manager.h:94
void handleEvent(const SDL_Event &event) override
Handles an SDL input event.
Definition input_manager.cpp:389
void registerActions() override
Registers action handlers for input events.
Definition input_manager.cpp:59
void setRuntimeEditor(ConfigUI *editor) override
Sets the runtime configuration editor.
Definition input_manager.h:124
bool isEditorActive() const override
Checks if the metadata editor UI is active.
Definition input_manager.h:101
bool isCatalogActive() const override
Checks if the metadata catalog UI is active.
Definition input_manager.h:108
void setDependencies(IAssetManager *assets, ISoundManager *sound, IConfigService *settings, size_t &currentIndex, std::vector< TableData > &tables, bool &showConfig, bool &showEditor, bool &showVpsdb, const std::string &exeDir, IScreenshotManager *screenshotManager, IWindowManager *windowManager, std::atomic< bool > &isLoadingTables, ITableLauncher *tableLauncher, ITableCallbacks *tableCallbacks) override
Sets dependencies for input handling.
Definition input_manager.cpp:26
bool shouldQuit() const override
Checks if the application should quit.
Definition input_manager.h:115
Defines the ConfigUI class for managing the ImGui-based configuration UI in ASAPCabinetFE.
Defines the IAssetManager interface for managing assets in ASAPCabinetFE.
Defines the IConfigService interface for managing configuration in ASAPCabinetFE.
Defines the IInputManager interface for handling input events in ASAPCabinetFE.
Defines the IKeybindProvider interface for managing input bindings in ASAPCabinetFE.
Defines the IScreenshotManager interface for screenshot capture operations in ASAPCabinetFE.
Defines the ITableLauncher interface for launching VPX tables.
Defines the IWindowManager interface for managing SDL windows and renderers in ASAPCabinetFE.
Defines the TableData struct for storing VPX table metadata and media paths.