xboxlive_sprite_add_from_gamerpicture

With this function you can get the gamer picture for a given user ID pointer. The function works asynchronously, and will trigger an Image Loaded asynchronous event to inform you that the function is finished (like with HTML5/URL calls to sprite_add()). The Asynchronous Image Loaded event will have a DS map stored in the built in variable async_load. The map contains the following information:

NOTE: When you dynamically load a sprite into your game at runtime, you must remember to remove it again using sprite_delete() when no longer needed, otherwise there is risk of a memory leak which will slow down and eventually crash your game.

 

Syntax:

xboxlive_sprite_add_from_gamerpicture(user_id, imagesize, xorig, yorig);

Argument Description
user_id The user ID (a pointer) to get the gamer picture for
imagesize Size in pixels of the sprite to be returned
xorig Indicate the x position of the origin in the sprite
yorig Indicate the y position of the origin in the sprite

 

Returns:

Real

 

Example:

var _a = 0;
var _num = xboxlive_get_user_count();
for (var i = 0; i < _num; ++i;)
    {
    var _uid = xboxlive_get_user(i);
    if _uid != pointer_null
        {
        global.UserName[_a] = xboxlive_gamedisplayname_for_user(_uid);
        global.UserScore[_a] = xboxlive_gamerscore_for_user(_uid);
        global.UserRep[_a] = xboxlive_reputation_for_user(_uid);
        global.UserAvatar[_a] = xboxlive_sprite_add_from_gamerpicture(_uid, 256, 0, 0);
        ++a;
        }
    }

The above code loops through the logged in users and stores their gamer data in various global arrays.