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