View Full Version : acquired wisdom please
Donone
11-18-2007, 06:50 AM
I have noticed that almost invariably the following sequence occurs...
Sp$=LoadSprite(AppPath$ + Spin$, -1, Fr$, 0, null);
SetSpriteProc(Sp$,&SpProc);
and I have been using...
Sp$=LoadSprite(AppPath$ + Spin$, -1, Fr$, 0, &SpProc);
There must be some advantage to the former being used and I am obviously in the dark.
Will some kind soul please let me in.
zehlein
11-18-2007, 07:16 AM
Readability.
Donone
11-18-2007, 07:19 AM
Well that was simple. Thank you.
kornalius
11-18-2007, 01:35 PM
WM_CREATE event is being called on the spriteproc if you use it inside LoadSprite() too.
Donone
11-18-2007, 04:25 PM
Ah, now not so simple. Please do you think you could elaborate a little on what effect that might have. Not urgent, at your leisure.
Thank you.
PointOfLight
11-18-2007, 05:05 PM
If you pass a sprite procedure on the LoadSprite event, you actually have the advantage of doing something to the sprite or to your game environment when the sprite is created (because it fires the WM_CREATE event).* If you need this functionality for any reason, pass the sprite procedure on the LoadSprite call.* Otherwise, just use the SetSpriteProc function.
kornalius
11-18-2007, 11:33 PM
If you pass the SpriteProc into LoadSprite you also save on one function call! ;)
Donone
11-19-2007, 09:55 AM
Thank you both for that important enlightenment.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.