Godot-GlobalInput-Addon
How to use:
- Create a project using the mono version of Godot
- Download and drag GlobalInput's addon folder in your project's addon folder.
- Create a temp node scene with a temp .cs script to be able to build the addon
- Activate the addon.
--------------------------------------------------
Dependencies
SharpHook - enter "dotnet add package SharpHook" into the console/cli within the project's directory
--------------------------------------------------
Setup Video
https://youtu.be/oJLsgq3i-yw - for v 0.1 (but should still work)
--------------------------------------------------
GdScript:
After activiating the pluggin, access the GlobalInput singleton/autoload with 'GlobalInput'.
Functions within GlobalInput autoload:
- GlobalInput.is_action_just_pressed(action: String)
- GlobalInput.is_action_pressed(action: String)
- GlobalInput.is_action_just_released(action: String)
- GlobalInput.is_key_pressed(key: Key)
- GlobalInput.get_vector(negativeX: String, positiveX: String, negativeY: String, positiveY: String)
- GlobalInput.get_mouse_position()
--------------------------------------------------
C#:
After activating the pluggin, access the GlobalInputCSharp singleton/autoload with:
'GlobalInputCSharp GlobalInput; // declare the variable'
(within the _Ready function)
'GlobalInput = GetNode("/root/GlobalInput/GlobalInputCSharp") // initialize the variable'
Functions within GlobalInputCSharp:
- GlobalInput.IsActionJustPressed(string action)
- GlobalInput.IsActionPressed(string action)
- GlobalInput.IsActionJustReleased(string action)
- GlobalInput.IsKeyPressed(Key key)
- GlobalInput.GetVector(string negativeX, string positiveX, string negativeY, string positiveY)
- GlobalInput.GetMousePosition()