Hi,
I'm using SDL to perform fadein/fadeout on my game.
On the PC in 24 bit mode I use alpha channel to perform this, but on the DS I have opened a 8 bit screen to save memory and CPU (maybe I'm misled because 16 bit depth would be better but I have tried this first and it was rather slow).
So my fadein/fadeout works on a PC with 8-bit screen because in this case I'm using palette manipulation (through SDL_SetPalette with hardware palette flag set). So it's OK SDL-wise. I have checked and the hardware palette flag is set for the screen.
The problem is that it's not working on a real DS. I don't see the transitions... The funniest thing is it works on IdeaS (a DS emulator): I see the fadein effect!! It does not work on No$GBA.
So is there some register to poke into to commit the changes? SDL for NDS has a lot of limitations & bugs, so I'm sure that this is not fully supported. I'm willing to fix this.
fadein/fadeout in paletted screenmode
Re: fadein/fadeout in paletted screenmode
Not sure if you'd want to do this, but you can change the master brightness of your display output (not the actual display).
It doesn't give as smooth a transition because it is only 5-bits, but if you aren't doing really slow transitions, it may be adequate.
http://nocash.emubase.de/gbatek.htm#dsvideo
That is just for the main display, but you can also change the sub display as well. (Both registers are defined already in the nds headers)
#define REG_MASTER_BRIGHT (*(vu16*)0x0400006C)
#define REG_MASTER_BRIGHT_SUB (*(vu16*)0x0400106C)
If you don't care about dealing with registers directly, there is a function in libnds that will handle everything for you.
It doesn't give as smooth a transition because it is only 5-bits, but if you aren't doing really slow transitions, it may be adequate.
http://nocash.emubase.de/gbatek.htm#dsvideo
Code: Select all
400006Ch - NDS9 - MASTER_BRIGHT - 16bit - Master Brightness Up/Down
0-4 Factor used for 6bit R,G,B Intensities (0-16, values >16 same as 16)
Brightness up: New = Old + (63-Old) * Factor/16
Brightness down: New = Old - Old * Factor/16
5-13 Not used
14-15 Mode (0=Disable, 1=Up, 2=Down, 3=Reserved)
#define REG_MASTER_BRIGHT (*(vu16*)0x0400006C)
#define REG_MASTER_BRIGHT_SUB (*(vu16*)0x0400106C)
If you don't care about dealing with registers directly, there is a function in libnds that will handle everything for you.
Code: Select all
/** \brief
\param screen 1 = main screen, 2 = subscreen, 3 = both
\param level -16 = black, 0 = full brightness, 16 = white
*/
void setBrightness(int screen, int level);
Re: fadein/fadeout in paletted screenmode
5 bits!!! That's more than enough. I have an Amiga so I know how to stay humble when it come to color.
I'll try this, looks very interesting for what I want to do. Thanks
EDIT: works fine and is very simple !!!! I hate this generic SDL shit when it comes to the DS: you have 2 registers to poke into, and they make you create a zillion structures to call a zillion stubbed code ... that does not work
thanks a lot!
I'll try this, looks very interesting for what I want to do. Thanks
EDIT: works fine and is very simple !!!! I hate this generic SDL shit when it comes to the DS: you have 2 registers to poke into, and they make you create a zillion structures to call a zillion stubbed code ... that does not work
thanks a lot!
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests