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

displayDensity() not functioning properly? #3436

Closed
shiffman opened this Issue Jun 26, 2015 · 6 comments

Comments

Projects
None yet
2 participants
@shiffman
Member

shiffman commented Jun 26, 2015

This works for me:

void setup() {
  size(100, 100);
  println(displayDensity());
}

However, this fails:

void setup() {
  size(100, 100);
  pixelDensity(displayDensity());
}

IllegalStateException: pixelDensity() cannot be used here

And the following

void setup() {
  size(100, 100);
  int d = displayDensity();
  pixelDensity(d);
}

d cannot be resolved to a variable

@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Jun 26, 2015

Member

Update, moving everything to settings() works fine.

void settings() {
  size(600, 600);
  pixelDensity(displayDensity());  
}

void setup() {
  // etc.
}
Member

shiffman commented Jun 26, 2015

Update, moving everything to settings() works fine.

void settings() {
  size(600, 600);
  pixelDensity(displayDensity());  
}

void setup() {
  // etc.
}
@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jun 26, 2015

Member

Hm, that's not good. I'll take a look.

Member

benfry commented Jun 26, 2015

Hm, that's not good. I'll take a look.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jun 26, 2015

Member

Now fixed, though we'll probably need to add the "no variables" caveat to the reference. There isn't a good way to make this work:

void setup() {
  size(100, 100);
  int d = displayDensity();
  pixelDensity(d);
}
Member

benfry commented Jun 26, 2015

Now fixed, though we'll probably need to add the "no variables" caveat to the reference. There isn't a good way to make this work:

void setup() {
  size(100, 100);
  int d = displayDensity();
  pixelDensity(d);
}
@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Jun 26, 2015

Member

That's actually from the reference, will open a processing-docs issue

Member

shiffman commented Jun 26, 2015

That's actually from the reference, will open a processing-docs issue

@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Jun 26, 2015

Member

Does this mean you can't say

pixelDensity(displayDensity());

either? But it's ok if you go ahead and use settings()?

Member

shiffman commented Jun 26, 2015

Does this mean you can't say

pixelDensity(displayDensity());

either? But it's ok if you go ahead and use settings()?

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jun 26, 2015

Member

Added notes to the docs item.

Member

benfry commented Jun 26, 2015

Added notes to the docs item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment