Advertisement
Vultraz

Untitled

Jul 2nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.55 KB | None | 0 0
  1.     /** Helper structure for rendering the queue contents. */
  2.     class render_helper
  3.     {
  4.     public:
  5.         friend class drawing_queue;
  6.  
  7.         /**
  8.          * Constructor.
  9.          *
  10.          * @param priority           Draw order for this element. Higher values will be drawn later.
  11.          * @param texture            The texture to render.
  12.          * @param src_rect           Source rect. If nullptr entire texture will be rendered.
  13.          * @param dst_rect           Destination rect. If nullptr texture will be stretched to fill the current
  14.          *                           rendering target.
  15.          * @param clp_rect           Clipping rect. If nullptr no render clipping will be applied.
  16.          */
  17.         render_helper(const int priority,
  18.                 const texture& texture,
  19.                 const SDL_Rect* src_rect = nullptr,
  20.                 const SDL_Rect* dst_rect = nullptr,
  21.                 const SDL_Rect* clp_rect = nullptr)
  22.             : priority_(priority)
  23.             , textures_(1, texture)
  24.             , src_rect_(src_rect)
  25.             , dst_rect_(dst_rect)
  26.             , clp_rect_(clp_rect)
  27.         {
  28.         }
  29.  
  30.         render_helper(const int priority,
  31.                 const std::vector<texture>& textures,
  32.                 const SDL_Rect* src_rect = nullptr,
  33.                 const SDL_Rect* dst_rect = nullptr,
  34.                 const SDL_Rect* clp_rect = nullptr)
  35.             : priority_(priority)
  36.             , textures_(textures)
  37.             , src_rect_(src_rect)
  38.             , dst_rect_(dst_rect)
  39.             , clp_rect_(clp_rect)
  40.         {
  41.         }
  42.  
  43.         bool operator<(const render_helper& rhs) const
  44.         {
  45.             return priority_ < rhs.priority_;
  46.         }
  47.  
  48.     private:
  49.         const int priority_;
  50.  
  51.         std::vector<texture> textures_;
  52.  
  53.         SDL_Rect* src_rect_;
  54.  
  55.         SDL_Rect* dst_rect_;
  56.  
  57.         SDL_Rect* clp_rect_;
  58.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement