Geometries.cpp 479 B

12345678910111213141516171819202122
  1. #include "StdInc.h"
  2. #include "Geometries.h"
  3. #if 0
  4. extern SDL_Surface * screen;
  5. Rect Rect::createCentered( int w, int h )
  6. {
  7. return Rect(screen->w/2 - w/2, screen->h/2 - h/2, w, h);
  8. }
  9. Rect Rect::around(const Rect &r, int width /*= 1*/) /*creates rect around another */
  10. {
  11. return Rect(r.x - width, r.y - width, r.w + width * 2, r.h + width * 2);
  12. }
  13. Rect Rect::centerIn(const Rect &r)
  14. {
  15. return Rect(r.x + (r.w - w) / 2, r.y + (r.h - h) / 2, w, h);
  16. }
  17. #endif