diff options
| -rw-r--r-- | go/ui/prompt.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/go/ui/prompt.go b/go/ui/prompt.go index 338121c6..9f8bad00 100644 --- a/go/ui/prompt.go +++ b/go/ui/prompt.go @@ -28,6 +28,7 @@ func NewPrompt(y, width int, action game.Action, promptText string) *Prompt { action: action, components: []Widget{NewFixedTextBox(0, y, width, PROMPT_HEIGHT, promptText).Centering(true)}, } + p.RegisterHandler("hover", p.Hover) return p } @@ -82,22 +83,12 @@ func (p *Prompt) setTextBgAlpha(alpha uint8) { } } -func (p *Prompt) onHover(ticks int, x int, y int, c *Collection) bool { - if ticks == 1 { +func (p *Prompt) Hover(hover bool, x int, y int) { + if hover { p.setTextBgAlpha(0x7f) - return true + } else { + p.setTextBgAlpha(0xff) } - - return false -} - -func (p *Prompt) stopHover(ticks int, x, y int) bool { - if p.Contains(x, y) { - return false - } - - p.setTextBgAlpha(0xff) - return true } func (p *Prompt) Layout() (int, int) { |
