Small adjustment to some checks.
This commit is contained in:
parent
0d822ee7d7
commit
281687b1c5
10
src/engine.c
10
src/engine.c
|
@ -268,15 +268,13 @@ void engine_setMode()
|
||||||
engine.autoPause = autoPause;
|
engine.autoPause = autoPause;
|
||||||
|
|
||||||
screen = SDL_CreateRGBSurface(0, DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
|
screen = SDL_CreateRGBSurface(0, DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
|
||||||
|
if (screen == NULL)
|
||||||
if (!screen)
|
|
||||||
{
|
{
|
||||||
printf("Couldn't create %ix%ix32 surface: %s\n", DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, SDL_GetError());
|
printf("Couldn't create %ix%ix32 surface: %s\n", DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = SDL_CreateWindow("Project: Starfighter", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen->w, screen->h, 0);
|
window = SDL_CreateWindow("Project: Starfighter", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen->w, screen->h, 0);
|
||||||
|
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
{
|
{
|
||||||
printf("Could not create window: %s\n", SDL_GetError());
|
printf("Could not create window: %s\n", SDL_GetError());
|
||||||
|
@ -287,8 +285,7 @@ void engine_setMode()
|
||||||
SDL_SetWindowFullscreen(window, engine.fullScreen ? FULLSCREEN : 0);
|
SDL_SetWindowFullscreen(window, engine.fullScreen ? FULLSCREEN : 0);
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||||
|
if (renderer == NULL)
|
||||||
if (!renderer)
|
|
||||||
{
|
{
|
||||||
printf("Could not create renderer: %s\n", SDL_GetError());
|
printf("Could not create renderer: %s\n", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -297,8 +294,7 @@ void engine_setMode()
|
||||||
SDL_RenderSetLogicalSize(renderer, screen->w, screen->h);
|
SDL_RenderSetLogicalSize(renderer, screen->w, screen->h);
|
||||||
|
|
||||||
renderer_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen->w, screen->h);
|
renderer_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen->w, screen->h);
|
||||||
|
if (renderer_texture == NULL)
|
||||||
if (!renderer_texture)
|
|
||||||
{
|
{
|
||||||
printf("Couldn't create %ix%ix32 texture: %s\n", screen->w, screen->h, SDL_GetError());
|
printf("Couldn't create %ix%ix32 texture: %s\n", screen->w, screen->h, SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in New Issue