почему то когда я загружаю изображение (sdl_loadbmp) оно загружается, но вместо него черный фон? как исправить?
код программы :
#include <iostream>
#include <SDL.h>
using namespace std;
const int width_screen = 640;
const int height_screen = 480;
SDL_Window* win = NULL;
SDL_Surface* scr = NULL;
SDL_Surface* helloworld = NULL;
bool init()
{
bool success = true;
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
cout << "Error in init program", SDL_GetError;
success = false;
}
else
{
win = SDL_CreateWindow("Hello world", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
width_screen, height_screen, SDL_WINDOW_SHOWN);
if (win == NULL)
{
cout << "Error in creating window", SDL_GetError;
success = false;
}
else
{
scr = SDL_GetWindowSurface(win);
if (scr == NULL)
{
cout << "Error in getting surface", SDL_GetError();
success = false;
}
}
}
return success;
}
bool load_media()
{
bool success = true;
helloworld = SDL_LoadBMP("C:/Users/mshun/Downloads/tmb_74342_5656.bmp");
if (helloworld == NULL)
{
cout << "Error in loading media", SDL_GetError();
success = false;
}
return success;
}
void close()
{
SDL_FreeSurface(helloworld);
helloworld = NULL;
SDL_DestroyWindow(win);
win = NULL;
SDL_Quit();
}
int main(int argc, char* args[])
{
if (!init())
{
cout << "Error in init... ", SDL_GetError();
}
else
{
if (!load_media())
{
cout << "Error in loading media... ", SDL_GetError();
}
else
{
SDL_UpdateWindowSurface(win);
SDL_Delay(200000);
}
}
close();
return 666;
}