Add Point/Rect constructors taking SDL_Point/SDL_Rect

This commit is contained in:
Dmitry Marakasov 2014-12-27 21:21:29 +03:00
parent 057804e814
commit a1d01e89d4
4 changed files with 28 additions and 0 deletions

View File

@ -30,6 +30,11 @@ Point::Point() {
y = 0;
}
Point::Point(const SDL_Point& point) {
x = point.x;
y = point.y;
}
Point::Point(int nx, int ny) {
x = nx;
y = ny;

View File

@ -54,6 +54,14 @@ public:
////////////////////////////////////////////////////////////
Point();
////////////////////////////////////////////////////////////
/// \brief Construct a point from existing SDL_Point
///
/// \param point Existing SDL_Point
///
////////////////////////////////////////////////////////////
Point(const SDL_Point& point);
////////////////////////////////////////////////////////////
/// \brief Construct the point from given coordinates
///

View File

@ -34,6 +34,13 @@ Rect::Rect() {
h = 0;
}
Rect::Rect(const SDL_Rect& rect) {
x = rect.x;
y = rect.y;
w = rect.w;
h = rect.h;
}
Rect::Rect(int nx, int ny, int nw, int nh) {
x = nx;
y = ny;

View File

@ -58,6 +58,14 @@ public:
////////////////////////////////////////////////////////////
Rect();
////////////////////////////////////////////////////////////
/// \brief Construct a rect from existing SDL_Rect
///
/// \param rect Existing SDL_Rect
///
////////////////////////////////////////////////////////////
Rect(const SDL_Rect& rect);
////////////////////////////////////////////////////////////
/// \brief Construct the rect from given corner coordinates, width and height
///