mirror of https://github.com/liamg/aminal.git
50 lines
704 B
Go
50 lines
704 B
Go
package buffer
|
|
|
|
type Cell struct {
|
|
r rune
|
|
attr CellAttributes
|
|
}
|
|
|
|
type CellAttributes struct {
|
|
FgColour [3]float32
|
|
BgColour [3]float32
|
|
Bold bool
|
|
Dim bool
|
|
Underline bool
|
|
Blink bool
|
|
Reverse bool
|
|
Hidden bool
|
|
}
|
|
|
|
func (cell *Cell) Attr() CellAttributes {
|
|
return cell.attr
|
|
}
|
|
|
|
func (cell *Cell) Rune() rune {
|
|
return cell.r
|
|
}
|
|
|
|
func (cell *Cell) Fg() [3]float32 {
|
|
return cell.attr.FgColour
|
|
}
|
|
|
|
func (cell *Cell) Bg() [3]float32 {
|
|
return cell.attr.BgColour
|
|
}
|
|
|
|
func (cell *Cell) erase() {
|
|
cell.setRune(0)
|
|
}
|
|
|
|
func (cell *Cell) setRune(r rune) {
|
|
cell.r = r
|
|
}
|
|
|
|
func NewBackgroundCell(colour [3]float32) Cell {
|
|
return Cell{
|
|
attr: CellAttributes{
|
|
BgColour: colour,
|
|
},
|
|
}
|
|
}
|