Update changelog for v0.4.0-alpha

This commit is contained in:
Noah 2020-11-20 23:35:37 -08:00
parent 8eb3ab51d3
commit 9529980ee4
5 changed files with 84 additions and 4 deletions

View File

@ -1,5 +1,26 @@
# Changes
## v0.4.0-alpha
This update brings improvements to the editor; you can now fully draw all the
graphics for a custom doodad using the in-app tools!
A key difference between a Level and a Doodad is that doodads have **Layers**
where they keep multiple frames of animation or state. The editor tool now
supports working with these extra layers.
Other new features:
* The **Guidebook** has been updated with tons of good info and screenshots of
the game's features. Press `F1` in-game to open the guidebook, or check it
online at https://www.sketchymaze.com/guidebook/
* **Layer Selection Window for Doodads:** when you're editing a Doodad drawing,
a "Lyr." button is added to the toolbar to access the Layers window.
* **Global UI popup modals:** when you're about to close a level with unsaved
changes, you get an Ok/Cancel prompt confirming if you want to do that.
Hitting the Escape key will ask you before just exiting the program. Alert
boxes are supported too, and an `alert` command added to the developer console.
## v0.3.0-alpha
This update introduces the player character to the game. He doesn't have a name;

View File

@ -3,10 +3,14 @@ package doodle
import (
"errors"
"fmt"
"os"
"path/filepath"
"strconv"
"git.kirsle.net/apps/doodle/pkg/balance"
"git.kirsle.net/apps/doodle/pkg/bindata"
"git.kirsle.net/apps/doodle/pkg/enum"
"git.kirsle.net/apps/doodle/pkg/log"
"git.kirsle.net/apps/doodle/pkg/modal"
"github.com/robertkrimen/otto"
)
@ -69,6 +73,9 @@ func (c Command) Run(d *Doodle) error {
d.shell.Text = "$ "
case "boolProp":
return c.BoolProp(d)
case "extract-bindata":
// Undocumented command to extract the binary of its assets.
return c.ExtractBindata(d, c.ArgsLiteral)
default:
return c.Default()
}
@ -88,6 +95,47 @@ func (c Command) Close(d *Doodle) error {
return nil
}
// ExtractBindata dumps the app's embedded bindata to the filesystem.
func (c Command) ExtractBindata(d *Doodle, path string) error {
if len(path) == 0 || path[0] != '/' {
d.Flash("Required: an absolute path to a directory to extract to.")
return nil
}
err := os.MkdirAll(path, 0755)
if err != nil {
d.Flash("MkdirAll: %s", err)
return err
}
for _, filename := range bindata.AssetNames() {
outfile := filepath.Join(path, filename)
log.Info("Extracting bindata: %s to: %s", filename, outfile)
data, err := bindata.Asset(filename)
if err != nil {
d.Flash("error on file %s: %s", filename, err)
continue
}
// Fill out the directory path.
if _, err := os.Stat(filepath.Dir(outfile)); os.IsNotExist(err) {
os.MkdirAll(filepath.Dir(outfile), 0755)
}
fh, err := os.Create(outfile)
if err != nil {
d.Flash("error writing file %s: %s", outfile, err)
continue
}
fh.Write(data)
fh.Close()
}
d.Flash("Bindata extracted to %s", path)
return nil
}
// Help prints the help info.
func (c Command) Help(d *Doodle) error {
if len(c.Args) == 0 {

View File

@ -146,8 +146,8 @@ func (d *Doodle) Run() error {
}
if keybind.Help(ev) {
// TODO: launch the guidebook.
native.OpenURL(balance.GuidebookPath)
// Launch the local guidebook
native.OpenLocalURL(balance.GuidebookPath)
} else if keybind.DebugOverlay(ev) {
DebugOverlay = !DebugOverlay
} else if keybind.DebugCollision(ev) {

View File

@ -654,8 +654,7 @@ func (u *EditorUI) SetupMenuBar(d *Doodle) *ui.MenuBar {
// Help menu
helpMenu := menu.AddMenu("Help")
helpMenu.AddItemAccel("User Manual", "F1", func() {
// TODO: launch the guidebook.
native.OpenURL(balance.GuidebookPath)
native.OpenLocalURL(balance.GuidebookPath)
})
helpMenu.AddItem("About", func() {
if u.aboutWindow == nil {

View File

@ -3,7 +3,9 @@
package native
import (
"fmt"
"os/exec"
"path/filepath"
"runtime"
"git.kirsle.net/apps/doodle/pkg/log"
@ -26,6 +28,16 @@ func OpenURL(url string) {
}
}
// OpenLocalURL opens a web browser to a local HTML path.
// It converts a relative path like "guidebook/index.html" to its absolute
// filesystem location.
func OpenLocalURL(path string) {
abs, _ := filepath.Abs(path)
url := fmt.Sprintf("file:///%s", abs)
fmt.Printf("Open Local URL: %s\n", url)
OpenURL(url)
}
func windowsOpenURL(url string) {
_, err := exec.Command("start", url).Output()
if err != nil {