Documentation
¶
Index ¶
- type UIBoxCollider
- func (bc *UIBoxCollider) DrawDebug(gameBase interfaces.IGameBase, screen *ebiten.Image)
- func (bc *UIBoxCollider) DrawDebugPriority() float64
- func (bc *UIBoxCollider) GetCTags() *ctags.CTags
- func (bc *UIBoxCollider) GetID() string
- func (bc *UIBoxCollider) GetPolygon() *collision2d.Polygon
- func (bc *UIBoxCollider) GetPolygonAtPosition(pos *vector2.Vector2) *collision2d.Polygon
- func (bc *UIBoxCollider) GetPositionOffset() *vector2.Vector2
- func (bc *UIBoxCollider) GetSizeScalar() *vector2.Vector2
- func (bc *UIBoxCollider) GetSprite() interfaces.ISprite
- func (bc *UIBoxCollider) PhysUpdate(gb interfaces.IGameBase) error
- func (bc *UIBoxCollider) SetPositionOffset(posOffset *vector2.Vector2)
- func (bc *UIBoxCollider) SetSizeScalar(ss *vector2.Vector2)
- type UICircleCollider
- func (cc *UICircleCollider) DrawDebug(gameBase interfaces.IGameBase, screen *ebiten.Image)
- func (cc *UICircleCollider) DrawDebugPriority() float64
- func (cc *UICircleCollider) GetCTags() *ctags.CTags
- func (bc *UICircleCollider) GetID() string
- func (cc *UICircleCollider) GetPolygon() *collision2d.Polygon
- func (cc *UICircleCollider) GetPolygonAtPosition(pos *vector2.Vector2) *collision2d.Polygon
- func (cc *UICircleCollider) GetPositionOffset() *vector2.Vector2
- func (cc *UICircleCollider) GetSizeScalar() *vector2.Vector2
- func (cc *UICircleCollider) GetSprite() interfaces.ISprite
- func (cc *UICircleCollider) PhysUpdate(gameBase interfaces.IGameBase) error
- func (cc *UICircleCollider) SetPositionOffset(posOffset *vector2.Vector2)
- func (cc *UICircleCollider) SetSizeScalar(ss *vector2.Vector2)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UIBoxCollider ¶
type UIBoxCollider struct {
// contains filtered or unexported fields
}
Collider that defines a box around the sprite.
func NewUIBoxCollider ¶
func NewUIBoxCollider(sprite interfaces.ISprite) *UIBoxCollider
Creates a new box collider attached to the sprite. The collider will have the same sizes as the sprite. This can be used as triggers on Sprite components, but the original purpose is to use FixedSprite as a base. The most common use of UI colliders is UIButton.
func (*UIBoxCollider) DrawDebug ¶
func (bc *UIBoxCollider) DrawDebug(gameBase interfaces.IGameBase, screen *ebiten.Image)
func (*UIBoxCollider) DrawDebugPriority ¶
func (bc *UIBoxCollider) DrawDebugPriority() float64
func (*UIBoxCollider) GetCTags ¶
func (bc *UIBoxCollider) GetCTags() *ctags.CTags
Returns collider tags. Most common use is triggers when using a collider on Sprite.
func (*UIBoxCollider) GetID ¶
func (bc *UIBoxCollider) GetID() string
Implementation of the goi.Component
func (*UIBoxCollider) GetPolygon ¶
func (bc *UIBoxCollider) GetPolygon() *collision2d.Polygon
Returns internal value of the polygon. This value is calculated each frame in the PhysUpdate() function. Used for use with collision2d API.
func (*UIBoxCollider) GetPolygonAtPosition ¶
func (bc *UIBoxCollider) GetPolygonAtPosition(pos *vector2.Vector2) *collision2d.Polygon
Returns boxPolygon (internal value) at the given position. Main use is in PhysUpdate() function.
func (*UIBoxCollider) GetPositionOffset ¶
func (bc *UIBoxCollider) GetPositionOffset() *vector2.Vector2
Returns the position of the collider. As the documentation for function SetPositionOffset() says, this value is relative to the position of the sprite.
Calculates using this algorithm:
colliderPosition := sprite.position + positionOffset
func (*UIBoxCollider) GetSizeScalar ¶
func (bc *UIBoxCollider) GetSizeScalar() *vector2.Vector2
Returns the value of the size scalar. As the documentation for function SetSizeScalar() says, this value is relative to the size of the sprite.
Calculated by this algorithm:
colliderSize := sprite.size * sizeScalar
func (*UIBoxCollider) GetSprite ¶
func (bc *UIBoxCollider) GetSprite() interfaces.ISprite
Returns the sprite this collider is attached to.
func (*UIBoxCollider) PhysUpdate ¶
func (bc *UIBoxCollider) PhysUpdate(gb interfaces.IGameBase) error
func (*UIBoxCollider) SetPositionOffset ¶
func (bc *UIBoxCollider) SetPositionOffset(posOffset *vector2.Vector2)
Changes the offset of the collider position relative to the sprite position. The default value is Vector(0,0) which does not changes the position of the collider.
Calculates using this algorithm:
colliderPosition := sprite.position + positionOffset
func (*UIBoxCollider) SetSizeScalar ¶
func (bc *UIBoxCollider) SetSizeScalar(ss *vector2.Vector2)
Changes the size scalar of the collider. Because the collider is attached to a sprite, this value resizes relative to the size of the sprite. The default value is Vector2(1,1) which does not resize the collider relative to the sprite.
Calculated by this algorithm:
colliderSize := sprite.size * sizeScalar
type UICircleCollider ¶
type UICircleCollider struct {
// contains filtered or unexported fields
}
Collider that defines a circle around the sprite.
func NewUICircleCollider ¶
func NewUICircleCollider(sprite interfaces.ISprite) *UICircleCollider
Creates a new circle collider attached to the sprite. The collider will have the same sizes as the sprite. This can be used as triggers on Sprite components, but the original purpose is to use FixedSprite as a base. The most common use of UI colliders is UIButton.
func (*UICircleCollider) DrawDebug ¶
func (cc *UICircleCollider) DrawDebug(gameBase interfaces.IGameBase, screen *ebiten.Image)
func (*UICircleCollider) DrawDebugPriority ¶
func (cc *UICircleCollider) DrawDebugPriority() float64
func (*UICircleCollider) GetCTags ¶
func (cc *UICircleCollider) GetCTags() *ctags.CTags
Returns collider tags. Most common use is triggers when using a collider on Sprite.
func (*UICircleCollider) GetID ¶
func (bc *UICircleCollider) GetID() string
Implementation of the goi.Component
func (*UICircleCollider) GetPolygon ¶
func (cc *UICircleCollider) GetPolygon() *collision2d.Polygon
Returns internal value of the polygon. This value is calculated each frame in the PhysUpdate() function. Used for use with collision2d API.
func (*UICircleCollider) GetPolygonAtPosition ¶
func (cc *UICircleCollider) GetPolygonAtPosition(pos *vector2.Vector2) *collision2d.Polygon
Returns boxPolygon (internal value) at the given position. Main use is in PhysUpdate() function.
func (*UICircleCollider) GetPositionOffset ¶
func (cc *UICircleCollider) GetPositionOffset() *vector2.Vector2
Returns the position of the collider. As the documentation for function SetPositionOffset() says, this value is relative to the position of the sprite.
Calculates using this algorithm:
colliderPosition := sprite.position + positionOffset
func (*UICircleCollider) GetSizeScalar ¶
func (cc *UICircleCollider) GetSizeScalar() *vector2.Vector2
Returns the value of the size scalar. As the documentation for function SetSizeScalar() says, this value is relative to the size of the sprite.
Calculated by this algorithm:
colliderSize := sprite.size * sizeScalar
func (*UICircleCollider) GetSprite ¶
func (cc *UICircleCollider) GetSprite() interfaces.ISprite
Returns the sprite this collider is attached to.
func (*UICircleCollider) PhysUpdate ¶
func (cc *UICircleCollider) PhysUpdate(gameBase interfaces.IGameBase) error
func (*UICircleCollider) SetPositionOffset ¶
func (cc *UICircleCollider) SetPositionOffset(posOffset *vector2.Vector2)
Changes the offset of the collider position relative to the sprite position. The default value is Vector(0,0) which does not changes the position of the collider.
Calculates using this algorithm:
colliderPosition := sprite.position + positionOffset
func (*UICircleCollider) SetSizeScalar ¶
func (cc *UICircleCollider) SetSizeScalar(ss *vector2.Vector2)
Changes the size scalar of the collider. Because the collider is attached to a sprite, this value resizes relative to the size of the sprite. The default value is Vector2(1,1) which does not resize the collider relative to the sprite.
Calculated by this algorithm:
colliderSize := sprite.size * sizeScalar