1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package ui
import (
"github.com/hajimehoshi/ebiten/v2"
"muhq.space/muhqs-game/go/game"
)
type HandCard struct {
C *game.Card
}
type HandView struct {
CardGrid
}
func NewHandView(x, y, width, height int, h *game.Hand, bottomAligned bool) *HandView {
hv := &HandView{CardGrid{
WidgetBase: NewWidgetBase(x, y, width, height),
cards: h,
rows: 1,
scale: -1,
}}
hv.renderImpl = func() *ebiten.Image { return hv.render() }
return hv
}
func (hv *HandView) FindObjectAt(x, y int) any {
if obj := hv.CardGrid.FindObjectAt(x, y); obj != nil {
return HandCard{obj.(*game.Card)}
}
return nil
}
|