Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jgame.impl
Class EngineLogic

    java.lang.Object
      jgame.impl.EngineLogic

    public class EngineLogic

extends java.lang.Object

Contains the platform-independent game logic.

Nested Class Summary
`class` | `EngineLogic.BGImage`

Field Summary
`int` | `alpha_thresh`
`java.util.Hashtable` | `audioclips` clipid -} filename
`JGColor` | `bg_color`
`boolean[][]` | `bg_defined` the defined state of the physical cells of background, i.e.
`java.util.Vector` | `bg_images` BGImages: images to use behind transparent tiles.
`int` | `canvas_xofs` offset of playfield wrt canvas (may be negative if we crop the playfield).
`int` | `canvas_yofs` offset of playfield wrt canvas (may be negative if we crop the playfield).
`int` | `crop_bottom`
`int` | `crop_left`
`int` | `crop_right`
`int` | `crop_top`
`java.lang.String` | `exit_message`
`JGColor` | `fg_color`
`double` | `fps`
`double` | `gamespeed`
`java.util.Vector` | `gamestate` Engine game state
`java.util.Vector` | `gamestate_new` New game states which the game has to transition to, and for which start[state] have to be called.
`java.util.Vector` | `gamestate_nextframe` New engine game state to be assigned at the next frame
`int` | `height` Actual scaled canvas size; that is, the size of the playfield view, which may be smaller than the desired size of the game window to accommodate for integer-sized scaled tiles.
`java.util.Hashtable` | `image_orig_size` JGPoint sizes of original images
`java.util.Hashtable` | `imagemaps`
`java.util.Hashtable` | `images` Strings -> JGImages, screen size, nonexistence indicates image is not cached and needs to be generated from images_orig
`java.util.Hashtable` | `images_bbox`
`java.util.Hashtable` | `images_exists` indicates that image is defined even if it has no Image
`java.util.Hashtable` | `images_loaded` Hashtable: name to filename.
`java.util.Hashtable` | `images_orig` Strings -> JGImages, original size, nonexistence means there is no image
`java.util.Hashtable` | `images_tile`
`java.util.Hashtable` | `images_tilecid`
`java.util.Hashtable` | `images_transp`
`JGImage` | `imageutil`
`boolean` | `is_exited` signals that thread should die and canvas should paint exit message
`boolean` | `is_inited` signals that JGame globals are set, and exit code should null globals in JGObject
`boolean` | `is_resizeable` Platform implementation decides if window is resizeable.
`double` | `max_aspect`
`double` | `maxframeskip`
`double` | `min_aspect`
`double` | `min_scale_fac` min_scale_fac is min (scalex,scaley).
`JGFont` | `msg_font`
`int` | `nrtilesx` Total number of tiles on the playfield.
`int` | `nrtilesy` Total number of tiles on the playfield.
`SortedArray` | `objects` Note: objects lock is used to synchronise object updating between repaint thread and game thread.
`int` | `offscreen_margin_x`
`int` | `offscreen_margin_y`
`JGColor` | `outline_colour`
`int` | `outline_thickness`
`int` | `pendingxofs` Pending pixel offset of visible view on playfield, to be handled at the next frame draw.
`int` | `pendingyofs` Pending pixel offset of visible view on playfield, to be handled at the next frame draw.
`int` | `pf_wrapshiftx`
`int` | `pf_wrapshifty`
`boolean` | `pf_wrapx` Wrap-around playfield
`boolean` | `pf_wrapy` Wrap-around playfield
`int` | `pfheight` Derived info (playfield size in logical pixels)
`int` | `pfheight_half` Derived info, used for modulo calculation
`int` | `pfwidth` Derived info (playfield size in logical pixels)
`int` | `pfwidth_half` Derived info, used for modulo calculation
`JGColor` | `render_bg_color`
`int` | `scaledtilex` Size of one tile, scaled
`int` | `scaledtiley` Size of one tile, scaled
`boolean` | `smooth_magnify`
`int[][]` | `tilecidmap`
`int[][]` | `tilemap`
`int` | `tilex` Size of one tile
`int` | `tilexofs` Tile offset of top left tile on background image; is derived from x/yofs
`int` | `tiley` Size of one tile
`int` | `tileyofs` Tile offset of top left tile on background image; is derived from x/yofs
`boolean` | `view_initialised` indicates if setCanvasSettings was called.
`int` | `viewnrtilesx` Number of tiles in view (visible window).
`int` | `viewnrtilesy` Number of tiles in view (visible window).
`int` | `width` Actual scaled canvas size; that is, the size of the playfield view, which may be smaller than the desired size of the game window to accommodate for integer-sized scaled tiles.
`int` | `winheight` Desired width/height of game window; 0 is not initialised yet.
`int` | `winwidth` Desired width/height of game window; 0 is not initialised yet.
`double` | `x_scale_fac` min_scale_fac is min (scalex,scaley).
`int` | `xofs` Pixel offset of visible view on playfield.
`int` | `xofs_mid` Derived offset information, useful for modulo.
`int` | `xofs_scaled` Derived offset information, useful for scaling.
`double` | `y_scale_fac` min_scale_fac is min (scalex,scaley).
`int` | `yofs` Pixel offset of visible view on playfield.
`int` | `yofs_mid` Derived offset information, useful for modulo.
`int` | `yofs_scaled` Derived offset information, useful for scaling.

Constructor Summary
`EngineLogic(JGImage imageutil, boolean make_bitmask, boolean prescale)`

Method Summary
`void` | `addGameState(java.lang.String state)`
`boolean` | `and(int value, int mask)`
`void` | `andTileCid(int x, int y, int and_mask)`
`void` | `checkBGCollision(JGEngineInterface eng, int tilecid, int objcid)`
`int` | `checkBGCollision(JGRectangle r)`
`int` | `checkCollision(int cidmask, JGObject obj)`
`void` | `checkCollision(JGEngineInterface eng, int srccid, int dstcid)`
`void` | `clearGameState()`
`int` | `countObjects(java.lang.String prefix, int cidmask)`
`int` | `countObjects(java.lang.String prefix, int cidmask, boolean suspended_obj)`
`int` | `countTiles(int tilecidmask)`
`void` | `defineAnimation(java.lang.String id, java.lang.String[] frames, double speed)`
`void` | `defineAnimation(java.lang.String id, java.lang.String[] frames, double speed, boolean pingpong)`
`void` | `defineAudioClip(java.lang.Object pkg_obj, java.lang.String clipid, java.lang.String filename)` Associate given clipid with a filename.
`void` | `defineImage(java.lang.Object pkg_obj, java.lang.String imgname, java.lang.String tilename, int collisionid, java.lang.String imgfile, java.lang.String img_op)`
`void` | `defineImage(java.lang.Object pkg_obj, 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)`
`void` | `defineImage(java.lang.String name, java.lang.String tilename, int collisionid, JGImage img, java.lang.String img_op, int top, int left, int width, int height)` passing -1 to top,left,width,height indicates these have to be taken from the image dimensions.
`void` | `defineImage(java.lang.String imgname, java.lang.String tilename, int collisionid, java.lang.String imgmap, int mapidx, java.lang.String img_op)`
`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)`
`void` | `defineImageMap(java.lang.Object pkg_obj, java.lang.String mapname, java.lang.String imgfile, int xofs, int yofs, int tilex, int tiley, int skipx, int skipy)`
`void` | `defineImageRotated(java.lang.Object pkg_obj, java.lang.String name, java.lang.String tilename, int collisionid, java.lang.String srcname, double angle)`
`void` | `defineMedia(JGEngineInterface eng, java.lang.String filename)`
`int` | `divFloor(int pos, int div)` Div which always rounds downwards, also for negative numbers.
`void` | `drawImageString(JGEngineInterface eng, java.lang.String string, double x, double y, int align, java.lang.String imgmap, int char_offset, int spacing, boolean pf_relative)`
`boolean` | `existsImage(java.lang.String imgname)` protected
`boolean` | `existsObject(java.lang.String index)`
`void` | `fillBG(java.lang.String filltile)`
`void` | `flushAddList()` Add objects marked for addition.
`void` | `flushRemoveList()` protected, remove objects marked for removal.
`void` | `frameFinished()` Do final update actions on objects after all frame updates finished.
`java.lang.String` | `getAbsolutePath(java.lang.Object pkg_obj, java.lang.String filename)` Generate absolute path from relative path by prepending the package name of this class (and converting the "." to "/".
`Animation` | `getAnimation(java.lang.String id)`
`JGImage` | `getImage(java.lang.String imgname)` Slow version, (re)scales image on demand if original image is present.
`JGRectangle` | `getImageBBox(java.lang.String imgname)`
`JGImage` | `getImageOrig(java.lang.String imgname)`
`JGImage` | `getImageQuick(java.lang.String imgname)` Quick version does not scale image on demand, and does not give an error when image is not defined.
`JGPoint` | `getImageSize(java.lang.String imgname)` Gets (non-scaled) image's physical size directly.
`JGObject` | `getObject(java.lang.String index)`
`java.util.Vector` | `getObjects(java.lang.String prefix, int cidmask, boolean suspended_obj, JGRectangle bbox)`
`JGImage` | `getSubImage(java.lang.String mapname, int imgnr)` protected
`int` | `getTileCid(int xidx, int yidx)`
`int` | `getTileCid(JGPoint center, int xofs, int yofs)`
`int` | `getTileCid(JGRectangle tiler)`
`int` | `getTileCidAtCoord(double x, double y)`
`JGPoint` | `getTileCoord(int tilex, int tiley)`
`JGPoint` | `getTileCoord(JGPoint tileidx)`
`java.lang.Object` | `getTileImage(java.lang.Integer tileid)` Protected.
`JGPoint` | `getTileIndex(double x, double y)`
`JGRectangle` | `getTiles(JGRectangle r)`
`boolean` | `getTiles(JGRectangle dest, JGRectangle r)`
`java.lang.String` | `getTileStr(int xidx, int yidx)`
`java.lang.String` | `getTileStr(JGPoint center, int xofs, int yofs)`
`java.lang.String` | `getTileStrAtCoord(double x, double y)`
`double` | `getXAlignOfs(double x)`
`double` | `getXDist(double x1, double x2)`
`double` | `getYAlignOfs(double y)`
`double` | `getYDist(double y1, double y2)`
`boolean` | `inGameState(java.lang.String state)`
`boolean` | `inGameStateNextFrame(java.lang.String state)`
`void` | `initBGTiles(int nrtilesx, int nrtilesy, java.lang.String filltile)` protected
`void` | `initPF()` Initialise some derived pf dimension variables.
`void` | `invalidateBGTiles()` protected
`boolean` | `isXAligned(double x, double margin)`
`boolean` | `isYAligned(double y, double margin)`
`void` | `markAddObject(JGObject obj)`
`double` | `moduloFloor(double pos, int div)` Modulo according to a regular modulo space, resulting in a value that is always greater than 0, float version.
`int` | `moduloFloor(int pos, int modulo)` Modulo according to a regular modulo space, resulting in a value that is always greater than 0.
`double` | `moduloXPos(double x)`
`double` | `moduloYPos(double y)`
`void` | `moveObjects(JGEngineInterface eng)`
`void` | `moveObjects(JGEngineInterface eng, java.lang.String prefix, int cidmask)`
`void` | `orTileCid(int x, int y, int or_mask)`
`double` | `random(double min, double max)`
`double` | `random(double min, double max, double interval)`
`int` | `random(int min, int max, int interval)`
`static java.lang.String` | `readline(java.io.InputStreamReader in)` Readline as in BufferedReader.
`void` | `registerTimer(JGTimer timer)`
`void` | `removeAllTimers()`
`void` | `removeGameState(java.lang.String state)`
`void` | `removeObject(JGObject obj)`
`void` | `removeObjects(java.lang.String prefix, int cidmask)`
`void` | `removeObjects(java.lang.String prefix, int cidmask, boolean suspended_obj)`
`void` | `repaintBG(JGEngineInterface eng)` Repaint those parts of BG which are undefined according to bg_defined.
`JGPoint` | `scalePos(double x, double y, boolean pf_relative)`
`JGRectangle` | `scalePos(double x, double y, double width, double height, boolean pf_relative)` returns null if r is null
`JGRectangle` | `scalePos(JGRectangle r, boolean pf_relative)` returns null if r is null
`int` | `scaleXPos(double x, boolean pf_relative)` The scale methods also take care of wraparound modulo calculations.
`int` | `scaleYPos(double y, boolean pf_relative)`
`void` | `setBGImage(java.lang.String bgimg, int depth, boolean wrapx, boolean wrapy)`
`void` | `setBGImgOffset(int depth, double xofs, double yofs, boolean centered)`
`void` | `setFrameRate(double fps, double maxframeskip)`
`void` | `setGameSpeed(double speed)`
`void` | `setGameState(java.lang.String state)`
`void` | `setOffscreenMargin(int xmargin, int ymargin)`
`void` | `setPFSize(int nrtilesx, int nrtilesy)`
`void` | `setPFWrap(boolean wrapx, boolean wrapy, int shiftx, int shifty)`
`void` | `setRenderSettings(int alpha_thresh, JGColor render_bg_col)`
`void` | `setTile(int x, int y, java.lang.String tilestr)`
`void` | `setTile(JGPoint tileidx, java.lang.String tilename)`
`void` | `setTileCid(int x, int y, int value)`
`void` | `setTileCid(int x, int y, int and_mask, int or_mask)`
`void` | `setTiles(int xofs, int yofs, java.lang.String[] tilemap)`
`void` | `setTileSettings(java.lang.String out_of_bounds_tile, int out_of_bounds_cid, int preserve_cids)`
`void` | `setTilesMulti(int xofs, int yofs, java.lang.String[] tilemap)`
`void` | `setViewOffset(int xofs, int yofs, boolean centered)`
`void` | `snapToGrid(JGPoint p, int gridsnapx, int gridsnapy)`
`double` | `snapToGridX(double x, double gridsnapx)`
`double` | `snapToGridY(double y, double gridsnapy)`
`static java.lang.String[]` | `splitList(java.lang.String liststr)` Split a ';' separated list of words
`void` | `tickTimers()` protected
`int` | `tileHeight()`
`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()`
`static java.util.Vector` | `tokenizeString(java.lang.String str, char splitchar)` Replacement for stringTokenizer.
`void` | `undefineImage(java.lang.String name)` Remove all information associated with image, including any cached image data.
`void` | `updateViewOffset()` Update offset according to pending offset.
`int` | `viewHeight()`
`int` | `viewWidth()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### imageutil

    public JGImage imageutil

### is_resizeable

    public boolean is_resizeable

  Platform implementation decides if window is resizeable. Resizeable requires the implementation to keep the original unscaled images in memory. Turn it off if you are short on memory.

### view_initialised

    public boolean view_initialised

  indicates if setCanvasSettings was called.

### fg_color

    public JGColor fg_color

### bg_color

    public JGColor bg_color

### msg_font

    public JGFont msg_font

### outline_thickness

    public int outline_thickness

### outline_colour

    public JGColor outline_colour

### fps

    public double fps

### maxframeskip

    public double maxframeskip

### gamespeed

    public double gamespeed

### gamestate

    public java.util.Vector gamestate

  Engine game state

### gamestate_nextframe

    public java.util.Vector gamestate_nextframe

  New engine game state to be assigned at the next frame

### gamestate_new

    public java.util.Vector gamestate_new

  New game states which the game has to transition to, and for which start[state] have to be called.

### is_inited

    public boolean is_inited

  signals that JGame globals are set, and exit code should null globals in JGObject

### is_exited

    public boolean is_exited

  signals that thread should die and canvas should paint exit message

### exit_message

    public java.lang.String exit_message

### images_orig

    public java.util.Hashtable images_orig

  Strings -> JGImages, original size, nonexistence means there is no image

### image_orig_size

    public java.util.Hashtable image_orig_size

  JGPoint sizes of original images

### images

    public java.util.Hashtable images

  Strings -> JGImages, screen size, nonexistence indicates image is not cached and needs to be generated from images_orig

### images_exists

    public java.util.Hashtable images_exists

  indicates that image is defined even if it has no Image

### images_transp

    public java.util.Hashtable images_transp

### images_loaded

    public java.util.Hashtable images_loaded

  Hashtable: name to filename. Indicates that image with given name is loaded from given filename

### images_tile

    public java.util.Hashtable images_tile

### images_bbox

    public java.util.Hashtable images_bbox

### images_tilecid

    public java.util.Hashtable images_tilecid

### imagemaps

    public java.util.Hashtable imagemaps

### alpha_thresh

    public int alpha_thresh

### render_bg_color

    public JGColor render_bg_color

### objects

    public SortedArray objects

  Note: objects lock is used to synchronise object updating between repaint thread and game thread. The synchronize functions are found in Engine.doFrameAll and Canvas.paint

### nrtilesx

    public int nrtilesx

  Total number of tiles on the playfield. Initially is the same as the nr of tiles on the visible window (viewnrtilesx/y), but can be changed to define a playfield larger than the visible window.

### nrtilesy

    public int nrtilesy

  Total number of tiles on the playfield. Initially is the same as the nr of tiles on the visible window (viewnrtilesx/y), but can be changed to define a playfield larger than the visible window.

### tilex

    public int tilex

  Size of one tile

### tiley

    public int tiley

  Size of one tile

### viewnrtilesx

    public int viewnrtilesx

  Number of tiles in view (visible window).

### viewnrtilesy

    public int viewnrtilesy

  Number of tiles in view (visible window).

### min_aspect

    public double min_aspect

### max_aspect

    public double max_aspect

### crop_top

    public int crop_top

### crop_left

    public int crop_left

### crop_bottom

    public int crop_bottom

### crop_right

    public int crop_right

### smooth_magnify

    public boolean smooth_magnify

### width

    public int width

  Actual scaled canvas size; that is, the size of the playfield view, which may be smaller than the desired size of the game window to accommodate for integer-sized scaled tiles.

### height

    public int height

  Actual scaled canvas size; that is, the size of the playfield view, which may be smaller than the desired size of the game window to accommodate for integer-sized scaled tiles.

### pfwidth_half

    public int pfwidth_half

  Derived info, used for modulo calculation

### pfheight_half

    public int pfheight_half

  Derived info, used for modulo calculation

### pfwidth

    public int pfwidth

  Derived info (playfield size in logical pixels)

### pfheight

    public int pfheight

  Derived info (playfield size in logical pixels)

### canvas_xofs

    public int canvas_xofs

  offset of playfield wrt canvas (may be negative if we crop the playfield).

### canvas_yofs

    public int canvas_yofs

  offset of playfield wrt canvas (may be negative if we crop the playfield).

### scaledtilex

    public int scaledtilex

  Size of one tile, scaled

### scaledtiley

    public int scaledtiley

  Size of one tile, scaled

### pendingxofs

    public int pendingxofs

  Pending pixel offset of visible view on playfield, to be handled at the next frame draw.

### pendingyofs

    public int pendingyofs

  Pending pixel offset of visible view on playfield, to be handled at the next frame draw.

### xofs

    public int xofs

  Pixel offset of visible view on playfield.

### yofs

    public int yofs

  Pixel offset of visible view on playfield.

### tilexofs

    public int tilexofs

  Tile offset of top left tile on background image; is derived from x/yofs

### tileyofs

    public int tileyofs

  Tile offset of top left tile on background image; is derived from x/yofs

### xofs_scaled

    public int xofs_scaled

  Derived offset information, useful for scaling.

### yofs_scaled

    public int yofs_scaled

  Derived offset information, useful for scaling.

### xofs_mid

    public int xofs_mid

  Derived offset information, useful for modulo.

### yofs_mid

    public int yofs_mid

  Derived offset information, useful for modulo.

### x_scale_fac

    public double x_scale_fac

  min_scale_fac is min (scalex,scaley). These are 1.0 until width, height are defined

### y_scale_fac

    public double y_scale_fac

  min_scale_fac is min (scalex,scaley). These are 1.0 until width, height are defined

### min_scale_fac

    public double min_scale_fac

  min_scale_fac is min (scalex,scaley). These are 1.0 until width, height are defined

### winwidth

    public int winwidth

  Desired width/height of game window; 0 is not initialised yet. Note that the width/height of the canvas may be a little smaller to accommodate integer-sized scaled tiles.

### winheight

    public int winheight

  Desired width/height of game window; 0 is not initialised yet. Note that the width/height of the canvas may be a little smaller to accommodate integer-sized scaled tiles.

### tilemap

    public int[][] tilemap

### tilecidmap

    public int[][] tilecidmap

### pf_wrapx

    public boolean pf_wrapx

  Wrap-around playfield

### pf_wrapy

    public boolean pf_wrapy

  Wrap-around playfield

### pf_wrapshiftx

    public int pf_wrapshiftx

### pf_wrapshifty

    public int pf_wrapshifty

### bg_images

    public java.util.Vector bg_images

  BGImages: images to use behind transparent tiles. Element 0 is always defined. Null indicates empty image.

### offscreen_margin_x

    public int offscreen_margin_x

### offscreen_margin_y

    public int offscreen_margin_y

### bg_defined

    public boolean[][] bg_defined

  the defined state of the physical cells of background, i.e. (0,0) is the top left of background.

### audioclips

    public java.util.Hashtable audioclips

  clipid -} filename

Constructor Detail

### EngineLogic

    public EngineLogic(JGImage imageutil,
                       boolean make_bitmask,
                       boolean prescale)

Method Detail

### viewWidth

    public int viewWidth()

### viewHeight

    public int viewHeight()

### tileWidth

    public int tileWidth()

### tileHeight

    public int tileHeight()

### tokenizeString

    public static java.util.Vector tokenizeString(java.lang.String str,
                                                  char splitchar)

  Replacement for stringTokenizer. str will be split into a Vector of tokens. Empty tokens are skipped. splitchar is a single character indicating a token boundary (multiple characters are not used here). The split characters are not included.

### readline

    public static java.lang.String readline(java.io.InputStreamReader in)

  Readline as in BufferedReader. Skips empty lines!

### getAbsolutePath

    public java.lang.String getAbsolutePath(java.lang.Object pkg_obj,
                                            java.lang.String filename)

  Generate absolute path from relative path by prepending the package name of this class (and converting the "." to "/". A relative path is a path without "/" or an URL protocol at the beginning. Absolute paths are not changed.

### existsImage

    public boolean existsImage(java.lang.String imgname)

  protected

### getTileImage

    public java.lang.Object getTileImage(java.lang.Integer tileid)

  Protected.

  Parameters:
    `tileid` - tile id number as Integer object (note: 0 is undefined)
  Returns:
    the image object, null means not defined

### getImageSize

    public JGPoint getImageSize(java.lang.String imgname)

  Gets (non-scaled) image's physical size directly.

### getImageQuick

    public JGImage getImageQuick(java.lang.String imgname)

  Quick version does not scale image on demand, and does not give an error when image is not defined. DEPRECATED.

### getImage

    public JGImage getImage(java.lang.String imgname)

  Slow version, (re)scales image on demand if original image is present.

### getImageOrig

    public JGImage getImageOrig(java.lang.String imgname)

### getSubImage

    public JGImage getSubImage(java.lang.String mapname,
                               int imgnr)

  protected

### defineMedia

    public void defineMedia(JGEngineInterface eng,
                            java.lang.String filename)

### splitList

    public static java.lang.String[] splitList(java.lang.String liststr)

  Split a ';' separated list of words

### undefineImage

    public void undefineImage(java.lang.String name)

  Remove all information associated with image, including any cached image data. Does not unload any image maps. XXX not quite finished; publish this method when finished.

### defineImage

    public void defineImage(java.lang.Object pkg_obj,
                            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)

### defineImage

    public void defineImage(java.lang.String name,
                            java.lang.String tilename,
                            int collisionid,
                            JGImage img,
                            java.lang.String img_op,
                            int top,
                            int left,
                            int width,
                            int height)

  passing -1 to top,left,width,height indicates these have to be taken from the image dimensions.

### defineImageRotated

    public void defineImageRotated(java.lang.Object pkg_obj,
                                   java.lang.String name,
                                   java.lang.String tilename,
                                   int collisionid,
                                   java.lang.String srcname,
                                   double angle)

### defineImageMap

    public void defineImageMap(java.lang.Object pkg_obj,
                               java.lang.String mapname,
                               java.lang.String imgfile,
                               int xofs,
                               int yofs,
                               int tilex,
                               int tiley,
                               int skipx,
                               int skipy)

### getImageBBox

    public JGRectangle getImageBBox(java.lang.String imgname)

### defineImage

    public void defineImage(java.lang.Object pkg_obj,
                            java.lang.String imgname,
                            java.lang.String tilename,
                            int collisionid,
                            java.lang.String imgfile,
                            java.lang.String img_op)

### defineImage

    public 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)

### defineImage

    public void defineImage(java.lang.String imgname,
                            java.lang.String tilename,
                            int collisionid,
                            java.lang.String imgmap,
                            int mapidx,
                            java.lang.String img_op)

### updateViewOffset

    public void updateViewOffset()

  Update offset according to pending offset. Protected.

### markAddObject

    public void markAddObject(JGObject obj)

### flushRemoveList

    public void flushRemoveList()

  protected, remove objects marked for removal.

### flushAddList

    public void flushAddList()

  Add objects marked for addition. Protected.

### existsObject

    public boolean existsObject(java.lang.String index)

### getObject

    public JGObject getObject(java.lang.String index)

### moveObjects

    public void moveObjects(JGEngineInterface eng,
                            java.lang.String prefix,
                            int cidmask)

### moveObjects

    public void moveObjects(JGEngineInterface eng)

### checkCollision

    public void checkCollision(JGEngineInterface eng,
                               int srccid,
                               int dstcid)

### checkCollision

    public int checkCollision(int cidmask,
                              JGObject obj)

### checkBGCollision

    public int checkBGCollision(JGRectangle r)

### checkBGCollision

    public void checkBGCollision(JGEngineInterface eng,
                                 int tilecid,
                                 int objcid)

### getObjects

    public java.util.Vector getObjects(java.lang.String prefix,
                                       int cidmask,
                                       boolean suspended_obj,
                                       JGRectangle bbox)

### removeObject

    public void removeObject(JGObject obj)

### removeObjects

    public void removeObjects(java.lang.String prefix,
                              int cidmask)

### removeObjects

    public void removeObjects(java.lang.String prefix,
                              int cidmask,
                              boolean suspended_obj)

### countObjects

    public int countObjects(java.lang.String prefix,
                            int cidmask)

### countObjects

    public int countObjects(java.lang.String prefix,
                            int cidmask,
                            boolean suspended_obj)

### frameFinished

    public void frameFinished()

  Do final update actions on objects after all frame updates finished. Protected.

### repaintBG

    public void repaintBG(JGEngineInterface eng)

  Repaint those parts of BG which are undefined according to bg_defined. Handles wraparound if applicable. If wraparound is on, xofs and yofs may be any value.

### setBGImage

    public void setBGImage(java.lang.String bgimg,
                           int depth,
                           boolean wrapx,
                           boolean wrapy)

### initBGTiles

    public void initBGTiles(int nrtilesx,
                            int nrtilesy,
                            java.lang.String filltile)

  protected

### invalidateBGTiles

    public void invalidateBGTiles()

  protected

### setTileSettings

    public void setTileSettings(java.lang.String out_of_bounds_tile,
                                int out_of_bounds_cid,
                                int preserve_cids)

### fillBG

    public void fillBG(java.lang.String filltile)

### setTileCid

    public void setTileCid(int x,
                           int y,
                           int and_mask,
                           int or_mask)

### setTile

    public void setTile(int x,
                        int y,
                        java.lang.String tilestr)

### countTiles

    public int countTiles(int tilecidmask)

### getTileCid

    public int getTileCid(int xidx,
                          int yidx)

### getTileStr

    public java.lang.String getTileStr(int xidx,
                                       int yidx)

### getTileCid

    public int getTileCid(JGRectangle tiler)

### tileStrToID

    public int tileStrToID(java.lang.String tilestr)

  Convert tile name to integer ID code (as used internally). The ID code basically encodes the four characters of the string into the bytes of the four-byte integer. The ID code is NOT related to the collision ID (CID).

  Parameters:
    `tilestr` - tilename, null or empty string -> ID = 0

### tileIDToStr

    public java.lang.String tileIDToStr(int tileid)

  Convert tile ID code to tile name (as used internally). The ID code basically encodes the four characters of the string into the bytes of the four-byte integer. The ID code is NOT related to the collision ID (CID).

  Parameters:
    `tilestr` - tile ID, tileid==0 -> tilename = empty string

### getTiles

    public boolean getTiles(JGRectangle dest,
                            JGRectangle r)

### getTiles

    public JGRectangle getTiles(JGRectangle r)

### setTileCid

    public void setTileCid(int x,
                           int y,
                           int value)

### orTileCid

    public void orTileCid(int x,
                          int y,
                          int or_mask)

### andTileCid

    public void andTileCid(int x,
                           int y,
                           int and_mask)

### setTile

    public void setTile(JGPoint tileidx,
                        java.lang.String tilename)

### setTiles

    public void setTiles(int xofs,
                         int yofs,
                         java.lang.String[] tilemap)

### setTilesMulti

    public void setTilesMulti(int xofs,
                              int yofs,
                              java.lang.String[] tilemap)

### getTileCidAtCoord

    public int getTileCidAtCoord(double x,
                                 double y)

### getTileCid

    public int getTileCid(JGPoint center,
                          int xofs,
                          int yofs)

### getTileStrAtCoord

    public java.lang.String getTileStrAtCoord(double x,
                                              double y)

### getTileStr

    public java.lang.String getTileStr(JGPoint center,
                                       int xofs,
                                       int yofs)

### drawImageString

    public void drawImageString(JGEngineInterface eng,
                                java.lang.String string,
                                double x,
                                double y,
                                int align,
                                java.lang.String imgmap,
                                int char_offset,
                                int spacing,
                                boolean pf_relative)

### moduloXPos

    public double moduloXPos(double x)

### moduloYPos

    public double moduloYPos(double y)

### divFloor

    public int divFloor(int pos,
                        int div)

  Div which always rounds downwards, also for negative numbers. It is the counterpart of moduloFloor.

### moduloFloor

    public double moduloFloor(double pos,
                              int div)

  Modulo according to a regular modulo space, resulting in a value that is always greater than 0, float version. It is the counterpart of divFloor.

### moduloFloor

    public int moduloFloor(int pos,
                           int modulo)

  Modulo according to a regular modulo space, resulting in a value that is always greater than 0.

### scaleXPos

    public int scaleXPos(double x,
                         boolean pf_relative)

  The scale methods also take care of wraparound modulo calculations. This is only applicable to pf_relative positions. The modulo semantics is that of moduloPos.

### scaleYPos

    public int scaleYPos(double y,
                         boolean pf_relative)

### scalePos

    public JGPoint scalePos(double x,
                            double y,
                            boolean pf_relative)

### scalePos

    public JGRectangle scalePos(double x,
                                double y,
                                double width,
                                double height,
                                boolean pf_relative)

  returns null if r is null

### scalePos

    public JGRectangle scalePos(JGRectangle r,
                                boolean pf_relative)

  returns null if r is null

### initPF

    public void initPF()

  Initialise some derived pf dimension variables. Also clears the tile map if !is_inited. Clears the resized image cache if is_inited and is_resizeable.

### setViewOffset

    public void setViewOffset(int xofs,
                              int yofs,
                              boolean centered)

### setBGImgOffset

    public void setBGImgOffset(int depth,
                               double xofs,
                               double yofs,
                               boolean centered)

### setPFSize

    public void setPFSize(int nrtilesx,
                          int nrtilesy)

### setPFWrap

    public void setPFWrap(boolean wrapx,
                          boolean wrapy,
                          int shiftx,
                          int shifty)

### setFrameRate

    public void setFrameRate(double fps,
                             double maxframeskip)

### setRenderSettings

    public void setRenderSettings(int alpha_thresh,
                                  JGColor render_bg_col)

### setOffscreenMargin

    public void setOffscreenMargin(int xmargin,
                                   int ymargin)

### setGameSpeed

    public void setGameSpeed(double speed)

### removeAllTimers

    public void removeAllTimers()

### registerTimer

    public void registerTimer(JGTimer timer)

### tickTimers

    public void tickTimers()

  protected

### setGameState

    public void setGameState(java.lang.String state)

### addGameState

    public void addGameState(java.lang.String state)

### removeGameState

    public void removeGameState(java.lang.String state)

### clearGameState

    public void clearGameState()

### inGameState

    public boolean inGameState(java.lang.String state)

### inGameStateNextFrame

    public boolean inGameStateNextFrame(java.lang.String state)

### defineAnimation

    public void defineAnimation(java.lang.String id,
                                java.lang.String[] frames,
                                double speed)

### defineAnimation

    public void defineAnimation(java.lang.String id,
                                java.lang.String[] frames,
                                double speed,
                                boolean pingpong)

### getAnimation

    public Animation getAnimation(java.lang.String id)

### and

    public boolean and(int value,
                       int mask)

### random

    public double random(double min,
                         double max)

### random

    public double random(double min,
                         double max,
                         double interval)

### random

    public int random(int min,
                      int max,
                      int interval)

### getTileIndex

    public JGPoint getTileIndex(double x,
                                double y)

### getTileCoord

    public JGPoint getTileCoord(int tilex,
                                int tiley)

### getTileCoord

    public JGPoint getTileCoord(JGPoint tileidx)

### snapToGridX

    public double snapToGridX(double x,
                              double gridsnapx)

### snapToGridY

    public double snapToGridY(double y,
                              double gridsnapy)

### snapToGrid

    public void snapToGrid(JGPoint p,
                           int gridsnapx,
                           int gridsnapy)

### isXAligned

    public boolean isXAligned(double x,
                              double margin)

### isYAligned

    public boolean isYAligned(double y,
                              double margin)

### getXAlignOfs

    public double getXAlignOfs(double x)

### getYAlignOfs

    public double getYAlignOfs(double y)

### getXDist

    public double getXDist(double x1,
                           double x2)

### getYDist

    public double getYDist(double y1,
                           double y2)

### defineAudioClip

    public void defineAudioClip(java.lang.Object pkg_obj,
                                java.lang.String clipid,
                                java.lang.String filename)

  Associate given clipid with a filename. Files are loaded from the resource path. Java 1.2+ supports at least: midi and wav files.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD