draw

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Border

func Border(decoration string)

func BotRight

func BotRight() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

BotRight is an Anchor on the bottom-right corner of the game window.

func Center

func Center() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

Center is an Anchor in the center-middle of the terminal that draws from the center outward.

func CenterLeft

func CenterLeft() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

CenterLeft is an Anchor in the center-middle of the terminal that draws toward the left side.

func CenterRight

func CenterRight() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

CenterRight is an Anchor in the center-middle of the terminal that draws toward the right side.

func CenterTop

func CenterTop() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

CenterTop is an Anchor in the center-middle of the terminal that draws toward the top.

func Draw

func Draw(anchor Anchor, color Color, text interface{})

Draw is a general function for drawing to the terminal. The text can be a rune, a string, or a multiline string, which will be drawn relative to the specified anchor. This function should always be used instead of termbox.SetCell().

func Green

func Green() (fg, bg termbox.Attribute)

Green is not a creative Color.

func Inverted

func Inverted() (fg, bg termbox.Attribute)

Inverted is a Color that inverts the text and background color to appear as a highlight.

func Magenta

func Magenta() (fg, bg termbox.Attribute)

Magenta is a magenta Color.

func MiddleLeft added in v0.0.3

func MiddleLeft() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

MiddleLeft is an Anchor that is vertically centered and on the left edge of the game window.

func MiddleRight

func MiddleRight() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

MiddleRight is an Anchor that is vertically centered and on the right edge of the game window.

func Normal

func Normal() (fg, bg termbox.Attribute)

Normal is the default Color.

func Origin

func Origin() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

Origin is an Anchor on the top-left corner of the terminal window.

func SetCursor

func SetCursor(anchor Anchor)

SetCursor uses an Anchor to determine the position of the cursor, so it can be used in conjunction with Draw to place the cursor.

func TopLeft

func TopLeft() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

TopLeft is an Anchor on the top-left corner of the game window.

func TopRight

func TopRight() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

TopRight is an Anchor on the top-right corner of the game window.

Types

type Anchor

type Anchor func() (positionX, positionY int, drawDirectionX, drawDirectionY float64)

Anchor defines a position offset and direction that can be used for drawing.

func Offset

func Offset(anchor Anchor, x, y int) Anchor

Offset returns an Anchor that is cffset from the specified Anchor by a specified position.

type Color

type Color func() (fg, bg termbox.Attribute)

Color defines foreground and background attributes for drawing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL