com.b3dgs.lionengine.game
Class Camera

java.lang.Object
  extended by com.b3dgs.lionengine.game.Camera
Direct Known Subclasses:
PlatformCamera, StrategyCamera

public class Camera
extends java.lang.Object

Standard camera, able to handle move, and both vertical/horizontal floating interleave. Camera can be used to move easily arround a map by following a specific entity.


Field Summary
protected  float horizontalInterval
          Interleave value.
protected  float verticalInterval
          Interleave value.
protected  float x
          Current and old location.
protected  float xOff
          Current and old offsets.
protected  float xOffOld
          Current and old offsets.
protected  float xOld
          Current and old location.
protected  float y
          Current and old location.
protected  float yOff
          Current and old offsets.
protected  float yOffOld
          Current and old offsets.
protected  float yOld
          Current and old location.
 
Constructor Summary
Camera(int horizontalInterval, int verticalInterval)
          Create a new camera.
 
Method Summary
 void backupLocation()
          Save current location.
 void follow(Entity entity)
          Follow automatically the specified entity.
 float getDiffX()
          Get the horizontal movement.
 float getDiffY()
          Get the vertical movement.
 int getX()
          Get horizontal location.
 float getXOld()
          Get old horizontal location.
 float getXReal()
          Get horizontal location.
 int getY()
          Get vertical location.
 float getYOld()
          Get old vertical location.
 float getYReal()
          Get vertical location.
 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 setIntervals(int horizontalInterval, int verticalInterval)
          Set intervals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected float x
Current and old location.


y

protected float y
Current and old location.


xOld

protected float xOld
Current and old location.


yOld

protected float yOld
Current and old location.


xOff

protected float xOff
Current and old offsets.


xOffOld

protected float xOffOld
Current and old offsets.


yOff

protected float yOff
Current and old offsets.


yOffOld

protected float yOffOld
Current and old offsets.


horizontalInterval

protected float horizontalInterval
Interleave value.


verticalInterval

protected float verticalInterval
Interleave value.

Constructor Detail

Camera

public Camera(int horizontalInterval,
              int verticalInterval)
Create a new camera.

Parameters:
horizontalInterval - horizontal margin.
verticalInterval - vertical margin.
Method Detail

setIntervals

public void setIntervals(int horizontalInterval,
                         int verticalInterval)
Set intervals.

Parameters:
horizontalInterval - horizontal margin.
verticalInterval - vertical margin.

move

public void move(float vx,
                 float vy)
Move the camera using specific vector.

Parameters:
vx - horizontal vector.
vy - vertical vector.

place

public void place(float x,
                  float y)
Place camera at a specific location.

Parameters:
x - horizontal location.
y - vertical location.

follow

public void follow(Entity entity)
Follow automatically the specified entity.

Parameters:
entity - entity to follow.

backupLocation

public void backupLocation()
Save current location.


getXReal

public float getXReal()
Get horizontal location.

Returns:
horizontal location.

getYReal

public float getYReal()
Get vertical location.

Returns:
vertical location.

getX

public int getX()
Get horizontal location.

Returns:
horizontal location.

getY

public int getY()
Get vertical location.

Returns:
vertical location.

getXOld

public float getXOld()
Get old horizontal location.

Returns:
old horizontal location.

getYOld

public float getYOld()
Get old vertical location.

Returns:
old vertical location.

getDiffX

public float getDiffX()
Get the horizontal movement.

Returns:
horizontal movement.

getDiffY

public float getDiffY()
Get the vertical movement.

Returns:
vertical movement.