#include <SdlImageWindow.h>
Definition at line 22 of file SdlImageWindow.h.
◆ SdlImageWindow() [1/2]
SdlImageWindow::SdlImageWindow |
( |
const char * |
title | ) |
|
|
explicit |
◆ SdlImageWindow() [2/2]
SdlImageWindow::SdlImageWindow |
( |
const char * |
title, |
|
|
SDL_Surface * |
srf, |
|
|
int |
nx, |
|
|
int |
ny, |
|
|
float |
scale |
|
) |
| |
|
explicit |
Definition at line 16 of file SdlImageWindow.cpp.
void create_window(SDL_Surface *srf, int nx, int ny, float scale)
◆ create_window()
void SdlImageWindow::create_window |
( |
SDL_Surface * |
srf, |
|
|
int |
nx, |
|
|
int |
ny, |
|
|
float |
scale |
|
) |
| |
Definition at line 31 of file SdlImageWindow.cpp.
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;
◆ update_image()
void SdlImageWindow::update_image |
( |
| ) |
|
Definition at line 59 of file SdlImageWindow.cpp.
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);
◆ title
const char* SdlImageWindow::title |
The documentation for this class was generated from the following files: