Extending from PShape to create custom objects ?
in
Programming Questions
•
23 days ago
Hi everybody,
I am currently working on a big Java project, based on Processing (to facilitate graphics management, essentially). Here is the idea : we would have multiple scenes, that can render a lot of objects. I would like to have my own objects (ie "Rectangle", "Ellipse"), that I would simply add to my scene in order to render it (by calling a draw() method, for example).
Here is the question : is it possible to simply extend PShape class, and manage my shape in my own class ? For example, something like that :
I am currently working on a big Java project, based on Processing (to facilitate graphics management, essentially). Here is the idea : we would have multiple scenes, that can render a lot of objects. I would like to have my own objects (ie "Rectangle", "Ellipse"), that I would simply add to my scene in order to render it (by calling a draw() method, for example).
Here is the question : is it possible to simply extend PShape class, and manage my shape in my own class ? For example, something like that :
- class Rectangle extends PShape {
- public void draw() {
- beginShape();
- // Some stuff
- endShape();
- }
- }
Is it possible ? Do you have an idea on how to implement this kind of stuff ?
Thanks
1