Package dev.prozilla.pine.core.component
Class Transform
java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.Transform
- All Implemented Interfaces:
Destructible,Printable,ApplicationContext,ApplicationProvider,ComponentsContext,ComponentsProvider,EntityContext,EntityProvider,SceneContext,SceneProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionChildren of the entityParent of the entityLocal positionfloatRotation in degreesThe velocity vector is added to the position each frame. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcalculateDepth(int depth) Calculates the z-indices of this transform and its children based on a depth value.intgetChildWithTag(String tag) Gets a child entity with a given tag.<ComponentType extends Component>
ComponentTypegetComponentInParent(Class<ComponentType> componentClass) <ComponentType extends Component>
ComponentTypegetComponentInParent(Class<ComponentType> componentClass, boolean includeAncestors) getComponentsInChildren(Class<ComponentType> componentClass) floatgetDepth()intfloatfloatgetParentWithTag(String tag) Gets a parent entity with a given tag.booleanisDescendantOf(Transform parent) voidvoidsetPosition(float x, float y) voidsetRenderChildrenBelow(boolean renderChildrenBelow) voidsetVelocity(float x, float y) voidtranslate(float deltaX, float deltaY) voidMethods inherited from class dev.prozilla.pine.core.component.Component
destroy, equals, getApplication, getEntity, getName, getScene, hashCode, setActive, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.prozilla.pine.core.ApplicationProvider
getAudioDevice, getConfig, getInput, getLogger, getModManager, getRenderer, getTimer, getTracker, getWindowMethods inherited from interface dev.prozilla.pine.core.component.ComponentsProvider
getComponent, getComponentsMethods inherited from interface dev.prozilla.pine.core.entity.EntityContext
isDescendantOfMethods inherited from interface dev.prozilla.pine.core.entity.EntityProvider
getTransformMethods inherited from interface dev.prozilla.pine.core.scene.SceneProvider
getCameraData, getWorld
-
Field Details
-
position
Local position -
rotation
public float rotationRotation in degrees -
velocity
The velocity vector is added to the position each frame. -
children
Children of the entity -
parent
Parent of the entity
-
-
Constructor Details
-
Transform
public Transform() -
Transform
public Transform(float x, float y) -
Transform
public Transform(float x, float y, float rotation)
-
-
Method Details
-
getFirstChild
-
getLastChild
-
isDescendantOf
-
getChildWithTag
Description copied from interface:EntityContextGets a child entity with a given tag.- Parameters:
tag- Tag of the child entity.- Returns:
- The child entity with the given tag, or null if there isn't one.
-
getParentWithTag
Description copied from interface:EntityContextGets a parent entity with a given tag.- Parameters:
tag- Tag of the parent entity.- Returns:
- The parent entity with the given tag, or null if there isn't one.
-
getComponentInParent
-
getComponentInParent
-
getComponentsInChildren
-
getGlobalX
public float getGlobalX() -
getGlobalY
public float getGlobalY() -
setParent
-
getChildCount
public int getChildCount() -
translate
-
translate
public void translate(float deltaX, float deltaY) -
setPosition
public void setPosition(float x, float y) -
setVelocity
public void setVelocity(float x, float y) -
setRenderChildrenBelow
public void setRenderChildrenBelow(boolean renderChildrenBelow) -
calculateDepth
public int calculateDepth(int depth) Calculates the z-indices of this transform and its children based on a depth value.- Parameters:
depth- Depth value before calculation- Returns:
- Depth value after calculation
-
getDepthIndex
public int getDepthIndex() -
getDepth
public float getDepth()- Returns:
- Depth value between
0fand1fbased on the depth index.
-