Any way to have a background color?

SGDK only sub forum

Moderator: Stef

Post Reply
ifrit05
Newbie
Posts: 2
Joined: Thu Feb 06, 2014 5:36 am

Any way to have a background color?

Post 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. :)
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post 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.
ifrit05
Newbie
Posts: 2
Joined: Thu Feb 06, 2014 5:36 am

Post by ifrit05 »

Thanks! Shoulda looked around a bit more.

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