|
libscratchcpp
A library for C++ based Scratch project players
|
#include <scratchcpp/rect.h>
Public Member Functions | |
| Rect (double left, double top, double right, double bottom) | |
| Rect () | |
| double | left () const |
| void | setLeft (double left) |
| double | top () const |
| void | setTop (double top) |
| double | right () const |
| void | setRight (double right) |
| double | bottom () const |
| void | setBottom (double bottom) |
| double | width () const |
| double | height () const |
| void | clamp (double left, double top, double right, double bottom) |
| void | snapToInt () |
| bool | intersects (const Rect &rect) const |
| bool | contains (double x, double y) const |
Static Public Member Functions | |
| static void | intersected (const Rect &a, const Rect &b, Rect &dst) |
| static void | united (const Rect &a, const Rect &b, Rect &dst) |
The Rect class represents a rectangle.
| Rect::Rect | ( | double | left, |
| double | top, | ||
| double | right, | ||
| double | bottom ) |
Constructs Rect.
| Rect::Rect | ( | ) |
| double Rect::bottom | ( | ) | const |
Returns the y-coordinate of the bottom edge.
| void Rect::clamp | ( | double | left, |
| double | top, | ||
| double | right, | ||
| double | bottom ) |
Clamps the rectangle to the given bounds.
| bool Rect::contains | ( | double | x, |
| double | y ) const |
Returns true if the given point is inside or on the edge of the rectangle.
| double Rect::height | ( | ) | const |
Returns the height of the rectangle.
Saves the intersection of the given rectangles (in Scratch space) to dst.
| bool Rect::intersects | ( | const Rect & | rect | ) | const |
Returns true if the rectangle intersects the given rectangle.
| double Rect::left | ( | ) | const |
Returns the x-coordinate of the left edge.
| double Rect::right | ( | ) | const |
Returns the x-coordinate of the right edge.
| void Rect::setBottom | ( | double | bottom | ) |
Sets the y-coordinate of the bottom edge.
| void Rect::setLeft | ( | double | left | ) |
Sets the x-coordinate of the left edge.
| void Rect::setRight | ( | double | right | ) |
Sets the x-coordinate of the right edge.
| void Rect::setTop | ( | double | top | ) |
Sets the y-coordinate of the top edge.
| void Rect::snapToInt | ( | ) |
Push out the rectangle to integer bounds.
| double Rect::top | ( | ) | const |
Returns the y-coordinate of the top edge.
Saves the union of the given rectangles (in Scratch space) to dst.
| double Rect::width | ( | ) | const |
Returns the width of the rectangle.