#9572 - yaustar - Sat Aug 09, 2003 5:15 am
    I have an idea how to set them but am new to the whole 'bits' and 'bit shifting'.
would I define them as:
 | Code: | 
  | #define BG_PRIORITY(n)  ((n)<<1)
 
 | 
and add it to:
 | Code: | 
  | temp = bg->size | (bg->charBaseBlock<<CHAR_SHIFT) | (bg->screenBaseBlock<<SCREEN_SHIFT)
 | bg->colorMode | bg->mosaic | bg->wraparound | bg->bg_priority;
 
 | 
While on the topic of backgrounds, do text backgrounds wraparound no matter what?
Thanks for your time[/code]
_________________
[Blog] [Portfolio]     
 
    #9573 - tepples - Sat Aug 09, 2003 5:32 am
    Close.  You're supposed to shift left by the number of the LOWEST order bit in the field.  In the case of BG priority, the lowest order bit is bit 0, so | Code: | 
  | #define BG_PRIORITY(n) ((n) << 0) | 
A non-trivial example might be sprite priority, which occupies bits 11 and 10 of a sprite's attribute 2. | Code: | 
  | #define OAM_PRIORITY(n) ((n) << 10) | 
And yes, text backgrounds always wrap.  You can make a text background not wrap by setting a window and telling the background to draw only within the window.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.     
 
    #9588 - yaustar - Sat Aug 09, 2003 3:19 pm
    thanks, that explains a lot
_________________
[Blog] [Portfolio]     
 
    #9600 - yaustar - Sun Aug 10, 2003 2:49 am
    how would I change the priority on the fly, i.e. after initialisation.
_________________
[Blog] [Portfolio]     
 
    #9616 - niltsair - Sun Aug 10, 2003 11:26 pm
    You retrieve the old 16bits value with a mask, leaving out the 2 bits concerning priority. You then 'or' this value with your new shifted priority value.
Say priority are bit 3&4 (I don't remember them offhand)
*bgRegValX = ( bgRegValX & 0xFFE7) | ( newPrioVal << 3);
(1111 1111 1110 0111 = 0xFFE7)
    
 
    #22531 - jhinders - Wed Jun 23, 2004 8:12 pm
     | tepples wrote: | 
  | And yes, text backgrounds always wrap.  You can make a text background not wrap by setting a window and telling the background to draw only within the window.
 | 
how exactly would you set a window and tell the background to only draw within it? 
    #22535 - Miked0801 - Wed Jun 23, 2004 9:23 pm
    No text backgrounds do not always wrap.  There is a bit you set in the BG control register that tells it to wrap or fill 0 color.  I don't have it handy, but could look it up if needed.
    
 
    #22536 - poslundc - Wed Jun 23, 2004 9:52 pm
    I'm fairly positive that bit only does anything for rotation backgrounds.
Dan.
    
 
    #22537 - jhinders - Wed Jun 23, 2004 9:53 pm
     | Miked0801 wrote: | 
  | No text backgrounds do not always wrap.  There is a bit you set in the BG control register that tells it to wrap or fill 0 color.  I don't have it handy, but could look it up if needed. | 
according to the documentation i have you can't set that bit for BG0 and BG1. 
    #22538 - Miked0801 - Wed Jun 23, 2004 11:38 pm
    Ok, strange - our engine is always playing with that bit.  I'll have to go in and see if it is just being ignored or whatever on our side.
    
 
    #22541 - tepples - Thu Jun 24, 2004 12:46 am
     | jhinders wrote: | 
  | how exactly would you set a window and tell the background to only draw within it? | 
Peruse this.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.