Example #1
0
// Initializes termbox library. This function should be called before any other functions.
// After successful initialization, the library must be finalized using 'Shutdown' function.
//
// Example usage:
//	err := termbox.Init()
//	if err != nil {
//		panic(err.String())
//	}
//	defer termbox.Shutdown()
func Init() error {
	switch int(C.tb_init()) {
	case -3:
		return errors.New("Pipe trap error")
	case -2:
		return errors.New("Failed to open /dev/tty")
	case -1:
		return errors.New("Unsupported terminal")
	}
	return nil
}
Example #2
0
func Init() int {
	return int(C.tb_init())
}