64 lines
1.4 KiB
Go
64 lines
1.4 KiB
Go
package main
|
|
|
|
import "log"
|
|
import (
|
|
blt "bearlibterminal"
|
|
"ui"
|
|
"util"
|
|
)
|
|
|
|
var version = "0.0.0"
|
|
|
|
func main() {
|
|
defer shutdown()
|
|
log.Println("Starting...")
|
|
|
|
config := util.LoadConfig()
|
|
|
|
blt.Open()
|
|
//blt.Set("window: size=80x25, title="+config.Title+" v"+string(version)+"; font: ./fonts/Monaco-Linux.ttf, size=10")
|
|
blt.Set("window: size=100x47, title="+config.Title+" v"+string(version)+"; font: ./resources/fonts-bitmap/ibmnew8x12.png, size=8x12;")
|
|
|
|
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()
|
|
}
|
|
|
|
func mainLoop () {
|
|
|
|
var exit = false
|
|
|
|
for !exit {
|
|
var key, keycode = ui.ReadKey()
|
|
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()
|
|
}
|
|
|
|
}
|
|
|
|
func shutdown() {
|
|
|
|
log.Println("Here we must save state, but it is not done yet")
|
|
log.Println("Exiting application...")
|
|
blt.Close()
|
|
} |