mirror of
https://github.com/br0xen/termbox-screen.git
synced 2024-11-22 05:33:13 +00:00
AddAndInitializeScreen
This commit is contained in:
parent
9bfd6c5c60
commit
e9dc04fa31
@ -3,7 +3,6 @@ package termboxScreen
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -66,6 +65,13 @@ func (m *Manager) AddScreen(s Screen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddAndInitializeScreen adds a screen just like AddScreen, but then
|
||||||
|
// calls it's 'Initialize' function with a blank bundle
|
||||||
|
func (m *Manager) AddAndInitializeScreen(s Screen) error {
|
||||||
|
m.AddScreen(s)
|
||||||
|
return m.InitializeScreen(s.Id(), Bundle{})
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Manager) GetScreens() map[int]Screen {
|
func (m *Manager) GetScreens() map[int]Screen {
|
||||||
return m.screens
|
return m.screens
|
||||||
}
|
}
|
||||||
@ -157,7 +163,6 @@ func (m *Manager) SetRefreshRate(t time.Duration) {
|
|||||||
func (m *Manager) pollRefreshEvents() {
|
func (m *Manager) pollRefreshEvents() {
|
||||||
if m.refreshRate > time.Microsecond {
|
if m.refreshRate > time.Microsecond {
|
||||||
for m.running {
|
for m.running {
|
||||||
ioutil.WriteFile("./log", []byte(time.Now().Format(time.RFC3339)), 0644)
|
|
||||||
time.Sleep(m.refreshRate)
|
time.Sleep(m.refreshRate)
|
||||||
m.SendNoneEvent()
|
m.SendNoneEvent()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user