Homemade “shaders” for shadows, cursor pause

As I said in my post restricting my game to using only the NES color palette, it is forbidden to actually use transparent surfaces to create filters. This would create colors that are not in the NES palette.

I had to find a solution to make shadows in my game, and the solution I found is to implement a “shader” of sorts that make use of arrays that switch colors around from one color palette to another. I call those palette tables, and their implementation could not be simpler:

palette_tableAtoB[paletteA_color] = paletteB_color

The problem is, how to you apply this palette table to the actual pixels on the image? The SDL library is a little bit fiddly in this regard, but essentially the pixels must be modified before the SDL_RenderCopy step, for each rendered element. For now, my homemade shaders are only implemented for the tilemap:

The Horse-ified Silou goes back to her original tile after cancellation, and can be re-selected. My engine is coming along nicely! The video also shows the short pause that the cursor takes after a single tile movement, for precise selection. Also, the Attackmap and Movemap also get shaded! This works for any palettes, so will probably also be use to lighten the colors, and create color filters.

Leave a comment