You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go version:
Go-SDL2 version:
SDL2 version:
OS: mac
Architecture: m1
forrunning {
sdl.WaitEvent()
// DrawMultilineText(text, surface, popup)RenderText(text, surface)
window.UpdateSurface()
forevent:=sdl.PollEvent(); event!=nil; event=sdl.PollEvent() {
switchevent:=event.(type) {
case*sdl.KeyboardEvent:
fmt.Println("Keyboard event") // does not work when waiting for eventsifevent.Type==sdl.KEYDOWN {
fmt.Println("Key pressed:", event.Keysym.Sym, text)
}
case*sdl.TextInputEvent:
fmt.Println("Text input event", event.GetText()) // does not work when I don't wait for events but works when after sdl.WaitEvent()case*sdl.QuitEvent:
running=falsedefault:
fmt.Println("Event type: ", event.GetType(), event) // does not work on Enter, when waiting for events
}
}
sdl.Delay(delay)
}
Keyboard events such as Enter or Escape works fine when I don't wait for event. But if i use wait event, I can catch only text input events. moreover, text input events does not appear when I don't use wait for event. @veeableful
The text was updated successfully, but these errors were encountered:
Hi @Mariownyou, since you called sdl.WaitEvent() you can use the event returned from the function and check whether it is a KeyboardEvent for the Enter or Escape, using a switch case similar to the one used for sdl.PollEvent().
Go version:
Go-SDL2 version:
SDL2 version:
OS: mac
Architecture: m1
Keyboard events such as Enter or Escape works fine when I don't wait for event. But if i use wait event, I can catch only text input events. moreover, text input events does not appear when I don't use wait for event.
@veeableful
The text was updated successfully, but these errors were encountered: