diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-09-03 14:32:13 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-09-03 14:32:13 +0200 |
| commit | d292115061b793c8fe959a3eecb0fd3c226f70f9 (patch) | |
| tree | 27603320be28174edb31a1a5410e74ca4165943c /go | |
| parent | 24a6b1d7aced3e2da8a4c26dfa844a6eaaf4632e (diff) | |
| download | muhqs-game-d292115061b793c8fe959a3eecb0fd3c226f70f9.tar.gz muhqs-game-d292115061b793c8fe959a3eecb0fd3c226f70f9.zip | |
fix prompt transparency on hover
Diffstat (limited to 'go')
| -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) { |
