把我的Java游戏油滑到一个网站 [英] Putting my Java Slick game onto a website

查看:176
本文介绍了把我的Java游戏油滑到一个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用基于状态的游戏在Java中的图形用户界面,因为它扩展了 StateBasedGame ,而不是 JApplet的它不是一个真正的小程序,我希望把它放在网站上,是如何做到这一点,我已经被告知以下code可让我使用HTML,使这个成为一个小程序,并不必编辑Java $不确定C $ C:

I have made a GUI in Java using State Based Game, as it extends StateBasedGame and not JApplet its not a true applet, I want to put it on a website and am unsure on how to do this, I have been told that the following code allows me to make this into an applet using html and not having to edit the Java code:

<applet code="org.lwjgl.util.applet.AppletLoader" 
        archive="org.lwjgl.util.applet.AppletLoader" 
        codebase="." 
        width="640" height="480">

  <param name="al_title" value="Ham Blaster"> 
  <param name="al_main" value="org.newdawn.slick.AppletGameContainer"> 
  <param name="game" value="org.javagame.Game">

  <param name="al_jars" value="racegame.jar, lwjgl.jar, slick.jar"> 

  <param name="al_windows" value="windows_natives.jar"> 
  <param name="al_linux" value="linux_natives.jar"> 
  <param name="al_mac" value="macosx_natives.jar"> 

  <param name="separate_jvm" value="true"> 
</applet> 

当我运行HTML code我得到我的屏幕中心出现以下错误:

When I run the html code I get the following error on the centre of my screen:

An error occurred while loading the applet. Please contact support to resolve this issue. missing required applet parameter: al_main.

我已经看过里面光滑的 ApplerGameContainer ,但我只能找到chrome文件,我试图在同一目录把这些作为HTML文件,但我仍然得到同样的错误。

I have looked inside slick for the ApplerGameContainer but I can only find chrome files, I tried putting these in the same directory as the html file but I still get the same error.

如果有些事情似乎非常简单,似乎过于明显地问我,请告诉我,因为我是新来的Java,我用这个code previous错误是因为我没有我的HTML和lwjgl_util_applet。罐子在同一目录中,所以请告诉我的任何,可以帮助我。

If something seems very simple and may seem too obvious to ask me, please tell me because I am new to Java, my previous error with this code was because I did not have my html and lwjgl_util_applet.jar in the same directory, so please tell me anything that may help me.

推荐答案

电解金属锰...

我不是pretty确定,但根据<一个href=\"http://www.smartwerkz.com/svn/public/projects/LWJGL/lwjgl-2.2.1/src/java/org/lwjgl/util/applet/AppletLoader.java\"相对=nofollow>来源中的错误来自init方法

I am not pretty sure, but according to sources the error comes from init method

/*
     * @see java.applet.Applet#init()
     */
    public void init() {
        state = STATE_INIT;

        // sanity check
        String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"};
        for(int i=0; i<requiredArgs.length; i++) {
            if(getParameter(requiredArgs[i]) == null) {
                fatalErrorOccured("missing required applet parameter: " + requiredArgs[i], null);
                return;             
                }

//...           }       
        }

如此看来您的 al_main 参数值为 或东西:•

so it seems your al_main param value is null or something :S

问题也许是这里的某个地方。

The problem is maybe someplace here

<param name="al_main" value="org.newdawn.slick.AppletGameContainer"> 

... 也许的,因为我没有看到你给init其余全部需要PARAMS为al_logo,al_progressbar

... maybe because I don't see you to init all the rest required params as "al_logo", "al_progressbar"

不管怎么说,这将是更有帮助你展现问题code

Anyways, it would be more helpful you to show the problem code

如果它有助于报告

这篇关于把我的Java游戏油滑到一个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆