* Replaces a certain amount of colors in the state's palette. * @param colors Pointer to the set of colors. * @param firstcolor Offset of the first color to replace. * @param ncolors Amount of colors to replace. * @param immediately Apply changes immediately, otherwise wait in case of multiple setPalettes. */
| 349 | * @param immediately Apply changes immediately, otherwise wait in case of multiple setPalettes. |
| 350 | */ |
| 351 | void State::setPalette(SDL_Color *colors, int firstcolor, int ncolors, bool immediately) |
| 352 | { |
| 353 | if (colors) |
| 354 | { |
| 355 | memcpy(_palette + firstcolor, colors, ncolors * sizeof(SDL_Color)); |
| 356 | } |
| 357 | if (immediately) |
| 358 | { |
| 359 | _game->getCursor()->setPalette(_palette); |
| 360 | _game->getCursor()->draw(); |
| 361 | _game->getFpsCounter()->setPalette(_palette); |
| 362 | _game->getFpsCounter()->draw(); |
| 363 | if (_game->getResourcePack() != 0) |
| 364 | { |
| 365 | _game->getResourcePack()->setPalette(_palette); |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Loads palettes from the game resources into the state. |
no test coverage detected