Add loading screen

This commit is contained in:
erroneousboat 2018-03-30 15:55:29 +02:00
parent 29201a8bb2
commit 0197300b18
2 changed files with 24 additions and 0 deletions

View File

@ -37,6 +37,9 @@ func CreateAppContext(flgConfig string, flgDebug bool) (*AppContext, error) {
}()
}
// Loading screen
views.Loading()
// Load config
config, err := config.NewConfig(flgConfig)
if err != nil {

21
views/load.go Normal file
View File

@ -0,0 +1,21 @@
package views
import (
termbox "github.com/nsf/termbox-go"
)
func Loading() {
const loading string = "LOADING"
w, h := termbox.Size()
termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)
offset := (w / 2) - (len(loading) / 2)
y := h / 2
for x := 0; x < len(loading); x++ {
termbox.SetCell(offset+x, y, rune(loading[x]), termbox.ColorDefault, termbox.ColorDefault)
}
termbox.Flush()
}