lqs/ui.go
Arnas Udovic 10f3de5030 start
2023-12-11 19:20:16 +02:00

37 lines
503 B
Go

package main
import (
"github.com/gdamore/tcell/v2"
)
type ui struct {
screen tcell.Screen
polling bool
tevChan chan tcell.Event
}
func newUi(screen tcell.Screen) *ui {
// wtot, htot := screen.Size()
ui := &ui{
screen: screen,
polling: true,
tevChan: make(chan tcell.Event, 1000),
}
// go ui.poolEvents()
return ui
}
func (ui *ui) pollEvents() {
var ev tcell.Event
for {
ev = ui.screen.PollEvent()
if ev == nil {
ui.polling = false
return
}
ui.tevChan <- ev
}
}