Noah Petherbridge
27fafdc96d
First pass at a level storage format to save and restore maps. To save a map: press F12. It takes a screenshot PNG into the screenshots/ folder and outputs a map JSON in the working directory. To restore a map: "go run cmd/doodle/main.go map.json"
38 lines
474 B
Go
38 lines
474 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"runtime"
|
|
|
|
"git.kirsle.net/apps/doodle"
|
|
)
|
|
|
|
// Build number is the git commit hash.
|
|
var Build string
|
|
|
|
// Command line args
|
|
var (
|
|
debug bool
|
|
)
|
|
|
|
func init() {
|
|
flag.BoolVar(&debug, "debug", false, "Debug mode")
|
|
}
|
|
|
|
func main() {
|
|
runtime.LockOSThread()
|
|
flag.Parse()
|
|
|
|
args := flag.Args()
|
|
var filename string
|
|
if len(args) > 0 {
|
|
filename = args[0]
|
|
}
|
|
|
|
app := doodle.New(debug)
|
|
if filename != "" {
|
|
app.LoadLevel(filename)
|
|
}
|
|
app.Run()
|
|
}
|