parent problem (Papplet)
in
Programming Questions
•
2 years ago
since i have to use a java file for the comparator (or is that changed in processing 1.5) i have to send the PApplet aswell for the processing functions like pushMatrix and rotate.
So in my java file i have the necessary
import processing.core.*;
the constructor has:
PApplet parent;
// empty constructor
Employee(PApplet parent){
this.parent = parent;
}
this works now for example:
parent.pushMatrix();
Only i can't reach the primitives that are in the main sketch
void setPositions() {
// Cannot find anything named "rot"
parent.rotate(rot);
or:
void setPositions() {
// parent.rot cannot be resolved or is not a field
parent.rotate(parent.rot);
How can i fix this?
setting options with
void setPositions() { is not going to help i think, since it makes use of a recursion call where rot gets updated.
in example (really stripped code)
- void setPositions() {
- rot += rotStep;
- // Now handle the children, if any.
- for (Employee employee : children) {
- employee.setPositions();
- }
- }
p.s. if i use eclipse, do i also get those problems then?
2