-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
68 lines (56 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
59
60
61
62
63
64
65
66
67
68
package main
import (
"log"
"os"
"github.com/hajimehoshi/ebiten/v2"
"github.com/urfave/cli/v2"
"github.com/FukuroNoOShiri/psyche/game"
"github.com/FukuroNoOShiri/psyche/intro"
"github.com/FukuroNoOShiri/psyche/play"
"github.com/FukuroNoOShiri/psyche/splash"
"github.com/FukuroNoOShiri/psyche/title"
)
func main() {
app := &cli.App{
Name: "psyche",
Usage: "Play Psyché",
Action: run,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "skip-to",
Usage: "skips to specific scene",
},
&cli.BoolFlag{
Name: "full-screen",
Usage: "starts in full screen mode",
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
func run(ctx *cli.Context) error {
ebiten.SetWindowSize(1280, 720)
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
ebiten.SetWindowTitle("Psyché")
if ctx.Bool("full-screen") {
ebiten.SetFullscreen(true)
}
intro.Scene.Next = play.Scene
title.Scene.Next = intro.Scene
splash.Scene.Next = title.Scene
var firstScene game.Scene = splash.Scene
switch ctx.String("skip-to") {
case "play":
firstScene = play.Scene
case "title":
firstScene = title.Scene
case "intro":
firstScene = intro.Scene
}
if err := game.SetScene(firstScene); err != nil {
return err
}
return ebiten.RunGame(game.Game)
}