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
#include "
app/emu/input/input_backend.h
"
6
7
namespace
yaze
{
8
namespace
emu {
9
10
// Forward declaration
11
class
Snes;
12
13
namespace
input {
14
15
class
InputManager
{
16
public
:
17
InputManager
() =
default
;
18
~InputManager
() {
Shutdown
(); }
19
20
bool
Initialize
(
InputBackendFactory::BackendType
type =
InputBackendFactory::BackendType::SDL2
);
21
void
Initialize
(std::unique_ptr<IInputBackend>
backend
);
22
void
Shutdown
();
23
void
Poll
(
Snes
* snes,
int
player = 1);
24
void
ProcessEvent
(
void
* event);
25
26
IInputBackend
*
backend
() {
return
backend_
.get(); }
27
const
IInputBackend
*
backend
()
const
{
return
backend_
.get(); }
28
29
bool
IsInitialized
()
const
{
return
backend_
&&
backend_
->IsInitialized(); }
30
31
InputConfig
GetConfig
()
const
;
32
void
SetConfig
(
const
InputConfig
& config);
33
34
// --- Agent Control API ---
35
void
PressButton
(
SnesButton
button);
36
void
ReleaseButton
(
SnesButton
button);
37
38
private
:
39
std::unique_ptr<IInputBackend>
backend_
;
40
ControllerState
agent_controller_state_
;
// State controlled by agent
41
};
42
43
}
// namespace input
44
}
// namespace emu
45
}
// namespace yaze
46
47
#endif
// YAZE_APP_EMU_INPUT_INPUT_MANAGER_H_
yaze::emu::Snes
Definition
snes.h:25
yaze::emu::input::IInputBackend
Abstract input backend interface.
Definition
input_backend.h:84
yaze::emu::input::InputBackendFactory::BackendType
BackendType
Definition
input_backend.h:137
yaze::emu::input::InputBackendFactory::BackendType::SDL2
@ SDL2
yaze::emu::input::InputManager
Definition
input_manager.h:15
yaze::emu::input::InputManager::Poll
void Poll(Snes *snes, int player=1)
Definition
input_manager.cc:47
yaze::emu::input::InputManager::PressButton
void PressButton(SnesButton button)
Definition
input_manager.cc:90
yaze::emu::input::InputManager::ProcessEvent
void ProcessEvent(void *event)
Definition
input_manager.cc:71
yaze::emu::input::InputManager::backend_
std::unique_ptr< IInputBackend > backend_
Definition
input_manager.h:39
yaze::emu::input::InputManager::agent_controller_state_
ControllerState agent_controller_state_
Definition
input_manager.h:40
yaze::emu::input::InputManager::SetConfig
void SetConfig(const InputConfig &config)
Definition
input_manager.cc:84
yaze::emu::input::InputManager::Shutdown
void Shutdown()
Definition
input_manager.cc:40
yaze::emu::input::InputManager::InputManager
InputManager()=default
yaze::emu::input::InputManager::ReleaseButton
void ReleaseButton(SnesButton button)
Definition
input_manager.cc:94
yaze::emu::input::InputManager::~InputManager
~InputManager()
Definition
input_manager.h:18
yaze::emu::input::InputManager::IsInitialized
bool IsInitialized() const
Definition
input_manager.h:29
yaze::emu::input::InputManager::GetConfig
InputConfig GetConfig() const
Definition
input_manager.cc:77
yaze::emu::input::InputManager::backend
const IInputBackend * backend() const
Definition
input_manager.h:27
yaze::emu::input::InputManager::Initialize
bool Initialize(InputBackendFactory::BackendType type=InputBackendFactory::BackendType::SDL2)
Definition
input_manager.cc:10
yaze::emu::input::InputManager::backend
IInputBackend * backend()
Definition
input_manager.h:26
input_backend.h
yaze::emu::input::SnesButton
SnesButton
SNES controller button mapping (platform-agnostic)
Definition
input_backend.h:15
yaze
Main namespace for the application.
Definition
asar_wrapper.cc:14
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.9.8