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
7
#include "
app/emu/input/input_backend.h
"
8
9
namespace
yaze
{
10
namespace
emu {
11
12
// Forward declaration
13
class
Snes;
14
15
namespace
input {
16
17
class
InputManager
{
18
public
:
19
InputManager
();
20
~InputManager
() {
Shutdown
(); }
21
22
bool
Initialize
(
InputBackendFactory::BackendType
type =
23
InputBackendFactory::BackendType::SDL2
);
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_
yaze::emu::Snes
Definition
snes.h:28
yaze::emu::input::IInputBackend
Abstract input backend interface.
Definition
input_backend.h:95
yaze::emu::input::InputBackendFactory::BackendType
BackendType
Definition
input_backend.h:148
yaze::emu::input::InputBackendFactory::BackendType::SDL2
@ SDL2
yaze::emu::input::InputManager
Definition
input_manager.h:17
yaze::emu::input::InputManager::Poll
void Poll(Snes *snes, int player=1)
Definition
input_manager.cc:59
yaze::emu::input::InputManager::PressButton
void PressButton(SnesButton button)
Definition
input_manager.cc:121
yaze::emu::input::InputManager::ProcessEvent
void ProcessEvent(void *event)
Definition
input_manager.cc:87
yaze::emu::input::InputManager::backend_
std::unique_ptr< IInputBackend > backend_
Definition
input_manager.h:42
yaze::emu::input::InputManager::SetConfig
void SetConfig(const InputConfig &config)
Definition
input_manager.cc:100
yaze::emu::input::InputManager::Shutdown
void Shutdown()
Definition
input_manager.cc:52
yaze::emu::input::InputManager::config_
InputConfig config_
Definition
input_manager.h:44
yaze::emu::input::InputManager::ReleaseButton
void ReleaseButton(SnesButton button)
Definition
input_manager.cc:127
yaze::emu::input::InputManager::~InputManager
~InputManager()
Definition
input_manager.h:20
yaze::emu::input::InputManager::IsInitialized
bool IsInitialized() const
Definition
input_manager.h:32
yaze::emu::input::InputManager::GetConfig
InputConfig GetConfig() const
Definition
input_manager.cc:93
yaze::emu::input::InputManager::backend
const IInputBackend * backend() const
Definition
input_manager.h:30
yaze::emu::input::InputManager::agent_buttons_
std::atomic< uint16_t > agent_buttons_
Definition
input_manager.h:43
yaze::emu::input::InputManager::InputManager
InputManager()
Definition
input_manager.cc:10
yaze::emu::input::InputManager::Initialize
bool Initialize(InputBackendFactory::BackendType type=InputBackendFactory::BackendType::SDL2)
Definition
input_manager.cc:17
yaze::emu::input::InputManager::backend
IInputBackend * backend()
Definition
input_manager.h:29
input_backend.h
yaze::emu::input::SnesButton
SnesButton
SNES controller button mapping (platform-agnostic)
Definition
input_backend.h:15
yaze
Definition
patch_export_usage.cc:8
yaze::emu::input::InputConfig
Input configuration (platform-agnostic key codes)
Definition
input_backend.h:54
src
app
emu
input
input_manager.h
Generated by
1.10.0