New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cursor() fails to work as expected with P2D/P3D (Processing 3.0) #3955

Closed
quarks opened this Issue Oct 3, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@quarks

quarks commented Oct 3, 2015

The code below demonstrates the problem I am experiencing. If you use the + and - keys to loop through the cursors it eventually freezes when it tries to use a previously used cursor.

Change the surface to JAVA2D and it works fine.

int[] cn = {ARROW, CROSS, HAND, MOVE, TEXT, WAIT};
String[] name = {"ARROW", "CROSS", "HAND", "MOVE", "TEXT", "WAIT"};
int idx = 0;

public void setup() {
  size(400, 400, P2D);
  cursor(cn[idx]);
}

public void draw() {
  background(255);
  stroke(255, 0, 0);
  line(0, mouseY, width, mouseY);
  line(mouseX, 0, mouseX, height);
  fill(0);
  text(mouseX + "  " + mouseY, 20, 20);
  text(name[idx] + " = " + cn[idx] + " ", 20, 40);
}

public void keyPressed() {
  if (key == '-')
    idx += cn.length - 1;
  if (key == '+')
    idx++;
  idx %= cn.length;
  cursor(cn[idx]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment