-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
58 lines (48 loc) · 1.28 KB
/
main.go
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"github.com/ikuo0/game/ebiten_act/changer"
"github.com/ikuo0/game/ebiten_act/global"
"github.com/ikuo0/game/ebiten_act/keyconfig"
"github.com/ikuo0/game/ebiten_act/title"
"github.com/ikuo0/game/ebiten_act/stage"
"github.com/ikuo0/game/lib/ginput"
"github.com/ikuo0/game/lib/log"
"github.com/ikuo0/game/lib/scene"
"github.com/ikuo0/game/lib/sound"
"github.com/hajimehoshi/ebiten"
"os"
"path"
)
type Initialize struct {
}
func (me *Initialize) Main(screen *ebiten.Image) (bool) {
ginput.Initialize()
return false
}
func (me *Initialize) Dispose() {
}
func (me *Initialize) ReturnValue() (scene.Parameter) {
return []string{"title"}
}
func NewInitialize(args scene.Parameter) (scene.Interface) {
return &Initialize {}
}
var sceneChanger = changer.NewChanger(changer.SceneList {
"initialize": NewInitialize,
"title": title.New,
"keyconfig": keyconfig.New,
"stage": stage.New,
})
func update(screen *ebiten.Image) error {
sound.Update()
return sceneChanger.Play(screen)
}
func main() {
global.SetRootPath(path.Dir(os.Args[0]))
log.Start(global.Path().File(`log.txt`))
sound.Initialize(global.SampleRate, 20, 20)
log.Log("main#1")
sceneChanger.Apply([]string{"initialize"})
log.Log("main#2")
ebiten.Run(update, 800, 600, 1, "EBITEN ACT")
}