It may save you some trouble in the future to look up the answer instead of
trying to figure it out:
TileVramAddress = TileNumber * BoundaryValue
Also note that sprites are split into 8x8 blocks in 1D mode (most people use
1D mode), which are then placed linearly in VRAM.
For example, a 32x32 sprite: (each letter represents a 8x8 block)
Will be placed like this in VRAM:
On 8/9/07, Geoff Harrower <geoff.harrower@...> wrote:
> I'm new to the DS homebrew thing, and so far I'm pretty impressed with
> what I see. I do have a question about Sprites, and looking through the
> demos and docs I haven't been able to find a clear answer. If there's a doc
> somewhere I'm missing please point me to it.
> Looking at the demos that come with devkitpro, I understand that
> SPRITE_GFX is where I store my sprite data. I'm pretty sure I have a clear
> understanding of that.
> What I'm unsure of is, if I were to load multiple sprites into SPRITE_GFX,
> how I tell each sprite entry which memory location to use in order to draw
> the sprite.
> Looking at the Complex_2D example, I thought that attribute2 was simply an
> index into SPRITE_GFX, based on the gfxID property in example. So I tried
> loading multiple Sprites, setting attribute2 to the memory offset
> from SPRITE_GFX of the corresponding sprite, but that didn't work.
> Next I looked at the Sprite_Bitmap example, because it makes use of
> multiple sprites.
> The first sprite is a 32x32 16 bit bitmap. it's attribute2 is set to
> ATTR2_ALPHA(1)| 0. Ok, so i'm guessing the 0 is the index into SPRITE_GFX.
> Makes sense.
> The next sprite is a 32x32 8 bit bitmap. I would have guessed that
> attribute2 for this sprite would be 1024. But it is in fact 64.
> Next sprite 3 a 32x32 4 bit bitmap. It's attribute2 is set to
> ATTR2_PALETTE(1) | 96.
> So, based on these numbers my guess is that attribute2 is calculated as
> attribute2 = PRIORITY | PALLETTE | (width + height)
> where width = (width_of_sprite * 16) / colour depth in bits
> height = (height_of_sprite * 16) / colour depth in bits
> Is this correct?
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> Devkitpro-arm-users mailing list