| 1 | // SuperTux |
| 2 | // Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.com> |
| 3 | // |
| 4 | // This program is free software: you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation, either version 3 of the License, or |
| 7 | // (at your option) any later version. |
| 8 | // |
| 9 | // This program is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU General Public License |
| 15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
| 17 | #ifndef HEADER_SUPERTUX_VIDEO_SURFACE_BATCH_HPP |
| 18 | #define |
| 19 | |
| 20 | #include <vector> |
| 21 | |
| 22 | #include "video/paint_style.hpp" |
| 23 | #include "video/surface_ptr.hpp" |
| 24 | |
| 25 | class Rectf; |
| 26 | class Vector; |
| 27 | |
| 28 | class SurfaceBatch |
| 29 | { |
| 30 | public: |
| 31 | SurfaceBatch(const SurfacePtr& surface); |
| 32 | SurfaceBatch(SurfaceBatch&&) = default; |
| 33 | |
| 34 | void draw(const Vector& pos, float angle = 0.0f); |
| 35 | void draw(const Rectf& dstrect, float angle = 0.0f); |
| 36 | void draw(const Rectf& srcrect, const Rectf& dstrect, float angle = 0.0f); |
| 37 | |
| 38 | std::vector<Rectf> move_srcrects() { return std::move(m_srcrects); } |
| 39 | std::vector<Rectf> move_dstrects() { return std::move(m_dstrects); } |
| 40 | std::vector<float> move_angles() { return std::move(m_angles); } |
| 41 | |
| 42 | private: |
| 43 | SurfacePtr m_surface; |
| 44 | std::vector<Rectf> m_srcrects; |
| 45 | std::vector<Rectf> m_dstrects; |
| 46 | std::vector<float> m_angles; |
| 47 | |
| 48 | private: |
| 49 | SurfaceBatch(const SurfaceBatch&) = delete; |
| 50 | SurfaceBatch& operator=(const SurfaceBatch&) = delete; |
| 51 | }; |
| 52 | |
| 53 | #endif |
| 54 | |
| 55 | /* EOF */ |
| 56 | |