com.b3dgs.lionengine.game.platform
Class PlatformCamera

java.lang.Object
  extended by com.b3dgs.lionengine.game.Camera
      extended by com.b3dgs.lionengine.game.platform.PlatformCamera

public class PlatformCamera
extends Camera

More specific camera, platform game oriented. It supports map borders limitation (can't see outside map).


Field Summary
 
Fields inherited from class com.b3dgs.lionengine.game.Camera
horizontalInterval, verticalInterval, x, xOff, xOffOld, xOld, y, yOff, yOffOld, yOld
 
Constructor Summary
PlatformCamera(int width, int height, int horizontalInterval, int verticalInterval)
          Create a new platform camera.
 
Method Summary
 void follow(AbstractPlatformEntity<?> entity)
          Follow specified entity.
 int getMapDownLimit()
          Get down map border.
 int getMapLeftLimit()
          Get left map border.
 int getMapRightLimit()
          Get right map border.
 int getMapUpLimit()
          Get up map border.
 void move(float vx, float vy)
          Move the camera using specific vector.
 void place(float x, float y)
          Place camera at a specific location.
 void setX(float x)
          Set location x (offsets are automatic).
 void setY(float y)
          Set location y (offsets are automatic).
 void updateLimits(int top, int left, int right, int bottom)
          Define the map borders.
 
Methods inherited from class com.b3dgs.lionengine.game.Camera
backupLocation, follow, getDiffX, getDiffY, getX, getXOld, getXReal, getY, getYOld, getYReal, setIntervals
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformCamera

public PlatformCamera(int width,
                      int height,
                      int horizontalInterval,
                      int verticalInterval)
Create a new platform camera.

Parameters:
width - screen width.
height - screen height.
horizontalInterval - horizontal floating margin.
verticalInterval - vertical floating margin.
Method Detail

follow

public void follow(AbstractPlatformEntity<?> entity)
Follow specified entity.

Parameters:
entity - entity to follow.

move

public void move(float vx,
                 float vy)
Description copied from class: Camera
Move the camera using specific vector.

Overrides:
move in class Camera
Parameters:
vx - horizontal vector.
vy - vertical vector.

place

public void place(float x,
                  float y)
Description copied from class: Camera
Place camera at a specific location.

Overrides:
place in class Camera
Parameters:
x - horizontal location.
y - vertical location.

setX

public void setX(float x)
Set location x (offsets are automatic).

Parameters:
x - location x.

setY

public void setY(float y)
Set location y (offsets are automatic).

Parameters:
y - location y.

updateLimits

public final void updateLimits(int top,
                               int left,
                               int right,
                               int bottom)
Define the map borders. Must be called after map loading.

Parameters:
top - map top.
left - map left.
right - map right.
bottom - map bottom.

getMapLeftLimit

public int getMapLeftLimit()
Get left map border.

Returns:
left map border.

getMapRightLimit

public int getMapRightLimit()
Get right map border.

Returns:
right map border.

getMapUpLimit

public int getMapUpLimit()
Get up map border.

Returns:
up map border.

getMapDownLimit

public int getMapDownLimit()
Get down map border.

Returns:
down map border.