Private Void Tick();不工作

时间:2015-08-01 09:09:55

标签: java function

该功能不知道如何解决这个问题。 如果它有助于我使用此tutorial

public void run() {
    long lastTime = System.nanoTime();
    double amountOfTicks = 60.0;
    double ns = 1000000000 / amountOfTicks;
    double delta = 0;
    long timer = System.currentTimeMillis();
    int frames = 0;
    while (running) {
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while (delta >= 1) {
            tick();
            delta--;
        }
        if (running) {
            render();
            frames++;

            if (System.currentTimeMillis() - timer > 1000) {
                timer += 1000;
                System.out.println("FPS: " + frames);
                frames = 0;
            }
        }
        stop();
    }

    private void tick(); {

    }

    private void render(); {
        BufferStrategy bs = this.getBufferStrategy();
        if (bs == null) {
            this.createBufferStrtegy(3);
            return;
        }

        Graphics g = bs.getDrawGraphics();



        g.dispose();
        bs.show();
    }

}

1 个答案:

答案 0 :(得分:0)

将tick()和render()方法移出run()方法,并从方法声明中删除分号。

<embed src="../files/ID 41279.pdf" width="1026px" height="1780" onerror="if (this.src != '../files/not-found.pdf') this.src = '../files/not-found.pdf';">