From ad34163fbfa87ba713d64b5c3f7e349fd6d48214 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Wed, 28 Jun 2017 15:13:55 +0800 Subject: [PATCH] Add some functions to Rect --- SDLWrapper/Renderer.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ SDLWrapper/Renderer.h | 6 ++++++ 2 files changed, 47 insertions(+) diff --git a/SDLWrapper/Renderer.cpp b/SDLWrapper/Renderer.cpp index 3c2c9c9..89a25d7 100644 --- a/SDLWrapper/Renderer.cpp +++ b/SDLWrapper/Renderer.cpp @@ -141,6 +141,47 @@ int Renderer::drawLines(const std::vector& pointvec) return drawLines(pointvec.data(),pointvec.size()); } +int Renderer::fillRects(const std::vector& rectvec) +{ + std::vector thisvec; + for(auto& rectref:rectvec) + { + thisvec.push_back(rectref.toSDLRect()); + } + return fillRects(thisvec); +} + +int Renderer::drawRects(const std::vector& rectvec) +{ + std::vector thisvec; + for(auto& rectref:rectvec) + { + thisvec.push_back(rectref.toSDLRect()); + } + return drawRects(thisvec); +} + +int Renderer::drawPoints(const std::vector& pointvec) +{ + std::vector thisvec; + for(auto& pointref:pointvec) + { + thisvec.push_back(pointref.toSDLPoint()); + } + return drawPoints(thisvec); +} + +int Renderer::drawLines(const std::vector& pointvec) +{ + std::vector thisvec; + for(auto& pointref:pointvec) + { + thisvec.push_back(pointref.toSDLPoint()); + } + return drawLines(thisvec); +} + + int Renderer::setScale(float scaleX, float scaleY) { return SDL_RenderSetScale(_get(),scaleX,scaleY); diff --git a/SDLWrapper/Renderer.h b/SDLWrapper/Renderer.h index 93ac6ba..6faa64e 100644 --- a/SDLWrapper/Renderer.h +++ b/SDLWrapper/Renderer.h @@ -56,6 +56,12 @@ public: int drawPoints(const std::vector& pointvec); int drawLines(const std::vector& pointvec); + /// Slower Functions (Need Convert First, then call Experimental Functions.) + int fillRects(const std::vector& rectvec); + int drawRects(const std::vector& rectvec); + int drawPoints(const std::vector& pointvec); + int drawLines(const std::vector& pointvec); + int setScale(float scaleX,float scaleY); std::tuple getScale() const;