Example #1
0
/**
 *
 *	ReadKey
 *
 *	Reads a single keystroke and returns it's ASCII value.
 *	If a special key is pressed such as an arrow-key, it will process
 *	the ^] + ] return codes and return the ASCII value + 100.
 *
 * 	@return Integer
 *
 */
func ReadKey() int {
	var ch int

	ch = int(C.readkey())
	if ch == 27 { // ESC
		if int(C.readkey()) == 91 { // [ bracket
			ch = int(C.readkey()) + 100 // Add 100 to ASCII value.
		}
	}

	return ch
}
Example #2
0
/**
 *
 *	RawKey
 *
 *	Reads a single keystroke and returns it's ASCII value.
 *	Does nothing with special keys being pressed.
 *	You will have to read each character code and process them
 *	yourself.
 *
 * 	@return Integer
 *
 */
func RawKey() int {
	return int(C.readkey())
}