Documentation ¶
Index ¶
- Constants
- type IAffineTransform
- type IAtlasX
- type IColor
- type IContactListener
- type IDelay
- type IDragging
- type IDynamicAtlasX
- type IDynamicPixelAtlasX
- type IDynamicText
- type IEngine
- type IEvent
- type IFilter
- type IFilterListener
- type IGeneratorValues
- type IGroup
- type IMatrix4
- type INode
- type INodeList
- type INodeManager
- type IPalette
- type IParticle
- type IParticleActivator
- type IParticleNode
- type IParticleSystem
- type IPoint
- type IPolygon
- type IQuadTree
- type IRasterFont
- type IRectangle
- type IRender
- type ISampleGenerator
- type IScene
- type IShader
- type ISingleTextureAtlasX
- type ISpriteSheet
- type IStaticAtlasX
- type ITransform
- type ITransformStack
- type IVector
- type IVector3
- type IVelocity
- type IWorld
- type IZone
- type IZoneListener
- type IZoomTransform
- type QuadrantBoundsFunc
- type TextSetter
- type ZoomValue
Constants ¶
const ( // MonoAtlasName is the Map name for StaticMono Atlas MonoAtlasName = "MonoAtlas" // DynamicMonoAtlasName is the Map name for a DynamicMono Atlas DynamicMonoAtlasName = "DynamicMonoAtlas" // DynamicPixelAtlasName is the Map name for DynamicPixel Atlas DynamicPixelAtlasName = "DynamicPixelAtlas" )
const ( CenteredFilledSquareShapeName = "CenteredFilledSquareShape" CenteredOutlinedSquareShapeName = "CenteredOutlinedSquareShape" UnCenteredFilledSquareShapeName = "UnCenteredFilledSquareShape" UnCenteredOutlinedSquareShapeName = "UnCenteredOutlinedSquareShape" FilledTriangleShapeName = "FilledTriangleShape" OutlinedTriangleShapeName = "OutlinedTriangleShape" FilledCircleShapeName = "FilledCircleShape" OutlinedCircleShapeName = "OutlinedCircleShape" FilledArcShapeName = "FilledArcShape" OutlinedArcShapeName = "OutlinedArcShape" FilledZBarShapeName = "FilledZBarShape" OutlinedZBarShapeName = "OutlinedZBarShape" HLineShapeName = "HLineShape" VLineShapeName = "VLineShape" PlusShapeName = "PlusShape" PolygonShapeName = "PolygonShape" PointsShapeName = "PointShape" LineShapeName = "LineShape" SquareShapeName = "SquareShape" )
These shape names are provided for convience. Use them for learning, but typically you would create your own shapes specific to your game which means you would have your own shape names.
const ( // FILLED polygon FILLED = 0 // OUTLINED polygon OUTLINED = 1 // OPENOUTLINED line strip OPENOUTLINED = 2 // FILLOUTLINED both fill and outlined FILLOUTLINED = 3 // CLOSED indicates a polygon should be rendered closed CLOSED = 0 // OPEN indicates a polygon should be rendered open OPEN = 1 )
const ( // MeshStatic represents static VBO buffers MeshStatic = 0 // MeshDynamic represents dynamic single mesh buffers, // for example, PixelBuffer MeshDynamic = 1 // MeshDynamicMulti represent dynamic multi mesh buffers, // for example, lines MeshDynamicMulti = 2 )
const ( // PTM is Pixels-to-Meters which isn't used in Ranger. It is // here as an example from pixel based engines. I wouldn't // use it, but instead use STM below. // Box2D uses the MKS(meters/kilograms/seconds) unit system. PTM = 1.0 / 30.0 // 1 MKS = 30 GUs // RangerScale is a value you change according to your desires. // The default is 30.0. For example RangerScale = 30.0 // STM is the Scale-to-MKS ratio. // Because Ranger uses transforms we don't think in terms of // pixels but rather in terms of spaces. Ranger's View-space // --without any scaling--is equal to physic-space (aka Box2D-space) // Thus if we want, for example, everything is ranger scaled up // then we need to scale it back down to physic-space and that // is what STM is for. STM = 1.0 / RangerScale // 1 MKS = 30 GUs // VelocityIterations is a resolution adjustment VelocityIterations = 8 // PositionIterations is a resolution adjustment PositionIterations = 3 )
const ( // IOTypeKeyboard is a keyboard event IOTypeKeyboard = 0 // IOTypeMouseMotion is a mouse event IOTypeMouseMotion = 1024 // IOTypeMouseButtonDown is a mouse event IOTypeMouseButtonDown = 1025 // IOTypeMouseButtonUp is a mouse event IOTypeMouseButtonUp = 1026 // IOTypeMouseWheel is a mouse event IOTypeMouseWheel = 1027 )
const ( // MaxParticleLifetime is a default lifetime MaxParticleLifetime = 1.0 // MaxParticleSpeed is a good default starting value MaxParticleSpeed = 10.0 )
const ( // StaticRenderGraphic generic static render setup StaticRenderGraphic = 0 // DynamicRenderGraphic generic dynamic render setup DynamicRenderGraphic = 1 // DynamicPixelBufRenderGraphic generic pixel buffer render setup DynamicPixelBufRenderGraphic = 2 // TextureRenderGraphic is used for texture quads TextureRenderGraphic = 3 )
const ( // WaveSQUARE a square wave WaveSQUARE = 0 // WaveTriangle a sawtooth wave WaveTriangle = 1 // WaveSINE a sine wave WaveSINE = 2 // WaveSawtooth a sine wave WaveSawtooth = 3 // WaveNoise is white noise WaveNoise = 4 // WaveNoisePink is pink noise WaveNoisePink = 5 // WaveNoiseBrownian is brownian/red noise WaveNoiseBrownian = 6 // PlaybackMasterVolume is main volume level applied after PlaybackMasterVolume = 1.0 // PlaybackSoundVolume is the volume applied during generation PlaybackSoundVolume = 0.1 // StandardSampleRate is a standard rate StandardSampleRate = 44100 // StandardSampleSize is a typical size StandardSampleSize = 8 // StandardOverSampling is basic over sampling StandardOverSampling = 8 // EnvelopeAttack part of envelope EnvelopeAttack = 0 // EnvelopeSustain part of envelope EnvelopeSustain = 1 // EnvelopeDecay part of envelope // EnvelopeDecay part of envelope EnvelopeDecay = 2 // EnvelopeRelease part of envelope EnvelopeRelease = 3 )
const ( // SceneOffStage means a scene off the stage either destroyed, // on the stack or in a pool. SceneOffStage = iota // SceneTransitionStartIn : the scene is beginning to transition SceneTransitionStartIn // SceneTransitioningIn : the scene is busy transitioning onto the stage SceneTransitioningIn // SceneOnStage means a scene is actively doing on stage. SceneOnStage // SceneTransitionStartOut : the scene is beginning to transition SceneTransitionStartOut // SceneTransitioningOut : the scene is busy transitioning off the stage SceneTransitioningOut // SceneExitedStage : the scene has finished transitioning off the stage SceneExitedStage // SceneFinished means a scene is done. Destroy it and/or remove from pool. SceneFinished )
const ( // CrossStateNone means has remained in the side since the last check. CrossStateNone = 0 // CrossStateEntered Object has entered zone. CrossStateEntered = 1 // CrossStateExited Object has exit zone. CrossStateExited = 2 // CrossStateInside Object is currently inside CrossStateInside = 3 // CrossStateOutside Object hasn't entered yet CrossStateOutside = 4 // ZoneStateObjectIsOutside object is currently outside of a zone ZoneStateObjectIsOutside = 0 // ZoneStateEnteredOuter Object has entered the outer region ZoneStateEnteredOuter = 1 // ZoneStateEnteredInner Object has entered the inner region ZoneStateEnteredInner = 2 // ZoneStateExitedInner Object has exited the inner region ZoneStateExitedInner = 3 // ZoneStateExitedOuter Object has exited the outer region ZoneStateExitedOuter = 4 // ZoneStateObjectIsInside object is currently inside of a zone ZoneStateObjectIsInside = 5 // ZoneActionNone Object is inside both regions ZoneActionNone = 0 // ZoneActionInward Object is heading inward ZoneActionInward = 1 // ZoneActionOutward Object is heading outward ZoneActionOutward = 2 )
const (
GLLines = 0
)
OpenGL Object types
const (
RelativeShaderPath = "/engine/assets/shaders/"
)
------------------------------------------------------ Paths ------------------------------------------------------
const XYZComponentCount int = 3
XYZComponentCount indicates how many parts to a vertex
const XYZWComponentCount int = 4
XYZWComponentCount is a composite of 2D vertex and 2D texture coords
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IAffineTransform ¶
type IAffineTransform interface { Matrix() *([16]float32) Components() (float32, float32, float32, float32, float32, float32) // ToIdentity sets the transform to an identity matrix ToIdentity() // SetByComp sets by component SetByComp(float32, float32, float32, float32, float32, float32) // SetByTransform sets point using another transform SetByTransform(IAffineTransform) SetFromMatrix(IMatrix4) // TransformPoint applys affine transform to point TransformPoint(IPoint) // TransformToPoint applys affine transform to out point, "in" is not modified TransformToPoint(in IPoint, out IPoint) // TransformToComps applys transform and returns results, "in" is not modified TransformToComps(in IPoint) (x, y float32) TransformCompToPoint(x, y float32, out IPoint) // TransformVertices3D applys transform to vertices TransformVertices3D(in []float32, out []float32) // MakeTranslate sets the transform to a Translate matrix MakeTranslate(x, y float32) // MakeTranslateUsingPoint sets the transform to a Translate matrix MakeTranslateUsingPoint(p IPoint) // Translate mutates/concat "this" matrix using tx,ty Translate(tx, ty float32) // MakeScale sets the transform to a Scale matrix MakeScale(x, y float32) // Scale mutates "this" matrix using sx, sy Scale(sx, sy float32) // GetPsuedoScale returns the transform's "a" component, however, // this is only valid if the transform doesn't have a rotation or zoom applied. GetPsuedoScale() float32 // MakeRotate sets the transform to a Rotate matrix MakeRotate(radians float64) // Rotate mutates "this" matrix using radian angle Rotate(radians float64) // Invert (mutates) inverts "this" matrix Invert() // Invert (non-mutating) inverts "this" matrix and sends to "out" InvertTo(out IAffineTransform) // Transpose // Converts either from or to pre or post multiplication. // a c // b d // to // a b // c d Transpose() Populate(destination IMatrix4) String4x4() string }
IAffineTransform represents 2D transforms
type IAtlasX ¶
type IAtlasX interface { Configure() error Burnt() bool Burn() error Shake() Bake() error Use() UnUse() SetColor(color []float32) Render(shapeID int, model IMatrix4) }
IAtlasX is a container for shapes and renders them.
type IContactListener ¶
type IContactListener interface { HandleBeginContact(nodeA, nodeB INode) bool HandleEndContact(nodeA, nodeB INode) bool }
IContactListener represents a Box2D contact listener
type IDelay ¶
type IDelay interface { Reset() SetPauseTime(milliseconds float64) Inc(dt float64) UpdateTransition(dt float64) ReadyToTransition() bool }
IDelay scene timing and transitions
type IDragging ¶
type IDragging interface { IsDragging() bool Delta() IPoint SetMotionState(x, y int32, state uint32) SetButtonState(x, y int32, button uint8, state uint32) SetMotionStateUsing(x, y int32, state uint32, node INode) SetButtonStateUsing(x, y int32, button uint8, state uint32, node INode) }
IDragging represents the node dragging behaviour
type IDynamicAtlasX ¶
type IDynamicAtlasX interface { AddShape(shapeName string, vertices []float32, indices []uint32, mode int) int GetShapeByName(shapeName string) int Update() SetData(vertices []float32, indices []uint32) SetPrimitiveMode(mode int) SetIndicesCount(count int) SetOffset(offset int) SetShapeVertex(x, y float32, index, shapdID int) SetVertex(x, y float32, index int) }
IDynamicAtlasX is a container for dynamic shapes
type IDynamicPixelAtlasX ¶
type IDynamicPixelAtlasX interface { Update() SetVertex(x, y float32, index int) SetData(vertices []float32, indices []uint32) SetPixelActiveCount(count int) }
IDynamicPixelAtlasX is a container for pixels
type IDynamicText ¶
IDynamicText represents dynamic text type objects
type IEngine ¶
type IEngine interface { // Start launches the game loop Begin() error // Ends shuts down the engine End() // World provides access to the engine's world properties World() IWorld }
IEngine is the main engine API
type IEvent ¶
type IEvent interface { Reset() BeenHandled() bool Handled(mark bool) SetMousePosition(x, y int32) GetMousePosition() (x, y int32) SetMouseRelMovement(x, y int32) GetMouseRelMovement() (x, y int32) SetDirection(uint32) GetDirection() uint32 SetType(uint32) GetType() uint32 SetClicks(uint8) GetClicks() uint8 SetButton(uint8) GetButton() uint8 SetWhich(uint32) GetWhich() uint32 SetState(uint32) GetState() uint32 SetRepeat(uint8) GetRepeat() uint8 SetKeyScan(uint32) GetKeyScan() uint32 SetKeyCode(uint32) GetKeyCode() uint32 SetKeyMotif(uint32) GetKeyMotif() uint32 }
IEvent represents IO event system
type IFilter ¶
type IFilter interface { Visit(transStack ITransformStack, interpolation float64) InheritOnlyRotation() InheritOnlyScale() InheritOnlyTranslation() InheritRotationAndTranslation() InheritAll() }
IFilter represents Transform Filter nodes
type IFilterListener ¶
IFilterListener represents a Box2D filter listener
type IGeneratorValues ¶
type IGeneratorValues interface { Mutate() Attack() float64 SetAttack(float64) ToEAttack() float64 // Convert from Internal to External Sustain() float64 SetSustain(float64) ToESustain() float64 Punch() float64 SetPunch(float64) Decay() float64 SetDecay(float64) ToEDecay() float64 SampleRate() int SetSampleRate(int) SampleSize() int SetSampleSize(int) BaseFreq() float64 SetBaseFreq(float64) ToIBaseFreq(float64) // Convert from External to Internal ToEBaseFreq() float64 // Convert from Internal to External FreqLimit() float64 SetFreqLimit(float64) ToEFreqLimit() float64 FreqRamp() float64 SetFreqRamp(float64) ToIFreqRamp(float64) // Slide ToEFreqRamp() float64 FreqDramp() float64 SetFreqDramp(float64) ToEFreqDramp() float64 VibStrength() float64 SetVibStrength(float64) ToEVibStrength() float64 VibSpeed() float64 SetVibSpeed(float64) ToEVibSpeed() float64 VibDelay() float64 SetVibDelay(float64) ArpMod() float64 SetArpMod(float64) ToEArpMod() float64 ArpSpeed() float64 SetArpSpeed(float64) ToEArpSpeed() float64 Duty() float64 SetDuty(float64) ToEDuty() float64 DutyRamp() float64 SetDutyRamp(float64) ToEDutyRamp() float64 RepeatSpeed() float64 SetRepeatSpeed(float64) ToERepeatSpeed() float64 PhaOffset() float64 SetPhaOffset(float64) ToEPhaOffset() float64 PhaRamp() float64 SetPhaRamp(float64) ToEPhaRamp() float64 LpfFreq() float64 SetLpfFreq(float64) ToELpfFreq() float64 LpfRamp() float64 SetLpfRamp(float64) ToELpfRamp() float64 LpfResonance() float64 SetLpfResonance(float64) ToELpfResonance() float64 HpfFreq() float64 SetHpfFreq(float64) ToEHpfFreq() float64 HpfRamp() float64 SetHpfRamp(float64) ToEHpfRamp() float64 SoundVol() float64 SetSoundVol(float64) WaveShape() int SetWaveShape(int) Noise() []float64 SetNoise([]float64) }
IGeneratorValues is an sfxr generator values
type IGroup ¶
type IGroup interface { // Children returns the children of current node. // Nodes should override this method for providing any child they contain. Children() []INode AddChild(INode) PrependChild(INode) GetChildByID(id int) INode GetChildByName(name string) INode InsertAndShift(newNode INode, width int) INode RemoveLast() INode }
IGroup is a collection of nodes. Group nodes can't be leafs.
type IMatrix4 ¶
type IMatrix4 interface { Translate(v IVector3) TranslateBy3Comps(x, y, z float32) TranslateBy2Comps(x, y float32) TransformVertices3D(in []float32, out []float32) SetTranslateUsingVector(v IVector3) SetTranslate3Comp(x, y, z float32) PostTranslate(tx, ty, tz float32) GetTranslation(out IVector3) SetRotation(angle float64) Rotate(angle float64) Scale(v IVector3) SetScale(v IVector3) ScaleByComp(x, y, z float32) SetScale3Comp(sx, sy, sz float32) SetScale2Comp(sx, sy float32) GetPsuedoScale() float32 Set(src IMatrix4) SetFromAffine(src IAffineTransform) Multiply(a, b IMatrix4) PreMultiply(b IMatrix4) PostMultiply(b IMatrix4) C(i int) float32 Matrix() *([16]float32) Clone() IMatrix4 Eq(IMatrix4) bool ToIdentity() Invert() bool // Graphics SetToOrtho(left, right, bottom, top, near, far float32) }
IMatrix4 is a 4x4 matrix
type INode ¶
type INode interface { ID() int SetID(id int) Name() string // Initialize configures default properties. Initialize(name string) // InitializeWithID configures default properties. InitializeWithID(id int, name string) // Build(IWorld) error World() IWorld HasParent() bool SetParent(INode) Parent() INode CalcTransform() IAffineTransform Interpolate(interpolation float64) EnterNode(INodeManager) ExitNode(INodeManager) EnterStageNode(INodeManager) IsVisible() bool SetVisible(bool) IsDirty() bool SetDirty(dirty bool) // RippleDirty passes the dirty flag downward to children. RippleDirty(dirty bool) Handle(IEvent) bool // IScene ITransform // Children IGroup Bounds() IRectangle SetBoundBySize(w, h float32) SetBoundByMinMax(minX, minY, maxX, maxY float32) Update(msPerUpdate, secPerUpdate float64) Atlas() IAtlasX SetAtlas(atlas IAtlasX) }
INode is an abstract object that represents SceneGraph nodes
type INodeList ¶
type INodeList interface { Items() *[]INode DeleteAt(i int) FindFirstElement(node INode) int Add(node INode) Remove(node INode) }
INodeList is a simple list collection
type INodeManager ¶
type INodeManager interface { Configure(IWorld) error ClearEnabled(bool) SetRoot(INode) Begin() error End() Visit(interpolation float64) bool Update(msPerUpdate, secPerUpdate float64) PushNode(INode) PopNode() INode ReplaceNode(INode) RouteEvents(IEvent) RegisterTarget(target INode) UnRegisterTarget(target INode) RegisterEventTarget(target INode) UnRegisterEventTarget(target INode) Debug() }
INodeManager manages node on a stack and forms a SceneGraph
type IPalette ¶
type IPalette interface { // Components return each component Components() (r, g, b, a float32) Array() []float32 // R is red component R() float32 // G is green component G() float32 // B is blus component B() float32 // A is alpha component A() float32 // SetColor SetColor(r, g, b, a float32) // SetRed SetRed(r float32) // SetGreen SetGreen(r float32) // SetBlue SetBlue(r float32) // SetAlpha SetAlpha(r float32) }
IPalette represents colors
type IParticle ¶
type IParticle interface { Evaluate(dt float32) IsActive() bool Activate(bool) Reset() SetLifespan(duration float32) }
IParticle represents a baseline particle
type IParticleActivator ¶
type IParticleActivator interface { Activate(particle IParticle, center IPoint) SetMaxLifetime(duration float64) }
IParticleActivator activates particles
type IParticleNode ¶
type IParticleNode interface { SetPosition(x, y float32) GetPosition() IPoint SetVelocity(angle float64, speed float32) Visual() INode }
IParticleNode represents a particle
type IParticleSystem ¶
type IParticleSystem interface { AddParticle(particle IParticle) Update(dt float32) SetPosition(x, y float32) SetAutoTrigger(bool) Activate(bool) TriggerOneshot() TriggerAt(pos IPoint) TriggerExplosion() }
IParticleSystem represents a particle system
type IPoint ¶
type IPoint interface { // Components returns the x,y parts Components() (float32, float32) // ComponentsAsInt32 return x,y parts for render context ComponentsAsInt32() (int32, int32) // X sets the x component X() float32 // Y sets the y component Y() float32 // SetByComp sets by component SetByComp(x, y float32) // SetByPoint sets point using another point SetByPoint(IPoint) MulPoint(IMatrix4) }
IPoint represents 2D points
type IPolygon ¶
type IPolygon interface { // AddVertex appends the point to vertices AddVertex(x, y float32) SetVertex(x, y float32, index int) PointInside(p IPoint) bool }
IPolygon represents 2D lines
type IQuadTree ¶
type IQuadTree interface { Add(INode) bool Remove(INode) bool Query(IRectangle, *[]INode) Traverse(quadrantCB QuadrantBoundsFunc) Clean() Clear() SetBoundary(x, y, w, h float32) SetBoundaryByMinMax(minX, minY, maxX, maxY float32) Boundary() IRectangle SetCapacity(capacity int) Capacity() int SetMaxDepth(depth int) MaxDepth() int }
IQuadTree is a spatial container for querying
type IRasterFont ¶
type IRasterFont interface { Initialize(dataFile string, relativePath string) error // Glyph returns an array of vertices that matches the character Glyph(char byte) []uint8 GlyphWidth() int }
IRasterFont is the bitmap raster font defined in assets/raster_font.data
type IRectangle ¶
type IRectangle interface { Set(x, y, w, h float32) SetByRectangle(rect IRectangle) SetBySize(width, height float32) SetMinMax(minX, minY, maxX, maxY float32) SetSize(w, h float32) SetCenter(x, y float32) SetBounds2D(vertices []float32) SetBounds3D(vertices []float32) Expand(x, y float32) Area() float32 Center() IPoint Width() float32 Height() float32 Left() float32 Right() float32 Top() float32 Bottom() float32 PointContained(p IPoint) bool PointInside(p IPoint) bool Intersects(o IRectangle) bool Contains(o IRectangle) bool }
IRectangle represents a 2D rectangle
type IRender ¶
type IRender interface {
Draw(IMatrix4)
}
IRender is the visual interface for drawing
type ISampleGenerator ¶
type ISampleGenerator interface { Init(IGeneratorValues) ReInit() Generate(IGeneratorValues) CanBeDrained(bool) Samples() *[]float64 SetSawtoothRise(rise bool) Stream(samples [][2]float64) (n int, ok bool) Err() error }
ISampleGenerator is a sfxr sample generator
type IScene ¶
type IScene interface { Notify(int) State() (int, int) CurrentState() int SetCurrentState(current int) TransitionDuration() float32 SetTransitionDuration(duration float32) EnterScene(INodeManager) ExitScene(INodeManager) bool }
IScene scene management
type ISingleTextureAtlasX ¶
type ISingleTextureAtlasX interface { SelectCoordsByIndex(index int) SpriteSheet() ISpriteSheet }
ISingleTextureAtlasX is for single texture atlases.
type ISpriteSheet ¶
type ISpriteSheet interface { Name() string Load(relativePath string, flipped bool) SheetImage() *image.NRGBA TextureXYCoords(name string) *[]int TextureSTCoords(name string) *[]float32 TextureSTCoordsByIndex(idx int) *[]float32 GetIndex(name string) int }
ISpriteSheet represents a collection of sprites (aka sub textures)
type IStaticAtlasX ¶
type IStaticAtlasX interface { AddShape(shapeName string, vertices []float32, indices []uint32, mode int) int GetShapeByName(shapeName string) int FetchVerticesByName(shapeName string) *[]float32 }
IStaticAtlasX is a container for static shapes
type ITransform ¶
type ITransform interface { CalcFilteredTransform( excludeTranslation bool, excludeRotation bool, excludeScale bool, aft IAffineTransform) // AffineTransform returns this node's transform AffineTransform() IAffineTransform InverseTransform() IAffineTransform SetPosition(x, y float32) Position() IPoint SetRotation(radian float64) Rotation() float64 SetScale(scale float32) SetScaleComps(sx, sy float32) Scale() float32 ScaleComps() (float32, float32) }
ITransform represents the transform properties of an INode
type ITransformStack ¶
type ITransformStack interface { Initialize(IMatrix4) Apply(IMatrix4) IMatrix4 ApplyAffine(IAffineTransform) IMatrix4 Save() Restore() }
ITransformStack a transformation stack
type IVector ¶
type IVector interface { Components() (float32, float32) // X sets the x component X() float32 // Y sets the y component Y() float32 // SetByComp sets by component SetByComp(x, y float32) // SetByPoint sets point using another point SetByPoint(IPoint) // SetByVector sets point using another vector SetByVector(IVector) SetByAngle(radians float64) // Length returns the square root length Length() float32 // LengthSqr return the squared length LengthSqr() float32 // Scale vector by s Scale(s float32) // Add offsets a this vector Add(x, y float32) // Sub offsets a this vector Sub(x, y float32) AddV(IVector) SubV(IVector) // Div vector by d Div(d float32) // AngleX computes the angle (radians) between this vector and v. AngleX(v IVector) float32 // Normalize normalizes this vector, if the vector is zero // then nothing happens Normalize() // SetDirection set the direction of the vector, however, // it will erase the magnitude SetDirection(radians float64) // CrossCW computes the cross-product faster in the CW direction CrossCW() // CrossCCW computes the cross-product faster in the CCW direction CrossCCW() }
IVector represents 2D vectors that have direction and magnitude
type IVector3 ¶
type IVector3 interface { Clone() IVector3 Set3Components(x, y, z float32) Set2Components(x, y float32) Components2D() (x, y float32) Components3D() (x, y, z float32) X() float32 Y() float32 Z() float32 Set(source IVector3) Add(src IVector3) Add2Components(x, y float32) Sub(src IVector3) Sub2Components(x, y float32) ScaleBy(s float32) ScaleBy2Components(sx, sy float32) MulAdd(src IVector3, scalar float32) Length() float32 LengthSquared() float32 Equal(other IVector3) bool EqEpsilon(other IVector3) bool Distance(src IVector3) float32 DistanceSquared(src IVector3) float32 DotByComponent(x, y, z float32) float32 Dot(o IVector3) float32 Cross(o IVector3) Mul(m IMatrix4) }
IVector3 is a 3x1 vector
type IVelocity ¶
type IVelocity interface { // SetMin sets minimum magnitude SetMin(float32) // SetMax sets maximum magnitude SetMax(float32) // SetMinMax sets min/maximum magnitude SetMinMax(float32, float32) // SetMagnitude set the current magnitude directly SetMagnitude(float32) // Magnitude returns the current magnitude Magnitude() float32 // Range returns the min/max magnitude range Range() (float32, float32) // SetDirection set the direction vector component SetDirectionByVector(IVector) SetDirectionByAngle(radians float64) // Direction returns the current direction component Direction() IVector // ConstrainMagnitude enables/disables the limiting of magnitude // to within the min/max range ConstrainMagnitude(bool) ApplyToPoint(point IPoint) }
IVelocity represents the direction and magnitude of a vector Velocity's direction is alway defined relative to the +X axis. Default direction is +X axis.
type IWorld ¶
type IWorld interface { Configure() error Begin() error End() RelativePath() string NodeManager() INodeManager Properties() *configuration.Properties PropertiesOverride(configFiel string) Root() INode Underlay() INode Scenes() INode Overlay() INode Push(scene INode) RouteEvents(event IEvent) Projection() IMatrix4 Viewspace() IMatrix4 InvertedViewspace() IMatrix4 RasterFont() IRasterFont AddAtlas(name string, atlas IAtlasX) GetAtlas(name string) IAtlasX // Debug Info Fps() int SetFps(int) Ups() int SetUps(int) AvgRender() float64 SetAvgRender(float64) }
IWorld represents properties of the game world
type IZoneListener ¶
type IZoneListener interface {
Notify(state, id int)
}
IZoneListener is for objects wanting to be notified of Zone events
type IZoomTransform ¶
type IZoomTransform interface { // GetTransform updates and returns the internal transform. GetTransform() IAffineTransform // Update modifies the internal transform state based on current values. Update() // SetPosition is an absolute position. Typically you would use TranslateBy. SetPosition(x, y float32) // Scale returns the current scale factor Scale() float32 PsuedoScale() float32 // SetScale sets the scale based on the current scale value making // this a relative scale. SetScale(scale float32) // SetAt sets the center zoom point. SetAt(x, y float32) // ZoomBy performs a relative zoom based on the current scale/zoom. ZoomBy(dx, dy float32) // TranslateBy is a relative positional translation. TranslateBy(dx, dy float32) }
IZoomTransform represents 2D zoom transform
type QuadrantBoundsFunc ¶
type QuadrantBoundsFunc func(bounds IRectangle)
QuadrantBoundsFunc is a functor that returns the current rectangle during a traversal.
type TextSetter ¶
type TextSetter func(string)
TextSetter is a functor for clients to what to notify objects of new text
Source Files ¶
- Ifilter.go
- api.go
- iaffinetransform.go
- iatlas_dynamic_pixel_x.go
- iatlas_dynamic_x.go
- iatlas_single_texture_x.go
- iatlas_static_x.go
- iatlas_x.go
- icolor.go
- icontact_listener.go
- idelay.go
- idragging.go
- idynamic_text.go
- iengine.go
- ievent.go
- ifilter_listener.go
- igenerator_values.go
- igroup.go
- imatrix4.go
- inode.go
- inode_list.go
- inode_manager.go
- ipalette.go
- iparticle.go
- iparticle_activator.go
- iparticle_node.go
- iparticle_system.go
- ipoint.go
- ipolygon.go
- iquadtree.go
- iraster_font.go
- irectangle.go
- irender.go
- isample_generator.go
- iscene.go
- ishader.go
- isprite_sheet.go
- itransform.go
- itransform_stack.go
- ivector.go
- ivector3.go
- ivelocity.go
- iworld.go
- izone.go
- izone_listener.go
- izoom_transform.go