I try to pass my sketch name like a final but i don’t find a way to do that, is it possible ?
sketch name in my case is call_class_itself.pdebut I try to find something more universel.
void setup() {
println(this.getClass().getSimpleName());
}
import rope.costume.R_Shape;
public class Test extends rope.costume.R_Shape {
final call_class_itself me;
// here the purpose to mke something universel
// final this.getClass().getSimpleName() me;
Test(PApplet pa) {
super(pa);
me = (call_class_itself) pa;
}
void truc(PApplet pa) {
me.beginShape(other);
}
}
void beginShape(PGraphics other) {
}
Therefore, field me doesn’t need to be of derived datatype call_class_itself in order to access the beginShape() member.
A me field of parent datatype PApplet would be just enough.
Java demands that all datatypes of its variables & functions to be already known at compile time, before the program is even run.
What you’re attempting to do above is to dynamically declare a field named me w/ some datatype that’s still gonna be determined in the future at run time, when the program’s already been compiled & running.
Maybe I’m not clear, I write my custom Processing method like beginShape(Pgraphics pg) and when I try to call this one from a class write outside Processing, my sketch don’t find it and return an error, it’s reason why i need to call those methodes from the sketch, and if I want something universal I cannot write the sketch name directly, I need to something to finf the sketchname before… its clearest ?
You point the problem this one is from rope.costume.R_Shape the library. So it’s a reason why my little class don’t want read the method beginShape(PGraphics other)
thx but, I know that it’s the first line of my code println(this.getClass().getSimpleName());my problem is transforme that in final this.getClass().getSimpleName() me; and that’s cannot be a String.
I written outside to mean the class parent is in a library. And in this case the class child cannot read the similar method write in the sketch like beginShape(PGraphics other).
And 3 minimum compilable “.java” files based (as much as I could) on your 3 original classes R_Shape, R_Image & BigBang from your library, following up all their inheritance chain:
R_Shape.java:
package rope.costume;
import rope.core.*;
import processing.core.*;
public class R_Shape extends R_Image {
public R_Shape(PApplet pa) {
super(pa);
}
public R_Shape(PApplet pa, PGraphics other) {
super(pa, other);
}
}
R_Image.java:
package rope.core;
import processing.core.*;
public class R_Image extends BigBang {
protected processing.core.PGraphics other;
public R_Image(PApplet pa) {
super(pa);
}
public R_Image(PApplet pa, PGraphics other) {
super(pa);
this.other = other;
}
}
BigBang.java:
package rope.core;
import processing.core.*;
public abstract class BigBang {
public PApplet pa;
public BigBang() {
}
public BigBang(PApplet pa) {
this.pa = pa;
}
}
Unless you could come up w/ some actually runnable code like mine above, that proves your compilable error does happen, I can’t help you anymore, sorry.