doodle/cmd/doodle/main.go

44 lines
648 B
Go
Raw Normal View History

2017-10-27 01:03:11 +00:00
package main
import (
"flag"
"runtime"
2017-10-27 01:03:11 +00:00
"git.kirsle.net/apps/doodle"
2017-10-27 01:03:11 +00:00
)
// Build number is the git commit hash.
var Build string
// Command line args
var (
debug bool
2018-06-21 02:00:46 +00:00
edit 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.")
2017-10-27 01:03:11 +00:00
}
func main() {
runtime.LockOSThread()
2017-10-27 01:03:11 +00:00
flag.Parse()
args := flag.Args()
var filename string
if len(args) > 0 {
filename = args[0]
}
2017-10-27 01:03:11 +00:00
app := doodle.New(debug)
if filename != "" {
2018-06-21 02:00:46 +00:00
if edit {
app.EditLevel(filename)
} else {
app.PlayLevel(filename)
}
}
app.Run()
2017-10-27 01:03:11 +00:00
}