Fix Bugs about Renderer

We have met a runtime error with SDL_IsClipEnabled. There is not
solution to it yet, so we just disable it.
Fix Bug in Window::_setRenderer_Real. smart pointer rnd is now reset
first. (We have known that smart pointers will only change its value
when it has the exact new value.)
This commit is contained in:
Kirigaya Kazuto 2017-04-10 21:48:06 +08:00
parent 6b53686383
commit da85418b60
2 changed files with 4 additions and 1 deletions

View File

@ -454,10 +454,12 @@ namespace MiniEngine
return Rect(rect); return Rect(rect);
} }
/*
bool Renderer::isClipEnabled() bool Renderer::isClipEnabled()
{ {
return SDL_RenderIsClipEnabled(rnd.lock().get())==SDL_TRUE; return SDL_RenderIsClipEnabled(rnd.lock().get())==SDL_TRUE;
} }
*/
void Renderer::disableClip() void Renderer::disableClip()
{ {
@ -607,6 +609,7 @@ namespace MiniEngine
void Window::_setRenderer_Real(Uint32 flags) void Window::_setRenderer_Real(Uint32 flags)
{ {
rnd.reset();
rnd.reset(SDL_CreateRenderer(wnd.get(), -1, flags), SDL_DestroyRenderer); rnd.reset(SDL_CreateRenderer(wnd.get(), -1, flags), SDL_DestroyRenderer);
winrnd.rnd=rnd; winrnd.rnd=rnd;
} }

View File

@ -172,7 +172,7 @@ namespace MiniEngine
int setClipRect(Rect cliprect); int setClipRect(Rect cliprect);
Rect getClipRect(); Rect getClipRect();
bool isClipEnabled(); //bool isClipEnabled();
void disableClip(); void disableClip();
bool isReady(); bool isReady();