2017-10-27 01:03:11 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
2017-10-27 02:26:54 +00:00
|
|
|
"runtime"
|
2017-10-27 01:03:11 +00:00
|
|
|
|
2018-10-28 05:22:13 +00:00
|
|
|
_ "image/png"
|
2019-04-10 00:35:44 +00:00
|
|
|
|
|
|
|
"git.kirsle.net/apps/doodle/lib/render/sdl"
|
|
|
|
doodle "git.kirsle.net/apps/doodle/pkg"
|
|
|
|
"git.kirsle.net/apps/doodle/pkg/balance"
|
2017-10-27 01:03:11 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Build number is the git commit hash.
|
|
|
|
var Build string
|
|
|
|
|
|
|
|
// Command line args
|
|
|
|
var (
|
2018-10-08 17:38:49 +00:00
|
|
|
debug bool
|
|
|
|
edit bool
|
|
|
|
guitest bool
|
2017-10-27 01:03:11 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
flag.BoolVar(&debug, "debug", false, "Debug mode")
|
2018-06-21 02:00:46 +00:00
|
|
|
flag.BoolVar(&edit, "edit", false, "Edit the map given on the command line. Default is to play the map.")
|
2018-10-08 17:38:49 +00:00
|
|
|
flag.BoolVar(&guitest, "guitest", false, "Enter the GUI Test scene.")
|
2017-10-27 01:03:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2017-10-27 02:26:54 +00:00
|
|
|
runtime.LockOSThread()
|
2017-10-27 01:03:11 +00:00
|
|
|
flag.Parse()
|
|
|
|
|
2018-06-17 17:29:57 +00:00
|
|
|
args := flag.Args()
|
|
|
|
var filename string
|
|
|
|
if len(args) > 0 {
|
|
|
|
filename = args[0]
|
|
|
|
}
|
|
|
|
|
2018-07-22 00:12:22 +00:00
|
|
|
// SDL engine.
|
|
|
|
engine := sdl.New(
|
|
|
|
"Doodle v"+doodle.Version,
|
2018-10-08 17:38:49 +00:00
|
|
|
balance.Width,
|
|
|
|
balance.Height,
|
2018-07-22 00:12:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
app := doodle.New(debug, engine)
|
2018-08-11 00:19:47 +00:00
|
|
|
app.SetupEngine()
|
2018-10-08 17:38:49 +00:00
|
|
|
if guitest {
|
|
|
|
app.Goto(&doodle.GUITestScene{})
|
|
|
|
} else if filename != "" {
|
2018-06-21 02:00:46 +00:00
|
|
|
if edit {
|
2018-10-02 17:11:38 +00:00
|
|
|
app.EditFile(filename)
|
2018-06-21 02:00:46 +00:00
|
|
|
} else {
|
|
|
|
app.PlayLevel(filename)
|
|
|
|
}
|
2018-06-17 17:29:57 +00:00
|
|
|
}
|
2017-10-27 02:26:54 +00:00
|
|
|
app.Run()
|
2017-10-27 01:03:11 +00:00
|
|
|
}
|