Quantcast
Viewing all articles
Browse latest Browse all 40524

Using OF Function in a Function

Hello,

I am trying to write a distance function that will compute the distance between a (x,y) coordinate and the mouse coordinates. But when I call mouseX or mouseY from within the function that I am writing I get the error "mouseX was not declared in the scope"

Is there any way to use a OF function from within a function?

Here is my code:

float distance(int n,int valX, int valY){
    float d;
    d = sqrt((valY-mouseY)*(valY-mouseY)+(valX-mouseX)(valX-mouseX));
    return d;
}

Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>