Update MiniEngine.cpp

This commit is contained in:
Kirigaya Kazuto 2017-03-02 13:12:13 +08:00 committed by GitHub
parent 409c126a78
commit 11b1125d29

View File

@ -117,6 +117,11 @@ namespace MiniEngine
return str.c_str(); return str.c_str();
} }
Texture::Texture()
{
updateInfo();
}
Rect Texture::getSize() Rect Texture::getSize()
{ {
return rect; return rect;
@ -195,6 +200,10 @@ namespace MiniEngine
void Texture::updateInfo() 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); SDL_QueryTexture(text.get(), NULL, NULL, &rect.w, &rect.h);
rect.x = rect.y = 0; rect.x = rect.y = 0;
} }