📄 gamelogo.java
字号:
import java.io.IOException;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;
public class GameLogo extends GameCanvas implements Runnable{
private GameMain gameMain;
//判断是否显示
public static GameMenu gameMenu;
boolean isShow;
protected GameLogo(GameMain game) {
//初始化
super(true);
isShow=true;
Thread t=new Thread(this);
t.start();
gameMain=game;
}
private void isKeyPress(){
int keyCode=this.getKeyStates();
if (keyCode!=0){
isShow=false;
}
}
private void showLogo(){
Graphics g=this.getGraphics();
g.setColor(255,255,255);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
g.setColor(0,0,0);
Image img=null;
try {
img=Image.createImage("/logo1.png");
} catch (IOException e) {
e.printStackTrace();
}
g.drawImage(img, 0, 0, 0);
this.flushGraphics();
}
public GameCanvas createGameMenu(int menuSelect){
if(gameMenu==null){
gameMenu=new GameMenu(gameMain,menuSelect);
}
return gameMenu;
}
public void run() {
int i=0;
while(isShow && i<=20){
isKeyPress();
showLogo();
try {
Thread.sleep(40);
} catch (InterruptedException e) {
e.printStackTrace();
}
i++;
}
Thread.yield();
gameMain.display.setCurrent(this.createGameMenu(0));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -