|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel java.applet.Applet jgame.platform.JGEngine
public abstract class JGEngine
Contains the main functionality of the game engine. Subclass it to write your own game. The engine can be run as applet, application, or midlet. To run as an application, have your main() construct an instance of your subclass (using a constructor other than the zero-parameter one). Then call initEngine(), with the desired window size, which will open a window, and initialise. To run as an applet or midlet, ensure that your subclass has a parameterless constructor which enables the browser to create it as an applet. Within this constructor, you call initEngineApplet() to initialise. After initialisation, initCanvas() will be called, within which you can call setCanvasSettings and setScalingPreferences. Note that applet parameters will only become available at this point, and not earlier.
Upon initialisation, the engine will create a new thread in which all game action will run. First it calls initGame() in your subclass. Here, you can define any initialisation code, such as variable initialisation and image loading. You can configure the load screen using setProgressBar, setProgressMessage, and setAuthorMessage, and by defining splash_image. The progress bar is set automatically when defineMedia is loading a table. Then, the engine will start producing frames. Each frame it will call doFrame() in your subclass, where you can call engine functions to move the game objects, check collisions, and everything else you want to do in a frame. Then, it will draw the current frame on the screen, after which it calls paintFrame(), where you can do any customised drawing on the frame, such as status messages. The engine enables you to specify states that the game may be in, say, the title screen state or the in-game state. When a state is set, the engine will first try to call start<state>() once at the beginning of the next frame. Then it will try to call additional doFrame<state>() and paintFrame<state>() methods every frame, where you can handle the game action for that specific state. Multple states may be set simultaneously, resulting in multiple method calls for each frame. Due to absence of the reflection framework, MIDlets do not support arbitrary state names, but only the following state names: "StartGame", "LevelDone", "InGame", "Title", "Highscore", "EnterHighscore", "LifeLost", "GameOver", "Paused".
The engine manages a list of sprite objects, and a matrix of equal-sized tiles. Its primary way to draw graphics is images. Images may be loaded from Gifs, JPegs, or PNGs (PNGs not in java 1.2, and GIFs are not always supported in MIDP, not even on new phones), which may contain either single images, or regularly spaced arrays or matrices of images (i.e. sprite sheets, we will call them image maps). An image is identified by a unique name, and is defined by the image file it comes from, the index within that file in case the file is an image map, and any flip and rotate actions that are to be be done on the file image to arrive at the final image. Animations may be defined in terms of sequences of images. Image maps, images, and animations can be defined by calling resp. defineImageMap, defineImage, or defineAnimation, or the definitions can be loaded from a text-file table file using defineImages().
Objects are of the class JGObject; see this class for more information. Objects are identified within the engine by unique String identifiers. Creating a new object with the same identifier as an old object will replace the old one. Objects are drawn on the screen in lexical order. The main methods for handling objects are moveObjects(), checkCollision(), and checkBGCollision().
Tiles can be used to define a background that the sprite objects can interact with, using a set of shorthands for reading, writing, and colliding with tiles. Tiles are uniquely identified by a short string (1-4 characters). Tiles may be transparent; a decorative background image can be displayed behind the tiles.
Collision is done by assigning collision IDs (cids) to both objects and tiles. A cid is basically a bit string (usually, one allocates 1 bit per basic object or tile type). Collision is done by specifying that a certain set of object types should be notified of collision with a certain set of object or tile types. Such a set is specified by a bit mask, which matches a cid when cid&mask != 0. JGObject defines collision methods (hit and hit_bg) which can then be implemented to handle the collisions. Objects have two bounding boxes: one for object-object collision (the sprite bounding box, or simply bounding box), and one for object-tile collision (the tile bounding box). The two bounding boxes may be dependent on the image (typically, you want these bounding boxes to approximate the shape of each individual image). For this purpose, you can define a collision bounding box with each image definition. This image bounding box is the default bounding box used by the object, but both sprite bbox and tile bbox can be overridden separately. Often, you want to set the tile bbox to a constant value, such as equal to the size of 1 tile.
Scrolling is done by defining a playfield that's larger than the game window, using setPFSize(). The game window (or view) can then be panned across the playfield using setViewOffset(). The game objects always move relative to the playfield. The draw methods take coordinates either relative to the playfield or to the view.
The engine supports arbitrary runtime scaling of the playfield. This means that you can code your game for a specific "virtual" screen size, and have it scale to any other screen size by simply supplying the desired "real" screen size at startup. Applets will scale to the size as given by the width and height fields in the HTML code. Midlets will scale to fit the available canvas. The scale factor will in no way affect the behaviour of the game (except performance-wise). Scaling is done using an anti-aliasing algorithm. Sometimes however, graphics may look a bit blocky or jaggy, because the engine uses a translucency-free scaling algorithm to ensure good performance.
The engine supports keyboard and mouse input. The state of the keyboard is maintained in a keymap, which can be read by getKey. The mouse can be read using getMouseButton and getMouseX/Y. The mouse buttons also have special keycodes. In MIDP, touch screens will generate mouse events. Button 1 is pressed when the user touches the screen. The mouse coordinates change only when the user touches or swipes the screen.
Sound clips can be loaded using defineAudio or by appropriate entries in a table loaded by defineMedia. playAudio and stopAudio can be used to control clip playing. enableAudio and disableAudio can be used to globally turn audio on and off for the entire application. In MIDP, sound always has only one channel, so the channel parameter is ignored. Due to limitations in typical MIDP implementations, playing a new sound while a sound is already playing will not trigger the new sound, but the old sound will keep playing.
A game speed variable is used to determine the update speed of velocities and timers. Game speed can be adapted by calling setGameSpeed, or is adapted automatically in video synced frame rate mode (as set by setVideoSyncedUpdate).
User statistics, game progress, and basic save game information can be stored using the store...() API. It enables persistent storage of numbers and Strings. It works with both MIDP and JRE, but JRE applets will need to be signed because persistent storage requires access to the local file system.
The opts... methods provide a standard options menu API. When an option is defined, a standard option menu item is created which is directly linked to a persistent storage variable. Currently implemented on Android only.
Upon initialisation, the engine shows an initialisation screen with a progress bar that reflects progress on the current graphics table being loaded. A splash image can be displayed during the init screen, by defining an image called splash_image. As soon as this image is defined, it is displayed above the progress message. Typically, one defines splash_image at the beginning of the graphics table, so that it displays as soon as possible during the init screen.
JGame applications can be quit by pressing Shift-Esc.
JGame has a number of debug features. It is possible to display the game state and the JGObjects' bounding boxes. There is also the possibility to output debug messages, using dbgPrint. A debug message is associated with a specific source (either a game object or the mainloop). Generated exceptions will generally be treated as debug messages. The messages can be printed on the playfield, next to the objects that output them. See dbgSetMessagesInPf for more information. Debug facilities are not yet implemented in MIDP, so most debug calls are ignored, except dbgPrint and dbgShowException, which print to stdout.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.applet.Applet |
---|
java.applet.Applet.AccessibleApplet |
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
KeyBackspace
|
static int |
KeyTab
|
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface jgame.impl.JGEngineInterface |
---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, HAND_CURSOR, JGameVersionString, KeyAlt, KeyCtrl, KeyDown, KeyEnter, KeyEsc, KeyFire, KeyLeft, KeyMouse1, KeyMouse2, KeyMouse3, KeyPound, KeyRight, KeyShift, KeyStar, KeyUp, NO_CURSOR, WAIT_CURSOR |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JGEngine()
Construct engine, but do not initialise it yet. |
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 |
defineImageRotated(java.lang.String name,
java.lang.String tilename,
int collisionid,
java.lang.String srcname,
double angle)
Define new image by rotating an already loaded image. |
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 OpenGL or Android. |
void |
drawImage(java.lang.String imgname,
double x,
double y)
Draw image with given ID, new version. |
void |
drawImage(java.lang.String imgname,
double x,
double y,
boolean pf_relative)
Draw image with given ID, new version. |
void |
drawImage(java.lang.String imgname,
double x,
double y,
boolean pf_relative,
JGColor blend_col,
double alpha,
double rot,
double scale)
Extended version of drawImage for OpenGL or Android, new version. |
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,
int len,
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,
boolean pf_relative,
JGColor[] shadecol,
java.lang.String tileimage)
Draw shaded or patterned 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)
xi,yi are tile indexes relative to the tileofs, that is, the top left of the bg, + 1. |
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. |
double[] |
getAccelVec()
get double[3] vector representing acceleration |
double |
getAccelX()
get accelerometer vector X coordinate |
double |
getAccelY()
get accelerometer vector Y coordinate |
double |
getAccelZ()
get accelerometer vector Z coordinate (positive = towards user) |
Animation |
getAnimation(java.lang.String id)
Get animation definition, don't call directly. |
java.awt.Color |
getAWTColor(JGColor col)
Convert JGColor to AWT color (JRE only). |
java.awt.Graphics |
getBufferGraphics()
get Graphics used to draw on buffer (JRE, non JOGL only). |
java.lang.String |
getConfigPath(java.lang.String filename)
Returns path to writable location for a file with the given name. |
double |
getFontHeight(JGFont jgfont)
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)
Non-static version for the sake of the interface. |
static int |
getKeyCodeStatic(java.lang.String keydesc)
|
java.lang.String |
getKeyDesc(int key)
Non-static version for the sake of the interface. |
static java.lang.String |
getKeyDescStatic(int 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 |
hasAccelerometer()
returns true if device has accelerometer (currently only android) |
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 |
init()
Initialise engine; don't call directly. |
abstract 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 |
initEngineComponent(int width,
int height)
Init engine as component to be embedded in a frame or panel; call this in your engine constructor. |
abstract void |
initGame()
Override to define your own initialisations after the engine initialised. |
int |
invokeUrl(java.lang.String url,
java.lang.String target)
Execute or go to URL (action depends on file type). |
boolean |
isAndroid()
Are we running on Android? |
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 |
optsAddBoolean(java.lang.String varname,
java.lang.String title,
java.lang.String desc,
boolean initial)
Adds boolean that can be configured with a checkbox. |
void |
optsAddEnum(java.lang.String varname,
java.lang.String title,
java.lang.String desc,
java.lang.String[] values,
int initial)
Adds enum that can be configured with radio buttons. |
void |
optsAddKey(java.lang.String varname,
java.lang.String title,
java.lang.String desc,
int initial)
Adds "key" option that can be configured by selecting a key or button on the device. |
void |
optsAddNumber(java.lang.String varname,
java.lang.String title,
java.lang.String desc,
int decimals,
double lower,
double upper,
double step,
double initial)
adds (int or float) number that can be configured with a slider. |
void |
optsAddString(java.lang.String varname,
java.lang.String title,
java.lang.String desc,
int maxlen,
boolean isPassword,
java.lang.String initial)
Adds String that can be configured by typing text. |
void |
optsAddTitle(java.lang.String title)
Adds title to be displayed above subsequent items. |
void |
optsClear()
Clear all previous option definitions. |
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(java.awt.Graphics g,
JGFont jgfont)
|
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 gamespeed)
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, null means hide cursor. |
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. |
boolean |
storeExists(java.lang.String id)
Checks if item exists in store |
double |
storeReadDouble(java.lang.String id,
double undef)
Reads double from store, use undef if ID not found |
int |
storeReadInt(java.lang.String id,
int undef)
Reads int from store, use undef if ID not found |
java.lang.String |
storeReadString(java.lang.String id,
java.lang.String undef)
Reads String from store, use undef if ID not found |
void |
storeRemove(java.lang.String id)
Remove record if it exists |
void |
storeWriteDouble(java.lang.String id,
double value)
Writes double to store under given ID |
void |
storeWriteInt(java.lang.String id,
int value)
Writes integer to store under given ID |
void |
storeWriteString(java.lang.String id,
java.lang.String value)
Writes string to store under given ID |
int |
tileHeight()
Get the tile height in (virtual) pixels. |
java.lang.String |
tileIDToStr(int tileid)
Convert tile ID code to tile name (as used internally). |
int |
tileStrToID(java.lang.String tilestr)
Convert tile name to integer ID code (as used internally). |
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. |
Methods inherited from class java.applet.Applet |
---|
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus |
Methods inherited from class java.awt.Panel |
---|
addNotify |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int KeyBackspace
public static final int KeyTab
Constructor Detail |
---|
public JGEngine()
Method Detail |
---|
public JGImage getImage(java.lang.String imgname)
JGEngineInterface
getImage
in interface JGEngineInterface
public JGPoint getImageSize(java.lang.String imgname)
JGEngineInterface
getImageSize
in interface JGEngineInterface
public 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)
JGEngineInterface
defineImage
in interface JGEngineInterface
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 dimensionspublic void defineImage(java.lang.String imgname, java.lang.String tilename, int collisionid, java.lang.String imgfile, java.lang.String img_op)
JGEngineInterface
defineImage
in interface JGEngineInterface
imgname
- image idtilename
- tile id (1-4 characters)collisionid
- cid to use for tile collision matchingimgfile
- filespec in resource path; "null" means no filepublic 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)
JGEngineInterface
defineImage
in interface JGEngineInterface
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 dimensionspublic void defineImage(java.lang.String imgname, java.lang.String tilename, int collisionid, java.lang.String imgmap, int mapidx, java.lang.String img_op)
JGEngineInterface
defineImage
in interface JGEngineInterface
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=firstpublic void defineImageRotated(java.lang.String name, java.lang.String tilename, int collisionid, java.lang.String srcname, double angle)
JGEngineInterface
If an image with this id is already defined, it is removed from any caches, so that the old image is really unloaded. This can be used to load large (background) images on demand, rather than have them all in memory. Note that the unloading does not work for images defined from image maps.
defineImageRotated
in interface JGEngineInterface
name
- image idtilename
- tile id (1-4 characters)collisionid
- cid to use for tile collision matchingsrcname
- image id of (already loaded) source imageangle
- the angle in radians by which to rotatepublic void defineImageMap(java.lang.String mapname, java.lang.String imgfile, int xofs, int yofs, int tilex, int tiley, int skipx, int skipy)
JGEngineInterface
defineImageMap
in interface JGEngineInterface
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.public JGRectangle getImageBBox(java.lang.String imgname)
JGEngineInterface
getImageBBox
in interface JGEngineInterface
public void defineMedia(java.lang.String filename)
JGEngineInterface
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
defineMedia
in interface JGEngineInterface
public void markAddObject(JGObject obj)
JGEngineInterface
markAddObject
in interface JGEngineInterface
public boolean existsObject(java.lang.String index)
JGEngineInterface
existsObject
in interface JGEngineInterface
public JGObject getObject(java.lang.String index)
JGEngineInterface
getObject
in interface JGEngineInterface
public void moveObjects(java.lang.String prefix, int cidmask)
JGEngineInterface
moveObjects
in interface JGEngineInterface
prefix
- ID prefix, null means ignorecidmask
- collision id mask, 0 means ignorepublic void moveObjects()
JGEngineInterface
moveObjects
in interface JGEngineInterface
public void checkCollision(int srccid, int dstcid)
JGEngineInterface
checkCollision
in interface JGEngineInterface
public int checkCollision(int cidmask, JGObject obj)
JGEngineInterface
checkCollision
in interface JGEngineInterface
cidmask
- cid mask of objects to consider, 0 means any
public int checkBGCollision(JGRectangle r)
JGEngineInterface
checkBGCollision
in interface JGEngineInterface
r
- bounding box in pixel coordinatespublic void checkBGCollision(int tilecid, int objcid)
JGEngineInterface
checkBGCollision
in interface JGEngineInterface
public java.util.Vector getObjects(java.lang.String prefix, int cidmask, boolean suspended_obj, JGRectangle bbox)
JGEngineInterface
getObjects
in interface JGEngineInterface
prefix
- ID prefix, null means ignorecidmask
- collision id mask, 0 means ignoresuspended_obj
- also count suspended objectsbbox
- collision bounding box, null means ignorepublic void removeObject(JGObject obj)
JGEngineInterface
removeObject
in interface JGEngineInterface
public void removeObjects(java.lang.String prefix, int cidmask)
JGEngineInterface
removeObjects
in interface JGEngineInterface
prefix
- ID prefix, null means ignorecidmask
- collision id mask, 0 means ignorepublic void removeObjects(java.lang.String prefix, int cidmask, boolean suspended_obj)
JGEngineInterface
removeObjects
in interface JGEngineInterface
prefix
- ID prefix, null means ignorecidmask
- collision id mask, 0 means ignoresuspended_obj
- also count suspended objectspublic int countObjects(java.lang.String prefix, int cidmask)
JGEngineInterface
countObjects
in interface JGEngineInterface
prefix
- ID prefix, null means ignorecidmask
- collision id mask, 0 means ignorepublic int countObjects(java.lang.String prefix, int cidmask, boolean suspended_obj)
JGEngineInterface
countObjects
in interface JGEngineInterface
prefix
- ID prefix, null means ignorecidmask
- collision id mask, 0 means ignoresuspended_obj
- also count suspended objectspublic void setBGImage(java.lang.String bgimg)
JGEngineInterface
setBGImage
in interface JGEngineInterface
bgimg
- image name, null=turn off background imagepublic void setBGImage(int depth, java.lang.String bgimg, boolean wrapx, boolean wrapy)
JGEngineInterface
setBGImage
in interface JGEngineInterface
depth
- depth level, 0=topmostbgimg
- image name, null=turn off image at this levelwrapx
- image should wrap in x directionwrapy
- image should wrap in y directionpublic void setTileSettings(java.lang.String out_of_bounds_tile, int out_of_bounds_cid, int preserve_cids)
JGEngineInterface
setTileSettings
in interface JGEngineInterface
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 tilespublic void fillBG(java.lang.String filltile)
JGEngineInterface
fillBG
in interface JGEngineInterface
filltile
- null means use background colourpublic void setTileCid(int x, int y, int and_mask, int or_mask)
JGEngineInterface
setTileCid
in interface JGEngineInterface
public void setTile(int x, int y, java.lang.String tilestr)
JGEngineInterface
setTile
in interface JGEngineInterface
public void drawTile(int xi, int yi, int tileid)
drawTile
in interface JGEngineInterface
public int countTiles(int tilecidmask)
JGEngineInterface
countTiles
in interface JGEngineInterface
public int getTileCid(int xidx, int yidx)
JGEngineInterface
getTileCid
in interface JGEngineInterface
public java.lang.String getTileStr(int xidx, int yidx)
JGEngineInterface
getTileStr
in interface JGEngineInterface
public int getTileCid(JGRectangle tiler)
JGEngineInterface
getTileCid
in interface JGEngineInterface
public JGRectangle getTiles(JGRectangle r)
JGEngineInterface
getTiles
in interface JGEngineInterface
r
- rectangle in pixel coordinates, null is none
public boolean getTiles(JGRectangle dest, JGRectangle r)
JGEngineInterface
getTiles
in interface JGEngineInterface
dest
- rectangle to copy tile range intor
- rectangle in pixel coordinates, null is none
public void setTileCid(int x, int y, int value)
JGEngineInterface
setTileCid
in interface JGEngineInterface
public void orTileCid(int x, int y, int or_mask)
JGEngineInterface
orTileCid
in interface JGEngineInterface
public void andTileCid(int x, int y, int and_mask)
JGEngineInterface
andTileCid
in interface JGEngineInterface
public void setTile(JGPoint tileidx, java.lang.String tilename)
JGEngineInterface
setTile
in interface JGEngineInterface
public void setTiles(int xofs, int yofs, java.lang.String[] tilemap)
JGEngineInterface
setTiles
in interface JGEngineInterface
public void setTilesMulti(int xofs, int yofs, java.lang.String[] tilemap)
JGEngineInterface
"x aa ab abc"
stands for a sequence of four tiles, "x",
"aa", "ab", and "abc".
setTilesMulti
in interface JGEngineInterface
public int getTileCidAtCoord(double x, double y)
JGEngineInterface
getTileCidAtCoord
in interface JGEngineInterface
public int getTileCid(JGPoint center, int xofs, int yofs)
JGEngineInterface
getTileCid
in interface JGEngineInterface
public java.lang.String getTileStrAtCoord(double x, double y)
JGEngineInterface
getTileStrAtCoord
in interface JGEngineInterface
public java.lang.String getTileStr(JGPoint center, int xofs, int yofs)
JGEngineInterface
getTileStr
in interface JGEngineInterface
public int tileStrToID(java.lang.String tilestr)
JGEngineInterface
tileStrToID
in interface JGEngineInterface
tilestr
- tilename, null or empty string -> ID = 0public java.lang.String tileIDToStr(int tileid)
JGEngineInterface
tileIDToStr
in interface JGEngineInterface
tileid
- tile ID, tileid==0 -> tilename = empty stringpublic double moduloXPos(double x)
JGEngineInterface
moduloXPos
in interface JGEngineInterface
public double moduloYPos(double y)
JGEngineInterface
moduloYPos
in interface JGEngineInterface
public void setProgressBar(double pos)
JGEngineInterface
setProgressBar
in interface JGEngineInterface
pos
- a number between 0 and 1public void setProgressMessage(java.lang.String msg)
JGEngineInterface
setProgressMessage
in interface JGEngineInterface
public void setAuthorMessage(java.lang.String msg)
JGEngineInterface
setAuthorMessage
in interface JGEngineInterface
public void dbgShowBoundingBox(boolean enabled)
JGEngineInterface
dbgShowBoundingBox
in interface JGEngineInterface
public void dbgShowGameState(boolean enabled)
JGEngineInterface
dbgShowGameState
in interface JGEngineInterface
public void dbgShowFullStackTrace(boolean enabled)
JGEngineInterface
dbgShowFullStackTrace
in interface JGEngineInterface
public void dbgShowMessagesInPf(boolean enabled)
JGEngineInterface
A message that is generated in this frame is shown in the foreground colour at the appropriate source. If the source did not generate a message, the last printed message remains visible, and is shown in debug colour 1. If an object prints a message, and then dies, the message will remain for a period of time after the object is gone. These messages are shown in debug colour 2.
dbgShowMessagesInPf
in interface JGEngineInterface
public void dbgSetMessageExpiry(int ticks)
JGEngineInterface
dbgSetMessageExpiry
in interface JGEngineInterface
public void dbgSetMessageFont(JGFont font)
JGEngineInterface
dbgSetMessageFont
in interface JGEngineInterface
public void dbgSetDebugColor1(JGColor col)
JGEngineInterface
dbgSetDebugColor1
in interface JGEngineInterface
public void dbgSetDebugColor2(JGColor col)
JGEngineInterface
dbgSetDebugColor2
in interface JGEngineInterface
public void dbgPrint(java.lang.String msg)
JGEngineInterface
dbgPrint
in interface JGEngineInterface
public void dbgPrint(java.lang.String source, java.lang.String msg)
JGEngineInterface
dbgPrint
in interface JGEngineInterface
source
- may be object ID or "MAIN" for the main program.public void dbgShowException(java.lang.String source, java.lang.Throwable e)
JGEngineInterface
dbgShowException
in interface JGEngineInterface
source
- may be object ID or "MAIN" for the main program.public java.lang.String dbgExceptionToString(java.lang.Throwable e)
JGEngineInterface
dbgExceptionToString
in interface JGEngineInterface
public void exitEngine(java.lang.String msg)
JGEngineInterface
exitEngine
in interface JGEngineInterface
msg
- an exit message, null means nonepublic void initEngineComponent(int width, int height)
JGEngineInterface
initEngineComponent
in interface JGEngineInterface
width
- canvas widthheight
- canvas heightpublic void initEngineApplet()
initEngineApplet
in interface JGEngineInterface
public void initEngine(int width, int height)
initEngine
in interface JGEngineInterface
width
- real screen width, 0 = use screen sizeheight
- real screen height, 0 = use screen sizepublic void setCanvasSettings(int nrtilesx, int nrtilesy, int tilex, int tiley, JGColor fgcolor, JGColor bgcolor, JGFont msgfont)
JGEngineInterface
setCanvasSettings
in interface JGEngineInterface
nrtilesx
- nr of tiles horizontallynrtilesy
- nr of tiles verticallytilex
- width of one tiletiley
- height of one tilefgcolor
- pen/text colour, null for default whitebgcolor
- background colour, null for default blackmsgfont
- font for messages and text drawing, null for defaultpublic void setScalingPreferences(double min_aspect_ratio, double max_aspect_ratio, int crop_top, int crop_left, int crop_bottom, int crop_right)
JGEngineInterface
Crop margin can be used if you wish to allow the scaling algorithm to take just a few pixels off your playfield in order to make a wider tile size fit. The tile size is always integer, so even a best-fit scaled tile size may leave an unused border around the playfield, which may be undesirable for small screens. Cropping just a few pixels off the playfield may be just enough to make the tiles 1 pixel larger. Setting a crop to a value greater than zero means you allow the playfield to fall off the canvas for the amount of actual pixels specified, in order to make a larger tile size fit. Default crop margin is 0.
setScalingPreferences
in interface JGEngineInterface
min_aspect_ratio
- minimum width:height ratio allowedmax_aspect_ratio
- maximum width:height ratio allowedcrop_top
- number of pixels to crop at topcrop_left
- number of pixels to crop at left sizecrop_bottom
- number of pixels to crop at bottomcrop_right
- number of pixels to crop at right sizepublic void setSmoothing(boolean smooth_magnify)
JGEngineInterface
setSmoothing
in interface JGEngineInterface
smooth_magnify
- smooth images when magnifyingpublic void requestGameFocus()
JGEngineInterface
requestGameFocus
in interface JGEngineInterface
public boolean isApplet()
JGEngineInterface
isApplet
in interface JGEngineInterface
public boolean isMidlet()
JGEngineInterface
isMidlet
in interface JGEngineInterface
public boolean isOpenGL()
JGEngineInterface
isOpenGL
in interface JGEngineInterface
public boolean isAndroid()
JGEngineInterface
isAndroid
in interface JGEngineInterface
public int viewWidth()
JGEngineInterface
viewWidth
in interface JGEngineInterface
public int viewHeight()
JGEngineInterface
viewHeight
in interface JGEngineInterface
public int viewTilesX()
JGEngineInterface
viewTilesX
in interface JGEngineInterface
public int viewTilesY()
JGEngineInterface
viewTilesY
in interface JGEngineInterface
public int viewXOfs()
JGEngineInterface
viewXOfs
in interface JGEngineInterface
public int viewYOfs()
JGEngineInterface
viewYOfs
in interface JGEngineInterface
public int pfWidth()
JGEngineInterface
pfWidth
in interface JGEngineInterface
public int pfHeight()
JGEngineInterface
pfHeight
in interface JGEngineInterface
public int pfTilesX()
JGEngineInterface
pfTilesX
in interface JGEngineInterface
public int pfTilesY()
JGEngineInterface
pfTilesY
in interface JGEngineInterface
public boolean pfWrapX()
JGEngineInterface
pfWrapX
in interface JGEngineInterface
public boolean pfWrapY()
JGEngineInterface
pfWrapY
in interface JGEngineInterface
public int tileWidth()
JGEngineInterface
tileWidth
in interface JGEngineInterface
public int tileHeight()
JGEngineInterface
tileHeight
in interface JGEngineInterface
public int displayWidth()
JGEngineInterface
displayWidth
in interface JGEngineInterface
public int displayHeight()
JGEngineInterface
displayHeight
in interface JGEngineInterface
public double getFrameRate()
getFrameRate
in interface JGEngineInterface
public double getGameSpeed()
JGEngineInterface
getGameSpeed
in interface JGEngineInterface
public double getFrameSkip()
getFrameSkip
in interface JGEngineInterface
public boolean getVideoSyncedUpdate()
getVideoSyncedUpdate
in interface JGEngineInterface
public int getOffscreenMarginX()
JGEngineInterface
getOffscreenMarginX
in interface JGEngineInterface
JGEngineInterface.setOffscreenMargin(int,int)
public int getOffscreenMarginY()
JGEngineInterface
getOffscreenMarginY
in interface JGEngineInterface
JGEngineInterface.setOffscreenMargin(int,int)
public double getXScaleFactor()
JGEngineInterface
getXScaleFactor
in interface JGEngineInterface
public double getYScaleFactor()
JGEngineInterface
getYScaleFactor
in interface JGEngineInterface
public double getMinScaleFactor()
JGEngineInterface
getMinScaleFactor
in interface JGEngineInterface
public void init()
init
in class java.applet.Applet
public abstract void initCanvas()
JGEngineInterface
initCanvas
in interface JGEngineInterface
public abstract void initGame()
JGEngineInterface
initGame
in interface JGEngineInterface
public void start()
JGEngineInterface
start
in interface JGEngineInterface
start
in class java.applet.Applet
public void stop()
JGEngineInterface
stop
in interface JGEngineInterface
stop
in class java.applet.Applet
public void startApp()
JGEngineInterface
startApp
in interface JGEngineInterface
public void pauseApp()
JGEngineInterface
pauseApp
in interface JGEngineInterface
public void destroyApp(boolean unconditional)
JGEngineInterface
destroyApp
in interface JGEngineInterface
public boolean isRunning()
JGEngineInterface
isRunning
in interface JGEngineInterface
public void wakeUpOnKey(int key)
JGEngineInterface
wakeUpOnKey
in interface JGEngineInterface
key
- keycode to wake up on, -1=any key or mouse, 0=nonepublic void destroy()
JGEngineInterface
destroy
in interface JGEngineInterface
destroy
in class java.applet.Applet
public void setViewOffset(int xofs, int yofs, boolean centered)
JGEngineInterface
setViewOffset
in interface JGEngineInterface
centered
- center view on (xofs, yofs), topleft otherwisepublic void setBGImgOffset(int depth, double xofs, double yofs, boolean centered)
JGEngineInterface
setBGImgOffset
in interface JGEngineInterface
depth
- depth level of image to setcentered
- center view on (xofs, yofs), topleft otherwisepublic void setViewZoomRotate(double zoom, double rotate)
JGEngineInterface
Mouse coordinates are inverse projected through the last set zoom/rotate setting, so that a playfield relative pixel drawn at the logical mouse coordinates coincides with the physical position of the mouse pointer. If you don't want this, you can set zoom/rotate to (1,0), read the mouse position, then set zoom/rotate to the desired value.
The zoom/rotate setting used for actual drawing is the last value set at the end of the doFrame phase. Should not be called during the paintFrame phase.
setViewZoomRotate
in interface JGEngineInterface
zoom
- zoom factor, 1.0 is normal sizerotate
- angle in radianspublic void setPFSize(int nrtilesx, int nrtilesy)
JGEngineInterface
setPFSize
in interface JGEngineInterface
nrtilesx
- number of tiles, >= viewTilesX()nrtilesy
- number of tiles, >= viewTilesY()public void setPFWrap(boolean wrapx, boolean wrapy, int shiftx, int shifty)
JGEngineInterface
setPFWrap
in interface JGEngineInterface
public void setFrameRate(double fps, double maxframeskip)
JGEngineInterface
setFrameRate
in interface JGEngineInterface
fps
- frames per second, useful range 2...80maxframeskip
- max successive frames to skip, useful range 0..10public void setVideoSyncedUpdate(boolean value)
JGEngineInterface
setVideoSyncedUpdate
in interface JGEngineInterface
public void setGameSpeed(double gamespeed)
JGEngineInterface
setGameSpeed
in interface JGEngineInterface
public void setRenderSettings(int alpha_thresh, JGColor render_bg_col)
JGEngineInterface
setRenderSettings
in interface JGEngineInterface
alpha_thresh
- bitmask threshold, 0...255, default=128render_bg_col
- bg colour for render, null=use background colourpublic void setOffscreenMargin(int xmargin, int ymargin)
JGEngineInterface
setOffscreenMargin
in interface JGEngineInterface
public void setBGColor(JGColor bgcolor)
setBGColor
in interface JGEngineInterface
public void setFGColor(JGColor fgcolor)
setFGColor
in interface JGEngineInterface
public void setMsgFont(JGFont msgfont)
setMsgFont
in interface JGEngineInterface
public void setColorsFont(JGColor fgcolor, JGColor bgcolor, JGFont msgfont)
setColorsFont
in interface JGEngineInterface
public void setTextOutline(int thickness, JGColor colour)
setTextOutline
in interface JGEngineInterface
thickness
- 0 = turn off outlinepublic void setMouseCursor(int cursor)
JGEngineInterface
setMouseCursor
in interface JGEngineInterface
public void setMouseCursor(java.lang.Object cursor)
setMouseCursor
in interface JGEngineInterface
cursor
- is of type java.awt.Cursorpublic void removeAllTimers()
JGEngineInterface
removeAllTimers
in interface JGEngineInterface
public void registerTimer(JGTimer timer)
JGEngineInterface
registerTimer
in interface JGEngineInterface
public void setGameState(java.lang.String state)
JGEngineInterface
setGameState
in interface JGEngineInterface
public void addGameState(java.lang.String state)
JGEngineInterface
addGameState
in interface JGEngineInterface
public void removeGameState(java.lang.String state)
JGEngineInterface
removeGameState
in interface JGEngineInterface
public void clearGameState()
JGEngineInterface
clearGameState
in interface JGEngineInterface
public boolean inGameState(java.lang.String state)
JGEngineInterface
inGameState
in interface JGEngineInterface
public boolean inGameStateNextFrame(java.lang.String state)
JGEngineInterface
inGameStateNextFrame
in interface JGEngineInterface
public void doFrame()
JGEngineInterface
doFrame
in interface JGEngineInterface
public void paintFrame()
JGEngineInterface
paintFrame
in interface JGEngineInterface
public java.awt.Graphics getBufferGraphics()
public void setColor(JGColor col)
JGEngineInterface
setColor
in interface JGEngineInterface
public java.awt.Color getAWTColor(JGColor col)
public void setFont(JGFont font)
JGEngineInterface
setFont
in interface JGEngineInterface
public void setFont(java.awt.Graphics g, JGFont jgfont)
public void setStroke(double thickness)
JGEngineInterface
setStroke
in interface JGEngineInterface
public void setBlendMode(int src_func, int dst_func)
JGEngineInterface
setBlendMode
in interface JGEngineInterface
src_func
- source multiply factor, 0=one, 1=alpha, -1 = one - alphadst_func
- destination multiply factor, 0=one, 1=alpha, -1 = one - alphapublic double getFontHeight(JGFont jgfont)
JGEngineInterface
getFontHeight
in interface JGEngineInterface
public void drawLine(double x1, double y1, double x2, double y2, double thickness, JGColor color)
JGEngineInterface
drawLine
in interface JGEngineInterface
public void drawLine(double x1, double y1, double x2, double y2)
JGEngineInterface
drawLine
in interface JGEngineInterface
public void drawLine(double x1, double y1, double x2, double y2, boolean pf_relative)
JGEngineInterface
drawLine
in interface JGEngineInterface
pf_relative
- coordinates are relative to playfield, otherwise viewpublic void drawPolygon(double[] x, double[] y, JGColor[] col, int len, boolean filled, boolean pf_relative)
JGEngineInterface
drawPolygon
in interface JGEngineInterface
x
- x coordinates of the pointsy
- y coordinates of the pointscol
- colour of each point, null means use default colourlen
- number of pointspf_relative
- coordinates are relative to playfield, otherwise viewpublic void drawRect(double x, double y, double width, double height, boolean filled, boolean centered, double thickness, JGColor color)
JGEngineInterface
drawRect
in interface JGEngineInterface
centered
- indicates (x,y) is center instead of topleft.public void drawRect(double x, double y, double width, double height, boolean filled, boolean centered)
JGEngineInterface
drawRect
in interface JGEngineInterface
centered
- indicates (x,y) is center instead of topleft.public void drawRect(double x, double y, double width, double height, boolean filled, boolean centered, boolean pf_relative)
JGEngineInterface
drawRect
in interface JGEngineInterface
centered
- indicates (x,y) is center instead of topleft.pf_relative
- coordinates are relative to playfield, otherwise viewpublic void drawRect(double x, double y, double width, double height, boolean filled, boolean centered, boolean pf_relative, JGColor[] shadecol)
JGEngineInterface
drawRect
in interface JGEngineInterface
shadecol
- colors topleft,topright,botright,botleft cornerspublic void drawRect(double x, double y, double width, double height, boolean filled, boolean centered, boolean pf_relative, JGColor[] shadecol, java.lang.String tileimage)
JGEngineInterface
drawRect
in interface JGEngineInterface
shadecol
- colors topleft,topright,botright,botleft cornerspublic void drawOval(double x, double y, double width, double height, boolean filled, boolean centered, double thickness, JGColor color)
JGEngineInterface
drawOval
in interface JGEngineInterface
centered
- indicates (x,y) is center instead of topleft.public void drawOval(double x, double y, double width, double height, boolean filled, boolean centered)
JGEngineInterface
drawOval
in interface JGEngineInterface
centered
- indicates (x,y) is center instead of topleft.public void drawOval(double x, double y, double width, double height, boolean filled, boolean centered, boolean pf_relative)
JGEngineInterface
drawOval
in interface JGEngineInterface
centered
- indicates (x,y) is center instead of topleft.pf_relative
- coordinates are relative to playfield, otherwise viewpublic void drawImage(double x, double y, java.lang.String imgname)
JGEngineInterface
drawImage
in interface JGEngineInterface
public void drawImage(double x, double y, java.lang.String imgname, boolean pf_relative)
JGEngineInterface
drawImage
in interface JGEngineInterface
pf_relative
- coordinates are relative to playfield, otherwise viewpublic void drawImage(double x, double y, java.lang.String imgname, JGColor blend_col, double alpha, double rot, double scale, boolean pf_relative)
JGEngineInterface
drawImage
in interface JGEngineInterface
blend_col
- colour to blend with image, null=(alpha,alpha,alpha)alpha
- alpha (blending) value, 0=transparent, 1=opaquerot
- rotation of object in degrees (radians)scale
- scaling of object (1 = normal size).public void drawImage(java.lang.String imgname, double x, double y)
JGEngineInterface
drawImage
in interface JGEngineInterface
public void drawImage(java.lang.String imgname, double x, double y, boolean pf_relative)
JGEngineInterface
drawImage
in interface JGEngineInterface
pf_relative
- coordinates are relative to playfield, otherwise viewpublic void drawImage(java.lang.String imgname, double x, double y, boolean pf_relative, JGColor blend_col, double alpha, double rot, double scale)
JGEngineInterface
drawImage
in interface JGEngineInterface
blend_col
- colour to blend with image, null=(alpha,alpha,alpha)alpha
- alpha (blending) value, 0=transparent, 1=opaquerot
- rotation of object in degrees (radians)scale
- scaling of object (1 = normal size).public void drawString(java.lang.String str, double x, double y, int align, JGFont font, JGColor color)
JGEngineInterface
drawString
in interface JGEngineInterface
align
- text alignment, -1=left, 0=center, 1=rightpublic void drawString(java.lang.String str, double x, double y, int align)
JGEngineInterface
drawString
in interface JGEngineInterface
align
- text alignment, -1=left, 0=center, 1=rightpublic void drawString(java.lang.String str, double x, double y, int align, boolean pf_relative)
JGEngineInterface
drawString
in interface JGEngineInterface
align
- text alignment, -1=left, 0=center, 1=rightpf_relative
- coordinates are relative to playfield, otherwise viewpublic void drawImageString(java.lang.String string, double x, double y, int align, java.lang.String imgmap, int char_offset, int spacing)
JGEngineInterface
drawImageString
in interface JGEngineInterface
align
- text alignment, -1=left, 0=center, 1=rightimgmap
- name of image mapchar_offset
- ASCII code of first image of image mapspacing
- number of pixels to skip between letterspublic void drawImageString(java.lang.String string, double x, double y, int align, java.lang.String imgmap, int char_offset, int spacing, boolean pf_relative)
JGEngineInterface
drawImageString
in interface JGEngineInterface
align
- text alignment, -1=left, 0=center, 1=rightimgmap
- name of image mapchar_offset
- ASCII code of first image of image mapspacing
- number of pixels to skip between letterspf_relative
- coordinates are relative to playfield, otherwise viewpublic JGPoint getMousePos()
JGEngineInterface
getMousePos
in interface JGEngineInterface
public int getMouseX()
JGEngineInterface
getMouseX
in interface JGEngineInterface
public int getMouseY()
JGEngineInterface
getMouseY
in interface JGEngineInterface
public boolean getMouseButton(int nr)
JGEngineInterface
getMouseButton
in interface JGEngineInterface
nr
- 1=button 1 ... 3 = button 3
public void clearMouseButton(int nr)
JGEngineInterface
clearMouseButton
in interface JGEngineInterface
nr
- 1=button 1 ... 3 = button 3public void setMouseButton(int nr)
JGEngineInterface
setMouseButton
in interface JGEngineInterface
nr
- 1=button 1 ... 3 = button 3public boolean getMouseInside()
JGEngineInterface
getMouseInside
in interface JGEngineInterface
public boolean getKey(int key)
JGEngineInterface
getKey
in interface JGEngineInterface
public void clearKey(int key)
JGEngineInterface
clearKey
in interface JGEngineInterface
public void setKey(int key)
JGEngineInterface
setKey
in interface JGEngineInterface
public int getLastKey()
JGEngineInterface
getLastKey
in interface JGEngineInterface
public char getLastKeyChar()
JGEngineInterface
getLastKeyChar
in interface JGEngineInterface
public void clearLastKey()
JGEngineInterface
clearLastKey
in interface JGEngineInterface
public java.lang.String getKeyDesc(int key)
getKeyDesc
in interface JGEngineInterface
public static java.lang.String getKeyDescStatic(int key)
public int getKeyCode(java.lang.String keydesc)
getKeyCode
in interface JGEngineInterface
public static int getKeyCodeStatic(java.lang.String keydesc)
public boolean hasAccelerometer()
JGEngineInterface
hasAccelerometer
in interface JGEngineInterface
public double getAccelX()
JGEngineInterface
getAccelX
in interface JGEngineInterface
public double getAccelY()
JGEngineInterface
getAccelY
in interface JGEngineInterface
public double getAccelZ()
JGEngineInterface
getAccelZ
in interface JGEngineInterface
public double[] getAccelVec()
JGEngineInterface
getAccelVec
in interface JGEngineInterface
public void defineAnimation(java.lang.String id, java.lang.String[] frames, double speed)
JGEngineInterface
defineAnimation
in interface JGEngineInterface
id
- the name by which the animation is knownframes
- an array of image names that should be played in sequencespeed
- the sequence speed: the number of animation steps per framepublic void defineAnimation(java.lang.String id, java.lang.String[] frames, double speed, boolean pingpong)
JGEngineInterface
defineAnimation
in interface JGEngineInterface
id
- the name by which the animation is knownframes
- an array of image names that should be played in sequencespeed
- the sequence speed: the number of animation steps per framepingpong
- true=play the images in forward order, then in reversepublic Animation getAnimation(java.lang.String id)
JGEngineInterface
getAnimation
in interface JGEngineInterface
public java.lang.String getConfigPath(java.lang.String filename)
JGEngineInterface
getConfigPath
in interface JGEngineInterface
public int invokeUrl(java.lang.String url, java.lang.String target)
JGEngineInterface
invokeUrl
in interface JGEngineInterface
public boolean and(int value, int mask)
JGEngineInterface
and
in interface JGEngineInterface
public double random(double min, double max)
JGEngineInterface
random
in interface JGEngineInterface
public double random(double min, double max, double interval)
JGEngineInterface
random
in interface JGEngineInterface
public int random(int min, int max, int interval)
JGEngineInterface
random
in interface JGEngineInterface
public double atan2(double y, double x)
JGEngineInterface
atan2
in interface JGEngineInterface
public JGPoint getTileIndex(double x, double y)
JGEngineInterface
getTileIndex
in interface JGEngineInterface
public JGPoint getTileCoord(int tilex, int tiley)
JGEngineInterface
getTileCoord
in interface JGEngineInterface
public JGPoint getTileCoord(JGPoint tileidx)
JGEngineInterface
getTileCoord
in interface JGEngineInterface
public double snapToGridX(double x, double gridsnapx)
JGEngineInterface
snapToGridX
in interface JGEngineInterface
x
- position to snapgridsnapx
- snap margin, 0.0 means no snappublic double snapToGridY(double y, double gridsnapy)
JGEngineInterface
snapToGridY
in interface JGEngineInterface
y
- position to snapgridsnapy
- snap margin, 0.0 means no snappublic void snapToGrid(JGPoint p, int gridsnapx, int gridsnapy)
JGEngineInterface
snapToGrid
in interface JGEngineInterface
public boolean isXAligned(double x, double margin)
JGEngineInterface
isXAligned
in interface JGEngineInterface
public boolean isYAligned(double y, double margin)
JGEngineInterface
isYAligned
in interface JGEngineInterface
public double getXAlignOfs(double x)
JGEngineInterface
getXAlignOfs
in interface JGEngineInterface
public double getYAlignOfs(double y)
JGEngineInterface
getYAlignOfs
in interface JGEngineInterface
public double getXDist(double x1, double x2)
JGEngineInterface
getXDist
in interface JGEngineInterface
public double getYDist(double y1, double y2)
JGEngineInterface
getYDist
in interface JGEngineInterface
public void enableAudio()
JGEngineInterface
enableAudio
in interface JGEngineInterface
public void disableAudio()
JGEngineInterface
disableAudio
in interface JGEngineInterface
public void defineAudioClip(java.lang.String clipid, java.lang.String filename)
JGEngineInterface
defineAudioClip
in interface JGEngineInterface
public java.lang.String lastPlayedAudio(java.lang.String channel)
JGEngineInterface
lastPlayedAudio
in interface JGEngineInterface
public void playAudio(java.lang.String clipid)
JGEngineInterface
playAudio
in interface JGEngineInterface
public void playAudio(java.lang.String channel, java.lang.String clipid, boolean loop)
JGEngineInterface
playAudio
in interface JGEngineInterface
public void stopAudio(java.lang.String channel)
JGEngineInterface
stopAudio
in interface JGEngineInterface
public void stopAudio()
JGEngineInterface
stopAudio
in interface JGEngineInterface
public void storeWriteInt(java.lang.String id, int value)
JGEngineInterface
storeWriteInt
in interface JGEngineInterface
public void storeWriteDouble(java.lang.String id, double value)
JGEngineInterface
storeWriteDouble
in interface JGEngineInterface
public void storeWriteString(java.lang.String id, java.lang.String value)
JGEngineInterface
storeWriteString
in interface JGEngineInterface
public void storeRemove(java.lang.String id)
JGEngineInterface
storeRemove
in interface JGEngineInterface
public boolean storeExists(java.lang.String id)
JGEngineInterface
storeExists
in interface JGEngineInterface
public int storeReadInt(java.lang.String id, int undef)
JGEngineInterface
storeReadInt
in interface JGEngineInterface
public double storeReadDouble(java.lang.String id, double undef)
JGEngineInterface
storeReadDouble
in interface JGEngineInterface
public java.lang.String storeReadString(java.lang.String id, java.lang.String undef)
JGEngineInterface
storeReadString
in interface JGEngineInterface
public void optsAddTitle(java.lang.String title)
JGEngineInterface
optsAddTitle
in interface JGEngineInterface
public void optsAddNumber(java.lang.String varname, java.lang.String title, java.lang.String desc, int decimals, double lower, double upper, double step, double initial)
JGEngineInterface
optsAddNumber
in interface JGEngineInterface
decimals
- number is int if 0public void optsAddBoolean(java.lang.String varname, java.lang.String title, java.lang.String desc, boolean initial)
JGEngineInterface
optsAddBoolean
in interface JGEngineInterface
public void optsAddEnum(java.lang.String varname, java.lang.String title, java.lang.String desc, java.lang.String[] values, int initial)
JGEngineInterface
optsAddEnum
in interface JGEngineInterface
public void optsAddKey(java.lang.String varname, java.lang.String title, java.lang.String desc, int initial)
JGEngineInterface
optsAddKey
in interface JGEngineInterface
public void optsAddString(java.lang.String varname, java.lang.String title, java.lang.String desc, int maxlen, boolean isPassword, java.lang.String initial)
JGEngineInterface
optsAddString
in interface JGEngineInterface
public void optsClear()
JGEngineInterface
optsClear
in interface JGEngineInterface
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |