|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJTP.Menu
public class Menu
Defines function and rendering of the menu component.
Field Summary | |
---|---|
static int |
EDITOR_BACK
|
static int |
EDITOR_LOAD
|
static int |
EDITOR_NEW
|
static int |
MAIN_EDITOR
|
static int |
MAIN_EXIT
|
static int |
MAIN_HELP
|
static int |
MAIN_HIGHSCORES
|
static int |
MAIN_ONEP
|
static int |
MAIN_TWOP
|
static int |
MENU_CHANGED
|
static int |
MENU_EDITOR
Editor submenu |
static int |
MENU_MAIN
Main menu |
static int |
MENU_MOVED
|
static int |
MENU_ONEP
One player submenu |
static int |
MENU_TWOP
Two player submenu |
static int |
MENU_TWOP_COOP
Two player cooperative submenu |
static int |
MENU_TWOP_VS
Two player versus submenu |
static int |
NONE
|
static int |
ONEP_BACK
|
static int |
ONEP_CHALLENGE
|
static int |
ONEP_LOAD
|
static int |
ONEP_NORMAL
|
static int |
TWOP_BACK
|
static int |
TWOP_COOP
|
static int |
TWOP_COOP_BACK
|
static int |
TWOP_COOP_CHALLENGE
|
static int |
TWOP_COOP_LOAD
|
static int |
TWOP_COOP_NORMAL
|
static int |
TWOP_VS
|
static int |
TWOP_VS_ALT
|
static int |
TWOP_VS_BACK
|
static int |
TWOP_VS_LOAD
|
static int |
TWOP_VS_SIM
|
Constructor Summary | |
---|---|
Menu(ScreenFrames frames,
TilePainter tilePainter,
int vOffset,
int buttonSpacing)
Constructs a new Menu instance with the given parameters. |
Method Summary | |
---|---|
int |
clickResult(Point mouseLocation)
Determine whether a menu button has been clicked (to be called after mousePressed() |
void |
drawAll(Graphics2D g)
|
void |
drawUpdate(Graphics2D g)
|
int |
keyResult(int keyCode)
|
Rectangle |
keyUpdateUI()
|
void |
mousePressed(int button,
Point mouseLocation)
|
void |
setEntryIndex(int i)
Sets which menu entry is highlighted. |
protected void |
setLastUpdateAsKey()
Use to make sure pressing a menu button via mouse/keyboard is handled exactly the same after the mouse leaves the screen. |
void |
setMenu(int menuIndex,
int menuEntryIndex)
Set active menu and entry. |
void |
setMenu(int menuIndex,
Point mousePosition)
Set active menu and highlight entry currently under mouse pointer. |
Rectangle |
updateUI(Point mouseLocation)
Updates state of menu based on current mouse position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MENU_MOVED
public static final int MENU_CHANGED
public static final int NONE
public static final int MAIN_ONEP
public static final int MAIN_TWOP
public static final int MAIN_EDITOR
public static final int MAIN_HIGHSCORES
public static final int MAIN_HELP
public static final int MAIN_EXIT
public static final int ONEP_NORMAL
public static final int ONEP_CHALLENGE
public static final int ONEP_LOAD
public static final int ONEP_BACK
public static final int TWOP_COOP
public static final int TWOP_VS
public static final int TWOP_BACK
public static final int TWOP_COOP_NORMAL
public static final int TWOP_COOP_CHALLENGE
public static final int TWOP_COOP_LOAD
public static final int TWOP_COOP_BACK
public static final int TWOP_VS_SIM
public static final int TWOP_VS_ALT
public static final int TWOP_VS_LOAD
public static final int TWOP_VS_BACK
public static final int EDITOR_NEW
public static final int EDITOR_LOAD
public static final int EDITOR_BACK
public static final int MENU_MAIN
public static final int MENU_ONEP
public static final int MENU_TWOP
public static final int MENU_TWOP_COOP
public static final int MENU_TWOP_VS
public static final int MENU_EDITOR
Constructor Detail |
---|
public Menu(ScreenFrames frames, TilePainter tilePainter, int vOffset, int buttonSpacing)
Menu
instance with the given parameters.
frames
- for drawing borderstilePainter
- for drawing individual menu entriesvOffset
- vertical padding (from top of screen) for menubuttonSpacing
- space in between buttons (in pixels)Method Detail |
---|
public Rectangle updateUI(Point mouseLocation)
mouseLocation
- current mouse position
null
if nothing has to be updated.protected void setLastUpdateAsKey()
public int clickResult(Point mouseLocation)
public void mousePressed(int button, Point mouseLocation)
public int keyResult(int keyCode)
public Rectangle keyUpdateUI()
public void drawUpdate(Graphics2D g)
public void drawAll(Graphics2D g)
public void setMenu(int menuIndex, Point mousePosition) throws IllegalArgumentException
menuIndex
- submenu to switch tomousePosition
- current absolute mouse position
IllegalArgumentException
public void setMenu(int menuIndex, int menuEntryIndex) throws IllegalArgumentException
menuIndex
- submenu to switch tomenuEntryIndex
- which option to highlight (choose NONE
if highlighting not desired at start)
IllegalArgumentException
public void setEntryIndex(int i) throws IllegalArgumentException
i
- of the menu entry to highlight
IllegalArgumentException
- if i
is outside the
range of valid menu entries for the currently active menu.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |