📄 jumping.java
字号:
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Copyright(c) 2003-2004 Jordi Martin Perez
*/
package org.piratis.j2me.demos.jumping;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import org.piratis.j2me.core.game.Canvas;
/**
* Simply MIDlet showing J2MEGL usage.<br><br>
* It (will) features a simply jumping game where the player (a bouncing
* ball) must overcome the different obstacles that will come up in its
* way to the finish (his home?)
*
* @author Jordi Mart韓
* @copyright Copyright (c) 2003-2004
* @created 24-jun-2004
* @version $Id: Jumping.java,v 1.2 2004/06/25 21:33:10 piratis Exp $
*/
public class Jumping
extends MIDlet
{
/**
* MIDlet variables
*/
private Canvas canvas;
private Display display;
private JumpingEngine engine;
/**
*
*/
public Jumping()
{
super();
// get display
this.display = Display.getDisplay(this);
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#startApp()
*/
protected void startApp() throws MIDletStateChangeException
{
try
{
// build simple canvas
this.canvas = new Canvas(this.display);
// fronton engine
this.engine = new JumpingEngine(this.canvas);
// set current canvas
this.display.setCurrent(this.canvas);
// start engine
Thread th = new Thread(this.engine);
th.start();
}
catch (Exception e)
{
e.printStackTrace();
}
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#pauseApp()
*/
protected void pauseApp()
{
this.engine.stop();
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
*/
protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
this.engine.stop();
notifyDestroyed();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -