Add function wrappedText
This commit is contained in:
parent
593900c788
commit
357757e479
17
Main.go
17
Main.go
|
@ -67,6 +67,23 @@ func centeredText(s string, x, y, width int, scr tcell.Screen, style tcell.Style
|
|||
}
|
||||
}
|
||||
|
||||
func wrappedText(s string, scr tcell.Screen, style tcell.Style) {
|
||||
x := 0
|
||||
y := 0
|
||||
w, h := scr.Size()
|
||||
for _, char := range s {
|
||||
if x >= w {
|
||||
if y >= h {
|
||||
break;
|
||||
}
|
||||
x = 0
|
||||
y++
|
||||
}
|
||||
scr.SetContent(x, y, char, nil, style)
|
||||
x++
|
||||
}
|
||||
}
|
||||
|
||||
func drawMonth(m time.Month, x, y int) {
|
||||
centeredText(months[m], x, y, monthWidth, wall, defStyle)
|
||||
|
||||
|
|
Loading…
Reference in a new issue