public class Camera
extends java.lang.Object
Constructor and Description |
---|
Camera(AbstractEntity focusentity,
int x,
int y,
int width,
int height,
GameView view,
Controller controller)
Creates a camera focusing an entity.
|
Camera(Coordinate focus,
int x,
int y,
int width,
int height,
GameView view,
Controller controller)
Create a camera focusin a specific coordinate.
|
Camera(GameView view,
Controller controller)
Creates a fullscale camera pointing at the middle of the map.
|
Camera(int x,
int y,
int width,
int height,
GameView view,
Controller controller)
Creates a camera pointing at the middle of the map.
|
Modifier and Type | Method and Description |
---|---|
void |
focusOnCoords(Coordinate coord)
Use this if you want to focus on a special groundBlock.
|
boolean[] |
getClipping(Coordinate coords)
get the clipping of a coordinate
|
int |
getProjectionHeight()
The amount of pixel which are visible in Y direction (projection
dimension, game dimension).
|
float |
getProjectionPosX()
The Camera Position in the game world.
|
float |
getProjectionPosY()
The Camera top-position in the game world.
|
int |
getProjectionWidth()
The amount of pixel which are visible in Y direction (projection
dimension).
|
float |
getScaling()
Returns the zoom multiplied by a scaling factor to achieve the same
viewport with every resolution
|
int |
getScreenHeight()
Returns the height of the camera output before scaling.
|
int |
getScreenPosX()
Returns the position of the cameras output (on the screen)
|
int |
getScreenPosY()
Returns the position of the camera (on the screen)
|
int |
getScreenWidth()
Returns the width of the camera output before scaling.
|
int |
getVisibleBackBorder()
Returns the top seight border of the deepest groundBlock
|
int |
getVisibleFrontBorder()
Returns the bottom seight border y-coordinate of the highest groundBlock
|
int |
getVisibleLeftBorder()
Returns the left border of the visible area.
|
int |
getVisibleRightBorder()
Returns the right border of the visible area.
|
float |
getZoom()
Returns the zoomfactor.
|
int |
getZRenderingLimit() |
boolean |
isClipped(Coordinate coord) |
boolean |
isCompletelyClipped(Coordinate coord) |
boolean |
isFullWindow()
Does the cameras output cover the whole screen?
|
void |
move(int x,
int y)
Move x and y coordinate
|
void |
rayCastingClipping()
Filters every Block (and side) wich is not visible.
|
void |
render(GameView view,
Camera camera)
Renders the viewport
|
void |
resize(int width,
int height)
Should be called when resized
|
void |
setDamageoverlayOpacity(float opacity) |
void |
setFullWindow(boolean fullWindow)
Set to true if the camera's output should cover the whole window
|
void |
setProjectionPosX(float x)
The Camera left Position in the game world.
|
void |
setProjectionPosY(float y)
The Camera top-position in the game world.
|
void |
setScreenSize(int width,
int height) |
void |
setZoom(float zoom)
Set the zoom factor and regenerates the sprites.
|
void |
setZRenderingLimit(int limit) |
void |
shake(float amplitude,
float time)
shakes the screen
|
void |
traceRayTo(Coordinate coord,
boolean neighbours)
Traces the ray to a specific groundBlock.
|
void |
update(float delta)
Updates the camera.
|
public Camera(int x, int y, int width, int height, GameView view, Controller controller)
x
- the position in the application window (viewport position). Origin top lefty
- the position in the application window (viewport position). Origin top leftwidth
- The width of the image (screen size) the camera creates on
the application window (viewport)height
- The height of the image (screen size) the camera creates on
the application window (viewport)view
- controller
- public Camera(GameView view, Controller controller)
view
- controller
- public Camera(Coordinate focus, int x, int y, int width, int height, GameView view, Controller controller)
focus
- the coordiante where the camera focusesx
- the position in the application window (viewport position). Origin top lefty
- the position in the application window (viewport position). Origin top leftwidth
- The width of the image (screen size) the camera creates on
the application window (viewport)height
- The height of the image (screen size) the camera creates on
the application window (viewport)view
- controller
- public Camera(AbstractEntity focusentity, int x, int y, int width, int height, GameView view, Controller controller)
focusentity
- the entity wich the camera focuses and followsx
- the position in the application window (viewport position). Origin top lefty
- the position in the application window (viewport position). Origin top leftwidth
- The width of the image (screen size) the camera creates on
the application window (viewport)height
- The height of the image (screen size) the camera creates on
the application window (viewport)view
- controller
- public void update(float delta)
delta
- public void render(GameView view, Camera camera)
view
- camera
- public void rayCastingClipping()
public void traceRayTo(Coordinate coord, boolean neighbours)
coord
- The coordinate where the ray should point to.neighbours
- True when neighbours groundBlock also should be scannedpublic void setZoom(float zoom)
zoom
- public float getZoom()
public float getScaling()
public int getZRenderingLimit()
public void setZRenderingLimit(int limit)
limit
- minimum is 0public void focusOnCoords(Coordinate coord)
coord
- the coordaintes of the groundBlock.public int getVisibleLeftBorder()
public int getVisibleRightBorder()
public int getVisibleBackBorder()
public int getVisibleFrontBorder()
public float getProjectionPosX()
public void setProjectionPosX(float x)
x
- game in pixelspublic float getProjectionPosY()
public void setProjectionPosY(float y)
y
- in game spacepublic final int getProjectionWidth()
Configuration.getRenderResolutionWidth()
.
For screen pixels use getScreenWidth()
.public final int getProjectionHeight()
getScreenHeight()
.public int getScreenPosX()
public int getScreenPosY()
public int getScreenHeight()
public int getScreenWidth()
public boolean isFullWindow()
public void setFullWindow(boolean fullWindow)
fullWindow
- public void resize(int width, int height)
width
- width of windowheight
- height of windowpublic void setScreenSize(int width, int height)
public void move(int x, int y)
x
- y
- public void setDamageoverlayOpacity(float opacity)
opacity
- public void shake(float amplitude, float time)
amplitude
- time
- public boolean[] getClipping(Coordinate coords)
coords
- public boolean isClipped(Coordinate coord)
coord
- public boolean isCompletelyClipped(Coordinate coord)
coord
-