Skip to content

Commit

Permalink
Merge pull request #62826 from akien-mga/3.x-reenable-input-accumulation
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Jul 7, 2022
2 parents 12c5348 + d6bcdd1 commit b4fa512
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/classes/Input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@
<member name="use_accumulated_input" type="bool" setter="set_use_accumulated_input" getter="is_using_accumulated_input">
If [code]true[/code], similar input events sent by the operating system are accumulated. When input accumulation is enabled, all input events generated during a frame will be merged and emitted when the frame is done rendering. Therefore, this limits the number of input method calls per second to the rendering FPS.
Input accumulation can be disabled to get slightly more precise/reactive input at the cost of increased CPU usage. In applications where drawing freehand lines is required, input accumulation should generally be disabled while the user is drawing the line to get results that closely follow the actual input.
[b]Note:[/b] Input accumulation is [i]disabled[/i] by default for backward compatibility reasons. It is however recommended to enable it for games which don't require very reactive input, as this will decrease CPU usage.
[b]Note:[/b] Input accumulation is [i]enabled[/i] by default. It is recommended to keep it enabled for games which don't require very reactive input, as this will decrease CPU usage.
</member>
</members>
<signals>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/InputEventMouseMotion.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</brief_description>
<description>
Contains mouse and pen motion information. Supports relative, absolute positions and speed. See [method Node._input].
[b]Note:[/b] By default, this event can be emitted multiple times per frame rendered, allowing for precise input reporting, at the expense of CPU usage. You can set [member Input.use_accumulated_input] to [code]true[/code] to let multiple events merge into a single emitted event per frame.
[b]Note:[/b] The behavior of this event is affected by the value of [member Input.use_accumulated_input]. When set to [code]true[/code] (default), mouse/pen motion events received from the OS will be merged to emit an accumulated event only once per frame rendered at most. When set to [code]false[/code], the events will be emitted as received, which means that they can be emitted multiple times per frame rendered, allowing for precise input reporting at the expense of CPU usage.
[b]Note:[/b] If you use InputEventMouseMotion to draw lines, consider implementing [url=https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm]Bresenham's line algorithm[/url] as well to avoid visible gaps in lines if the user is moving the mouse quickly.
</description>
<tutorials>
Expand Down
2 changes: 1 addition & 1 deletion main/input_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ void InputDefault::release_pressed_events() {

InputDefault::InputDefault() {
use_input_buffering = false;
use_accumulated_input = false;
use_accumulated_input = true;
mouse_button_mask = 0;
emulate_touch_from_mouse = false;
emulate_mouse_from_touch = false;
Expand Down

0 comments on commit b4fa512

Please sign in to comment.