Doodad CLI Tool Features; Write Lock and Hidden
* The `doodad` CLI tool got a lot of new commands: * `doodad show` to verbosely print details about Levels and Doodads. * `edit-level` and `edit-doodad` to update details about Levels and Doodads, such as their Title, Author, page type and size, etc. * Doodads gain a `Hidden bool` that hides them from the palette in Editor Mode. The player character (Blue Azulian) is Hidden. * Add some boolProps to the balance/ package and made a dynamic system to easily configure these with the in-game dev console. * Command: `boolProp list` returns available balance.boolProps * `boolProp <name>` returns the current value. * `boolProp <name> <true or false>` sets the value. * The new boolProps are: * showAllDoodads: enable Hidden doodads on the palette UI (NOTE: reload the editor to take effect) * writeLockOverride: edit files that are write locked anyway * prettyJSON: pretty-format the JSON files saved by the game.
This commit is contained in:
parent
7f4640b727
commit
5f37193512
31
functions.go
31
functions.go
|
@ -1,5 +1,36 @@
|
|||
package render
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var regexpResolution = regexp.MustCompile(`^(\d+)x(\d+)$`)
|
||||
|
||||
// ParseResolution turns a resolution string like "1024x768" and returns the
|
||||
// width and height values.
|
||||
func ParseResolution(resi string) (int, int, error) {
|
||||
m := regexpResolution.FindStringSubmatch(resi)
|
||||
if m == nil {
|
||||
return 0, 0, fmt.Errorf("invalid resolution format, should be %s",
|
||||
regexpResolution.String(),
|
||||
)
|
||||
}
|
||||
|
||||
width, err := strconv.Atoi(m[1])
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
|
||||
height, err := strconv.Atoi(m[2])
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
|
||||
return width, height, nil
|
||||
}
|
||||
|
||||
// TrimBox helps with Engine.Copy() to trim a destination box so that it
|
||||
// won't overflow with the parent container.
|
||||
func TrimBox(src, dst *Rect, p Point, S Rect, thickness int32) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user