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 } }