E
- Entity type used.public abstract class ControlPanelModel<E extends EntityStrategy> extends Object implements ControlPanelListener
Modifier and Type | Field and Description |
---|---|
protected PlayerStrategy |
player
Player owning the control panel.
|
Constructor and Description |
---|
ControlPanelModel()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ControlPanelListener listener)
Add a control panel listener.
|
boolean |
canClick(CursorStrategy cursor)
Check if cursor can click on panel.
|
protected int |
computeSelectionHeight(CursorStrategy cursor,
CameraStrategy camera,
int sx,
int sy)
Perform the height selection by considering the click point and current location.
|
protected int |
computeSelectionWidth(CursorStrategy cursor,
CameraStrategy camera,
int sx,
int sy)
Perform the width selection by considering the click point and current location.
|
com.b3dgs.lionengine.Rectangle |
getArea()
Get clickable area on map (out panel).
|
boolean |
isOrdered()
Check if panel is in ordered mode (waiting for a second click).
|
boolean |
isSelecting()
Check if panel is in selection mode.
|
void |
notifySelectionDone(com.b3dgs.lionengine.Rectangle selection)
Notify when selection is done.
|
void |
notifySelectionStarted(com.b3dgs.lionengine.Rectangle selection)
Notify when selection started.
|
abstract void |
notifyUpdatedSelection(Set<E> selection)
Called when the selection has been updated by the handler.
|
protected abstract void |
onStartOrder()
Called when an order started.
|
protected abstract void |
onTerminateOrder()
Called when an order terminated.
|
void |
ordered()
Set the ordered state (when an action skill is chosen).
|
void |
removeListener(ControlPanelListener listener)
Add a control panel listener.
|
void |
renderCursorSelection(com.b3dgs.lionengine.Graphic g,
CameraStrategy camera)
Render cursor selection routine.
|
void |
resetOrder()
Reset order state (order failed).
|
void |
setClickableArea(CameraGame camera)
Set clickable area on map (not on panel), depending of the camera view.
|
void |
setClickableArea(com.b3dgs.lionengine.Rectangle area)
Set clickable area on map (not on panel).
|
void |
setClickSelection(int click)
Set the mouse click selection value.
|
void |
setPlayer(PlayerStrategy player)
Set player (player owning this panel).
|
void |
setSelectionColor(com.b3dgs.lionengine.ColorRgba color)
Set the selection color.
|
void |
update(double extrp,
CameraStrategy camera,
CursorStrategy cursor,
com.b3dgs.lionengine.Keyboard keyboard)
Update panel routine.
|
protected void |
updateCursorSelection(CursorStrategy cursor,
CameraStrategy camera)
Function handling cursor selection (preparing area transposed on the map).
|
protected PlayerStrategy player
public abstract void notifyUpdatedSelection(Set<E> selection)
selection
- The selected entities.protected abstract void onStartOrder()
protected abstract void onTerminateOrder()
public void addListener(ControlPanelListener listener)
listener
- The listener.public void removeListener(ControlPanelListener listener)
listener
- The listener.public void update(double extrp, CameraStrategy camera, CursorStrategy cursor, com.b3dgs.lionengine.Keyboard keyboard)
extrp
- The extrapolation value.camera
- The camera viewpoint.cursor
- The cursor reference (used for selection).keyboard
- The keyboard reference.public void renderCursorSelection(com.b3dgs.lionengine.Graphic g, CameraStrategy camera)
g
- The graphic output.camera
- The camera reference.public void resetOrder()
public void setClickSelection(int click)
click
- The click id.public void setClickableArea(com.b3dgs.lionengine.Rectangle area)
area
- The area representing the clickable area.public void setClickableArea(CameraGame camera)
camera
- The camera reference.public void setPlayer(PlayerStrategy player)
player
- The player reference.public void setSelectionColor(com.b3dgs.lionengine.ColorRgba color)
color
- The selection color.public com.b3dgs.lionengine.Rectangle getArea()
public boolean canClick(CursorStrategy cursor)
cursor
- The cursor reference.true
if can click on panel, false
else.public void ordered()
public boolean isOrdered()
true
if ordering, false
else.public boolean isSelecting()
true
if selecting, false
else.protected void updateCursorSelection(CursorStrategy cursor, CameraStrategy camera)
cursor
- The cursor reference.camera
- The camera reference.protected int computeSelectionWidth(CursorStrategy cursor, CameraStrategy camera, int sx, int sy)
cursor
- The cursor reference.camera
- The camera reference.sx
- The starting horizontal click.sy
- The starting vertical click.protected int computeSelectionHeight(CursorStrategy cursor, CameraStrategy camera, int sx, int sy)
cursor
- The cursor reference.camera
- The camera reference.sx
- The starting horizontal click.sy
- The starting vertical click.public void notifySelectionStarted(com.b3dgs.lionengine.Rectangle selection)
ControlPanelListener
notifySelectionStarted
in interface ControlPanelListener
selection
- The selection.public void notifySelectionDone(com.b3dgs.lionengine.Rectangle selection)
ControlPanelListener
notifySelectionDone
in interface ControlPanelListener
selection
- The selection.Copyright © 2014 Byron 3D Games Studio. All rights reserved.