Bandidos
Public Member Functions | Protected Member Functions | List of all members
com.mygdx.game.engine.entities.components.TransformComponent Class Reference
Inheritance diagram for com.mygdx.game.engine.entities.components.TransformComponent:
com.mygdx.game.engine.entities.components.BaseEntityComponent com.mygdx.game.engine.events.EventDispatcher

Public Member Functions

float getLocalPositionX ()
 
float getLocalPositionY ()
 
float getLocalRotation ()
 
float getLocalScaleX ()
 
float getLocalScaleY ()
 
float getPositionX ()
 
float getPositionY ()
 
float getRotation ()
 
float getScaleX ()
 
float getScaleY ()
 
TransformComponent [] getChilderen ()
 
TransformComponent getParent ()
 
void setParent (TransformComponent parent)
 
Vector2 getUpwards ()
 
Vector2 getRight ()
 
void translatePosition (float xDelta, float yDelta)
 
void translateRotation (float deltaRotation)
 
void translateScale (float deltaX, float deltaY)
 
EngineTween doPosition (float x, float y, float duration, TweenStartType tweenStartType)
 
EngineTween doRotation (float degrees, float duration, boolean shortestRotation, TweenStartType tweenStartType)
 
EngineTween doScale (float x, float y, float duration, TweenStartType tweenStartType)
 
void lookAt (Vector2 posToLookAt, float percentageTowardsLocation)
 
void setPosition (Vector2 newPosValue)
 
void setPosition (float newPosX, float newPosY)
 
void setRotation (float angleInDeg)
 
void setScale (float scaleX, float scaleY)
 
void awake ()
 
- Public Member Functions inherited from com.mygdx.game.engine.entities.components.BaseEntityComponent
EngineTween startTweenOnComponent (Tween tween, TweenStartType tweenStartType)
 
Timeline startTimelineOnComponent (Timeline timeline, boolean updateInGameTime)
 
EngineTween doFloat (TweenableFloat floatToTween, float newValue, float duration, TweenStartType tweenStartType)
 
void stopAllComponentTweens ()
 
void initialize (BaseEntity parentEntity)
 
BaseEntity getParentOfComponent ()
 
boolean isActive ()
 
boolean isDestroyed ()
 
void setActiveState (boolean activeState)
 
void destroy ()
 
void update (float deltaTime)
 
abstract void awake ()
 
- Public Member Functions inherited from com.mygdx.game.engine.events.EventDispatcher
void addEventListener (String type, IEventReceiver listeningClass)
 
void dispatchEvent (Event event)
 
void removeEventListener (String type, IEventReceiver listener)
 
boolean hasEventListener (String type)
 
ArrayList< ListenerItemgetAllListeners ()
 
void destroyAllListeners ()
 
void clean ()
 

Protected Member Functions

void updated (float deltaTime)
 
void destroyed ()
 
void activeStateChanged ()
 
- Protected Member Functions inherited from com.mygdx.game.engine.entities.components.BaseEntityComponent
abstract void updated (float deltaTime)
 
abstract void destroyed ()
 
abstract void activeStateChanged ()
 

Detailed Description

This component contains the orientation information of the entity it is attached to. (Position, Rotation, Scale)

Author
Ramses Di Perna

Member Function Documentation

◆ activeStateChanged()

void com.mygdx.game.engine.entities.components.TransformComponent.activeStateChanged ( )
protected

◆ awake()

void com.mygdx.game.engine.entities.components.TransformComponent.awake ( )

◆ destroyed()

void com.mygdx.game.engine.entities.components.TransformComponent.destroyed ( )
protected

◆ doPosition()

EngineTween com.mygdx.game.engine.entities.components.TransformComponent.doPosition ( float  x,
float  y,
float  duration,
TweenStartType  tweenStartType 
)

Tweens the entity to the given position in the given duration. The Tween can still be modified by the return value The Tween will be updated in the Component channel. (EngineTweener)

Parameters
xPosition to tween to
yPosition to tween to
durationin seconds on how long to take until reaching the position.
gameTimemeans, when set to true, this tween will be effected by the Time Scale of the game, else it will not (False recommended for UI elements)
Returns
The Tween which will be executed.

◆ doRotation()

EngineTween com.mygdx.game.engine.entities.components.TransformComponent.doRotation ( float  degrees,
float  duration,
boolean  shortestRotation,
TweenStartType  tweenStartType 
)

Tweens the entity to the given rotation in the given duration. The Tween can still be modified by the return value The Tween will be updated in the Component channel. (EngineTweener)

Parameters
degreesTo lerp to
durationin seconds on how long to take until reaching the rotation.
shortestRotationindicates whether it should take a long or a short turn when dealing with from 350 -> 10. True means rotating right and false means rotating left.
gameTimemeans, when set to true, this tween will be effected by the Time Scale of the game, else it will not (False recommended for UI elements)
Returns
The Tween which will be executed.

◆ doScale()

EngineTween com.mygdx.game.engine.entities.components.TransformComponent.doScale ( float  x,
float  y,
float  duration,
TweenStartType  tweenStartType 
)

Tweens the entity to the given scale in the given duration. The Tween can still be modified by the return value The Tween will be updated in the Component channel. (EngineTweener)

Parameters
xscale to tween to
yscale to tween to
durationin seconds on how long to take until reaching the scale.
gameTimemeans, when set to true, this tween will be effected by the Time Scale of the game, else it will not (False recommended for UI elements)
Returns
The Tween which will be executed.

◆ getChilderen()

TransformComponent [] com.mygdx.game.engine.entities.components.TransformComponent.getChilderen ( )

Returns all the childeren added to this TransformComponent

Returns
List of childeren TransformComponents.

◆ getLocalPositionX()

float com.mygdx.game.engine.entities.components.TransformComponent.getLocalPositionX ( )

Returns the X position of the entity in local (parent) space.

Returns
X value of the position Vector2.

◆ getLocalPositionY()

float com.mygdx.game.engine.entities.components.TransformComponent.getLocalPositionY ( )

Returns the Y position of the entity in local (parent) space.

Returns
Y value of the position Vector2

◆ getLocalRotation()

float com.mygdx.game.engine.entities.components.TransformComponent.getLocalRotation ( )

Returns the rotation of the current entity in Degrees in local (parent) space.

Returns
Rotation value in degrees.

◆ getLocalScaleX()

float com.mygdx.game.engine.entities.components.TransformComponent.getLocalScaleX ( )

Returns the X Scale of the entity in local (parent) space.

Returns
X value of the Scale Vector2

◆ getLocalScaleY()

float com.mygdx.game.engine.entities.components.TransformComponent.getLocalScaleY ( )

Returns the Y Scale of the entity in local (parent) space.

Returns
Y value of the Scale Vector2

◆ getParent()

TransformComponent com.mygdx.game.engine.entities.components.TransformComponent.getParent ( )

Gets the parent for the position of this transform component

Returns
The TransformComponent this component is attached to.

◆ getPositionX()

float com.mygdx.game.engine.entities.components.TransformComponent.getPositionX ( )

Returns the X position of the entity in world space.

Returns
X value of the position Vector2.

◆ getPositionY()

float com.mygdx.game.engine.entities.components.TransformComponent.getPositionY ( )

Returns the Y position of the entity in world space.

Returns
Y value of the position Vector2

◆ getRight()

Vector2 com.mygdx.game.engine.entities.components.TransformComponent.getRight ( )

Gets the Right vector of the current transform and its rotation

Returns
normalized right vector for current rotation

◆ getRotation()

float com.mygdx.game.engine.entities.components.TransformComponent.getRotation ( )

Returns the rotation of the current entity in Degrees in world space.

Returns
Rotation value in degrees.

◆ getScaleX()

float com.mygdx.game.engine.entities.components.TransformComponent.getScaleX ( )

Returns the X Scale of the entity in world space.

Returns
X value of the Scale Vector2

◆ getScaleY()

float com.mygdx.game.engine.entities.components.TransformComponent.getScaleY ( )

Returns the Y Scale of the entity in world space.

Returns
Y value of the Scale Vector2

◆ getUpwards()

Vector2 com.mygdx.game.engine.entities.components.TransformComponent.getUpwards ( )

Gets the Upward vector of the current transform and its rotation

Returns
normalized upward vector for current rotation

◆ lookAt()

void com.mygdx.game.engine.entities.components.TransformComponent.lookAt ( Vector2  posToLookAt,
float  percentageTowardsLocation 
)

Makes the Entity which this component is attached to change its angle to look at the given positionToLookAt

Parameters
posToLookAtwhich will be the target to turn towards
percentageTowardsLocationis a value between 0 and 1 with 1 being fully turned to the posToLookAt and 0 being not at all.

◆ setParent()

void com.mygdx.game.engine.entities.components.TransformComponent.setParent ( TransformComponent  parent)

Sets the parent for the position of this transform component

Returns
The TransformComponent this component is attached to.

◆ setPosition() [1/2]

void com.mygdx.game.engine.entities.components.TransformComponent.setPosition ( Vector2  newPosValue)

Sets the position to a new value

Parameters
newPosValueoverwriting the x and y position of the entity.

◆ setPosition() [2/2]

void com.mygdx.game.engine.entities.components.TransformComponent.setPosition ( float  newPosX,
float  newPosY 
)

Sets the position to a new value

Parameters
newPosXoverwriting the x position of the entity.
newPosYoverwriting the y position of the entity.

◆ setRotation()

void com.mygdx.game.engine.entities.components.TransformComponent.setRotation ( float  angleInDeg)

Sets the rotation to a new value in Degrees

Parameters
angleInDegoverwriting the angle of the entity in degrees.

◆ setScale()

void com.mygdx.game.engine.entities.components.TransformComponent.setScale ( float  scaleX,
float  scaleY 
)

Sets the scale to a new value

Parameters
newScaleValueoverwriting the x and y scale of the entity

◆ translatePosition()

void com.mygdx.game.engine.entities.components.TransformComponent.translatePosition ( float  xDelta,
float  yDelta 
)

Moves the entity with the given delta amount

Parameters
xDeltato add to the current x position
yDeltato add to the current y position

◆ translateRotation()

void com.mygdx.game.engine.entities.components.TransformComponent.translateRotation ( float  deltaRotation)

Rotates the entity with the given delta amount

Parameters
deltaRotationto add to the current rotation

◆ translateScale()

void com.mygdx.game.engine.entities.components.TransformComponent.translateScale ( float  deltaX,
float  deltaY 
)

◆ updated()

void com.mygdx.game.engine.entities.components.TransformComponent.updated ( float  deltaTime)
protected

The documentation for this class was generated from the following file: