Documentation ¶
Overview ¶
Package Components ...
Package Components ...
Package Graphics ¶
Package Components ...
Package Text
Index ¶
- func NewModelRenderer() *modelRenderer
- type AXIS
- type AnimationManager
- func (a *AnimationManager) AddAnimation(animationToAdd *FrameAnimation, nameToMap string)
- func (a *AnimationManager) CurrentAnimation() *FrameAnimation
- func (a *AnimationManager) GetAnimation(mappedName string) *FrameAnimation
- func (a *AnimationManager) SetCurrentAnimation(mappedAnimationName string)
- func (a *AnimationManager) StartAnimation()
- func (a *AnimationManager) StopAnimation()
- type Child
- type ChildComponent
- type Component
- type FrameAnimation
- func (f *FrameAnimation) Append(imageLoc string)
- func (f *FrameAnimation) AppendAnimation(animIn *FrameAnimation)
- func (f *FrameAnimation) Remove(imageIdx int)
- func (f *FrameAnimation) Reorder(imageOneIdx int, imageTwoIdx int)
- func (f *FrameAnimation) SetAsOneTimeOnly(setOneTime bool)
- func (f *FrameAnimation) SetFrequency(freqIn float64, setFrequencyByTheFrame bool)
- type Node
- type Renderer
- type ScriptComponent
- type SpriteRenderer
- type TextRenderer
- func (s *TextRenderer) SetColor(r, g, b, a float32)
- func (this *TextRenderer) SetFont(font string)
- func (this *TextRenderer) SetSize(size int)
- func (this *TextRenderer) SetText(text string)
- func (this *TextRenderer) TextTransform(vertex mathgl.Vec4) mathgl.Vec4
- func (this *TextRenderer) Update(delta float32)
- type Transform
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewModelRenderer ¶
func NewModelRenderer() *modelRenderer
NewSpriteRenderer creates a renderer and initializes its animation map
Types ¶
type AnimationManager ¶
type AnimationManager struct {
// contains filtered or unexported fields
}
AnimationManager contains a map of animations, and allows the user to interface with them
func (*AnimationManager) AddAnimation ¶
func (a *AnimationManager) AddAnimation(animationToAdd *FrameAnimation, nameToMap string)
AddAnimation maps a created animation inside the renderer
func (*AnimationManager) CurrentAnimation ¶
func (a *AnimationManager) CurrentAnimation() *FrameAnimation
func (*AnimationManager) GetAnimation ¶
func (a *AnimationManager) GetAnimation(mappedName string) *FrameAnimation
GetAnimation grabs a mapped animation and returns it for the user to manipulate if desired
func (*AnimationManager) SetCurrentAnimation ¶
func (a *AnimationManager) SetCurrentAnimation(mappedAnimationName string)
SetCurrentAnimation takes a animation's name and tries to set that as the current animation
func (*AnimationManager) StartAnimation ¶
func (a *AnimationManager) StartAnimation()
StartAnimation tells our current animation that it should animate (to be used when scripting)
func (*AnimationManager) StopAnimation ¶
func (a *AnimationManager) StopAnimation()
StopAnimation tells our current animation that it should not animate (to be used when scripting)
type ChildComponent ¶
type ChildComponent struct {
Parent *Node
}
func (*ChildComponent) GetParent ¶
func (this *ChildComponent) GetParent() *Node
func (*ChildComponent) Intialize ¶
func (this *ChildComponent) Intialize()
func (*ChildComponent) SetParent ¶
func (this *ChildComponent) SetParent(node *Node)
func (*ChildComponent) Update ¶
func (this *ChildComponent) Update(delta float32)
type FrameAnimation ¶
type FrameAnimation struct {
// contains filtered or unexported fields
}
FrameAnimation is a sequence of images and settings used by the renderer to animate sprites
func OBJAnimation ¶
func OBJAnimation(loc string) *FrameAnimation
OBJAnimation takes the folder to OBJ files and creates animation from them
func SpliceFullSpriteSheetAnimation ¶
func SpliceFullSpriteSheetAnimation(imageLoc string, frameWidth int, frameHeight int) *FrameAnimation
SpliceFullSpriteSheetAnimation manually cuts up an entire sprite sheet based on user defined frame dimensions
func SpliceSpriteSheetAnimation ¶
func SpliceSpriteSheetAnimation(imageLoc string, frameWidth, frameHeight, noOfFrames, rowNum int) *FrameAnimation
SpliceSpriteSheetAnimation manually cuts up a row of a sprite sheet based on user defined dimensions and sets it as the current animation
func (*FrameAnimation) Append ¶
func (f *FrameAnimation) Append(imageLoc string)
Append simply adds an image from the aggregate to the end of our animation
func (*FrameAnimation) AppendAnimation ¶
func (f *FrameAnimation) AppendAnimation(animIn *FrameAnimation)
AppendAnimation adds a list of images to the end of our animation
func (*FrameAnimation) Remove ¶
func (f *FrameAnimation) Remove(imageIdx int)
Remove an item from the animation via 1-based input
func (*FrameAnimation) Reorder ¶
func (f *FrameAnimation) Reorder(imageOneIdx int, imageTwoIdx int)
Reorder simply swaps the order in which any two images are rendered ()
func (*FrameAnimation) SetAsOneTimeOnly ¶
func (f *FrameAnimation) SetAsOneTimeOnly(setOneTime bool)
func (*FrameAnimation) SetFrequency ¶
func (f *FrameAnimation) SetFrequency(freqIn float64, setFrequencyByTheFrame bool)
SetFrequency sets our animation's timing in either seconds or frames per toggle i.e. Frequency(4,true) sets to update every 4 frames i.e. Frequency(0.25,false) sets to update every 1/4 of a second
type Node ¶
type Node struct { ChildComponent Name string // contains filtered or unexported fields }
func (*Node) AddComponent ¶
func (*Node) GetComponent ¶
func (*Node) Initialize ¶
func (this *Node) Initialize()
type Renderer ¶
type Renderer struct { ChildComponent Color *Image.Color // contains filtered or unexported fields }
ScriptComponent becomes a user defined script Contains helper methods
func (*Renderer) CustomTransform ¶
CustomTransforms allows the caller to apply a transformation to the current vertex data
func (*Renderer) Initialize ¶
func (this *Renderer) Initialize()
func (*Renderer) Render ¶
func (this *Renderer) Render(obj Opengl.RenderObject)
Render writes vertex data of RenderObjects to opengl
type ScriptComponent ¶
type ScriptComponent struct {
ChildComponent
}
ScriptComponent becomes a user defined script Contains helper methods
func (ScriptComponent) Transform ¶
func (this ScriptComponent) Transform() *Transform
Transform - returns the parent's Transform
type SpriteRenderer ¶
type SpriteRenderer struct { // ChildComponent Renderer // holds our map of animations as well as actions necessary to control them AnimationManager *AnimationManager // contains filtered or unexported fields }
SpriteRenderer is a component which allows a sprite to be drawn or animated
func NewSpriteRenderer ¶
func NewSpriteRenderer() *SpriteRenderer
NewSpriteRenderer creates a renderer and initializes its animation map
func (*SpriteRenderer) SetColor ¶
func (s *SpriteRenderer) SetColor(r, g, b, a float32)
SetColor allows us to modify image coloring of whatever is set in the Renderer
func (*SpriteRenderer) SetImage ¶
func (s *SpriteRenderer) SetImage(imageLoc string)
SetImage puts a designated image from the agregate into our image which will be rendered
func (*SpriteRenderer) SetSubImage ¶
func (s *SpriteRenderer) SetSubImage(imageLoc string, bounds image.Rectangle)
SetSubImage sets a designated part of an image for this sprite renderer
@param {[string]} this *SpriteRenderer [the base image path] @param {[image.Rectangle]} this *SpriteRenderer [the rectangular bounds of designated part of image] @return
func (*SpriteRenderer) Update ¶
func (s *SpriteRenderer) Update(delta float32)
Update gets called every frame and accounts for all settings in the renderer as well as shifts animations
type TextRenderer ¶
type TextRenderer struct { Renderer // contains filtered or unexported fields }
func NewTextRenderer ¶
func NewTextRenderer() *TextRenderer
func (*TextRenderer) SetColor ¶
func (s *TextRenderer) SetColor(r, g, b, a float32)
func (*TextRenderer) SetFont ¶
func (this *TextRenderer) SetFont(font string)
func (*TextRenderer) SetSize ¶
func (this *TextRenderer) SetSize(size int)
size of text in pixels (current max 100)
func (*TextRenderer) SetText ¶
func (this *TextRenderer) SetText(text string)
func (*TextRenderer) TextTransform ¶
func (this *TextRenderer) TextTransform(vertex mathgl.Vec4) mathgl.Vec4
func (*TextRenderer) Update ¶
func (this *TextRenderer) Update(delta float32)
type Transform ¶
type Transform struct {
// location
X, Y, Z float32
// rotation radians
Rot float32
// rotation (Euler Angle)
XR, YR, ZR float32
//scale
XS, YS, ZS float32
// contains filtered or unexported fields
}
func NewTransform ¶
func NewTransform() Transform