mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Add some functions to Rect
This commit is contained in:
parent
1b02c209fe
commit
ad34163fbf
|
@ -141,6 +141,47 @@ int Renderer::drawLines(const std::vector<SDL_Point>& pointvec)
|
|||
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)
|
||||
{
|
||||
return SDL_RenderSetScale(_get(),scaleX,scaleY);
|
||||
|
|
|
@ -56,6 +56,12 @@ public:
|
|||
int drawPoints(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);
|
||||
std::tuple<float,float> getScale() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user