#1771 - darkcloud - Wed Jan 22, 2003 10:26 pm
When I use text backgrounds, and I scoll them using REG_BGxHOFS or REG_BGxVOFS (0x4000010 to 0x400001E). These work just as I want, if I update these by 1, then the bg will scroll by 1. But when using rot bgs, and use REG_BGxX or REG_BGxY, it seems like I have to update these registers by a lot just to get them to move a pixel. Why is this?
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.
#1772 - Splam - Wed Jan 22, 2003 10:54 pm
Because they're fixed point fractions. 19bit integer (signed) 8bit fractional so if you're doing a straight scroll you need to add 256 to them. They're like that to get accuracy for the rotation and scaling modes, eg if you scaled the screen by 1/2 you wouldn't want it to move 1 pixel a time but only 1/2 a pixel (even though there isn't such a thing it saves you working it out if you see what i mean).
#1773 - darkcloud - Wed Jan 22, 2003 10:58 pm
Oh I see. Thanks. I figured out how to get it to scroll correctly just a few minutes ago but now I know why it does that so thanks again.
_________________
Maybe in order to understand mankind, we have to look at the word itself: "Mankind". Basically, it's made up of two separate words - "mank" and "ind". What do these words mean ? It's a mystery, and that's why so is mankind.
#1774 - Touchstone - Wed Jan 22, 2003 11:03 pm
Those registers are .8 fixed points meaning one pixel unit movement equals 256 int units. Code: |
int PixelsToMove = 10;
*REG_BGxX = PixelsToMove << 8; |
This is because you need better precision when dealing with the rotation parameters.
_________________
You can't beat our meat