Small OpenGL based c++ rendering library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rect.cpp 569B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "rect.h"
  2. namespace segl {
  3. Rect::Rect() {
  4. set(0.0f, 0.0f, 0.0f, 0.0f);
  5. }
  6. Rect::Rect(float _x, float _y, float _w, float _h) {
  7. set(_x, _y, _w, _h);
  8. }
  9. Rect::Rect(const SDL_Rect &r) {
  10. set(r.x, r.y, r.w, r.h);
  11. }
  12. void Rect::set(float _x, float _y, float _w, float _h) {
  13. x = _x;
  14. y = _y;
  15. w = _w;
  16. h = _h;
  17. }
  18. void Rect::setPoint(float _x, float _y) {
  19. x = _x;
  20. y = _y;
  21. }
  22. void Rect::setDim(float _w, float _h) {
  23. w = _w;
  24. h = _h;
  25. }
  26. SDL_Rect Rect::getSDLRect() {
  27. SDL_Rect tmp = {(Uint8)x, (Uint8)y, (Uint8)w, (Uint8)h};
  28. return tmp;
  29. }
  30. } // namespace segl