Improve non-stdin case
This commit is contained in:
parent
1247d58912
commit
5e718cdbe2
|
@ -22,11 +22,13 @@ type ansiConsoleFrontend struct {
|
||||||
keyChannel chan uint8
|
keyChannel chan uint8
|
||||||
extraLineFeeds chan int
|
extraLineFeeds chan int
|
||||||
textUpdated bool
|
textUpdated bool
|
||||||
|
stdinKeyboard bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newAnsiConsoleFrontend(a *Apple2) *ansiConsoleFrontend {
|
func newAnsiConsoleFrontend(a *Apple2, stdinKeyboard bool) *ansiConsoleFrontend {
|
||||||
var fe ansiConsoleFrontend
|
var fe ansiConsoleFrontend
|
||||||
fe.apple2 = a
|
fe.apple2 = a
|
||||||
|
fe.stdinKeyboard = stdinKeyboard
|
||||||
fe.subscribeToTextPages()
|
fe.subscribeToTextPages()
|
||||||
return &fe
|
return &fe
|
||||||
}
|
}
|
||||||
|
@ -121,8 +123,9 @@ func (fe *ansiConsoleFrontend) textModeGoRoutine() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(strings.Repeat("#", 44))
|
fmt.Println(strings.Repeat("#", 44))
|
||||||
fmt.Print("\033[KLine: ")
|
if fe.stdinKeyboard {
|
||||||
|
fmt.Print("\033[KLine: ")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
time.Sleep(refreshDelayMs * time.Millisecond)
|
time.Sleep(refreshDelayMs * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,10 @@ func (a *Apple2) AddDisk2(diskRomFile string, diskImage string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run starts the Apple2 emulation
|
// Run starts the Apple2 emulation
|
||||||
func (a *Apple2) Run(log bool, consoleKeyboard bool) {
|
func (a *Apple2) Run(log bool, stdinKeyboard bool) {
|
||||||
// Init frontend
|
// Init frontend
|
||||||
fe := newAnsiConsoleFrontend(a)
|
fe := newAnsiConsoleFrontend(a, stdinKeyboard)
|
||||||
if consoleKeyboard {
|
if stdinKeyboard {
|
||||||
a.io.setKeyboardProvider(fe)
|
a.io.setKeyboardProvider(fe)
|
||||||
}
|
}
|
||||||
if !log {
|
if !log {
|
||||||
|
|
Loading…
Reference in New Issue