commenting

This commit is contained in:
probandula
2016-10-26 21:40:02 +02:00
parent c3b6433632
commit 7a8557b6ac
3 changed files with 4 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import (
"strings" "strings"
) )
// Represents a single ascii character
type AsciiChar struct { type AsciiChar struct {
// Slice with the lines of the Char // Slice with the lines of the Char
Lines []string Lines []string
@@ -13,6 +14,7 @@ type AsciiChar struct {
Color color.Attribute Color color.Attribute
} }
// Creates a new ascii character
func NewAsciiChar(font *font, char rune) (*AsciiChar, error) { func NewAsciiChar(font *font, char rune) (*AsciiChar, error) {
// If not ascii, throw an error // If not ascii, throw an error
if char < 0 || char > 127 { if char < 0 || char > 127 {
@@ -24,6 +26,7 @@ func NewAsciiChar(font *font, char rune) (*AsciiChar, error) {
lines := make([]string, height) lines := make([]string, height)
// Get the char lines of the char
for i := 0; i < height; i++ { for i := 0; i < height; i++ {
row := font.fontSlice[beginRow+i] row := font.fontSlice[beginRow+i]
row = strings.Replace(row, "@", "", -1) row = strings.Replace(row, "@", "", -1)

View File

@@ -97,7 +97,6 @@ func getColorSlice(colorStr string) []color.Attribute {
} }
return colors return colors
} }
// Validate if all required options are given // Validate if all required options are given

View File

@@ -49,7 +49,7 @@ func (ar *AsciiRender) Render(str string) (string, error) {
// Can be called from the user (if options wished) or the above Render method // Can be called from the user (if options wished) or the above Render method
// Contains the whole rendering logic // Contains the whole rendering logic
func (ar *AsciiRender) RenderOpts(str string, opt *RenderOptions) (string, error) { func (ar *AsciiRender) RenderOpts(str string, opt *RenderOptions) (string, error) {
// Should the text be colored
colored := len(opt.FontColor) > 0 colored := len(opt.FontColor) > 0
// Load the font // Load the font