R-Type
R-Type project
EventAction.hpp
1
/*
2
** EPITECH PROJECT, 2022
3
** gameEngine2
4
** File description:
5
** EventAction
6
*/
7
8
#ifndef EVENTACTION_HPP_
9
#define EVENTACTION_HPP_
10
11
#include <functional>
12
#include <vector>
13
14
namespace
KapEngine
{
15
16
namespace
Events {
17
18
class
EventAction
{
19
public
:
20
EventAction
() {
21
PROFILER_FUNC_START();
22
PROFILER_FUNC_END();
23
}
24
~
EventAction
() {
25
PROFILER_FUNC_START();
26
PROFILER_FUNC_END();
27
}
28
34
void
registerAction
(std::function<
void
()> func) {
35
PROFILER_FUNC_START();
36
_funcs.push_back(func);
37
PROFILER_FUNC_END();
38
}
39
44
void
invoke
() {
45
PROFILER_FUNC_START();
46
for
(std::size_t i = 0; i < _funcs.size(); i++) {
47
_funcs[i]();
48
}
49
PROFILER_FUNC_END();
50
}
51
56
void
clear
() {
57
PROFILER_FUNC_START();
58
_funcs.clear();
59
PROFILER_FUNC_END();
60
}
61
62
protected
:
63
private
:
64
std::vector<std::function<void()>> _funcs;
65
};
66
67
}
68
69
}
70
71
#endif
/* !EVENTACTION_HPP_ */
KapEngine::Events::EventAction::clear
void clear()
clear all actions
Definition:
EventAction.hpp:56
KapEngine::Events::EventAction
Definition:
EventAction.hpp:18
KapEngine::Events::EventAction::registerAction
void registerAction(std::function< void()> func)
register an action to do (lambda)
Definition:
EventAction.hpp:34
KapEngine::Events::EventAction::invoke
void invoke()
call all actions
Definition:
EventAction.hpp:44
KapEngine
main namespace
Definition:
Component.hpp:17
Library
KapEngine
KapEngine
Events
Action
EventAction.hpp
Generated by
1.8.17