gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > enable bg on the fly

#131276 - snowsquirrel - Wed Jun 13, 2007 3:37 pm

Can I enable/disable bg's on the fly.

i.e.,
Code:

static uint32 videoGetMode() { return DISPLAY_CR; }

videoSetMode( MODE_0_2D | DISPLAY_BG3_ACTIVE );

BG3_CR = DISPLAY_CR |
                BG_COLOR_256 |
                BG_MAP_BASE(0) |
                BG_TILE_BASE(1) |
                BG_PRIORITY(3) ;

// ...

//much later
unit32 mode = videoGetMode();
mode |= DISPLAY_BG2_ACTIVE;
videoSetMode( mode );
BG3_CR = DISPLAY_CR |
                BG_COLOR_256 |
                BG_MAP_BASE(1) |
                BG_TILE_BASE(2) |
                BG_PRIORITY(2) ;


Should this work?

#131280 - kalus - Wed Jun 13, 2007 5:24 pm

should work fine, does on mine, i switch between 2d and 3d from menu too game, and that requires enabling bg's whenever you go back to 2d.

#131283 - Dark Knight ez - Wed Jun 13, 2007 6:06 pm

What the .
You shouldn't put DISPLAY_CR in the BG3_CR line.
DISPLAY_CR is a control register... not an attribute.
_________________
AmplituDS website

#131284 - snowsquirrel - Wed Jun 13, 2007 6:36 pm

Quote:
What the .
You shouldn't put DISPLAY_CR in the BG3_CR line.
DISPLAY_CR is a control register... not an attribute.


lol! That was a typo.

~S