Esempio n. 1
0
// Process calls the Process method on all controls.
func (form *Form) Process() {
	_, keyInfo := console.GetKeyEX()
	frameInfo := &FrameInfo{keyInfo}

	form.forAllControls(func(control Control) {
		control.Process(frameInfo)
	})

	form.handleFocusFlags()

	if !form.isVisualValid {
		form.redraw()
	}
}
Esempio n. 2
0
func main() {
	numCols := 80
	numRows := 25

	console.SetTitle("lol I set the title too")
	console.ClearScreen(numCols, numRows)
	x, y := 0, 0
	console.MoveTo(x, y)
	sprite := "O"
	fmt.Print(sprite)
	console.MoveTo(numCols-1, numRows-1)
	_, info := console.GetScreenBufferInfo()

	for {
		isHit, event := console.GetKeyEX()
		if isHit && event.IsSpecial {
			console.MoveTo(x, y)
			fmt.Print(" ")

			switch event.SpecialChar {
			case console.ScArrowUp:
				y--
			case console.ScArrowLeft:
				x--
			case console.ScArrowDown:
				y++
			case console.ScArrowRight:
				x++
			case console.ScEsc:
				return
			}

			console.MoveTo(x, y)

			console.SetCharacterProperties(console.ChFgBlue | console.ChBgYellow | console.ChUnderline)
			fmt.Print(sprite)
			console.SetCharacterProperties(info.CharacterColor)

			console.MoveTo(numCols-1, numRows-1)
		}
	}
}