Alex.
Retired
- Joined
- Aug 24, 2005
- Messages
- 4,616
Guess who -
In the game I'm making, I have this big sprite sheet (1000x500). It's loaded as a SDL_Surface, and is a local variable that's passed from function to function. Due to its size, it slowed my game down by 75%, so I split it into two pieces and periodically loaded needed parts of them. This solved the speed problem, but I feel that it's still slowing it down, even if only by a little bit.
Should I make the spritesheet a global variable in order not to have it passed around by functions? What about the screen itself (I have that declared as a local and passed around as well). Would that improve speed, and would it be good coding practice?
Thanks a bunch!
- Alex
In the game I'm making, I have this big sprite sheet (1000x500). It's loaded as a SDL_Surface, and is a local variable that's passed from function to function. Due to its size, it slowed my game down by 75%, so I split it into two pieces and periodically loaded needed parts of them. This solved the speed problem, but I feel that it's still slowing it down, even if only by a little bit.
Should I make the spritesheet a global variable in order not to have it passed around by functions? What about the screen itself (I have that declared as a local and passed around as well). Would that improve speed, and would it be good coding practice?
Thanks a bunch!
- Alex