Page 1 of 1

Get sprite position/tile/palette etc.

Posted: Sat Aug 10, 2013 12:31 pm
by Xynxyn
Is there any function in SGDK that allows to directly get (for example) position of sprite?

Posted: Sun Aug 11, 2013 11:56 am
by Moon-Watcher
You can use spriteDefCache array to get sprite data

Posted: Sun Aug 11, 2013 12:21 pm
by Xynxyn
But I want to get it directly from VRAM. ;| (Sorry, I forgot to write it)

Posted: Sun Aug 11, 2013 1:47 pm
by TmEE co.(TM)
VRAM reads are slow and can cause issues with mixed writes if you aren't careful. Reading out from that same cache would be the fastest way to get the info, I imagine the cache is just straight DMA'd into VRAM when needed.
The data does not change in VRAM on its own so there's not a whole lot need to go poke at it directly.

Posted: Sun Aug 11, 2013 7:39 pm
by Stef
You can do VRAM read operation but this is not direct way of doing it as indeed, that would not be a great idea. usually you always keep a work ram version of your sprites data then you upload it to VRAM when needed. Working exclusively from VRAM would make operations lot slower.

Posted: Sun Aug 11, 2013 9:45 pm
by Xynxyn
I thought mainly about RAM usage, but that usage if using the spriteDefCache isn't much bigger, and operating directly on VRAM is much slower, I probably would stay with the standard option. (I used it before, but want to know the black magic ;D)