sprite_prefetch_multi


描述

此函数可以用来预读取给定精灵的一定数量的纹理页,并将它放进纹理存储中。你需要提供有精灵索引构成的数组,此索引会在你创建精灵资源时给出,然后这些纹理页将会被加载进存储中。Note that the function will return -1 if prefetch is not supported for the chosen resource or the target platform is HTML5, or it will return 0 if all worked correctly.

NOTE: There is a performance hit as the texture is uploaded to texture memory on most devices, so it's recommended that you call sprite_prefetch_multi on any required graphics at the start of a level to avoid any stalls.


语法:

sprite_prefetch_multi

参数 描述
array 将要被读取的精灵的索引数组。


Returns:

Int (-1 or 0)


例如:

spr_a[0] = spr_Player_Aura1;
spr_a[1] = spr_Player_Aura2;
spr_a[2] = spr_Player_Aura3;
spr_a[3] = spr_Player_Aura4;
sprite_prefetch_multi(spr_a);

上述函数将会创建一个数组,数组中每个元素都存储一个精灵索引。然后将精灵纹理都放进存储中。