aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-17 23:59:44 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-17 23:59:44 +0200
commite31c05cc4c784d0824315098c9066711c9c6d66e (patch)
tree2dfba1cfa7104ad88b6679d9405a08a8691d9c62
parentd29b92edd06b39aa203a6328a531a1c703aabc91 (diff)
Add orientation flip
-rw-r--r--robo.go5
-rw-r--r--units.go8
2 files changed, 11 insertions, 2 deletions
diff --git a/robo.go b/robo.go
index 10b3d25..cc05226 100644
--- a/robo.go
+++ b/robo.go
@@ -172,7 +172,10 @@ const (
Landscape
)
-func (o Orientation) Orientation(c *bufio.Writer) { send(c, "FN", o) }
+func (o Orientation) Orientation(c *bufio.Writer) {
+ orientation = o
+ send(c, "FN", o)
+}
type LineStyle int
diff --git a/units.go b/units.go
index 9561749..81e48c7 100644
--- a/units.go
+++ b/units.go
@@ -32,8 +32,14 @@ type Point struct {
X, Y Unit
}
+var orientation = Portrait
+
func (p Point) String() string {
- return fmt.Sprintf("%v,%v", p.X, p.Y)
+ if orientation == Portrait {
+ return fmt.Sprintf("%v,%v", p.X, p.Y)
+ } else {
+ return fmt.Sprintf("%v,%v", p.Y, p.X)
+ }
}
func parsePoint(s string) (p Point) {