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 <memory>
5
6
#include "
app/emu/input/input_backend.h
"
7
8
namespace
yaze
{
9
namespace
emu {
10
11
// Forward declaration
12
class
Snes;
13
14
namespace
input {
15
16
class
InputManager
{
17
public
:
18
InputManager
();
19
~InputManager
() {
Shutdown
(); }
20
21
bool
Initialize
(
InputBackendFactory::BackendType
type =
22
InputBackendFactory::BackendType::SDL2
);
23
void
Initialize
(std::unique_ptr<IInputBackend>
backend
);
24
void
Shutdown
();
25
void
Poll
(
Snes
* snes,
int
player = 1);
26
void
ProcessEvent
(
void
* event);
27
28
IInputBackend
*
backend
() {
return
backend_
.get(); }
29
const
IInputBackend
*
backend
()
const
{
return
backend_
.get(); }
30
31
bool
IsInitialized
()
const
{
return
backend_
&&
backend_
->IsInitialized(); }
32
33
InputConfig
GetConfig
()
const
;
34
void
SetConfig
(
const
InputConfig
& config);
35
36
// --- Agent Control API ---
37
void
PressButton
(
SnesButton
button);
38
void
ReleaseButton
(
SnesButton
button);
39
40
private
:
41
std::unique_ptr<IInputBackend>
backend_
;
42
ControllerState
agent_controller_state_
;
// State controlled by agent
43
InputConfig
config_
;
// Cached/pending config
44
};
45
46
}
// namespace input
47
}
// namespace emu
48
}
// namespace yaze
49
50
#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:16
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:120
yaze::emu::input::InputManager::ProcessEvent
void ProcessEvent(void *event)
Definition
input_manager.cc:86
yaze::emu::input::InputManager::backend_
std::unique_ptr< IInputBackend > backend_
Definition
input_manager.h:41
yaze::emu::input::InputManager::agent_controller_state_
ControllerState agent_controller_state_
Definition
input_manager.h:42
yaze::emu::input::InputManager::SetConfig
void SetConfig(const InputConfig &config)
Definition
input_manager.cc:99
yaze::emu::input::InputManager::Shutdown
void Shutdown()
Definition
input_manager.cc:52
yaze::emu::input::InputManager::config_
InputConfig config_
Definition
input_manager.h:43
yaze::emu::input::InputManager::ReleaseButton
void ReleaseButton(SnesButton button)
Definition
input_manager.cc:124
yaze::emu::input::InputManager::~InputManager
~InputManager()
Definition
input_manager.h:19
yaze::emu::input::InputManager::IsInitialized
bool IsInitialized() const
Definition
input_manager.h:31
yaze::emu::input::InputManager::GetConfig
InputConfig GetConfig() const
Definition
input_manager.cc:92
yaze::emu::input::InputManager::backend
const IInputBackend * backend() const
Definition
input_manager.h:29
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:28
input_backend.h
yaze::emu::input::SnesButton
SnesButton
SNES controller button mapping (platform-agnostic)
Definition
input_backend.h:15
yaze
Definition
application.cc:18
yaze::emu::input::ControllerState
Controller state (16-bit SNES controller format)
Definition
input_backend.h:33
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