mirror of https://github.com/libsdl-org/SDL
Added notes for migrating SDL_GetRGBA()/SDL_MapRGBA() code
This commit is contained in:
parent
af2dbf3ff3
commit
60ed914c66
|
@ -349,13 +349,13 @@ The SDL_EVENT_WINDOW_SIZE_CHANGED event has been removed, and you can use SDL_EV
|
||||||
|
|
||||||
The keysym field of key events has been removed to remove one level of indirection, and `sym` has been renamed `key`.
|
The keysym field of key events has been removed to remove one level of indirection, and `sym` has been renamed `key`.
|
||||||
|
|
||||||
Code that looked like this:
|
Code that used to look like this:
|
||||||
```c
|
```c
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDL_Keycode key = event.key.keysym.sym;
|
SDL_Keycode key = event.key.keysym.sym;
|
||||||
SDL_Keymod mod = event.key.keysym.mod;
|
SDL_Keymod mod = event.key.keysym.mod;
|
||||||
```
|
```
|
||||||
now looks like this:
|
should be changed to:
|
||||||
```c
|
```c
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDL_Keycode key = event.key.key;
|
SDL_Keycode key = event.key.key;
|
||||||
|
@ -1098,6 +1098,24 @@ SDL_PixelFormatEnum has been renamed SDL_PixelFormat and is used instead of Uint
|
||||||
|
|
||||||
SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB(), and SDL_GetRGBA() take an optional palette parameter for indexed color lookups.
|
SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB(), and SDL_GetRGBA() take an optional palette parameter for indexed color lookups.
|
||||||
|
|
||||||
|
Code that used to look like this:
|
||||||
|
```c
|
||||||
|
SDL_GetRGBA(pixel, surface->format, &r, &g, &b, &a);
|
||||||
|
```
|
||||||
|
should be changed to:
|
||||||
|
```c
|
||||||
|
SDL_GetRGBA(pixel, SDL_GetPixelFormatDetails(surface->format), SDL_GetSurfacePalette(surface), &r, &g, &b, &a);
|
||||||
|
```
|
||||||
|
|
||||||
|
Code that used to look like this:
|
||||||
|
```c
|
||||||
|
pixel = SDL_MapRGBA(surface->format, r, g, b, a);
|
||||||
|
```
|
||||||
|
should be changed to:
|
||||||
|
```c
|
||||||
|
pixel = SDL_MapSurfaceRGBA(surface, r, g, b, a);
|
||||||
|
```
|
||||||
|
|
||||||
SDL_GetMasksForPixelFormat() now returns the standard int error code.
|
SDL_GetMasksForPixelFormat() now returns the standard int error code.
|
||||||
|
|
||||||
SDL_CalculateGammaRamp has been removed, because SDL_SetWindowGammaRamp has been removed as well due to poor support in modern operating systems (see [SDL_video.h](#sdl_videoh)).
|
SDL_CalculateGammaRamp has been removed, because SDL_SetWindowGammaRamp has been removed as well due to poor support in modern operating systems (see [SDL_video.h](#sdl_videoh)).
|
||||||
|
|
Loading…
Reference in New Issue