From da85418b6035b980a853b2b149a2f743850bea0c Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Mon, 10 Apr 2017 21:48:06 +0800 Subject: [PATCH] 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.) --- MiniEngine.cpp | 3 +++ MiniEngine.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/MiniEngine.cpp b/MiniEngine.cpp index 6949751..7978cb1 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -454,10 +454,12 @@ namespace MiniEngine return Rect(rect); } + /* bool Renderer::isClipEnabled() { return SDL_RenderIsClipEnabled(rnd.lock().get())==SDL_TRUE; } + */ void Renderer::disableClip() { @@ -607,6 +609,7 @@ namespace MiniEngine void Window::_setRenderer_Real(Uint32 flags) { + rnd.reset(); rnd.reset(SDL_CreateRenderer(wnd.get(), -1, flags), SDL_DestroyRenderer); winrnd.rnd=rnd; } diff --git a/MiniEngine.h b/MiniEngine.h index f2b4b8c..9ace324 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -172,7 +172,7 @@ namespace MiniEngine int setClipRect(Rect cliprect); Rect getClipRect(); - bool isClipEnabled(); + //bool isClipEnabled(); void disableClip(); bool isReady();