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"
14 lines
201 B
Go
14 lines
201 B
Go
package types
|
|
|
|
import "fmt"
|
|
|
|
// Point is a 2D point in space.
|
|
type Point struct {
|
|
X int32 `json:"x"`
|
|
Y int32 `json:"y"`
|
|
}
|
|
|
|
func (p Point) String() string {
|
|
return fmt.Sprintf("(%d,%d)", p.X, p.Y)
|
|
}
|