-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcharacter_controller.hpp
48 lines (38 loc) · 1.27 KB
/
character_controller.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include <type_traits>
#include <godot_cpp/classes/input.hpp>
#include <godot_cpp/classes/node2d.hpp>
#include <godot_cpp/classes/object.hpp>
#include <godot_cpp/variant/vector2.hpp>
#include "core/concepts.hpp"
#include "core/constants.hpp"
#include "util/bind.hpp"
namespace rl
{
class CharacterController : public godot::Node2D
{
GDCLASS(CharacterController, godot::Node2D);
public:
enum class InputMode {
MouseAndKeyboard,
Controller,
AI
};
public:
CharacterController() = default;
virtual ~CharacterController() = default;
void _process(double delta_time) override;
virtual void process_action_input(godot::Input* const input, double delta_time);
virtual void process_movement_input(godot::Input* const input, double delta_time);
virtual void process_rotation_input(godot::Input* const input, double delta_time);
protected:
static void _bind_methods();
protected:
// the active input mode for character controls
InputMode m_input_mode{ InputMode::MouseAndKeyboard };
// target rotation
double m_rotation_angle{ 0.0 };
// elapsed runtime (seconds)
double m_elapsed_time{ 0.0 };
};
}