Skip to content

Instantly share code, notes, and snippets.

@timeu
Created October 13, 2011 17:23
Show Gist options
  • Save timeu/1284859 to your computer and use it in GitHub Desktop.
Save timeu/1284859 to your computer and use it in GitHub Desktop.
Access Processing Code from GWT processing wrapper
DataStore data = null;
void setup()
{
data = new DataStore();
}
void draw()
{
//render code
}
class DataStore {
String data;
void setData(String data) {
this.data = data;
}
}
// API for access via javascript/GWT
void api_setProcessingData(String data) {
data.setData(data);
}
void api_setSize(int width, int height) {
size(width,height);
}
public class MyCustomInstance extends ProcessingInstance{
protected MyCustomInstance() {}
public final native void setProcessingData(String value) /*-{
this.api_setProcessingData(value);
}-*/;
public final native void setSize(int width, int height) /*-{
this.api_setSize(width,height);
}-*/;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment