Documentation ¶
Index ¶
- Constants
- Variables
- func DegToRad(x float64) float64
- func DirectionToFloatingPoint(direction float64) FloatingPoint
- func Float64Between(low, high float64) float64
- func FloatingPointToDirection(point FloatingPoint) float64
- func HsvToRgb(hue, saturation, value float64) (r, g, b int)
- func Int64Between(low, high int64) int64
- func OneOrMinusOne() float64
- func RadToDeg(x float64) float64
- func RandomFile(dir string, suffixes []string) (*string, error)
- func ReadBeanGif() (*[]image.Image, *[]time.Duration, *image.Rectangle)
- func ReadGif(imgPath *string, targetSize Point) (*[]image.Image, *[]time.Duration, *image.Rectangle)
- func ReadJpg(imgPath *string) *image.Image
- func ReadPng(imgPath *string) *image.Image
- func Rotate(p, o Point, degrees float64) Point
- func RotateOrigin(fp FloatingPoint, degrees float64) FloatingPoint
- func TimeToText(t time.Time) string
- type Acceleration
- type Component
- type CompositeDrawable
- func (cd *CompositeDrawable) AddDrawable(drawable Drawable)
- func (cd *CompositeDrawable) AddDrawables(drawables ...Drawable)
- func (cd *CompositeDrawable) DisableDrawable(drawable Drawable)
- func (cd *CompositeDrawable) Draw(canvas canvas.Canvas) error
- func (cd *CompositeDrawable) EnableDrawable(drawable Drawable)
- func (cd *CompositeDrawable) RemoveDrawable(d Drawable)
- type ConstantAcceleration
- type Drawable
- type Graphic
- type Layout
- type MaskedDrawable
- type Movement
- type Physics
- type Updatable
Constants ¶
View Source
const BOTTOM float64 = 90
View Source
const BOTTOM_LEFT float64 = 135
View Source
const BOTTOM_RIGHT float64 = 45
View Source
const LEFT float64 = 180
View Source
const RIGHT float64 = 0
View Source
const TOP float64 = 270
View Source
const TOP_LEFT float64 = 225
View Source
const TOP_RIGHT float64 = 315
Variables ¶
View Source
var ColorBlack color.Color = color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff}
View Source
var ColorBlue color.Color = color.RGBA{R: 0x00, G: 0x00, B: 0xff, A: 0xff}
View Source
var ColorGreen color.Color = color.RGBA{R: 0x00, G: 0xff, B: 0x00, A: 0xff}
View Source
var ColorRed color.Color = color.RGBA{R: 0xff, G: 0x00, B: 0x00, A: 0xff}
View Source
var ColorViolet color.Color = color.RGBA{R: 0xff, G: 0x00, B: 0xff, A: 0xff}
View Source
var ColorWhite color.Color = color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
View Source
var ColorYellow color.Color = color.RGBA{R: 0xff, G: 0xff, B: 0x00, A: 0xff}
View Source
var ImagesSuffixes = []string{".jpg", ".png", ".gif"}
View Source
var None = Origin
View Source
var Origin = Point{}
View Source
var Random = rand.New(randomSource)
Functions ¶
func DirectionToFloatingPoint ¶
func DirectionToFloatingPoint(direction float64) FloatingPoint
Cartesian coordinates from angle (degrees)
func Float64Between ¶
func FloatingPointToDirection ¶
func FloatingPointToDirection(point FloatingPoint) float64
Angle (degrees) from cartesian coordinates
func Int64Between ¶
func OneOrMinusOne ¶
func OneOrMinusOne() float64
func RotateOrigin ¶
func RotateOrigin(fp FloatingPoint, degrees float64) FloatingPoint
func TimeToText ¶
Types ¶
type Acceleration ¶
type Acceleration interface { // Returns (dVx, dVy) in Pixels per second NextVelocityDelta(dtInSeconds float64) FloatingPoint // Direction in Degrees, reference is RIGHT Direction() float64 }
var Gravity Acceleration = ConstantAcceleration{/* contains filtered or unexported fields */}
type CompositeDrawable ¶
type CompositeDrawable struct { Graphic *Graphic Drawables []*disablableDrawable }
func NewCompositeDrawable ¶
func NewCompositeDrawable(graphic *Graphic) *CompositeDrawable
func (*CompositeDrawable) AddDrawable ¶
func (cd *CompositeDrawable) AddDrawable(drawable Drawable)
func (*CompositeDrawable) AddDrawables ¶
func (cd *CompositeDrawable) AddDrawables(drawables ...Drawable)
func (*CompositeDrawable) DisableDrawable ¶
func (cd *CompositeDrawable) DisableDrawable(drawable Drawable)
func (*CompositeDrawable) EnableDrawable ¶
func (cd *CompositeDrawable) EnableDrawable(drawable Drawable)
func (*CompositeDrawable) RemoveDrawable ¶
func (cd *CompositeDrawable) RemoveDrawable(d Drawable)
type ConstantAcceleration ¶
type ConstantAcceleration struct {
// contains filtered or unexported fields
}
func NewConstantAcceleration ¶
func NewConstantAcceleration(acceleration, direction float64) *ConstantAcceleration
func (ConstantAcceleration) Direction ¶
func (a ConstantAcceleration) Direction() float64
func (ConstantAcceleration) NextVelocityDelta ¶
func (a ConstantAcceleration) NextVelocityDelta(dtInSeconds float64) FloatingPoint
func (ConstantAcceleration) SetAcceleration ¶
func (a ConstantAcceleration) SetAcceleration(acceleration float64)
func (ConstantAcceleration) SetDirection ¶
func (a ConstantAcceleration) SetDirection(direction float64)
type Graphic ¶
type Graphic struct {
// contains filtered or unexported fields
}
func NewGraphic ¶
func NewOffsetGraphic ¶
func (*Graphic) ComputedOffset ¶
func (g *Graphic) ComputedOffset() Point
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
func DefaultLayout ¶
func DefaultLayout() *Layout
func (*Layout) BackgroundColor ¶
type MaskedDrawable ¶
type MaskedDrawable struct {
// contains filtered or unexported fields
}
func (MaskedDrawable) Draw ¶
func (md MaskedDrawable) Draw(canvas Canvas) error
override Drawable.Draw method to perform indirection with effect
type Movement ¶
type Movement struct {
// contains filtered or unexported fields
}
func NewBoundedMovement ¶
func NewBoundedMovement(initialPosition, initialVelocity FloatingPoint, accelerations *[]Acceleration, bounds *image.Rectangle) *Movement
func NewMovement ¶
func NewMovement(initialPosition, initialVelocity FloatingPoint, accelerations *[]Acceleration) *Movement
func (*Movement) NextPosition ¶
TODO: consider max values for accelerations Return the next position to use
func (*Movement) SetVelocity ¶
func (m *Movement) SetVelocity(velocity FloatingPoint)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.