SDL_Surface* EntityViewData::getEntityImage() { if (this->openImage == NULL) { SDL_Surface* loadedImageTmp = IMG_Load(this->entityImage.c_str()); if (loadedImageTmp == NULL) { printf("Unable to load Entity Image. %s\n", SDL_GetError()); unlog.logErrorMessage( string("Unable to load Entity Image.") + string(SDL_GetError())); return NULL; } SDL_Surface* loadedImageRot = rotozoomSurfaceXY(loadedImageTmp, 0, this->scaleWidth, this->scaleHeight, 0); SDL_FreeSurface(loadedImageTmp); SDL_Surface* loadedImage = SDL_DisplayFormatAlpha(loadedImageRot); SDL_FreeSurface(loadedImageRot); this->openImage = loadedImage; } return this->openImage; }