Project Creating PApplet from existing Applet
in
Programming Questions
•
6 months ago
My Professor has instructed we create processing projects using pre-existing Java 4k games(Applets)
original Applet
I thought this wouldn't be too difficult considering Processing PApplet extends applet. Maybe I'm grossly overlooking something, but this has proved to be very very difficult.
After trying to run the applet directly, I started with trying to draft all the objects into objects PApplet likes to work with.
I ran into some pitfalls concerning the way things were calculated. Sprites needed to be Shapes but had to be images too...
^I need a way to translate their sprites, and preform the same manipulations;
Realizing that what a disaster manually converting things was I thought of using PApplet as a wrapper.
my high hope was synchronizing the applet with a PApplet, allow applet to do display calculations and return a pixel array and the PApplet to send control input.
This method I hoped could be a way to convert any applet not just the one I was working on.
Here's where I came to realizing that I have no real idea how to sync and Applet with a PApplet. I have experience using locks and semaphores, but thats all in C/C++.
Here's my code so far:
Applet w exportable pixel array
each frame is tied up in an image, from there pixel data can be easily extracted.
- sg.drawImage(backBuffer, 0, 0, 768, 576, 0, 0, 256, 192, null);
- BufferedImage pDisplay = backBuffer.getSubimage(0,0,256,192);
my idea was to start the applets on different threads and have some communication between them.
- //I tried starting the applet like this in another PDE
- A myApplet = new A();
Compiler gave errors of mixing static and non-static
Then i thought maybe I had to join the applets
I think communication between threads can be established with pipes, how to implement that between a PApplet and an Applet is still to be determined. Anyone with experience with this would be a great help.
I'm really looking for any way possible to translate or run a Applet in a processing PApplet environment.
3