MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / setPalette

Method setPalette

src/Engine/State.cpp:351–368  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

349 * @param immediately Apply changes immediately, otherwise wait in case of multiple setPalettes.
350 */
351void 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.

Callers 8

loadMethod · 0.45
loadTerminalMethod · 0.45
fixMethod · 0.45
COLORS256Function · 0.45
DECODE_COLORFunction · 0.45
addMethod · 0.45
initMethod · 0.45
initMethod · 0.45

Calls 6

getCursorMethod · 0.80
getFpsCounterMethod · 0.80
getColorsMethod · 0.80
drawMethod · 0.45
getResourcePackMethod · 0.45
getPaletteMethod · 0.45

Tested by

no test coverage detected