feat: initial game screen and input window defs
This commit is contained in:
parent
331c625220
commit
024eb0c2bb
6 changed files with 156 additions and 74 deletions
19
utils/helper/incremental_print.go
Normal file
19
utils/helper/incremental_print.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package helper
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
. "github.com/gbin/goncurses"
|
||||
)
|
||||
|
||||
func IncrementalPrint(scr *Window, text string, from_y int, from_x int, interval_millis int) {
|
||||
for i:=0; i < len(text); i++ {
|
||||
ch := string([]rune(text)[i])
|
||||
_, mx := scr.MaxYX()
|
||||
cy := i / mx + 2 + from_y
|
||||
cx := i % mx + 2
|
||||
scr.MovePrint(cy, cx, ch)
|
||||
time.Sleep( time.Duration(1000 / len(text)) * time.Millisecond)
|
||||
scr.Refresh()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue