Updated Termbox API (markdown)

Jakub Sobon 2019-03-02 18:33:32 -05:00
parent 4ec60418d0
commit b497ddf1e6
1 changed files with 5 additions and 5 deletions

@ -2,11 +2,11 @@
[![Doc Status](https://godoc.org/github.com/mum4k/termdash/terminal/termbox?status.png)](https://godoc.org/github.com/mum4k/termdash/terminal/termbox) [![Doc Status](https://godoc.org/github.com/mum4k/termdash/terminal/termbox?status.png)](https://godoc.org/github.com/mum4k/termdash/terminal/termbox)
The [termbox](https://github.com/mum4k/termdash/tree/master/terminal/termbox) package implements the [[Terminal API|terminal-api]] using the [termbox-go](https://github.com/nsf/termbox-go). Termbox provides cell based access to the terminal. The [termbox](https://godoc.org/github.com/mum4k/termdash/terminal/termbox) package implements the [[Terminal API|terminal-api]] using the [termbox-go](https://github.com/nsf/termbox-go). Termbox provides cell based access to the terminal.
The public API surface of this package consists of the following: The public API surface of this package consists of the following:
## [termbox.New](https://github.com/mum4k/termdash/blob/614d6ed82014e343ca40f25ee1bed8dfbd452830/terminal/termbox/termbox.go#L82-L97) ## [termbox.New](https://godoc.org/github.com/mum4k/termdash/terminal/termbox#New)
Users of Termdash need to provide [[Termdash API|termdash-api]] with a terminal instance. Termbox is one of the valid options. Use the **New** function to create a Terminal instance. Users of Termdash need to provide [[Termdash API|termdash-api]] with a terminal instance. Termbox is one of the valid options. Use the **New** function to create a Terminal instance.
@ -17,11 +17,11 @@ if err != nil {
} }
``` ```
## [termbox.Option](https://github.com/mum4k/termdash/blob/614d6ed82014e343ca40f25ee1bed8dfbd452830/terminal/termbox/termbox.go#L28-L32) ## [termbox.Option](https://godoc.org/github.com/mum4k/termdash/terminal/termbox#Option)
This interface is used to provide optional arguments to **New**. This interface is used to provide optional arguments to **New**.
### [termbox.ColorMode](https://github.com/mum4k/termdash/blob/614d6ed82014e343ca40f25ee1bed8dfbd452830/terminal/termbox/termbox.go#L45-L51) ### [termbox.ColorMode](https://godoc.org/github.com/mum4k/termdash/terminal/termbox#ColorMode)
Used to set the color mode in which the terminal will be initialised. The available color modes are documented in the [[Terminal API|terminal-api]]. The following example sets the color mode to grayscale. Note that when no options are provided, Termbox is initialised in a color mode that supports all 256 terminal colors. Refer to the [[Cell API|cell-api]] for an explanation of terminal colors. Used to set the color mode in which the terminal will be initialised. The available color modes are documented in the [[Terminal API|terminal-api]]. The following example sets the color mode to grayscale. Note that when no options are provided, Termbox is initialised in a color mode that supports all 256 terminal colors. Refer to the [[Cell API|cell-api]] for an explanation of terminal colors.
@ -32,7 +32,7 @@ if err != nil {
} }
``` ```
## [termbox.Close](https://github.com/mum4k/termdash/blob/ffbf88caeddb1735dcf2a5f735eec80dc9cf9fe7/terminal/termbox/termbox.go#L158-L164) ## [termbox.Close](https://godoc.org/github.com/mum4k/termdash/terminal/termbox#Terminal.Close)
This function should be used to close the terminal and return it to a sane state once the Termbox instance isn't needed anymore. A good practice is to defer the call right after Termbox instance is created: This function should be used to close the terminal and return it to a sane state once the Termbox instance isn't needed anymore. A good practice is to defer the call right after Termbox instance is created: