ready to ecs

This commit is contained in:
anton.gurov
2019-10-31 18:33:37 +03:00
parent 2bb7cae632
commit fa3e3ee786
5 changed files with 43 additions and 15 deletions

View File

@ -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
}
}