Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsESCPressed ¶
IsESCPressed checks if the given error is of type ErrESCPressed.
Parameters:
- err: The error to check.
Returns:
- bool: True if the error is of type ErrESCPressed, false otherwise.
Types ¶
type Display ¶
type Display struct {
// contains filtered or unexported fields
}
Display represents a display that can be used to draw to the screen.
func NewDisplay ¶
NewDisplay creates a new display with the given frame rate.
If the frame rate is less than or equal to 0, an error of type *ers.ErrInvalidParameter will be returned.
Parameters:
- frameRate: The frame rate of the display.
Returns:
- *Display: A pointer to the new display.
- error: An error if the display could not be created.
func (*Display) GetErrChannel ¶
GetErrChannel returns the error channel of the display.
Returns:
- <-chan error: The error channel of the display.
func (*Display) GetTable ¶
func (d *Display) GetTable() WriteOnlyDTer
GetTable returns the table that the display will draw to.
Returns:
- WriteOnlyDTer: The table that the display will draw to.
type DrawTable ¶
type DrawTable struct {
// contains filtered or unexported fields
}
DrawTable represents a table that can be drawn to the screen.
func NewDrawTable ¶
NewDrawTable creates a new table with the given width, height, and default style.
If the width or height is less than 0, an error of type *ers.ErrInvalidParameter will be returned.
Parameters:
- width: The width of the table.
- height: The height of the table.
- defaultStyle: The default style of the table.
Returns:
- *DrawTable: A pointer to the new table.
- error: An error if the table could not be created.
func (*DrawTable) GetHeight ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table.
func (*DrawTable) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table.
func (*DrawTable) ResizeHeight ¶
ResizeHeight resizes the height of the table. No op if the height is the same.
If the height is less than 0, an error of type *ers.ErrInvalidParameter will be returned.
Parameters:
- height: The new height of the table.
Returns:
- error: An error if the height could not be resized.
func (*DrawTable) ResizeWidth ¶
ResizeWidth resizes the width of the table. No op if the width is the same.
If the width is less than 0, an error of type *ers.ErrInvalidParameter will be returned.
Parameters:
- width: The new width of the table.
Returns:
- error: An error if the width could not be resized.
func (*DrawTable) WriteAt ¶
GetStyle returns the style of the table at the given position.
If the position is out of bounds, an error of type *ers.ErrInvalidParameter will be returned.
Parameters:
- x: The x-coordinate of the position.
- y: The y-coordinate of the position.
- value: The value to set.
Returns:
- *DtCell: The style of the table at the given position.
- error: An error if the style could not be retrieved.
type DtCell ¶
type DtCell struct {
// Char represents the character of the cell.
Char rune
// Style represents the style of the cell.
Style tcell.Style
}
DtCell represents a cell in a table that can be drawn to the screen.
type ErrESCPressed ¶
type ErrESCPressed struct{}
ErrESCPressed is an error that is returned when the ESC key is pressed.
func NewErrESCPressed ¶
func NewErrESCPressed() *ErrESCPressed
NewErrESCPressed creates a new ErrESCPressed error.
Returns:
- *ErrESCPressed: A pointer to the new error.
func (ErrESCPressed) Error ¶
func (e ErrESCPressed) Error() string
Error returns the error message.
Returns:
- string: The error message.
type WriteOnlyDTer ¶
type WriteOnlyDTer interface {
// WriteAt writes a cell to the table at the given x and y coordinates.
//
// If the x-coordinate is out of bounds, an error of type *ers.ErrInvalidParameter
// will be returned.
//
// If the y-coordinate is out of bounds, an error of type *ers.ErrInvalidParameter
// will be returned.
//
// Parameters:
//
// - x: The x-coordinate of the position.
// - y: The y-coordinate of the position.
// - value: The value to set.
//
// Returns:
//
// - error: An error if the cell could not be written.
WriteAt(x, y int, value *DtCell) error
// GetWidth returns the width of the table.
//
// Returns:
//
// - int: The width of the table.
GetWidth() int
// GetHeight returns the height of the table.
//
// Returns:
//
// - int: The height of the table.
GetHeight() int
}
WriteOnlyDTer is an interface that represents a table that can be written to.