Giter Site home page Giter Site logo

godot-input-buffer's People

Contributors

drkitt avatar johnnyneverwalked avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

godot-input-buffer's Issues

Incompatibility

I can't get the addon to work in version 4.2.1 stable official [b09f793f5] it's just not detecting the key presses, i think the function calls changed, i tried to fix it but couldn't.

Shouldn't this only track events assigned to actions?

Just wondering, since the method signature is _is_action_press_buffered(action), shouldn't this script only care about events that are assigned to actions in the InputMap? And if so, couldn't you get rid of most of the conditional logic in the keycode checking etc? So it could all be simplified to a dictionary of action names?

Something like this

extends Node

const BUFFER_WINDOW: int = 150

var buffer: Dictionary = {}


func _input(event: InputEvent) -> void:
	var action: StringName = _get_event_action(event)

	if action:
		buffer[action] = Time.get_ticks_msec()


func is_action_pressed_buffered(action: StringName) -> bool:
	if buffer.has(action):
		return Time.get_ticks_msec() - buffer[action] <= BUFFER_WINDOW

	return false


func _get_event_action(event: InputEvent) -> StringName:
	var actions: Array[StringName] = InputMap.get_actions()
	var event_action: StringName

	actions.reverse()

	for action in actions:
		if !event_action && event.is_action(action):
			event_action = action

	return event_action

Godot 4 and Joystick support

Hello, I found this addon and it was really useful for my projects! :)
Since I am working with Godot 4 for on one of them, I forked your repo and made the following changes:

  • Converted the buffer to Godot 4
  • Added support for Input InputEventJoypadMotion events to support gamepad joystick buffering

I could open a PR to merge these changes if you're ok with it, but I didn't want to do it on main before asking since it would break 3.x compatibility

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.