Javascript 如果使用Socket.IO,是否可以为HTML编译LibGDX游戏?如果是,怎么做?
从一开始,它似乎在我的游戏中使用socket.io并让它运行,我需要做大量工作来包装Java的JS代码和其他目前不属于我专业领域的东西 我是否应该尝试学习并执行此建议的解决方案?它是否应该在默认情况下工作,而我只是做得不对?是否有一种替代Socket.IO的方法,我可以使用并实现它,而无需更改太多的代码库Javascript 如果使用Socket.IO,是否可以为HTML编译LibGDX游戏?如果是,怎么做?,javascript,java,gwt,socket.io,libgdx,Javascript,Java,Gwt,Socket.io,Libgdx,从一开始,它似乎在我的游戏中使用socket.io并让它运行,我需要做大量工作来包装Java的JS代码和其他目前不属于我专业领域的东西 我是否应该尝试学习并执行此建议的解决方案?它是否应该在默认情况下工作,而我只是做得不对?是否有一种替代Socket.IO的方法,我可以使用并实现它,而无需更改太多的代码库 如果需要更具体的问题,则在任务“draftCompileGwt”期间会发生以下错误: 将此代码添加到GdxDefinitionSuperdev.gwt时: <inherits name
如果需要更具体的问题,则在任务“draftCompileGwt”期间会发生以下错误: 将此代码添加到GdxDefinitionSuperdev.gwt时:
<inherits name='io.socket' />
具有堆栈跟踪的完整日志:
p.S.:为桌面编译时,正确地包括Socket.IO。它在my build.gradle的“核心”部分具有特色。我正在运行的服务器位于Node.JS中
p.p.S:如果我能看看如何使用Socket.IO将基本LibGDX应用程序(baglogic徽标)编译为HTML,我可以用它代替我的代码并让它工作:)
谢谢你的阅读 使用GWT,仅仅包含一个javascript库并从java代码中引用它是不够的——您需要为javascript API定义一个java包装器,以便可以从java代码中访问它 例如,有一个项目,其中有人在GWT中为socket.io创建了java包装器
一旦构建,应用程序需要由HTTP web服务器提供服务,例如apache或node.js模块
service
。然后,您可以将浏览器指向所服务的URL并在浏览器中运行它。使用GWT,仅包含javascript库并从java代码引用它是不够的——您需要为javascript API定义java包装器,以便可以从java代码访问它
例如,有一个项目,其中有人在GWT中为socket.io创建了java包装器
一旦构建,应用程序需要由HTTP web服务器提供服务,例如apache或node.js模块
service
。然后,您可以将浏览器指向所服务的URL并在浏览器中运行它。我尝试使用GWT Socket.IO,但在尝试运行本机方法时遇到了问题:java.lang.UnsatifiedLinkError。我如何告诉JNI查找JS代码?这个错误听起来像是在JVM(例如node.JS)中运行它。它必须在web浏览器中运行。我尝试使用GWT Socket.IO,但遇到了问题:java.lang.UnsatifiedLinkError,当尝试运行本机方法时。我如何告诉JNI查找JS代码?这个错误听起来像是在JVM(例如node.JS)中运行它。它必须在web浏览器中运行。
<inherits name='io.socket' />
> Task :html:draftCompileGwt
Compiling module com.lab.guy.GdxDefinitionSuperdev
[ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Touhou.java'
[ERROR] Line 53: No source code is available for type io.socket.client.Socket; did you forget to inherit a required module?
[ERROR] Line 177: No source code is available for type io.socket.client.IO; did you forget to inherit a required module?
[ERROR] Line 188: No source code is available for type org.json.JSONObject; did you forget to inherit a required module?
[ERROR] Line 204: No source code is available for type org.json.JSONException; did you forget to inherit a required module?
[ERROR] Line 212: No source code is available for type io.socket.emitter.Emitter.Listener; did you forget to inherit a required module?
[ERROR] Line 409: No source code is available for type org.json.JSONArray; did you forget to inherit a required module?
Tracing compile failure path for type 'com.lab.guy.Touhou'
[ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Touhou.java'
[ERROR] Line 188: No source code is available for type org.json.JSONObject; did you forget to inherit a required module?
[ERROR] Line 204: No source code is available for type org.json.JSONException; did you forget to inherit a required module?
[ERROR] Line 53: No source code is available for type io.socket.client.Socket; did you forget to inherit a required module?
[ERROR] Line 177: No source code is available for type io.socket.client.IO; did you forget to inherit a required module?
[ERROR] Line 212: No source code is available for type io.socket.emitter.Emitter.Listener; did you forget to inherit a required module?
[ERROR] Line 409: No source code is available for type org.json.JSONArray; did you forget to inherit a required module?
[ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Player.java'
[ERROR] com.lab.guy.Touhou cannot be resolved to a type