Skip to content

Commit

Permalink
Embed all resources (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokiat authored May 14, 2023
1 parent 0ae7514 commit 3eb343b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/rallymka/app_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ import (
"github.com/mokiat/lacking/ui/mat"
"github.com/mokiat/lacking/util/resource"
gameui "github.com/mokiat/rally-mka/internal/ui"
"github.com/mokiat/rally-mka/resources"
)

func runApplication() error {
registry, err := asset.NewDirRegistry(".")
if err != nil {
return fmt.Errorf("failed to initialize registry: %w", err)
}
locator := mat.WrappedResourceLocator(resource.NewFSLocator(resources.UI))

renderAPI := glrender.NewAPI()
gameController := game.NewController(registry, renderAPI, glgame.NewShaderCollection())
resourceLocator := mat.WrappedResourceLocator(resource.NewFileLocator("./resources"))
uiCfg := ui.NewConfig(resourceLocator, renderAPI, glui.NewShaderCollection())
uiCfg := ui.NewConfig(locator, renderAPI, glui.NewShaderCollection())
uiController := ui.NewController(uiCfg, func(w *ui.Window) {
gameui.BootstrapApplication(w, gameController)
})
Expand All @@ -37,7 +38,8 @@ func runApplication() error {
cfg.SetMaximized(false)
cfg.SetMinSize(1024, 576)
cfg.SetVSync(true)
cfg.SetIcon("resources/ui/images/icon.png")
cfg.SetIcon("ui/images/icon.png")
cfg.SetMaximized(true)
cfg.SetLocator(locator)
return glapp.Run(cfg, app.NewLayeredController(gameController, uiController))
}

0 comments on commit 3eb343b

Please sign in to comment.