Documentation ¶
Index ¶
- Constants
- Variables
- func CrossProduct(this, that Point) float32
- func DotProduct(this, that Point) float32
- func Exit()
- func FloatEqual(a, b float32) bool
- func FloatEqualThreshold(a, b, epsilon float32) bool
- func Height() float32
- func LineTraceFraction(tracer, boundary Line) float32
- func LoadShader(vertSrc, fragSrc string) *webgl.Program
- func MultiplyMatrixVector(m *Matrix, v []float32) []float32
- func Open(title string, width, height int, fullscreen bool, hideCursor bool, r Responder)
- func SetBg(color uint32)
- func Width() float32
- type AABB
- type AABBer
- type Action
- type Animation
- func (anim *Animation) GetDelay() time.Duration
- func (anim *Animation) GetFrame() int
- func (anim *Animation) GetTotalFrames() int
- func (anim *Animation) NextFrame() int
- func (anim *Animation) Play(num int)
- func (anim *Animation) ResetTime()
- func (anim *Animation) SetDelay(d time.Duration)
- func (anim *Animation) SetFrame(n int)
- func (anim *Animation) SetTotalFrames(total int)
- func (anim *Animation) Stop()
- type Assets
- type Batch
- type BatchLine
- type Camera
- type Clock
- type Container
- type Drawable
- type Font
- type Game
- func (g *Game) Close()
- func (g *Game) Key(key Key, modifier Modifier, action Action)
- func (g *Game) Mouse(x, y float32, button Key, action Action)
- func (g *Game) Preload()
- func (g *Game) Render()
- func (g *Game) Resize(w, h float32)
- func (g *Game) Scroll(amount float32)
- func (g *Game) Setup()
- func (g *Game) Type(char rune)
- func (g *Game) Update(dt float32)
- type Image
- type ImageObject
- type Key
- type Line
- type Loader
- type Matrix
- func (m *Matrix) Identity() *Matrix
- func (m *Matrix) Multiply(m2 *Matrix) *Matrix
- func (m *Matrix) Rotate(deg float32) *Matrix
- func (m *Matrix) RotateRad(rad float32) *Matrix
- func (m *Matrix) RotationComponent() float32
- func (m *Matrix) RotationComponentRad() float32
- func (m *Matrix) Scale(x, y float32) *Matrix
- func (m *Matrix) ScaleComponent() (x, y float32)
- func (m *Matrix) Set(val []float32) *Matrix
- func (m *Matrix) Translate(x, y float32) *Matrix
- func (m *Matrix) TranslatePoint(p Point) *Matrix
- func (m *Matrix) TranslationComponent() (x, y float32)
- type Modifier
- type Point
- func (p *Point) Add(p2 Point) *Point
- func (p *Point) AddScalar(s float32) *Point
- func (p *Point) Equal(p2 Point) bool
- func (p *Point) Multiply(p2 Point) *Point
- func (p *Point) MultiplyMatrixVector(m *Matrix) *Point
- func (p *Point) MultiplyScalar(s float32) *Point
- func (p *Point) Normalize() (Point, float32)
- func (p *Point) PointDistance(p2 Point) float32
- func (p *Point) PointDistanceSquared(p2 Point) float32
- func (p *Point) ProjectOnto(p2 Point) Point
- func (p *Point) Set(x, y float32) *Point
- func (p *Point) Subtract(p2 Point) *Point
- func (p *Point) SubtractScalar(s float32) *Point
- func (p Point) Within(c Container) bool
- type Region
- type Resource
- type Responder
- type Sound
- type Sprite
- type Texture
- type Timer
- type Trace
Constants ¶
const ( // Epsilon is some tiny value that determines how precisely equal we want our // floats to be. Epsilon float32 = 1e-3 // MinNormal is the smallest normal value possible. MinNormal = float32(1.1754943508222875e-38) // 1 / 2**(127 - 1) // RadToDeg is multiplied with a radian value to get the equivalant value in degrees. RadToDeg = 180 / math.Pi // DegToRad is multiplied with a degree value to get the equivalent value in radians. DegToRad = math.Pi / 180 )
Variables ¶
var ( NONE = Action(0) MOVE = Action(1) PRESS = Action(2) RELEASE = Action(3) REPEAT = Action(4) SHIFT = Modifier(0x0001) CONTROL = Modifier(0x0002) ALT = Modifier(0x0004) SUPER = Modifier(0x0008) )
var ( MouseLeft = Key(-1) MouseRight = Key(-2) MouseMiddle = Key(-3) BoardDash = Key(189) BoardApostrophe = Key(222) BoardSemicolon = Key(186) BoardEquals = Key(187) BoardComma = Key(188) BoardPeriod = Key(190) BoardSlash = Key(191) BoardBackslash = Key(220) BoardBackspace = Key(8) BoardTab = Key(9) BoardCapsLock = Key(20) BoardSpace = Key(32) BoardEnter = Key(13) BoardEscape = Key(27) BoardInsert = Key(45) BoardPrintScreen = Key(42) BoardDelete = Key(46) BoardPageUp = Key(33) BoardPageDown = Key(34) BoardHome = Key(36) BoardEnd = Key(35) BoardPause = Key(19) BoardScrollLock = Key(145) BoardArrowLeft = Key(37) BoardArrowRight = Key(39) BoardArrowDown = Key(40) BoardArrowUp = Key(38) BoardLeftBracket = Key(219) BoardLeftShift = Key(16) BoardLeftControl = Key(17) BoardLeftSuper = Key(73) BoardLeftAlt = Key(18) BoardRightBracket = Key(221) BoardRightShift = Key(16) BoardRightControl = Key(17) BoardRightSuper = Key(73) BoardRightAlt = Key(18) BoardZero = Key(48) BoardOne = Key(49) BoardTwo = Key(50) BoardThree = Key(51) BoardFour = Key(52) BoardFive = Key(53) BoardSix = Key(54) BoardSeven = Key(55) BoardEight = Key(56) BoardNine = Key(57) BoardF1 = Key(112) BoardF2 = Key(113) BoardF3 = Key(114) BoardF4 = Key(115) BoardF5 = Key(116) BoardF6 = Key(117) BoardF7 = Key(118) BoardF8 = Key(119) BoardF9 = Key(120) BoardF10 = Key(121) BoardF11 = Key(122) BoardF12 = Key(123) BoardA = Key(65) BoardB = Key(66) BoardC = Key(67) BoardD = Key(68) BoardE = Key(69) BoardF = Key(70) BoardG = Key(71) BoardH = Key(72) BoardI = Key(73) BoardJ = Key(74) BoardK = Key(75) BoardL = Key(76) BoardM = Key(77) BoardN = Key(78) BoardO = Key(79) BoardP = Key(80) BoardQ = Key(81) BoardR = Key(82) BoardS = Key(83) BoardT = Key(84) BoardU = Key(85) BoardV = Key(86) BoardW = Key(87) BoardX = Key(88) BoardY = Key(89) BoardZ = Key(90) BoardNumLock = Key(144) BoardNumMultiply = Key(106) BoardNumDivide = Key(111) BoardNumAdd = Key(107) BoardNumSubtract = Key(109) BoardNumZero = Key(96) BoardNumOne = Key(97) BoardNumTwo = Key(98) BoardNumThree = Key(99) BoardNumFour = Key(100) BoardNumFive = Key(101) BoardNumSix = Key(102) BoardNumSeven = Key(103) BoardNumEight = Key(104) BoardNumNine = Key(105) BoardNumDecimal = Key(110) BoardNumEnter = Key(13) )
var ( Time *Clock Files *Loader )
Functions ¶
func CrossProduct ¶
CrossProduct returns the 2 dimensional cross product of this and that, which represents the magnitude of the three dimensional cross product
func DotProduct ¶
DotProduct returns the dot product between this and that
func FloatEqual ¶
FloatEqual is a safe utility function to compare floats. It's Taken from http://floating-point-gui.de/errors/comparison/
It is slightly altered to not call Abs when not needed.
func FloatEqualThreshold ¶
FloatEqualThreshold is a utility function to compare floats. It's Taken from http://floating-point-gui.de/errors/comparison/
It is slightly altered to not call Abs when not needed.
This differs from FloatEqual in that it lets you pass in your comparison threshold, so that you can adjust the comparison value to your specific needs
func LineTraceFraction ¶
LineTraceFraction returns the trace fraction of tracer through boundary 1 means no intersection 0 means tracer's origin lies on the boundary line
func LoadShader ¶
func MultiplyMatrixVector ¶
MultiplyMatrixVector multiplies the matrix m with the float32 vector v and returns the result. The size of vector v MUST be 2 or 3. If v is size 2, a 3rd component is automatically added with value of 1.0.
Types ¶
type AABB ¶
type AABB struct {
Min, Max Point
}
AABB describes two points of a rectangle: the upper-left corner and the lower-right corner. It should always hold that `Min.X <= Max.X` and `Min.Y <= Max.Y`.
type AABBer ¶
type AABBer interface { // AABB returns the axis aligned bounding box. AABB() AABB }
AABBer is an interface for everything that provides information about its axis aligned bounding box.
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
func (*Batch) SetProjection ¶
type BatchLine ¶
type BatchLine struct {
// contains filtered or unexported fields
}
func NewBatchLine ¶
func (*BatchLine) SetProjection ¶
type Container ¶
type Container interface { // Contains reports whether the container contains the given point. Contains(p Point) bool }
A Container is a 2D closed shape which contains a set of points.
type ImageObject ¶
type ImageObject struct {
// contains filtered or unexported fields
}
func NewImageObject ¶
func NewImageObject(img *image.NRGBA) *ImageObject
func (*ImageObject) Data ¶
func (i *ImageObject) Data() interface{}
func (*ImageObject) Height ¶
func (i *ImageObject) Height() int
func (*ImageObject) Width ¶
func (i *ImageObject) Width() int
type Line ¶
Line describes a line segment on a 2 dimensional euclidean space it can also be thought of as a 2 dimensional vector with an offset
func (*Line) Angle ¶
Angle returns the euclidean angle of l in radians relative to a vertical line, going positive as you head towards the positive x-axis (clockwise) and negative as you head towards the negative x-axis. Values returned are [-pi, pi].
func (*Line) AngleDeg ¶
AngleDeg returns the euclidean angle of l in degrees relative to a vertical line, going positive as you head towards the positive x-axis (clockwise) and negative as you head towards the negative x-axis. Values returned are [-180, 180].
func (*Line) PointDistance ¶
PointDistance Returns the euclidean distance from the point p to the line segment l
func (*Line) PointDistanceSquared ¶
PointDistanceSquared returns the squared euclidean distance from the point p to the line segment l
type Matrix ¶
type Matrix struct { Val [9]float32 // contains filtered or unexported fields }
Matrix describes a 3x3 column-major matrix useful for 2D transformations.
func (*Matrix) Multiply ¶
Multiply postmultiplies m matrix with m2 and stores the result in m, returning m. Multiplaction is the result of m2 times m.
func (*Matrix) RotationComponent ¶
RotationComponent returns the current rotation component of m in degrees. This assumes uniform scaling.
func (*Matrix) RotationComponentRad ¶
RotationComponentRad returns the current rotation component of m in radians. This assumes uniform scaling.
func (*Matrix) ScaleComponent ¶
ScaleComponent returns the current scale component of m. This assumes uniform scaling.
func (*Matrix) Set ¶
Set sets the matrix to the given float slice and returns the matrix. The float slice must have at least 9 elements. If the float slie contains more than 9 elements, only the first 9 will be copied.
func (*Matrix) TranslatePoint ¶
TranslatePoint translates m by the point p.
func (*Matrix) TranslationComponent ¶
TranslationComponent returns the current translation component of m. This assumes uniform scaling.
type Point ¶
type Point struct {
X, Y float32
}
Point describes a coordinate in a 2 dimensional euclidean space it can also be thought of as a 2 dimensional vector from the origin
func LineIntersection ¶
LineIntersection returns the point where the line segments one and two intersect and true if there is intersection, nil and false when line segments one and two do not intersect
func (*Point) Equal ¶
Equal indicates whether two points have the same value, avoiding issues with float precision
func (*Point) MultiplyMatrixVector ¶
MultiplyMatrixVector multiplies the matrix m with the point and returns the result.
func (*Point) MultiplyScalar ¶
MultiplyScalar multiplies each component of p by s
func (*Point) Normalize ¶
Normalize returns the unit vector from p, and its magnitude. if you try to normalize the null vector, the return value will be null values
func (*Point) PointDistance ¶
PointDistance returns the euclidean distance between p and p2
func (*Point) PointDistanceSquared ¶
PointDistanceSquared returns the squared euclidean distance between p and p2
func (*Point) ProjectOnto ¶
ProjectOnto returns the vector produced by projecting p on to p2 returns an empty Point if they can't project onto one another
func (*Point) SubtractScalar ¶
SubtractScalar subtracts s from each component of p
type Sprite ¶
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
func NewTexture ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
decode/convert
Package convert resamples and converts audio data
|
Package convert resamples and converts audio data |
decode/vorbis
Package vorbis provides Ogg/Vorbis decoder.
|
Package vorbis provides Ogg/Vorbis decoder. |
decode/wav
Package wav provides WAV (RIFF) decoder.
|
Package wav provides WAV (RIFF) decoder. |
Package math currently is a wrapper to github.com/EngoEngine/math.
|
Package math currently is a wrapper to github.com/EngoEngine/math. |