Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Using OF Function in a Function

$
0
0

@on4now4 wrote:

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;
}

Posts: 16

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles