|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJTP.LevelChooser
public class LevelChooser
Defines function and rendering of the level chooser component.
Field Summary | |
---|---|
static int |
CLOSE
|
static int |
COOP
|
static int |
CUSTOM
|
static int |
EXIT
|
static int |
FIRST
|
static int |
LAST
|
static int |
LEVEL_CHANGED
|
static int |
LEVEL_CHOSEN
|
static int |
NEXT
|
static int |
NONE
|
static int |
PLAY
|
static int |
PREVIOUS
|
static int |
SINGLE
|
Constructor Summary | |
---|---|
LevelChooser(TilePainter painter,
Images imgData,
ScreenFrames frames,
LevelSet[] defaultLevelSets,
Font txtFont,
Color txtColor,
Graphics2D g)
Create a new LevelChooser instance with the given attributes. |
Method Summary | |
---|---|
int |
clickResult(Point mouseLocation)
|
void |
drawAll(Graphics2D g)
|
void |
drawUpdate(Graphics2D g)
|
int |
getChosenLevel()
Returns currently highlighted level |
int |
keyResult(int keyCode)
|
void |
mousePressed(int button,
Point mouseLocation)
|
void |
setCustomLevelSet(LevelSet ls,
boolean twoPlayer)
Specify a levelset which can be previewed in CUSTOM mode. |
void |
setLevelSet(int type)
Specify which levelset to display. |
Rectangle |
updateUI(Point mouseLocation)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NONE
public static final int FIRST
public static final int PREVIOUS
public static final int NEXT
public static final int LAST
public static final int PLAY
public static final int CLOSE
public static final int LEVEL_CHANGED
public static final int LEVEL_CHOSEN
public static final int EXIT
public static final int SINGLE
public static final int COOP
public static final int CUSTOM
Constructor Detail |
---|
public LevelChooser(TilePainter painter, Images imgData, ScreenFrames frames, LevelSet[] defaultLevelSets, Font txtFont, Color txtColor, Graphics2D g)
LevelChooser
instance with the given attributes.
painter
- used to draw previews and buttonsimgData
- provides access to global resourcesframes
- used to draw framesdefaultLevelSets
- holds single, cooperative, versus and versus
alternative levelsets (at most single and cooperative sets are required
in that order)txtFont
- font style to use (not for buttons)txtColor
- colour to use for textg
- the graphics context for drawingMethod Detail |
---|
public void setCustomLevelSet(LevelSet ls, boolean twoPlayer) throws NullPointerException
CUSTOM
mode.
ls
- the levelset to loadtwoPlayer
- if false
then two player levelsets are
rendered without 2nd start (when choosing to play 2P levelset in 1P mode)
NullPointerException
- if ls
is null
.public void setLevelSet(int type) throws IllegalArgumentException, NullPointerException
type
- one of SINGLE
, COOP
or CUSTOM
.
IllegalArgumentException
- if type is invalid
NullPointerException
- if CUSTOM
type has been chosen
without previously choosing a custom set via the setCustomLevelSet
method.public void drawAll(Graphics2D g)
public void drawUpdate(Graphics2D g)
public Rectangle updateUI(Point mouseLocation)
public int clickResult(Point mouseLocation)
public int getChosenLevel()
public void mousePressed(int button, Point mouseLocation)
public int keyResult(int keyCode)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |