From 84a3589697f55047eeae5e2d3e22bd33fb2f381d Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Fri, 21 Apr 2017 10:45:21 +0800 Subject: [PATCH] Add multiple drawing functions --- MiniEngine.cpp | 27 +++++++++++++++++++++++++++ MiniEngine.h | 7 +++++++ 2 files changed, 34 insertions(+) diff --git a/MiniEngine.cpp b/MiniEngine.cpp index 050dd8e..8f3a1c7 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -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(); diff --git a/MiniEngine.h b/MiniEngine.h index 1df9fe2..74437ca 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -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();