Add multiple drawing functions

This commit is contained in:
Kirigaya Kazuto 2017-04-21 10:45:21 +08:00
parent 72b58f6b8b
commit 84a3589697
2 changed files with 34 additions and 0 deletions

View File

@ -593,22 +593,42 @@ namespace MiniEngine
return SDL_RenderFillRect(_get(), &inr);
}
int Renderer::fillRects_Raw(const SDL_Rect* pRects,int n)
{
return SDL_RenderFillRects(_get(),pRects,n);
}
int Renderer::drawRect(Rect rect)
{
auto inr = rect.toSDLRect();
return SDL_RenderDrawRect(_get(), &inr);
}
int Renderer::drawRects_Raw(const SDL_Rect* pRects,int n)
{
return SDL_RenderDrawRects(_get(),pRects,n);
}
int Renderer::drawPoint(Point p)
{
return SDL_RenderDrawPoint(_get(),p.x,p.y);
}
int Renderer::drawPoints_Raw(const SDL_Point* pPoints,int n)
{
return SDL_RenderDrawPoints(_get(),pPoints,n);
}
int Renderer::drawLine(Point a,Point b)
{
return SDL_RenderDrawLine(_get(),a.x,a.y,b.x,b.y);
}
int Renderer::drawLines_Raw(const SDL_Point* pPoints,int n)
{
return SDL_RenderDrawLines(_get(),pPoints,n);
}
int Renderer::clear()
{
return SDL_RenderClear(_get());
@ -800,6 +820,13 @@ namespace MiniEngine
return Rect(rect);
}
Rect Renderer::getOutputSize()
{
int w,h;
SDL_GetRendererOutputSize(_get(),&w,&h);
return Rect(0,0,w,h);
}
int Renderer::setClipRect(Rect cliparea)
{
SDL_Rect rect=cliparea.toSDLRect();

View File

@ -211,6 +211,11 @@ namespace MiniEngine
int drawPoint(Point p);
int drawLine(Point a,Point b);
int fillRects_Raw(const SDL_Rect* pRects,int n);
int drawRects_Raw(const SDL_Rect* pRects,int n);
int drawPoints_Raw(const SDL_Point* pPoints,int n);
int drawLines_Raw(const SDL_Point* pPoints,int n);
int clear();
void update();
@ -233,6 +238,8 @@ namespace MiniEngine
int setViewport();
Rect getViewport();
Rect getOutputSize();
int setClipRect(Rect cliprect);
Rect getClipRect();
//bool isClipEnabled();