yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
input_manager.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EMU_INPUT_INPUT_MANAGER_H_
2#define YAZE_APP_EMU_INPUT_INPUT_MANAGER_H_
3
4#include <atomic>
5#include <memory>
6
8
9namespace yaze {
10namespace emu {
11
12// Forward declaration
13class Snes;
14
15namespace input {
16
18 public:
21
24 void Initialize(std::unique_ptr<IInputBackend> backend);
25 void Shutdown();
26 void Poll(Snes* snes, int player = 1);
27 void ProcessEvent(void* event);
28
29 IInputBackend* backend() { return backend_.get(); }
30 const IInputBackend* backend() const { return backend_.get(); }
31
32 bool IsInitialized() const { return backend_ && backend_->IsInitialized(); }
33
34 InputConfig GetConfig() const;
35 void SetConfig(const InputConfig& config);
36
37 // --- Agent Control API ---
38 void PressButton(SnesButton button);
39 void ReleaseButton(SnesButton button);
40
41 private:
42 std::unique_ptr<IInputBackend> backend_;
43 std::atomic<uint16_t> agent_buttons_{0}; // Thread-safe agent button state
44 InputConfig config_; // Cached/pending config
45};
46
47} // namespace input
48} // namespace emu
49} // namespace yaze
50
51#endif // YAZE_APP_EMU_INPUT_INPUT_MANAGER_H_
Abstract input backend interface.
void Poll(Snes *snes, int player=1)
void PressButton(SnesButton button)
std::unique_ptr< IInputBackend > backend_
void SetConfig(const InputConfig &config)
void ReleaseButton(SnesButton button)
InputConfig GetConfig() const
const IInputBackend * backend() const
std::atomic< uint16_t > agent_buttons_
bool Initialize(InputBackendFactory::BackendType type=InputBackendFactory::BackendType::SDL2)
SnesButton
SNES controller button mapping (platform-agnostic)
Input configuration (platform-agnostic key codes)