|
||||||||||
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
public abstract class GComponent
Title: GComponent
Description: This abstract object is an element that is used for user interaction. GComponents can be any type of element that the user will directly interact with, such as a button, or window.
The GComponent has a location that is relative to its parent. if there is no parent, the location is relative to the top of the viewing screen. The GComponent has a height and width. It can be seen or not seen. It can be enabled or disabled. A GComponent can tell if it has been clicked by the mouse. It can tell if it has focus or not. Even though a GComponents is a sprite, it is intended to be added to a map through the addComponent() method. The map will render all components on top of every other element.Copyright: Copyright (c) 2006
Nested Class Summary | |
---|---|
static class |
GComponent.Alignment
|
static class |
GComponent.MouseActions
|
Field Summary | |
---|---|
protected GComponent.Alignment |
horizontalAlignment
|
protected static int |
id
|
protected boolean |
invalid
|
protected keyPolling |
keyPolling
|
protected java.util.List<InputMonitor.Mouse> |
mouseActions
|
protected GContainer |
parent
|
protected boolean |
requestKeyPolling
|
protected int |
screenHeight
|
protected int |
screenWidth
|
protected GComponent.Alignment |
verticalAlignment
|
protected int |
xOffSet
|
protected int |
yOffSet
|
Fields inherited from class org.deken.game.sprites.Sprite |
---|
boundingBox, collisionMap, location, size |
Constructor Summary | |
---|---|
GComponent()
|
|
GComponent(InputMonitor.Mouse mouseAction)
|
Method Summary | |
---|---|
void |
addMouseAction(InputMonitor.Mouse mouseAction)
|
abstract GComponent |
copy()
|
protected GComponent |
copyBase(GComponent component)
|
abstract void |
draw(java.awt.Graphics2D graphics,
int xOffset,
int yOffset)
Draws the sprite with the current offset. |
GComponent.Alignment |
getHorizontalAlignment()
|
java.util.List<InputMonitor.Mouse> |
getMouseActions()
Returns a list of MouseActions that this component will listen for. |
GContainer |
getParent()
|
GComponent.Alignment |
getVerticalAlignment()
|
double |
getXLocation()
getXLocation |
double |
getYLocation()
getYLocation |
boolean |
isEnabled()
|
protected void |
positionHorizontalAlignment()
Calculates the horizontal position based on the parent or screen width, and the Alignment set. |
protected void |
positionVerticalAlignment()
Calculates the vertical position based on the parent or screen height, and the Alignment set. |
boolean |
requestKeyPolling()
|
void |
setEnabled(boolean enabled)
|
void |
setHorizontalAlignment(GComponent.Alignment horizontalAlignment,
int screenWidth)
|
void |
setInvalid()
Makes this GComponent invalid, so that it will be re-validated. |
void |
setKeyPolling(keyPolling polling)
|
abstract void |
setMonitored(boolean active)
|
void |
setParent(GContainer parent)
|
void |
setVerticalAlignment(GComponent.Alignment verticalAlignment,
int screenHeight)
|
abstract void |
update(long elapseTime)
update |
abstract void |
validate(java.awt.Graphics2D graphics)
|
Methods inherited from class org.deken.game.sprites.Sprite |
---|
getBounds, getDepth, getHeight, getLocation, getName, getSize, getWidth, removeFromMap, setBoundingBox, setBoundingBox, setCollisionMap, setLocation, setName, setSize, spriteCollison, toString, updateLocation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.deken.game.input.InputMouseListener |
---|
notifyListener |
Field Detail |
---|
protected static int id
protected java.util.List<InputMonitor.Mouse> mouseActions
protected boolean requestKeyPolling
protected keyPolling keyPolling
protected GContainer parent
protected int xOffSet
protected int yOffSet
protected boolean invalid
protected GComponent.Alignment horizontalAlignment
protected GComponent.Alignment verticalAlignment
protected int screenWidth
protected int screenHeight
Constructor Detail |
---|
public GComponent()
public GComponent(InputMonitor.Mouse mouseAction)
Method Detail |
---|
public void addMouseAction(InputMonitor.Mouse mouseAction)
mouseAction
- public abstract GComponent copy()
copy
in class Sprite
public abstract void draw(java.awt.Graphics2D graphics, int xOffset, int yOffset)
draw
in class Sprite
graphics
- xOffset
- yOffset
- public GComponent.Alignment getHorizontalAlignment()
public java.util.List<InputMonitor.Mouse> getMouseActions()
public GContainer getParent()
public GComponent.Alignment getVerticalAlignment()
public double getXLocation()
getXLocation
in class Sprite
public double getYLocation()
getYLocation
in class Sprite
public boolean isEnabled()
public boolean requestKeyPolling()
public void setEnabled(boolean enabled)
enabled
- public void setHorizontalAlignment(GComponent.Alignment horizontalAlignment, int screenWidth)
horizontalAlignment
- screenWidth
- public void setInvalid()
public void setKeyPolling(keyPolling polling)
public abstract void setMonitored(boolean active)
public void setParent(GContainer parent)
parent
- public void setVerticalAlignment(GComponent.Alignment verticalAlignment, int screenHeight)
verticalAlignment
- screenHeight
- public abstract void update(long elapseTime)
This method takes the elapse time, and calculates the new current frame of the animation.
update
in interface Updateable
update
in class Sprite
elapseTime
- longpublic abstract void validate(java.awt.Graphics2D graphics)
graphics
- protected GComponent copyBase(GComponent component)
protected void positionVerticalAlignment()
protected void positionHorizontalAlignment()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |