Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

g4p new window

$
0
0

Hello I am looking for the best way how to create a new window in processing. I search for many solution and I find using g4p. I tried a little code to find out how does it work but I don't know what I am doing wrong. Later I would like to make 2 windows. In one sliders on the other changing graphic. But for now it seems I cant handle the first window. in this code the cursor should change on rect but it just blinking or doing nothing.

import g4p_controls.*;
GWindow Screen;

void setup() {
  size(400, 320, P2D);
  Screen =  GWindow.getWindow(this, "Fullscreen", 100, 50, 480, 320, P2D);
}
void draw() {
  background(230);
  rectMode(CENTER);
  rect(100, 100, 100, 100);

  if (dist(100, 100, mouseX, mouseY) < 50) {
    cursor(HAND);
  } else {
    cursor(ARROW);
  }
  Screen.addDrawHandler(this, "windowDraw");
}
public void windowDraw(PApplet app, GWinData data) {
  app.background(255);
  app.strokeWeight(2);
  app.stroke(0);
  app.line(app.width / 2, app.height/2, app.mouseX, app.mouseY);
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles