Java Reference
In-Depth Information
public void init() {
try {
mWorld = (World) Loader.load("/pogoroo.m3g")[0];
mCam = mWorld.getActiveCamera();
mCam.translate(0, 0, -1.5f);
mCam.setOrientation(180, 0, 1, 0);
}
catch(Exception e) {
e.printStackTrace();
}
mWorldStartTime = System.currentTimeMillis();
}
public void start() {
mRunning = true;
mPaintThrd = new Thread(this);
mPaintThrd.start();
}
public void stop() {
mRunning = false;
try{
mPaintThrd.join();}
catch (InterruptedException ex){}
}
public void run() {
Graphics g = getGraphics();
long startTime;
while(mRunning) {
if (isShown()) {
int keyStates = getKeyStates();
if ((keyStates & UP_PRESSED) != 0) {
cameraForward();
}
else if ((keyStates & DOWN_PRESSED) != 0) {
cameraBackward();
}
else if ((keyStates & LEFT_PRESSED) != 0) {
cameraLeft();
}
else if ((keyStates & RIGHT_PRESSED) != 0) {
cameraRight();
}
Search WWH ::




Custom Search