fengb / fundude

Gameboy emulator: Zig -> wasm
https://fengb.github.io/fundude/
MIT License
181 stars 8 forks source link

GBC pixel layout #39

Closed fengb closed 4 years ago

fengb commented 4 years ago

GBC features 5 bits per RGB — 32 shades / channel — 32768 colors. This translates to a simple

const Pixel = packed struct{
    r: u5,
    g: u5,
    b: u5,
    extra: u1,
};

This should be cascaded through all the rendering/caching layers, with the extra field storing "background transparency" or "sprite on top" configuration. For the current monochrome system, we should convert the pixel values to the proper grayscale values.

To replicate the "retro green" look, we can apply a CSS filter or some similar hack, but this is a nice to have.

fengb commented 4 years ago

Resolved via 0029a2bc950944c98e853af7a5da34d28a373953