|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.b3dgs.lionengine.game.strategy.StrategyCursor
public class StrategyCursor
This class can be used to handle easely a strategy cursor, designed to select and give order to any kind of entry. The cursor is asynchronous compared to the mouse window.
AbstractEntry
Constructor Summary | |
---|---|
StrategyCursor(Screen screen,
java.lang.String cursor,
TileBasedMap<?> map)
Create a new strategy cursor. |
Method Summary | |
---|---|
boolean |
canClick(AbstractControlPanel<?,?,?> panel)
Check if cursor can click for a selection (cursor outside panel). |
void |
fixBetween(int minX,
int minY,
int maxX,
int maxY)
Allow cursor to move only in the specified area. |
int |
getClick()
Return mouse click number. |
java.awt.geom.Rectangle2D |
getGrid(int size)
Get a rectangle describing a grid (placed on the cursor, depending of map tile size). |
int |
getHorizontalMapTile()
Get the horizontal tile pointed by the cursor. |
float |
getHorizontalSensibility()
Get horizontal sensibility. |
int |
getMoveX()
Get cursor horizontal move. |
int |
getMoveY()
Get cursor vertical move. |
int |
getScreenX()
Get cursor location x on screen (not synced to any camera). |
int |
getScreenY()
Get cursor location y on screen (not synced to any camera). |
int |
getVerticalMapTile()
Get the vertical tile pointed by the cursor. |
float |
getVerticalSensibility()
Get vertical sensibility. |
int |
getX()
Get cursor location x on map (synced to camera). |
int |
getX(int sx,
int sy)
Get real location x (from map referential), avoiding control panel. |
int |
getY()
Get cursor location y on map (synced to camera). |
int |
getY(int sx,
int sy)
Get real location y (from map referential), avoiding control panel (see checkCursor). |
void |
lockMouse(boolean lock)
Lock mouse state. |
void |
place(int x,
int y)
Set cursor location. |
void |
render(java.awt.Graphics2D g)
Render cursor on screen. |
void |
setLimits(java.awt.geom.Rectangle2D clickableArea)
Set clickable area. |
void |
setSensibility(int sh,
int sv)
Set cursor sensibility (move speed). |
void |
update(Mouse mouse,
boolean async,
float extrp)
Deprecated. Call update(Mouse mouse, StrategyCamera camera, float extrp) instead. |
void |
update(Mouse mouse,
boolean async,
StrategyCamera camera,
float extrp)
This update function is preferable to the other one, as it allows to interact with objects in the map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StrategyCursor(Screen screen, java.lang.String cursor, TileBasedMap<?> map)
screen
- screen reference.cursor
- cursor image path.map
- map reference.Method Detail |
---|
public void setLimits(java.awt.geom.Rectangle2D clickableArea)
clickableArea
- clickable area.AbstractControlPanel
public boolean canClick(AbstractControlPanel<?,?,?> panel)
panel
- panel reference.
@Deprecated public void update(Mouse mouse, boolean async, float extrp)
Cursor
update
in interface Cursor
mouse
- mouse reference.extrp
- extrapolation value.public void update(Mouse mouse, boolean async, StrategyCamera camera, float extrp)
mouse
- mouse reference.camera
- camera reference.extrp
- extrapolation value.public void render(java.awt.Graphics2D g)
Cursor
render
in interface Cursor
g
- graphic output.public java.awt.geom.Rectangle2D getGrid(int size)
size
- size (in tile square).
public void setSensibility(int sh, int sv)
Cursor
setSensibility
in interface Cursor
sh
- horizontal speed.sv
- vertical speed.public int getClick()
Cursor
getClick
in interface Cursor
public void place(int x, int y)
Cursor
place
in interface Cursor
x
- horizontal location.y
- vertical location.public void fixBetween(int minX, int minY, int maxX, int maxY)
Cursor
fixBetween
in interface Cursor
minX
- minimal x.minY
- minimal y.maxX
- maximal x.maxY
- maximal y.public int getX()
getX
in interface Cursor
public int getY()
getY
in interface Cursor
public int getScreenX()
public int getScreenY()
public int getX(int sx, int sy)
sx
- starting selection location x.sy
- starting selection location y.
AbstractControlPanel
public int getY(int sx, int sy)
sx
- starting selection location x.sy
- starting selection location y.
AbstractControlPanel
public int getHorizontalMapTile()
public int getVerticalMapTile()
public float getHorizontalSensibility()
Cursor
getHorizontalSensibility
in interface Cursor
public float getVerticalSensibility()
Cursor
getVerticalSensibility
in interface Cursor
public int getMoveX()
public int getMoveY()
public void lockMouse(boolean lock)
Cursor
lockMouse
in interface Cursor
lock
- true to lock mouse.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |