|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.lcdui.Displayable | +--javax.microedition.lcdui.Canvas | +--javax.microedition.lcdui.game.GameCanvas | +--mgdk.MCanvas
The base class for MIDlets created with MGDK, every MIDlet should have one. Extend it and overload handleInput(), updateObjects() and draw(). Initialize sprites etc in your new class constructor.
Field Summary | |
javax.microedition.lcdui.game.LayerManager |
layers
All games will probable use a LayerManager, use this one :o) |
int |
msgBoxBack
|
int |
msgBoxBorder
|
int |
msgBoxText
|
Fields inherited from class javax.microedition.lcdui.game.GameCanvas |
DOWN_PRESSED, FIRE_PRESSED, GAME_A_PRESSED, GAME_B_PRESSED, GAME_C_PRESSED, GAME_D_PRESSED, LEFT_PRESSED, RIGHT_PRESSED, UP_PRESSED |
Fields inherited from class javax.microedition.lcdui.Canvas |
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP |
Constructor Summary | |
MCanvas()
Constructor, sets default values and creates some objects. |
Method Summary | |
void |
clear(javax.microedition.lcdui.Graphics gr,
int r,
int g,
int b)
Clears the screen. |
void |
draw(javax.microedition.lcdui.Graphics g)
Draw objects to the screen here (overload it). |
void |
handleInput()
Handle inputs in this one (overload it). |
boolean |
keyA()
|
boolean |
keyB()
|
boolean |
keyC()
|
boolean |
keyD()
|
boolean |
keyDown()
Checks if key down is pressed. |
boolean |
keyFire()
Checks if the fire key is pressed. |
boolean |
keyLeft()
Checks if key left is pressed. |
boolean |
keyRight()
Checks if key right is pressed. |
boolean |
keyUp()
Checks if key up is pressed. |
void |
msgBox(java.lang.String msg,
int width,
int height)
Displays a simple messagebox centered on screen. |
void |
run()
The main game loop. |
void |
start()
Start the main game loop. |
void |
stop()
Stop the main game loop. |
void |
updateObjects()
Update (move, animation) your objects (sprites, maps) in this one (overload it). |
void |
wishFPS(int fps)
Set how many frames per second you wish for your game to have. |
void |
wishTimePerFrame(int tpf)
Set how much time you wish to spend for each update of your game. |
Methods inherited from class javax.microedition.lcdui.game.GameCanvas |
flushGraphics, flushGraphics, getGraphics, getKeyStates, paint |
Methods inherited from class javax.microedition.lcdui.Canvas |
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, setFullScreenMode, showNotify, sizeChanged |
Methods inherited from class javax.microedition.lcdui.Displayable |
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public javax.microedition.lcdui.game.LayerManager layers
public int msgBoxBack
public int msgBoxText
public int msgBoxBorder
Constructor Detail |
public MCanvas()
Method Detail |
public void wishFPS(int fps)
public void wishTimePerFrame(int tpf)
public void start()
public void stop()
public void run()
run
in interface java.lang.Runnable
public void handleInput()
public void updateObjects()
public void draw(javax.microedition.lcdui.Graphics g)
public void msgBox(java.lang.String msg, int width, int height)
public void clear(javax.microedition.lcdui.Graphics gr, int r, int g, int b)
public boolean keyLeft()
public boolean keyRight()
public boolean keyDown()
public boolean keyUp()
public boolean keyFire()
public boolean keyA()
public boolean keyB()
public boolean keyC()
public boolean keyD()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |