|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface JGEngineInterface
Interface defining all platform-independent methods in JGEngine. It is primarily used as an internal interface for JGObjects, JGTimers, etc to the different engine implementations.
| Field Summary | |
|---|---|
static int |
CROSSHAIR_CURSOR
Platform-independent cursor. |
static int |
DEFAULT_CURSOR
Platform-independent cursor. |
static int |
HAND_CURSOR
Platform-independent cursor. |
static int |
KeyAlt
|
static int |
KeyBackspace
|
static int |
KeyCtrl
|
static int |
KeyDown
Cursor keys for both regular and mobile keyboard. |
static int |
KeyEnter
On a mobile, pressing "*" also triggers KeyEnter. |
static int |
KeyEsc
|
static int |
KeyFire
Fire stands for a mobile key, indicating the fire button of the cursor controls. |
static int |
KeyLeft
Cursor keys for both regular and mobile keyboard. |
static int |
KeyMouse1
Keymap equivalent of mouse button. |
static int |
KeyMouse2
Keymap equivalent of mouse button. |
static int |
KeyMouse3
Keymap equivalent of mouse button. |
static int |
KeyPound
The mobile Pound key, equal to '#'. |
static int |
KeyRight
Cursor keys for both regular and mobile keyboard. |
static int |
KeyShift
On a mobile, the cursor control Fire is the same as shift. |
static int |
KeyStar
The mobile Star key, equal to '*'. |
static int |
KeyTab
|
static int |
KeyUp
Cursor keys for both regular and mobile keyboard. |
static int |
WAIT_CURSOR
Platform-independent cursor. |
| Method Summary | |
|---|---|
void |
addGameState(java.lang.String state)
Add the given state to the game's existing state on the next frame. |
boolean |
and(int value,
int mask)
A Boolean AND shorthand to use for collision; returns (value&mask) != 0. |
void |
andTileCid(int x,
int y,
int and_mask)
Modify the cid of a single tile by ANDing a bit mask, leaving the actual tile. |
double |
atan2(double y,
double x)
Replacement for Math.atan2 for the sake of MIDP portability. |
void |
checkBGCollision(int tilecid,
int objcid)
Calls all bg colliders of objects that match objid that collide with tiles that match tileid. |
int |
checkBGCollision(JGRectangle r)
Check collision of tiles within given rectangle, return the OR of all cids found. |
void |
checkCollision(int srccid,
int dstcid)
Calls all colliders of objects that match dstcid that collide with objects that match srccid. |
int |
checkCollision(int cidmask,
JGObject obj)
Checks collision of objects with given cid mask with given object. |
void |
clearGameState()
Set the game's main state to none, on the next frame. |
void |
clearKey(int key)
Set the key status of a key to released. |
void |
clearLastKey()
Clear the lastkey status. |
void |
clearMouseButton(int nr)
Set state of button to released. |
int |
countObjects(java.lang.String prefix,
int cidmask)
Count how many objects there are with both the given name prefix and have colid&cidmask != 0. |
int |
countObjects(java.lang.String prefix,
int cidmask,
boolean suspended_obj)
Count how many objects there are with both the given name prefix and have colid&cidmask != 0. |
int |
countTiles(int tilecidmask)
Count number of tiles with given mask. |
java.lang.String |
dbgExceptionToString(java.lang.Throwable e)
Convert the relevant information of an exception to a multiline String. |
void |
dbgPrint(java.lang.String msg)
Print a debug message, with the main program being the source. |
void |
dbgPrint(java.lang.String source,
java.lang.String msg)
Print a debug message from a specific source, which is either the main program or a JGObject. |
void |
dbgSetDebugColor1(JGColor col)
Set debug color 1, used for printing debug information. |
void |
dbgSetDebugColor2(JGColor col)
Set debug color 2, used for printing debug information. |
void |
dbgSetMessageExpiry(int ticks)
Set the number of frames a debug message of a removed object should remain on the playfield. |
void |
dbgSetMessageFont(JGFont font)
Set the font for displaying debug messages. |
void |
dbgShowBoundingBox(boolean enabled)
Show bounding boxes around the objects: the image bounding box (getBBox) , the tile span (getTiles), and the center tiles (getCenterTiles). |
void |
dbgShowException(java.lang.String source,
java.lang.Throwable e)
Print the relevant information of an exception as a debug message. |
void |
dbgShowFullStackTrace(boolean enabled)
Indicates whether to show full exception stack traces or just the first lines. |
void |
dbgShowGameState(boolean enabled)
Show the game state in the bottom right corner of the screen. |
void |
dbgShowMessagesInPf(boolean enabled)
Output messages on playfield instead of console. |
void |
defineAnimation(java.lang.String id,
java.lang.String[] frames,
double speed)
Define new animation sequence. |
void |
defineAnimation(java.lang.String id,
java.lang.String[] frames,
double speed,
boolean pingpong)
Define new animation sequence. |
void |
defineAudioClip(java.lang.String clipid,
java.lang.String filename)
Associate given clipid with a filename. |
void |
defineImage(java.lang.String imgname,
java.lang.String tilename,
int collisionid,
java.lang.String imgmap,
int mapidx,
java.lang.String img_op)
Define new sprite/tile image from map, with collision bounding box equal to the image's dimensions. |
void |
defineImage(java.lang.String imgname,
java.lang.String tilename,
int collisionid,
java.lang.String imgmap,
int mapidx,
java.lang.String img_op,
int top,
int left,
int width,
int height)
Define new sprite/tile image from map. |
void |
defineImage(java.lang.String imgname,
java.lang.String tilename,
int collisionid,
java.lang.String imgfile,
java.lang.String img_op)
Define new sprite/tile image from a file, with collision bounding box equal to the image's dimensions. |
void |
defineImage(java.lang.String name,
java.lang.String tilename,
int collisionid,
java.lang.String imgfile,
java.lang.String img_op,
int top,
int left,
int width,
int height)
Define new sprite/tile image from a file. |
void |
defineImageMap(java.lang.String mapname,
java.lang.String imgfile,
int xofs,
int yofs,
int tilex,
int tiley,
int skipx,
int skipy)
Define image map, a large image containing a number of smaller images to use for sprites or fonts. |
void |
defineMedia(java.lang.String filename)
Load a set of imagemap, image, animation, and audio clip definitions from a file. |
void |
destroy()
Destroy function for deinitialising the engine properly. |
void |
destroyApp(boolean unconditional)
Called by the application manager to exit app. |
void |
disableAudio()
Disable audio, stop all currently playing audio. |
int |
displayHeight()
Get the real display height on this device. |
int |
displayWidth()
Get the real display width on this device. |
void |
doFrame()
Is called every frame. |
void |
drawImage(double x,
double y,
java.lang.String imgname)
Draw image with given ID. |
void |
drawImage(double x,
double y,
java.lang.String imgname,
boolean pf_relative)
Draw image with given ID. |
void |
drawImage(double x,
double y,
java.lang.String imgname,
JGColor blend_col,
double alpha,
double rot,
double scale,
boolean pf_relative)
Extended version of drawImage for platforms with opengl capabilities. |
void |
drawImageString(java.lang.String string,
double x,
double y,
int align,
java.lang.String imgmap,
int char_offset,
int spacing)
Draws a single line of text using an image map as font; text alignment is same as drawString. |
void |
drawImageString(java.lang.String string,
double x,
double y,
int align,
java.lang.String imgmap,
int char_offset,
int spacing,
boolean pf_relative)
Draws a single line of text using an image map as font; text alignment is same as drawString. |
void |
drawLine(double x1,
double y1,
double x2,
double y2)
Draw a line with current thickness and colour. |
void |
drawLine(double x1,
double y1,
double x2,
double y2,
boolean pf_relative)
Draw a line with current thickness and colour. |
void |
drawLine(double x1,
double y1,
double x2,
double y2,
double thickness,
JGColor color)
DrawLine combined with thickness/colour setting. |
void |
drawOval(double x,
double y,
double width,
double height,
boolean filled,
boolean centered)
Draw oval with default thickness and colour. |
void |
drawOval(double x,
double y,
double width,
double height,
boolean filled,
boolean centered,
boolean pf_relative)
Draw oval with default thickness and colour. |
void |
drawOval(double x,
double y,
double width,
double height,
boolean filled,
boolean centered,
double thickness,
JGColor color)
Set thickness/colour and draw oval. |
void |
drawPolygon(double[] x,
double[] y,
JGColor[] col,
boolean filled,
boolean pf_relative)
Draw convex polygon. |
void |
drawRect(double x,
double y,
double width,
double height,
boolean filled,
boolean centered)
Draw rectangle in default colour and thickness. |
void |
drawRect(double x,
double y,
double width,
double height,
boolean filled,
boolean centered,
boolean pf_relative)
Draw rectangle in default colour and thickness. |
void |
drawRect(double x,
double y,
double width,
double height,
boolean filled,
boolean centered,
boolean pf_relative,
JGColor[] shadecol)
Draw shaded rectangle. |
void |
drawRect(double x,
double y,
double width,
double height,
boolean filled,
boolean centered,
double thickness,
JGColor color)
Set colour/thickness and draw rectangle. |
void |
drawString(java.lang.String str,
double x,
double y,
int align)
Draws string so that (x,y) is the topleft coordinate (align=-1), the top middle coordinate (align=0), or the top right coordinate (align=1). |
void |
drawString(java.lang.String str,
double x,
double y,
int align,
boolean pf_relative)
Draws string so that (x,y) is the topleft coordinate (align=-1), the top middle coordinate (align=0), or the top right coordinate (align=1). |
void |
drawString(java.lang.String str,
double x,
double y,
int align,
JGFont font,
JGColor color)
Draws string so that (x,y) is the topleft coordinate (align=-1), the top middle coordinate (align=0), or the top right coordinate (align=1). |
void |
drawTile(int xi,
int yi,
int tileid)
Draw tile directly on background, do not call this directly, use setTile instead. |
void |
enableAudio()
Enable audio, restart any audio loops. |
boolean |
existsObject(java.lang.String index)
Get object if it exists. |
void |
exitEngine(java.lang.String msg)
Exit, optionally reporting an exit message. |
void |
fillBG(java.lang.String filltile)
Fill the background with the given tile. |
jgame.impl.Animation |
getAnimation(java.lang.String id)
Get animation definition, don't call directly. |
java.lang.String |
getConfigPath(java.lang.String filename)
Returns path to writable location for a file with the given name. |
double |
getFontHeight(JGFont font)
Get height of given font in pixels. |
double |
getFrameRate()
|
double |
getFrameSkip()
|
double |
getGameSpeed()
Get game speed variable. |
JGImage |
getImage(java.lang.String imgname)
Gets (scaled) image directly. |
JGRectangle |
getImageBBox(java.lang.String imgname)
Gets the collision bounding box of an image. |
JGPoint |
getImageSize(java.lang.String imgname)
Gets (non-scaled) image's physical size directly. |
boolean |
getKey(int key)
Get the key status of the given key. |
int |
getKeyCode(java.lang.String keydesc)
Obtain key code from printable string describing the key, the inverse of getKeyDesc. |
java.lang.String |
getKeyDesc(int key)
Get a printable string describing the key. |
int |
getLastKey()
Get the keycode of the key that was pressed last, 0=none. |
char |
getLastKeyChar()
Get the keycode of the key that was pressed last, 0=none. |
double |
getMinScaleFactor()
Get minimum of the x and y scale factors |
boolean |
getMouseButton(int nr)
Get state of button. |
boolean |
getMouseInside()
Check if mouse is inside game window |
JGPoint |
getMousePos()
Get current mouse position in logical coordinates, inverse projected through last set view zoom/rotate setting. |
int |
getMouseX()
Get current mouse X position |
int |
getMouseY()
Get current mouse Y position |
JGObject |
getObject(java.lang.String index)
Get object if it exists, null if not. |
java.util.Vector |
getObjects(java.lang.String prefix,
int cidmask,
boolean suspended_obj,
JGRectangle bbox)
Query the object list for objects matching the given name prefix, CID mask, and collide with the given bounding box. |
int |
getOffscreenMarginX()
Get offscreen X margin. |
int |
getOffscreenMarginY()
Get offscreen Y margin. |
int |
getTileCid(int xidx,
int yidx)
Get collision id of tile at given tile index position. |
int |
getTileCid(JGPoint center,
int xofs,
int yofs)
Get the tile cid of the point that is (xofs,yofs) from the tile index coordinate center. |
int |
getTileCid(JGRectangle tiler)
Get the OR of the cids at the tile indexes given by tiler |
int |
getTileCidAtCoord(double x,
double y)
Get collision id of the tile at given pixel coordinates. |
JGPoint |
getTileCoord(int tilex,
int tiley)
Get pixel coordinate corresponding to the top left of the tile at the given index |
JGPoint |
getTileCoord(JGPoint tileidx)
Get pixel coordinate corresponding to the top left of the tile at the given index |
JGPoint |
getTileIndex(double x,
double y)
Get tile index of the tile the coordinate is on. |
JGRectangle |
getTiles(JGRectangle r)
Get tile index range of all tiles overlapping given rectangle of pixel coordinates. |
boolean |
getTiles(JGRectangle dest,
JGRectangle r)
Get tile index range of all tiles overlapping given rectangle of pixel coordinates, version without object creation. |
java.lang.String |
getTileStr(int xidx,
int yidx)
get string id of tile at given index position. |
java.lang.String |
getTileStr(JGPoint center,
int xofs,
int yofs)
Get the tile string of the point that is (xofs,yofs) from the tile index coordinate center. |
java.lang.String |
getTileStrAtCoord(double x,
double y)
Get string id of the tile at given pixel coordinates. |
boolean |
getVideoSyncedUpdate()
|
double |
getXAlignOfs(double x)
Returns the difference between position and the closest tile-aligned position. |
double |
getXDist(double x1,
double x2)
Calculates length of the shortest path between x1 and x2, with x1, x2 being playfield coordinates, taking into account the wrap setting. |
double |
getXScaleFactor()
Get scale factor of real screen width wrt virtual screen width |
double |
getYAlignOfs(double y)
Returns the difference between position and the closest tile-aligned position. |
double |
getYDist(double y1,
double y2)
Calculates length of the shortest path between y1 and y2, with y1, y2 being playfield coordinates, taking into account the wrap setting. |
double |
getYScaleFactor()
Get scale factor of real screen height wrt virtual screen height |
boolean |
inGameState(java.lang.String state)
Check if game is in given state. |
boolean |
inGameStateNextFrame(java.lang.String state)
Check if game will be in given state the next frame. |
void |
initCanvas()
Override to define your own initialisations before the engine initialises. |
void |
initEngine(int width,
int height)
Init engine as application. |
void |
initEngineApplet()
Init engine as applet; call this in your engine constructor. |
void |
initGame()
Override to define your own initialisations after the engine initialised. |
boolean |
isApplet()
Are we running as an applet or as an application? |
boolean |
isMidlet()
Are we running as a midlet? |
boolean |
isOpenGL()
Are we running with an OpenGL backend? |
boolean |
isRunning()
True if engine is running, false if paused. |
boolean |
isXAligned(double x,
double margin)
Returns true if x falls within margin of the tile snap grid. |
boolean |
isYAligned(double y,
double margin)
Returns true if y falls within margin of the tile snap grid. |
java.lang.String |
lastPlayedAudio(java.lang.String channel)
Returns the audioclip that was last played, null if audio was stopped with stopAudio. |
void |
markAddObject(JGObject obj)
Add new object, will become active next frame, do not call directly. |
double |
moduloXPos(double x)
A modulo that moduloes symmetrically, relative to the middle of the view. |
double |
moduloYPos(double y)
A modulo that moduloes symmetrically, relative to the middle of the view. |
void |
moveObjects()
Call the move() methods of all registered objects. |
void |
moveObjects(java.lang.String prefix,
int cidmask)
Call the move() methods of those objects matching the given name prefix and collision id mask. |
void |
orTileCid(int x,
int y,
int or_mask)
Modify the cid of a single tile by ORing a bit mask, leaving the actual tile. |
void |
paintFrame()
Is called when the engine's default screen painting is finished, and custom painting actions may be carried out. |
void |
pauseApp()
Called by the application manager to pause app. |
int |
pfHeight()
Get the virtual height in pixels (not the scaled screen height) |
int |
pfTilesX()
Get the number of tiles in X direction |
int |
pfTilesY()
Get the number of tiles in Y direction |
int |
pfWidth()
Get the virtual width in pixels (not the scaled screen width) |
boolean |
pfWrapX()
Is playfield X wrap enabled? |
boolean |
pfWrapY()
Is playfield Y wrap enabled? |
void |
playAudio(java.lang.String clipid)
Play audio clip on unnamed channel, which means it will not replace another clip, and cannot be stopped. |
void |
playAudio(java.lang.String channel,
java.lang.String clipid,
boolean loop)
Play clip on channel with given name. |
double |
random(double min,
double max)
A floating-point random number between min and max |
double |
random(double min,
double max,
double interval)
Generates discrete random number between min and max inclusive, with steps of interval. |
int |
random(int min,
int max,
int interval)
Generates discrete random number between min and max inclusive, with steps of interval, integer version. |
void |
registerTimer(JGTimer timer)
Register a timer with the engine, don't call directly. |
void |
removeAllTimers()
Remove all JGTimers still ticking in the system. |
void |
removeGameState(java.lang.String state)
Remove the given state from the game's existing state on the next frame. |
void |
removeObject(JGObject obj)
Remove one particular object. |
void |
removeObjects(java.lang.String prefix,
int cidmask)
Remove all objects which have the given name prefix and/or match the given cidmask. |
void |
removeObjects(java.lang.String prefix,
int cidmask,
boolean suspended_obj)
Remove all objects which have the given name prefix and/or match the given cidmask. |
void |
requestGameFocus()
Call this to get focus. |
void |
setAuthorMessage(java.lang.String msg)
Set author message, default "JGame [version]" |
void |
setBGColor(JGColor bgcolor)
Set global background colour, which is displayed in borders, and behind transparent tiles if no BGImage is defined. |
void |
setBGImage(int depth,
java.lang.String bgimg,
boolean wrapx,
boolean wrapy)
Set image to display at a particular parallax scroll level. |
void |
setBGImage(java.lang.String bgimg)
Set image to display behind transparent tiles. |
void |
setBGImgOffset(int depth,
double xofs,
double yofs,
boolean centered)
Change (absolute) offset of BG image independently of view offset. |
void |
setBlendMode(int src_func,
int dst_func)
Set blend mode, for platforms that support blending. |
void |
setCanvasSettings(int nrtilesx,
int nrtilesy,
int tilex,
int tiley,
JGColor fgcolor,
JGColor bgcolor,
JGFont msgfont)
Set canvas dimensions and message colours/fonts. |
void |
setColor(JGColor col)
Set current drawing colour. |
void |
setColorsFont(JGColor fgcolor,
JGColor bgcolor,
JGFont msgfont)
Set foreground and background colour, and message font in one go; passing a null means ignore that argument. |
void |
setFGColor(JGColor fgcolor)
Set global foreground colour, used for printing text and status messages. |
void |
setFont(JGFont font)
Set current font, scale the font to screen size. |
void |
setFrameRate(double fps,
double maxframeskip)
Set frame rate in frames per second, and maximum number of frames that may be skipped before displaying a frame again. |
void |
setGameSpeed(double speed)
Set game speed variable, default is 1.0. |
void |
setGameState(java.lang.String state)
Set the game's main state on the next frame. |
void |
setKey(int key)
Set the key status of a key to pressed. |
void |
setMouseButton(int nr)
Set state of button to pressed. |
void |
setMouseCursor(int cursor)
Set mouse cursor to a platform-independent standard cursor. |
void |
setMouseCursor(java.lang.Object cursor)
Set mouse cursor, platform dependent. |
void |
setMsgFont(JGFont msgfont)
Set the (unscaled) message font, used for displaying status messages. |
void |
setOffscreenMargin(int xmargin,
int ymargin)
Set margin used for testing if object should expire or suspend when off-view or off-playfield. |
void |
setPFSize(int nrtilesx,
int nrtilesy)
Set the playfield size to be any size larger or equal to the view size. |
void |
setPFWrap(boolean wrapx,
boolean wrapy,
int shiftx,
int shifty)
Set playfield wraparound setting. |
void |
setProgressBar(double pos)
Set progress bar position in the load screen. |
void |
setProgressMessage(java.lang.String msg)
Set progress message, default "Loading files..." |
void |
setRenderSettings(int alpha_thresh,
JGColor render_bg_col)
Configure image rendering. |
void |
setScalingPreferences(double min_aspect_ratio,
double max_aspect_ratio,
int crop_top,
int crop_left,
int crop_bottom,
int crop_right)
Set scaling preferences for translating the virtual playfield to the actual display. |
void |
setSmoothing(boolean smooth_magnify)
Magnification can be set to smooth or blocky. |
void |
setStroke(double thickness)
Set the line thickness |
void |
setTextOutline(int thickness,
JGColor colour)
Set parameters of outline surrounding text (for example, used to increase contrast). |
void |
setTile(int x,
int y,
java.lang.String tilestr)
Set a single tile. |
void |
setTile(JGPoint tileidx,
java.lang.String tilename)
Set a single tile. |
void |
setTileCid(int x,
int y,
int value)
Set the cid of a single tile to the given value, leaving the actual tile. |
void |
setTileCid(int x,
int y,
int and_mask,
int or_mask)
Set the cid of a single tile using and and or mask. |
void |
setTiles(int xofs,
int yofs,
java.lang.String[] tilemap)
Set a block of tiles according to the single-letter tile names in the nxm character array tilemap. |
void |
setTileSettings(java.lang.String out_of_bounds_tile,
int out_of_bounds_cid,
int preserve_cids)
Define background tile settings. |
void |
setTilesMulti(int xofs,
int yofs,
java.lang.String[] tilemap)
Set a block of tiles according to the tile names in the nxm element array tilemap. |
void |
setVideoSyncedUpdate(boolean value)
Enable/disable video synced update (jogl only). |
void |
setViewOffset(int xofs,
int yofs,
boolean centered)
Change offset of playfield view. |
void |
setViewZoomRotate(double zoom,
double rotate)
Zoom/rotate view. |
void |
snapToGrid(JGPoint p,
int gridsnapx,
int gridsnapy)
Snap p to grid in case p is close enough to the grid lines. |
double |
snapToGridX(double x,
double gridsnapx)
Snap to grid, double version. |
double |
snapToGridY(double y,
double gridsnapy)
Snap to grid, double version. |
void |
start()
Signal that the engine should start running. |
void |
startApp()
Called when midlet is first initialised, or unpaused. |
void |
stop()
signal that the engine should stop running and wait. |
void |
stopAudio()
Stop all audio channels. |
void |
stopAudio(java.lang.String channel)
Stop one audio channel. |
int |
tileHeight()
Get the tile height in (virtual) pixels. |
int |
tileWidth()
Get the tile width in (virtual) pixels. |
int |
viewHeight()
Get the virtual height in pixels (not the scaled screen height) |
int |
viewTilesX()
Get the number of tiles of view window in X direction |
int |
viewTilesY()
Get the number of tiles of view window in Y direction |
int |
viewWidth()
Get the virtual width in pixels (not the scaled screen width) |
int |
viewXOfs()
Get view offset as it will be at the next frame draw, in case we are not inside a frame draw, or the view offset as it is, when we are. |
int |
viewYOfs()
Get view offset as it will be at the next frame draw, in case we are not inside a frame draw, or the view offset as it is, when we are. |
void |
wakeUpOnKey(int key)
Make engine call start() when a key is pressed. |
| Field Detail |
|---|
static final int KeyUp
static final int KeyDown
static final int KeyLeft
static final int KeyRight
static final int KeyShift
static final int KeyFire
static final int KeyCtrl
static final int KeyAlt
static final int KeyEsc
static final int KeyEnter
static final int KeyStar
static final int KeyPound
static final int KeyBackspace
static final int KeyTab
static final int KeyMouse1
static final int KeyMouse2
static final int KeyMouse3
static final int DEFAULT_CURSOR
static final int CROSSHAIR_CURSOR
static final int HAND_CURSOR
static final int WAIT_CURSOR
| Method Detail |
|---|
void setProgressBar(double pos)
pos - a number between 0 and 1void setProgressMessage(java.lang.String msg)
void setAuthorMessage(java.lang.String msg)
JGImage getImage(java.lang.String imgname)
JGPoint getImageSize(java.lang.String imgname)
void defineImage(java.lang.String name,
java.lang.String tilename,
int collisionid,
java.lang.String imgfile,
java.lang.String img_op,
int top,
int left,
int width,
int height)
name - image idtilename - tile id (1-4 characters)collisionid - cid to use for tile collision matchingimgfile - filespec in resource path; "null" means no filetop - collision bounding box dimensionsleft - collision bounding box dimensionswidth - collision bounding box dimensionsheight - collision bounding box dimensions
void defineImageMap(java.lang.String mapname,
java.lang.String imgfile,
int xofs,
int yofs,
int tilex,
int tiley,
int skipx,
int skipy)
mapname - id of image mapimgfile - filespec in resource pathxofs - x offset of first imageyofs - y offset of first imagetilex - width of an imagetiley - height of an imageskipx - nr of pixels to skip between successive imagesskipy - nr of pixels to skip between successive images vertically.JGRectangle getImageBBox(java.lang.String imgname)
void defineImage(java.lang.String imgname,
java.lang.String tilename,
int collisionid,
java.lang.String imgfile,
java.lang.String img_op)
imgname - image idtilename - tile id (1-4 characters)collisionid - cid to use for tile collision matchingimgfile - filespec in resource path; "null" means no file
void defineImage(java.lang.String imgname,
java.lang.String tilename,
int collisionid,
java.lang.String imgmap,
int mapidx,
java.lang.String img_op,
int top,
int left,
int width,
int height)
imgname - image idtilename - tile id (1-4 characters)collisionid - cid to use for tile collision matchingimgmap - id of image mapmapidx - index of image in map, 0=firsttop - collision bounding box dimensionsleft - collision bounding box dimensionswidth - collision bounding box dimensionsheight - collision bounding box dimensions
void defineImage(java.lang.String imgname,
java.lang.String tilename,
int collisionid,
java.lang.String imgmap,
int mapidx,
java.lang.String img_op)
imgname - image idtilename - tile id (1-4 characters)collisionid - cid to use for tile collision matchingimgmap - id of image mapmapidx - index of image in map, 0=firstvoid defineMedia(java.lang.String filename)
defineImage("mytile", "#", 1,"gfx/myimage.gif", "-");
is equivalent to the following line in the table:
mytile # 1
gfx/myimage.gif -
with the whitespace between the fields consisting of one or more tabs. The defineAnimation methods take an array of names as the second argument. This is represented in table format as the names separated by semicolon ';' characters. So:
defineAnimation("anim",new String[]{"frame0","frame1",...},0.5);
is equivalent to:
anim frame0;frame1;... 0.5
void setBGImage(java.lang.String bgimg)
bgimg - image name, null=turn off background image
void setBGImage(int depth,
java.lang.String bgimg,
boolean wrapx,
boolean wrapy)
bgimg - image name, null=turn off image at this leveldepth - depth level, 0=topmostwrapx - image should wrap in x directionwrapy - image should wrap in y direction
void setTileSettings(java.lang.String out_of_bounds_tile,
int out_of_bounds_cid,
int preserve_cids)
out_of_bounds_tile - tile string to use outside of screen boundsout_of_bounds_cid - cid to use outside of screen boundariespreserve_cids - cid mask to preserve when setting tilesvoid fillBG(java.lang.String filltile)
filltile - null means use background colourvoid markAddObject(JGObject obj)
boolean existsObject(java.lang.String index)
JGObject getObject(java.lang.String index)
void moveObjects(java.lang.String prefix,
int cidmask)
cidmask - collision id mask, 0 means ignoreprefix - ID prefix, null means ignorevoid moveObjects()
void checkCollision(int srccid,
int dstcid)
int checkCollision(int cidmask,
JGObject obj)
cidmask - cid mask of objects to consider, 0 means any
int checkBGCollision(JGRectangle r)
r - bounding box in pixel coordinates
void checkBGCollision(int tilecid,
int objcid)
java.util.Vector getObjects(java.lang.String prefix,
int cidmask,
boolean suspended_obj,
JGRectangle bbox)
cidmask - collision id mask, 0 means ignoreprefix - ID prefix, null means ignoresuspended_obj - also count suspended objectsbbox - collision bounding box, null means ignorevoid removeObject(JGObject obj)
void removeObjects(java.lang.String prefix,
int cidmask)
cidmask - collision id mask, 0 means ignoreprefix - ID prefix, null means ignore
void removeObjects(java.lang.String prefix,
int cidmask,
boolean suspended_obj)
cidmask - collision id m