Add some functions to Rect

This commit is contained in:
Kirigaya Kazuto 2017-06-28 15:13:55 +08:00
parent 1b02c209fe
commit ad34163fbf
2 changed files with 47 additions and 0 deletions

View File

@ -141,6 +141,47 @@ int Renderer::drawLines(const std::vector<SDL_Point>& pointvec)
return drawLines(pointvec.data(),pointvec.size()); return drawLines(pointvec.data(),pointvec.size());
} }
int Renderer::fillRects(const std::vector<Rect>& rectvec)
{
std::vector<SDL_Rect> thisvec;
for(auto& rectref:rectvec)
{
thisvec.push_back(rectref.toSDLRect());
}
return fillRects(thisvec);
}
int Renderer::drawRects(const std::vector<Rect>& rectvec)
{
std::vector<SDL_Rect> thisvec;
for(auto& rectref:rectvec)
{
thisvec.push_back(rectref.toSDLRect());
}
return drawRects(thisvec);
}
int Renderer::drawPoints(const std::vector<Point>& pointvec)
{
std::vector<SDL_Point> thisvec;
for(auto& pointref:pointvec)
{
thisvec.push_back(pointref.toSDLPoint());
}
return drawPoints(thisvec);
}
int Renderer::drawLines(const std::vector<Point>& pointvec)
{
std::vector<SDL_Point> thisvec;
for(auto& pointref:pointvec)
{
thisvec.push_back(pointref.toSDLPoint());
}
return drawLines(thisvec);
}
int Renderer::setScale(float scaleX, float scaleY) int Renderer::setScale(float scaleX, float scaleY)
{ {
return SDL_RenderSetScale(_get(),scaleX,scaleY); return SDL_RenderSetScale(_get(),scaleX,scaleY);

View File

@ -56,6 +56,12 @@ public:
int drawPoints(const std::vector<SDL_Point>& pointvec); int drawPoints(const std::vector<SDL_Point>& pointvec);
int drawLines(const std::vector<SDL_Point>& pointvec); int drawLines(const std::vector<SDL_Point>& pointvec);
/// Slower Functions (Need Convert First, then call Experimental Functions.)
int fillRects(const std::vector<Rect>& rectvec);
int drawRects(const std::vector<Rect>& rectvec);
int drawPoints(const std::vector<Point>& pointvec);
int drawLines(const std::vector<Point>& pointvec);
int setScale(float scaleX,float scaleY); int setScale(float scaleX,float scaleY);
std::tuple<float,float> getScale() const; std::tuple<float,float> getScale() const;