run methods on a layer created by PGraphics
in
Programming Questions
•
3 years ago
Hi,
I'm trying to run a method in a different class "on" a layer created by PGraphics and createGraphics.
I have just started to use Class and cannot sort out by myself now, so could anyone give some help?
What I'm trying now is.....
------------------------------------------------------------------------------------------------------------------
myClass myInstance;
PGraphics topLayer;
void setup()
{
:
myInstance= new myClass();
topLayer= createGraphics(width,height,g.getClass(),getName());
}
void draw()
{
:
topLayer.beginDraw();
topLayer.myInstance.myMethod(); // <- this line is the problem...
topLayer.endDraw();
image( topLayer, 0, 0 );
}
------------------------------------------------------------------------------------------------------------------
I know it means I need "myInstance.myMethod()" under "topLayer". But PGraphics class is something I cannot reach easily.
Is there any way I can run "myInstance.myMethod()" on the "topLayer"?
Thanks in advance,
P.S.
I refered this topic:
2