Hi,
there's folks who cannot remember the indices of their sprites/sounds. Or the numbering requires an insertion of a new resource (for aesthetical reasons). For all these I sketched a method of using names instead of numbers:
Regards,
Gernot
there's folks who cannot remember the indices of their sprites/sounds. Or the numbering requires an insertion of a new resource (for aesthetical reasons). For all these I sketched a method of using names instead of numbers:
Code (glbasic) Select
spr_human = DynLoadSprite("Human.bmp")
SPRITE spr_human, 0,0
SHOWSCREEN
MOUSEWAIT
FUNCTION DynLoadSprite: file$
LOADSPRITE file$, GLOBAL spr_id_max
spr_id_max = spr_id_max + 1
RETURN spr_id_max-1
ENDFUNCTION
FUNCTION DynLoadSound: file$, buffer
LOADSOUND file$, GLOBAL spr_id_max, buffer
snd_id_max = snd_id_max + 1
RETURN snd_id_max-1
ENDFUNCTION
FUNCTION DynLoadObject: file$
X_LOADOBJ file$, GLOBAL obj_id_max
obj_id_max = obj_id_max + 1
RETURN obj_id_max-1
ENDFUNCTION
it's obvious what I mean, isn't it? All these functions should go in C:\Program Files\GLBasic\Projects\Common\DynLoad.gbas and can be inserted in any project from there easily.Regards,
Gernot