本文介绍了如何使用外部库和文件在网站上运行Processing Sketch?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我制作了一个使用Processing的游戏,并且使用了2个Java库(声音最小化和散列映射的java.util.map),以及游戏使用的许多外部图像和声音文件。我想把游戏放到我的网站上,以一种无需下载即可播放的方式。我一直无法找到一种方法,所以我想我会问这里。 解决方案


You 可以使用,但如果您的草图包含Java库,则不起作用。



:您不需要导入 java.util.HashMap 以在Processing草图中使用它。只需使用,这实际上可以与Processing.js一起使用。)



如果您使用Java库,那么您唯一的选择是作为应用程序进行部署,并让用户下载您的程序。

另一种选择是摆脱Java库并改用JavaScript库。您可以从Processing.js代码调用JavaScript代码。详情请参阅。



无耻的自我推销:我写了关于不同版本的Processing的指南,以及如何部署它们,可用。


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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 15:58