|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object erland.game.tileadventure.MapEditor
public abstract class MapEditor
Abstract class that implement basic behaviour in a map editor
Field Summary | |
---|---|
protected static int |
BUTTON_EXIT
Standard Exit button, used in getDefaultButtons() |
protected static int |
BUTTON_LOAD
Standard Load button, used in getDefaultButtons() |
protected static int |
BUTTON_SAVE
Standard Save button, used in getDefaultButtons() |
Constructor Summary | |
---|---|
MapEditor()
|
Method Summary | |
---|---|
protected void |
clickedMapBlock(int posX,
int posY)
Called when a block on the map is clicked, this method will either insert the selected block in the clicked map position or remove the current block at the map position |
protected void |
clickedSelectBlock(int posX,
int posY)
Called when a block in the selection area is clicked, this method will make the clicked block the currently selected block or if there were no block at the clicked make no block selected |
protected abstract MapObjectInterface |
cloneBlock(MapObjectInterface block,
IrregularBlockContainerInterface cont,
int x,
int y,
int z)
Clone specified block |
void |
draw()
|
protected void |
drawBlock(Graphics g,
MapObjectInterface block)
Draw the specified block |
protected void |
drawFinish(Graphics g)
Called everything normal has been drawed, can be used to do extra drawing on top of the other graphics |
abstract void |
drawHoveringFrame(Graphics g,
int posX,
int posY)
|
abstract void |
drawMapBlocks(Graphics g,
MapObjectContainerInterface blocks)
|
void |
drawPaletteBlocks(Graphics g,
MapObjectContainerInterface paletteBlocks)
|
abstract void |
drawSelectedFrame(Graphics g,
MapObjectInterface selectedBlock)
|
void |
exit()
|
protected void |
exitButton()
Called when the standard exit button is pressed, the map editor should exit |
protected void |
exitFinish()
Called once when exit of the map editor is finished |
protected int |
getDefaultButtons()
Called to get which default buttons that should be available, the return value is a bitmask composed by BUTTON_EXIT , BUTTON_LOAD , BUTTON_SAVE |
GameEnvironmentInterface |
getEnvironment()
|
protected abstract MapObjectContainerInterface |
getMapBlocks()
Get matrix with all blocks in the map |
protected abstract IrregularBlockContainerInterface |
getMapContainer()
Get block container for the map area |
protected int |
getMapPosZ()
|
protected abstract MapObjectContainerInterface |
getPaletteBlocks()
Get matrix with all blocks in the block selection area |
protected abstract IrregularBlockContainerInterface |
getPaletteContainer()
Get block container for the block selection area |
protected int |
getPalettePosZ()
|
protected void |
hoverMapBlock(int posX,
int posY)
Called when the mouse pointer is hovering over a block on the map , this method will just be called to make it possible to show which block the mouse is hovering over The method is called with -1 in both parameters if the mouse is not hovering over any block |
void |
init(GameEnvironmentInterface environ)
|
protected EPanel |
initButtonPanel()
Create and initialize button panel |
protected void |
initButtons(EPanel panel)
Create and initialize all buttons |
protected void |
initDefaultButtons(EPanel panel)
Create and initialize default butons |
protected void |
initFinish()
Called once when the initialization of the map editor is finished |
protected abstract boolean |
isEmptyAllowed()
Checks if it is allowed to have positions in the map without any block |
boolean |
isExit()
|
protected void |
leftMouseDragged(int x,
int y)
|
protected void |
leftMousePressed(int x,
int y)
|
protected void |
loadButton()
Called when the standard load button is pressed, a new map should be loaded |
protected void |
mouseHovering(int x,
int y)
|
protected MapObjectInterface |
prepareNewBlock(MapObjectInterface oldBlock,
MapObjectInterface newBlock)
Prepare a new block so it can be inserted in the map |
protected void |
saveButton(MapObjectContainerInterface blocks)
Called when the standard save button is pressed, the current blocks in the map area should be saved to the map |
void |
setCheatmode(boolean enable)
|
protected void |
setMapBlock(MapObjectInterface block,
int posX,
int posY,
int posZ)
Uppdates the map with a new block |
void |
update()
|
protected void |
updateBlocks()
Update all blocks |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int BUTTON_EXIT
getDefaultButtons()
protected static final int BUTTON_SAVE
getDefaultButtons()
protected static final int BUTTON_LOAD
getDefaultButtons()
Constructor Detail |
---|
public MapEditor()
Method Detail |
---|
public boolean isExit()
isExit
in interface GamePanelInterface
public void exit()
exit
in interface GamePanelInterface
protected abstract IrregularBlockContainerInterface getMapContainer()
protected abstract IrregularBlockContainerInterface getPaletteContainer()
protected abstract MapObjectContainerInterface getPaletteBlocks()
protected abstract MapObjectContainerInterface getMapBlocks()
protected MapObjectInterface prepareNewBlock(MapObjectInterface oldBlock, MapObjectInterface newBlock)
oldBlock
- Old block at the same positionnewBlock
- New block that should be inserted
public void init(GameEnvironmentInterface environ)
init
in interface GamePanelInterface
protected void clickedMapBlock(int posX, int posY)
posX
- X position of the block in the map that was clickedposY
- Y position of the block in the map that was clickedprotected void setMapBlock(MapObjectInterface block, int posX, int posY, int posZ)
block
- The new block to insert in mapposX
- The x position of the new blockposY
- The y position of the new blockposZ
- The z position of the new blockprotected void hoverMapBlock(int posX, int posY)
posX
- X position of the block in the map that was hovered overposY
- Y position of the block in the map that was hovered overprotected void clickedSelectBlock(int posX, int posY)
posX
- X position of the block in the selection area that was clickedposY
- Y position of the block in the selection area that was clickedprotected void leftMouseDragged(int x, int y)
protected void mouseHovering(int x, int y)
protected void leftMousePressed(int x, int y)
protected void updateBlocks()
public void update()
update
in interface GamePanelInterface
protected void drawBlock(Graphics g, MapObjectInterface block)
g
- Graphics object to draw onblock
- Block to drawprotected abstract MapObjectInterface cloneBlock(MapObjectInterface block, IrregularBlockContainerInterface cont, int x, int y, int z)
block
- Block to clonecont
- Block container to put new block inx
- X position to put new block aty
- Y position to put new block atz
- Z position to put new block at
protected abstract boolean isEmptyAllowed()
protected void initButtons(EPanel panel)
panel
- EPanel to put buttons onprotected void initFinish()
protected void exitFinish()
protected void saveButton(MapObjectContainerInterface blocks)
blocks
- The blocks in the map areaprotected void loadButton()
protected void exitButton()
protected int getDefaultButtons()
BUTTON_EXIT
, BUTTON_LOAD
, BUTTON_SAVE
protected void initDefaultButtons(EPanel panel)
panel
- EPanel which the buttons should be added toprotected EPanel initButtonPanel()
protected void drawFinish(Graphics g)
g
- The Graphics object to draw onpublic abstract void drawMapBlocks(Graphics g, MapObjectContainerInterface blocks)
public abstract void drawSelectedFrame(Graphics g, MapObjectInterface selectedBlock)
public abstract void drawHoveringFrame(Graphics g, int posX, int posY)
public void drawPaletteBlocks(Graphics g, MapObjectContainerInterface paletteBlocks)
public void draw()
draw
in interface GamePanelInterface
public void setCheatmode(boolean enable)
setCheatmode
in interface GamePanelInterface
public GameEnvironmentInterface getEnvironment()
protected int getMapPosZ()
protected int getPalettePosZ()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |