I’m trying to dynamically trying to generate a spacing value which depends on the window size and the number of elements in a vector.
This is what I’m doing:
spacing = ofGetWidth()/drawBuffer.size();
I have spacing declared as a float in my header file, but the results I keep getting is a int - how do I get the value of spacing as a float while dividing an int by an int?
that’s how division works in c/c++ divinding an int by an int will give an int which kind of makes sense the problem is that when assigning to a float you don’t get any warning or similar. the way you’ve done it is the proper solution, you can also only cast the divisor or assign it to a float variable first
Thanks! I’m still quite new to programming so I run into these issues that are rather trivial, I hope you guys on the forum don’t mind these basic questions!