public class Camera extends java.lang.Object implements ICamera
ICamera.FocusChangedListener, ICamera.ZoomChangedListener| Modifier and Type | Field and Description |
|---|---|
protected java.awt.geom.Point2D |
focus
Provides the center location for the viewport.
|
| Constructor and Description |
|---|
Camera()
Instantiates a new camera.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.awt.geom.Point2D |
clampToMap(java.awt.geom.Point2D focus) |
Align |
getClampAlign() |
Valign |
getClampValign() |
java.awt.geom.Point2D |
getFocus()
Gets the map location that is focused by this camera.
|
java.awt.geom.Point2D |
getMapLocation(java.awt.geom.Point2D viewPortLocation)
Gets the map location.
|
double |
getPixelOffsetX()
Gets the pixel offset x.
|
double |
getPixelOffsetY()
Gets the pixel offset y.
|
float |
getRenderScale() |
java.awt.geom.Rectangle2D |
getViewport()
Gets the camera region.
|
java.awt.geom.Point2D |
getViewportDimensionCenter(IEntity entity) |
protected double |
getViewportHeight() |
java.awt.geom.Point2D |
getViewportLocation(double x,
double y)
Gets the render location.
|
java.awt.geom.Point2D |
getViewportLocation(IEntity entity)
This method calculates to location for the specified entity in relation to
the focus map location of the camera.
|
java.awt.geom.Point2D |
getViewportLocation(java.awt.geom.Point2D mapLocation)
This method calculates to location for the specified point in relation to
the focus map location of the camera.
|
protected double |
getViewportWidth() |
float |
getZoom() |
boolean |
isClampToMap() |
void |
onFocus(ICamera.FocusChangedListener listener)
Adds the specified focus changed listener to receive events when the focus of this camera changed.
|
void |
onZoom(ICamera.ZoomChangedListener listener)
Adds the specified zoom changed listener to receive events when the zoom of this camera changed.
|
void |
pan(double x,
double y,
int duration)
Pans the camera over the specified duration (in frames) to the target
location, after accounting for modifications such as clamping to the
map.
|
void |
pan(java.awt.geom.Point2D focus,
int duration)
Pans the camera over the specified duration (in frames) to the target
location, after accounting for modifications such as clamping to the
map.
|
protected int |
panTime() |
void |
removeFocusListener(ICamera.FocusChangedListener listener)
Removes the specified focus changed listener.
|
void |
removeZoomListener(ICamera.ZoomChangedListener listener)
Removes the specified zoom changed listener.
|
void |
setClampAlign(Align align,
Valign valign) |
void |
setClampToMap(boolean clampToMap) |
void |
setFocus(double x,
double y) |
void |
setFocus(java.awt.geom.Point2D focus) |
void |
setZoom(float targetZoom,
int delay) |
void |
shake(double intensity,
int delay,
int shakeDuration) |
void |
update()
This method is called by the game loop on all objects that are attached to the loop.
|
void |
updateFocus() |
protected java.awt.geom.Point2D focus
public java.awt.geom.Point2D getFocus()
ICamerapublic java.awt.geom.Point2D getMapLocation(java.awt.geom.Point2D viewPortLocation)
ICameragetMapLocation in interface ICameraviewPortLocation - the pointpublic double getPixelOffsetX()
ICameragetPixelOffsetX in interface ICamerapublic double getPixelOffsetY()
ICameragetPixelOffsetY in interface ICamerapublic java.awt.geom.Rectangle2D getViewport()
ICameragetViewport in interface ICamerapublic java.awt.geom.Point2D getViewportDimensionCenter(IEntity entity)
getViewportDimensionCenter in interface ICamerapublic java.awt.geom.Point2D getViewportLocation(double x,
double y)
ICameragetViewportLocation in interface ICamerax - the xy - the ypublic java.awt.geom.Point2D getViewportLocation(IEntity entity)
ICameragetViewportLocation in interface ICameraentity - the entitypublic java.awt.geom.Point2D getViewportLocation(java.awt.geom.Point2D mapLocation)
ICameragetViewportLocation in interface ICameramapLocation - the pointpublic float getRenderScale()
getRenderScale in interface ICamerapublic void onZoom(ICamera.ZoomChangedListener listener)
ICamerapublic void removeZoomListener(ICamera.ZoomChangedListener listener)
ICameraremoveZoomListener in interface ICameralistener - The listener to add.public void onFocus(ICamera.FocusChangedListener listener)
ICamerapublic void removeFocusListener(ICamera.FocusChangedListener listener)
ICameraremoveFocusListener in interface ICameralistener - The listener to add.public void setFocus(java.awt.geom.Point2D focus)
public void shake(double intensity,
int delay,
int shakeDuration)
public void update()
IUpdateableClientConfiguration.update in interface IUpdateableClientConfiguration.setMaxFps(int)public void updateFocus()
updateFocus in interface ICamerapublic boolean isClampToMap()
isClampToMap in interface ICamerapublic void setClampToMap(boolean clampToMap)
setClampToMap in interface ICamerapublic void setClampAlign(Align align, Valign valign)
setClampAlign in interface ICamerapublic Align getClampAlign()
getClampAlign in interface ICamerapublic Valign getClampValign()
getClampValign in interface ICameraprotected java.awt.geom.Point2D clampToMap(java.awt.geom.Point2D focus)
protected double getViewportWidth()
protected double getViewportHeight()
public void pan(java.awt.geom.Point2D focus,
int duration)
ICamerapublic void pan(double x,
double y,
int duration)
ICameraprotected int panTime()