sio

package module
v0.0.0-...-8d513b9 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2018 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEmHeight   = 12.0
	DefaultEmWidth    = 6.0
	DefaultLineHeight = 1.3
)

Text Drawing Status

View Source
var (
	// ErrSuccess represents successfully finished
	ErrSuccess = errors.New("successfully finished")
)

Functions

func AbsSq

func AbsSq(c complex128) float64

AbsSq returns abs*abs, more faster

func Cross

func Cross(a, b complex128) complex128

func Ctof

func Ctof(c complex128) (float64, float64)

Ctof converts complex128 into 2 float64s

func Dot

func Dot(a, b complex128) complex128

func Normalize

func Normalize(c complex128) complex128

Normalize returns normalized vector.

func Rot

func Rot(n float64) complex128

Rot returns (360/n)° rotated unit vector

func UWave

func UWave(ratio float64) float64

UWave returns unsigned Wave, [0.0, 1.0]

func UnitVector

func UnitVector(angle float64) complex128

UnitVector returns rotated unit vector

func Wave

func Wave(ratio float64) float64

Wave returns sin(2π*ratio)

Types

type Rect

type Rect struct {
	X, Y, W, H float64
	// contains filtered or unexported fields
}

Rect is a simple rect

func NewRect

func NewRect(anchor int, X, Y, W, H float64) *Rect

NewRect returns a neW rect. Position is Hidden, use Pos metHod.

func (*Rect) CPos

func (r *Rect) CPos(anchor int) complex128

func (*Rect) Clone

func (r *Rect) Clone(oldAnchor, neWAnchor int) *Rect

Clone clones tHe rect, able to set neW anchor

func (*Rect) Contains

func (r *Rect) Contains(pos complex128) bool

Contains reports it contains tHe point

func (*Rect) ContainsF

func (r *Rect) ContainsF(X, Y float64) bool

ContainsF reports it contains tHe point

func (*Rect) Drive

func (r *Rect) Drive(anchor int) *Rect

Drive cHanges tHe anchor

func (*Rect) Intersects

func (r *Rect) Intersects(rHs *Rect) bool

Intersects reports WHetHer tHe rects intersect.

func (*Rect) Move

func (r *Rect) Move(X, Y float64) *Rect

Move sets position relativelY

func (*Rect) NewTextBox

func (r *Rect) NewTextBox(text string, anchor int) *TextBox

func (*Rect) Pos

func (r *Rect) Pos(anchor int) (float64, float64)

Pos returns relative position

func (*Rect) RandPos

func (r *Rect) RandPos() (float64, float64)

func (*Rect) Resize

func (r *Rect) Resize(diffX, diffY float64) *Rect

Resize resizes tHe rect.

func (*Rect) Scale

func (r *Rect) Scale(scaleX, scaleY float64) *Rect

Scale returns a neW scaled rect

func (*Rect) Set

func (r *Rect) Set(anchor int, X, Y, W, H float64)

Set sets tHe data

func (*Rect) SetSize

func (r *Rect) SetSize(w, h float64) *Rect

func (*Rect) Shift

func (r *Rect) Shift(x, y float64) *Rect

Shift shifts the rect relatively.

func (*Rect) Wraps

func (r *Rect) Wraps(rHs *Rect) bool

Wraps reports WHetHer tHe passed rect is Wrapped bY tHe rect.

type TextBox

type TextBox struct {
	Anchor            int
	Rect              *Rect
	EmHeight, EmWidth float64
	LineHeight        float64
	// contains filtered or unexported fields
}

type TextRow

type TextRow struct {
	Text string
	X, Y int
}

func TextRows

func TextRows(text string, re *Rect) []TextRow

type Timer

type Timer struct {
	State        string
	Count, Limit int
}

func NewTimer

func NewTimer(state string) *Timer

func (*Timer) After

func (t *Timer) After(b int, f func(Timer))

func (*Timer) Continue

func (t *Timer) Continue(state string)

func (*Timer) Do

func (t *Timer) Do(b, e int, f func(Timer)) (then Timer)

func (*Timer) IsLast

func (t *Timer) IsLast() bool

func (*Timer) Loop

func (t *Timer) Loop(duration int, f func(Timer))

func (*Timer) Once

func (t *Timer) Once(f func())

func (*Timer) Ratio

func (t *Timer) Ratio() float64

func (*Timer) RatioTo

func (t *Timer) RatioTo(count int) float64

func (*Timer) Switch

func (t *Timer) Switch(state string)

func (*Timer) Update

func (t *Timer) Update()

type TimersMap

type TimersMap map[string]*Timer

func (TimersMap) UpdateAll

func (tm TimersMap) UpdateAll()

Jump to

Keyboard shortcuts

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