Documentation
¶
Index ¶
- Constants
- Variables
- func GetLetterMap() map[byte]func() Letter
- type Cell
- type CellDrawer
- type Letter
- type Segment
- type SegmentABar
- type SegmentARisingStick
- type SegmentDCurve
- type SegmentELower
- type SegmentEMiddle
- type SegmentIBottom
- type SegmentID
- type SegmentIMiddle
- type SegmentITop
- type SegmentKLower
- type SegmentKUpper
- type SegmentNBar
- type SegmentNLeftVert
- type SegmentNRightVert
- type SegmentSLowerBar
- type SegmentSMiddle
- type SegmentSUpperBar
- type SegmentState
Constants ¶
const ( DefaultWidth float64 = 51. DefaultHeight float64 = 85. )
Default dimensions of the original segment's cell
const ( DGapThinnest = 5 DDiagonalHeight = DefaultHeight / 4 )
Sizes a D
const ( StateFadein = iota StateSolid StateFadeout )
Possible states of a segment
const ABarUpperHeight = DefaultHeight - 35
ABarUpperHeight is the height of the line through the centre of an A
const EEdgeDepth = 5
EEdgeDepth is how far in the centre line of the E is from the right
const EPointDepth = 13
EPointDepth is how far in the dip on the left of an E goes in
const IOverhang = 7
IOverhang is how far the top bar of an I hangs over
const SStickLength = 7
SStickLength is the length of the sticks on the tops and bottoms of an S
Variables ¶
var ( ColorsDeath = [2]color.RGBA{ {0x31, 0x34, 0x16, 0xff}, {0x95, 0x97, 0x7E, 0xff}, } ColorsParadox = [2]color.RGBA{ {0x50, 0x41, 0x39, 0xff}, {0x00, 0x00, 0x00, 0xff}, } )
Original Colours
Functions ¶
func GetLetterMap ¶
GetLetterMap returns a map to get the functions corresponding to each letter
Types ¶
type Cell ¶
type Cell struct {
TopLeft [2]float64
BottomRight [2]float64
Segments []Segment
DeathColors [2]color.RGBA
ParadoxColors [2]color.RGBA
LetterColor color.Color
}
Cell represents a single cell containing LetterSegments
func NewCell ¶
func NewCell(topLeft, bottomRight [2]float64, segments []Segment, deathColors, paradoxColors [2]color.RGBA) *Cell
NewCell creates a new Cell. The color arguments take an array of two colors, the first is the background and the second is the foreground.
func (*Cell) Draw ¶
func (cell *Cell) Draw(gc *draw2dimg.GraphicContext) bool
Draw calls the Draw method for all of its segments for them to render onto it. The image is then rendered onto the main context.
type CellDrawer ¶
type CellDrawer interface {
Fill(paths ...*draw2d.Path)
FillStroke(paths ...*draw2d.Path)
Stroke(paths ...*draw2d.Path)
Close()
SetFillColor(c color.Color)
SetStrokeColor(c color.Color)
MoveTo(x, y float64)
LineTo(x, y float64)
}
CellDrawer represents a type that contains all of the drawing functions needed by a segment in order to draw within the cell
func NewCellDrawer ¶
func NewCellDrawer(gc *draw2dimg.GraphicContext, cell *Cell, segment Segment) CellDrawer
NewCellDrawer creates a CellDrawer for allowing a segment to draw within a cell. It allows the Cell and the segment's reference sizes to be different, and will translate between one and the other to simplify the construction of segment drawing procedures.
type Letter ¶
type Letter []Segment
Letter defines a custom type for full letters. A letter is defined as a slice of segments.
type Segment ¶
type Segment interface {
Width() float64
Height() float64
Draw(CellDrawer, *Cell) bool // defined for each type
ID() SegmentID // defined for each type
}
Segment is an interface representing a segment of a letter. Any coordinates used should be defined in terms of the cell
type SegmentABar ¶
type SegmentABar struct {
// contains filtered or unexported fields
}
SegmentABar is the horizontal line through an A
func (*SegmentABar) Draw ¶
func (seg *SegmentABar) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
type SegmentARisingStick ¶
type SegmentARisingStick struct {
// contains filtered or unexported fields
}
SegmentARisingStick is one of the parts of an A
/ / / / | | | |
func (*SegmentARisingStick) Draw ¶
func (seg *SegmentARisingStick) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentARisingStick) Height ¶
func (seg *SegmentARisingStick) Height() float64
Height returns the Height of the segment
func (*SegmentARisingStick) ID ¶
func (seg *SegmentARisingStick) ID() SegmentID
ID returns the ID of the segment
type SegmentDCurve ¶
type SegmentDCurve struct {
// contains filtered or unexported fields
}
SegmentDCurve is the curved line of a D
func (*SegmentDCurve) Draw ¶
func (seg *SegmentDCurve) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentDCurve) Height ¶
func (seg *SegmentDCurve) Height() float64
Height returns the Height of the segment
func (*SegmentDCurve) ID ¶
func (seg *SegmentDCurve) ID() SegmentID
ID returns the ID of the segment
type SegmentELower ¶
type SegmentELower struct {
// contains filtered or unexported fields
}
SegmentELower is the lower bar on an E
func (*SegmentELower) Draw ¶
func (seg *SegmentELower) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentELower) Height ¶
func (seg *SegmentELower) Height() float64
Height returns the Height of the segment
func (*SegmentELower) ID ¶
func (seg *SegmentELower) ID() SegmentID
ID returns the ID of the segment
type SegmentEMiddle ¶
type SegmentEMiddle struct {
// contains filtered or unexported fields
}
SegmentEMiddle is the centre segment of an E
func (*SegmentEMiddle) Draw ¶
func (seg *SegmentEMiddle) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentEMiddle) Height ¶
func (seg *SegmentEMiddle) Height() float64
Height returns the Height of the segment
func (*SegmentEMiddle) ID ¶
func (seg *SegmentEMiddle) ID() SegmentID
ID returns the ID of the segment
type SegmentIBottom ¶
type SegmentIBottom struct {
// contains filtered or unexported fields
}
SegmentIBottom is the line below an I
func (*SegmentIBottom) Draw ¶
func (seg *SegmentIBottom) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentIBottom) Height ¶
func (seg *SegmentIBottom) Height() float64
Height returns the Height of the segment
func (*SegmentIBottom) ID ¶
func (seg *SegmentIBottom) ID() SegmentID
ID returns the ID of the segment
type SegmentIMiddle ¶
type SegmentIMiddle struct {
// contains filtered or unexported fields
}
SegmentIMiddle is the line through the centre of an I
func (*SegmentIMiddle) Draw ¶
func (seg *SegmentIMiddle) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentIMiddle) Height ¶
func (seg *SegmentIMiddle) Height() float64
Height returns the Height of the segment
func (*SegmentIMiddle) ID ¶
func (seg *SegmentIMiddle) ID() SegmentID
ID returns the ID of the segment
type SegmentITop ¶
type SegmentITop struct {
// contains filtered or unexported fields
}
SegmentITop is the line atop an I
func (*SegmentITop) Draw ¶
func (seg *SegmentITop) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
type SegmentKLower ¶
type SegmentKLower struct {
// contains filtered or unexported fields
}
SegmentKLower is the upper part of a K
func (*SegmentKLower) Draw ¶
func (seg *SegmentKLower) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentKLower) Height ¶
func (seg *SegmentKLower) Height() float64
Height returns the Height of the segment
func (*SegmentKLower) ID ¶
func (seg *SegmentKLower) ID() SegmentID
ID returns the ID of the segment
type SegmentKUpper ¶
type SegmentKUpper struct {
// contains filtered or unexported fields
}
SegmentKUpper is the upper part of a K
func (*SegmentKUpper) Draw ¶
func (seg *SegmentKUpper) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentKUpper) Height ¶
func (seg *SegmentKUpper) Height() float64
Height returns the Height of the segment
func (*SegmentKUpper) ID ¶
func (seg *SegmentKUpper) ID() SegmentID
ID returns the ID of the segment
type SegmentNBar ¶
type SegmentNBar struct {
// contains filtered or unexported fields
}
SegmentNBar is the vertical bar across the top of an N
func (*SegmentNBar) Draw ¶
func (seg *SegmentNBar) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
type SegmentNLeftVert ¶
type SegmentNLeftVert struct {
// contains filtered or unexported fields
}
SegmentNLeftVert is the vertical line on the right hand side of an N
func (*SegmentNLeftVert) Draw ¶
func (seg *SegmentNLeftVert) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentNLeftVert) Height ¶
func (seg *SegmentNLeftVert) Height() float64
Height returns the Height of the segment
func (*SegmentNLeftVert) ID ¶
func (seg *SegmentNLeftVert) ID() SegmentID
ID returns the ID of the segment
type SegmentNRightVert ¶
type SegmentNRightVert struct {
// contains filtered or unexported fields
}
SegmentNRightVert is the vertical line on the right hand side of an N
func (*SegmentNRightVert) Draw ¶
func (seg *SegmentNRightVert) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentNRightVert) Height ¶
func (seg *SegmentNRightVert) Height() float64
Height returns the Height of the segment
func (*SegmentNRightVert) ID ¶
func (seg *SegmentNRightVert) ID() SegmentID
ID returns the ID of the segment
type SegmentSLowerBar ¶
type SegmentSLowerBar struct {
// contains filtered or unexported fields
}
SegmentSLowerBar is the bottom bar on an S
func (*SegmentSLowerBar) Draw ¶
func (seg *SegmentSLowerBar) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentSLowerBar) Height ¶
func (seg *SegmentSLowerBar) Height() float64
Height returns the Height of the segment
func (*SegmentSLowerBar) ID ¶
func (seg *SegmentSLowerBar) ID() SegmentID
ID returns the ID of the segment
type SegmentSMiddle ¶
type SegmentSMiddle struct {
// contains filtered or unexported fields
}
SegmentSMiddle is the middle section of an S
func (*SegmentSMiddle) Draw ¶
func (seg *SegmentSMiddle) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentSMiddle) Height ¶
func (seg *SegmentSMiddle) Height() float64
Height returns the Height of the segment
func (*SegmentSMiddle) ID ¶
func (seg *SegmentSMiddle) ID() SegmentID
ID returns the ID of the segment
type SegmentSUpperBar ¶
type SegmentSUpperBar struct {
// contains filtered or unexported fields
}
SegmentSUpperBar is the top bar on an S
func (*SegmentSUpperBar) Draw ¶
func (seg *SegmentSUpperBar) Draw(gc CellDrawer, cell *Cell) bool
Draw defines the behaviour of the segment
func (*SegmentSUpperBar) Height ¶
func (seg *SegmentSUpperBar) Height() float64
Height returns the Height of the segment
func (*SegmentSUpperBar) ID ¶
func (seg *SegmentSUpperBar) ID() SegmentID
ID returns the ID of the segment
type SegmentState ¶
type SegmentState int
SegmentState is a type used for storing various internal states of the segments