Package org.collebol.gui.graphics
Class Camera
java.lang.Object
org.collebol.gui.graphics.Camera
The Camera class represents a camera in a 2D space.
It has a position (Vector2D) and a zoom level (float).
The class provides methods to move the camera by a given delta and to zoom in or out by a given factor.
Additionally, it includes getter and setter methods for the position and zoom level.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]This method will convert the position as Vector2D to the GameLocation where the origin point is pointed at.The origin of the Camera represents the reference point from which the camera's position and zoom are calculated.floatfloatgetZoom()booleanvoidAdd a amount to the current camera positionvoidsetAmbientLight(float[] ambientLight) voidsetGameLocation(GameLocation location) This method will set the GameLocation to a Panel (Vector2D) position where the origin point is pointed at.voidsetLighting(boolean lighting) voidThe origin of the Camera represents the reference point from which the camera's position and zoom are calculated.voidsetPosition(Vector2D position) voidsetRotation(float rotation) voidsetZoom(float zoom) voidzoom(float factor) Zoom the current canvas.
-
Constructor Details
-
Camera
-
-
Method Details
-
getOrigin
The origin of the Camera represents the reference point from which the camera's position and zoom are calculated.- Returns:
- origin point as Vector
-
setOrigin
The origin of the Camera represents the reference point from which the camera's position and zoom are calculated.- Parameters:
origin- as vector
-
move
Add a amount to the current camera position- Parameters:
delta- amount. X and Y
-
zoom
public void zoom(float factor) Zoom the current canvas.- Parameters:
factor- the amount will be added.
-
getPosition
- Returns:
- current vector position of the camera.
-
setPosition
- Parameters:
position- as vector x and y.
-
getZoom
public float getZoom()- Returns:
- current zoom factor.
-
setZoom
public void setZoom(float zoom) - Parameters:
zoom- set zoom factor (float).
-
getRotation
public float getRotation() -
setRotation
public void setRotation(float rotation) -
calculate
-
getGameLocation
This method will convert the position as Vector2D to the GameLocation where the origin point is pointed at.- Returns:
- GameLocation from vector
-
setGameLocation
This method will set the GameLocation to a Panel (Vector2D) position where the origin point is pointed at.- Parameters:
location- the GameLocation the Camera must go to.
-
getAmbientLight
public float[] getAmbientLight() -
setAmbientLight
public void setAmbientLight(float[] ambientLight) -
isLighting
public boolean isLighting() -
setLighting
public void setLighting(boolean lighting)
-