koromo

package module
v0.0.0-...-4628ecc Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func LoadImage

func LoadImage(path string) (*eb.Image, error)

LoadImage wraps ebitenutil.NewImageFromFile

func Rot

func Rot(n float64) complex128

Rot returns (360/n)° rotated unit vector

func UWave

func UWave(ratio, offset 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, offset float64) float64

Wave returns sin(2π*ratio)

Types

type Rect

type Rect struct {
	// 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) Height

func (r *Rect) Height() float64

Height is getter

func (*Rect) Move

func (r *Rect) Move(anchor int, x, y float64)

Move sets position relatively

func (*Rect) Pos

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

Pos returns relative position

func (*Rect) Resize

func (r *Rect) Resize(origAnchor, newAnchor int, diffX, diffY float64) *Rect

Resize returns a new resized rect, no breaking changes

func (*Rect) Scale

func (r *Rect) Scale(origAnchor, newAnchor int, 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) Width

func (r *Rect) Width() float64

Width is getter

type Stm

type Stm struct {
	// contains filtered or unexported fields
}

Stm is a simple state keeper

func (*Stm) Continue

func (s *Stm) Continue(next int)

Continue changes state not to reset count

func (Stm) Current

func (s Stm) Current() int

Current returns current state

func (Stm) Elapsed

func (s Stm) Elapsed() int

Elapsed returns elapsed count from changing state

func (Stm) ElapsedRatio

func (s Stm) ElapsedRatio(base int) float64

ElapsedRatio returns count / base

func (Stm) HasElapsed

func (s Stm) HasElapsed(frames int) bool

HasElapsed reports the time has elapsed or not

func (*Stm) Reset

func (s *Stm) Reset()

Reset resets the count

func (*Stm) To

func (s *Stm) To(next int)

To changes current state

func (*Stm) Update

func (s *Stm) Update()

Update increments the count

Jump to

Keyboard shortcuts

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