79639591

Date: 2025-05-26 21:45:29
Score: 0.5
Natty:
Report link

What you're doing is totally fine, but here's how I might do it:

struct palette {
    u16 *items;
    u8 first_i;
};

void scrollPalette(struct palette *p, bool scroll_dir) 
{
    if (scroll_dir) {
        p->first_i = (p->first_i + 1) % 16;
    } else {
        p->first_i = p->first_i == 0 ? 15 : p->first_i - 1;
    }
}

Then you need to access and display the palette differently, for example:

u16 palleteGet(struct pallete *p, u8 n) {
    return p->items[(p->first_i + n) % 16];
}
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): What you
  • Low reputation (0.5):
Posted by: clarkep