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.

glrect.cpp 551B

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