To/fromBounds(Rectangle)


#1

A very useful method now that lots of method use Rectangle:

inline Rectangle<int> toBounds(const Rectangle<float> & rect) { return Rectangle<int>(roundFloatToInt(rect.getX()), roundFloatToInt(rect.getY()), roundFloatToInt(rect.getWidth()), roundFloatToInt(rect.getHeight())); }
inline Rectangle<float> fromBounds(const Rectangle<int> & rect) { return Rectangle<float>(static_cast<float>(rect.getX()), static_cast<float>(rect.getY()), static_cast<float>(rect.getWidth()), static_cast<float>(rect.getHeight())); }

Avoid many conversion work when doing bounds-related graphic work.


#2

Ok, so for those searching before asking:
There’s now a toFloat() method, and a getSmallestIntegerContainer() method in all Rectangle class.