SDL_Rect* src = frameRects.at(currentFrame);
if (src == NULL)
Engine::getInstance().fail("Frame rect is null\n");
SDL_Rect dest;
dest.x = t.getPosition().x;
dest.y = t.getPosition().y;
dest.w = src->w;
dest.h = src->h;
if (textureSurface == NULL)
std::cout << "Original is null";
if (SDL_BlitSurface(textureSurface, src, subSurf, &dest) != 0)
Engine::getInstance().fail("Failed to blit\n");
SDL_Texture *subTex = SDL_CreateTextureFromSurface(renderer, textureSurface);
if (subTex == NULL)
Engine::getInstance().fail("Failed to create texture");
SDL_RenderCopy(renderer, subTex, NULL, &dest);
currentFrame = (currentFrame + 1) % frameRects.size();
I've checked that the src and dest rects are correct, but after the surfaceBlit function, the dest-rect has 0 width and height, and nothing is drawn to the screen. Has anyone else had this problem?