|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deken.game.sprites.Sprite
org.deken.game.component.GComponent
org.deken.game.component.GContainer
org.deken.game.component.GMenu
public class GMenu
Title: GMenu
Description: This is a container object for storing a menu list.
Copyright: Copyright (c) Mar 6, 2011
Nested Class Summary | |
---|---|
static class |
GMenu.MenuOrientation
|
Nested classes/interfaces inherited from class org.deken.game.component.GComponent |
---|
GComponent.Alignment, GComponent.MouseActions |
Field Summary | |
---|---|
protected java.util.List<java.lang.Integer> |
keyActions
|
protected GComponent.Alignment |
menuAlignment
|
protected int |
menuInset
|
protected java.util.Collection<MenuListener> |
menuListeners
|
protected GMenu.MenuOrientation |
menuOrientation
|
protected int |
spacing
|
Fields inherited from class org.deken.game.component.GContainer |
---|
backgroundColor, grabbed |
Fields inherited from class org.deken.game.component.GComponent |
---|
horizontalAlignment, id, invalid, keyPolling, mouseActions, parent, requestKeyPolling, screenHeight, screenWidth, verticalAlignment, xOffSet, yOffSet |
Fields inherited from class org.deken.game.sprites.Sprite |
---|
boundingBox, collisionMap, location, size |
Constructor Summary | |
---|---|
GMenu(int screenWidth,
int screenHeight)
Constructor |
|
GMenu(int screenWidth,
int screenHeight,
GComponent.Alignment menuAlignment)
|
Method Summary | |
---|---|
void |
add(GComponent component)
Adds the component to this GMenu if it extends GTextContainer. |
void |
add(GTextContainer gameTextContainer)
Add a GameTextContainer at the end of the list. |
void |
add(GTextContainer gameTextContainer,
int index)
Add a GameTextContainer at the given index. |
void |
addInputAction(InputAction inputAction)
add an InputAction for monitoring. |
void |
addMenuListener(MenuListener listener)
|
GMenu |
copy()
|
void |
draw(java.awt.Graphics2D graphics,
int xOffset,
int yOffset)
Calls the draw for all menu times, each time adding the button heights spacing to the next button's Y location. |
java.util.List<? extends GComponent> |
getChildren()
|
GTextContainer |
getComponentByName(java.lang.String name)
|
int |
getHeight()
Return the combined GameButton heights. |
int[] |
getInputActionIds()
Gets the Key IDs. |
java.util.List<GTextContainer> |
getMenuList()
|
int |
getWidth()
Return the width of the menu, subtracting insets. |
void |
notifyButtonListener(java.lang.String name)
|
void |
notifyListener(InputAction inputAction)
Listen for the up and down arrow keys, to move the selection. |
void |
notifyListener(InputMouseAction inputMouseAction)
notifyListener |
void |
remove(GComponent gComponent)
|
void |
setEnabled(boolean enabled)
|
void |
setMenuInset(int menuInset)
|
void |
setMenuOrientation(GMenu.MenuOrientation menuOrientation)
|
void |
setMonitored(boolean active)
|
void |
setScreenHeightWidth(int screenWidth,
int screenHeight)
|
void |
setSpacing(int spacing)
Set the spacing between menu elements. |
protected void |
spriteCollison(Sprite collideSprite)
Handle the collision with another sprite. |
void |
update(long elapseTime)
update |
void |
validate(java.awt.Graphics2D graphics)
|
Methods inherited from class org.deken.game.component.GContainer |
---|
copyBase, isGrabbed, isSizeSet, setBackgroundColor, setGrabbed |
Methods inherited from class org.deken.game.component.GComponent |
---|
addMouseAction, copyBase, getHorizontalAlignment, getMouseActions, getParent, getVerticalAlignment, getXLocation, getYLocation, isEnabled, positionHorizontalAlignment, positionVerticalAlignment, requestKeyPolling, setHorizontalAlignment, setInvalid, setKeyPolling, setParent, setVerticalAlignment |
Methods inherited from class org.deken.game.sprites.Sprite |
---|
getBounds, getDepth, getLocation, getName, getSize, removeFromMap, setBoundingBox, setBoundingBox, setCollisionMap, setLocation, setName, setSize, toString, updateLocation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int spacing
protected int menuInset
protected java.util.List<java.lang.Integer> keyActions
protected GComponent.Alignment menuAlignment
protected java.util.Collection<MenuListener> menuListeners
protected GMenu.MenuOrientation menuOrientation
Constructor Detail |
---|
public GMenu(int screenWidth, int screenHeight)
screenWidth
- screenHeight
- public GMenu(int screenWidth, int screenHeight, GComponent.Alignment menuAlignment)
screenWidth
- screenHeight
- menuAlignment
- Method Detail |
---|
public void add(GComponent component)
add
in class GContainer
component
-
GameException
public void add(GTextContainer gameTextContainer)
gameTextContainer
- public void add(GTextContainer gameTextContainer, int index)
gameTextContainer
- index
- public void addInputAction(InputAction inputAction)
InputListener
addInputAction
in interface InputListener
public void addMenuListener(MenuListener listener)
public GMenu copy()
copy
in class GComponent
public void draw(java.awt.Graphics2D graphics, int xOffset, int yOffset)
draw
in class GComponent
graphics
- xOffset
- yOffset
- public java.util.List<? extends GComponent> getChildren()
getChildren
in class GContainer
public GTextContainer getComponentByName(java.lang.String name)
getComponentByName
in class GContainer
public int getHeight()
getHeight
in class Sprite
public int[] getInputActionIds()
InputListener
getInputActionIds
in interface InputListener
public java.util.List<GTextContainer> getMenuList()
public int getWidth()
getWidth
in class Sprite
public void notifyButtonListener(java.lang.String name)
notifyButtonListener
in interface ButtonListener
public void notifyListener(InputAction inputAction)
notifyListener
in interface InputListener
inputAction
- public void notifyListener(InputMouseAction inputMouseAction)
InputMouseListener
This method is called when any Mouse Motion event occurs.
notifyListener
in interface InputMouseListener
inputMouseAction
- InputMouseActionpublic void remove(GComponent gComponent)
remove
in class GContainer
public void setEnabled(boolean enabled)
setEnabled
in class GComponent
public void setMenuInset(int menuInset)
public void setMenuOrientation(GMenu.MenuOrientation menuOrientation)
public void setMonitored(boolean active)
setMonitored
in class GComponent
public void setScreenHeightWidth(int screenWidth, int screenHeight)
setScreenHeightWidth
in class GContainer
public void setSpacing(int spacing)
spacing
- public void update(long elapseTime)
GComponent
This method takes the elapse time, and calculates the new current frame of the animation.
update
in interface Updateable
update
in class GComponent
elapseTime
- longpublic void validate(java.awt.Graphics2D graphics)
validate
in class GComponent
protected void spriteCollison(Sprite collideSprite)
Sprite
spriteCollison
in class Sprite
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |