com.b3dgs.lionengine.game.strategy
Class StrategyCamera

java.lang.Object
  extended by com.b3dgs.lionengine.game.Camera
      extended by com.b3dgs.lionengine.game.strategy.StrategyCamera

public class StrategyCamera
extends Camera

This camera should be used for a strategy oriented game. It allows free movement arround the current map, using its border as limit. It is also possible to define specific keys for camera handling.


Field Summary
 
Fields inherited from class com.b3dgs.lionengine.game.Camera
horizontalInterval, verticalInterval, x, xOff, xOffOld, xOld, y, yOff, yOffOld, yOld
 
Constructor Summary
StrategyCamera(Screen screen, AbstractControlPanel<?,?,?> panel, int hStep, int vStep)
          Create a strategy oriented camera.
 
Method Summary
 void follow(Entity entity)
          Follow automatically the specified entity.
 int getOffsetX()
          Get horizontal offset.
 int getOffsetY()
          Get vertical offset.
 int getX()
          Get horizontal location.
 float getXReal()
          Get horizontal location.
 int getY()
          Get vertical location.
 float getYReal()
          Get vertical location.
 void move(float vx, float vy)
          Move the camera using specific vector.
 void setBorders(TileBasedMap<?> map, AbstractControlPanel<?,?,?> panel)
          Set up camera limits depending of the map.
 void setKeys(int left, int right, int up, int down)
          Set specific camera keyboard controls.
 void setOffsets(AbstractControlPanel<?,?,?> panel)
          Calculate offset depending of the control panel.
 void setSensibility(int hSens, int vSens)
          Set camera sensibility (the lowest it is, the fastest it is).
 void update(Keyboard keyboard, Mouse mouse, float extrp)
          Update camera by handling its movements.
 
Methods inherited from class com.b3dgs.lionengine.game.Camera
backupLocation, getDiffX, getDiffY, getXOld, getYOld, place, setIntervals
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrategyCamera

public StrategyCamera(Screen screen,
                      AbstractControlPanel<?,?,?> panel,
                      int hStep,
                      int vStep)
Create a strategy oriented camera. Don't forget to call setBorders function when the map is loaded.

Parameters:
screen - screen reference.
hStep - horizontal force move.
vStep - vertical force move.
Method Detail

setSensibility

public void setSensibility(int hSens,
                           int vSens)
Set camera sensibility (the lowest it is, the fastest it is).

Parameters:
hSens - horizontal sensibility value.
vSens - vertical sensibility value.

setOffsets

public void setOffsets(AbstractControlPanel<?,?,?> panel)
Calculate offset depending of the control panel. Usefull to apply an offset during map rendering, in order to avoid map hidding part.

Parameters:
panel - panel reference.

setBorders

public void setBorders(TileBasedMap<?> map,
                       AbstractControlPanel<?,?,?> panel)
Set up camera limits depending of the map.

Parameters:
map - map reference.
panel - control panel reference;

update

public void update(Keyboard keyboard,
                   Mouse mouse,
                   float extrp)
Update camera by handling its movements.

Parameters:
keyboard - keyboard reference.
mouse - mouse reference.
extrp - extrapolation value.

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.

follow

public void follow(Entity entity)
Description copied from class: Camera
Follow automatically the specified entity.

Overrides:
follow in class Camera
Parameters:
entity - entity to follow.

setKeys

public void setKeys(int left,
                    int right,
                    int up,
                    int down)
Set specific camera keyboard controls.

Parameters:
left - left key.
right - right key.
up - up key.
down - down key.
See Also:
Keyboard

getX

public int getX()
Description copied from class: Camera
Get horizontal location.

Overrides:
getX in class Camera
Returns:
horizontal location.

getY

public int getY()
Description copied from class: Camera
Get vertical location.

Overrides:
getY in class Camera
Returns:
vertical location.

getXReal

public float getXReal()
Description copied from class: Camera
Get horizontal location.

Overrides:
getXReal in class Camera
Returns:
horizontal location.

getYReal

public float getYReal()
Description copied from class: Camera
Get vertical location.

Overrides:
getYReal in class Camera
Returns:
vertical location.

getOffsetX

public int getOffsetX()
Get horizontal offset.

Returns:
horizontal offset.

getOffsetY

public int getOffsetY()
Get vertical offset.

Returns:
vertical offset.