pierce-smith1 / yok.scr

the doughbyte-themed windows screensaver
https://doughbyte.com/aut/yokscr
11 stars 1 forks source link

Consider dumping enums? #30

Open pierce-smith1 opened 10 months ago

pierce-smith1 commented 10 months ago

There is a LOT of enum-to-integer casting going on in this codebase. At first enums seemed like the right call for things like config options and palette names, but we are doing an unexpected amount of math on these values, to the point where they maybe should just be integers.

So, we could go through all the enums we have (that we do a lot of math on) and just turn them into constants:

enum class PaletteName {
    autumn,
    bliss,
    ...
}

// ... might become ...

const int PALETTE_AUTUMN = 0;
const int PALETTE_BLISS = 1;
...

The disadvantage here, of course, is that it's more error prone and it's way more annoying to define new variants. There is probably a more elegant way. But... boy, are these enum things getting irritating.

pierce-smith1 commented 8 months ago

A lot of enums have been removed, but those for patterns still exist.