Skip to content

Commit

Permalink
detach fsys from NewGame()
Browse files Browse the repository at this point in the history
preparing for web version
  • Loading branch information
hndada committed Nov 28, 2022
1 parent 508afa4 commit 34cb1aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cmd/gosu/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ func main() {
if err != nil {
log.Fatal(err)
}
g := gosu.NewGame(os.DirFS(dir))
gosu.Load(os.DirFS(dir))
g := gosu.NewGame()
if err := ebiten.RunGame(g); err != nil {
panic(err)
}
Expand Down
8 changes: 4 additions & 4 deletions game.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
)

// Todo: tidy NewSettings() and *Settings.Load()?
func load(fsys fs.FS) {
func Load(fsys fs.FS) {
data, err := fs.ReadFile(fsys, "settings.toml")
if err != nil {
fmt.Println("no settings.toml detected")
Expand Down Expand Up @@ -79,8 +79,8 @@ func load(fsys fs.FS) {
}
}

func NewGame(fsys fs.FS) *game {
load(fsys)
func NewGame() *game {
// load(fsys)
// dir, err := os.Getwd()
// if err != nil {
// log.Fatal(err)
Expand All @@ -93,7 +93,7 @@ func NewGame(fsys fs.FS) *game {
// panic(err)
// }
g := &game{
FS: fsys,
// FS: fsys,
Scene: nil,
choose: choose.NewScene(),
}
Expand Down

0 comments on commit 34cb1aa

Please sign in to comment.