ttk.go
func Init() error {
	rawMtx.Lock()
	defer rawMtx.Unlock()

	if termRaw {
		return ErrAlreadyInitialized
	}

	// switch mode
	err := termbox.Init()
	if err != nil {
		return err
	}

	bg = termbox.ColorDefault
	fg = termbox.ColorDefault
	termbox.HideCursor()
	termbox.SetInputMode(termbox.InputAlt) // this may need to become variable
	_ = termbox.Clear(bg, bg)
	maxX, maxY = termbox.Size()
	_ = termbox.Flush()

	// see if we need to launch the key handler
	if !keyHandler {
		go initKeyHandler()
		keyHandler = true
	}

	termRaw = true // we are now in raw mode

	return nil
}
func Init() error {
	rawMtx.Lock()
	defer rawMtx.Unlock()

	if termRaw {
		return ErrAlreadyInitialized
	}

	// switch mode
	err := termbox.Init()
	if err != nil {
		return err
	}

	bg = termbox.ColorDefault
	fg = termbox.ColorDefault
	termbox.HideCursor()
	termbox.SetInputMode(termbox.InputAlt) // this may need to become variable
	_ = termbox.Clear(bg, bg)
	maxX, maxY = termbox.Size()
	_ = termbox.Flush()

	// see if we need to launch the key handler
	if !keyHandler {
		go initKeyHandler()
		keyHandler = true
	}

	termRaw = true // we are now in raw mode

	return nil
}
func Init ( ) error { rawMtx . Lock ( ) defer rawMtx . Unlock ( ) if termRaw { return ErrAlreadyInitialized } // switch mode err := termbox . Init ( ) if err != nil { return err } bg = termbox . ColorDefault fg = termbox . ColorDefault termbox . HideCursor ( ) termbox . SetInputMode ( termbox . InputAlt ) // this may need to become variable _ = termbox . Clear ( bg , bg ) maxX , maxY = termbox . Size ( ) _ = termbox . Flush ( ) // see if we need to launch the key handler if ! keyHandler { go initKeyHandler ( ) keyHandler = true } termRaw = true // we are now in raw mode return nil }
// Init switches the terminal to raw mode and commences managed window mode.
// This function shall be called prior to any ttk calls.
Init switches the terminal to raw mode and commences managed window mode . This function shall be called prior to any ttk calls .