libsegl/rect.cpp

41 lines
569 B
C++
Raw Normal View History

#include "rect.h"
namespace segl {
Rect::Rect() {
set(0.0f, 0.0f, 0.0f, 0.0f);
}
Rect::Rect(float _x, float _y, float _w, float _h) {
set(_x, _y, _w, _h);
}
Rect::Rect(const SDL_Rect &r) {
set(r.x, r.y, r.w, r.h);
}
void Rect::set(float _x, float _y, float _w, float _h) {
x = _x;
y = _y;
w = _w;
h = _h;
}
void Rect::setPoint(float _x, float _y) {
x = _x;
y = _y;
}
void Rect::setDim(float _w, float _h) {
w = _w;
h = _h;
}
SDL_Rect Rect::getSDLRect() {
SDL_Rect tmp = {(Uint8)x, (Uint8)y, (Uint8)w, (Uint8)h};
return tmp;
}
} // namespace segl