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-06-17 02:59:23 +00:00
|
|
|
"git.kirsle.net/apps/doodle"
|
2018-07-22 00:12:22 +00:00
|
|
|
"git.kirsle.net/apps/doodle/render/sdl"
|
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() {
|
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,
|
|
|
|
800,
|
|
|
|
600,
|
|
|
|
)
|
|
|
|
|
|
|
|
app := doodle.New(debug, engine)
|
2018-06-17 17:29:57 +00:00
|
|
|
if filename != "" {
|
2018-06-21 02:00:46 +00:00
|
|
|
if edit {
|
|
|
|
app.EditLevel(filename)
|
|
|
|
} 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
|
|
|
}
|