Class CameraData
java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.camera.CameraData
- All Implemented Interfaces:
Lifecycle
,Printable
,ComponentFinder
,EntityFinder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyTransform
(float x, float y) Applies the camera's transformation to a given x and y value.applyTransform
(Vector2f position) Applies the camera's transformation to a given position.float
Returns the horizontal center of this camera.float
Returns the vertical center of this camera.float
getScale()
Returns the scale of the camera's viewport.float
getZoom()
Returns the zoom value multiplied by the scale of the viewport.void
multiplyZoom
(float factor) Zooms the camera by a factor.screenToWorldPosition
(int screenX, int screenY) screenToWorldPosition
(Vector2i screenPosition) void
setBackgroundColor
(Color color) void
setSize
(int width, int height) void
zoomIn
(float zoom) Zooms the camera in or out based on a zoom value.Methods inherited from class dev.prozilla.pine.core.component.Component
equals, getCamera, getChildWithTag, getComponent, getComponentInParent, getComponentInParent, getComponents, getComponentsInChildren, getEntity, getInput, getLogger, getName, getParentWithTag, getRenderer, getTimer, getTracker, getTransform, getWindow, getWorld, hashCode, setActive, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
zoomFactor
public float zoomFactor -
width
public float width -
height
public float height -
backgroundColor
-
-
Constructor Details
-
CameraData
public CameraData() -
CameraData
-
-
Method Details
-
setSize
public void setSize(int width, int height) -
setBackgroundColor
-
multiplyZoom
public void multiplyZoom(float factor) Zooms the camera by a factor.- Parameters:
factor
- Zoom factor
-
zoomIn
public void zoomIn(float zoom) Zooms the camera in or out based on a zoom value. Use a positive value to zoom in and a negative value to zoom out.- Parameters:
zoom
- Zoom value
-
getScale
public float getScale()Returns the scale of the camera's viewport.- Returns:
- Scale
-
getZoom
public float getZoom()Returns the zoom value multiplied by the scale of the viewport.- Returns:
- Zoom value
-
getCenterX
public float getCenterX()Returns the horizontal center of this camera.- Returns:
- X value
-
getCenterY
public float getCenterY()Returns the vertical center of this camera.- Returns:
- Y value
-
applyTransform
Applies the camera's transformation to a given x and y value.- Returns:
- Array of x and y values
-
applyTransform
Applies the camera's transformation to a given position.- Returns:
- Array of x and y values
-
screenToWorldPosition
-
screenToWorldPosition
-