ready to ecs
This commit is contained in:
@ -117,12 +117,21 @@ func setupLayers(mainwindow *mainwindow.MainWindow) {
|
||||
|
||||
func decodeInput(ctx util.ClientCtx, baseLayer *mainwindow.Layer) {
|
||||
var exit = false
|
||||
//for some reason blt's input queue gots spammed with 0xE0 on start.
|
||||
//with this crutch we can wait out this WindowCloseEvent burst.
|
||||
var waitForStartingWindowCloseBurst = true
|
||||
for !exit{
|
||||
select {
|
||||
case keycode := <-State.rawInput:
|
||||
if keycode == blt.TK_NONE {
|
||||
continue
|
||||
}
|
||||
if keycode == blt.TK_CLOSE && !waitForStartingWindowCloseBurst {
|
||||
ctx.Logger().Warn().Msg("exiting on window close...")
|
||||
State.exit <- struct{}{}
|
||||
ctx.Logger().Warn().Msg("...done")
|
||||
return
|
||||
}
|
||||
var pressed= ""
|
||||
var isModifier, _= util.InArray(keycode, modifiers)
|
||||
if !isModifier {
|
||||
@ -154,6 +163,7 @@ func decodeInput(ctx util.ClientCtx, baseLayer *mainwindow.Layer) {
|
||||
exit = true
|
||||
return
|
||||
default:
|
||||
waitForStartingWindowCloseBurst = false
|
||||
State.input <- pressed
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user