Using PShape in PApplet extension class
in
Programming Questions
•
2 years ago
Hi,
I'm working on a special case, combining Arduino loaded with Firmata with processing.
I use two windows, one invoked from the normal Main script, and one from a public class called UIWindow. PShape works fine in the Main script, but in UIWindow it gets a nullpointerException.
Main script (simplified)
im not sure what i'm doing wrong here, but right now as far as code goes I feel like I'm solo-skydiving without training.
Anyone
I'm working on a special case, combining Arduino loaded with Firmata with processing.
I use two windows, one invoked from the normal Main script, and one from a public class called UIWindow. PShape works fine in the Main script, but in UIWindow it gets a nullpointerException.
Main script (simplified)
- PShape oogSVG;
- void setup() {
size(1280, 1024);
// Passing in this applet allows you to call functions in the parent
uiWindow = new UIWindow( this, 1440, 900 );
frame.setLocation(0,0);
oogSVG = loadShape ("oog1.svg");
smooth(); - void draw() {
// background(backgroundIMG);
background(200);
noFill();
shape(oogSVG, 0, 0); }
- public class UIWindow extends PApplet
{
Frame frame;
int width;
int height;
Arduino arduino;
PShape infoSVG;
Main parent;
UIWindow ( Main _parent, int w, int h )
{
parent = _parent;
arduino = parent.getArduinoClass();
width = w;
height = h;
frame = new Frame( );
frame.setBounds( 0, 0, width, height );
frame.removeNotify();
frame.setUndecorated(true);
frame.setLocation( 0, 0 );
frame.add( this);
this.init( );
frame.show( );
}
void setup( )
{
size( width, height, P2D );
frameRate( 10 );
infoSVG = loadShape ("kader1.svg");
}
void draw ( )
{
shape(infoSVG, 0, 0);
}
im not sure what i'm doing wrong here, but right now as far as code goes I feel like I'm solo-skydiving without training.
Anyone
1