Toast Engine
Loading...
Searching...
No Matches
input_events.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
10#include <toast/events/event.hpp>
11#include <toast/uid.hpp>
12
13namespace input {
14class Action;
15enum class ActionEvent : uint8_t;
16enum class Device : uint8_t;
17}
18
19namespace assets {
20class Haptic;
21}
22
23namespace event {
24
28struct 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;
37};
38
42struct 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
52struct 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
62struct 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
72struct ReloadInputActions : Event<ReloadInputActions> { };
73
77struct 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;
83};
84
90struct PlayHapticDirect : Event<PlayHapticDirect> {
93 : controller(controller),
94 haptic(std::move(haptic)) { }
95
96 uint32_t controller;
98};
99
103struct SetHapticsMultiplier : Event<SetHapticsMultiplier> {
104 explicit SetHapticsMultiplier(float multiplier) : multiplier(multiplier) { }
105
106 float multiplier;
107};
108
109}
Type-safe smart pointer for assets.
Definition core_types.hpp:149
Asset representing a single haptic effect loaded from a .thaptic file.
Definition haptic.hpp:33
Definition action.hpp:21
Base types for the asset system.
Device
Physical device a keycode belongs to.
Definition keycodes.hpp:18
PlayHapticDirect(uint32_t controller, assets::Handle< assets::Haptic > haptic)
Definition input_events.hpp:92
PlayHaptic(std::string target, assets::Handle< assets::Haptic > haptic)
Definition input_events.hpp:79
Requests that the input system rebuild its actions from the asset manifest.
Definition input_events.hpp:72
Definition uid.hpp:20
Unique identifier for everything that exists in our engine.
ActionEvent
Discrete event an action can emit, carried alongside the action in an InputEvent.
Definition value.hpp:76