sdl load image Unknown pixel format
SDL_Surface *image = SDL_LoadBMP(path);
SDL_Texture *texture;
texture = SDL_CreateTextureFromSurface(renderer, image);
if (!texture)
{
return false;
}
SDL_FreeSurface(image);
SDL_Rect rect = {pos.x, pos.y, size.width, size.height};
if (SDL_QueryTexture(texture, NULL, NULL, &rect.w, &rect.h))
{
return false;
}
if (SDL_RenderCopy(renderer, texture, NULL, &rect))
{
return false;
}
SDL_DestroyTexture(texture);