context is great again, fixes to connectors
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
|
||||
@ -138,7 +139,7 @@ func main() {
|
||||
SetBgColor("#ef305c70").
|
||||
SetFgColor("white").
|
||||
SetItems([]interface{}{
|
||||
`"Fisheye" crafty shaded glasses`,
|
||||
`"Fish-eye" crafty shaded glasses`,
|
||||
"Xecutor's glowing visor",
|
||||
"Kitschy goggles of many pathways",
|
||||
"Ring of inexistence",
|
||||
@ -190,7 +191,7 @@ func main() {
|
||||
// f()
|
||||
// break
|
||||
case <-State.Exit:
|
||||
mainCtx.Logger().Warn().Msg("quitting NOW")
|
||||
appctx.Logger(mainCtx).Warn().Msg("quitting NOW")
|
||||
exit = true
|
||||
break
|
||||
// не оставляйте default в бесконечном select {} - сожрет всё CPU
|
||||
@ -201,7 +202,7 @@ func main() {
|
||||
}
|
||||
|
||||
}
|
||||
mainCtx.Logger().Info().Msg("pre-shutdown sequence")
|
||||
appctx.Logger(mainCtx).Info().Msg("pre-shutdown sequence")
|
||||
}
|
||||
|
||||
func setupLayers(mainwindow *mainwindow.MainWindow) {
|
||||
@ -211,7 +212,7 @@ func setupLayers(mainwindow *mainwindow.MainWindow) {
|
||||
mainwindow.AddLayer("menu", 3, "white")
|
||||
}
|
||||
|
||||
func decodeInput(ctx appctx.ClientCtx, baseLayer *mainwindow.Layer) {
|
||||
func decodeInput(ctx context.Context, baseLayer *mainwindow.Layer) {
|
||||
var exit = false
|
||||
var waitForWCspam = true
|
||||
for !exit {
|
||||
@ -221,9 +222,9 @@ func decodeInput(ctx appctx.ClientCtx, baseLayer *mainwindow.Layer) {
|
||||
continue
|
||||
}
|
||||
if keycode == blt.TK_CLOSE && !waitForWCspam {
|
||||
ctx.Logger().Warn().Msg("exiting on window close...")
|
||||
appctx.Logger(ctx).Warn().Msg("exiting on window close...")
|
||||
State.Exit <- struct{}{}
|
||||
ctx.Logger().Warn().Msg("...done")
|
||||
appctx.Logger(ctx).Warn().Msg("...done")
|
||||
return
|
||||
}
|
||||
var pressed = ""
|
||||
@ -247,9 +248,9 @@ func decodeInput(ctx appctx.ClientCtx, baseLayer *mainwindow.Layer) {
|
||||
case "Ctrl+q":
|
||||
//fallthrough
|
||||
//case "Escape":
|
||||
ctx.Logger().Info().Msg("exiting on quit command...")
|
||||
appctx.Logger(ctx).Info().Msg("exiting on quit command...")
|
||||
State.Exit <- struct{}{}
|
||||
ctx.Logger().Info().Msg("...done")
|
||||
appctx.Logger(ctx).Info().Msg("...done")
|
||||
exit = true
|
||||
return
|
||||
default:
|
||||
|
Reference in New Issue
Block a user