|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJTP.Editor
public class Editor
Defines function and rendering of the editor component.
Field Summary | |
---|---|
static int |
ARROW_DOWN
|
static int |
ARROW_LEFT
|
static int |
ARROW_RIGHT
|
static int |
ARROW_UP
|
static int |
CLOSE
|
static int |
GRAVITY
|
static int |
GRID
|
static int |
ICE
|
static int |
LEVEL_BACK
|
static int |
LEVEL_CLEAR
|
static int |
LEVEL_FIRST
|
static int |
LEVEL_FORWARD
|
static int |
LEVEL_LAST
|
static int |
LEVEL_MESSAGES
|
static int |
LEVEL_PLAY
|
static int |
LEVEL_SWAP
|
static int |
LEVEL_TIME
|
static int |
NONE
|
static int |
NORMAL
|
static int |
SAVE
|
static int |
SAVECLOSE
|
static int |
START
|
static int |
START2
|
static int |
TELEPORT
|
Constructor Summary | |
---|---|
Editor(Images imgData,
ScreenFrames frames,
TilePainter tPainter,
int gridSize,
int tileHeightLimit,
int buttonSpacing,
float buttonBorderThickness,
Color buttonBorderColor,
Font txtFont,
Color gridColor,
Color gridHighlight,
Color txtColor,
Graphics2D g,
String fileExtension,
String levelSetFilename)
Creates a new Editor instance with the specified parameters. |
Method Summary | |
---|---|
int |
clickResult(int button,
Component screen)
Handles mouse (up) events based on last mouse location from last updateUI call. |
boolean |
cursorChange()
Indicates whether the cursor should be change (e.g. |
boolean |
cursorChange(boolean exit)
Indicates whether the cursor should be change (e.g. |
void |
drawAll(Graphics2D g)
Draws all editor components and grid. |
void |
drawClickUpdate(Graphics2D g)
Draws update after mouse click (call after clickResult ) |
void |
drawKeyUpdate(Graphics2D g)
Draws update required after keypress (call after keyUpdate ) |
void |
drawUpdate(Graphics2D g)
Draw any required changes after mouse movement (call after updateUI |
LevelSet |
getTestSet()
Returns levelset for testing (so can be loaded into GamePlayer
. |
int |
keyResult(int keyCode,
Component screen)
Processes a keypress. |
void |
loadLevelSet(String filename,
Component c,
Graphics2D g)
Loads a levelset from disk or creates a new one if it does not exist. |
boolean |
mousePressed(int button)
Handles mouse (down) events. |
boolean |
redrawWanted()
Indicates whether screen should be refreshed. |
Rectangle |
updateUI(Point mouseLocation)
Determines whether a different button or tile is active and returns clipping area (for drawing) is so. |
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 NORMAL
public static final int ICE
public static final int TELEPORT
public static final int GRAVITY
public static final int ARROW_UP
public static final int ARROW_DOWN
public static final int ARROW_LEFT
public static final int ARROW_RIGHT
public static final int START
public static final int START2
public static final int LEVEL_SWAP
public static final int LEVEL_FIRST
public static final int LEVEL_LAST
public static final int LEVEL_MESSAGES
public static final int LEVEL_BACK
public static final int LEVEL_FORWARD
public static final int LEVEL_TIME
public static final int LEVEL_CLEAR
public static final int LEVEL_PLAY
public static final int SAVE
public static final int CLOSE
public static final int SAVECLOSE
public static final int GRID
Constructor Detail |
---|
public Editor(Images imgData, ScreenFrames frames, TilePainter tPainter, int gridSize, int tileHeightLimit, int buttonSpacing, float buttonBorderThickness, Color buttonBorderColor, Font txtFont, Color gridColor, Color gridHighlight, Color txtColor, Graphics2D g, String fileExtension, String levelSetFilename) throws IOException
Editor
instance with the specified parameters.
imgData
- access to global image resourcesframes
- responsible for background and frame paintingtPainter
- responsible for drawing grid and tilesgridSize
- width and height of grid (e.g. 15x15)tileHeightLimit
- maximum height a pile can havebuttonSpacing
- horizontal and vertical spacing inbetween buttonsbuttonBorderThickness
- thickness of highlighted button borderbuttonBorderColor
- colour of highlighted button bordertxtFont
- style of all text (except tile numbers)gridColor
- colour of grid drawn underneath tilesgridHighlight
- colour of highlighted grid positiontxtColor
- colour of all text (except tile numbers)g
- graphics context for renderingfileExtension
- so upon new levelset creation the correct extension
is added if requiredlevelSetFilename
- a levelset to load initially, can be
null
IOException
- if the specified levelset cannot be loaded/createdMethod Detail |
---|
public void loadLevelSet(String filename, Component c, Graphics2D g) throws IOException
filename
- absolute path for new/existing levelsetc
- parent component for drawing dialogs if requiredg
- graphics context for rendering
IOException
- if either the levelset could not be loaded or a new
one could not be created.public int clickResult(int button, Component screen)
updateUI
call.
button
- the mouse button which was releasedscreen
- parent component so can draw dialogs if required
NONE
public boolean mousePressed(int button)
button
- which button has been pressed (down)
true
if a screen update is now required.public int keyResult(int keyCode, Component screen)
keyCode
- one of the codes as defined in the KeyEvent
class.screen
- requires parent component so can draw dialogs if required
NONE
public Rectangle updateUI(Point mouseLocation)
mouseLocation
- current mouse position
null
if no screen update
is required.public boolean redrawWanted()
updateUI
returned nothing.
true
if screen should be redrawnpublic void drawUpdate(Graphics2D g)
updateUI
g
- graphics context used for renderingpublic void drawClickUpdate(Graphics2D g)
clickResult
)
g
- graphics context used for renderingpublic void drawKeyUpdate(Graphics2D g)
keyUpdate
)
g
- graphics context used for renderingpublic void drawAll(Graphics2D g)
g
- graphics context used for renderingpublic LevelSet getTestSet()
GamePlayer
.
null
if the Play/Test button has not been pressed.public boolean cursorChange()
true
if the cursor needs to be changedpublic boolean cursorChange(boolean exit)
exit
- indicates whether the whole game screen has been left
true
if the cursor needs to be changed
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |