Documentation
¶
Overview ¶
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Code generated by go:generate. DO NOT EDIT.
Index ¶
- func FixBoundaries[T any](maxWidth, maxHeight int, elems [][]T, x, y *int) [][]T
- type BoolTable
- func (t *BoolTable) Cell() iter.Seq[bool]
- func (t *BoolTable) Cleanup()
- func (t *BoolTable) GetAt(x, y int) bool
- func (t *BoolTable) GetFullTable() [][]bool
- func (t *BoolTable) GetHeight() int
- func (t *BoolTable) GetWidth() int
- func (t *BoolTable) IsXInBounds(x int) error
- func (t *BoolTable) IsYInBounds(y int) error
- func (t *BoolTable) WriteAt(x, y int, cell bool)
- func (t *BoolTable) WriteHorizontalSequence(x, y *int, sequence []bool)
- func (t *BoolTable) WriteTableAt(table *BoolTable, x, y *int)
- func (t *BoolTable) WriteVerticalSequence(x, y *int, sequence []bool)
- type ByteTable
- func (t *ByteTable) Cell() iter.Seq[byte]
- func (t *ByteTable) Cleanup()
- func (t *ByteTable) GetAt(x, y int) byte
- func (t *ByteTable) GetFullTable() [][]byte
- func (t *ByteTable) GetHeight() int
- func (t *ByteTable) GetWidth() int
- func (t *ByteTable) IsXInBounds(x int) error
- func (t *ByteTable) IsYInBounds(y int) error
- func (t *ByteTable) WriteAt(x, y int, cell byte)
- func (t *ByteTable) WriteHorizontalSequence(x, y *int, sequence []byte)
- func (t *ByteTable) WriteTableAt(table *ByteTable, x, y *int)
- func (t *ByteTable) WriteVerticalSequence(x, y *int, sequence []byte)
- type Complex128Table
- func (t *Complex128Table) Cell() iter.Seq[complex128]
- func (t *Complex128Table) Cleanup()
- func (t *Complex128Table) GetAt(x, y int) complex128
- func (t *Complex128Table) GetFullTable() [][]complex128
- func (t *Complex128Table) GetHeight() int
- func (t *Complex128Table) GetWidth() int
- func (t *Complex128Table) IsXInBounds(x int) error
- func (t *Complex128Table) IsYInBounds(y int) error
- func (t *Complex128Table) WriteAt(x, y int, cell complex128)
- func (t *Complex128Table) WriteHorizontalSequence(x, y *int, sequence []complex128)
- func (t *Complex128Table) WriteTableAt(table *Complex128Table, x, y *int)
- func (t *Complex128Table) WriteVerticalSequence(x, y *int, sequence []complex128)
- type Complex64Table
- func (t *Complex64Table) Cell() iter.Seq[complex64]
- func (t *Complex64Table) Cleanup()
- func (t *Complex64Table) GetAt(x, y int) complex64
- func (t *Complex64Table) GetFullTable() [][]complex64
- func (t *Complex64Table) GetHeight() int
- func (t *Complex64Table) GetWidth() int
- func (t *Complex64Table) IsXInBounds(x int) error
- func (t *Complex64Table) IsYInBounds(y int) error
- func (t *Complex64Table) WriteAt(x, y int, cell complex64)
- func (t *Complex64Table) WriteHorizontalSequence(x, y *int, sequence []complex64)
- func (t *Complex64Table) WriteTableAt(table *Complex64Table, x, y *int)
- func (t *Complex64Table) WriteVerticalSequence(x, y *int, sequence []complex64)
- type ErrorTable
- func (t *ErrorTable) Cell() iter.Seq[error]
- func (t *ErrorTable) Cleanup()
- func (t *ErrorTable) GetAt(x, y int) error
- func (t *ErrorTable) GetFullTable() [][]error
- func (t *ErrorTable) GetHeight() int
- func (t *ErrorTable) GetWidth() int
- func (t *ErrorTable) IsXInBounds(x int) error
- func (t *ErrorTable) IsYInBounds(y int) error
- func (t *ErrorTable) WriteAt(x, y int, cell error)
- func (t *ErrorTable) WriteHorizontalSequence(x, y *int, sequence []error)
- func (t *ErrorTable) WriteTableAt(table *ErrorTable, x, y *int)
- func (t *ErrorTable) WriteVerticalSequence(x, y *int, sequence []error)
- type Float32Table
- func (t *Float32Table) Cell() iter.Seq[float32]
- func (t *Float32Table) Cleanup()
- func (t *Float32Table) GetAt(x, y int) float32
- func (t *Float32Table) GetFullTable() [][]float32
- func (t *Float32Table) GetHeight() int
- func (t *Float32Table) GetWidth() int
- func (t *Float32Table) IsXInBounds(x int) error
- func (t *Float32Table) IsYInBounds(y int) error
- func (t *Float32Table) WriteAt(x, y int, cell float32)
- func (t *Float32Table) WriteHorizontalSequence(x, y *int, sequence []float32)
- func (t *Float32Table) WriteTableAt(table *Float32Table, x, y *int)
- func (t *Float32Table) WriteVerticalSequence(x, y *int, sequence []float32)
- type Float64Table
- func (t *Float64Table) Cell() iter.Seq[float64]
- func (t *Float64Table) Cleanup()
- func (t *Float64Table) GetAt(x, y int) float64
- func (t *Float64Table) GetFullTable() [][]float64
- func (t *Float64Table) GetHeight() int
- func (t *Float64Table) GetWidth() int
- func (t *Float64Table) IsXInBounds(x int) error
- func (t *Float64Table) IsYInBounds(y int) error
- func (t *Float64Table) WriteAt(x, y int, cell float64)
- func (t *Float64Table) WriteHorizontalSequence(x, y *int, sequence []float64)
- func (t *Float64Table) WriteTableAt(table *Float64Table, x, y *int)
- func (t *Float64Table) WriteVerticalSequence(x, y *int, sequence []float64)
- type Int16Table
- func (t *Int16Table) Cell() iter.Seq[int16]
- func (t *Int16Table) Cleanup()
- func (t *Int16Table) GetAt(x, y int) int16
- func (t *Int16Table) GetFullTable() [][]int16
- func (t *Int16Table) GetHeight() int
- func (t *Int16Table) GetWidth() int
- func (t *Int16Table) IsXInBounds(x int) error
- func (t *Int16Table) IsYInBounds(y int) error
- func (t *Int16Table) WriteAt(x, y int, cell int16)
- func (t *Int16Table) WriteHorizontalSequence(x, y *int, sequence []int16)
- func (t *Int16Table) WriteTableAt(table *Int16Table, x, y *int)
- func (t *Int16Table) WriteVerticalSequence(x, y *int, sequence []int16)
- type Int32Table
- func (t *Int32Table) Cell() iter.Seq[int32]
- func (t *Int32Table) Cleanup()
- func (t *Int32Table) GetAt(x, y int) int32
- func (t *Int32Table) GetFullTable() [][]int32
- func (t *Int32Table) GetHeight() int
- func (t *Int32Table) GetWidth() int
- func (t *Int32Table) IsXInBounds(x int) error
- func (t *Int32Table) IsYInBounds(y int) error
- func (t *Int32Table) WriteAt(x, y int, cell int32)
- func (t *Int32Table) WriteHorizontalSequence(x, y *int, sequence []int32)
- func (t *Int32Table) WriteTableAt(table *Int32Table, x, y *int)
- func (t *Int32Table) WriteVerticalSequence(x, y *int, sequence []int32)
- type Int64Table
- func (t *Int64Table) Cell() iter.Seq[int64]
- func (t *Int64Table) Cleanup()
- func (t *Int64Table) GetAt(x, y int) int64
- func (t *Int64Table) GetFullTable() [][]int64
- func (t *Int64Table) GetHeight() int
- func (t *Int64Table) GetWidth() int
- func (t *Int64Table) IsXInBounds(x int) error
- func (t *Int64Table) IsYInBounds(y int) error
- func (t *Int64Table) WriteAt(x, y int, cell int64)
- func (t *Int64Table) WriteHorizontalSequence(x, y *int, sequence []int64)
- func (t *Int64Table) WriteTableAt(table *Int64Table, x, y *int)
- func (t *Int64Table) WriteVerticalSequence(x, y *int, sequence []int64)
- type Int8Table
- func (t *Int8Table) Cell() iter.Seq[int8]
- func (t *Int8Table) Cleanup()
- func (t *Int8Table) GetAt(x, y int) int8
- func (t *Int8Table) GetFullTable() [][]int8
- func (t *Int8Table) GetHeight() int
- func (t *Int8Table) GetWidth() int
- func (t *Int8Table) IsXInBounds(x int) error
- func (t *Int8Table) IsYInBounds(y int) error
- func (t *Int8Table) WriteAt(x, y int, cell int8)
- func (t *Int8Table) WriteHorizontalSequence(x, y *int, sequence []int8)
- func (t *Int8Table) WriteTableAt(table *Int8Table, x, y *int)
- func (t *Int8Table) WriteVerticalSequence(x, y *int, sequence []int8)
- type IntTable
- func (t *IntTable) Cell() iter.Seq[int]
- func (t *IntTable) Cleanup()
- func (t *IntTable) GetAt(x, y int) int
- func (t *IntTable) GetFullTable() [][]int
- func (t *IntTable) GetHeight() int
- func (t *IntTable) GetWidth() int
- func (t *IntTable) IsXInBounds(x int) error
- func (t *IntTable) IsYInBounds(y int) error
- func (t *IntTable) WriteAt(x, y int, cell int)
- func (t *IntTable) WriteHorizontalSequence(x, y *int, sequence []int)
- func (t *IntTable) WriteTableAt(table *IntTable, x, y *int)
- func (t *IntTable) WriteVerticalSequence(x, y *int, sequence []int)
- type RuneTable
- func (t *RuneTable) Cell() iter.Seq[rune]
- func (t *RuneTable) Cleanup()
- func (t *RuneTable) GetAt(x, y int) rune
- func (t *RuneTable) GetFullTable() [][]rune
- func (t *RuneTable) GetHeight() int
- func (t *RuneTable) GetWidth() int
- func (t *RuneTable) IsXInBounds(x int) error
- func (t *RuneTable) IsYInBounds(y int) error
- func (t *RuneTable) WriteAt(x, y int, cell rune)
- func (t *RuneTable) WriteHorizontalSequence(x, y *int, sequence []rune)
- func (t *RuneTable) WriteTableAt(table *RuneTable, x, y *int)
- func (t *RuneTable) WriteVerticalSequence(x, y *int, sequence []rune)
- type StringTable
- func (t *StringTable) Cell() iter.Seq[string]
- func (t *StringTable) Cleanup()
- func (t *StringTable) GetAt(x, y int) string
- func (t *StringTable) GetFullTable() [][]string
- func (t *StringTable) GetHeight() int
- func (t *StringTable) GetWidth() int
- func (t *StringTable) IsXInBounds(x int) error
- func (t *StringTable) IsYInBounds(y int) error
- func (t *StringTable) WriteAt(x, y int, cell string)
- func (t *StringTable) WriteHorizontalSequence(x, y *int, sequence []string)
- func (t *StringTable) WriteTableAt(table *StringTable, x, y *int)
- func (t *StringTable) WriteVerticalSequence(x, y *int, sequence []string)
- type Table
- func (t *Table[T]) Cell() iter.Seq[T]
- func (t *Table[T]) Cleanup()
- func (t *Table[T]) GetAt(x, y int) T
- func (t *Table[T]) GetFullTable() [][]T
- func (t *Table[T]) GetHeight() int
- func (t *Table[T]) GetWidth() int
- func (t *Table[T]) IsXInBounds(x int) error
- func (t *Table[T]) IsYInBounds(y int) error
- func (t *Table[T]) WriteAt(x, y int, cell T)
- func (t *Table[T]) WriteHorizontalSequence(x, y *int, sequence []T)
- func (t *Table[T]) WriteTableAt(table *Table[T], x, y *int)
- func (t *Table[T]) WriteVerticalSequence(x, y *int, sequence []T)
- type Uint16Table
- func (t *Uint16Table) Cell() iter.Seq[uint16]
- func (t *Uint16Table) Cleanup()
- func (t *Uint16Table) GetAt(x, y int) uint16
- func (t *Uint16Table) GetFullTable() [][]uint16
- func (t *Uint16Table) GetHeight() int
- func (t *Uint16Table) GetWidth() int
- func (t *Uint16Table) IsXInBounds(x int) error
- func (t *Uint16Table) IsYInBounds(y int) error
- func (t *Uint16Table) WriteAt(x, y int, cell uint16)
- func (t *Uint16Table) WriteHorizontalSequence(x, y *int, sequence []uint16)
- func (t *Uint16Table) WriteTableAt(table *Uint16Table, x, y *int)
- func (t *Uint16Table) WriteVerticalSequence(x, y *int, sequence []uint16)
- type Uint32Table
- func (t *Uint32Table) Cell() iter.Seq[uint32]
- func (t *Uint32Table) Cleanup()
- func (t *Uint32Table) GetAt(x, y int) uint32
- func (t *Uint32Table) GetFullTable() [][]uint32
- func (t *Uint32Table) GetHeight() int
- func (t *Uint32Table) GetWidth() int
- func (t *Uint32Table) IsXInBounds(x int) error
- func (t *Uint32Table) IsYInBounds(y int) error
- func (t *Uint32Table) WriteAt(x, y int, cell uint32)
- func (t *Uint32Table) WriteHorizontalSequence(x, y *int, sequence []uint32)
- func (t *Uint32Table) WriteTableAt(table *Uint32Table, x, y *int)
- func (t *Uint32Table) WriteVerticalSequence(x, y *int, sequence []uint32)
- type Uint64Table
- func (t *Uint64Table) Cell() iter.Seq[uint64]
- func (t *Uint64Table) Cleanup()
- func (t *Uint64Table) GetAt(x, y int) uint64
- func (t *Uint64Table) GetFullTable() [][]uint64
- func (t *Uint64Table) GetHeight() int
- func (t *Uint64Table) GetWidth() int
- func (t *Uint64Table) IsXInBounds(x int) error
- func (t *Uint64Table) IsYInBounds(y int) error
- func (t *Uint64Table) WriteAt(x, y int, cell uint64)
- func (t *Uint64Table) WriteHorizontalSequence(x, y *int, sequence []uint64)
- func (t *Uint64Table) WriteTableAt(table *Uint64Table, x, y *int)
- func (t *Uint64Table) WriteVerticalSequence(x, y *int, sequence []uint64)
- type Uint8Table
- func (t *Uint8Table) Cell() iter.Seq[uint8]
- func (t *Uint8Table) Cleanup()
- func (t *Uint8Table) GetAt(x, y int) uint8
- func (t *Uint8Table) GetFullTable() [][]uint8
- func (t *Uint8Table) GetHeight() int
- func (t *Uint8Table) GetWidth() int
- func (t *Uint8Table) IsXInBounds(x int) error
- func (t *Uint8Table) IsYInBounds(y int) error
- func (t *Uint8Table) WriteAt(x, y int, cell uint8)
- func (t *Uint8Table) WriteHorizontalSequence(x, y *int, sequence []uint8)
- func (t *Uint8Table) WriteTableAt(table *Uint8Table, x, y *int)
- func (t *Uint8Table) WriteVerticalSequence(x, y *int, sequence []uint8)
- type UintTable
- func (t *UintTable) Cell() iter.Seq[uint]
- func (t *UintTable) Cleanup()
- func (t *UintTable) GetAt(x, y int) uint
- func (t *UintTable) GetFullTable() [][]uint
- func (t *UintTable) GetHeight() int
- func (t *UintTable) GetWidth() int
- func (t *UintTable) IsXInBounds(x int) error
- func (t *UintTable) IsYInBounds(y int) error
- func (t *UintTable) WriteAt(x, y int, cell uint)
- func (t *UintTable) WriteHorizontalSequence(x, y *int, sequence []uint)
- func (t *UintTable) WriteTableAt(table *UintTable, x, y *int)
- func (t *UintTable) WriteVerticalSequence(x, y *int, sequence []uint)
- type UintptrTable
- func (t *UintptrTable) Cell() iter.Seq[uintptr]
- func (t *UintptrTable) Cleanup()
- func (t *UintptrTable) GetAt(x, y int) uintptr
- func (t *UintptrTable) GetFullTable() [][]uintptr
- func (t *UintptrTable) GetHeight() int
- func (t *UintptrTable) GetWidth() int
- func (t *UintptrTable) IsXInBounds(x int) error
- func (t *UintptrTable) IsYInBounds(y int) error
- func (t *UintptrTable) WriteAt(x, y int, cell uintptr)
- func (t *UintptrTable) WriteHorizontalSequence(x, y *int, sequence []uintptr)
- func (t *UintptrTable) WriteTableAt(table *UintptrTable, x, y *int)
- func (t *UintptrTable) WriteVerticalSequence(x, y *int, sequence []uintptr)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FixBoundaries ¶
FixBoundaries is a function that fixes the boundaries of a table of elements based on the maximum width and height of the table.
Parameters:
- maxWidth: The maximum width of the table.
- maxHeight: The maximum height of the table.
- elems: The elements of the table.
- x: The x-coordinate to fix the boundaries at.
- y: The y-coordinate to fix the boundaries at.
Returns:
- [][]T: The elements of the table with the boundaries fixed.
Behaviors:
- If maxWidth is less than 0, it is set to 0.
- If maxHeight is less than 0, it is set to 0.
- If elems is empty, nil is returned.
Types ¶
type BoolTable ¶
type BoolTable struct {
// contains filtered or unexported fields
}
BoolTable represents a table of cells that can be drawn to the screen.
func NewBoolTable ¶
NewBoolTable creates a new table of type bool with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *BoolTable: The new table. Never nil.
func (*BoolTable) Cell ¶ added in v0.1.12
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type bool.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*BoolTable) Cleanup ¶
func (t *BoolTable) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type bool.
func (*BoolTable) GetAt ¶
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type bool.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- bool: The cell at the given coordinates.
func (*BoolTable) GetFullTable ¶
GetFullTable returns the full table as a 2D slice of elements of type bool.
Returns:
- [][]bool: The full table.
func (*BoolTable) GetHeight ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*BoolTable) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*BoolTable) IsXInBounds ¶
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*BoolTable) IsYInBounds ¶
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*BoolTable) WriteAt ¶
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*BoolTable) WriteHorizontalSequence ¶
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*BoolTable) WriteTableAt ¶
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*BoolTable) WriteVerticalSequence ¶
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type ByteTable ¶
type ByteTable struct {
// contains filtered or unexported fields
}
ByteTable represents a table of cells that can be drawn to the screen.
func NewByteTable ¶
NewByteTable creates a new table of type byte with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *ByteTable: The new table. Never nil.
func (*ByteTable) Cell ¶ added in v0.1.12
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type byte.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*ByteTable) Cleanup ¶
func (t *ByteTable) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type byte.
func (*ByteTable) GetAt ¶
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type byte.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- byte: The cell at the given coordinates.
func (*ByteTable) GetFullTable ¶
GetFullTable returns the full table as a 2D slice of elements of type byte.
Returns:
- [][]byte: The full table.
func (*ByteTable) GetHeight ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*ByteTable) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*ByteTable) IsXInBounds ¶
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*ByteTable) IsYInBounds ¶
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*ByteTable) WriteAt ¶
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*ByteTable) WriteHorizontalSequence ¶
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*ByteTable) WriteTableAt ¶
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*ByteTable) WriteVerticalSequence ¶
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Complex128Table ¶
type Complex128Table struct {
// contains filtered or unexported fields
}
Complex128Table represents a table of cells that can be drawn to the screen.
func NewComplex128Table ¶
func NewComplex128Table(width, height int) *Complex128Table
NewComplex128Table creates a new table of type complex128 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Complex128Table: The new table. Never nil.
func (*Complex128Table) Cell ¶ added in v0.1.12
func (t *Complex128Table) Cell() iter.Seq[complex128]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type complex128.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Complex128Table) Cleanup ¶
func (t *Complex128Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type complex128.
func (*Complex128Table) GetAt ¶
func (t *Complex128Table) GetAt(x, y int) complex128
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type complex128.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- complex128: The cell at the given coordinates.
func (*Complex128Table) GetFullTable ¶
func (t *Complex128Table) GetFullTable() [][]complex128
GetFullTable returns the full table as a 2D slice of elements of type complex128.
Returns:
- [][]complex128: The full table.
func (*Complex128Table) GetHeight ¶
func (t *Complex128Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Complex128Table) GetWidth ¶
func (t *Complex128Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Complex128Table) IsXInBounds ¶
func (t *Complex128Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Complex128Table) IsYInBounds ¶
func (t *Complex128Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Complex128Table) WriteAt ¶
func (t *Complex128Table) WriteAt(x, y int, cell complex128)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Complex128Table) WriteHorizontalSequence ¶
func (t *Complex128Table) WriteHorizontalSequence(x, y *int, sequence []complex128)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Complex128Table) WriteTableAt ¶
func (t *Complex128Table) WriteTableAt(table *Complex128Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Complex128Table) WriteVerticalSequence ¶
func (t *Complex128Table) WriteVerticalSequence(x, y *int, sequence []complex128)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Complex64Table ¶
type Complex64Table struct {
// contains filtered or unexported fields
}
Complex64Table represents a table of cells that can be drawn to the screen.
func NewComplex64Table ¶
func NewComplex64Table(width, height int) *Complex64Table
NewComplex64Table creates a new table of type complex64 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Complex64Table: The new table. Never nil.
func (*Complex64Table) Cell ¶ added in v0.1.12
func (t *Complex64Table) Cell() iter.Seq[complex64]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type complex64.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Complex64Table) Cleanup ¶
func (t *Complex64Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type complex64.
func (*Complex64Table) GetAt ¶
func (t *Complex64Table) GetAt(x, y int) complex64
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type complex64.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- complex64: The cell at the given coordinates.
func (*Complex64Table) GetFullTable ¶
func (t *Complex64Table) GetFullTable() [][]complex64
GetFullTable returns the full table as a 2D slice of elements of type complex64.
Returns:
- [][]complex64: The full table.
func (*Complex64Table) GetHeight ¶
func (t *Complex64Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Complex64Table) GetWidth ¶
func (t *Complex64Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Complex64Table) IsXInBounds ¶
func (t *Complex64Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Complex64Table) IsYInBounds ¶
func (t *Complex64Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Complex64Table) WriteAt ¶
func (t *Complex64Table) WriteAt(x, y int, cell complex64)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Complex64Table) WriteHorizontalSequence ¶
func (t *Complex64Table) WriteHorizontalSequence(x, y *int, sequence []complex64)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Complex64Table) WriteTableAt ¶
func (t *Complex64Table) WriteTableAt(table *Complex64Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Complex64Table) WriteVerticalSequence ¶
func (t *Complex64Table) WriteVerticalSequence(x, y *int, sequence []complex64)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type ErrorTable ¶
type ErrorTable struct {
// contains filtered or unexported fields
}
ErrorTable represents a table of cells that can be drawn to the screen.
func NewErrorTable ¶
func NewErrorTable(width, height int) *ErrorTable
NewErrorTable creates a new table of type error with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *ErrorTable: The new table. Never nil.
func (*ErrorTable) Cell ¶ added in v0.1.12
func (t *ErrorTable) Cell() iter.Seq[error]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type error.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*ErrorTable) Cleanup ¶
func (t *ErrorTable) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type error.
func (*ErrorTable) GetAt ¶
func (t *ErrorTable) GetAt(x, y int) error
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type error.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- error: The cell at the given coordinates.
func (*ErrorTable) GetFullTable ¶
func (t *ErrorTable) GetFullTable() [][]error
GetFullTable returns the full table as a 2D slice of elements of type error.
Returns:
- [][]error: The full table.
func (*ErrorTable) GetHeight ¶
func (t *ErrorTable) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*ErrorTable) GetWidth ¶
func (t *ErrorTable) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*ErrorTable) IsXInBounds ¶
func (t *ErrorTable) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*ErrorTable) IsYInBounds ¶
func (t *ErrorTable) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*ErrorTable) WriteAt ¶
func (t *ErrorTable) WriteAt(x, y int, cell error)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*ErrorTable) WriteHorizontalSequence ¶
func (t *ErrorTable) WriteHorizontalSequence(x, y *int, sequence []error)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*ErrorTable) WriteTableAt ¶
func (t *ErrorTable) WriteTableAt(table *ErrorTable, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*ErrorTable) WriteVerticalSequence ¶
func (t *ErrorTable) WriteVerticalSequence(x, y *int, sequence []error)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Float32Table ¶
type Float32Table struct {
// contains filtered or unexported fields
}
Float32Table represents a table of cells that can be drawn to the screen.
func NewFloat32Table ¶
func NewFloat32Table(width, height int) *Float32Table
NewFloat32Table creates a new table of type float32 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Float32Table: The new table. Never nil.
func (*Float32Table) Cell ¶ added in v0.1.12
func (t *Float32Table) Cell() iter.Seq[float32]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type float32.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Float32Table) Cleanup ¶
func (t *Float32Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type float32.
func (*Float32Table) GetAt ¶
func (t *Float32Table) GetAt(x, y int) float32
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type float32.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- float32: The cell at the given coordinates.
func (*Float32Table) GetFullTable ¶
func (t *Float32Table) GetFullTable() [][]float32
GetFullTable returns the full table as a 2D slice of elements of type float32.
Returns:
- [][]float32: The full table.
func (*Float32Table) GetHeight ¶
func (t *Float32Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Float32Table) GetWidth ¶
func (t *Float32Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Float32Table) IsXInBounds ¶
func (t *Float32Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Float32Table) IsYInBounds ¶
func (t *Float32Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Float32Table) WriteAt ¶
func (t *Float32Table) WriteAt(x, y int, cell float32)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Float32Table) WriteHorizontalSequence ¶
func (t *Float32Table) WriteHorizontalSequence(x, y *int, sequence []float32)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Float32Table) WriteTableAt ¶
func (t *Float32Table) WriteTableAt(table *Float32Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Float32Table) WriteVerticalSequence ¶
func (t *Float32Table) WriteVerticalSequence(x, y *int, sequence []float32)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Float64Table ¶
type Float64Table struct {
// contains filtered or unexported fields
}
Float64Table represents a table of cells that can be drawn to the screen.
func NewFloat64Table ¶
func NewFloat64Table(width, height int) *Float64Table
NewFloat64Table creates a new table of type float64 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Float64Table: The new table. Never nil.
func (*Float64Table) Cell ¶ added in v0.1.12
func (t *Float64Table) Cell() iter.Seq[float64]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type float64.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Float64Table) Cleanup ¶
func (t *Float64Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type float64.
func (*Float64Table) GetAt ¶
func (t *Float64Table) GetAt(x, y int) float64
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type float64.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- float64: The cell at the given coordinates.
func (*Float64Table) GetFullTable ¶
func (t *Float64Table) GetFullTable() [][]float64
GetFullTable returns the full table as a 2D slice of elements of type float64.
Returns:
- [][]float64: The full table.
func (*Float64Table) GetHeight ¶
func (t *Float64Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Float64Table) GetWidth ¶
func (t *Float64Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Float64Table) IsXInBounds ¶
func (t *Float64Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Float64Table) IsYInBounds ¶
func (t *Float64Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Float64Table) WriteAt ¶
func (t *Float64Table) WriteAt(x, y int, cell float64)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Float64Table) WriteHorizontalSequence ¶
func (t *Float64Table) WriteHorizontalSequence(x, y *int, sequence []float64)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Float64Table) WriteTableAt ¶
func (t *Float64Table) WriteTableAt(table *Float64Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Float64Table) WriteVerticalSequence ¶
func (t *Float64Table) WriteVerticalSequence(x, y *int, sequence []float64)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Int16Table ¶
type Int16Table struct {
// contains filtered or unexported fields
}
Int16Table represents a table of cells that can be drawn to the screen.
func NewInt16Table ¶
func NewInt16Table(width, height int) *Int16Table
NewInt16Table creates a new table of type int16 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Int16Table: The new table. Never nil.
func (*Int16Table) Cell ¶ added in v0.1.12
func (t *Int16Table) Cell() iter.Seq[int16]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type int16.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Int16Table) Cleanup ¶
func (t *Int16Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type int16.
func (*Int16Table) GetAt ¶
func (t *Int16Table) GetAt(x, y int) int16
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type int16.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- int16: The cell at the given coordinates.
func (*Int16Table) GetFullTable ¶
func (t *Int16Table) GetFullTable() [][]int16
GetFullTable returns the full table as a 2D slice of elements of type int16.
Returns:
- [][]int16: The full table.
func (*Int16Table) GetHeight ¶
func (t *Int16Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Int16Table) GetWidth ¶
func (t *Int16Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Int16Table) IsXInBounds ¶
func (t *Int16Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Int16Table) IsYInBounds ¶
func (t *Int16Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Int16Table) WriteAt ¶
func (t *Int16Table) WriteAt(x, y int, cell int16)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Int16Table) WriteHorizontalSequence ¶
func (t *Int16Table) WriteHorizontalSequence(x, y *int, sequence []int16)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Int16Table) WriteTableAt ¶
func (t *Int16Table) WriteTableAt(table *Int16Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Int16Table) WriteVerticalSequence ¶
func (t *Int16Table) WriteVerticalSequence(x, y *int, sequence []int16)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Int32Table ¶
type Int32Table struct {
// contains filtered or unexported fields
}
Int32Table represents a table of cells that can be drawn to the screen.
func NewInt32Table ¶
func NewInt32Table(width, height int) *Int32Table
NewInt32Table creates a new table of type int32 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Int32Table: The new table. Never nil.
func (*Int32Table) Cell ¶ added in v0.1.12
func (t *Int32Table) Cell() iter.Seq[int32]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type int32.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Int32Table) Cleanup ¶
func (t *Int32Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type int32.
func (*Int32Table) GetAt ¶
func (t *Int32Table) GetAt(x, y int) int32
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type int32.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- int32: The cell at the given coordinates.
func (*Int32Table) GetFullTable ¶
func (t *Int32Table) GetFullTable() [][]int32
GetFullTable returns the full table as a 2D slice of elements of type int32.
Returns:
- [][]int32: The full table.
func (*Int32Table) GetHeight ¶
func (t *Int32Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Int32Table) GetWidth ¶
func (t *Int32Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Int32Table) IsXInBounds ¶
func (t *Int32Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Int32Table) IsYInBounds ¶
func (t *Int32Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Int32Table) WriteAt ¶
func (t *Int32Table) WriteAt(x, y int, cell int32)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Int32Table) WriteHorizontalSequence ¶
func (t *Int32Table) WriteHorizontalSequence(x, y *int, sequence []int32)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Int32Table) WriteTableAt ¶
func (t *Int32Table) WriteTableAt(table *Int32Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Int32Table) WriteVerticalSequence ¶
func (t *Int32Table) WriteVerticalSequence(x, y *int, sequence []int32)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Int64Table ¶
type Int64Table struct {
// contains filtered or unexported fields
}
Int64Table represents a table of cells that can be drawn to the screen.
func NewInt64Table ¶
func NewInt64Table(width, height int) *Int64Table
NewInt64Table creates a new table of type int64 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Int64Table: The new table. Never nil.
func (*Int64Table) Cell ¶ added in v0.1.12
func (t *Int64Table) Cell() iter.Seq[int64]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type int64.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Int64Table) Cleanup ¶
func (t *Int64Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type int64.
func (*Int64Table) GetAt ¶
func (t *Int64Table) GetAt(x, y int) int64
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type int64.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- int64: The cell at the given coordinates.
func (*Int64Table) GetFullTable ¶
func (t *Int64Table) GetFullTable() [][]int64
GetFullTable returns the full table as a 2D slice of elements of type int64.
Returns:
- [][]int64: The full table.
func (*Int64Table) GetHeight ¶
func (t *Int64Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Int64Table) GetWidth ¶
func (t *Int64Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Int64Table) IsXInBounds ¶
func (t *Int64Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Int64Table) IsYInBounds ¶
func (t *Int64Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Int64Table) WriteAt ¶
func (t *Int64Table) WriteAt(x, y int, cell int64)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Int64Table) WriteHorizontalSequence ¶
func (t *Int64Table) WriteHorizontalSequence(x, y *int, sequence []int64)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Int64Table) WriteTableAt ¶
func (t *Int64Table) WriteTableAt(table *Int64Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Int64Table) WriteVerticalSequence ¶
func (t *Int64Table) WriteVerticalSequence(x, y *int, sequence []int64)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Int8Table ¶
type Int8Table struct {
// contains filtered or unexported fields
}
Int8Table represents a table of cells that can be drawn to the screen.
func NewInt8Table ¶
NewInt8Table creates a new table of type int8 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Int8Table: The new table. Never nil.
func (*Int8Table) Cell ¶ added in v0.1.12
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type int8.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Int8Table) Cleanup ¶
func (t *Int8Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type int8.
func (*Int8Table) GetAt ¶
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type int8.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- int8: The cell at the given coordinates.
func (*Int8Table) GetFullTable ¶
GetFullTable returns the full table as a 2D slice of elements of type int8.
Returns:
- [][]int8: The full table.
func (*Int8Table) GetHeight ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Int8Table) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Int8Table) IsXInBounds ¶
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Int8Table) IsYInBounds ¶
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Int8Table) WriteAt ¶
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Int8Table) WriteHorizontalSequence ¶
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Int8Table) WriteTableAt ¶
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Int8Table) WriteVerticalSequence ¶
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type IntTable ¶
type IntTable struct {
// contains filtered or unexported fields
}
IntTable represents a table of cells that can be drawn to the screen.
func NewIntTable ¶
NewIntTable creates a new table of type int with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *IntTable: The new table. Never nil.
func (*IntTable) Cell ¶ added in v0.1.12
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type int.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*IntTable) Cleanup ¶
func (t *IntTable) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type int.
func (*IntTable) GetAt ¶
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type int.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- int: The cell at the given coordinates.
func (*IntTable) GetFullTable ¶
GetFullTable returns the full table as a 2D slice of elements of type int.
Returns:
- [][]int: The full table.
func (*IntTable) GetHeight ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*IntTable) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*IntTable) IsXInBounds ¶
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*IntTable) IsYInBounds ¶
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*IntTable) WriteAt ¶
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*IntTable) WriteHorizontalSequence ¶
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*IntTable) WriteTableAt ¶
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*IntTable) WriteVerticalSequence ¶
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type RuneTable ¶
type RuneTable struct {
// contains filtered or unexported fields
}
RuneTable represents a table of cells that can be drawn to the screen.
func NewRuneTable ¶
NewRuneTable creates a new table of type rune with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *RuneTable: The new table. Never nil.
func (*RuneTable) Cell ¶ added in v0.1.12
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type rune.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*RuneTable) Cleanup ¶
func (t *RuneTable) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type rune.
func (*RuneTable) GetAt ¶
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type rune.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- rune: The cell at the given coordinates.
func (*RuneTable) GetFullTable ¶
GetFullTable returns the full table as a 2D slice of elements of type rune.
Returns:
- [][]rune: The full table.
func (*RuneTable) GetHeight ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*RuneTable) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*RuneTable) IsXInBounds ¶
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*RuneTable) IsYInBounds ¶
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*RuneTable) WriteAt ¶
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*RuneTable) WriteHorizontalSequence ¶
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*RuneTable) WriteTableAt ¶
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*RuneTable) WriteVerticalSequence ¶
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type StringTable ¶
type StringTable struct {
// contains filtered or unexported fields
}
StringTable represents a table of cells that can be drawn to the screen.
func NewStringTable ¶
func NewStringTable(width, height int) *StringTable
NewStringTable creates a new table of type string with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *StringTable: The new table. Never nil.
func (*StringTable) Cell ¶ added in v0.1.12
func (t *StringTable) Cell() iter.Seq[string]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type string.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*StringTable) Cleanup ¶
func (t *StringTable) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type string.
func (*StringTable) GetAt ¶
func (t *StringTable) GetAt(x, y int) string
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type string.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- string: The cell at the given coordinates.
func (*StringTable) GetFullTable ¶
func (t *StringTable) GetFullTable() [][]string
GetFullTable returns the full table as a 2D slice of elements of type string.
Returns:
- [][]string: The full table.
func (*StringTable) GetHeight ¶
func (t *StringTable) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*StringTable) GetWidth ¶
func (t *StringTable) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*StringTable) IsXInBounds ¶
func (t *StringTable) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*StringTable) IsYInBounds ¶
func (t *StringTable) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*StringTable) WriteAt ¶
func (t *StringTable) WriteAt(x, y int, cell string)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*StringTable) WriteHorizontalSequence ¶
func (t *StringTable) WriteHorizontalSequence(x, y *int, sequence []string)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*StringTable) WriteTableAt ¶
func (t *StringTable) WriteTableAt(table *StringTable, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*StringTable) WriteVerticalSequence ¶
func (t *StringTable) WriteVerticalSequence(x, y *int, sequence []string)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Table ¶
type Table[T any] struct { // contains filtered or unexported fields }
Table[T any] represents a table of cells that can be drawn to the screen.
func NewTable ¶
NewTable creates a new table of type T with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Table[T]: The new table. Never nil.
func (*Table[T]) Cell ¶ added in v0.1.12
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type T.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Table[T]) Cleanup ¶
func (t *Table[T]) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type T.
func (*Table[T]) GetAt ¶
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type T.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- T: The cell at the given coordinates.
func (*Table[T]) GetFullTable ¶
func (t *Table[T]) GetFullTable() [][]T
GetFullTable returns the full table as a 2D slice of elements of type T.
Returns:
- [][]T: The full table.
func (*Table[T]) GetHeight ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Table[T]) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Table[T]) IsXInBounds ¶
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Table[T]) IsYInBounds ¶
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Table[T]) WriteAt ¶
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Table[T]) WriteHorizontalSequence ¶
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Table[T]) WriteTableAt ¶
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Table[T]) WriteVerticalSequence ¶
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Uint16Table ¶
type Uint16Table struct {
// contains filtered or unexported fields
}
Uint16Table represents a table of cells that can be drawn to the screen.
func NewUint16Table ¶
func NewUint16Table(width, height int) *Uint16Table
NewUint16Table creates a new table of type uint16 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Uint16Table: The new table. Never nil.
func (*Uint16Table) Cell ¶ added in v0.1.12
func (t *Uint16Table) Cell() iter.Seq[uint16]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type uint16.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Uint16Table) Cleanup ¶
func (t *Uint16Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type uint16.
func (*Uint16Table) GetAt ¶
func (t *Uint16Table) GetAt(x, y int) uint16
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type uint16.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- uint16: The cell at the given coordinates.
func (*Uint16Table) GetFullTable ¶
func (t *Uint16Table) GetFullTable() [][]uint16
GetFullTable returns the full table as a 2D slice of elements of type uint16.
Returns:
- [][]uint16: The full table.
func (*Uint16Table) GetHeight ¶
func (t *Uint16Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Uint16Table) GetWidth ¶
func (t *Uint16Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Uint16Table) IsXInBounds ¶
func (t *Uint16Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Uint16Table) IsYInBounds ¶
func (t *Uint16Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Uint16Table) WriteAt ¶
func (t *Uint16Table) WriteAt(x, y int, cell uint16)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Uint16Table) WriteHorizontalSequence ¶
func (t *Uint16Table) WriteHorizontalSequence(x, y *int, sequence []uint16)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Uint16Table) WriteTableAt ¶
func (t *Uint16Table) WriteTableAt(table *Uint16Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Uint16Table) WriteVerticalSequence ¶
func (t *Uint16Table) WriteVerticalSequence(x, y *int, sequence []uint16)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Uint32Table ¶
type Uint32Table struct {
// contains filtered or unexported fields
}
Uint32Table represents a table of cells that can be drawn to the screen.
func NewUint32Table ¶
func NewUint32Table(width, height int) *Uint32Table
NewUint32Table creates a new table of type uint32 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Uint32Table: The new table. Never nil.
func (*Uint32Table) Cell ¶ added in v0.1.12
func (t *Uint32Table) Cell() iter.Seq[uint32]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type uint32.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Uint32Table) Cleanup ¶
func (t *Uint32Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type uint32.
func (*Uint32Table) GetAt ¶
func (t *Uint32Table) GetAt(x, y int) uint32
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type uint32.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- uint32: The cell at the given coordinates.
func (*Uint32Table) GetFullTable ¶
func (t *Uint32Table) GetFullTable() [][]uint32
GetFullTable returns the full table as a 2D slice of elements of type uint32.
Returns:
- [][]uint32: The full table.
func (*Uint32Table) GetHeight ¶
func (t *Uint32Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Uint32Table) GetWidth ¶
func (t *Uint32Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Uint32Table) IsXInBounds ¶
func (t *Uint32Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Uint32Table) IsYInBounds ¶
func (t *Uint32Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Uint32Table) WriteAt ¶
func (t *Uint32Table) WriteAt(x, y int, cell uint32)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Uint32Table) WriteHorizontalSequence ¶
func (t *Uint32Table) WriteHorizontalSequence(x, y *int, sequence []uint32)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Uint32Table) WriteTableAt ¶
func (t *Uint32Table) WriteTableAt(table *Uint32Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Uint32Table) WriteVerticalSequence ¶
func (t *Uint32Table) WriteVerticalSequence(x, y *int, sequence []uint32)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Uint64Table ¶
type Uint64Table struct {
// contains filtered or unexported fields
}
Uint64Table represents a table of cells that can be drawn to the screen.
func NewUint64Table ¶
func NewUint64Table(width, height int) *Uint64Table
NewUint64Table creates a new table of type uint64 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Uint64Table: The new table. Never nil.
func (*Uint64Table) Cell ¶ added in v0.1.12
func (t *Uint64Table) Cell() iter.Seq[uint64]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type uint64.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Uint64Table) Cleanup ¶
func (t *Uint64Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type uint64.
func (*Uint64Table) GetAt ¶
func (t *Uint64Table) GetAt(x, y int) uint64
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type uint64.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- uint64: The cell at the given coordinates.
func (*Uint64Table) GetFullTable ¶
func (t *Uint64Table) GetFullTable() [][]uint64
GetFullTable returns the full table as a 2D slice of elements of type uint64.
Returns:
- [][]uint64: The full table.
func (*Uint64Table) GetHeight ¶
func (t *Uint64Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Uint64Table) GetWidth ¶
func (t *Uint64Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Uint64Table) IsXInBounds ¶
func (t *Uint64Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Uint64Table) IsYInBounds ¶
func (t *Uint64Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Uint64Table) WriteAt ¶
func (t *Uint64Table) WriteAt(x, y int, cell uint64)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Uint64Table) WriteHorizontalSequence ¶
func (t *Uint64Table) WriteHorizontalSequence(x, y *int, sequence []uint64)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Uint64Table) WriteTableAt ¶
func (t *Uint64Table) WriteTableAt(table *Uint64Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Uint64Table) WriteVerticalSequence ¶
func (t *Uint64Table) WriteVerticalSequence(x, y *int, sequence []uint64)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type Uint8Table ¶
type Uint8Table struct {
// contains filtered or unexported fields
}
Uint8Table represents a table of cells that can be drawn to the screen.
func NewUint8Table ¶
func NewUint8Table(width, height int) *Uint8Table
NewUint8Table creates a new table of type uint8 with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *Uint8Table: The new table. Never nil.
func (*Uint8Table) Cell ¶ added in v0.1.12
func (t *Uint8Table) Cell() iter.Seq[uint8]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type uint8.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*Uint8Table) Cleanup ¶
func (t *Uint8Table) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type uint8.
func (*Uint8Table) GetAt ¶
func (t *Uint8Table) GetAt(x, y int) uint8
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type uint8.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- uint8: The cell at the given coordinates.
func (*Uint8Table) GetFullTable ¶
func (t *Uint8Table) GetFullTable() [][]uint8
GetFullTable returns the full table as a 2D slice of elements of type uint8.
Returns:
- [][]uint8: The full table.
func (*Uint8Table) GetHeight ¶
func (t *Uint8Table) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*Uint8Table) GetWidth ¶
func (t *Uint8Table) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*Uint8Table) IsXInBounds ¶
func (t *Uint8Table) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*Uint8Table) IsYInBounds ¶
func (t *Uint8Table) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*Uint8Table) WriteAt ¶
func (t *Uint8Table) WriteAt(x, y int, cell uint8)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*Uint8Table) WriteHorizontalSequence ¶
func (t *Uint8Table) WriteHorizontalSequence(x, y *int, sequence []uint8)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*Uint8Table) WriteTableAt ¶
func (t *Uint8Table) WriteTableAt(table *Uint8Table, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*Uint8Table) WriteVerticalSequence ¶
func (t *Uint8Table) WriteVerticalSequence(x, y *int, sequence []uint8)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type UintTable ¶
type UintTable struct {
// contains filtered or unexported fields
}
UintTable represents a table of cells that can be drawn to the screen.
func NewUintTable ¶
NewUintTable creates a new table of type uint with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *UintTable: The new table. Never nil.
func (*UintTable) Cell ¶ added in v0.1.12
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type uint.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*UintTable) Cleanup ¶
func (t *UintTable) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type uint.
func (*UintTable) GetAt ¶
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type uint.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- uint: The cell at the given coordinates.
func (*UintTable) GetFullTable ¶
GetFullTable returns the full table as a 2D slice of elements of type uint.
Returns:
- [][]uint: The full table.
func (*UintTable) GetHeight ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*UintTable) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*UintTable) IsXInBounds ¶
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*UintTable) IsYInBounds ¶
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*UintTable) WriteAt ¶
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*UintTable) WriteHorizontalSequence ¶
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*UintTable) WriteTableAt ¶
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*UintTable) WriteVerticalSequence ¶
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.
type UintptrTable ¶
type UintptrTable struct {
// contains filtered or unexported fields
}
UintptrTable represents a table of cells that can be drawn to the screen.
func NewUintptrTable ¶
func NewUintptrTable(width, height int) *UintptrTable
NewUintptrTable creates a new table of type uintptr with the given width and height. Negative parameters are treated as absolute values.
Parameters:
- width: The width of the table.
- height: The height of the table.
Returns:
- *UintptrTable: The new table. Never nil.
func (*UintptrTable) Cell ¶ added in v0.1.12
func (t *UintptrTable) Cell() iter.Seq[uintptr]
Cell returns an iterator that is a pull-model iterator that scans the table row by row as it was an array of elements of type uintptr.
Example:
[ a b c ] [ d e f ] Cell() -> [ a ] -> [ b ] -> [ c ] -> [ d ] -> [ e ] -> [ f ]
func (*UintptrTable) Cleanup ¶
func (t *UintptrTable) Cleanup()
Cleanup is a method that cleans up the table.
It sets all cells in the table to the zero value of type uintptr.
func (*UintptrTable) GetAt ¶
func (t *UintptrTable) GetAt(x, y int) uintptr
GetAt returns the cell at the given coordinates in the table. However, out-of-bounds coordinates return the zero value of type uintptr.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
Returns:
- uintptr: The cell at the given coordinates.
func (*UintptrTable) GetFullTable ¶
func (t *UintptrTable) GetFullTable() [][]uintptr
GetFullTable returns the full table as a 2D slice of elements of type uintptr.
Returns:
- [][]uintptr: The full table.
func (*UintptrTable) GetHeight ¶
func (t *UintptrTable) GetHeight() int
GetHeight returns the height of the table.
Returns:
- int: The height of the table. Never negative.
func (*UintptrTable) GetWidth ¶
func (t *UintptrTable) GetWidth() int
GetWidth returns the width of the table.
Returns:
- int: The width of the table. Never negative.
func (*UintptrTable) IsXInBounds ¶
func (t *UintptrTable) IsXInBounds(x int) error
IsXInBounds checks if the given x-coordinate is within the bounds of the table.
Parameters:
- x: The x-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the x-coordinate is out of bounds.
func (*UintptrTable) IsYInBounds ¶
func (t *UintptrTable) IsYInBounds(y int) error
IsYInBounds checks if the given y-coordinate is within the bounds of the table.
Parameters:
- y: The y-coordinate to check.
Returns:
- error: An error of type *ints.ErrOutOfBounds if the y-coordinate is out of bounds.
func (*UintptrTable) WriteAt ¶
func (t *UintptrTable) WriteAt(x, y int, cell uintptr)
WriteAt writes a cell to the table at the given coordinates. However, out-of-bounds coordinates do nothing.
Parameters:
- x: The x-coordinate of the cell.
- y: The y-coordinate of the cell.
- cell: The cell to write to the table.
func (*UintptrTable) WriteHorizontalSequence ¶
func (t *UintptrTable) WriteHorizontalSequence(x, y *int, sequence []uintptr)
WriteHorizontalSequence is the equivalent of WriteVerticalSequence but for horizontal sequences.
See WriteVerticalSequence for more information.
Parameters:
- x: The x-coordinate of the starting cell.
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
func (*UintptrTable) WriteTableAt ¶
func (t *UintptrTable) WriteTableAt(table *UintptrTable, x, y *int)
WriteTableAt is a convenience function that copies the values from the given table to the table starting at the given coordinates in a more efficient way than using any other methods.
While it acts in the same way as both WriteVerticalSequence and WriteHorizontalSequence combined, it is more efficient than calling those two functions separately.
See WriteVerticalSequence for more information.
Parameters:
- table: The table to write to the table.
- x: The x-coordinate to write the table at.
- y: The y-coordinate to write the table at.
If the table is nil, x or y are nil, nothing happens.
func (*UintptrTable) WriteVerticalSequence ¶
func (t *UintptrTable) WriteVerticalSequence(x, y *int, sequence []uintptr)
WriteVerticalSequence is a function that writes the specified values to the table starting from the specified coordinates (top = 0, 0) and continuing down the table in the vertical direction until either the sequence is exhausted or the end of the table is reached; at which point any remaining values in the sequence are ignored.
Due to implementation details, any value that would be written outside are ignored. As such, if x is out-of-bounds, the function does nothing and, if y is out-of-bounds, only out-of-bounds values are not written.
Parameters:
- x: The x-coordinate of the starting cell. (Never changes)
- y: The y-coordinate of the starting cell.
- sequence: The sequence of cells to write to the table.
At the end of the function, the y coordinate points to the cell right below the last cell in the sequence that was written.
Example:
// [ a b c ] // [ d e f ] // // seq := [ g h i ], x = 0, y = -1 WriteVerticalSequence(x, y, seq) // [ h b c ] // [ i e f ] // // x = 0, y = 2
As you can see, the 'g' value was ignored as it would be out-of-bounds. Finally, if either x or y is nil, the function does nothing.