26 this->renderer = NULL;
34 window = SDL_CreateWindow(
title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, scale * nx, scale * ny, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL);
37 std::cout <<
"Window could not be created! SDL Error: " << SDL_GetError() << std::endl;
40 renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
43 std::cout <<
"Renderer could not be created! SDL Error: " << SDL_GetError() << std::endl;
46 tex = SDL_CreateTexture(renderer, SDL_GetWindowPixelFormat(window), SDL_TEXTUREACCESS_STATIC, nx, ny);
49 std::cout <<
"Texture could not be created! SDL Error: " << SDL_GetError() << std::endl;
52 if (SDL_RenderSetLogicalSize(renderer, scale * nx, scale * ny) < 0)
54 std::cout <<
"Logical size could not be set! SDL Error: " << SDL_GetError() << std::endl;
63 if (SDL_UpdateTexture(tex, NULL, srf->pixels, srf->pitch) == -1)
65 std::cout <<
"SDL_UpdateTexture failed: " << SDL_GetError() << std::endl;
67 if (SDL_RenderCopy(renderer, tex, NULL, NULL) == -1)
69 std::cout <<
"SDL_RenderCopy failed: " << SDL_GetError() << std::endl;
71 SDL_RenderPresent(renderer);
void create_window(SDL_Surface *srf, int nx, int ny, float scale)
SdlImageWindow(const char *title)