Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
input_events.hpp
Go to the documentation of this file.
1
6
7
#pragma once
8
9
#include <
toast/assets/core_types.hpp
>
10
#include <toast/events/event.hpp>
11
#include <
toast/uid.hpp
>
12
13
namespace
input {
14
class
Action
;
15
enum class
ActionEvent
: uint8_t;
16
enum class
Device
: uint8_t;
17
}
18
19
namespace
assets {
20
class
Haptic
;
21
}
22
23
namespace
event {
24
28
struct
InputEvent : Event<InputEvent> {
29
InputEvent(
toast::UID
action_id,
input::Action
& action,
input::ActionEvent
type)
30
: action_id(action_id),
31
action(action),
32
type(type) { }
33
34
toast::UID
action_id;
35
input::Action
& action;
36
input::ActionEvent
type;
37
};
38
42
struct
LastInputType : Event<LastInputType> {
43
LastInputType(
input::Device
device, std::string name) : device(device), name(std::move(name)) { }
44
45
input::Device
device;
46
std::string name;
47
};
48
52
struct
SetInputLayout : Event<SetInputLayout> {
53
SetInputLayout(std::string target, std::string layout) : target(std::move(target)), layout(std::move(layout)) { }
54
55
std::string target;
56
std::string layout;
57
};
58
62
struct
SetInputLayer : Event<SetInputLayer> {
63
SetInputLayer(std::string target, std::string layer) : target(std::move(target)), layer(std::move(layer)) { }
64
65
std::string target;
66
std::string layer;
67
};
68
72
struct
ReloadInputActions
: Event<ReloadInputActions> { };
73
77
struct
PlayHaptic
: Event<PlayHaptic> {
79
PlayHaptic
(std::string target,
assets::Handle<assets::Haptic>
haptic) : target(std::move(target)), haptic(std::move(haptic)) { }
80
81
std::string target;
82
assets::Handle<assets::Haptic>
haptic;
83
};
84
90
struct
PlayHapticDirect
: Event<PlayHapticDirect> {
92
PlayHapticDirect
(uint32_t controller,
assets::Handle<assets::Haptic>
haptic)
93
: controller(controller),
94
haptic(std::move(haptic)) { }
95
96
uint32_t controller;
97
assets::Handle<assets::Haptic>
haptic;
98
};
99
103
struct
SetHapticsMultiplier : Event<SetHapticsMultiplier> {
104
explicit
SetHapticsMultiplier(
float
multiplier) : multiplier(multiplier) { }
105
106
float
multiplier;
107
};
108
109
}
assets::Handle
Type-safe smart pointer for assets.
Definition
core_types.hpp:149
assets::Haptic
Asset representing a single haptic effect loaded from a .thaptic file.
Definition
haptic.hpp:33
input::Action
Definition
action.hpp:21
core_types.hpp
Base types for the asset system.
input::Device
Device
Physical device a keycode belongs to.
Definition
keycodes.hpp:18
event::PlayHapticDirect::PlayHapticDirect
PlayHapticDirect(uint32_t controller, assets::Handle< assets::Haptic > haptic)
Definition
input_events.hpp:92
event::PlayHaptic::PlayHaptic
PlayHaptic(std::string target, assets::Handle< assets::Haptic > haptic)
Definition
input_events.hpp:79
event::ReloadInputActions
Requests that the input system rebuild its actions from the asset manifest.
Definition
input_events.hpp:72
toast::UID
Definition
uid.hpp:20
uid.hpp
Unique identifier for everything that exists in our engine.
input::ActionEvent
ActionEvent
Discrete event an action can emit, carried alongside the action in an InputEvent.
Definition
value.hpp:76
engine
src
toast
input
input_events.hpp
Generated by
1.17.0