Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Helper structure for rendering the queue contents. */
- class render_helper
- {
- public:
- friend class drawing_queue;
- /**
- * Constructor.
- *
- * @param priority Draw order for this element. Higher values will be drawn later.
- * @param texture The texture to render.
- * @param src_rect Source rect. If nullptr entire texture will be rendered.
- * @param dst_rect Destination rect. If nullptr texture will be stretched to fill the current
- * rendering target.
- * @param clp_rect Clipping rect. If nullptr no render clipping will be applied.
- */
- render_helper(const int priority,
- const texture& texture,
- const SDL_Rect* src_rect = nullptr,
- const SDL_Rect* dst_rect = nullptr,
- const SDL_Rect* clp_rect = nullptr)
- : priority_(priority)
- , textures_(1, texture)
- , src_rect_(src_rect)
- , dst_rect_(dst_rect)
- , clp_rect_(clp_rect)
- {
- }
- render_helper(const int priority,
- const std::vector<texture>& textures,
- const SDL_Rect* src_rect = nullptr,
- const SDL_Rect* dst_rect = nullptr,
- const SDL_Rect* clp_rect = nullptr)
- : priority_(priority)
- , textures_(textures)
- , src_rect_(src_rect)
- , dst_rect_(dst_rect)
- , clp_rect_(clp_rect)
- {
- }
- bool operator<(const render_helper& rhs) const
- {
- return priority_ < rhs.priority_;
- }
- private:
- const int priority_;
- std::vector<texture> textures_;
- SDL_Rect* src_rect_;
- SDL_Rect* dst_rect_;
- SDL_Rect* clp_rect_;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement