|
Author |
Topic: help - mouseX / width (Read 206 times) |
|
kevinP
|
help - mouseX / width
« on: Feb 16th, 2004, 2:31pm » |
|
Help, I'm stuck on something simple. I'm just trying to divide mouseX by the frame width to get a normalized value for mouseX... (but I only get 0.0). I must be doing something stupid I suspect. Code: float nx; void setup() { size(200, 200); framerate(5); } void loop() { nx = mouseX / width; println("mouseX=" + mouseX + " width=" + width + " nx=" + nx); } |
| Outputs: "mouseX=133 width=200 nx=0.0"
|
« Last Edit: Feb 16th, 2004, 2:32pm by kevinP » |
|
Kevin Pfeiffer
|
|
|
toxi_ Guest
|
Re: help - mouseX / width
« Reply #1 on: Feb 16th, 2004, 7:20pm » |
|
that's because you're dividing 2 integers. that should do the trick: Code:
|
|
|
|
|