Hi,
I am new to development for the NDS but I am familiar with C++ and common programming concepts. Basically I am using grit to load a 16 bit .png image in as a background. I am then trying to make the background rotate in either direction.
I have found the function bgRotate() which I can use to rotate the background in an anti-clockwise direction around the top left corner. Can anyone tell me how I can rotate the graphic around its center point rather than the top left corner? I have already attempted to use the bgSetCenter() function but instead of keeping the background at its original coodinates and only moving the center point for the rotation, the image is being moved also.
I have Googled my socks off but cannot find anything that makes it any clearer to me. Any help would be much appreciated.
Cheers,
Tom
bgRotate() Rotate from center of graphic
Re: bgRotate() Rotate from center of graphic
The example under (your devkitpro install dir)\examples\nds\Graphics\Backgrounds\rotation\
Should be of great help.
Should be of great help.
Re: bgRotate() Rotate from center of graphic
AFAIK, the only way to rotate a background with the center as its rotation point is to rotate it from the top-left, and then move the background position to the correct place using some calculations. which is what the background api is doing. if it doesn't work then I think there is a bug in the calculations.
could you describe what is going wrong some more? does the background still rotate, where does its position move to ect. this might help finding the bug.
edit: sylus beats me to it <.< . check the examples to see if that works.
could you describe what is going wrong some more? does the background still rotate, where does its position move to ect. this might help finding the bug.
edit: sylus beats me to it <.< . check the examples to see if that works.
Re: bgRotate() Rotate from center of graphic
Brilliant, I will take a look right away. Thanks for pointing that one outSylus101 wrote:The example under (your devkitpro install dir)\examples\nds\Graphics\Backgrounds\rotation\
Should be of great help.
The background rotates perfectly, but only around the top left corner. Moving the rotation centre actually moves the top left corner of the background. It therefore continues to rotate around the top left corner but with said corner positioned where the rotation centre was set to.vuurrobin wrote:AFAIK, the only way to rotate a background with the center as its rotation point is to rotate it from the top-left, and then move the background position to the correct place using some calculations. which is what the background api is doing. if it doesn't work then I think there is a bug in the calculations.
could you describe what is going wrong some more? does the background still rotate, where does its position move to ect. this might help finding the bug.
Re: bgRotate() Rotate from center of graphic
Dude, this example is EXACTLY what I was after. You legend!Sylus101 wrote:The example under (your devkitpro install dir)\examples\nds\Graphics\Backgrounds\rotation\
Should be of great help.
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests