Skip to content

Commit

Permalink
chore: Render now displays x/y axis values
Browse files Browse the repository at this point in the history
  • Loading branch information
minitauros committed Jul 18, 2022
1 parent 44ff62e commit 2bbec2d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion render.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package plane

import (
"fmt"
"strconv"
"strings"
)

Expand All @@ -22,8 +24,18 @@ func GetRender(s *Surface) string {
}

rowVals := make([]string, 0, len(rows))
for _, row := range rows {
for i, row := range rows {
row = append([]string{fmt.Sprintf("%01d | ", s.height-i-1)}, row...)
rowVals = append(rowVals, strings.Join(row, " "))
}

rowVals = append(rowVals, " "+strings.Repeat("-", s.width*2-1))

xLegendVals := []string{" "}
for x := 0; x < s.width; x++ {
xLegendVals = append(xLegendVals, strconv.Itoa(x))
}
rowVals = append(rowVals, strings.Join(xLegendVals, " "))

return "\n" + strings.Join(rowVals, "\n")
}

0 comments on commit 2bbec2d

Please sign in to comment.