【发布时间】:2015-06-19 00:18:02
【问题描述】:
我正在将程序从 SDL 1 更新到 SDL 2,并且需要使用调色板。最初,我使用了SDL_SetColors(screen, color, 0, intColors);,但这在 SDL 2 中不起作用。我正在尝试使用:
SDL_Palette *palette = (SDL_Palette *)malloc(sizeof(color)*intColors);
SDL_SetPaletteColors(palette, color, 0, intColors);
SDL_SetSurfacePalette(surface, palette);
但是SDL_SetPaletteColors() 返回 -1 并失败。 SDL_GetError 没有给我任何信息。
如何从SDL_Color 制作调色板,然后将其设置为我的表面的调色板?
【问题讨论】:
标签: c sdl-2 palette color-palette