|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.b3dgs.lionengine.game.Handler<AbstractEntry<TTile,TSkill,TAttr>>
com.b3dgs.lionengine.game.strategy.AbstractEntryHandler<TTile,TSkill,TAttr>
TTile
- tile type used.TSkill
- skill type used.TAttr
- attributes type used.public abstract class AbstractEntryHandler<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
This class will handle a list of entrys, by updating and rendering them. All action are defined here, such as selection and orders. It need a control panel to work properly. Don't forget to call createLayers(map) after map creation (when its size is established).
AbstractControlPanel
Field Summary | |
---|---|
protected boolean |
clicked
Handler flags. |
protected boolean |
clickedFlag
Handler flags. |
protected boolean |
ordered
Handler flags. |
protected AbstractControlPanel<TTile,TSkill,TAttr> |
panel
Control panel reference. |
protected AbstractPlayer |
player
Player reference. |
protected boolean |
selected
Handler flags. |
protected boolean |
selecting
Handler flags. |
java.util.Set<AbstractEntry<TTile,TSkill,TAttr>> |
selection
Current entry selection set. |
Fields inherited from class com.b3dgs.lionengine.game.Handler |
---|
elements |
Constructor Summary | |
---|---|
AbstractEntryHandler(AbstractControlPanel<TTile,TSkill,TAttr> panel)
Create a new entry handler. |
Method Summary | |
---|---|
void |
add(AbstractEntry<TTile,TSkill,TAttr> entry)
Add an element to the handler list. |
protected abstract boolean |
canBeSelected(AbstractEntry<TTile,TSkill,TAttr> entry)
Check if entry is selectable. |
void |
createLayers(TileBasedMap<TTile> map)
Prepare rendering layers, depending of the map height. |
java.util.Set<AbstractEntry<TTile,TSkill,TAttr>> |
getSelection()
Get list of selected entrys during cursor selection. |
void |
remove(AbstractEntry<TTile,TSkill,TAttr> entry)
Remove an entry from the handler list. |
void |
render(java.awt.Graphics2D g,
StrategyCamera camera,
StrategyCursor cursor)
Main rendering routine; has to be called in a game loop. |
void |
renderCursorSelection(java.awt.Graphics2D g,
java.awt.Color color,
int x,
int y,
int w,
int h)
Rendering selection properties. |
void |
renderCursorSelection(java.awt.Graphics2D g,
StrategyCamera camera)
Render cursor selection routine. |
void |
renderEntry(java.awt.Graphics2D g,
AbstractEntry<TTile,TSkill,TAttr> entry,
StrategyCamera camera,
StrategyCursor cursor)
Rendering function for an entry. |
void |
renderEntryOver(java.awt.Graphics2D g,
AbstractEntry<TTile,TSkill,TAttr> entry,
StrategyCamera camera,
java.awt.Color color)
Rendering function concerning cursor over entry case. |
void |
renderEntrySelection(java.awt.Graphics2D g,
AbstractEntry<TTile,TSkill,TAttr> entry,
StrategyCamera camera,
java.awt.Color color)
Rendering function concerning selection state. |
void |
setOrdered(boolean state)
Set the ordered state (true when an action [skill] is chosen). |
void |
setPlayer(AbstractPlayer player)
Set player (player owning this panel). |
void |
update(Keyboard keyboard,
StrategyCursor cursor,
StrategyCamera camera,
float extrp)
Main routine; has to be called in main game loop. |
void |
updateCursorSelection(StrategyCursor cursor,
StrategyCamera camera)
Function handling cursor selection (preparing area transposed on the map). |
void |
updateEntry(Keyboard keyboard,
StrategyCursor cursor,
StrategyCamera camera,
AbstractEntry<TTile,TSkill,TAttr> entry,
float extrp)
Update current entry, by handling mouse orders, over, and selection. |
Methods inherited from class com.b3dgs.lionengine.game.Handler |
---|
list, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final java.util.Set<AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>> selection
protected final AbstractControlPanel<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes> panel
protected AbstractPlayer player
protected boolean clicked
protected boolean clickedFlag
protected boolean selecting
protected boolean selected
protected boolean ordered
Constructor Detail |
---|
public AbstractEntryHandler(AbstractControlPanel<TTile,TSkill,TAttr> panel)
panel
- control panel reference.Method Detail |
---|
public void createLayers(TileBasedMap<TTile> map)
map
- map reference.public void add(AbstractEntry<TTile,TSkill,TAttr> entry)
Handler
add
in class Handler<AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>>
entry
- element to add.public void remove(AbstractEntry<TTile,TSkill,TAttr> entry)
entry
- entry to remove.public void update(Keyboard keyboard, StrategyCursor cursor, StrategyCamera camera, float extrp)
keyboard
- keyboard reference.cursor
- cursor reference (used for selection).camera
- camera viewpoint.extrp
- extrapolation value.public void updateCursorSelection(StrategyCursor cursor, StrategyCamera camera)
cursor
- cursor reference.camera
- camera reference.public void updateEntry(Keyboard keyboard, StrategyCursor cursor, StrategyCamera camera, AbstractEntry<TTile,TSkill,TAttr> entry, float extrp)
keyboard
- keyboard reference.entry
- current entry.cursor
- cursor reference.camera
- camera reference.extrp
- extrapolation value.protected abstract boolean canBeSelected(AbstractEntry<TTile,TSkill,TAttr> entry)
entry
- entry to check.
public void render(java.awt.Graphics2D g, StrategyCamera camera, StrategyCursor cursor)
g
- graphic output.camera
- camera reference.cursor
- cursor reference.public void renderCursorSelection(java.awt.Graphics2D g, StrategyCamera camera)
g
- graphic output.camera
- camera reference.public void renderCursorSelection(java.awt.Graphics2D g, java.awt.Color color, int x, int y, int w, int h)
g
- graphic output.color
- selection color.x
- horizontal selection location (screen referential).y
- vertical selection location (screen referential).w
- selection width.h
- selection height.public void renderEntry(java.awt.Graphics2D g, AbstractEntry<TTile,TSkill,TAttr> entry, StrategyCamera camera, StrategyCursor cursor)
g
- graphic output.entry
- current entry.camera
- camera reference.cursor
- cursor reference.public void renderEntryOver(java.awt.Graphics2D g, AbstractEntry<TTile,TSkill,TAttr> entry, StrategyCamera camera, java.awt.Color color)
g
- graphic output.entry
- current entry.camera
- camera reference.color
- box color.public void renderEntrySelection(java.awt.Graphics2D g, AbstractEntry<TTile,TSkill,TAttr> entry, StrategyCamera camera, java.awt.Color color)
g
- graphic output.entry
- current entry.camera
- camera reference.color
- box color.public void setOrdered(boolean state)
state
- ordered state.public java.util.Set<AbstractEntry<TTile,TSkill,TAttr>> getSelection()
public void setPlayer(AbstractPlayer player)
player
- player reference.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |