Working on v2
This commit is contained in:
48
old/ui_loop_windows.go
Normal file
48
old/ui_loop_windows.go
Normal file
@@ -0,0 +1,48 @@
|
||||
// +build windows
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
termbox "github.com/nsf/termbox-go"
|
||||
)
|
||||
|
||||
func uiLoop() int {
|
||||
err := termbox.Init()
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return 1
|
||||
}
|
||||
termbox.SetOutputMode(termbox.Output256)
|
||||
app.BuildScreens()
|
||||
displayScreen := app.screens[ScreenMain]
|
||||
bundle := Bundle{}
|
||||
bundle.setValue(MainBundleListKey, MainBundleListRecent)
|
||||
displayScreen.initialize(bundle)
|
||||
app.layoutAndDrawScreen(displayScreen)
|
||||
eventChan := make(chan termbox.Event)
|
||||
go readUserInput(eventChan)
|
||||
go checkForUpdate(eventChan)
|
||||
for {
|
||||
event := <-eventChan
|
||||
if event.Type == termbox.EventKey {
|
||||
if event.Key == termbox.KeyCtrlC {
|
||||
break
|
||||
}
|
||||
newScreenIndex := displayScreen.handleKeyEvent(event)
|
||||
if newScreenIndex < len(app.screens) {
|
||||
displayScreen = app.screens[newScreenIndex]
|
||||
app.layoutAndDrawScreen(displayScreen)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if event.Type == termbox.EventResize {
|
||||
displayScreen.initialize(nil)
|
||||
app.layoutAndDrawScreen(displayScreen)
|
||||
}
|
||||
}
|
||||
termbox.Close()
|
||||
// Any wrap up should be done here...
|
||||
return 0
|
||||
}
|
||||
Reference in New Issue
Block a user