Documentation ¶
Overview ¶
Taken from https://github.com/juj/RectangleBinPack.
Index ¶
- Constants
- Variables
- func Abs(val float32) float32
- func AddScene(scene Scene)
- func AtlasFromSheet(path string, width, height, frames int) (atlas *ManagedAtlas, groupID ID, err error)
- func ColorModelToGLTypes(model color.Model) (internalFormat int, typ gl.GLenum, format gl.GLenum, target gl.GLenum, ...)
- func DeltaTime() float64
- func DrawSprite(tex *Texture, uv UV, position Vector, scale Vector, rotation float32, ...)
- func DrawSprites(tex *Texture, uvs []UV, positions []Vector, scales []Vector, ...)
- func FindOptimalSize(tries int, rects ...image.Rectangle) (w, h int, err error)
- func FindOptimalSizeFast(totalSize int64) (w, h int)
- func FindSDF(img image.Image, x, y, maxRadius int) int
- func FindSDFAlpha(img *image.Alpha, x, y, maxRadius int) int
- func GameTime() time.Time
- func InsideScreen(ratio float32, position Vector, scale Vector) bool
- func LerpAngle(from, to float32, t float32) float32
- func Lerpf(from, to float32, t float32) float32
- func LoadGIF(path string) (imgs []image.Image, err error)
- func LoadImage(path string) (img image.Image, err error)
- func LoadImageQuiet(path string) (img image.Image)
- func LoadScene(scene Scene)
- func MainLoop() bool
- func NextPowerOfTwo(x uint64) uint64
- func PanicPath() string
- func RenderAtlas(a Atlas)
- func Roundf(val float32, places int) float32
- func Run()
- func SetTitle(title string)
- func StartEngine()
- func Terminate()
- func Title() string
- type Align
- type AnimatedUV
- type Arbiter
- type Atlas
- type BaseComponent
- func (c *BaseComponent) Awake()
- func (c *BaseComponent) Clone()
- func (c *BaseComponent) Draw()
- func (c *BaseComponent) FixedUpdate()
- func (c *BaseComponent) GameObject() *GameObject
- func (c *BaseComponent) LateUpdate()
- func (c *BaseComponent) OnCollisionEnter(arbiter Arbiter) bool
- func (c *BaseComponent) OnCollisionExit(arbiter Arbiter)
- func (c *BaseComponent) OnCollisionPostSolve(arbiter Arbiter)
- func (c *BaseComponent) OnCollisionPreSolve(arbiter Arbiter) bool
- func (c *BaseComponent) OnComponentAdd()
- func (c *BaseComponent) OnDestroy()
- func (c *BaseComponent) OnDisable()
- func (c *BaseComponent) OnEnable()
- func (c *BaseComponent) OnMouseEnter(arbiter Arbiter) bool
- func (c *BaseComponent) OnMouseExit(arbiter Arbiter)
- func (c *BaseComponent) PostDraw()
- func (c *BaseComponent) Start()
- func (c *BaseComponent) Transform() *Transform
- func (c *BaseComponent) Update()
- type BasicMaterial
- type Batch
- type Camera
- func (c *Camera) Clear()
- func (c *Camera) InsideScreen(ratio float32, position Vector, scale Vector) bool
- func (c *Camera) InvertedMatrix() Matrix
- func (c *Camera) LateUpdate()
- func (c *Camera) Matrix() Matrix
- func (c *Camera) MouseLocalPosition() Vector
- func (c *Camera) MouseWorldPosition() Vector
- func (c *Camera) Render()
- func (c *Camera) ScreenResolution() (Width, Height float32)
- func (c *Camera) ScreenSize() (Width, Height float32)
- func (c *Camera) ScreenToWorld(x, y float32) Vector
- func (c *Camera) SetSize(size float32) error
- func (c *Camera) Size() float32
- func (c *Camera) Update()
- func (c *Camera) UpdateResolution()
- type Color
- type Component
- type DepthMap
- func (this *DepthMap) Add(depth int, object *GameObject)
- func (this DepthMap) Iter(fnc func(*GameObject))
- func (this DepthMap) Len() int
- func (this DepthMap) Less(i, j int) bool
- func (this *DepthMap) Remove(depth int, object *GameObject) bool
- func (this DepthMap) String() string
- func (this DepthMap) Swap(i, j int)
- type EngineColorModel
- type FPS
- type Filter
- type Font
- func NewFont(fontPath string, size float64) (*Font, error)
- func NewFont2(fontPath string, size float64, dpi int, readonly bool, ...) (*Font, error)
- func NewSDFFont(fontPath string, size float64) (*Font, error)
- func NewSDFFont2(fontPath string, size float64, sdfSize float64, scanRange int) (*Font, error)
- func NewSDFFont3(fontPath string, size float64, dpi int, readonly bool, ...) (*Font, error)
- type FuncKey
- type FuncList
- type GLColorModel
- type GLTexture
- type GameObject
- func (g *GameObject) AddComponent(com Component) Component
- func (g *GameObject) AddToScene()
- func (g *GameObject) Clone() *GameObject
- func (g *GameObject) ComponentImplements(intrfce interface{}) Component
- func (g *GameObject) ComponentTypeOf(component Component) Component
- func (g *GameObject) Components() []Component
- func (g *GameObject) Destroy()
- func (c *GameObject) GameObject() *GameObject
- func (g *GameObject) IsActive() bool
- func (g *GameObject) IsSelfActive() bool
- func (g *GameObject) IsValid() bool
- func (g *GameObject) Name() string
- func (g *GameObject) RemoveComponent(com Component) bool
- func (g *GameObject) RemoveComponentOfType(typ reflect.Type) bool
- func (g *GameObject) RemoveComponentsOfType(typ reflect.Type)
- func (g *GameObject) RemoveFromScene()
- func (g *GameObject) SetActive(active bool)
- func (g *GameObject) SetName(name string)
- func (g *GameObject) Transform() *Transform
- type ID
- type LetterInfo
- type ManagedAtlas
- func (ma *ManagedAtlas) AddImage(img image.Image, id ID) error
- func (ma *ManagedAtlas) BuildAtlas() error
- func (ma *ManagedAtlas) Group(id ID) []image.Rectangle
- func (ma *ManagedAtlas) Index(id ID) image.Rectangle
- func (ma *ManagedAtlas) Indexs() []ID
- func (atlas *ManagedAtlas) LoadGIF(path string) (err error, groupID ID)
- func (atlas *ManagedAtlas) LoadGIFID(path string, groupID ID) (err error)
- func (atlas *ManagedAtlas) LoadGroup(path string) error
- func (atlas *ManagedAtlas) LoadGroupSheet(path string, width, height, frames int) (err error, groupID ID)
- func (atlas *ManagedAtlas) LoadGroupSheetOffset(path string, pt image.Point, width, height, frames int) (err error, groupID ID)
- func (ma *ManagedAtlas) LoadImage(path string) (err error, id ID)
- func (ma *ManagedAtlas) LoadImageID(path string, id ID) error
- func (atlas *ManagedAtlas) Release()
- type Material
- type Matrix
- func (mA *Matrix) Invert() Matrix
- func (m1 *Matrix) Mul(m2 Matrix)
- func (m1 *Matrix) MulPtr(m2 *Matrix)
- func (mA *Matrix) Ortho(left, right, bottom, top, Znear, Zfar float32)
- func (mA *Matrix) Ptr() *float32
- func (mA *Matrix) Reset()
- func (mA *Matrix) Rotate(a, x, y, z float32)
- func (mA *Matrix) RotateX(a, x float32)
- func (mA *Matrix) RotateXYZ(x, y, z float32)
- func (mA *Matrix) RotateY(a, y float32)
- func (mA *Matrix) RotateZ(a, z float32)
- func (mA *Matrix) Scale(x, y, z float32)
- func (mA *Matrix) Translate(x, y, z float32)
- func (mA *Matrix) Translation() Vector
- type MaxRectsBin
- func (this *MaxRectsBin) FindPositionForNewNodeBestShortSideFit(width, height int) (bestNode image.Rectangle, bestShortSideFit, bestLongSideFit int)
- func (this *MaxRectsBin) Insert(rect image.Rectangle) (image.Rectangle, error)
- func (this *MaxRectsBin) InsertArray(rects []image.Rectangle) ([]image.Rectangle, error)
- func (this *MaxRectsBin) Occupancy() float32
- func (this *MaxRectsBin) PruneFreeList()
- func (this *MaxRectsBin) SplitFreeNode(freeNode, usedNode image.Rectangle) bool
- func (this *MaxRectsBin) String() string
- type MemHandle
- type Mouse
- type OnAnimationEnd
- type Physics
- func (p *Physics) Clone()
- func (p *Physics) CollisionEnter(arbiter *chipmunk.Arbiter) bool
- func (p *Physics) CollisionExit(arbiter *chipmunk.Arbiter)
- func (p *Physics) CollisionPostSolve(arbiter *chipmunk.Arbiter)
- func (p *Physics) CollisionPreSolve(arbiter *chipmunk.Arbiter) bool
- func (p *Physics) OnComponentAdd()
- func (p *Physics) OnDestroy()
- func (p *Physics) OnDisable()
- func (p *Physics) OnEnable()
- func (p *Physics) Start()
- type Program
- type Rect
- type RectID
- type RectSortable
- type ResID
- type Resource
- type Resources
- type Scene
- type SceneData
- type Sprite
- func (p *Sprite) Align() Align
- func (sp *Sprite) AnimationLength() int
- func (p *Sprite) BindAnimations(animMap map[ID][2]int)
- func (p *Sprite) CurrentAnimation() interface{}
- func (sp *Sprite) CurrentAnimationIndex() int
- func (sp *Sprite) Draw()
- func (sp *Sprite) DrawScreen()
- func (sp *Sprite) OnComponentAdd()
- func (sp *Sprite) RealSize() (s Vector)
- func (sp *Sprite) RealWorldSize() (s Vector)
- func (p *Sprite) SetAlign(align Align)
- func (p *Sprite) SetAnimation(id ID)
- func (sp *Sprite) SetAnimationIndex(index int)
- func (sp *Sprite) Start()
- func (sp *Sprite) Update()
- func (sp *Sprite) UpdateShape()
- type StaticBatch
- func (this *StaticBatch) Add(position, scale Vector, rotation float32, uv UV) (index int)
- func (this *StaticBatch) Remove(index int)
- func (this *StaticBatch) Render()
- func (this *StaticBatch) Update(position, scale Vector, rotation float32, uv UV, index int)
- func (this *StaticBatch) UpdateUV(uv UV, index int)
- type Texture
- func LoadTexture(path string) (tex *Texture, err error)
- func LoadTextureFromImage(image image.Image) (tex *Texture, err error)
- func NewRGBATexture(rgbaData interface{}, width int, height int) *Texture
- func NewRGBTexture(rgbData interface{}, width int, height int) *Texture
- func NewTexture(image image.Image, data interface{}) (texture *Texture, err error)
- func NewTexture2(data interface{}, width int, height int, target gl.GLenum, internalFormat int, ...) *Texture
- func NewTextureEmpty(width int, height int, model color.Model) *Texture
- func (t *Texture) Bind()
- func (t *Texture) BuildMipmaps()
- func (t *Texture) GLTexture() gl.Texture
- func (t *Texture) Height() int
- func (t *Texture) Image() image.Image
- func (t *Texture) Options(filter, clamp int)
- func (t *Texture) Param(filter, value int)
- func (t *Texture) Paramf(filter int, value float32)
- func (t *Texture) PixelSize() int
- func (t *Texture) PreloadRender()
- func (t *Texture) ReadTextureFromGPU() []byte
- func (t *Texture) Release()
- func (t *Texture) Render()
- func (t *Texture) SetData(data interface{})
- func (t *Texture) SetFiltering(minFilter Filter, magFilter Filter)
- func (t *Texture) SetReadOnly()
- func (t *Texture) SetWraping(wrapType WrapType, wrap Wrap)
- func (t *Texture) Unbind()
- func (t *Texture) Width() int
- type Timer
- func (timer Timer) Defer(result *time.Duration) func()
- func (timer Timer) DeferCustom(key interface{}, result *time.Duration) func()
- func (timer Timer) Start()
- func (timer Timer) StartCustom(key interface{})
- func (timer Timer) Stop() time.Duration
- func (timer Timer) StopCustom(key interface{}) time.Duration
- type Transform
- func (t *Transform) Angle() float32
- func (t *Transform) Child(index int) *Transform
- func (t *Transform) Children() []*Transform
- func (t *Transform) Clone()
- func (t *Transform) Depth() int
- func (t *Transform) Direction() Vector
- func (t *Transform) DirectionTransform(up Vector) Vector
- func (t *Transform) InScene() bool
- func (t *Transform) InvertedMatrix() Matrix
- func (t *Transform) Matrix() Matrix
- func (t *Transform) OnComponentAdd()
- func (t *Transform) Parent() *Transform
- func (t *Transform) Position() Vector
- func (t *Transform) Rotation() Vector
- func (t *Transform) Scale() Vector
- func (t *Transform) SetDepth(depth int)
- func (t *Transform) SetDepthRecursive(depth int)
- func (t *Transform) SetParent(newParent *Transform)
- func (t *Transform) SetParent2(g *GameObject)
- func (t *Transform) SetPosition(vect Vector)
- func (t *Transform) SetPositionf(x, y float32)
- func (t *Transform) SetRotation(vect Vector)
- func (t *Transform) SetRotationf(z float32)
- func (t *Transform) SetScale(vect Vector)
- func (t *Transform) SetScalef(x, y float32)
- func (t *Transform) SetWorldPosition(vect Vector)
- func (t *Transform) SetWorldPositionf(x, y float32)
- func (t *Transform) SetWorldRotation(vect Vector)
- func (t *Transform) SetWorldRotationf(z float32)
- func (t *Transform) SetWorldScale(vect Vector)
- func (t *Transform) SetWorldScalef(x, y float32)
- func (t *Transform) Translate(v Vector)
- func (t *Transform) Translatef(x, y float32)
- func (t *Transform) WorldPosition() Vector
- func (t *Transform) WorldRotation() Vector
- func (t *Transform) WorldScale() Vector
- type UV
- type VAO
- type VBO
- type Vector
- func (v *Vector) Add(vect Vector) Vector
- func (v *Vector) Distance(vect Vector) float32
- func (v *Vector) Div(vect Vector) Vector
- func (v *Vector) Length() float32
- func (v *Vector) Mul(vect Vector) Vector
- func (v *Vector) Mul2(vect float32) Vector
- func (v *Vector) Normalize()
- func (v *Vector) Normalized() Vector
- func (v *Vector) String() string
- func (v *Vector) Sub(vect Vector) Vector
- func (v *Vector) Transform(transform Matrix) Vector
- type Wrap
- type WrapType
Constants ¶
View Source
const ( RadianConst = math.Pi / 180 DegreeConst = 180 / math.Pi MouseTag = "Mouse" )
View Source
const ( Nearest = Filter(gl.NEAREST) Linear = Filter(gl.LINEAR) MipMapLinearNearest = Filter(gl.LINEAR_MIPMAP_NEAREST) MipMapLinearLinear = Filter(gl.LINEAR_MIPMAP_LINEAR) MipMapNearestLinear = Filter(gl.NEAREST_MIPMAP_LINEAR) MipMapNearestNearest = Filter(gl.NEAREST_MIPMAP_NEAREST) WrapS = WrapType(gl.TEXTURE_WRAP_S) WrapR = WrapType(gl.TEXTURE_WRAP_R) WrapT = WrapType(gl.TEXTURE_WRAP_T) ClampToEdge = Wrap(gl.CLAMP_TO_EDGE) ClampToBorder = Wrap(gl.CLAMP_TO_BORDER) MirroredRepeat = Wrap(gl.MIRRORED_REPEAT) Repeat = Wrap(gl.REPEAT) )
View Source
const ( AlignLeft = Align(1) AlignCenter = Align(2) AlignRight = Align(4) AlignTopLeft = Align(8 | AlignLeft) AlignTopCenter = Align(8 | AlignCenter) AlignTopRight = Align(8 | AlignRight) AlignBottomLeft = Align(16 | AlignLeft) AlignBottomCenter = Align(16 | AlignCenter) AlignBottomRight = Align(16 | AlignRight) )
Variables ¶
View Source
var ( Color_White = Color{1, 1, 1, 1} Color_Black = Color{0, 0, 0, 1} Color_Red = Color{1, 0, 0, 1} Color_Green = Color{0, 1, 0, 1} Color_Blue = Color{0, 0, 1, 1} Color_Transparent = Color{1, 1, 1, 0} )
View Source
var ( Inf = vect.Float(math.Inf(1)) Space *chipmunk.Space = nil CorrectWrongPhysics = true EnablePhysics = true Debug = false InternalFPS = float64(100) BehaviorTicks = 5 Width = 1280 Height = 720 )
View Source
var ( Zero = Vector{0, 0, 0} Up = Vector{0, 1, 0} Down = Vector{0, -1, 0} Left = Vector{-1, 0, 0} Right = Vector{1, 0, 0} Forward = Vector{0, 0, 1} Backward = Vector{0, 0, -1} One = Vector{1, 1, 1} MinusOne = Vector{-1, -1, -1} )
View Source
var (
CustomColorModels = make(map[color.Model]*GLColorModel)
)
View Source
var Padding = 1
View Source
var (
ResourceManager = &Resources{make(map[ResID]Resource)}
)
View Source
var TextureShader gl.Program
Functions ¶
func AtlasFromSheet ¶
func AtlasFromSheet(path string, width, height, frames int) (atlas *ManagedAtlas, groupID ID, err error)
func NewRGBA(r image.Rectangle) (*image.RGBA, *MemHandle) { w, h := r.Dx(), r.Dy() memHandle := Allocate(4 * w * h) buf := memHandle.Bytes() ResourceManager.Add(memHandle) return &image.RGBA{buf, 4 * w, r}, memHandle }
func ColorModelToGLTypes ¶
func DrawSprite ¶
func DrawSprites ¶
func FindOptimalSize ¶
This needs to be smarter, but it does work great for images like fonts
func FindOptimalSizeFast ¶
func LoadImageQuiet ¶
func NextPowerOfTwo ¶
func RenderAtlas ¶
func RenderAtlas(a Atlas)
func StartEngine ¶
func StartEngine()
Types ¶
type AnimatedUV ¶
type AnimatedUV []UV
func AnimatedGroupUVs ¶
func AnimatedGroupUVs(a Atlas, groups ...ID) (AnimatedUV, map[ID][2]int)
func AnimatedUVs ¶
func AnimatedUVs(a Atlas, ids ...ID) AnimatedUV
func IndexGroupUV ¶
func IndexGroupUV(a Atlas, group ID) AnimatedUV
type Arbiter ¶
func (*Arbiter) GameObjectA ¶
func (arbiter *Arbiter) GameObjectA() *GameObject
func (*Arbiter) GameObjectB ¶
func (arbiter *Arbiter) GameObjectB() *GameObject
func (*Arbiter) ShapeB ¶
func (arbiter *Arbiter) ShapeB() *GameObject
func (arbiter *Arbiter) ShapeA() *chipmunk.Shape { if arbiter.Swapped { return arbiter.Arbiter.ShapeB } return arbiter.Arbiter.ShapeA }
func (arbiter *Arbiter) ShapeB() *chipmunk.Shape { if arbiter.Swapped { return arbiter.Arbiter.ShapeA } return arbiter.Arbiter.ShapeB }
type BaseComponent ¶
type BaseComponent struct {
// contains filtered or unexported fields
}
func NewComponent ¶
func NewComponent() BaseComponent
func (*BaseComponent) Awake ¶
func (c *BaseComponent) Awake()
func (*BaseComponent) Clone ¶
func (c *BaseComponent) Clone()
func (*BaseComponent) Draw ¶
func (c *BaseComponent) Draw()
func (*BaseComponent) FixedUpdate ¶
func (c *BaseComponent) FixedUpdate()
func (*BaseComponent) GameObject ¶
func (c *BaseComponent) GameObject() *GameObject
func (*BaseComponent) LateUpdate ¶
func (c *BaseComponent) LateUpdate()
func (*BaseComponent) OnCollisionEnter ¶
func (c *BaseComponent) OnCollisionEnter(arbiter Arbiter) bool
func (*BaseComponent) OnCollisionExit ¶
func (c *BaseComponent) OnCollisionExit(arbiter Arbiter)
func (*BaseComponent) OnCollisionPostSolve ¶
func (c *BaseComponent) OnCollisionPostSolve(arbiter Arbiter)
func (*BaseComponent) OnCollisionPreSolve ¶
func (c *BaseComponent) OnCollisionPreSolve(arbiter Arbiter) bool
func (*BaseComponent) OnComponentAdd ¶
func (c *BaseComponent) OnComponentAdd()
func (*BaseComponent) OnDestroy ¶
func (c *BaseComponent) OnDestroy()
func (*BaseComponent) OnDisable ¶
func (c *BaseComponent) OnDisable()
func (*BaseComponent) OnEnable ¶
func (c *BaseComponent) OnEnable()
func (*BaseComponent) OnMouseEnter ¶
func (c *BaseComponent) OnMouseEnter(arbiter Arbiter) bool
func (*BaseComponent) OnMouseExit ¶
func (c *BaseComponent) OnMouseExit(arbiter Arbiter)
func (*BaseComponent) PostDraw ¶
func (c *BaseComponent) PostDraw()
func (*BaseComponent) Start ¶
func (c *BaseComponent) Start()
func (*BaseComponent) Transform ¶
func (c *BaseComponent) Transform() *Transform
func (*BaseComponent) Update ¶
func (c *BaseComponent) Update()
type BasicMaterial ¶
type BasicMaterial struct { Program Program ViewMatrix, ProjMatrix, ModelMatrix, AddColor, Texture, Tiling, Offset gl.UniformLocation Verts, UV gl.AttribLocation // contains filtered or unexported fields }
var SDFMaterial *BasicMaterial
var TextureMaterial *BasicMaterial
func NewBasicMaterial ¶
func NewBasicMaterial(vertexShader, fragmentShader string) *BasicMaterial
func (*BasicMaterial) Begin ¶
func (b *BasicMaterial) Begin(gobj *GameObject)
func (*BasicMaterial) End ¶
func (b *BasicMaterial) End(gobj *GameObject)
func (*BasicMaterial) Load ¶
func (b *BasicMaterial) Load() error
type Camera ¶
type Camera struct { BaseComponent Projection *Matrix // contains filtered or unexported fields }
func CurrentCamera ¶
func CurrentCamera() *Camera
func (*Camera) InsideScreen ¶
Checks if box is in the screen
func (*Camera) InvertedMatrix ¶
InvertedMatrix of the camera, this is needed because we will optimize it someday
func (*Camera) LateUpdate ¶
func (c *Camera) LateUpdate()
func (*Camera) Matrix ¶
Matrix of the camera, this is needed because sometimes we control the matrix
func (*Camera) MouseLocalPosition ¶
Mouse local position
func (*Camera) MouseWorldPosition ¶
Mouse world position
func (*Camera) ScreenResolution ¶
Screen resolution
func (*Camera) ScreenSize ¶
Returns Screen Size
func (*Camera) ScreenToWorld ¶
Takes a point on the screen and turns it into point on world
type Component ¶
type Component interface { Draw() PostDraw() Update() FixedUpdate() Start() Awake() Clone() LateUpdate() OnEnable() OnDisable() OnCollisionEnter(arbiter Arbiter) bool OnCollisionPreSolve(arbiter Arbiter) bool OnCollisionPostSolve(arbiter Arbiter) OnCollisionExit(arbiter Arbiter) OnMouseEnter(arbiter Arbiter) bool OnMouseExit(arbiter Arbiter) OnComponentAdd() OnDestroy() // contains filtered or unexported methods }
type DepthMap ¶
type DepthMap []depthData
func (*DepthMap) Add ¶
func (this *DepthMap) Add(depth int, object *GameObject)
func (DepthMap) Iter ¶
func (this DepthMap) Iter(fnc func(*GameObject))
type EngineColorModel ¶
type FPS ¶
type FPS struct { BaseComponent FPS float64 // contains filtered or unexported fields }
type Font ¶
type Font struct { *Texture // contains filtered or unexported fields }
func NewSDFFont2 ¶
func NewSDFFont3 ¶
func (*Font) LetterInfo ¶
func (t *Font) LetterInfo(letter rune) *LetterInfo
type FuncList ¶
type FuncList struct {
Functions []FuncKey
}
func NewFuncList ¶
func NewFuncList(f func()) *FuncList
type GLColorModel ¶
type GameObject ¶
type GameObject struct { Tag string Physics *Physics Sprite *Sprite // contains filtered or unexported fields }
func NewGameObject ¶
func NewGameObject(name string) *GameObject
func (*GameObject) AddComponent ¶
func (g *GameObject) AddComponent(com Component) Component
func (*GameObject) AddToScene ¶
func (g *GameObject) AddToScene()
func (*GameObject) Clone ¶
func (g *GameObject) Clone() *GameObject
func (*GameObject) ComponentImplements ¶
func (g *GameObject) ComponentImplements(intrfce interface{}) Component
func (*GameObject) ComponentTypeOf ¶
func (g *GameObject) ComponentTypeOf(component Component) Component
func (*GameObject) Components ¶
func (g *GameObject) Components() []Component
func (*GameObject) Destroy ¶
func (g *GameObject) Destroy()
func (*GameObject) GameObject ¶
func (c *GameObject) GameObject() *GameObject
func (*GameObject) IsActive ¶
func (g *GameObject) IsActive() bool
func (*GameObject) IsSelfActive ¶
func (g *GameObject) IsSelfActive() bool
func (*GameObject) IsValid ¶
func (g *GameObject) IsValid() bool
func (*GameObject) Name ¶
func (g *GameObject) Name() string
func (*GameObject) RemoveComponent ¶
func (g *GameObject) RemoveComponent(com Component) bool
func (*GameObject) RemoveComponentOfType ¶
func (g *GameObject) RemoveComponentOfType(typ reflect.Type) bool
func (*GameObject) RemoveComponentsOfType ¶
func (g *GameObject) RemoveComponentsOfType(typ reflect.Type)
func (*GameObject) RemoveFromScene ¶
func (g *GameObject) RemoveFromScene()
Removed object from Scene if hes in one
func (*GameObject) SetActive ¶
func (g *GameObject) SetActive(active bool)
func (*GameObject) SetName ¶
func (g *GameObject) SetName(name string)
func (*GameObject) Transform ¶
func (g *GameObject) Transform() *Transform
type LetterInfo ¶
type ManagedAtlas ¶
type ManagedAtlas struct { *Texture Bin *MaxRectsBin // contains filtered or unexported fields }
func AtlasLoadDirectory ¶
func AtlasLoadDirectory(path string) (*ManagedAtlas, error)
func NewManagedAtlas ¶
func NewManagedAtlas(width, height int) *ManagedAtlas
func (*ManagedAtlas) BuildAtlas ¶
func (ma *ManagedAtlas) BuildAtlas() error
func (*ManagedAtlas) Indexs ¶
func (ma *ManagedAtlas) Indexs() []ID
func (*ManagedAtlas) LoadGIF ¶
func (atlas *ManagedAtlas) LoadGIF(path string) (err error, groupID ID)
func (*ManagedAtlas) LoadGIFID ¶
func (atlas *ManagedAtlas) LoadGIFID(path string, groupID ID) (err error)
func (*ManagedAtlas) LoadGroup ¶
func (atlas *ManagedAtlas) LoadGroup(path string) error
func (*ManagedAtlas) LoadGroupSheet ¶
func (atlas *ManagedAtlas) LoadGroupSheet(path string, width, height, frames int) (err error, groupID ID)
func (*ManagedAtlas) LoadGroupSheetOffset ¶
func (*ManagedAtlas) LoadImageID ¶
func (ma *ManagedAtlas) LoadImageID(path string, id ID) error
func (*ManagedAtlas) Release ¶
func (atlas *ManagedAtlas) Release()
type Material ¶
type Material interface { Load() error Begin(gobj *GameObject) End(gobj *GameObject) }
type Matrix ¶
type Matrix [16]float32
func NewIdentity ¶
func NewIdentity() *Matrix
func (*Matrix) Translation ¶
type MaxRectsBin ¶
func NewBin ¶
func NewBin(width, height, padding int) *MaxRectsBin
func (*MaxRectsBin) FindPositionForNewNodeBestShortSideFit ¶
func (this *MaxRectsBin) FindPositionForNewNodeBestShortSideFit(width, height int) (bestNode image.Rectangle, bestShortSideFit, bestLongSideFit int)
func (*MaxRectsBin) InsertArray ¶
func (*MaxRectsBin) Occupancy ¶
func (this *MaxRectsBin) Occupancy() float32
/ Computes the ratio of used surface area.
func (*MaxRectsBin) PruneFreeList ¶
func (this *MaxRectsBin) PruneFreeList()
func (*MaxRectsBin) SplitFreeNode ¶
func (this *MaxRectsBin) SplitFreeNode(freeNode, usedNode image.Rectangle) bool
func (*MaxRectsBin) String ¶
func (this *MaxRectsBin) String() string
type Mouse ¶
type Mouse struct {
BaseComponent
}
func (*Mouse) OnCollisionEnter ¶
func (*Mouse) OnCollisionExit ¶
func (*Mouse) OnComponentAdd ¶
func (m *Mouse) OnComponentAdd()
type OnAnimationEnd ¶
type OnAnimationEnd func(sprite *Sprite)
type Physics ¶
type Physics struct { BaseComponent Body *chipmunk.Body Box *chipmunk.BoxShape Shape *chipmunk.Shape Interpolate bool // contains filtered or unexported fields }
func NewPhysics ¶
func NewPhysicsCircle ¶
func (*Physics) CollisionExit ¶
func (*Physics) CollisionPostSolve ¶
func (*Physics) CollisionPreSolve ¶
func (*Physics) OnComponentAdd ¶
func (p *Physics) OnComponentAdd()
type RectSortable ¶
func (RectSortable) Len ¶
func (this RectSortable) Len() int
func (RectSortable) Less ¶
func (this RectSortable) Less(i, j int) bool
func (RectSortable) Swap ¶
func (this RectSortable) Swap(i, j int)
type Resources ¶
func (*Resources) ReleaseResource ¶
func (r *Resources) ReleaseResource(res interface{})
type SceneData ¶
type SceneData struct { Camera *Camera // contains filtered or unexported fields }
func (*SceneData) AddGameObject ¶
func (s *SceneData) AddGameObject(gameObject ...*GameObject)
func (*SceneData) RemoveGameObject ¶
func (s *SceneData) RemoveGameObject(g *GameObject)
type Sprite ¶
type Sprite struct { BaseComponent *Texture //buffer gl.Buffer AnimationSpeed float32 UVs AnimatedUV AnimationEndCallback OnAnimationEnd Tiling Vector Render bool Color Color // contains filtered or unexported fields }
func NewSprite2 ¶
func NewSprite3 ¶
func NewSprite3(tex *Texture, uv AnimatedUV) *Sprite
func (*Sprite) AnimationLength ¶
func (*Sprite) BindAnimations ¶
func (*Sprite) CurrentAnimation ¶
func (p *Sprite) CurrentAnimation() interface{}
func (*Sprite) CurrentAnimationIndex ¶
func (*Sprite) DrawScreen ¶
func (sp *Sprite) DrawScreen()
func (*Sprite) OnComponentAdd ¶
func (sp *Sprite) OnComponentAdd()
func (*Sprite) RealWorldSize ¶
func (*Sprite) SetAnimation ¶
func (*Sprite) SetAnimationIndex ¶
type StaticBatch ¶
type StaticBatch struct { Tex *Texture Vertices VBO UVs VBO Indecies VBO // contains filtered or unexported fields }
func NewStaticBatch ¶
func NewStaticBatch(tex *Texture) *StaticBatch
func (*StaticBatch) Add ¶
func (this *StaticBatch) Add(position, scale Vector, rotation float32, uv UV) (index int)
func (*StaticBatch) Remove ¶
func (this *StaticBatch) Remove(index int)
func (*StaticBatch) Render ¶
func (this *StaticBatch) Render()
func (*StaticBatch) Update ¶
func (this *StaticBatch) Update(position, scale Vector, rotation float32, uv UV, index int)
func (*StaticBatch) UpdateUV ¶
func (this *StaticBatch) UpdateUV(uv UV, index int)
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
func LoadTexture ¶
func NewRGBATexture ¶
func NewRGBTexture ¶
func NewTexture ¶
func NewTexture2 ¶
func (*Texture) BuildMipmaps ¶
func (t *Texture) BuildMipmaps()
func (*Texture) PreloadRender ¶
func (t *Texture) PreloadRender()
func (*Texture) ReadTextureFromGPU ¶
func (*Texture) SetFiltering ¶
func (*Texture) SetReadOnly ¶
func (t *Texture) SetReadOnly()
func (*Texture) SetWraping ¶
type Timer ¶
func (Timer) DeferCustom ¶
func (Timer) StartCustom ¶
func (timer Timer) StartCustom(key interface{})
func (Timer) StopCustom ¶
type Transform ¶
type Transform struct { BaseComponent // contains filtered or unexported fields }
func NewTransform ¶
func NewTransform() *Transform
func (*Transform) DirectionTransform ¶
func (*Transform) InvertedMatrix ¶
func (*Transform) OnComponentAdd ¶
func (t *Transform) OnComponentAdd()
func (*Transform) SetDepthRecursive ¶
func (*Transform) SetParent2 ¶
func (t *Transform) SetParent2(g *GameObject)
func (*Transform) SetPosition ¶
func (*Transform) SetPositionf ¶
func (*Transform) SetRotation ¶
func (*Transform) SetRotationf ¶
func (*Transform) SetWorldPosition ¶
func (*Transform) SetWorldPositionf ¶
func (*Transform) SetWorldRotation ¶
func (*Transform) SetWorldRotationf ¶
func (*Transform) SetWorldScale ¶
func (*Transform) SetWorldScalef ¶
func (*Transform) Translatef ¶
func (*Transform) WorldPosition ¶
func (*Transform) WorldRotation ¶
func (*Transform) WorldScale ¶
type Vector ¶
type Vector struct {
X, Y, Z float32
}
func NewVector2 ¶
func NewVector3 ¶
func (*Vector) Normalized ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.