Additional Windows not behaving like main Processing Window (when using G4P Library)
in
Contributed Library Questions
•
2 years ago
Hello,
When updating the centre coordinates of a eclipse through a variable, in a normal processing window a new eclipse is drawn. However when in the G4P additional window the original eclipse is moved. I want to emulate the normal processing window behaviour in the additional windows.
In the code below, in the main window as the "blob" is moved a "painted" effect is created, however in the additional window a shaking blob moves.
Any help would be greatly appreciated.
- import processing.opengl.*;
- import guicomponents.*;
- private GWindow[] window;
- int blobX = 0, blobY = 0;
- void setup() {
- size(600, 200, OPENGL);
- background(255);
- window = new GWindow[1];
- window[0] = new GWindow(this, "Window", 100, 100, 600,200,false, OPENGL);
- window[0].setBackground(255);
- window[0].addDrawHandler(this, "windowDraw");
- }
- void draw() {
- noStroke();
- fill(255,0,0);
- ellipse(blobX, blobY, random(20,40), random(20,40));
- fill(255,0,0, 180);
- ellipse(blobX, blobY, (random(20,40)+5), (random(20,40))+5);
- fill(255,0,0, 125);
- ellipse(blobX, blobY, (random(20,40)+10), (random(20,40))+10);
- }
- public void windowDraw(GWinApplet appc, GWinData windata) {
- appc.noStroke();
- appc.fill(255,0,0);
- appc.ellipse(blobX, blobY, random(40, 65),random(40, 65));
- appc.fill(255,0,0, 180);
- appc.ellipse(blobX, blobY, random(40, 65)+10,random(40, 65)+10);
- appc.fill(255,0,0, 125);
- appc.ellipse(blobX, blobY, random(40, 65)+20,random(40, 65)+20);
- }
- //Use the X and Y keys to move the blob
- public void keyPressed() {
- if (key == 'x')
- blobX = blobX +10;
- if (key == 'y')
- blobY = blobY + 10;
- }
1