add things
This commit is contained in:
@ -1,65 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"lab.zaar.be/thefish/alchemyst-go/ui"
|
||||
"lab.zaar.be/thefish/alchemyst-go/ui/mainwindow"
|
||||
"lab.zaar.be/thefish/alchemyst-go/util"
|
||||
blt "lab.zaar.be/thefish/bearlibterminal"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
config := util.LoadConfig()
|
||||
|
||||
//var logLevels = map[string]zerolog.Level{"debug": zerolog.DebugLevel, "info": zerolog.InfoLevel, "warn": zerolog.WarnLevel}
|
||||
//var logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}).Level(logLevels[opts.Verbosity])
|
||||
var logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339})
|
||||
|
||||
mainCtx := util.NewClientContext(config, &logger)
|
||||
|
||||
log.Info().Msg("Starting...")
|
||||
|
||||
defer mainwindow.Shutdown(mainCtx)
|
||||
|
||||
mainwindow.Init(mainCtx)
|
||||
|
||||
blt.Print(1, 1, "Hello, [font=italic]world[/font]!")
|
||||
blt.Print(1, 4, "Testing line-spacing")
|
||||
blt.PrintExt(1, 6, 5, 4, 1, "Lorem ipsum dolor sit amet")
|
||||
blt.Refresh()
|
||||
|
||||
mainLoop(mainCtx)
|
||||
}
|
||||
|
||||
func mainLoop(ctx util.ClientCtx) {
|
||||
|
||||
var exit = false
|
||||
|
||||
for !exit {
|
||||
var key, keycode = ui.ReadKey(ctx)
|
||||
if key != "" {
|
||||
blt.ClearArea(0, 3, 80, 1)
|
||||
}
|
||||
switch key {
|
||||
case "F10":
|
||||
blt.Set("window: size=100x47; font: ./resources/fonts-ttf/UbuntuMono-R.ttf, size=10;")
|
||||
case "Ctrl+q":
|
||||
fallthrough
|
||||
case "Escape":
|
||||
exit = true
|
||||
default:
|
||||
blt.Print(1, 3, "Key: "+key)
|
||||
}
|
||||
|
||||
if keycode == blt.TK_CLOSE {
|
||||
exit = true
|
||||
}
|
||||
|
||||
blt.Refresh()
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user