Beispiel #1
0
func test_2() {
	const pauseSec time.Duration = 5
	ansiterm.ClearPage()
	ansiterm.MoveToRC(9, 20)
	fmt.Printf("In a few seconds program will print 1000 X chars")
	ansiterm.MoveToRC(10, 20)
	fmt.Printf("This is slowed by forcing a 10 ms sleep per loop")
	pause(pauseSec)
	ansiterm.ClearPage()
	for i := 0; i < 1000; i++ {
		row := int(rand.Int31n(25))
		col := int(rand.Int31n(80))
		ansiterm.MoveToRC(row, col)
		time.Sleep(time.Duration(0.01 * float64(time.Second)))
		fmt.Printf("X")
	}
	pause(pauseSec)
	ansiterm.ClearPage()
	ansiterm.MoveToRC(9, 20)
	fmt.Printf("In a few seconds program will print 1000 X chars")
	ansiterm.MoveToRC(10, 20)
	fmt.Printf("using the same program at FULL speed - don't blink...")
	pause(pauseSec)
	ansiterm.ClearPage()
	for i := 0; i < 1000; i++ {
		row := int(rand.Int31n(25))
		col := int(rand.Int31n(80))
		ansiterm.MoveToRC(row, col)
		fmt.Printf("X")
	}
	pause(pauseSec)
	ansiterm.ClearPage()
}
Beispiel #2
0
func main() {
	ansiterm.ResetTerm(0)
	ansiterm.ClearPage()
	initFields()
	startSensors()
	runfor = 1
	done := time.After(time.Duration(runfor) * time.Minute)
	fmt.Printf("This demo will stop after %d minutes\n", runfor)

L1:
	for {
		select {
		case t := <-temp.Ch:
			temp.Show(fmt.Sprintf("%d", t))
		case t := <-clock.Ch:
			clock.Show(fmt.Sprintf("%d", t))
		case t := <-seekerrs.Ch:
			seekerrs.Show(fmt.Sprintf("%d", t))

		// note: label is required else it 'breaks' the select, not the for
		case _ = <-done:
			break L1
		}
	}
	if false {
		os.Exit(0)
	}
	ansiterm.ClearPage()
}
Beispiel #3
0
func main() {

	//test color/additional functions here
	ansiterm.ResetTerm(ansiterm.NORMAL)
	ansiterm.ClearPage()

	ansiterm.MoveToXY(10, 10)
	sleepOne()

	ansiterm.HideCursor()
	sleepOne()

	ansiterm.SetFGColor(5)
	fmt.Printf("TEST MOVE HIDDEN CURSOR / OUT IN PURPLE")
	sleepOne()

	ansiterm.MoveToXY(10, 12)
	ansiterm.SetColorBright()
	fmt.Printf("BRIGHT COLORS")
	sleepOne()

	ansiterm.MoveToXY(10, 14)
	ansiterm.SetColorNormal()
	fmt.Printf("NORMAL COLORS AGAIN")
	sleepOne()

	ansiterm.ShowCursor()
	sleepOne()

	ansiterm.ResetTerm(ansiterm.NORMAL)
}
Beispiel #4
0
func test_1() {
	const pauseSec = 2
	fmt.Printf("Test_001\n")
	ansiterm.ResetTerm(ansiterm.NORMAL)
	defer ansiterm.ClearPage()

	ansiterm.ClearPage()
	Headline("this headline should be on row 1")
	StatusUpdate("one")
	pause(pauseSec)

	ansiterm.MoveToRC(3, 1)
	Headline("erase page and print Test on third line")
	StatusUpdate("two")
	fmt.Printf("Test\r")
	pause(pauseSec)

	Headline("erase first 3 chars on third line")
	StatusUpdate("three")
	ansiterm.Erase(3)
	pause(pauseSec)

	Headline("print Best on third line")
	StatusUpdate("four")
	fmt.Printf("Best\r")
	pause(pauseSec)

	Headline("erase entire third line")
	StatusUpdate("five")
	ansiterm.ClearLine()
	pause(pauseSec)

	Headline("print Rest on third line")
	StatusUpdate("six")
	fmt.Printf("Rest\r")
	pause(pauseSec)

	Headline("move to 10,10 and print a msg")
	StatusUpdate("seven")
	ansiterm.MoveToRC(10, 10)
	fmt.Printf("x at 10,10")
	pause(pauseSec)
}
Beispiel #5
0
func main() {
	flag.Parse()
	if flag.NArg() > 0 {
		for i := 0; i < flag.NArg(); i++ {
			fmt.Printf("args(%v)\n", flag.Arg(i))
		}
	}
	_ = rand.Int31n(10)
	ansiterm.ClearPage()
	test_1()
}