From e31c05cc4c784d0824315098c9066711c9c6d66e Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 17 May 2015 23:59:44 +0200 Subject: Add orientation flip --- robo.go | 5 ++++- units.go | 8 +++++++- 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) { -- cgit v1.2.3