diff --git a/cmd/doodad/commands/convert.go b/cmd/doodad/commands/convert.go index ca015ca..f840178 100644 --- a/cmd/doodad/commands/convert.go +++ b/cmd/doodad/commands/convert.go @@ -12,7 +12,7 @@ import ( "image/png" "git.kirsle.net/apps/doodle/lib/render" - doodle "git.kirsle.net/apps/doodle/pkg" + "git.kirsle.net/apps/doodle/pkg/branding" "git.kirsle.net/apps/doodle/pkg/doodads" "git.kirsle.net/apps/doodle/pkg/level" "git.kirsle.net/apps/doodle/pkg/log" @@ -146,7 +146,7 @@ func imageToDrawing(c *cli.Context, chroma render.Color, inputFiles []string, ou case extDoodad: log.Info("Output is a Doodad file (chunk size %d): %s", chunkSize, outputFile) doodad := doodads.New(chunkSize) - doodad.GameVersion = doodle.Version + doodad.GameVersion = branding.Version doodad.Title = c.String("title") if doodad.Title == "" { doodad.Title = "Converted Doodad" @@ -184,7 +184,7 @@ func imageToDrawing(c *cli.Context, chroma render.Color, inputFiles []string, ou } lvl := level.New() - lvl.GameVersion = doodle.Version + lvl.GameVersion = branding.Version lvl.Title = c.String("title") if lvl.Title == "" { lvl.Title = "Converted Level" diff --git a/cmd/doodad/main.go b/cmd/doodad/main.go index f05be02..a028068 100644 --- a/cmd/doodad/main.go +++ b/cmd/doodad/main.go @@ -9,8 +9,8 @@ import ( "time" "git.kirsle.net/apps/doodle/cmd/doodad/commands" - doodle "git.kirsle.net/apps/doodle/pkg" "git.kirsle.net/apps/doodle/pkg/balance" + "git.kirsle.net/apps/doodle/pkg/branding" "github.com/urfave/cli" ) @@ -37,7 +37,7 @@ func main() { } app.Version = fmt.Sprintf("%s build %s%s. Built on %s", - doodle.Version, + branding.Version, Build, freeLabel, BuildDate, diff --git a/cmd/doodle/main.go b/cmd/doodle/main.go index 3162344..029ed4f 100644 --- a/cmd/doodle/main.go +++ b/cmd/doodle/main.go @@ -11,6 +11,7 @@ import ( "git.kirsle.net/apps/doodle/lib/render/sdl" doodle "git.kirsle.net/apps/doodle/pkg" "git.kirsle.net/apps/doodle/pkg/balance" + "git.kirsle.net/apps/doodle/pkg/branding" "github.com/urfave/cli" _ "image/png" @@ -37,7 +38,7 @@ func main() { app := cli.NewApp() app.Name = "doodle" - app.Usage = "command line interface for Doodle" + app.Usage = fmt.Sprintf("%s - %s", branding.AppName, branding.Summary) var freeLabel string if balance.FreeVersion { @@ -45,7 +46,7 @@ func main() { } app.Version = fmt.Sprintf("%s build %s%s. Built on %s", - doodle.Version, + branding.Version, Build, freeLabel, BuildDate, @@ -74,7 +75,7 @@ func main() { // SDL engine. engine := sdl.New( - "Doodle v"+doodle.Version, + fmt.Sprintf("%s v%s", branding.AppName, branding.Version), balance.Width, balance.Height, ) diff --git a/pkg/branding/branding.go b/pkg/branding/branding.go new file mode 100644 index 0000000..ae3ff64 --- /dev/null +++ b/pkg/branding/branding.go @@ -0,0 +1,8 @@ +package branding + +// Constants for branding and version information. +const ( + AppName = "Project: Doodle" + Summary = "A drawing-based maze game" + Version = "0.0.8-alpha" +) diff --git a/pkg/doodads/fmt_readwrite.go b/pkg/doodads/fmt_readwrite.go index 5034558..ec50578 100644 --- a/pkg/doodads/fmt_readwrite.go +++ b/pkg/doodads/fmt_readwrite.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "strings" + "git.kirsle.net/apps/doodle/pkg/branding" "git.kirsle.net/apps/doodle/pkg/enum" "git.kirsle.net/apps/doodle/pkg/filesystem" "git.kirsle.net/apps/doodle/pkg/log" @@ -62,6 +63,10 @@ func (d *Doodad) WriteFile(filename string) error { filename += enum.DoodadExt } + // Set the version information. + d.Version = 1 + d.GameVersion = branding.Version + // bin, err := m.ToBinary() bin, err := d.ToJSON() if err != nil { diff --git a/pkg/doodle.go b/pkg/doodle.go index 3812a99..a64425a 100644 --- a/pkg/doodle.go +++ b/pkg/doodle.go @@ -14,9 +14,6 @@ import ( ) const ( - // Version number. - Version = "0.0.7-alpha" - // TargetFPS is the frame rate to cap the game to. TargetFPS = 1000 / 60 // 60 FPS diff --git a/pkg/editor_scene.go b/pkg/editor_scene.go index 4c1fd01..d1678d4 100644 --- a/pkg/editor_scene.go +++ b/pkg/editor_scene.go @@ -257,8 +257,7 @@ func (s *EditorScene) SaveDoodad(filename string) error { // Save it to their profile directory. filename = userdir.DoodadPath(filename) log.Info("Write Doodad: %s", filename) - err := d.WriteJSON(filename) - return err + return d.WriteFile(filename) } // Destroy the scene. diff --git a/pkg/editor_ui.go b/pkg/editor_ui.go index c7d8199..b8767a2 100644 --- a/pkg/editor_ui.go +++ b/pkg/editor_ui.go @@ -9,6 +9,7 @@ import ( "git.kirsle.net/apps/doodle/lib/render" "git.kirsle.net/apps/doodle/lib/ui" "git.kirsle.net/apps/doodle/pkg/balance" + "git.kirsle.net/apps/doodle/pkg/branding" "git.kirsle.net/apps/doodle/pkg/doodads" "git.kirsle.net/apps/doodle/pkg/enum" "git.kirsle.net/apps/doodle/pkg/level" @@ -564,7 +565,7 @@ func (u *EditorUI) SetupStatusBar(d *Doodle) *ui.Frame { shareware = " (shareware)" } extraLabel := ui.NewLabel(ui.Label{ - Text: "Doodle v" + Version + shareware, + Text: fmt.Sprintf("%s v%s%s", branding.AppName, branding.Version, shareware), Font: balance.StatusFont, }) extraLabel.Configure(ui.Config{ diff --git a/pkg/guitest_scene.go b/pkg/guitest_scene.go index 09afafb..0df3865 100644 --- a/pkg/guitest_scene.go +++ b/pkg/guitest_scene.go @@ -7,6 +7,7 @@ import ( "git.kirsle.net/apps/doodle/lib/render" "git.kirsle.net/apps/doodle/lib/ui" "git.kirsle.net/apps/doodle/pkg/balance" + "git.kirsle.net/apps/doodle/pkg/branding" "git.kirsle.net/apps/doodle/pkg/log" ) @@ -258,7 +259,7 @@ func (s *GUITestScene) Draw(d *Doodle) error { d.Engine.Clear(render.White) label := ui.NewLabel(ui.Label{ - Text: "GUITest Doodle v" + Version, + Text: fmt.Sprintf("GUITest %s v%s", branding.AppName, branding.Version), Font: render.Text{ Size: 26, Color: render.Pink, diff --git a/pkg/level/fmt_readwrite.go b/pkg/level/fmt_readwrite.go index 8c4ab72..7c33719 100644 --- a/pkg/level/fmt_readwrite.go +++ b/pkg/level/fmt_readwrite.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "strings" + "git.kirsle.net/apps/doodle/pkg/branding" "git.kirsle.net/apps/doodle/pkg/enum" "git.kirsle.net/apps/doodle/pkg/filesystem" "git.kirsle.net/apps/doodle/pkg/log" @@ -47,6 +48,10 @@ func (m *Level) WriteFile(filename string) error { filename += enum.LevelExt } + // Set the version information. + m.Version = 1 + m.GameVersion = branding.Version + // bin, err := m.ToBinary() bin, err := m.ToJSON() if err != nil { diff --git a/pkg/main_scene.go b/pkg/main_scene.go index 4b0e78d..81840ae 100644 --- a/pkg/main_scene.go +++ b/pkg/main_scene.go @@ -5,6 +5,7 @@ import ( "git.kirsle.net/apps/doodle/lib/render" "git.kirsle.net/apps/doodle/lib/ui" "git.kirsle.net/apps/doodle/pkg/balance" + "git.kirsle.net/apps/doodle/pkg/branding" ) // MainScene implements the main menu of Doodle. @@ -67,7 +68,7 @@ func (s *MainScene) Draw(d *Doodle) error { d.Engine.Clear(render.White) label := ui.NewLabel(ui.Label{ - Text: "Doodle v" + Version, + Text: branding.AppName, Font: render.Text{ Size: 26, Color: render.Pink,