diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-30 20:25:15 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-07-30 20:28:56 +0200 |
| commit | 5a4a5159b3dcc1caa01e81222f3f1beefcfb4b02 (patch) | |
| tree | 643fa1cdddca1f03d5e76719a2afb607009d91c1 /go/ui | |
| parent | f64e8747e287e949ce7cbbb42303ad1cdfabec89 (diff) | |
| download | muhqs-game-5a4a5159b3dcc1caa01e81222f3f1beefcfb4b02.tar.gz muhqs-game-5a4a5159b3dcc1caa01e81222f3f1beefcfb4b02.zip | |
use any instead of interface{}
Diffstat (limited to 'go/ui')
| -rw-r--r-- | go/ui/cardGrid.go | 2 | ||||
| -rw-r--r-- | go/ui/cardView.go | 2 | ||||
| -rw-r--r-- | go/ui/choice.go | 4 | ||||
| -rw-r--r-- | go/ui/collection.go | 2 | ||||
| -rw-r--r-- | go/ui/hand.go | 2 | ||||
| -rw-r--r-- | go/ui/mapView.go | 2 | ||||
| -rw-r--r-- | go/ui/prompt.go | 4 | ||||
| -rw-r--r-- | go/ui/stateBar.go | 2 | ||||
| -rw-r--r-- | go/ui/textBox.go | 2 | ||||
| -rw-r--r-- | go/ui/widget.go | 4 |
10 files changed, 13 insertions, 13 deletions
diff --git a/go/ui/cardGrid.go b/go/ui/cardGrid.go index e3866369..355965a1 100644 --- a/go/ui/cardGrid.go +++ b/go/ui/cardGrid.go @@ -125,7 +125,7 @@ func (w *CardGrid) render() *ebiten.Image { return img } -func (w *CardGrid) FindObjectAt(_x, _y int) interface{} { +func (w *CardGrid) FindObjectAt(_x, _y int) any { if !w.Contains(_x, _y) || w.grid == nil { return nil } diff --git a/go/ui/cardView.go b/go/ui/cardView.go index 960f9230..0dff9481 100644 --- a/go/ui/cardView.go +++ b/go/ui/cardView.go @@ -91,7 +91,7 @@ func (cv *ToggleCardView) Contains(x, y int) bool { return cv.cv.Contains(x, y) || cv.tgglBtn.Contains(x, y) } -func (cv *ToggleCardView) FindObjectAt(x, y int) interface{} { +func (cv *ToggleCardView) FindObjectAt(x, y int) any { return cv.cv.FindObjectAt(x, y) } diff --git a/go/ui/choice.go b/go/ui/choice.go index 7c32b2bc..1c1c72b6 100644 --- a/go/ui/choice.go +++ b/go/ui/choice.go @@ -10,11 +10,11 @@ import ( type Choice struct { TextBox - choices []interface{} + choices []any onClick func(*Choice, int, int) } -func NewChoice(x, y int, choices []interface{}, onClick func(*Choice, int, int)) *Choice { +func NewChoice(x, y int, choices []any, onClick func(*Choice, int, int)) *Choice { c := &Choice{ TextBox: *(NewAutoTextBox(x, y, "")), choices: choices, diff --git a/go/ui/collection.go b/go/ui/collection.go index ece205a0..78944814 100644 --- a/go/ui/collection.go +++ b/go/ui/collection.go @@ -114,7 +114,7 @@ func (c *Collection) FindWidgetAt(x, y int) Widget { return nil } -func (c *Collection) FindObjectAt(x, y int) interface{} { +func (c *Collection) FindObjectAt(x, y int) any { // Iterate the widget in reverse order to ensure that upper widgets are // considered first diff --git a/go/ui/hand.go b/go/ui/hand.go index 7c8feab8..46dd34c6 100644 --- a/go/ui/hand.go +++ b/go/ui/hand.go @@ -24,7 +24,7 @@ func NewHandView(x, y, width, height int, h *game.Hand, bottomAligned bool) *Han return hv } -func (hv *HandView) FindObjectAt(x, y int) interface{} { +func (hv *HandView) FindObjectAt(x, y int) any { if obj := hv.CardGrid.FindObjectAt(x, y); obj != nil { return HandCard{obj.(*game.Card)} } diff --git a/go/ui/mapView.go b/go/ui/mapView.go index f716278c..d73f3573 100644 --- a/go/ui/mapView.go +++ b/go/ui/mapView.go @@ -386,7 +386,7 @@ func isSymbolTransparentAt(p game.Permanent, relativeX, relativeY int) bool { return alpha == 0 } -func (vw *MapView) FindObjectAt(screenX, screenY int) interface{} { +func (vw *MapView) FindObjectAt(screenX, screenY int) any { scaled_tile_wdth := int(float64(TILE_WIDTH) * vw.scale) scaled_tile_hght := int(float64(TILE_HEIGHT) * vw.scale) x := screenX / scaled_tile_wdth diff --git a/go/ui/prompt.go b/go/ui/prompt.go index a289ae13..5448dfde 100644 --- a/go/ui/prompt.go +++ b/go/ui/prompt.go @@ -40,7 +40,7 @@ func NewCancelablePrompt(y, width int, action game.Action, promptText string) *P func (p *Prompt) Cancelable() bool { return p.cancelable } func (p *Prompt) Action() game.Action { return p.action } -func (p *Prompt) Add(obj interface{}) error { +func (p *Prompt) Add(obj any) error { if handCard, ok := obj.(HandCard); ok { obj = handCard.C } @@ -66,7 +66,7 @@ func (p *Prompt) Contains(x, y int) bool { return x >= 0 && y >= 0 && x <= p.width && y >= p.y && y <= p.y+PROMPT_HEIGHT } -func (p *Prompt) FindObjectAt(screenX, screenY int) interface{} { return nil } +func (p *Prompt) FindObjectAt(screenX, screenY int) any { return nil } func (*Prompt) Render(Widget) *ebiten.Image { return nil } func (p *Prompt) setTextBgAlpha(alpha uint8) { diff --git a/go/ui/stateBar.go b/go/ui/stateBar.go index 65187e30..a5189a84 100644 --- a/go/ui/stateBar.go +++ b/go/ui/stateBar.go @@ -46,7 +46,7 @@ func (sb *StateBar) Draw(screen *ebiten.Image) { sb.phaseView.Draw(screen) } -func (sb *StateBar) FindObjectAt(x, y int) interface{} { return nil } +func (sb *StateBar) FindObjectAt(x, y int) any { return nil } func (sb *StateBar) ForceRedraw() { if sb.resourceView != nil { diff --git a/go/ui/textBox.go b/go/ui/textBox.go index c93e14e2..7a3772f0 100644 --- a/go/ui/textBox.go +++ b/go/ui/textBox.go @@ -179,7 +179,7 @@ func (w *PocList) setText() { w.Y = w.bottomY - int(height) - w.YMargin } -func (w *PocList) FindObjectAt(_x, _y int) interface{} { +func (w *PocList) FindObjectAt(_x, _y int) any { if !w.Contains(_x, _y) { return nil } diff --git a/go/ui/widget.go b/go/ui/widget.go index da12929d..4082c828 100644 --- a/go/ui/widget.go +++ b/go/ui/widget.go @@ -6,7 +6,7 @@ import ( type Widget interface { Draw(*ebiten.Image) - FindObjectAt(int, int) interface{} + FindObjectAt(int, int) any Contains(int, int) bool Layout() (int, int) @@ -57,7 +57,7 @@ func (w *WidgetBase) Contains(x, y int) bool { return x >= 0 && y >= 0 && x >= w.X && x <= w.X+w.Width && y >= w.Y && y <= w.Y+w.Height } -func (w *WidgetBase) FindObjectAt(int, int) interface{} { +func (w *WidgetBase) FindObjectAt(int, int) any { return nil } |
