package screens import ( "lab.zaar.be/thefish/alchemyst-go/engine/gamestate" "lab.zaar.be/thefish/alchemyst-go/ui/mainwindow" ) type GameScreen struct { mw *mainwindow.MainWindow state *gamestate.GameState vp *mainwindow.ViewPort } func NewGameScreen(mw *mainwindow.MainWindow, state *gamestate.GameState, viewPort *mainwindow.ViewPort) *GameScreen { return &GameScreen{mw: mw, state: state, vp: viewPort} } func (ts *GameScreen) UseEcs() bool { return true } func (ts *GameScreen) Enter() {} func (ts *GameScreen) HandleInput(input string) { //ts.state.Do(func(){ switch input { case "Up", "k", "8": ts.state.Player.Walk(0, -1) break case "Down", "j", "2": ts.state.Player.Walk(0, 1) break case "Left", "h", "4": ts.state.Player.Walk(-1, 0) break case "Right", "l", "6": ts.state.Player.Walk(1, 0) break case "y", "7": ts.state.Player.Walk(-1, -1) break case "u", "9": ts.state.Player.Walk(1, -1) break case "b", "1": ts.state.Player.Walk(-1, 1) break case "n", "3": ts.state.Player.Walk(-1, 3) break default: ts.mw.GetLayer("base").ClearArea(0, 3, 40, 1) ts.mw.GetLayer("base").Print(1, 3, "Key: "+input) ts.mw.GetLayer("base").Print(1, 6, "█") } //}) } func (ts *GameScreen) Exit() {} func (ts *GameScreen) Render() { ts.vp.Render(ts.state) }