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

📄 tankcanvas.java

📁 j2me的坦克大战 元代码 单机版和蓝牙联网版
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                        g.drawString("OnlineVS", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 4 *                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("Exit", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 5 *                                fontHeight, g.TOP | g.HCENTER);                        break;                    case 3:                        g.setColor(0x00, 0xfe, 0xfe);                        g.drawString("Start", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight(), g.TOP |                                g.HCENTER);                        g.drawString("Setting", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() +                                fontHeight, g.TOP | g.HCENTER);                        g.setColor(0xfe, 0x3f, 0x00);                        g.drawString("About", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 2 *                                fontHeight, g.TOP | g.HCENTER);                        g.setColor(0x00, 0xfe, 0xfe);                        g.drawString("Online", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 3 *                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("OnlineVS", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 4 *                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("Exit", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 5 *                                fontHeight, g.TOP | g.HCENTER);                        break;                    case 4:                        g.setColor(0x00, 0xfe, 0xfe);                        g.drawString("Start", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight(), g.TOP |                                g.HCENTER);                        g.drawString("Setting", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() +                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("About", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 2 *                                fontHeight, g.TOP | g.HCENTER);                        g.setColor(0xfe, 0x3f, 0x00);                        g.drawString("Online", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 3 *                                fontHeight, g.TOP | g.HCENTER);                        g.setColor(0x00, 0xfe, 0xfe);                        g.drawString("OnlineVS", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 4 *                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("Exit", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 5 *                                fontHeight, g.TOP | g.HCENTER);                        break;                    case 5:                        g.setColor(0x00, 0xfe, 0xfe);                        g.drawString("Start", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight(), g.TOP |                                g.HCENTER);                        g.drawString("Setting", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() +                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("About", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 2 *                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("Online", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 3 *                                fontHeight, g.TOP | g.HCENTER);                        g.setColor(0xfe, 0x3f, 0x00);                        g.drawString("OnlineVS", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 4 *                                fontHeight, g.TOP | g.HCENTER);                        g.setColor(0x00, 0xfe, 0xfe);                        g.drawString("Exit", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 5 *                                fontHeight, g.TOP | g.HCENTER);                        break;                    case 6:                        g.setColor(0x00, 0xfe, 0xfe);                        g.drawString("Start", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight(), g.TOP |                                g.HCENTER);                        g.drawString("Setting", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() +                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("About", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 2 *                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("Online", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 3 *                                fontHeight, g.TOP | g.HCENTER);                        g.drawString("OnlineVS", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 4 *                                fontHeight, g.TOP | g.HCENTER);                        g.setColor(0xfe, 0x3f, 0x00);                        g.drawString("Exit", screenWidth / 2, (screenHeight -                                imgTitle.getHeight()) / 3 + imgTitle.getHeight() + 5 *                                fontHeight, g.TOP | g.HCENTER);                        break;                    default:                        break;                }                break;            default:                break;        }    }    private void inputMenu(int j) {        switch (j) {            case Canvas.LEFT:            case Canvas.UP:                //gameState = 3;                gameSubStatus = 3;                if (gameSelect > 1) {                    gameSelect--;                } else {                    gameSelect = 6;                }                break;            case Canvas.RIGHT:            case Canvas.DOWN:                //gameState = 3;                gameSubStatus = 3;                if (gameSelect < 6) {                    gameSelect++;                } else {                    gameSelect = 1;                }                break;            case Canvas.FIRE:                //gameState = 3;(展开图片时按键没用)                if (gameSelect == 1) {                    gameMidlet.newGame();                }                if (gameSelect == 2) {                    gameMidlet.option.gaming = false;                    gameMidlet.gameOption();                }                if (gameSelect == 3) {                    gameMidlet.gameInstruction();                }                if (gameSelect == 4) {                    gameMidlet.gameNetForm();                }                if (gameSelect == 5) {                    gameMidlet.gameNetForm2();                                    }                if (gameSelect == 6) {                    gameMidlet.destroyApp(true);                }                break;            default:                break;        }    }    protected void keyPressed(int keyCode) {        int j = getGameAction(keyCode);        switch (gameSubStatus) {            case 1:                break;            case 2:                if (controlMenu) {                    gameState = 3;                    gameSubStatus = 1;                    controlMenu = false;                }                break;            case 3:                if (gameState == 3) {                    inputMenu(j);                }                break;        }    }    private void drawSplash(Graphics g) {        Image imgSplash = null;        try {            imgSplash = Image.createImage("/splash.png");        } catch (IOException ex) {            ex.printStackTrace();        }        if (imgSplash != null) {            g.drawImage(imgSplash, screenWidth / 2, screenHeight / 2, Graphics.VCENTER | Graphics.HCENTER);        }        SplashCnt++;        if (SplashCnt == 10) {            gameState = 2;            gameSubStatus = 1;            SplashCnt = 0;        }    }    public void run() {        int step = 100;        while (true) {            long start = System.currentTimeMillis();            repaint();            serviceRepaints();            long end = System.currentTimeMillis();            int duration = (int) (end - start);            if (duration < step) {                try {                    Thread.sleep(step - duration);                } catch (InterruptedException e) {                }            }        }    }}

⌨️ 快捷键说明

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