examples now using SDL_ALPHA_OPAQUE(_FLOAT) for opaque alpha value

This commit is contained in:
Michael Palomas 2024-10-23 13:44:28 +02:00 committed by Sam Lantinga
parent 63ef5a2369
commit 21c91d5535
19 changed files with 38 additions and 38 deletions

View file

@ -55,22 +55,22 @@ SDL_AppResult SDL_AppIterate(void *appstate)
SDL_FRect rect;
/* as you can see from this, rendering draws over whatever was drawn before it. */
SDL_SetRenderDrawColor(renderer, 33, 33, 33, 255); /* dark gray, full alpha */
SDL_SetRenderDrawColor(renderer, 33, 33, 33, SDL_ALPHA_OPAQUE); /* dark gray, full alpha */
SDL_RenderClear(renderer); /* start with a blank canvas. */
/* draw a filled rectangle in the middle of the canvas. */
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255); /* blue, full alpha */
SDL_SetRenderDrawColor(renderer, 0, 0, 255, SDL_ALPHA_OPAQUE); /* blue, full alpha */
rect.x = rect.y = 100;
rect.w = 440;
rect.h = 280;
SDL_RenderFillRect(renderer, &rect);
/* draw some points across the canvas. */
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); /* red, full alpha */
SDL_SetRenderDrawColor(renderer, 255, 0, 0, SDL_ALPHA_OPAQUE); /* red, full alpha */
SDL_RenderPoints(renderer, points, SDL_arraysize(points));
/* draw a unfilled rectangle in-set a little bit. */
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); /* green, full alpha */
SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); /* green, full alpha */
rect.x += 30;
rect.y += 30;
rect.w -= 60;
@ -78,7 +78,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
SDL_RenderRect(renderer, &rect);
/* draw two lines in an X across the whole canvas. */
SDL_SetRenderDrawColor(renderer, 255, 255, 0, 255); /* yellow, full alpha */
SDL_SetRenderDrawColor(renderer, 255, 255, 0, SDL_ALPHA_OPAQUE); /* yellow, full alpha */
SDL_RenderLine(renderer, 0, 0, 640, 480);
SDL_RenderLine(renderer, 0, 480, 640, 0);