sprite_prefetch


描述

此函数可以用来预读取给定精灵的纹理页,并将它放进纹理存储中。你要提供在创建精灵资源时定义的精灵索引,然后此精灵所在的纹理页将会被加载进存储中。. 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 on any required graphics at the start of a level to avoid any stalls.


语法:

sprite_prefetch(ind)

参数 描述
ind 将要被预读取的精灵的所有。


Returns:

Int (-1 or 0)


例如:

sprite_prefetch(spr_Player_Aura);

上述代码将会把给定的精灵放进纹理存储中并供将来使用。