example.payment.jbricks
Class Engine

java.lang.Object
  extended by example.payment.jbricks.Engine
All Implemented Interfaces:
java.lang.Runnable

public class Engine
extends java.lang.Object
implements java.lang.Runnable

This class drives the games (hence the name engine :). It has all the level data, animates the objects, keeps track of state, and triggers screen redraws.


Field Summary
static int MENU
           
static int OVER
           
static int PATTERN_WIDTH
           
static int PLAY
           
static int TITLE
           
 
Constructor Summary
Engine(Screen screen)
           
 
Method Summary
protected  boolean canBuyLevels(int count)
           
protected  boolean canBuyLives(int count)
           
protected  int getAvailableLevels()
           
protected  int getAvailableLives()
           
 void getState(EngineState engineState)
           
protected  void increaseNumOfLevels(int inc)
           
protected  void increaseNumOfLives(int inc)
           
 void keyPressed(int keycode, int gameAction)
           
 void keyReleased(int keycode, int gameAction)
           
 boolean levelStarted()
           
protected  void resumeGame()
           
 void run()
           
 void setLastKeyPressed(long time)
           
 void setPaused(boolean pause)
           
protected  void setState(int state)
           
protected  void showMenu()
           
protected  void startGame(int level)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_WIDTH

public static final int PATTERN_WIDTH
See Also:
Constant Field Values

TITLE

public static final int TITLE
See Also:
Constant Field Values

PLAY

public static final int PLAY
See Also:
Constant Field Values

OVER

public static final int OVER
See Also:
Constant Field Values

MENU

public static final int MENU
See Also:
Constant Field Values
Constructor Detail

Engine

public Engine(Screen screen)
Method Detail

keyPressed

public void keyPressed(int keycode,
                       int gameAction)

keyReleased

public void keyReleased(int keycode,
                        int gameAction)

getState

public void getState(EngineState engineState)

startGame

protected void startGame(int level)

setLastKeyPressed

public void setLastKeyPressed(long time)

levelStarted

public boolean levelStarted()

stop

public void stop()

setPaused

public void setPaused(boolean pause)

run

public void run()
Specified by:
run in interface java.lang.Runnable

setState

protected void setState(int state)

increaseNumOfLevels

protected void increaseNumOfLevels(int inc)

increaseNumOfLives

protected void increaseNumOfLives(int inc)

getAvailableLevels

protected int getAvailableLevels()

getAvailableLives

protected int getAvailableLives()

canBuyLevels

protected boolean canBuyLevels(int count)

canBuyLives

protected boolean canBuyLives(int count)

showMenu

protected void showMenu()

resumeGame

protected void resumeGame()