Potato Engine
Loading...
Searching...
No Matches
InputBinding.hpp
Go to the documentation of this file.
1
2#pragma once
3
5#include "Input.hpp"
6
11{
12// optimized declaration order
13public:
14 std::string name;
15
16private:
17 EventDelegate<> delegate;
18
19public:
20 Keycode key;
21 InputType type;
22
32 template<typename T>
33 InputBinding(Keycode key, InputType type, std::string name, T* obj, void(T::*callback)()) :
34 name(name),
35 delegate(obj, callback),
36 key(key),
37 type(type)
38 {}
39
47 InputBinding(Keycode key, InputType type, std::string name, void(*callback)()) :
48 name(name),
49 delegate(callback),
50 key(key),
51 type(type)
52 {}
53
55 inline const EventDelegate<>& GetDelegate() const { return delegate; }
56
57};
Global input enum definitions.
InputType
Enum representing input states.
Definition Input.hpp:52
Keycode
Enum representing input keys.
Definition Input.hpp:15
A wrapper that carries response delegate information.
const EventDelegate & GetDelegate() const
Gets EventDelegate reference.
InputBinding(Keycode key, InputType type, std::string name, T *obj, void(T::*callback)())
Constructs binding with method callback.
InputBinding(Keycode key, InputType type, std::string name, void(*callback)())
Constructs binding with standalone callback.