|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.b3dgs.lionengine.game.strategy.AbstractControlPanel<TTile,TSkill,TAttr>
TTile
- tile type used.TSkill
- skill type used.TAttr
- attributes type used.public abstract class AbstractControlPanel<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
This class represents the control panel (hud), which will contain selected entrys, actions, and many other infos. It supports differents types of axis, by auto blocking the selection if necessary. Panel has to be used with an entry handler, in order to control them all (use setEntryHandler).
AbstractEntryHandler
Field Summary | |
---|---|
protected java.util.List<PanelComponent> |
components
|
protected AbstractEntryHandler<TTile,TSkill,TAttr> |
entrys
Entry handler reference. |
protected TiledSprite |
icons
Available icons inside surface. |
protected Sprite |
panel
Control panel image. |
protected AbstractPlayer |
player
Player owning the control panel. |
Constructor Summary | |
---|---|
AbstractControlPanel(Sprite panel,
TiledSprite icons)
Create a new control panel. |
Method Summary | |
---|---|
void |
addComponent(PanelComponent component)
|
void |
checkCursor(StrategyCursor cursor)
Check if cursor is inside or outside the panel (this avoid selection inside panel). |
java.awt.geom.Rectangle2D |
getArea()
Get clickable area on map (out panel). |
java.util.List<PanelComponent> |
getComponents()
|
void |
render(java.awt.Graphics2D g,
StrategyCursor cursor)
Panel rendering need to be defined here (list of selected entrys, informations...). |
protected void |
renderEntrySkills(java.awt.Graphics2D g,
StrategyCursor cursor,
AbstractEntry<TTile,TSkill,TAttr> entry,
int isx,
int isy,
int mw,
int mh,
int ipl)
Render entry skills icons (in case of a single entry selection). |
protected void |
renderEntrysSkills(java.awt.Graphics2D g,
StrategyCursor cursor,
java.util.Set<AbstractEntry<TTile,TSkill,TAttr>> entrys,
int isx,
int isy,
int mw,
int mh,
int ipl,
java.util.Set<java.lang.String> ignore)
Render entrys skills icons (only common skills, in case of multiple entry selection). |
protected abstract void |
renderMultipleEntry(java.awt.Graphics2D g,
StrategyCursor cursor,
java.util.Set<AbstractEntry<TTile,TSkill,TAttr>> entrys)
Rendering function in case of many selected unit. |
protected abstract void |
renderSingleEntry(java.awt.Graphics2D g,
StrategyCursor cursor,
AbstractEntry<TTile,TSkill,TAttr> entry)
Rendering function in case of a single selected unit. |
void |
setClickableArea(int x,
int y,
int width,
int height)
Set clickable area on map (not on panel). |
void |
setEntryHandler(AbstractEntryHandler<TTile,TSkill,TAttr> entrys)
Set entry handler reference. |
void |
setPlayer(AbstractPlayer player)
Set player (player owning this panel). |
protected void |
updateSkill(java.awt.Graphics2D g,
StrategyCursor cursor,
TSkill skill,
int ico,
int ix,
int iy,
int iw,
int ih)
Rendering of a specific skill. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final TiledSprite icons
protected final Sprite panel
protected AbstractPlayer player
protected AbstractEntryHandler<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes> entrys
protected final java.util.List<PanelComponent> components
Constructor Detail |
---|
public AbstractControlPanel(Sprite panel, TiledSprite icons)
panel
- panel image.icons
- panel icons set.Method Detail |
---|
public void setClickableArea(int x, int y, int width, int height)
x
- starting clickable location x.y
- starting clickable location y.width
- clickable area width.height
- clickable area height.public void setEntryHandler(AbstractEntryHandler<TTile,TSkill,TAttr> entrys)
entrys
- entry handler reference.public void render(java.awt.Graphics2D g, StrategyCursor cursor)
g
- graphic output.cursor
- cursor reference.protected abstract void renderSingleEntry(java.awt.Graphics2D g, StrategyCursor cursor, AbstractEntry<TTile,TSkill,TAttr> entry)
g
- graphic output.cursor
- cursor reference.entry
- current entry.protected abstract void renderMultipleEntry(java.awt.Graphics2D g, StrategyCursor cursor, java.util.Set<AbstractEntry<TTile,TSkill,TAttr>> entrys)
g
- graphic output.cursor
- cursor reference.entrys
- list of selected entrys.protected void renderEntrySkills(java.awt.Graphics2D g, StrategyCursor cursor, AbstractEntry<TTile,TSkill,TAttr> entry, int isx, int isy, int mw, int mh, int ipl)
g
- graphic output.cursor
- cursor reference.entry
- current entry.isx
- icons starting location x.isy
- icons starting location y.mw
- horizontal margin bewteen icons.mh
- vertical margin bewteen icons.ipl
- number of icons per line.protected void renderEntrysSkills(java.awt.Graphics2D g, StrategyCursor cursor, java.util.Set<AbstractEntry<TTile,TSkill,TAttr>> entrys, int isx, int isy, int mw, int mh, int ipl, java.util.Set<java.lang.String> ignore)
g
- graphic output.cursor
- cursor reference.entrys
- list of selected entrys.isx
- icons starting location x.isy
- icons starting location y.mw
- horizontal margin bewteen icons.mh
- vertical margin bewteen icons.ipl
- number of icons per line.ignore
- set of skill name to ignore on multiple selection.protected void updateSkill(java.awt.Graphics2D g, StrategyCursor cursor, TSkill skill, int ico, int ix, int iy, int iw, int ih)
super.renderSkill(g, cursor, entry, skill, ico, ix, iy, iw, ih); int cx = cursor.getX(), cy = cursor.getY(); if (cx >= ix && cx <= ix + iw && cy >= iy && cy <= iy + ih) { g.setColor(Color.RED); g.drawRect(ix, iy, iw, ih); }
g
- graphic output.cursor
- cursor reference.skill
- current skill.ico
- icon number.ix
- icon location x.iy
- icon location y.iw
- icon width.ih
- icon height.public void checkCursor(StrategyCursor cursor)
cursor
- cursor reference.public java.awt.geom.Rectangle2D getArea()
public void setPlayer(AbstractPlayer player)
player
- player reference.public void addComponent(PanelComponent component)
public java.util.List<PanelComponent> getComponents()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |