dk.itu.smds.torusman
Class TorusMan

java.lang.Object
  extended by javax.microedition.midlet.MIDlet
      extended by jgame.platform.JGEngine
          extended by dk.itu.smds.util.JGEngine
              extended by dk.itu.smds.torusman.TorusMan
All Implemented Interfaces:
jgame.impl.JGEngineInterface

public class TorusMan
extends dk.itu.smds.util.JGEngine

Tutorial example 1: a minimal program. A "bare skeleton" program displaying a moving text "hello world". In order to run as both applet and application, you need to define a main() method (this is the entry point for an application) and a parameterless constructor (this is the entry point for an applet). We use a second constructor with a size parameter to initialise the engine as an application.


Field Summary
 
Fields inherited from interface jgame.impl.JGEngineInterface
CROSSHAIR_CURSOR, DEFAULT_CURSOR, HAND_CURSOR, KeyAlt, KeyBackspace, KeyCtrl, KeyDown, KeyEnter, KeyEsc, KeyFire, KeyLeft, KeyMouse1, KeyMouse2, KeyMouse3, KeyPound, KeyRight, KeyShift, KeyStar, KeyTab, KeyUp, WAIT_CURSOR
 
Constructor Summary
TorusMan()
          The parameterless constructor is called by the browser, in case we're an applet.
TorusMan(jgame.JGPoint size)
          We use a separate constructor for starting as an application.
 
Method Summary
 void doFrame()
          Game logic is done here.
 void initCanvas()
          This method is called by the engine when it is ready to intialise the canvas (for an applet, this is after the browser has called init()).
 void initGame()
          This method is called when the engine has finished initialising and is ready to produce frames.
static void main(java.lang.String[] args)
           
 void paintFrame()
          Any graphics drawing beside objects or tiles should be done here.
 void startApp()
           
 
Methods inherited from class jgame.platform.JGEngine
addGameState, and, andTileCid, atan2, checkBGCollision, checkBGCollision, checkCollision, checkCollision, clearGameState, clearKey, clearLastKey, clearMouseButton, countObjects, countObjects, countTiles, dbgExceptionToString, dbgPrint, dbgPrint, dbgSetDebugColor1, dbgSetDebugColor2, dbgSetMessageExpiry, dbgSetMessageFont, dbgShowBoundingBox, dbgShowException, dbgShowFullStackTrace, dbgShowGameState, dbgShowMessagesInPf, defineAnimation, defineAnimation, defineAudioClip, defineImage, defineImage, defineImage, defineImage, defineImageMap, defineMedia, destroy, destroyApp, disableAudio, displayHeight, displayWidth, doFrameEnterHighscore, doFrameGameOver, doFrameHighscores, doFrameInGame, doFrameLevelDone, doFrameLifeLost, doFramePaused, doFrameStartGame, doFrameStartLevel, doFrameTitle, drawImage, drawImage, drawImageString, drawImageString, drawLine, drawLine, drawLine, drawOval, drawOval, drawOval, drawRect, drawRect, drawRect, drawString, drawString, drawString, drawTile, enableAudio, existsObject, exitEngine, fillBG, getAnimation, getBufferGraphics, getConfigPath, getFontHeight, getFrameRate, getFrameSkip, getGameSpeed, getImage, getImageBBox, getImageSize, getKey, getKeyCode, getKeyCodeStatic, getKeyDesc, getKeyDescStatic, getLastKey, getLastKeyChar, getMinScaleFactor, getMouseButton, getMouseInside, getMousePos, getMouseX, getMouseY, getObject, getObjects, getOffscreenMarginX, getOffscreenMarginY, getParameter, getTileCid, getTileCid, getTileCid, getTileCidAtCoord, getTileCoord, getTileCoord, getTileIndex, getTiles, getTiles, getTileStr, getTileStr, getTileStrAtCoord, getXAlignOfs, getXDist, getXScaleFactor, getYAlignOfs, getYDist, getYScaleFactor, inGameState, inGameStateNextFrame, initEngine, initEngineApplet, isApplet, isMidlet, isXAligned, isYAligned, lastPlayedAudio, markAddObject, moduloXPos, moduloYPos, moveObjects, moveObjects, orTileCid, paintFrameEnterHighscore, paintFrameGameOver, paintFrameHighscores, paintFrameInGame, paintFrameLevelDone, paintFrameLifeLost, paintFramePaused, paintFrameStartGame, paintFrameStartLevel, paintFrameTitle, pauseApp, pfHeight, pfTilesX, pfTilesY, pfWidth, pfWrapX, pfWrapY, playAudio, playAudio, random, random, random, registerTimer, removeAllTimers, removeGameState, removeObject, removeObjects, removeObjects, requestGameFocus, setAuthorMessage, setBGColor, setBGImage, setCanvasSettings, setColor, setColorsFont, setFGColor, setFont, setFont, setFrameRate, setGameSpeed, setGameState, setKey, setMouseButton, setMouseCursor, setMouseCursor, setMsgFont, setOffscreenMargin, setPFSize, setPFWrap, setProgressBar, setProgressMessage, setRenderSettings, setScalingPreferences, setStroke, setTextOutline, setTile, setTile, setTileCid, setTileCid, setTiles, setTileSettings, setTilesMulti, setViewOffset, snapToGrid, snapToGridX, snapToGridY, start, startEnterHighscore, startGameOver, startHighscores, startInGame, startLevelDone, startLifeLost, startPaused, startStartGame, startStartLevel, startTitle, stop, stopAudio, stopAudio, tileHeight, tileWidth, tryMethod, viewHeight, viewTilesX, viewTilesY, viewWidth, viewXOfs, viewYOfs, wakeUpOnKey
 
Methods inherited from class javax.microedition.midlet.MIDlet
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TorusMan

public TorusMan()
The parameterless constructor is called by the browser, in case we're an applet.


TorusMan

public TorusMan(jgame.JGPoint size)
We use a separate constructor for starting as an application.

Method Detail

main

public static void main(java.lang.String[] args)

startApp

public void startApp()
Overrides:
startApp in class dk.itu.smds.util.JGEngine

initCanvas

public void initCanvas()
This method is called by the engine when it is ready to intialise the canvas (for an applet, this is after the browser has called init()). Note that applet parameters become available here and not earlier (don't try to access them from within the parameterless constructor!). Use isApplet() to check if we started as an applet.

Specified by:
initCanvas in interface jgame.impl.JGEngineInterface
Specified by:
initCanvas in class jgame.platform.JGEngine

initGame

public void initGame()
This method is called when the engine has finished initialising and is ready to produce frames. Note that the engine logic runs in its own thread, separate from the AWT event thread, which is used for painting only. This method is the first to be called from within its thread. During this method, the game window shows the intro screen.

Specified by:
initGame in interface jgame.impl.JGEngineInterface
Specified by:
initGame in class jgame.platform.JGEngine

doFrame

public void doFrame()
Game logic is done here. No painting can be done here, define paintFrame to do that.

Specified by:
doFrame in interface jgame.impl.JGEngineInterface
Overrides:
doFrame in class jgame.platform.JGEngine

paintFrame

public void paintFrame()
Any graphics drawing beside objects or tiles should be done here. Usually, only status / HUD information needs to be drawn here.

Specified by:
paintFrame in interface jgame.impl.JGEngineInterface
Overrides:
paintFrame in class jgame.platform.JGEngine