You 可以使用,但如果您的草图包含Java库,则不起作用。
:您不需要导入 java.util.HashMap
以在Processing草图中使用它。只需使用,这实际上可以与Processing.js一起使用。)
如果您使用Java库,那么您唯一的选择是作为应用程序进行部署,并让用户下载您的程序。
另一种选择是摆脱Java库并改用JavaScript库。您可以从Processing.js代码调用JavaScript代码。详情请参阅。
So I have made a game using Processing and have used 2 java libraries (minim for sound and java.util.map for a hashmap), as well as having many external image and sound files which the game uses. I want to put the game on my website, in a way that you can play it without downloading it. I have not been able to find a way of ding this so I thought I'd ask here.
Short answer: you can't.
You can deploy basic Processing sketches using Processing.js, but that won't work if your sketch contains Java libraries.
(Side note: you don't need to import java.util.HashMap
to use it in a Processing sketch. Just use HashMap
directly. That would actually work with Processing.js.)
If you use Java libraries, then your only option is to deploy as an application and have users download your program.
The other option is to get rid of the Java libraries and use JavaScript libraries instead. You can call JavaScript code from Processing.js code. See here for more info.
Shameless self-promotion: I wrote a guide on the different versions of Processing and how you can deploy them, available here.
这篇关于如何使用外部库和文件在网站上运行Processing Sketch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!