Page 1 of 1

Any way to have a background color?

Posted: Thu Feb 06, 2014 5:41 am
by ifrit05
Heya been messing around with the SGDK for a bit. Made a little program that played a WAV file, nothing fancy.

Looked through the tutorials and I'm at a loss on how to display a color background if possible. I tried the bitmap way and I could never get it to load correctly (make spat out a bunch of errors).

Thinking about getting a Everdrive MD soon too. I love Gen/MD and would love to start making homebrew for it.

BTW the Bad Apple demo that Stef made was amazing. Didn't know the Genny had the power in it. :)

Posted: Thu Feb 06, 2014 9:11 am
by Stef
Hi ifrit05 :)

Welcome here, i guess the comment on the Bad Aple video comes fro you, thanks for it ;)
You have to understand how the Sega Genesis video system work, it is definitely not a standard bitmap or text mode device.
The video hardware use 4 palettes of 16 colors each to display image when color 0 is transparent. You can set int the video processor a color index (from 0 to 63) which will be use as the default background color.
For that you can use the following SGDK method :

Code: Select all

VDP_setBackgroundColor(u8 index);
Then you have to define the RGB color for the specified color index in video palette :

Code: Select all

VDP_setPaletteColor(u16 index, u16 value);
where index goes from 0 to 63 (because 4 palettes of 16 colors each) and value is the RGB color in 0000RRR0GGG0BBB0 format.

Posted: Thu Feb 06, 2014 3:54 pm
by ifrit05
Thanks! Shoulda looked around a bit more.

Gonna play around a bit and see what I can do. :)