FunkPanion/plugins/GlobalInput/global_input_gd_script.gd
2024-11-23 14:36:52 -06:00

57 lines
1.7 KiB
GDScript

#region Header
#01. tool
#02. class_name
#03. extends
extends Node
#endregion
#region Documentation
#-----------------------------------------------------------
#04. # docstring
## hoge
#-----------------------------------------------------------
#endregion
#region Body
#05. signals
#-----------------------------------------------------------
#-----------------------------------------------------------
#06. enums
#-----------------------------------------------------------
#-----------------------------------------------------------
#08. variables
#-----------------------------------------------------------
var global_input_csharp = preload("res://plugins/GlobalInput/GlobalInputCSharp.cs")
var global_input = global_input_csharp.new()
#-----------------------------------------------------------
#09. methods
#-----------------------------------------------------------
func _ready() -> void:
add_child(global_input)
print("GLOBAL KEY INPUT READY")
func is_action_just_pressed(action: StringName) -> bool:
return global_input.IsActionJustPressed(action)
func is_action_pressed(action: StringName) -> bool:
return global_input.IsActionPressed(action)
func is_action_just_released(action: StringName) -> bool:
return global_input.IsActionJustReleased(action)
func is_key_pressed(key: int) -> bool:
return global_input.IsKeyPressed(key)
func get_vector(negative_x, positive_x, negative_y, positive_y) -> Vector2:
return global_input.GetVector(negative_x, positive_x, negative_y, positive_y)
func get_mouse_position() -> Vector2:
return global_input.GetMousePosition()
#-----------------------------------------------------------
#10. signal methods
#-----------------------------------------------------------