How does SPR_update work with multiple sprites?
Moderator: Stef
-
- Interested
- Posts: 33
- Joined: Fri Dec 12, 2014 2:41 am
- Location: USA - Chicago, IL
How does SPR_update work with multiple sprites?
Do I need to pass in an array of sprite pointers? Or can I make a call to SPR_update for each sprite I want to draw?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
You need to pass an array of sprite, for instance :
and you can call SPR_Update(..) only once per frame.
Your sprite array should contains the active sprites for the frame.
Your array can be 10 in size but you can only send the 2 first sprites to the VDP by using '2' as second argument (as in my example).
Code: Select all
Sprite sprites[10];
...
SPR_Update(sprites, 2);
Your sprite array should contains the active sprites for the frame.
Your array can be 10 in size but you can only send the 2 first sprites to the VDP by using '2' as second argument (as in my example).
-
- Interested
- Posts: 33
- Joined: Fri Dec 12, 2014 2:41 am
- Location: USA - Chicago, IL
So I'm using a function to create the array of sprites. I pass in a list of strings, which go to a table to look up the sprites I want to draw, then add them to the array of sprites. The sprites are already initialized using SPR_initSprite().
This method is giving me an error saying that it is finding re-definitions of the Sprite Definitions, which I set with the SPR_initSprite(). Any ideas what could be going on? Should I not initialize the sprite until I need to draw it?
This method is giving me an error saying that it is finding re-definitions of the Sprite Definitions, which I set with the SPR_initSprite(). Any ideas what could be going on? Should I not initialize the sprite until I need to draw it?
-
- Interested
- Posts: 33
- Joined: Fri Dec 12, 2014 2:41 am
- Location: USA - Chicago, IL
I was able to figure out the problem. I'm using rescomp to compile my sprites for usage in the program. So I have a gfx.res file to use with rescomp. Somehow, a gfx.s file was in the same folder. I didn't create that file...so I don't know how it ended up there.
Maybe something left over while it was compiling...
EDIT: I interrupted the build while it was compiling, which means the gfx.s wasn't cleaned by make. Lessons learned.
Maybe something left over while it was compiling...
EDIT: I interrupted the build while it was compiling, which means the gfx.s wasn't cleaned by make. Lessons learned.
Last edited by BroOfTheSun on Tue Dec 30, 2014 7:03 pm, edited 1 time in total.