Created
October 13, 2011 17:23
-
-
Save timeu/1284859 to your computer and use it in GitHub Desktop.
Access Processing Code from GWT processing wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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