diff options
author | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-10-23 15:27:14 +0300 |
---|---|---|
committer | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-10-23 15:27:14 +0300 |
commit | 024eb0c2bbbc2f30fb8e2403ef22fabc27910acd (patch) | |
tree | 4c738ea4d781fadaa8db892e315ec7e20746deaf /utils/helper/incremental_print.go | |
parent | 331c625220d4db0efabb0709cc64849eb11d5422 (diff) | |
download | rulmarc-024eb0c2bbbc2f30fb8e2403ef22fabc27910acd.tar.gz rulmarc-024eb0c2bbbc2f30fb8e2403ef22fabc27910acd.tar.bz2 rulmarc-024eb0c2bbbc2f30fb8e2403ef22fabc27910acd.zip |
feat: initial game screen and input window defs
Diffstat (limited to 'utils/helper/incremental_print.go')
-rw-r--r-- | utils/helper/incremental_print.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/helper/incremental_print.go b/utils/helper/incremental_print.go new file mode 100644 index 0000000..0b4fc4f --- /dev/null +++ b/utils/helper/incremental_print.go @@ -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() + } +} |