Don't compare pointer against '0', but NULL

This commit is contained in:
Sylvain 2022-11-16 21:47:43 +01:00
parent 1d7966df15
commit ce5da5d579
No known key found for this signature in database
GPG key ID: 5F87E02E5BC0939E
14 changed files with 21 additions and 21 deletions

View file

@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer)
/* create ship texture from surface */
ship = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (ship == 0) {
if (!ship) {
fatalError("could not create ship texture");
}
SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
@ -145,7 +145,7 @@ initializeTextures(SDL_Renderer *renderer)
}
/* create space texture from surface */
space = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (space == 0) {
if (!space) {
fatalError("could not create space texture");
}
SDL_FreeSurface(bmp_surface);

View file

@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer)
/* convert RGBA surface to texture */
texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (texture == 0) {
if (!texture) {
fatalError("could not create texture");
}
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);

View file

@ -183,7 +183,7 @@ loadFont(void)
SDL_BlitSurface(surface, NULL, converted, NULL);
/* create our texture */
texture = SDL_CreateTextureFromSurface(renderer, converted);
if (texture == 0) {
if (!texture) {
printf("texture creation failed: %s\n", SDL_GetError());
} else {
/* set blend mode for our texture */

View file

@ -58,7 +58,7 @@ main(int argc, char *argv[])
/* create window and renderer */
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
if (window == 0) {
if (!window) {
fatalError("Could not initialize Window");
}
renderer = SDL_CreateRenderer(window, -1, 0);

View file

@ -63,7 +63,7 @@ initializeTexture(SDL_Renderer *renderer)
brush =
SDL_CreateTextureFromSurface(renderer, bmp_surface);
SDL_FreeSurface(bmp_surface);
if (brush == 0) {
if (!brush) {
fatalError("could not create brush texture");
}
/* additive blending -- laying strokes on top of eachother makes them brighter */