public class Camera
extends java.lang.Object
Constructor and Description |
---|
Camera()
Creates a fullscale camera pointing at the middle of the map.
|
Camera(AbstractEntity focusentity,
int x,
int y,
int width,
int height)
Creates a camera focusing an entity.
|
Camera(Coordinate focus,
int x,
int y,
int width,
int height)
Create a camera focusin a specific coordinate.
|
Camera(int x,
int y,
int width,
int height)
Creates a camera pointing at the middle of the map.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.ArrayList<RenderDataDTO> |
createDepthList()
Fills the map into a list and sorts it in the order of the rendering, called the "depthlist".
|
void |
focusOnCoords(Coordinate coord)
Use this if you want to focus on a special groundBlock.
|
float |
getScaling()
Returns the zoom multiplied by a scaling factor to achieve the same viewport with every resolution
|
float |
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)
|
float |
getScreenWidth()
Returns the width of the camera output before scaling.
|
int |
getViewportHeight()
The amount of pixel which are visible in Y direction (game pixels).
|
int |
getViewportPosX()
The Camera Position in the game world.
|
int |
getViewportPosY()
The Camera top-position in the game world.
|
int |
getViewportWidth()
The amount of pixel which are visible in Y direction (game pixels).
|
int |
getVisibleBottomBorder()
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.
|
int |
getVisibleTopBorder()
Returns the top seight border of the deepest groundBlock
|
float |
getZoom()
Returns the zoomfactor.
|
static int |
getZRenderingLimit()
Must be static because raytracing is static
|
boolean |
isFullWindow()
Does the cameras output cover the whole screen?
|
void |
move(int x,
int y)
Move x and y coordinate
|
protected static void |
raytracing()
Filters every Block (and side) wich is not visible.
|
void |
render(View view,
Camera camera)
Renders the viewport
|
void |
resize(int width,
int height)
Should be called when resized
|
void |
setFullWindow(boolean fullWindow)
Set to true if the camera's output should cover the whole window
|
void |
setToggleChunkSwitch(boolean toggleChunkSwitch) |
void |
setViewportPosX(int x)
The Camera left Position in the game world.
|
void |
setViewportPosY(int y)
The Camera top-position in the game world.
|
void |
setZoom(float zoom)
Set the zoom factor and regenerates the sprites.
|
static void |
setZRenderingLimit(int zRenderingLimit) |
boolean |
togglesChunkSwitch() |
static void |
traceRayTo(Coordinate coord,
boolean neighbours)
Traces the ray to a specific groundBlock.
|
void |
update()
Updates the camera.
|
public Camera()
public Camera(int x, int y, int width, int height)
x
- the position in the application window (viewport position)y
- the position in the application window (viewport position)width
- 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)public Camera(Coordinate focus, int x, int y, int width, int height)
focus
- the coordiante where the camera focusesx
- the position in the application window (viewport position)y
- the position in the application window (viewport position)width
- 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)public Camera(AbstractEntity focusentity, int x, int y, int width, int height)
focusentity
- the entity wich the camera focuses and followsx
- the position in the application window (viewport position)y
- the position in the application window (viewport position)width
- 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)public void update()
protected java.util.ArrayList<RenderDataDTO> createDepthList()
protected static void raytracing()
public static 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 void focusOnCoords(Coordinate coord)
coord
- the coordaintes of the groundBlock.public int getVisibleLeftBorder()
public int getVisibleRightBorder()
public int getVisibleTopBorder()
public int getVisibleBottomBorder()
public int getViewportPosX()
public void setViewportPosX(int x)
x
- in pixelspublic int getViewportPosY()
public void setViewportPosY(int y)
y
- in game spacepublic final int getViewportWidth()
public final int getViewportHeight()
public int getScreenPosX()
public int getScreenPosY()
public float getScreenHeight()
public float getScreenWidth()
public boolean togglesChunkSwitch()
public void setToggleChunkSwitch(boolean toggleChunkSwitch)
toggleChunkSwitch
- public boolean isFullWindow()
public void setFullWindow(boolean fullWindow)
fullWindow
- public void resize(int width, int height)
width
- width of windowheight
- height of windowpublic static int getZRenderingLimit()
public static void setZRenderingLimit(int zRenderingLimit)
zRenderingLimit
- minimum is 1public void move(int x, int y)
x
- y
-