gd.Input returns classdb.Input. I want to create function which handles all inputs and returns action name which should be processed into my state machine.
So i want to make function like
func (p *Player) HandleInput(event gd.InputEvent) {
// trying to handle mouse modes
if event.AsInputEvent().IsActionPressed(p.Temporary.StringName("ui_cancel"), true, true) {
mouseMode := gd.Input(p.Temporary).GetMouseMode()
if mouseMode == gd.InputMouseMode(0) {
gd.Input(p.Temporary).SetMouseMode(gd.InputMouseMode(1))
} else {
gd.Input(p.Temporary).SetMouseMode(gd.InputMouseMode(0))
}
}
// rest of strange code to collect movements
}
How can I get that gd.InputEvent type from classdb.Input? And also specific InputEventMouseMotion to handle rotation?
Hi!
Here is simple code snippet from examples
gd.Input
returnsclassdb.Input
. I want to create function which handles all inputs and returns action name which should be processed into my state machine.So i want to make function like
How can I get that
gd.InputEvent
type fromclassdb.Input
? And also specificInputEventMouseMotion
to handle rotation?