Quantcast
Viewing all articles
Browse latest Browse all 40524

Using OF Function in a Function

I see Image may be NSFW.
Clik here to view.
:smile:

in the ofApp.h

public:
float distance(int n,int valX, int valY);

in the ofApp.cpp

void ofApp::draw() {
    float dist = distance(1, 100, 200);
}

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

instead of (1, 100, 200) you need to put your variables of course.


Viewing all articles
Browse latest Browse all 40524

Trending Articles



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