mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Merge branch 'mingw-dev-renderer' into mingw-dev-event
Recently we have heard about great updates in their branch on Renderer. We merge it into our branch to make brush powerful.
This commit is contained in:
commit
0ca3a34d7a
|
@ -25,6 +25,14 @@ namespace MiniEngine
|
|||
h = H;
|
||||
}
|
||||
|
||||
Rect::Rect(SDL_Rect rect)
|
||||
{
|
||||
x=rect.x;
|
||||
y=rect.y;
|
||||
w=rect.w;
|
||||
h=rect.h;
|
||||
}
|
||||
|
||||
Rect::Rect()
|
||||
{
|
||||
x = y = w = h = 0;
|
||||
|
@ -272,6 +280,11 @@ namespace MiniEngine
|
|||
return SDL_RenderDrawPoint(rnd.lock().get(),p.x,p.y);
|
||||
}
|
||||
|
||||
int Renderer::drawLine(Point a,Point b)
|
||||
{
|
||||
return SDL_RenderDrawLine(rnd.lock().get(),a.x,a.y,b.x,b.y);
|
||||
}
|
||||
|
||||
int Renderer::clear()
|
||||
{
|
||||
return SDL_RenderClear(rnd.lock().get());
|
||||
|
@ -410,6 +423,47 @@ namespace MiniEngine
|
|||
return t;
|
||||
}
|
||||
|
||||
int Renderer::setViewport(Rect viewPort)
|
||||
{
|
||||
SDL_Rect rect=viewPort.toSDLRect();
|
||||
return SDL_RenderSetViewport(rnd.lock().get(),&rect);
|
||||
}
|
||||
|
||||
int Renderer::setViewport()
|
||||
{
|
||||
return SDL_RenderSetViewport(rnd.lock().get(),NULL);
|
||||
}
|
||||
|
||||
Rect Renderer::getViewport()
|
||||
{
|
||||
SDL_Rect rect;
|
||||
SDL_RenderGetViewport(rnd.lock().get(),&rect);
|
||||
return Rect(rect);
|
||||
}
|
||||
|
||||
int Renderer::setClipRect(Rect cliparea)
|
||||
{
|
||||
SDL_Rect rect=cliparea.toSDLRect();
|
||||
return SDL_RenderSetClipRect(rnd.lock().get(),&rect);
|
||||
}
|
||||
|
||||
Rect Renderer::getClipRect()
|
||||
{
|
||||
SDL_Rect rect;
|
||||
SDL_RenderGetClipRect(rnd.lock().get(),&rect);
|
||||
return Rect(rect);
|
||||
}
|
||||
|
||||
bool Renderer::isClipEnabled()
|
||||
{
|
||||
return SDL_RenderIsClipEnabled(rnd.lock().get())==SDL_TRUE;
|
||||
}
|
||||
|
||||
void Renderer::disableClip()
|
||||
{
|
||||
SDL_RenderSetClipRect(rnd.lock().get(),NULL);
|
||||
}
|
||||
|
||||
bool Renderer::isReady()
|
||||
{
|
||||
return !rnd.expired();
|
||||
|
|
11
MiniEngine.h
11
MiniEngine.h
|
@ -20,6 +20,7 @@ namespace MiniEngine
|
|||
public:
|
||||
int x, y, w, h;
|
||||
Rect(int X, int Y, int W, int H);
|
||||
Rect(SDL_Rect);
|
||||
Rect();
|
||||
SDL_Rect toSDLRect();
|
||||
};
|
||||
|
@ -147,6 +148,7 @@ namespace MiniEngine
|
|||
int fillRect(Rect rect);
|
||||
int drawRect(Rect rect);
|
||||
int drawPoint(Point p);
|
||||
int drawLine(Point a,Point b);
|
||||
|
||||
int clear();
|
||||
void update();
|
||||
|
@ -164,6 +166,15 @@ namespace MiniEngine
|
|||
Texture loadTexture(std::string FileName) throw(ErrorViewer);
|
||||
Texture createTexture(int Width, int Height) throw(ErrorViewer);
|
||||
|
||||
int setViewport(Rect viewport);
|
||||
int setViewport();
|
||||
Rect getViewport();
|
||||
|
||||
int setClipRect(Rect cliprect);
|
||||
Rect getClipRect();
|
||||
bool isClipEnabled();
|
||||
void disableClip();
|
||||
|
||||
bool isReady();
|
||||
private:
|
||||
std::weak_ptr<SDL_Renderer> rnd;
|
||||
|
|
Loading…
Reference in New Issue
Block a user