moved event and draw loops to Start method

This commit is contained in:
milarin 2023-04-24 14:16:12 +02:00
parent 0af1f0fde6
commit e0874e6e4c

View File

@ -41,9 +41,6 @@ func NewScreen(root View) (*Screen, error) {
s.KeyPressed = CloseOnCtrlC(s) s.KeyPressed = CloseOnCtrlC(s)
go s.eventloop()
go s.drawloop()
return s, nil return s, nil
} }
@ -57,6 +54,10 @@ func (s *Screen) Start() error {
defer close(s.redrawCh) defer close(s.redrawCh)
s.scr.EnableMouse() s.scr.EnableMouse()
go s.eventloop()
go s.drawloop()
s.started = true s.started = true
return <-s.stopCh return <-s.stopCh
} }