Skip to content

utilities

Francisco Dias edited this page Apr 6, 2024 · 2 revisions

Utilities

This modules provides the user with some utility functions.

Functions

The following functions are provided for helping with development:



Back To Top

GooglePlayServices_UriToPath

Some of the functions callbacks in this API return URIs (unique resource identifiers). However if you need to open these files or load them as images (using the sprite_add function) it is necessary to convert these URIs into paths. This function requests the Google Play Services API for the path to a given URI.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GooglePlayServices_UriToPath(uri)
Argument Type Description
uri String The URI to get the path from.

Returns:

Real


Triggers:

Social Async Event

Key Type Description
type String The string "GooglePlayServices_UriToPath"
success Boolean Whether or not the function request succeeded.
ind Real The id of the request this callback refers to.
path String The path to the resource.

Example:

var request = GooglePlayServices_UriToPath(uri)

The code sample above save the identifier that can be used inside Social Async Event.

if(async_load[? "type"] == "GooglePlayServices_UriToPath")
if(async_load[?"ind"] == request)
{
    if(!async_load[?"success"])
       exit

    sprite = sprite_add(async_load[?"path"], 0, 0, 0, 0, 0);
}

The code above matches the response against the correct event type and request identifier (ind) . And loads the resolved path as a sprite using the sprite_add function.



Clone this wiki locally