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

📄 game.java

📁 一个java的免费游戏引擎,里面有文档,和例子
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                if((d = 0.00064999999999999997D * (double)l1) > 0.22D)
                    d = 0.22D + d / 6D;
                f = (float)((double)f + d);
                if(o(l1))
                {
                    p(Color.BLACK);
                    bufferedimage.flush();
                    bufferedimage = null;
                    return;
                }
            }
            do
            {
                if(!k)
                    break label0;
                Graphics2D graphics2d1;
                (graphics2d1 = bsGraphics.getBackBuffer()).drawImage(bufferedimage, 0, 0, null);
            } while(!bsGraphics.flip());
            for(int i = 0; i++ < 50;)
            {
                if(!k)
                    break label0;
                try
                {
                    Thread.sleep(50L);
                }
                catch(InterruptedException _ex) { }
                if(o(50L))
                {
                    p(Color.BLACK);
                    bufferedimage.flush();
                    bufferedimage = null;
                    return;
                }
            }

            f = 1.0F;
            systemtimer.refresh();
            while(f > 0.0F) 
            {
                do
                {
                    if(!k)
                        break label0;
                    Graphics2D graphics2d2;
                    (graphics2d2 = bsGraphics.getBackBuffer()).setColor(Color.BLACK);
                    graphics2d2.fillRect(0, 0, getWidth(), getHeight());
                    java.awt.Composite composite1 = graphics2d2.getComposite();
                    graphics2d2.setComposite(AlphaComposite.getInstance(3, f));
                    graphics2d2.drawImage(bufferedimage, 0, 0, null);
                    graphics2d2.setComposite(composite1);
                } while(!bsGraphics.flip());
                long l2 = systemtimer.sleep();
                double d1;
                if((d1 = 0.00055000000000000003D * (double)l2) > 0.14999999999999999D)
                    d1 = 0.14999999999999999D + (d1 - 0.040000000000000001D) / 2D;
                f = (float)((double)f - d1);
                if(o(l2))
                {
                    p(Color.BLACK);
                    bufferedimage.flush();
                    bufferedimage = null;
                    return;
                }
            }
            bufferedimage.flush();
            bufferedimage = null;
            systemtimer.stopTimer();
            systemtimer = null;
            try
            {
                p(Color.BLACK);
                Thread.sleep(100L);
                return;
            }
            catch(InterruptedException _ex) { }
        }
    }

    private boolean o(long l1)
    {
        boolean flag = bsInput.getKeyPressed() != 0x80000000 || bsInput.getMousePressed() != 0x80000000;
        bsInput.update(l1);
        return flag;
    }

    private void p(Color color)
    {
        Graphics2D graphics2d;
        (graphics2d = bsGraphics.getBackBuffer()).setColor(color);
        graphics2d.fillRect(0, 0, getWidth(), getHeight());
        bsGraphics.flip();
        (graphics2d = bsGraphics.getBackBuffer()).setColor(color);
        graphics2d.fillRect(0, 0, getWidth(), getHeight());
        bsGraphics.flip();
    }

    private void q()
    {
        try
        {
            BufferedImage bufferedimage = ImageUtil.getImage((a != null ? a : (a = a("com.golden.gamedev.Game"))).getResource("Game.fnt"));
            fontManager = new GameFontManager();
            GameFont gamefont = fontManager.getFont(bufferedimage);
            Graphics2D graphics2d;
            (graphics2d = bsGraphics.getBackBuffer()).setColor(Color.RED.darker());
            graphics2d.fillRect(0, 0, getWidth(), getHeight());
            gamefont.drawString(graphics2d, "THIS GAME IS USING", 10, 10);
            gamefont.drawString(graphics2d, "GTGE CRACKED VERSION!!", 10, 30);
            gamefont.drawString(graphics2d, "PLEASE REPORT THIS GAME TO", 10, 50);
            gamefont.drawString(graphics2d, "WWW.GOLDENSTUDIOS.OR.ID", 10, 70);
            gamefont.drawString(graphics2d, "THANK YOU....", 10, 105);
            bsGraphics.flip();
            bsInput = new AWTInput(bsGraphics.getComponent());
            try
            {
                int i = 0;
                do
                    Thread.sleep(50L);
                while(++i < 160 && !o(50L));
            }
            catch(InterruptedException _ex) { }
            finish();
        }
        catch(Throwable _ex) { }
        System.out.println("THIS GAME IS USING GTGE CRACKED VERSION!!");
        System.out.println("PLEASE REPORT THIS GAME TO HTTP://WWW.GOLDENSTUDIOS.OR.ID/");
        System.out.println("THANK YOU....");
        System.exit(-1);
    }

    public int getRandom(int i, int j)
    {
        return Utility.getRandom(i, j);
    }

    public int getWidth()
    {
        return bsGraphics.getSize().width;
    }

    public int getHeight()
    {
        return bsGraphics.getSize().height;
    }

    public BufferedImage takeScreenShot()
    {
        BufferedImage bufferedimage;
        Graphics2D graphics2d = (bufferedimage = ImageUtil.createImage(getWidth(), getHeight(), 1)).createGraphics();
        render(graphics2d);
        graphics2d.dispose();
        return bufferedimage;
    }

    public void takeScreenShot(File file)
    {
        ImageUtil.saveImage(takeScreenShot(), file);
    }

    public int playMusic(String s)
    {
        return bsMusic.play(s);
    }

    public int playSound(String s)
    {
        return bsSound.play(s);
    }

    public void setFPS(int i)
    {
        bsTimer.setFPS(i);
    }

    public int getCurrentFPS()
    {
        return bsTimer.getCurrentFPS();
    }

    public int getFPS()
    {
        return bsTimer.getFPS();
    }

    public void drawFPS(Graphics2D graphics2d, int i, int j)
    {
        fontManager.getFont("FPS Font").drawString(graphics2d, "FPS = " + getCurrentFPS() + "/" + getFPS(), i, j);
    }

    public int getMouseX()
    {
        return bsInput.getMouseX();
    }

    public int getMouseY()
    {
        return bsInput.getMouseY();
    }

    public boolean checkPosMouse(int i, int j, int i1, int j1)
    {
        return getMouseX() >= i && getMouseY() >= j && getMouseX() <= i1 && getMouseY() <= j1;
    }

    public boolean checkPosMouse(Sprite sprite, boolean flag)
    {
        double d;
        double d1;
        Background background = sprite.getBackground();
        if(getMouseX() < background.getClip().x || getMouseY() < background.getClip().y || getMouseX() > background.getClip().x + background.getClip().width || getMouseY() > background.getClip().y + background.getClip().height)
            return false;
        d = ((double)getMouseX() + background.getX()) - (double)background.getClip().x;
        d1 = ((double)getMouseY() + background.getY()) - (double)background.getClip().y;
        if(!flag)
            break MISSING_BLOCK_LABEL_162;
        if((sprite.getImage().getRGB((int)(d - sprite.getX()), (int)(d1 - sprite.getY())) & 0xff000000) != 0)
            return true;
        return false;
        JVM INSTR pop ;
        return false;
        return d >= sprite.getX() && d1 >= sprite.getY() && d <= sprite.getX() + (double)sprite.getWidth() && d1 <= sprite.getY() + (double)sprite.getHeight();
    }

    public boolean click()
    {
        return bsInput.isMousePressed(1);
    }

    public boolean rightClick()
    {
        return bsInput.isMousePressed(3);
    }

    public boolean keyDown(int i)
    {
        return bsInput.isKeyDown(i);
    }

    public boolean keyPressed(int i)
    {
        return bsInput.isKeyPressed(i);
    }

    public void hideCursor()
    {
        bsInput.setMouseVisible(false);
    }

    public void showCursor()
    {
        bsInput.setMouseVisible(true);
    }

    public void setMaskColor(Color color)
    {
        bsLoader.setMaskColor(color);
    }

    public BufferedImage getImage(String s, boolean flag)
    {
        return bsLoader.getImage(s, flag);
    }

    public BufferedImage getImage(String s)
    {
        return bsLoader.getImage(s);
    }

    public BufferedImage[] getImages(String s, int i, int j, boolean flag)
    {
        return bsLoader.getImages(s, i, j, flag);
    }

    public BufferedImage[] getImages(String s, int i, int j)
    {
        return bsLoader.getImages(s, i, j);
    }

    public BufferedImage[] getImages(String s, int i, int j, boolean flag, String s1, int i1)
    {
        String s2 = s + s1 + i1;
        BufferedImage abufferedimage[];
        if((abufferedimage = bsLoader.getStoredImages(s2)) == null)
        {
            BufferedImage abufferedimage1[] = getImages(s, i, j, flag);
            int j1;
            abufferedimage = new BufferedImage[j1 = s1.length() / i1];
            for(int k1 = 0; k1 < j1; k1++)
                abufferedimage[k1] = abufferedimage1[Integer.parseInt(s1.substring(k1 * i1, (k1 + 1) * i1))];

            bsLoader.storeImages(s2, abufferedimage);
        }
        return abufferedimage;
    }

    public BufferedImage[] getImages(String s, int i, int j, String s1, int i1)
    {
        return getImages(s, i, j, true, s1, i1);
    }

    public BufferedImage[] getImages(String s, int i, int j, boolean flag, int i1, int j1)
    {
        String s1 = i1 + s + j1;
        BufferedImage abufferedimage[];
        if((abufferedimage = bsLoader.getStoredImages(s1)) == null)
        {
            BufferedImage abufferedimage1[] = getImages(s, i, j, flag);
            int k1;
            abufferedimage = new BufferedImage[k1 = (j1 - i1) + 1];
            for(int l1 = 0; l1 < k1; l1++)
                abufferedimage[l1] = abufferedimage1[i1 + l1];

            bsLoader.storeImages(s1, abufferedimage);
        }
        return abufferedimage;
    }

    public BufferedImage[] getImages(String s, int i, int j, int i1, int j1)
    {
        return getImages(s, i, j, true, i1, j1);
    }

    static Class a(String s)
    {
        return Class.forName(s);
        ClassNotFoundException classnotfoundexception;
        classnotfoundexception;
        throw new NoClassDefFoundError(classnotfoundexception.getMessage());
    }
}

⌨️ 快捷键说明

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