pud dev menu, prefabs blitting seems broken - out of level bounds

This commit is contained in:
anton.gurov 2019-11-12 13:00:44 +03:00
parent c6d3997e6f
commit d198001ec0
2 changed files with 11 additions and 2 deletions

View File

@ -154,7 +154,7 @@ func main() {
&State, &State,
types.NewCenteredRect(mw.Rect, 70, 25), types.NewCenteredRect(mw.Rect, 70, 25),
true, true,
).SetBgColor("#ef305c70"). ).SetBgColor("#ef6d559d").
SetFgColor("white"), SetFgColor("white"),
) )

View File

@ -5,6 +5,7 @@ import (
"lab.zaar.be/thefish/alchemyst-go/engine/gamestate" "lab.zaar.be/thefish/alchemyst-go/engine/gamestate"
"lab.zaar.be/thefish/alchemyst-go/engine/types" "lab.zaar.be/thefish/alchemyst-go/engine/types"
"lab.zaar.be/thefish/alchemyst-go/ui/mainwindow" "lab.zaar.be/thefish/alchemyst-go/ui/mainwindow"
"strings"
) )
type DevmenuScreen struct { type DevmenuScreen struct {
@ -53,6 +54,7 @@ func (devm *DevmenuScreen) HandleInput(input string) {
level.Tiles[idx].Visible = false level.Tiles[idx].Visible = false
level.Tiles[idx].Explored = false level.Tiles[idx].Explored = false
} }
devm.scm.SetScreen(devm.scm.PreviousScreen)
break break
case "v": case "v":
level := devm.state.Level level := devm.state.Level
@ -61,6 +63,7 @@ func (devm *DevmenuScreen) HandleInput(input string) {
level.Tiles[idx].Explored = true level.Tiles[idx].Explored = true
} }
fmt.Printf("making everything visible!") fmt.Printf("making everything visible!")
devm.scm.SetScreen(devm.scm.PreviousScreen)
break break
case "Escape": case "Escape":
fallthrough fallthrough
@ -88,8 +91,14 @@ func (devm *DevmenuScreen) Render() {
menuLayer.WithColor(devm.fgColor).PrintInside( menuLayer.WithColor(devm.fgColor).PrintInside(
devm.Rect, devm.Rect,
"v - all visible\ni - all invisible", strings.Join([]string{
"Dev Menu:",
"[color=green]v[/color] - set all tiles visible",
"[color=green]i[/color] - set all tiles invisible",
}, "\n"),
1, 1,
) )
menuLayer.Print(devm.X+2, devm.Y+devm.H-1, "[color=green]Space[/color] to close")
} }