Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: go get ./...

- name: Build WebAssembly
run: |
go build -ldflags="-s -w" -tags tiny -o docs/html/main.wasm .
go build -ldflags="-s -w" -tags ark_tiny -o docs/html/main.wasm .
- name: Deploy to GitHub Pages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: |
sudo apt-get update -y
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: go get ./...
- name: Build
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Build
run: GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build .
- name: Build APP Bundle
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Build
run: GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build .
- name: Build APP Bundle
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: |
sudo apt-get update -y
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: go get ./...
- name: Build
Expand All @@ -75,7 +75,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Build
run: GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build .
- name: Build APP Bundle
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Build
run: GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build .
- name: Build APP Bundle
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: go get ./...
- name: Build WebAssembly
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: |
go get ./...
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: |
sudo apt-get update -y
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
go-version: '1.25.x'
- name: Install dependencies
run: |
sudo apt-get update -y
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [[v0.2.2]](https://github.com/mlange-42/tiny-world/compare/v0.2.1...v0.2.2)

* Migrate from the Arche ECS to [Ark](https://github.com/mlange-42/ark) (#267)

## [[v0.2.1]](https://github.com/mlange-42/tiny-world/compare/v0.2.0...v0.2.1)

### Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A tiny, slow-paced world and colony building game.

Made with [Ebitengine](https://github.com/hajimehoshi/ebiten) and the [Arche](https://github.com/mlange-42/arche) Entity Component System.
Made with [Ebitengine](https://github.com/hajimehoshi/ebiten) and the [Ark](https://github.com/mlange-42/ark) Entity Component System.

<div align="center" width="100%">
<img alt="Tiny World screenshot" src="https://github.com/mlange-42/tiny-world/assets/44003176/b3384739-af7c-4f44-996f-8f1cb5097fa3"></img>
Expand Down
2 changes: 1 addition & 1 deletion game/comp/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package comp
import (
"image"

"github.com/mlange-42/arche/ecs"
"github.com/mlange-42/ark/ecs"
"github.com/mlange-42/tiny-world/game/resource"
"github.com/mlange-42/tiny-world/game/terr"
)
Expand Down
6 changes: 3 additions & 3 deletions game/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ package game

import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/mlange-42/arche-model/model"
"github.com/mlange-42/ark-tools/app"
"github.com/mlange-42/tiny-world/game/res"
)

// Game container
type Game struct {
Model *model.Model
Model *app.App
Screen res.Screen
Mouse res.Mouse

canvasHelper *canvasHelper
}

// NewGame returns a new game
func NewGame(mod *model.Model) Game {
func NewGame(mod *app.App) Game {
return Game{
Model: mod,
Screen: res.Screen{Image: nil, Width: 0, Height: 0},
Expand Down
15 changes: 7 additions & 8 deletions game/menu/draw_ui.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
package menu

import (
"github.com/mlange-42/arche/ecs"
"github.com/mlange-42/arche/generic"
"github.com/mlange-42/ark/ecs"
"github.com/mlange-42/tiny-world/game/res"
)

// DrawUI is a system to render the user interface.
type DrawUI struct {
screen generic.Resource[res.Screen]
ui generic.Resource[UI]
sprites generic.Resource[res.Sprites]
screen ecs.Resource[res.Screen]
ui ecs.Resource[UI]
sprites ecs.Resource[res.Sprites]
}

// InitializeUI the system
func (s *DrawUI) InitializeUI(world *ecs.World) {
s.ui = generic.NewResource[UI](world)
s.screen = generic.NewResource[res.Screen](world)
s.sprites = generic.NewResource[res.Sprites](world)
s.ui = s.ui.New(world)
s.screen = s.screen.New(world)
s.sprites = s.sprites.New(world)
}

// UpdateUI the system
Expand Down
41 changes: 19 additions & 22 deletions game/menu/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func NewUI(f fs.FS, folder, mapsFolder string, selectedTab int, sprts *res.Sprit
}

ui.infoLabel = widget.NewText(
widget.TextOpts.Text(" ", fonts.Default, ui.sprites.TextHighlightColor),
widget.TextOpts.Text(" ", &fonts.Default, ui.sprites.TextHighlightColor),
widget.TextOpts.Position(widget.TextPositionCenter, widget.TextPositionCenter),
widget.TextOpts.WidgetOpts(
widget.WidgetOpts.LayoutData(widget.RowLayoutData{
Expand Down Expand Up @@ -157,7 +157,7 @@ func NewUI(f fs.FS, folder, mapsFolder string, selectedTab int, sprts *res.Sprit
widget.ContainerOpts.Layout(widget.NewRowLayout(
widget.RowLayoutOpts.Direction(widget.DirectionVertical),
widget.RowLayoutOpts.Spacing(5),
widget.RowLayoutOpts.Padding(widget.Insets{Top: 24}),
widget.RowLayoutOpts.Padding(&widget.Insets{Top: 24}),
)),
widget.ContainerOpts.WidgetOpts(
widget.WidgetOpts.LayoutData(widget.AnchorLayoutData{
Expand All @@ -168,7 +168,7 @@ func NewUI(f fs.FS, folder, mapsFolder string, selectedTab int, sprts *res.Sprit
)

titleLabel := widget.NewText(
widget.TextOpts.Text("Tiny World", fonts.Title, ui.sprites.TextColor),
widget.TextOpts.Text("Tiny World", &fonts.Title, ui.sprites.TextColor),
widget.TextOpts.Position(widget.TextPositionCenter, widget.TextPositionCenter),
widget.TextOpts.WidgetOpts(
widget.WidgetOpts.LayoutData(widget.RowLayoutData{
Expand Down Expand Up @@ -282,7 +282,7 @@ func (ui *UI) createMainMenuButton(text string, fonts *res.Fonts, click func(arg
widget.WidgetOpts.MinSize(240, 0),
),
widget.ButtonOpts.Image(ui.defaultButtonImage()),
widget.ButtonOpts.Text(text, fonts.Default, &widget.ButtonTextColor{
widget.ButtonOpts.Text(text, &fonts.Default, &widget.ButtonTextColor{
Idle: ui.sprites.TextColor,
Disabled: ui.sprites.TextColor,
}),
Expand Down Expand Up @@ -323,7 +323,7 @@ func (ui *UI) createBackStartButtons(text string, fonts *res.Fonts,
}),
),
widget.ButtonOpts.Image(ui.defaultButtonImage()),
widget.ButtonOpts.Text("Back", fonts.Default, &widget.ButtonTextColor{
widget.ButtonOpts.Text("Back", &fonts.Default, &widget.ButtonTextColor{
Idle: ui.sprites.TextColor,
Disabled: ui.sprites.TextColor,
}),
Expand All @@ -346,7 +346,7 @@ func (ui *UI) createBackStartButtons(text string, fonts *res.Fonts,
}),
),
widget.ButtonOpts.Image(ui.defaultButtonImage()),
widget.ButtonOpts.Text(text, fonts.Default, &widget.ButtonTextColor{
widget.ButtonOpts.Text(text, &fonts.Default, &widget.ButtonTextColor{
Idle: ui.sprites.TextColor,
Disabled: ui.sprites.TextColor,
}),
Expand All @@ -360,7 +360,7 @@ func (ui *UI) createBackStartButtons(text string, fonts *res.Fonts,

func (ui *UI) createMainMenuLabel(text string, fonts *res.Fonts) *widget.Text {
label := widget.NewText(
widget.TextOpts.Text(text, fonts.Default, ui.sprites.TextColor),
widget.TextOpts.Text(text, &fonts.Default, ui.sprites.TextColor),
widget.TextOpts.Position(widget.TextPositionCenter, widget.TextPositionCenter),
widget.TextOpts.WidgetOpts(
widget.WidgetOpts.LayoutData(
Expand Down Expand Up @@ -389,7 +389,7 @@ func (ui *UI) createNewWorldPanel(games []save.SaveGame, fonts *res.Fonts, start
}),
),
widget.TextInputOpts.Placeholder("World name"),
widget.TextInputOpts.Face(fonts.Default),
widget.TextInputOpts.Face(&fonts.Default),
widget.TextInputOpts.Image(&widget.TextInputImage{
Idle: ui.background,
Disabled: ui.backgroundHover,
Expand All @@ -401,9 +401,7 @@ func (ui *UI) createNewWorldPanel(games []save.SaveGame, fonts *res.Fonts, start
DisabledCaret: ui.sprites.TextColor,
}),
widget.TextInputOpts.Padding(widget.NewInsetsSimple(5)),
widget.TextInputOpts.CaretOpts(
widget.CaretOpts.Size(fonts.Default, 2),
),
widget.TextInputOpts.CaretWidth(2),
)

menuContainer.AddChild(newName)
Expand Down Expand Up @@ -432,7 +430,7 @@ func (ui *UI) createNewWorldPanel(games []save.SaveGame, fonts *res.Fonts, start
menuContainer.AddChild(buttons)

editorLabel := widget.NewText(
widget.TextOpts.Text(editorModeText, fonts.Default, ui.sprites.TextColor),
widget.TextOpts.Text(editorModeText, &fonts.Default, ui.sprites.TextColor),
widget.TextOpts.Position(widget.TextPositionCenter, widget.TextPositionEnd),
widget.TextOpts.WidgetOpts(
widget.WidgetOpts.LayoutData(widget.RowLayoutData{
Expand Down Expand Up @@ -477,7 +475,7 @@ func (ui *UI) createLoadPanel(games []save.SaveGame, fonts *res.Fonts,
widget.WidgetOpts.ContextMenu(contextMenu),
),
widget.ButtonOpts.Image(img),
widget.ButtonOpts.Text(game.Name, fonts.Default, &widget.ButtonTextColor{
widget.ButtonOpts.Text(game.Name, &fonts.Default, &widget.ButtonTextColor{
Idle: ui.sprites.TextColor,
Disabled: ui.sprites.TextColor,
}),
Expand All @@ -496,7 +494,7 @@ func (ui *UI) createLoadPanel(games []save.SaveGame, fonts *res.Fonts,
widget.WidgetOpts.ContextMenu(contextMenu),
),
widget.ButtonOpts.Image(img),
widget.ButtonOpts.Text(fmt.Sprintf("Delete '%s'", game), fonts.Default, &widget.ButtonTextColor{
widget.ButtonOpts.Text(fmt.Sprintf("Delete '%s'", game), &fonts.Default, &widget.ButtonTextColor{
Idle: ui.sprites.TextColor,
Disabled: ui.sprites.TextColor,
}),
Expand Down Expand Up @@ -548,7 +546,7 @@ func (ui *UI) createScenariosPanel(games []save.SaveGame, achievements *achievem
}),
),
widget.TextInputOpts.Placeholder("World name"),
widget.TextInputOpts.Face(fonts.Default),
widget.TextInputOpts.Face(&fonts.Default),
widget.TextInputOpts.Image(&widget.TextInputImage{
Idle: ui.background,
Disabled: ui.background,
Expand All @@ -560,9 +558,7 @@ func (ui *UI) createScenariosPanel(games []save.SaveGame, achievements *achievem
DisabledCaret: ui.sprites.TextColor,
}),
widget.TextInputOpts.Padding(widget.NewInsetsSimple(5)),
widget.TextInputOpts.CaretOpts(
widget.CaretOpts.Size(fonts.Default, 2),
),
widget.TextInputOpts.CaretWidth(2),
)

mapsLabel := ui.createMainMenuLabel("Scenarios", fonts)
Expand Down Expand Up @@ -615,7 +611,7 @@ func (ui *UI) createScenariosPanel(games []save.SaveGame, achievements *achievem
tooltipContainer := widget.NewContainer(
widget.ContainerOpts.Layout(widget.NewRowLayout(
widget.RowLayoutOpts.Direction(widget.DirectionVertical),
widget.RowLayoutOpts.Padding(widget.Insets{Top: 6, Bottom: 6, Left: 12, Right: 12}),
widget.RowLayoutOpts.Padding(&widget.Insets{Top: 6, Bottom: 6, Left: 12, Right: 12}),
)),
widget.ContainerOpts.AutoDisableChildren(),
widget.ContainerOpts.BackgroundImage(ui.background),
Expand Down Expand Up @@ -648,7 +644,8 @@ func (ui *UI) createScenariosPanel(games []save.SaveGame, achievements *achievem

label := widget.NewText(
widget.TextOpts.ProcessBBCode(true),
widget.TextOpts.Text(fmt.Sprintf("%s%s\n\n%sRequired achievements:\n%s", m.Name, localText, description, achieve), fonts.Default, ui.sprites.TextColor),
widget.TextOpts.Text(fmt.Sprintf("%s%s\n\n%sRequired achievements:\n%s", m.Name, localText, description, achieve),
&fonts.Default, ui.sprites.TextColor),
widget.TextOpts.Position(widget.TextPositionStart, widget.TextPositionCenter),
widget.TextOpts.MaxWidth(360),
)
Expand All @@ -668,7 +665,7 @@ func (ui *UI) createScenariosPanel(games []save.SaveGame, achievements *achievem
)),
),
widget.ButtonOpts.Image(img),
widget.ButtonOpts.Text(m.Name+localMarker, fonts.Default, &widget.ButtonTextColor{
widget.ButtonOpts.Text(m.Name+localMarker, &fonts.Default, &widget.ButtonTextColor{
Idle: ui.sprites.TextColor,
Disabled: color.NRGBA{180, 180, 180, 255},
}),
Expand Down Expand Up @@ -784,7 +781,7 @@ func (ui *UI) createAchievementsPanel(achieves *achievements.Achievements, fonts
widget.WidgetOpts.LayoutData(widget.GridLayoutData{}),
),
widget.ButtonOpts.Image(img),
widget.ButtonOpts.Text(name+"\n"+ach.Description, fonts.Default, &widget.ButtonTextColor{
widget.ButtonOpts.Text(name+"\n"+ach.Description, &fonts.Default, &widget.ButtonTextColor{
Idle: ui.sprites.TextColor,
Disabled: color.NRGBA{120, 120, 120, 255},
}),
Expand Down
Loading