CreateSprite
Very usefull function that creates simple square sprite with given size and texture. It returns an effect object id wich may be processed to change it's properties as usual.
function CreateSprite(texture, width, height){
let obj=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj,texture);
ObjEffect_SetRenderState(obj,ALPHA); // by default. May be changed later
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexXY(obj,0,-width/2,-height/2);
ObjEffect_SetVertexXY(obj,1,width/2,-height/2);
ObjEffect_SetVertexXY(obj,2,-width/2,height/2);
ObjEffect_SetVertexXY(obj,3,width/2,height/2);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,width,0);
ObjEffect_SetVertexUV(obj,2,0,height);
ObjEffect_SetVertexUV(obj,3,width,height);
return obj;
}