doodle/cmd/doodle/main.go

60 lines
1018 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"
"git.kirsle.net/apps/doodle/balance"
"git.kirsle.net/apps/doodle/render/sdl"
Wallpapers and Bounded Levels Implement the Wallpaper system into the levels and the concept of Bounded and Unbounded levels. The first wallpaper image is notepad.png which looks like standard ruled notebook paper. On bounded levels, the top/left edges of the page look as you would expect and the blue lines tile indefinitely in the positive directions. On unbounded levels, you only get the repeating blue lines but not the edge pieces. A wallpaper is just a rectangular image file. The image is divided into four equal quadrants to be the Corner, Top, Left and Repeat textures for the wallpaper. The Repeat texture is ALWAYS used and fills all the empty space behind the drawing. (Doodads draw with blank canvases as before because only levels have wallpapers!) Levels have four options of a "Page Type": - Unbounded (default, infinite space) - NoNegativeSpace (has a top left edge but can grow infinitely) - Bounded (has a top left edge and bounded size) - Bordered (bounded with bordered texture; NOT IMPLEMENTED!) The scrollable viewport of a Canvas will respect the wallpaper and page type settings of a Level loaded into it. That is, if the level has a top left edge (not Unbounded) you can NOT scroll to see negative coordinates below (0,0) -- and if the level has a max dimension set, you can't scroll to see pixels outside those dimensions. The Canvas property NoLimitScroll=true will override the scroll locking and let you see outside the bounds, for debugging. - Default map settings for New Level are now: - Page Type: NoNegativeSpace - Wallpaper: notepad.png (default) - MaxWidth: 2550 (8.5" * 300 ppi) - MaxHeight: 3300 ( 11" * 300 ppi)
2018-10-28 05:22:13 +00:00
_ "image/png"
2017-10-27 01:03:11 +00:00
)
// Build number is the git commit hash.
var Build string
// Command line args
var (
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.")
flag.BoolVar(&guitest, "guitest", false, "Enter the GUI Test scene.")
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]
}
// SDL engine.
engine := sdl.New(
"Doodle v"+doodle.Version,
balance.Width,
balance.Height,
)
app := doodle.New(debug, engine)
app.SetupEngine()
if guitest {
app.Goto(&doodle.GUITestScene{})
} else if filename != "" {
2018-06-21 02:00:46 +00:00
if edit {
app.EditFile(filename)
2018-06-21 02:00:46 +00:00
} else {
app.PlayLevel(filename)
}
}
app.Run()
2017-10-27 01:03:11 +00:00
}