merged
This commit is contained in:
parent
3886a05ce2
commit
31d5be5d07
@ -69,7 +69,7 @@ func (devm *DevmenuScreen) HandleInput(input string) {
|
|||||||
level.Tiles[idx].Visible = true
|
level.Tiles[idx].Visible = true
|
||||||
level.Tiles[idx].Explored = true
|
level.Tiles[idx].Explored = true
|
||||||
}
|
}
|
||||||
appctx.Logger(devm.ctx).Warn().Msg("making everything visible!")
|
appctx.Logger().Warn().Msg("making everything visible!")
|
||||||
devm.scm.SetScreen(devm.scm.PreviousScreen)
|
devm.scm.SetScreen(devm.scm.PreviousScreen)
|
||||||
break
|
break
|
||||||
case "p":
|
case "p":
|
||||||
|
@ -88,7 +88,7 @@ func (ms *MenuScreen) Render() {
|
|||||||
if ms.renderParent {
|
if ms.renderParent {
|
||||||
ms.scm.PreviousScreen.Render()
|
ms.scm.PreviousScreen.Render()
|
||||||
}
|
}
|
||||||
if (ms.redraw || ms.renderParent) {
|
if ms.redraw || ms.renderParent {
|
||||||
ms.redraw = false
|
ms.redraw = false
|
||||||
ms.drawFunc()
|
ms.drawFunc()
|
||||||
}
|
}
|
||||||
@ -96,13 +96,13 @@ func (ms *MenuScreen) Render() {
|
|||||||
|
|
||||||
func (ms *MenuScreen) ListHandleInput(input string) {
|
func (ms *MenuScreen) ListHandleInput(input string) {
|
||||||
switch input {
|
switch input {
|
||||||
case "Up":
|
case "Up", "k":
|
||||||
ms.offset = ms.offset - 1
|
ms.offset = ms.offset - 1
|
||||||
if ms.offset < 0 {
|
if ms.offset < 0 {
|
||||||
ms.offset = 0
|
ms.offset = 0
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "Down":
|
case "Down", "j":
|
||||||
ms.offset = ms.offset + 1
|
ms.offset = ms.offset + 1
|
||||||
if ms.offset > len(ms.items)-1 {
|
if ms.offset > len(ms.items)-1 {
|
||||||
ms.offset = len(ms.items) - 1
|
ms.offset = len(ms.items) - 1
|
||||||
@ -133,7 +133,7 @@ func (ms *MenuScreen) ListRender() {
|
|||||||
itemField := types.Rect{ms.X, ms.Y + headerHeight + 1, ms.W, ms.H - headerHeight - footerHeight}
|
itemField := types.Rect{ms.X, ms.Y + headerHeight + 1, ms.W, ms.H - headerHeight - footerHeight}
|
||||||
_ = itemField
|
_ = itemField
|
||||||
var ilw, ilh int
|
var ilw, ilh int
|
||||||
if (len(ms.items) > 0) {
|
if len(ms.items) > 0 {
|
||||||
//fixme itemfield object, scroller, inputhandler, current selected item
|
//fixme itemfield object, scroller, inputhandler, current selected item
|
||||||
menuItems := make([]string, 0)
|
menuItems := make([]string, 0)
|
||||||
for i := ms.offset; i < len(ms.items); i++ {
|
for i := ms.offset; i < len(ms.items); i++ {
|
||||||
@ -152,15 +152,15 @@ func (ms *MenuScreen) ListRender() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ms *MenuScreen) drawScrollBar(menuLayer *mainwindow.Layer, itemField types.Rect) {
|
func (ms *MenuScreen) drawScrollBar(menuLayer *mainwindow.Layer, itemField types.Rect) {
|
||||||
scrollbarBg := types.NewRect(itemField.X+itemField.W-2, itemField.Y + 1, 1, itemField.H - 4)
|
scrollbarBg := types.NewRect(itemField.X+itemField.W-2, itemField.Y+1, 1, itemField.H-4)
|
||||||
menuLayer.WithColor("#77000000").NewWindow(scrollbarBg).Splash()
|
menuLayer.WithColor("#77000000").NewWindow(scrollbarBg).Splash()
|
||||||
//tick
|
//tick
|
||||||
menuLayer.WithColor(ms.fgColor).Put(
|
menuLayer.WithColor(ms.fgColor).Put(
|
||||||
scrollbarBg.X,
|
scrollbarBg.X,
|
||||||
scrollbarBg.Y + int(float64(ms.offset) / float64(len(ms.items)) * float64(scrollbarBg.H)),
|
scrollbarBg.Y+int(float64(ms.offset)/float64(len(ms.items))*float64(scrollbarBg.H)),
|
||||||
"⏹",
|
"⏹",
|
||||||
)
|
)
|
||||||
menuLayer.WithColor(ms.fgColor).Put(itemField.X+itemField.W-2, itemField.Y+scrollbarBg.H + 1, "↓")
|
menuLayer.WithColor(ms.fgColor).Put(itemField.X+itemField.W-2, itemField.Y+scrollbarBg.H+1, "↓")
|
||||||
menuLayer.WithColor(ms.fgColor).Put(itemField.X+itemField.W-2, itemField.Y, "↑")
|
menuLayer.WithColor(ms.fgColor).Put(itemField.X+itemField.W-2, itemField.Y, "↑")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user