diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-04-03 17:33:12 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:53 +0100 |
| commit | e2acea9d73cc717786b083008cb44441ef487299 (patch) | |
| tree | 21c06c1116f0a75dff726148c444be89f30ae4ce /go/ui | |
| parent | 011b95e8db31f1306eafb575ed12bed4e2fc1ca3 (diff) | |
| download | muhqs-game-e2acea9d73cc717786b083008cb44441ef487299.tar.gz muhqs-game-e2acea9d73cc717786b083008cb44441ef487299.zip | |
bump ebiten version to 2.5.1 and new APIs
Diffstat (limited to 'go/ui')
| -rw-r--r-- | go/ui/button.go | 4 | ||||
| -rw-r--r-- | go/ui/cardGrid.go | 2 | ||||
| -rw-r--r-- | go/ui/collection.go | 5 | ||||
| -rw-r--r-- | go/ui/mapView.go | 6 |
4 files changed, 8 insertions, 9 deletions
diff --git a/go/ui/button.go b/go/ui/button.go index e882d39c..afd37a31 100644 --- a/go/ui/button.go +++ b/go/ui/button.go @@ -4,8 +4,8 @@ import ( "image/color" "github.com/hajimehoshi/ebiten/v2" - "github.com/hajimehoshi/ebiten/v2/ebitenutil" "github.com/hajimehoshi/ebiten/v2/text" + "github.com/hajimehoshi/ebiten/v2/vector" "muhq.space/muhqs-game/go/font" ) @@ -32,7 +32,7 @@ func NewSimpleButton(x, y, w, h int, label string, onClick func(b *SimpleButton) func (b *SimpleButton) render() *ebiten.Image { img := ebiten.NewImage(b.Width, b.Height) - ebitenutil.DrawRect(img, float64(0), float64(0), float64(b.Width), float64(b.Height), b.Bg) + vector.DrawFilledRect(img, float32(0), float32(0), float32(b.Width), float32(b.Height), b.Bg, false) bounds := text.BoundString(font.Font24, b.label) x := b.Width/2 - centerTextXOffset(bounds) diff --git a/go/ui/cardGrid.go b/go/ui/cardGrid.go index 4cab2da7..36a215d5 100644 --- a/go/ui/cardGrid.go +++ b/go/ui/cardGrid.go @@ -98,7 +98,7 @@ func (w *CardGrid) render() *ebiten.Image { op.GeoM.Translate(xOffset, yOffset) if c, found := w.highlights[card]; found { - op.ColorM.ScaleWithColor(c) + op.ColorScale.ScaleWithColor(c) } w.grid.DrawImage(cardImg, op) diff --git a/go/ui/collection.go b/go/ui/collection.go index 03920f34..31a4d225 100644 --- a/go/ui/collection.go +++ b/go/ui/collection.go @@ -98,9 +98,8 @@ func (c *Collection) Update() error { } if textInput, ok := activeWidget.(*TextInput); ok { - // var input []rune - // ebiten.AppendInputChars(input) - input := ebiten.InputChars() + var input []rune + ebiten.AppendInputChars(input) if len(input) > 0 { textInput.AddInput(input) } diff --git a/go/ui/mapView.go b/go/ui/mapView.go index 721356ff..59e8f3a7 100644 --- a/go/ui/mapView.go +++ b/go/ui/mapView.go @@ -132,7 +132,7 @@ func (vw *MapView) drawMapLayer(screen *ebiten.Image) { op.GeoM.Translate(x_px, y_px) if color, found := vw.tileHighlights[pos]; found { - op.ColorM.ScaleWithColor(color) + op.ColorScale.ScaleWithColor(color) } vw.mapLayer.DrawImage(tileImg, op) @@ -176,10 +176,10 @@ func (vw *MapView) drawPermanentsLayer(screen *ebiten.Image) { op := &ebiten.DrawImageOptions{} op.GeoM.Translate(float64(x_px), float64(y_px)) - op.ColorM.ScaleWithColor(p.Controller().Color) + op.ColorScale.ScaleWithColor(p.Controller().Color) if color, found := vw.permanentsHighlights[p]; found { - op.ColorM.ScaleWithColor(color) + op.ColorScale.ScaleWithColor(color) } vw.permanentsLayer.DrawImage(permanentSymbol, op) |
