From 11b1125d298427da448e674b575f7ff794f7bc84 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Thu, 2 Mar 2017 13:12:13 +0800 Subject: [PATCH] Update MiniEngine.cpp --- MiniEngine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MiniEngine.cpp b/MiniEngine.cpp index aef7cf2..e53ab6a 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -117,6 +117,11 @@ namespace MiniEngine return str.c_str(); } + Texture::Texture() + { + updateInfo(); + } + Rect Texture::getSize() { return rect; @@ -195,6 +200,10 @@ namespace MiniEngine void Texture::updateInfo() { + if(text.get()==nullptr) + { + rect.x=rect.y=rect.w=rect.h=0; + } SDL_QueryTexture(text.get(), NULL, NULL, &rect.w, &rect.h); rect.x = rect.y = 0; }