Instead of returning a mess of struct we need to walk, why not just output the line? This will be easier on memory, and easier on me.
@@ -0,0 +1,45 @@
+package door
+
+// This was the way I did it in door++...
+// Don't
+/*
+type RenderOutput struct {
+ Color string
+ Pos int
+ Len int
+}
+type Render struct {
+ Text string
+ Outputs []RenderOutput
+*/
+type Line struct {
+ DefaultColor string
+ RenderF func(string) string
+ UpdateF func() string
+func (l *Line) Update() bool {
+ if l.UpdateF == nil {
+ return false
+ }
+ NewText := l.UpdateF()
+ if NewText != l.Text {
+ l.Text = NewText
+ return true
+func (l *Line) Output(d *Door) {
+ if l.RenderF == nil {
+ output := l.DefaultColor + l.Text
+ d.Write(output)
+ } else {
+ output := l.RenderF(l.Text)