Advertisement
Vultraz

Untitled

Sep 9th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1.     const unsigned x = x_(variables);
  2.     const unsigned y = y_(variables);
  3.     const unsigned w = w_(variables);
  4.     const unsigned h = h_(variables);
  5.  
  6.     DBG_GUI_D << "Rectangle: draw from " << x << ',' << y << " width " << w
  7.               << " height " << h << " canvas size " << canvas->w << ','
  8.               << canvas->h << ".\n";
  9.  
  10.     VALIDATE(static_cast<int>(x) < canvas->w
  11.              && static_cast<int>(x + w) <= canvas->w
  12.              && static_cast<int>(y) < canvas->h
  13.              && static_cast<int>(y + h) <= canvas->h,
  14.              _("Rectangle doesn't fit on canvas."));
  15.  
  16.  
  17.     surface_lock locker(canvas);
  18.  
  19.     // draw the border
  20.     for(unsigned i = 0; i < border_thickness_; ++i) {
  21.         SDL_Rect dimensions {
  22.             x + i,
  23.             y + i,
  24.             w - (i * 2),
  25.             h - (i * 2)
  26.         };
  27.  
  28.         set_renderer_color(renderer, border_color_);
  29.  
  30.         SDL_RenderDrawRect(renderer, &dimensions);
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement