diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 14:29:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch) | |
tree | 43cdc7cfe8239c23065616a931de3769d2db1e86 /core/input | |
parent | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff) |
Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
-o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
-o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```
This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.
This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.
Part of #33027.
Diffstat (limited to 'core/input')
-rw-r--r-- | core/input/input.cpp | 2 | ||||
-rw-r--r-- | core/input/input_event.cpp | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp index a9921f791a..e81dfcf30f 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -672,6 +672,7 @@ void Input::set_mouse_position(const Point2 &p_posf) { Point2 Input::get_mouse_position() const { return mouse_pos; } + Point2 Input::get_last_mouse_speed() const { return mouse_speed_track.speed; } @@ -812,6 +813,7 @@ void Input::accumulate_input_event(const Ref<InputEvent> &p_event) { accumulated_events.push_back(p_event); } + void Input::flush_accumulated_events() { while (accumulated_events.front()) { parse_input_event(accumulated_events.front()->get()); diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index 094ed0bc56..497ce79038 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -131,6 +131,7 @@ void InputEventFromWindow::_bind_methods() { void InputEventFromWindow::set_window_id(int64_t p_id) { window_id = p_id; } + int64_t InputEventFromWindow::get_window_id() const { return window_id; } @@ -148,6 +149,7 @@ bool InputEventWithModifiers::get_shift() const { void InputEventWithModifiers::set_alt(bool p_enabled) { alt = p_enabled; } + bool InputEventWithModifiers::get_alt() const { return alt; } @@ -155,6 +157,7 @@ bool InputEventWithModifiers::get_alt() const { void InputEventWithModifiers::set_control(bool p_enabled) { control = p_enabled; } + bool InputEventWithModifiers::get_control() const { return control; } @@ -162,6 +165,7 @@ bool InputEventWithModifiers::get_control() const { void InputEventWithModifiers::set_metakey(bool p_enabled) { meta = p_enabled; } + bool InputEventWithModifiers::get_metakey() const { return meta; } @@ -169,6 +173,7 @@ bool InputEventWithModifiers::get_metakey() const { void InputEventWithModifiers::set_command(bool p_enabled) { command = p_enabled; } + bool InputEventWithModifiers::get_command() const { return command; } @@ -359,6 +364,7 @@ void InputEventKey::_bind_methods() { void InputEventMouse::set_button_mask(int p_mask) { button_mask = p_mask; } + int InputEventMouse::get_button_mask() const { return button_mask; } @@ -366,6 +372,7 @@ int InputEventMouse::get_button_mask() const { void InputEventMouse::set_position(const Vector2 &p_pos) { pos = p_pos; } + Vector2 InputEventMouse::get_position() const { return pos; } @@ -373,6 +380,7 @@ Vector2 InputEventMouse::get_position() const { void InputEventMouse::set_global_position(const Vector2 &p_global_pos) { global_pos = p_global_pos; } + Vector2 InputEventMouse::get_global_position() const { return global_pos; } @@ -405,6 +413,7 @@ float InputEventMouseButton::get_factor() const { void InputEventMouseButton::set_button_index(int p_index) { button_index = p_index; } + int InputEventMouseButton::get_button_index() const { return button_index; } @@ -412,6 +421,7 @@ int InputEventMouseButton::get_button_index() const { void InputEventMouseButton::set_pressed(bool p_pressed) { pressed = p_pressed; } + bool InputEventMouseButton::is_pressed() const { return pressed; } @@ -419,6 +429,7 @@ bool InputEventMouseButton::is_pressed() const { void InputEventMouseButton::set_doubleclick(bool p_doubleclick) { doubleclick = p_doubleclick; } + bool InputEventMouseButton::is_doubleclick() const { return doubleclick; } @@ -739,6 +750,7 @@ int InputEventJoypadButton::get_button_index() const { void InputEventJoypadButton::set_pressed(bool p_pressed) { pressed = p_pressed; } + bool InputEventJoypadButton::is_pressed() const { return pressed; } @@ -746,6 +758,7 @@ bool InputEventJoypadButton::is_pressed() const { void InputEventJoypadButton::set_pressure(float p_pressure) { pressure = p_pressure; } + float InputEventJoypadButton::get_pressure() const { return pressure; } @@ -798,6 +811,7 @@ void InputEventJoypadButton::_bind_methods() { void InputEventScreenTouch::set_index(int p_index) { index = p_index; } + int InputEventScreenTouch::get_index() const { return index; } @@ -805,6 +819,7 @@ int InputEventScreenTouch::get_index() const { void InputEventScreenTouch::set_position(const Vector2 &p_pos) { pos = p_pos; } + Vector2 InputEventScreenTouch::get_position() const { return pos; } @@ -812,6 +827,7 @@ Vector2 InputEventScreenTouch::get_position() const { void InputEventScreenTouch::set_pressed(bool p_pressed) { pressed = p_pressed; } + bool InputEventScreenTouch::is_pressed() const { return pressed; } @@ -860,6 +876,7 @@ int InputEventScreenDrag::get_index() const { void InputEventScreenDrag::set_position(const Vector2 &p_pos) { pos = p_pos; } + Vector2 InputEventScreenDrag::get_position() const { return pos; } @@ -867,6 +884,7 @@ Vector2 InputEventScreenDrag::get_position() const { void InputEventScreenDrag::set_relative(const Vector2 &p_relative) { relative = p_relative; } + Vector2 InputEventScreenDrag::get_relative() const { return relative; } @@ -874,6 +892,7 @@ Vector2 InputEventScreenDrag::get_relative() const { void InputEventScreenDrag::set_speed(const Vector2 &p_speed) { speed = p_speed; } + Vector2 InputEventScreenDrag::get_speed() const { return speed; } @@ -922,6 +941,7 @@ void InputEventScreenDrag::_bind_methods() { void InputEventAction::set_action(const StringName &p_action) { action = p_action; } + StringName InputEventAction::get_action() const { return action; } @@ -929,6 +949,7 @@ StringName InputEventAction::get_action() const { void InputEventAction::set_pressed(bool p_pressed) { pressed = p_pressed; } + bool InputEventAction::is_pressed() const { return pressed; } |