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

📄 gameengine.java

📁 一个java的免费游戏引擎,里面有文档,和例子
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 

package com.golden.gamedev;

import com.golden.gamedev.engine.BaseAudio;
import com.golden.gamedev.engine.BaseGraphics;
import com.golden.gamedev.engine.BaseInput;
import com.golden.gamedev.engine.BaseTimer;
import java.awt.Graphics2D;
import java.io.PrintStream;

// Referenced classes of package com.golden.gamedev:
//            Game, GameObject

public abstract class GameEngine extends Game
{

    private GameObject a;
    private int b;
    public GameObject nextGame;
    public int nextGameID;

    public GameEngine()
    {
    }

    void startGameLoop()
    {
        bsTimer.startTimer();
        for(; isRunning(); a.start())
        {
            bsInput.refresh();
            refresh();
            if(nextGame == null && nextGameID == -1)
            {
                finish();
                break;
            }
            a = nextGame;
            b = -1;
            if(a == null)
            {
                b = nextGameID;
                a = getGame(nextGameID);
            }
            if(a == null)
            {
                finish();
                System.err.println("ERROR: GameObject with ID = " + b + " is not available!!");
                break;
            }
            if(nextGame == a)
                nextGame = null;
            if(nextGameID == b)
                nextGameID = -1;
        }

        bsTimer.stopTimer();
        bsSound.stopAll();
        bsMusic.stopAll();
        if(isFinish())
        {
            bsGraphics.cleanup();
            notifyExit();
        }
    }

    public void initResources()
    {
    }

    public void update(long l)
    {
    }

    public void render(Graphics2D graphics2d)
    {
    }

    public void refresh()
    {
    }

    public abstract GameObject getGame(int i);

    public GameObject getCurrentGame()
    {
        return a;
    }

    public int getCurrentGameID()
    {
        return b;
    }
}

⌨️ 快捷键说明

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