⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 splashscreen.java

📁 欢迎使用蓝牙联网坦克大战
💻 JAVA
字号:
/*
 * Combat - an example of a multiplater game using the Bluetooth Multiplayer Games Framework
 * Author: Francesco Panciroli (email: fif0302@iperbole.bologna.it)
 * Copyright (C) 2006  Francesco Panciroli
 * 
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package newpackagetank;

import javax.microedition.lcdui.*;
import org.apache.log4j.Category;


class SplashScreen extends Canvas implements Runnable {

	static Category log = Category.getInstance("newpackagetank.SplashScreen");

	private final TankMidlet midlet;
    //private Image splashImage;
    private volatile boolean dismissed = false;

    SplashScreen(TankMidlet midlet) {
        this.midlet = midlet;
        setFullScreenMode(true);
        //splashImage = TankMidlet.createImage("/splashScreen.png");
        //log.debug("splashImage = " + splashImage);
        new Thread(this).start();
    }

    public void run() {
    	repaintAll();
        synchronized(this) {
            try {
                wait(3000L);   // 3 seconds
            } catch (InterruptedException e) {
                // ignore
            }
        }
        dismiss();
    }


    public void paint(Graphics g) {
       // if (splashImage != null) {
            int width = getWidth();
            int height = getHeight();
            g.setColor(0x00FFFFFF);
            g.fillRect(0, 0, width, height);

            g.setColor(0x00FF0000);
            g.drawRect(1, 1, width-2, height-2);

    		g.setColor(255, 0, 0);
    		g.drawString("坦克大战", width / 2, 30, Graphics.TOP | Graphics.HCENTER);
    		g.drawString("2008", width / 2, 45, Graphics.TOP | Graphics.HCENTER);

    		g.setColor(0x000000FF);
    		g.drawString("迈泰科脉工作室", width / 2, height - 40, Graphics.BOTTOM | Graphics.HCENTER);
    		g.drawString("Copyright (C) 2008", width / 2, height - 25, Graphics.BOTTOM | Graphics.HCENTER);

			
    }


    public void keyPressed(int keyCode) {
        dismiss();
    }


    private synchronized void dismiss() {
        if (!dismissed) {
            dismissed = true;
            midlet.splashScreenDone();
        }
    }

    private void repaintAll() {
		repaint(0, 0, getWidth(), getHeight());
		serviceRepaints();
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -