简体   繁体   English

处理(语言)为Javascript,如何同时用.java文件加载多个.pde源文件?

[英]Processing (the Language) to Javascript, how to load multiple .pde source files with a .java file as well?

<canvas id=”geometry” data-processing-sources=”ClassFile1.pde ClassFile2.pde main.pde” width=”800″ height=”800″ />

Using the above method doesn't work, but it works if the source is only within one .pde and doesn't include a .java file. 使用上面的方法不起作用,但是如果源仅在一个.pde中且不包含.java文件,则该方法有效。

Is there anyway to use 4 .pde files and 1 .java file for a Javascript "app"? 无论如何,对于Javascript“ app”,要使用4个.pde文件和1个.java文件吗?

http://processingjs.org/ http://processing.org/ http://processingjs.org/ http://processing.org/

It's not the "using multiple files" part. 不是“使用多个文件”部分。 Processing.js can do that just fine. Processing.js可以做到这一点。 The problem is that You can't just include .java files and expect it to work. 问题是您不能只包含.java文件并期望它能工作。 Processing.js runs Processing source code by translating it to native JS and running that on the page. Processing.js通过将Processing的源代码翻译成本地JS并在页面上运行来运行Processing的源代码。 If you use any plain Java, you're no longer using Processing, you're using Java, and all bets are off. 如果您使用任何普通的Java,则不再使用处理,而是使用Java,并且所有选择都关闭了。 Rewrite your .java to real Processing code (usually fairly easy) and turn it into a .pde file, and things should work. 将您的.java重写为真实的Processing代码(通常相当简单),然后将其转换为.pde文件,一切正常。

If your code runs in the PDE with just main.pde, ClassFile1.pde, and ClassFile2.pde, and you don't escape to plain Java in your source to do things that you can also do in Processing, then it'll run using Processing.js 如果您的代码仅在main.pde,ClassFile1.pde和ClassFile2.pde的PDE中运行,并且您没有逃避源代码中纯Java的操作,而您也可以在Processing中进行操作,那么它将运行使用Processing.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM