Beispiel #1
0
func typeProgram(a2 *goapple2.Apple2) {
	return
	lines := []string{
		"10 GR",
		"20 POKE -16302,0",
		"30 FOR Y=0 TO 47",
		"40 FOR X=0 TO 39",
		"50 COLOR=INT(RND(1)*16)",
		"60 PLOT X,Y",
		"70 NEXT",
		"80 NEXT",
		"RUN",
	}
	lines = []string{
		"10 HGR2",
		"20 FOR I = 0 to 7",
		"30 HCOLOR=7-I",
		"40 HPLOT I*10, 0 TO 191 + I*10, 191",
		"50 NEXT",
		"RUN",
	}
	for _, line := range lines {
		for _, ch := range line {
			a2.Keypress(byte(ch))
		}
		a2.Keypress(13)
	}
}
Beispiel #2
0
func ProcessEvents(events chan termbox.Event, a2 *goapple2.Apple2) bool {
	select {
	case ev := <-events:
		if ev.Type == termbox.EventKey && ev.Ch == '~' {
			return true
		}
		if ev.Type == termbox.EventKey {
			if key, err := termboxToAppleKeyboard(ev); err == nil {
				a2.Keypress(key)
			}
		}
	default:
	}

	return false
}
Beispiel #3
0
func ProcessEvents(events <-chan interface{}, a2 *goapple2.Apple2) (done bool) {
	select {
	case _event := <-events:
		switch e := _event.(type) {
		case sdl.QuitEvent:
			return true
		case sdl.KeyboardEvent:
			if e.Type == sdl.KEYDOWN {
				if e.Keysym.Sym == sdl.K_F1 {
					return true
				}
				if e.Keysym.Mod == sdl.KMOD_LCTRL && e.Keysym.Sym == sdl.K_LEFTBRACKET {
					return true
				}
				if key, err := sdlToAppleKeyboard(e.Keysym); err == nil {
					a2.Keypress(key)
				}
			}
		}
	default:
		// Nothing to do here
	}
	return false
}