Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.Because "rvslots" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used.__NOTOC__
<!-- GIDEROSOBJ:FBInstant.context-->
'''<translate>Supported platforms</translate>:''' [[File:Platform html5.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
=== <translate>Description</translate> ===
Contains functions and properties related to the current game context.
{|-
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
[[Special:MyLanguage/FBInstant.context.chooseAsync|FBInstant.context.chooseAsync]] ''<translate>Opens a context selection dialog for the player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.chooseAsync(options,callback) Opens a context selection dialog for the player. -->
[[Special:MyLanguage/FBInstant.context.createAsync|FBInstant.context.createAsync]] ''<translate>Attempts to create or switch into a context between a specified player and the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.createAsync(id,callback) Attempts to create or switch into a context between a specified player and the current player. -->
[[Special:MyLanguage/FBInstant.context.getID|FBInstant.context.getID]] ''<translate>A unique identifier for the current game context.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.getID() A unique identifier for the current game context. -->
[[Special:MyLanguage/FBInstant.context.getPlayersAsync|FBInstant.context.getPlayersAsync]] ''<translate>Gets an table of #contextplayer objects containing information about active players.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.getPlayersAsync(callback) Gets an table of #contextplayer objects containing information about active players. -->
[[Special:MyLanguage/FBInstant.context.getType|FBInstant.context.getType]] ''<translate>The type of the current game context.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.getType() The type of the current game context. -->
[[Special:MyLanguage/FBInstant.context.isSizeBetween|FBInstant.context.isSizeBetween]] ''<translate>Determines whether the number of participants in the current game context is between a given minimum and maximum.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.isSizeBetween(minSize,maxSize) Determines whether the number of participants in the current game context is between a given minimum and maximum. -->
[[Special:MyLanguage/FBInstant.context.switchAsync|FBInstant.context.switchAsync]] ''<translate>Request a switch into a specific context.</translate>''<br/><!-- GIDEROSMTD:FBInstant.context.switchAsync(id,callback) Request a switch into a specific context. -->
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
=== <translate>Constants</translate> ===
|}
{{Facebook Instant Games}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Context|Context]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Gets an table of #contextplayer tables containing information about active players (people who played the game in the last 90 days) that are associated with the current context. This may include the current player.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.context.getPlayersAsync(callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''callback''': (function) <translate>A function that will be called with two arguments: a set of key-value pairs or nil is the operation failed, and an error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example 1'''<br/>
<syntaxhighlight lang="lua">
FBInstant.context.getPlayersAsync(function(result,error)
if result then
print("Active players:",#result)
for loop=1,#result do
local player=result[loop]
for key,value in pairs(player) do
print(key,value)
end
end
end
end)
<br/></syntaxhighlight>
'''Example 2'''<br/>
<syntaxhighlight lang="lua">
FBInstant.context.getPlayersAsync(function(result,error)
if result then
print("Active players:",#result)
for loop=1,#result do
local player=result[loop]
print("id,name,photo",player.getID(),player.getName(),player.getPhoto())
end
end
end)
<br/></syntaxhighlight>
{{FBInstant.context}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3.1<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/* Initialisation and Core|* Initialisation and Core]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Prompts the user to create a shortcut to the game if they are eligible to Can only be called once per session.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.createShortcutAsync(callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''callback''': (function) <translate>A function that will be called with two arguments: Will return false if createShortcutAsync was already called this session or the user is ineligible for shortcut creation and an error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.createShortcutAsync(function(result,error)
if result then
print("Created shortcut")
else
print("Can't create shortcut")
end
end)
<br/></syntaxhighlight>
{{FBInstant}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/* Initialisation and Core|* Initialisation and Core]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Attempt to create an instance of rewarded video. This instance can then be preloaded and presented.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.getRewardedVideoAsync(placementID,callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''placementID''': (string) <translate>The placement ID that's been setup in your Audience Network settings.</translate> <br/>
'''callback''': (function) <translate>A function that will be called with two arguments: Resolves with a #adinstance, or rejects with a #apierror if it couldn't be created. An error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.getRewardedVideoAsync("my_placement_ad", function(result,error)
print("getRewardedVideoAsync result:",result)
end)
<br/></syntaxhighlight>
'''Example 2'''<br/>
<syntaxhighlight lang="lua">
FBInstant.getRewardedVideoAsync("my_placement_ad", function(result,error)
advert = result -- make a global of the result
advert:loadAsync( function () -- Preload the reward advert.
print("Advert loaded!")
advert:showAsync( function () -- show the reward advert.
print("Reward advert watched!")
end)
end)
end)
<br/></syntaxhighlight>
{{FBInstant}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3.1<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/* Initialisation and Core|* Initialisation and Core]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Attempts to match the current player with other users looking for people to play with. If successful, a new Messenger group thread will be created containing the matched players and the player will be context switched to that thread. The default minimum and maximum number of players in one matched thread are 2 and 20 respectively, depending on how many players are trying to get matched around the same time. The values can be changed in fbapp-config.json. See the [Bundle Config documentation]https://developers.facebook.com/docs/games/instant-games/bundle-config for documentation about fbapp-config.json.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.matchPlayerAsync(matchTag,switchContextWhenMatched,callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''matchTag''': (string) <translate>Optional extra information about the player used to group them with similar players. Players will only be grouped with other players with exactly the same tag. The tag must only include letters, numbers, and underscores and be 100 characters or less in length.</translate> '''optional'''<br/>
'''switchContextWhenMatched''': (boolean) <translate>Optional extra parameter that specifies whether the player should be immediately switched to the new context when a match is found. By default this will be false which will mean the player needs explicitly press play after being matched to switch to the new context.</translate> '''optional'''<br/>
'''callback''': (function) <translate>A function that will be called with two arguments: True when the player has been added to a group thread and switched into the thread's context. An error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.matchPlayerAsync("level1", function(result,error)
print(FBInstant.context.getID()) -- eg 12345
end)
<br/></syntaxhighlight>
'''Example 2'''<br/>
<syntaxhighlight lang="lua">
FBInstant.matchPlayerAsync(nil, function(result,error)
print(FBInstant.context.getID()) -- eg 34567
end)
<br/></syntaxhighlight>
{{FBInstant}}__NOTOC__
<!-- GIDEROSOBJ:FBInstant.payments-->
'''<translate>Supported platforms</translate>:''' [[File:Platform html5.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
=== <translate>Description</translate> ===
Contains functions and properties related to payments and purchases of game products.
{|-
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
[[Special:MyLanguage/FBInstant.payments.consumePurchaseAsync|FBInstant.payments.consumePurchaseAsync]] ''<translate>Consumes a specific purchase belonging to the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.payments.consumePurchaseAsync(purchaseToken,callback) Consumes a specific purchase belonging to the current player. -->
[[Special:MyLanguage/FBInstant.payments.getCatalogAsync|FBInstant.payments.getCatalogAsync]] ''<translate>Fetches the game's product catalog.</translate>''<br/><!-- GIDEROSMTD:FBInstant.payments.getCatalogAsync(callback) Fetches the game's product catalog. -->
[[Special:MyLanguage/FBInstant.payments.getPurchasesAsync|FBInstant.payments.getPurchasesAsync]] ''<translate>Fetches all of the player's unconsumed purchases.</translate>''<br/><!-- GIDEROSMTD:FBInstant.payments.getPurchasesAsync(callback) Fetches all of the player's unconsumed purchases. -->
[[Special:MyLanguage/FBInstant.payments.onReady|FBInstant.payments.onReady]] ''<translate>Sets a callback to be triggered when Payments operations are available.</translate>''<br/><!-- GIDEROSMTD:FBInstant.payments.onReady(callback) Sets a callback to be triggered when Payments operations are available. -->
[[Special:MyLanguage/FBInstant.payments.purchaseAsync|FBInstant.payments.purchaseAsync]] ''<translate>Begins the purchase flow for a specific product.</translate>''<br/><!-- GIDEROSMTD:FBInstant.payments.purchaseAsync(purchaseConfig,callback) Begins the purchase flow for a specific product. -->
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
=== <translate>Constants</translate> ===
|}
{{Facebook Instant Games}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Payments|Payments]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Consumes a specific purchase belonging to the current player. Before provisioning a product's effects to the player, the game should request the consumption of the purchased product. Once the purchase is successfully consumed, the game should immediately provide the player with the effects of their purchase.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.payments.consumePurchaseAsync(purchaseToken,callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''purchaseToken''': (string) <translate>The purchase token of the purchase that should be consumed.</translate> <br/>
'''callback''': (function) <translate>A function that will be called with two arguments: True when the purchase has been consumed successfully otherwise the operation failed, and an error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.payments.consumePurchaseAsync("54321", function(result,error)
if result then
print("Consumed!")
end
end)
<br/></syntaxhighlight>
{{FBInstant.payments}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Payments|Payments]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Fetches the game's product catalog.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.payments.getCatalogAsync(callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''callback''': (function) <translate>A function that will be called with two arguments: a set of key-value pairs that are the products that are registered to the game or nil if the operation failed, and an error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example 1'''<br/>
<syntaxhighlight lang="lua">
FBInstant.payments.getCatalogAsync(function(result,error)
if result then
for key,value in pairs(result) do
print(key,value)
end
end
end)
<br/></syntaxhighlight>
'''Example 2'''<br/>
<syntaxhighlight lang="lua">
FBInstant.payments.getCatalogAsync(function(result,error)
if result then
for loop=1,#result do
local p=result[loop]
print("title,id,description,umage,price,currency",p.title,p.productID,p.description,p.imageURI,p.price,p.priceCurrencyCode)
end
end
end)
<br/></syntaxhighlight>
{{FBInstant.payments}}__NOTOC__
<!-- GIDEROSOBJ:FBInstant.player -->
'''<translate>Supported platforms</translate>:''' [[File:Platform html5.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
=== <translate>Description</translate> ===
Contains functions and properties related to the current player.
{|-
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
[[Special:MyLanguage/FBInstant.player.canSubscribeBotAsync|FBInstant.player.canSubscribeBotAsync]] ''<translate>Whether a player can subscribe to the game bot or not.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.canSubscribeBotAsync(callback) Whether a player can subscribe to the game bot or not. -->
[[Special:MyLanguage/FBInstant.player.flushDataAsync|FBInstant.player.flushDataAsync]] ''<translate>Immediately flushes any changes to the player data to the designated cloud storage.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.flushDataAsync(callback) Immediately flushes any changes to the player data to the designated cloud storage. -->
[[Special:MyLanguage/FBInstant.player.getConnectedPlayersAsync|FBInstant.player.getConnectedPlayersAsync]] ''<translate>Fetches a table of ConnectedPlayer tables.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.getConnectedPlayersAsync(callback) Fetches a table of ConnectedPlayer tables. -->
[[Special:MyLanguage/FBInstant.player.getDataAsync|FBInstant.player.getDataAsync]] ''<translate>Retrieve data from the designated cloud storage of the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.getDataAsync(keys,callback) Retrieve data from the designated cloud storage of the current player. -->
[[Special:MyLanguage/FBInstant.player.getID|FBInstant.player.getID]] ''<translate>A unique identifier for the player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.getID() A unique identifier for the player. -->
[[Special:MyLanguage/FBInstant.player.getName|FBInstant.player.getName]] ''<translate>The player's localized display name.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.getName() The player's localized display name. -->
[[Special:MyLanguage/FBInstant.player.getPhoto|FBInstant.player.getPhoto]] ''<translate>A url to the player's public profile photo.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.getPhoto() A url to the player's public profile photo. -->
[[Special:MyLanguage/FBInstant.player.getSignedPlayerInfoAsync|FBInstant.player.getSignedPlayerInfoAsync]] ''<translate>Fetch the player's unique identifier along with a signature.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.getSignedPlayerInfoAsync(requestPayload,callback) Fetch the player's unique identifier along with a signature. -->
[[Special:MyLanguage/FBInstant.player.getStatsAsync|FBInstant.player.getStatsAsync]] ''<translate>Retrieve stats from the designated cloud storage of the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.getStatsAsync(keys,callback) Retrieve stats from the designated cloud storage of the current player. -->
[[Special:MyLanguage/FBInstant.player.incrementStatsAsync|FBInstant.player.incrementStatsAsync]] ''<translate>Increment stats saved in the designated cloud storage of the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.incrementStatsAsync(keys-value-pairs,callback) Increment stats saved in the designated cloud storage of the current player. -->
[[Special:MyLanguage/FBInstant.player.setDataAsync|FBInstant.player.setDataAsync]] ''<translate>Set data to be saved to the designated cloud storage of the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.setDataAsync(keys-value-pairs,callback) Set data to be saved to the designated cloud storage of the current player. -->
[[Special:MyLanguage/FBInstant.player.setStatsAsync|FBInstant.player.setStatsAsync]] ''<translate>Set stats to be saved to the designated cloud storage of the current player.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.setStatsAsync(keys-value-pairs,callback) Set stats to be saved to the designated cloud storage of the current player. -->
[[Special:MyLanguage/FBInstant.player.subscribeBotAsync|FBInstant.player.subscribeBotAsync]] ''<translate>Request that the player subscribe the bot associated to the game.</translate>''<br/><!-- GIDEROSMTD:FBInstant.player.subscribeBotAsync(callback) Request that the player subscribe the bot associated to the game. -->
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
=== <translate>Constants</translate> ===
|}
{{Facebook Instant Games}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Player|Player]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Immediately flushes any changes to the player data to the designated cloud storage. This function is expensive, and should primarily be used for critical changes where persistence needs to be immediate and known by the game. Non-critical changes should rely on the platform to persist them in the background. NOTE: Calls to player.setDataAsync will be rejected while this function's result is pending.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.player.flushDataAsync(callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''callback''': (function) <translate>A function that will be called with two arguments: true when changes have been persisted successfully or nil if the operation failed, and an error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.player.setDataAsync({achievements={"medal1","medal2","medal3"},currentLife=300}, function(result,error)
if result then
FBInstant.player.flushDataAsync(function (result,error)
if result then
print("Data persisted to FB!")
end
end)
end
end)
<br/></syntaxhighlight>
{{FBInstant.player}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Player|Player]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Fetches a table of ConnectedPlayer tables containing information about players that are connected to the current player.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.player.getConnectedPlayersAsync(callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''callback''': (function) <translate>A function that will be called with two arguments: a set of key-value pairs or nil is the operation failed, and an error code if the function failed. NOTE: This promise will not resolve until FBInstant.startGameAsync() has resolved.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example 1'''<br/>
<syntaxhighlight lang="lua">
FBInstant.player.getConnectedPlayersAsync(function(result,error)
if result then
print("Connected players:",#result)
for loop=1,#result do
local player=result[loop]
for key,value in pairs(player) do
print(key,value)
end
end
end
end)
<br/></syntaxhighlight>
'''Example 2'''<br/>
<syntaxhighlight lang="lua">
FBInstant.player.getConnectedPlayersAsync(function(result,error)
if result then
print("Connected players:",#result)
for loop=1,#result do
local player=result[loop]
print("id, name, photo:",player.getID(),player.getName(),player.getPhoto())
end
end
end)
<br/></syntaxhighlight>
{{FBInstant.player}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Player|Player]]<br/>
=== <translate>Description</translate> ===
<translate><br />
A url to the player's public profile photo. The photo will always be a square, and with dimensions of at least 200x200. When rendering it in the game, the exact dimensions should never be assumed to be constant. It's recommended to always scale the image to a desired size before rendering. The value will always be null until FBInstant.startGameAsync() resolves.<br /><br />
WARNING: Due to CORS, using these photos in the game canvas can cause it to be tainted, which will prevent the canvas data from being extracted. To prevent this, set the cross-origin attribute of the images you use to 'anonymous'.<br />
<br /></translate>
<syntaxhighlight lang="lua">
(string) = FBInstant.player.getPhoto()
</syntaxhighlight>
=== <translate>Return values</translate> ===
'''<translate>Returns</translate>''' (string) <translate>Url to the player's public profile photo.</translate><br/>
{{FBInstant.player}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Player|Player]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Retrieve stats from the designated cloud storage of the current player.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.player.getStatsAsync(keys,callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''keys''': (table) <translate>An optional table of unique keys to retrieve stats for. If the function is called with it nil, it will fetch all stats.</translate> <br/>
'''callback''': (function) <translate>A function that will be called with two arguments: a set of key-value pairs or nil is the operation failed, and an error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.player.getDataAsync({"level","zombiesSlain"}, function(result,error)
if result then
print("stats are loaded")
for key,value in pairs(result) do
print(key,value)
end
end
end)
<br/></syntaxhighlight>
{{FBInstant.player}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Player|Player]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Increment stats saved in the designated cloud storage of the current player.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.player.incrementStatsAsync(keyValuePairs,callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''keys-value-pairs''': (table) <translate>A table containing a set of key-value pairs indicating how much to increment each stat in cloud storage. The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected.</translate> <br/>
'''callback''': (function) <translate>A function that will be called with two arguments: a table which contains the updated key-value pairs for each key specified in the input dictionary or nil if the operation failed, and an error code if the function failed. NOTE: The table does not necessarily mean that the changes have already been persisted. Rather, it means that the increments were valid and have been scheduled to be performed. It also guarantees that all values that were incremented are now available in player.getStatsAsync.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.player.incrementStatsAsync({level=1,zombiesSlain=17,rank=-1}, function(result,error)
if result then
print("increments have been made! New values:")
for key,value in pairs(result) do
print(key,value)
end
end
end)
<br/></syntaxhighlight>
{{FBInstant.player}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Player|Player]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Set stats to be saved to the designated cloud storage of the current player.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.player.setStatsAsync(keyValuePairs,callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''keys-value-pairs''': (table) <translate>A table containing a set of key-value pairs that should be persisted to cloud storage as stats, which can be surfaced or used in a variety of ways to benefit player engagement. The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected.</translate> <br/>
'''callback''': (function) <translate>A function that will be called with two arguments: true or nil if the operation failed, and an error code if the function failed. NOTE: True does not necessarily mean that the input has already been persisted. Rather, it means that the data was valid and has been scheduled to be saved. It also guarantees that all values that were set are now available in player.getDataAsync</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.player.setStatsAsync({level=5,zombiesSlain=27}, function(result,error)
if result then
print("data is set")
end
end)
<br/></syntaxhighlight>
{{FBInstant.player}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.3<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/* Initialisation and Core|* Initialisation and Core]]<br/>
=== <translate>Description</translate> ===
<translate><br />
This indicates that the game has finished initial loading and is ready to start. Context information will be up-to-date when the returned promise resolves.<br />
<br /></translate>
<syntaxhighlight lang="lua">
FBInstant.startGameAsync(callback)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''callback''': (function) <translate>A function that will be called with two arguments: True when the game should start or nil if the operation failed, and an error code if the function failed.</translate> <br/>
=== <translate>Examples</translate> ===
'''Example'''<br/>
<syntaxhighlight lang="lua">
FBInstant.startGameAsync( function(result,error)
if result then
-- don't call context api until here!
end
end)
<br/></syntaxhighlight>
{{FBInstant}}__NOTOC__
<languages />
<!-- GIDEROSOBJ:Facebook -->
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/EventDispatcher|EventDispatcher]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Facebook SDK plugin is available for only iOS as an external plugin. To use facebook module:<br />
<br />
1. Download and install Facebook SDK from https://developers.facebook.com/ios/downloads/<br />
2. Add FacebookSDK.framework to your project.<br />
3. Add the backward compatibility headers as described https://developers.facebook.com/docs/howtos/feed-dialog-using-ios-sdk/#step2<br />
4. Add {Gideros Installation Directory}/All Plugins/Facebook/source/iOS/* files to your Xcode project.<br />
5. If enabled, disable "Application does not run in background" property in .plist file.<br />
<br />
The [[Special:MyLanguage/Facebook|Facebook]] class is defined in module "facebook". Therefore, you need to call<br />
''require("facebook")'' before using it. Loading the Facebook module <br />
also creates a global variable ''facebook'' of type [[Special:MyLanguage/Facebook|Facebook]] for direct use. <br /></translate>
{|-
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
[[Special:MyLanguage/Facebook:authorize|Facebook:authorize]] <br/><!-- GIDEROSMTD:Facebook:authorize(permissions) -->
[[Special:MyLanguage/Facebook:dialog|Facebook:dialog]] <br/><!-- GIDEROSMTD:Facebook:dialog(action,paramaters) -->
[[Special:MyLanguage/Facebook:extendAccessToken|Facebook:extendAccessToken]] <br/><!-- GIDEROSMTD:Facebook:extendAccessToken() -->
[[Special:MyLanguage/Facebook:extendAccessTokenIfNeeded|Facebook:extendAccessTokenIfNeeded]] <br/><!-- GIDEROSMTD:Facebook:extendAccessTokenIfNeeded() -->
[[Special:MyLanguage/Facebook:getAccessToken|Facebook:getAccessToken]] <br/><!-- GIDEROSMTD:Facebook:getAccessToken() -->
[[Special:MyLanguage/Facebook:getExpirationDate|Facebook:getExpirationDate]] <br/><!-- GIDEROSMTD:Facebook:getExpirationDate() -->
[[Special:MyLanguage/Facebook:graphRequest|Facebook:graphRequest]] <br/><!-- GIDEROSMTD:Facebook:graphRequest(graphPath,paramaters,method) -->
[[Special:MyLanguage/Facebook:isSessionValid|Facebook:isSessionValid]] <br/><!-- GIDEROSMTD:Facebook:isSessionValid() -->
[[Special:MyLanguage/Facebook:logout|Facebook:logout]] <br/><!-- GIDEROSMTD:Facebook:logout() -->
[[Special:MyLanguage/Facebook:setAccessToken|Facebook:setAccessToken]] <br/><!-- GIDEROSMTD:Facebook:setAccessToken(accessToken) -->
[[Special:MyLanguage/Facebook:setAppId|Facebook:setAppId]] <br/><!-- GIDEROSMTD:Facebook:setAppId(appId) -->
[[Special:MyLanguage/Facebook:setExpirationDate|Facebook:setExpirationDate]] <br/><!-- GIDEROSMTD:Facebook:setExpirationDate(expirationDate) -->
[[Special:MyLanguage/Facebook:shouldExtendAccessToken|Facebook:shouldExtendAccessToken]] <br/><!-- GIDEROSMTD:Facebook:shouldExtendAccessToken() -->
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
[[Special:MyLanguage/Event.DIALOG_CANCEL|Event.DIALOG_CANCEL]]<br/><!-- GIDEROSEVT:Event.DIALOG_CANCEL dialogCancel-->
[[Special:MyLanguage/Event.DIALOG_COMPLETE|Event.DIALOG_COMPLETE]]<br/><!-- GIDEROSEVT:Event.DIALOG_COMPLETE dialogComplete-->
[[Special:MyLanguage/Event.DIALOG_ERROR|Event.DIALOG_ERROR]]<br/><!-- GIDEROSEVT:Event.DIALOG_ERROR dialogError-->
[[Special:MyLanguage/Event.LOGIN_CANCEL|Event.LOGIN_CANCEL]]<br/><!-- GIDEROSEVT:Event.LOGIN_CANCEL loginCancel-->
[[Special:MyLanguage/Event.LOGIN_COMPLETE|Event.LOGIN_COMPLETE]]<br/><!-- GIDEROSEVT:Event.LOGIN_COMPLETE loginComplete-->
[[Special:MyLanguage/Event.LOGIN_ERROR|Event.LOGIN_ERROR]]<br/><!-- GIDEROSEVT:Event.LOGIN_ERROR loginError-->
[[Special:MyLanguage/Event.LOGOUT_COMPLETE|Event.LOGOUT_COMPLETE]]<br/><!-- GIDEROSEVT:Event.LOGOUT_COMPLETE logoutComplete-->
[[Special:MyLanguage/Event.REQUEST_COMPLETE|Event.REQUEST_COMPLETE]]<br/><!-- GIDEROSEVT:Event.REQUEST_COMPLETE requestComplete-->
[[Special:MyLanguage/Event.REQUEST_ERROR|Event.REQUEST_ERROR]]<br/><!-- GIDEROSEVT:Event.REQUEST_ERROR requestError-->
=== <translate>Constants</translate> ===
|}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Facebook|Facebook]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Makes a request to the Graph API.<br />
<br /></translate>
<syntaxhighlight lang="lua">
Facebook:graphRequest(graphPath,paramaters,method)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''graphPath''': (string) <translate>The path to the Graph API endpoint. For example, to fetch data about the currently logged in user this parameter should be ''me'', representing a call to the https://graph.facebook.com/me endpoint.</translate> <br/>
'''paramaters''': (table, optional) <translate>Table representing the API call parameters.</translate> <br/>
'''method''': (string, optional) <translate>HTTP method.</translate> <br/>__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Facebook|Facebook]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Checks if the access token is available and has not expired.<br />
<br /></translate>
<syntaxhighlight lang="lua">
(bool) = Facebook:isSessionValid()
</syntaxhighlight>
=== <translate>Return values</translate> ===
'''<translate>Returns</translate>''' (bool) <translate>''true'' if the access token is valid, ''false'' otherwise.</translate><br/>__NOTOC__
<!-- GIDEROSOBJ:Facebook Instant Games -->
'''Supported platforms:''' [[File:Platform html5.png]]<br/>
'''Available since:''' Gideros 2018.3<br/>
=== Description ===
Adds Facebook Instant Games framework to your project.
You need to do two things to target Facebook Instant Games:
# Tick the Facebook Instant Game tickbox when exporting to HTML5, you can also specify the percentage indicator that the game will show it has loaded before you take control.
# Require the FBInstant library code, see the example below.
You can upload, debug and test your game by creating a player and uploading to Facebook servers as a game. The player will interact with the Gideros Studio similar to any other player.
The only restriction with the player is that it only works on the computer viewing the html5 game (localhost) - this would normally rule out actual phones but there is a workaround for Android:
# Connect your Android phone to your computer using ADB.
# Type in this command in a command console shell (Windows) or terminal (Mac): '''adb reverse tcp:15001 tcp:15001'''
# The Android device now will see the Gideros Studio when testing the game when a player is launched from within Facebook Messenger.
Please refer to the https://developers.facebook.com/docs/games/instant-games/getting-started/quickstart original Facebook documentation for more information about testing and uploading.
'''note:''' the official Facebook documentation mentions having to wait for initializeAsync, with Gideros this has already been done for you before your game starts.
=== Old Documentation (Obsolete) ===
[[* Initialisation and Core]]
=== Classes ===
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">
[[FBInstant]] ''Facebook Instant Games Initialisation and Core''<br/><!--GIDEROSOBJ:FBInstant Facebook Instant Games Initialisation and Core-->
[[FBInstant.context]] ''contains functions and properties related to the current game context''<br/><!--GIDEROSOBJ:FBInstant.context contains functions and properties related to the current game context-->
[[FBInstant.payments]] ''contains functions and properties related to payments and purchases of game products''<br/><!--GIDEROSOBJ:FBInstant.payments contains functions and properties related to payments and purchases of game products-->
[[FBInstant.player]] ''contains functions and properties related to the current player''<br/><!--GIDEROSOBJ:FBInstant.player contains functions and properties related to the current player-->
</div>
{{GIDEROS IMPORTANT LINKS}}__NOTOC__
<!-- GIDEROSOBJ:flurry -->
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]]<br/>
'''Available since:''' Gideros 2011.6<br/>
'''<big>Flurry Mobile Analytics, including SDK and Analytics UI, will sunset on <span style="color:#ff0000">March 15, 2024</span>.</big>'''
=== Description ===
This table stores all the functions related to Flurry analytics library.
Flurry is available only for iOS and Android. To use flurry:
# create an account on https://www.flurry.com/ and follow the instructions about creating a new application
'''For iOS''' (external plugin):
# download Flurry header and libraries and add them to your Xcode project
# add {Gideros Installation Directory}/All Plugins/Flurry/source/iOS/flurry.mm file to your Xcode project
To load the Flurry library, add the Flurry '''plugin''' to your app and the following code:
<syntaxhighlight lang="lua">
if application:getDeviceInfo() == "Android" or application:getDeviceInfo() == "iOS" then
require "flurry"
end
</syntaxhighlight>
=== Example ===
<syntaxhighlight lang="lua">
if application:getDeviceInfo() == "Android" or application:getDeviceInfo() == "iOS" then
local api_key = "your flurry app key" -- if empty the app will crash!
if flurry ~= nil and flurry.isAvailable() then
print("Flurry is available")
flurry.startSession(api_key)
flurry.logEvent("test_event", { name="test" } )
else
print("Flurry is not available")
end
end
</syntaxhighlight>
{|-
| style="width: 50%; vertical-align:top;"|
=== Methods ===
[[flurry.endTimedEvent]] ''ends Flurry timed event''<br/><!--GIDEROSMTD:flurry.endTimedEvent(eventName,parameters) ends Flurry timed event-->
[[flurry.isAvailable]] ''returns true if Flurry is available''<br/><!--GIDEROSMTD:flurry.isAvailable() returns true if Flurry is available-->
[[flurry.logEvent]] ''logs Flurry event''<br/><!--GIDEROSMTD:flurry.logEvent(eventName,parameters,timed) logs Flurry event-->
[[flurry.startSession]] ''starts the Flurry session with your API key''<br/><!--GIDEROSMTD:flurry.startSession(apiKey) starts the Flurry session with your API key-->
| style="width: 50%; vertical-align:top;"|
=== Events ===
=== Constants ===
|}
{{GIDEROS IMPORTANT LINKS}}__NOTOC__
'''Available since:''' Gideros 2011.6<br/>
'''Class:''' [[Flurry]]<br/>
=== Description ===
Starts the Flurry session with your API key.
<syntaxhighlight lang="lua">
flurry.startSession(apiKey)
</syntaxhighlight>
'''If the API key is nil or an empty string, your app may crash'''
To create an account on Flurry and to obtain the API key specific to your application, please visit https://www.flurry.com/ and follow the instructions there.
You need to call this function once after your application starts. For example, ''init.lua'' is suitable to call this function.
=== Parameters ===
'''apiKey''': (string) the Flurry API key<br/>
{{Flurry}}__NOTOC__
<!-- GIDEROSOBJ:Font -->
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
'''Available since:''' Gideros 2011.6<br/>
'''Inherits from:''' [[FontBase]]<br/>
=== Description ===
The '''Font''' class is used to load fonts created by "Gideros Font Creator".
[[File:Font creator.png]]
Gideros Font Creator exports two files:
* a ''.txt'' file that specifies the positions of the character glyphs
* a ''.png'' file of the font
=== Example ===
'''Use these two files to create a Font object'''
<syntaxhighlight lang="lua">
local font = Font.new("font.txt", "font.png")
</syntaxhighlight>
{|-
| style="width: 50%; vertical-align:top;"|
=== Methods ===
[[Font.getDefault]] ''gets the default font''<br/><!--GIDEROSMTD:Font.getDefault() gets the default font-->
[[Font.new]] ''creates a new Font object''<br/><!--GIDEROSMTD:Font.new(txtfile,imagefile,filtering) creates a new Font object-->
| style="width: 50%; vertical-align:top;"|
=== Events ===
=== Constants ===
|}
{{GIDEROS IMPORTANT LINKS}}'''Available since:''' Gideros 2015.08<br/>
'''Class:''' [[Font]]<br/>
=== Description ===
Returns the '''Font''' object used as the default font in Gideros.
<syntaxhighlight lang="lua">
Font.getDefault()
</syntaxhighlight>
{{Font}}'''Available since:''' Gideros 2011.6<br/>
'''Class:''' [[Font]]<br/>
=== Description ===
Creates a new '''Font''' object.
<syntaxhighlight lang="lua">
Font.new(txtfile,imagefile,filtering)
</syntaxhighlight>
=== Parameters ===
'''txtfile''': (string) path to the font text file<br/>
'''imagefile''': (string) path to the font image file<br/>
'''filtering''': (boolean) whether or not the font texture is filtered (default = false)<br/>
{{Font}}__NOTOC__
<!-- GIDEROSOBJ:FontBase -->
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
'''Available since:''' Gideros 2011.6<br/>
'''Inherits from:''' [[Object]]<br/>
=== Description ===
'''FontBase''' is the base class for Font and TTFont classes.
{|-
| style="width: 50%; vertical-align:top;"|
=== Methods ===
[[FontBase:getAdvanceX]] ''returns the width of the first character''<br/><!--GIDEROSMTD:FontBase:getAdvanceX(text,letterSpacing,size) returns the width of the first character-->
[[FontBase:getAscender]] ''returns the ascender of the font''<br/><!--GIDEROSMTD:FontBase:getAscender() returns the ascender of the font-->
[[FontBase:getBounds]] ''returns the tight bounding rectangle of the characters in the string specified by text''<br/><!--GIDEROSMTD:FontBase:getBounds(text) returns the tight bounding rectangle of the characters in the string specified by text-->
[[FontBase:getCharIndexAtOffset]] ''returns the offset within the given text string''<br/><!--GIDEROSMTD:FontBase:getCharIndexAtOffset(text,offset,letterSpacing,size) returns the offset within the given text string-->
[[FontBase:getLineHeight]] ''returns the distance from one base line to the next''<br/><!--GIDEROSMTD:FontBase:getLineHeight() returns the distance from one base line to the next-->
[[FontBase:layoutText]] ''computes the text layout with given constraints''<br/><!--GIDEROSMTD:FontBase:layoutText(text,width,height,flags,letterSpacing,lineSpacing,tabSpace,breakChar) computes the text layout with given constraints-->
| style="width: 50%; vertical-align:top;"|
=== Events ===
=== Constants ===
'''[[FontBase Constants]]'''
<!--GIDEROSCST:FontBase.TLF_BOTTOM TLF_BOTTOM-->
<!--GIDEROSCST:FontBase.TLF_BREAKWORDS TLF_BREAKWORDS-->
<!--GIDEROSCST:FontBase.TLF_CENTER TLF_CENTER-->
<!--GIDEROSCST:FontBase.TLF_JUSTIFIED TLF_JUSTIFIED-->
<!--GIDEROSCST:FontBase.TLF_LEFT TLF_LEFT-->
<!--GIDEROSCST:FontBase.TLF_LTR TLF_LTR-->
<!--GIDEROSCST:FontBase.TLF_NOBIDI TLF_NOBIDI-->
<!--GIDEROSCST:FontBase.TLF_NOSHAPING TLF_NOSHAPING-->
<!--GIDEROSCST:FontBase.TLF_NOWRAP TLF_NOWRAP-->
<!--GIDEROSCST:FontBase.TLF_REF_ASCENT TLF_REF_ASCENT-->
<!--GIDEROSCST:FontBase.TLF_REF_BASELINE TLF_REF_BASELINE-->
<!--GIDEROSCST:FontBase.TLF_REF_BOTTOM TLF_REF_BOTTOM-->
<!--GIDEROSCST:FontBase.TLF_REF_DESCENT TLF_REF_DESCENT-->
<!--GIDEROSCST:FontBase.TLF_REF_LINETOP TLF_REF_LINETOP-->
<!--GIDEROSCST:FontBase.TLF_REF_MEDIAN TLF_REF_MEDIAN-->
<!--GIDEROSCST:FontBase.TLF_REF_MIDDLE TLF_REF_MIDDLE-->
<!--GIDEROSCST:FontBase.TLF_REF_TOP TLF_REF_TOP-->
<!--GIDEROSCST:FontBase.TLF_RIGHT TLF_RIGHT-->
<!--GIDEROSCST:FontBase.TLF_RTL TLF_RTL-->
<!--GIDEROSCST:FontBase.TLF_TOP TLF_TOP-->
<!--GIDEROSCST:FontBase.TLF_VCENTER TLF_VCENTER-->
|}
{{GIDEROS IMPORTANT LINKS}}'''Available since:''' Gideros 2011.6<br/>
'''Class:''' [[FontBase]]<br/>
=== Description ===
Returns the tight bounding rectangle of the characters in the string specified by ''text''.
<syntaxhighlight lang="lua">
(number), (number), (number), (number) = FontBase:getBounds(text)
</syntaxhighlight>
=== Parameters ===
'''text''': (string) <br/>
=== Return values ===
'''Returns''' (number) x coordinate of the bound <br/>
'''Returns''' (number) y coordinate of the bound <br/>
'''Returns''' (number) width of the bound <br/>
'''Returns''' (number) height of the bound <br/>
{{FontBase}}'''Available since:''' Gideros 2011.6<br/>
'''Class:''' [[FontBase]]<br/>
=== Description ===
Returns the distance from one base line to the next.
<syntaxhighlight lang="lua">
(number) = FontBase:getLineHeight()
</syntaxhighlight>
=== Return values ===
'''Returns''' (number) The distance from one base line to the next.<br/>
{{FontBase}}__NOTOC__
<!-- GIDEROSOBJ:Gaming -->
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]]<br/>
'''Available since:''' Gideros 2012.09<br/>
=== Description ===
The '''Gaming''' class currently supports:
*Gaming.new("googleplay") -- Android
*Gaming.new("gamekit") -- iOS
<syntaxhighlight lang="lua">
require("gaming")
</syntaxhighlight>
Loading the '''gaming''' module also creates a global class '''Gaming'''.
{|-
| style="width: 50%; vertical-align:top;"|
=== Methods ===
[[Gaming.new]] ''instantiate the Gaming plugin''<br/><!--GIDEROSMTD:Gaming.new(backend) instantiate the Gaming plugin-->
[[Gaming:autoMatch]] <br/><!--GIDEROSMTD:Gaming:autoMatch()-->
[[Gaming:deleteState]] ''remove the specified save/state''<br/><!--GIDEROSMTD:Gaming:deleteState(key) remove the specified save/state-->
[[Gaming:getAllPlayers]] <br/><!--GIDEROSMTD:Gaming:getAllPlayers()-->
[[Gaming:getPlayerId]] ''get the id of current player''<br/><!--GIDEROSMTD:Gaming:getPlayerId() get the id of current player-->
[[Gaming:getPlayerInfo]] <br/><!--GIDEROSMTD:Gaming:getPlayerInfo()-->
[[Gaming:getPlayerName]] ''get the name of current player''<br/><!--GIDEROSMTD:Gaming:getPlayerName() get the name of current player-->
[[Gaming:getPlayerPicture]] ''get the profile picture of current player''<br/><!--GIDEROSMTD:Gaming:getPlayerPicture() get the profile picture of current player-->
[[Gaming:getPlayerScore]] ''get the score of current player''<br/><!--GIDEROSMTD:Gaming:getPlayerScore() get the score of current player-->
[[Gaming:incrementAchievement]] ''increment the progress toward an achievement''<br/><!--GIDEROSMTD:Gaming:incrementAchievement(achievementId,numSteps,immediate) increment the progress toward an achievement-->
[[Gaming:invitePlayers]] <br/><!--GIDEROSMTD:Gaming:invitePlayers()-->
[[Gaming:isLoggedIn]] ''return the login state in Gaming service''<br/><!--GIDEROSMTD:Gaming:isLoggedIn() return the login state in Gaming service-->
[[Gaming:joinRoom]] <br/><!--GIDEROSMTD:Gaming:joinRoom()-->
[[Gaming:loadAchievements]] ''load all achievements''<br/><!--GIDEROSMTD:Gaming:loadAchievements() load all achievements-->
[[Gaming:loadPlayerCenteredScores]] ''load a leaderboard centered on the player''<br/><!--GIDEROSMTD:Gaming:loadPlayerCenteredScores(leaderboardId,timeSpan,collection,maxEntries) load a leaderboard centered on the player-->
[[Gaming:loadScores]] ''load a leaderboard''<br/><!--GIDEROSMTD:Gaming:loadScores(leaderboardId,timeSpan,collection,maxEntries) load a leaderboard-->
[[Gaming:loadState]] ''load a save/state''<br/><!--GIDEROSMTD:Gaming:loadState(key) load a save/state-->
[[Gaming:login]] ''log in the Gaming service''<br/><!--GIDEROSMTD:Gaming:login() log in the Gaming service-->
[[Gaming:logout]] ''log out of the gaming service''<br/><!--GIDEROSMTD:Gaming:logout() log out of the gaming service-->
[[Gaming:reportAchievement]] ''report an achievement progress''<br/><!--GIDEROSMTD:Gaming:reportAchievement(achievementId,numSteps,immediate) report an achievement progress-->
[[Gaming:reportScore]] ''report a new score''<br/><!--GIDEROSMTD:Gaming:reportScore(leaderboardId,score,immediate) report a new score-->
[[Gaming:resolveState]] ''resolve a save/state conflict''<br/><!--GIDEROSMTD:Gaming:resolveState(key,version,data) resolve a save/state conflict-->
[[Gaming:revealAchievement]] ''reveal an achievement''<br/><!--GIDEROSMTD:Gaming:revealAchievement(achievementId,immediate) reveal an achievement-->
[[Gaming:sendTo]] <br/><!--GIDEROSMTD:Gaming:sendTo()-->
[[Gaming:sendToAll]] <br/><!--GIDEROSMTD:Gaming:sendToAll()-->
[[Gaming:showAchievements]] ''show the achievements''<br/><!--GIDEROSMTD:Gaming:showAchievements() show the achievements-->
[[Gaming:showInvitations]] <br/><!--GIDEROSMTD:Gaming:showInvitations()-->
[[Gaming:showLeaderboard]] ''show a leaderboard''<br/><!--GIDEROSMTD:Gaming:showLeaderboard(leaderboardId) show a leaderboard-->
[[Gaming:showWaitingRoom]] ''display the waiting room''<br/><!--GIDEROSMTD:Gaming:showWaitingRoom() display the waiting room-->
[[Gaming:updateState]] ''update a save/state''<br/><!--GIDEROSMTD:Gaming:updateState(key,data,immediate) update a save/state-->
|style="width: 50%; vertical-align:top;"|
=== Events ===
[[Event.CONNECTED_TO_ROOM]]<br/><!--GIDEROSEVT:Event.CONNECTED_TO_ROOM conntectedToRoom-->
[[Event.DATA_RECEIVED]]<br/><!--GIDEROSEVT:Event.DATA_RECEIVED dataReceived-->
[[Event.DISCONNECTED_FROM_ROOM]]<br/><!--GIDEROSEVT:Event.DISCONNECTED_FROM_ROOM disconntectedFromRoom-->
[[Event.GAME_STARTED]]<br/><!--GIDEROSEVT:Event.GAME_STARTED gameStarted-->
[[Event.INVITATION_RECEIVED]]<br/><!--GIDEROSEVT:Event.INVITATION_RECEIVED invitationReceived-->
[[Event.JOINED_ROOM]]<br/><!--GIDEROSEVT:Event.JOINED_ROOM joinedRoom-->
[[Event.LEFT_ROOM]]<br/><!--GIDEROSEVT:Event.LEFT_ROOM leftRoom-->
[[Event.LOAD_ACHIEVEMENTS_COMPLETE]]<br/><!--GIDEROSEVT:Event.LOAD_ACHIEVEMENTS_COMPLETE loadAchievementsComplete-->
[[Event.LOAD_ACHIEVEMENTS_ERROR]]<br/><!--GIDEROSEVT:Event.LOAD_ACHIEVEMENTS_ERROR loadAchievementsError-->
[[Event.LOAD_SCORES_COMPLETE]]<br/><!--GIDEROSEVT:Event.LOAD_SCORES_COMPLETE loadScoresComplete-->
[[Event.LOAD_SCORES_ERROR]]<br/><!--GIDEROSEVT:Event.LOAD_SCORES_ERROR loadScoresComplete-->
[[Event.LOGIN_COMPLETE]]<br/><!--GIDEROSEVT:Event.LOGIN_COMPLETE loginComplete-->
[[Event.LOGIN_ERROR]]<br/><!--GIDEROSEVT:Event.LOGIN_ERROR loginError-->
[[Event.PEER_CONNECTED]]<br/><!--GIDEROSEVT:Event.PEER_CONNECTED peerConnected-->
[[Event.PEER_DECLINED]]<br/><!--GIDEROSEVT:Event.PEER_DECLINED peerDeclined-->
[[Event.PEER_DISCONNECTED]]<br/><!--GIDEROSEVT:Event.PEER_DISCONNECTED peerDisconnected-->
[[Event.PEER_INVITED]]<br/><!--GIDEROSEVT:Event.PEER_INVITED peerInvited-->
[[Event.PEER_JOINED]]<br/><!--GIDEROSEVT:Event.PEER_JOINED peerJoined-->
[[Event.PEER_LEFT]]<br/><!--GIDEROSEVT:Event.PEER_LEFT peerLeft-->
[[Event.PLAYER_INFORMATION_COMPLETE]]<br/><!--GIDEROSEVT:Event.PLAYER_INFORMATION_COMPLETE playerInformationComplete-->
[[Event.PLAYER_INFORMATION_ERROR]]<br/><!--GIDEROSEVT:Event.PLAYER_INFORMATION_ERROR playerInformationError-->
[[Event.PLAYER_SCORE_COMPLETE]]<br/><!--GIDEROSEVT:Event.PLAYER_SCORE_COMPLETE playerScoreComplete-->
[[Event.PLAYER_SCORE_ERROR]]<br/><!--GIDEROSEVT:Event.PLAYER_SCORE_ERROR playerScoreError-->
[[Event.REPORT_ACHIEVEMENT_COMPLETE]]<br/><!--GIDEROSEVT:Event.REPORT_ACHIEVEMENT_COMPLETE reportAchievementComplete-->
[[Event.REPORT_ACHIEVEMENT_ERROR]]<br/><!--GIDEROSEVT:Event.REPORT_ACHIEVEMENT_ERROR reportAchievementError-->
[[Event.REPORT_SCORE_COMPLETE]]<br/><!--GIDEROSEVT:Event.REPORT_SCORE_COMPLETE reportScoreComplete-->
[[Event.REPORT_SCORE_ERROR]]<br/><!--GIDEROSEVT:Event.REPORT_SCORE_ERROR reportScoreError-->
[[Event.ROOM_AUTO_MATCHING]]<br/><!--GIDEROSEVT:Event.ROOM_AUTO_MATCHING roomAutoMatching-->
[[Event.ROOM_CONNECTED]]<br/><!--GIDEROSEVT:Event.ROOM_CONNECTED roomConnected-->
[[Event.ROOM_CONNECTING]]<br/><!--GIDEROSEVT:Event.ROOM_CONNECTING roomConnecting-->
[[Event.ROOM_CREATED]]<br/><!--GIDEROSEVT:Event.ROOM_CREATED roomCreated-->
[[Event.STATE_CONFLICT]]<br/><!--GIDEROSEVT:Event.STATE_CONFLICT stateConflict-->
[[Event.STATE_DELETED]]<br/><!--GIDEROSEVT:Event.STATE_DELETED stateDeleted-->
[[Event.STATE_ERROR]]<br/><!--GIDEROSEVT:Event.STATE_ERROR stateError-->
[[Event.STATE_LOADED]]<br/><!--GIDEROSEVT:Event.STATE_LOADED stateLoaded-->
=== Constants ===
[[Gaming.ALL_PLAYERS]]<br/><!--GIDEROSCST:Gaming.ALL_PLAYERS 1-->
[[Gaming.ALL_TIME]]<br/><!--GIDEROSCST:Gaming.ALL_TIME 2-->
[[Gaming.FRIENDS]]<br/><!--GIDEROSCST:Gaming.FRIENDS 0-->
[[Gaming.HIDDEN]]<br/><!--GIDEROSCST:Gaming.HIDDEN 2-->
[[Gaming.REVEALED]]<br/><!--GIDEROSCST:Gaming.REVEALED 1-->
[[Gaming.TODAY]]<br/><!--GIDEROSCST:Gaming.TODAY 0-->
[[Gaming.UNLOCKED]]<br/><!--GIDEROSCST:Gaming.UNLOCKED 0-->
[[Gaming.WEEK]]<br/><!--GIDEROSCST:Gaming.WEEK 1-->
|}
{{GIDEROS IMPORTANT LINKS}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gaming|Gaming]]<br/>
=== <translate>Description</translate> ===
<translate><br /></translate>
<syntaxhighlight lang="lua">
Gaming:autoMatch()
</syntaxhighlight>
{{Gaming}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2018.9<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gaming|Gaming]]<br/>
=== <translate>Description</translate> ===
<translate>Returns true if we are logged in.</translate>
<syntaxhighlight lang="lua">
(bool) = Gaming:isLoggedIn()
</syntaxhighlight>
=== <translate>Return values</translate> ===
'''<translate>Returns</translate>''' (bool) <translate>''true'' if Gaming is logged in, ''false'' otherwise.</translate><br/>
{{Gaming}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gaming|Gaming]]<br/>
=== <translate>Description</translate> ===
<translate>Fetch player leaderboard entries. Either [[Special:MyLanguage/Event.PLAYER_SCORE_COMPLETE|Event.PLAYER_SCORE_COMPLETE]] or [[Special:MyLanguage/Event.PLAYER_SCORE_ERROR|Event.PLAYER_SCORE_ERROR]] will be triggered.</translate>
<syntaxhighlight lang="lua">
Gaming:loadPlayerCenteredScores(leaderboardId,timeSpan,collection,maxEntries)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''leaderboardId''': (string) <translate>Leaderboard Id</translate> <br/>
'''timeSpan''': (number) <translate>Time range: [[Special:MyLanguage/Gaming.TODAY|Gaming.TODAY]], [[Special:MyLanguage/Gaming.WEEK|Gaming.WEEK]] or [[Special:MyLanguage/Gaming.ALL_TIME|Gaming.ALL_TIME]]</translate> '''optional'''<br/>
'''collection''': (number) <translate>Player range: [[Special:MyLanguage/Gaming.FRIENDS|Gaming.FRIENDS]] or [[Special:MyLanguage/Gaming.ALL_PLAYERS|Gaming.ALL_PLAYERS]]</translate> '''optional'''<br/>
'''maxEntries''': (number) <translate>Maximum number of entries to return</translate> '''optional'''<br/>
{{Gaming}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gaming|Gaming]]<br/>
=== <translate>Description</translate> ===
<translate>Fetch leaderboard entries. Either [[Special:MyLanguage/Event.LOAD_SCORES_COMPLETE|Event.LOAD_SCORES_COMPLETE]] or [[Special:MyLanguage/Event.LOAD_SCORES_ERROR|Event.LOAD_SCORES_ERROR]] will be triggered.</translate>
<syntaxhighlight lang="lua">
Gaming:loadScores(leaderboardId,timeSpan,collection,maxEntries)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''leaderboardId''': (string) <translate>Leaderboard Id</translate> <br/>
'''timeSpan''': (number) <translate>Time range: [[Special:MyLanguage/Gaming.TODAY|Gaming.TODAY]], [[Special:MyLanguage/Gaming.WEEK|Gaming.WEEK]] or [[Special:MyLanguage/Gaming.ALL_TIME|Gaming.ALL_TIME]]</translate> '''optional'''<br/>
'''collection''': (number) <translate>Player range: [[Special:MyLanguage/Gaming.FRIENDS|Gaming.FRIENDS]] or [[Special:MyLanguage/Gaming.ALL_PLAYERS|Gaming.ALL_PLAYERS]]</translate> '''optional'''<br/>
'''maxEntries''': (number) <translate>Maximum number of entries to return</translate> '''optional'''<br/>
{{Gaming}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gaming|Gaming]]<br/>
=== <translate>Description</translate> ===
<translate>Load a data element from cloud storage. Either 'Event.STATE_LOADED'', ''Event.STATE_ERROR'' or ''Event.STATE_CONFLICT` will be triggered.</translate>
<syntaxhighlight lang="lua">
Gaming:loadState(key)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''key''': (number) <translate>Key to load</translate> <br/>
{{Gaming}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gaming|Gaming]]<br/>
=== <translate>Description</translate> ===
<translate>Log into the gaming backend, if not already logged in. IF login is issued, events [[Special:MyLanguage/Event.LOGIN_COMPLETE|Event.LOGIN_COMPLETE]] or [[Special:MyLanguage/Event.LOGIN_ERROR|Event.LOGIN_ERROR]]will be triggered.</translate>
<syntaxhighlight lang="lua">
Gaming:login()
</syntaxhighlight>
{{Gaming}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gaming|Gaming]]<br/>
=== <translate>Description</translate> ===
<translate>Logs out from gaming services</translate>
<syntaxhighlight lang="lua">
Gaming:logout()
</syntaxhighlight>
{{Gaming}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gaming|Gaming]]<br/>
=== <translate>Description</translate> ===
<translate>Update a data element in cloud storage. Either [[Special:MyLanguage/Event.STATE_ERROR|Event.STATE_ERROR]] or [[Special:MyLanguage/Event.STATE_CONFLICT|Event.STATE_CONFLICT]] will be triggered.</translate>
<syntaxhighlight lang="lua">
Gaming:updateState(key,data,immediate)
</syntaxhighlight>
=== <translate>Parameters</translate> ===
'''key''': (number) <translate>Key to update</translate> <br/>
'''data''': (string) <translate>New data</translate> <br/>
'''immediate''': (boolean) <translate>Push the update immediately</translate> <br/>
{{Gaming}}__NOTOC__
<!-- GIDEROSOBJ:Geolocation -->
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform winrt.png]]<br/>
'''Available since:''' Gideros 2012.8<br/>
'''Inherits from:''' [[Object]]<br/>
=== Description ===
The '''Geolocation''' Class is used to configure the parameters and dispatching of location and heading related events.
=== Examples ===
<syntaxhighlight lang="lua">
geolocation = Geolocation.new()
local function onLocationUpdate(event)
print("location: ", event.latitude, event.longitude, event.altitude)
end
local function onHeadingUpdate(event)
print("heading: ", event.magneticHeading, event.trueHeading)
end
geolocation:addEventListener(Event.LOCATION_UPDATE, onLocationUpdate)
geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate)
geolocation:start()
</syntaxhighlight>
{|-
| style="width: 50%; vertical-align:top;"|
=== Methods ===
[[Geolocation.getAccuracy]] ''returns the previously set desired accuracy''<br/><!--GIDEROSMTD:Geolocation.getAccuracy() returns the previously set desired accuracy-->
[[Geolocation.getThreshold]] ''returns the previously set minimum distance threshold''<br/><!--GIDEROSMTD:Geolocation.getThreshold() returns the previously set minimum distance threshold-->
[[Geolocation.isAvailable]] ''does this device have the capability to determine current location?''<br/><!--GIDEROSMTD:Geolocation.isAvailable() does this device have the capability to determine current location?-->
[[Geolocation.isHeadingAvailable]] ''does this device have the capability to determine heading?''<br/><!--GIDEROSMTD:Geolocation.isHeadingAvailable() does this device have the capability to determine heading?-->
[[Geolocation.new]] ''creates new Geolocation instance''<br/><!--GIDEROSMTD:Geolocation.new() creates new Geolocation instance-->
[[Geolocation.setAccuracy]] ''sets the accuracy of the location data''<br/><!--GIDEROSMTD:Geolocation.setAccuracy(accuracy) sets the accuracy of the location data-->
[[Geolocation.setThreshold]] ''sets the threshold''<br/><!--GIDEROSMTD:Geolocation.setThreshold(threshold) sets the threshold-->
[[Geolocation:start]] ''starts the generation of updates that report the current location and heading''<br/><!--GIDEROSMTD:Geolocation:start() starts the generation of updates that report the current location and heading-->
[[Geolocation:startUpdatingHeading]] ''starts the generation of updates that report the heading''<br/><!--GIDEROSMTD:Geolocation:startUpdatingHeading() starts the generation of updates that report the heading-->
[[Geolocation:startUpdatingLocation]] ''starts the generation of updates that report the current location''<br/><!--GIDEROSMTD:Geolocation:startUpdatingLocation() starts the generation of updates that report the current location-->
[[Geolocation:stop]] ''stops the generation of updates that report the current location and heading''<br/><!--GIDEROSMTD:Geolocation:stop() stops the generation of updates that report the current location and heading-->
[[Geolocation:stopUpdatingHeading]] ''stops the generation of updates that report the heading''<br/><!--GIDEROSMTD:Geolocation:stopUpdatingHeading() stops the generation of updates that report the heading-->
[[Geolocation:stopUpdatingLocation]] ''stops the generation of updates that report the current location''<br/><!--GIDEROSMTD:Geolocation:stopUpdatingLocation() stops the generation of updates that report the current location-->
| style="width: 50%; vertical-align:top;"|
=== Events ===
[[Event.ERROR]]<br/><!--GIDEROSEVT:Event.ERROR error-->
[[Event.HEADING_UPDATE]]<br/><!--GIDEROSEVT:Event.HEADING_UPDATE headingUpdate-->
[[Event.LOCATION_UPDATE]]<br/><!--GIDEROSEVT:Event.LOCATION_UPDATE locationUpdate-->
=== Constants ===
|}
{{GIDEROS IMPORTANT LINKS}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Geolocation|Geolocation]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Returns the previously set desired accuracy.<br />
<br /></translate>
<syntaxhighlight lang="lua">
(number) = Geolocation.getAccuracy()
</syntaxhighlight>
=== <translate>Return values</translate> ===
'''<translate>Returns</translate>''' (number) <translate>The previously set desired accuracy</translate><br/>
{{Geolocation}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Geolocation|Geolocation]]<br/>
=== <translate>Description</translate> ===
<translate>Creates new Geolocation instance</translate>
<syntaxhighlight lang="lua">
Geolocation.new()
</syntaxhighlight>
{{Geolocation}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Geolocation|Geolocation]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Stops the generation of updates that report the current location and heading.<br />
<br /></translate>
<syntaxhighlight lang="lua">
Geolocation:stop()
</syntaxhighlight>
{{Geolocation}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Geolocation|Geolocation]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Stops the generation of updates that report the current location.<br />
<br /></translate>
<syntaxhighlight lang="lua">
Geolocation:stopUpdatingLocation()
</syntaxhighlight>
{{Geolocation}}__NOTOC__
'''Available since:''' Gideros 2011.6<br/>
'''Class:''' [[(global)]]<br/>
=== Description ===
Returns the current environment in use by the function.
<syntaxhighlight lang="lua">
(table) = getfenv(f)
</syntaxhighlight>
''f'' can be a Lua function or a number that specifies the function at that stack level: Level 1 is the function calling getfenv. If the given function is not a Lua function, or if f is 0, getfenv returns the global environment. The default for f is 1.
=== Parameters ===
'''f''': (varies) function or number(call stack level) '''optional'''<br/>
=== Return values ===
'''Returns''' (table) environment with all the defined values in environment scope<br/>
{{(global)}}The Ultimate Guide to Gideros Studio
__TOC__
== Welcome to Gideros Studio ==
'''IMPORTANT''': '''Gideros 2022.1+ switched to QT6 and 64bit meaning it will only run on:'''
'''*Windows 10+ 64bit'''
'''*OS X Lion 10.7'''
'''*Ubuntu 20.04 (or equivalent distribution)'''
Gideros Studio lets you create rich games and applications for desktop, mobile, HTML5, and various other consoles. It has an intuitive and simple user interface with advanced classes like physics, accelerometer and so on.
Using Gideros Studio is straightforward - no knowledge of C, C++, Objective C, Java, .Net or any other structured, complex programming language is required. In Gideros Studio, you code using the Lua language, a simple and powerful scripting language.
Gideros Studio provides a set of functions and libraries to help develop your apps faster. Using a few lines of code, you can create stunning animations for eBooks, games or generic applications. The following is a list of Gideros Studio SDK features:
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">
* desktop (Windows, Mac, Linux)
* HTML, Android, iOS, and various consoles support
* Fully native, OpenGL powered implementation
* iOS & Android plugins - native code support
* 2D scene graph
* Game & application analytics with Flurry analytics
* Touch and accelerometer sensor
* Automatic and pre-calculated texture packs
* Audio playback
* Scene transitions
* Physics engine (Liquidfun)
* Movieclip library
* Tweening library
* Font creator
* Font renderer
* 30+ different easing (tweening) functions
* Landscape and portrait modes
* Global timer pause/resume
* Sprites & sprite sheets
* 32-bit textures
* Texture Atlas
* Fast orthogonal tilemaps
</div>
Gideros Studio builds executables directly on your host machine, without sending your application to a remote server. This saves a lot of time and energy, and you can be sure that your intellectual property will not be compromised.
=== Platform support ===
Gideros Studio runs on a variety of operating systems, including Microsoft Windows, Mac OSX and Linux. Currently, the downloadable version is only for Microsoft and Mac OS X platform, but it’s possible to run Gideros Studio under Linux, using Wine. We recommend 1 GHz or more CPU, 1 GB RAM and at least 1 GB free disk space.
Gideros Studio executables run on ARMv6 and ARMv7 platforms. Minimum requirements for iOS and Android are:
* iOS: iPod touch 2nd generation or better, iPhone 2 or better, iPad 1 or better
* Android: at least Android 4.4. Note that previous Android versions (4.0 or below) won’t work.
There are some specific Android devices having issues to run Gideros applications, mainly those having different keys that interact with the end user. These hardware keys may not be supported. If in doubt, contact Gideros Mobile support or Gideros Mobile forums.
=== General Architecture ===
Gideros Studio has a layered architecture. The mid layer consists of OpenGL and C++ functions. The scripting language is powered by Lua. Lua virtual machine (LuaVM) converts the functions and callbacks to C++ functions and OpenGL, and each graphical command is drawn directly on the screen using the device OpenGL hardware accelerator. This results in very high-performance applications and games.
[[File:Gideros_framework_drawing.png]]
From top to bottom, the following parts constitute the whole Gideros framework:
#Gideros Studio IDE: The complete, cross-platform IDE
#Bridge: Connector between C++ API and IDE
#C++ API: API converting Lua calls to machine specific calls
#Libraries: External libraries used in a project
#Platform: The whole SDK
#Hardware: Either iOS (iPhone, iPad, iPod) or Android
== Downloading Gideros Studio ==
You can download Gideros Studio from Gideros Studio download page (http://www.giderosmobile.com/download). Downloading and installing Gideros Studio is free.
'''Note''': Gideros Studio for Windows enables you to build applications for iOS and Android. You can see your application running on Gideros Player, or better, see it on a real device by installing the player on iPhone, iPad or Android.
System requirements for all platforms are as follows:
* 1 GHz processor
* 1 GB RAM
* 1 GB disk space
* OpenGL based graphics card
=== Installing for MS Windows ===
Double click on the executable you downloaded and follow these steps:
# Choose a destination folder
# Click install
That's it. Now go to Start Menu and click on "Gideros Studio".
=== Installing for Mac OS X ===
In order to install Gideros Studio for Mac OS X, do the following:
# Double-click the .dmg file to mount it
# Drag and drop the Gideros folder into your Applications directory
=== Using Gideros Studio under Linux ===
Gideros Studio natively runs under Mac OS X and Windows. However, it's possible to run this application under Linux, using Wine. Wine takes care of mapping MS Windows functions to Linux. There are several complex MS Windows apps that run under Linux with full performance, thanks to Wine developers.
First, install Wine:
<code>
apt-get install wine
</code>
If you are using the Software Center, then do the following:
*Open Software Center
*Type "wine" and install Wine
Now download the latest version, and then using a command line, type "wine" followed by the application name. The installer will tell you how to proceed and locate every file to your home directory.
After installation, you'll see the "Wine" menu item in Ubuntu under Applications.
Go to Wine → Programs → Gideros Studio and run "Gideros Studio".
== Starting Gideros Studio ==
After installation, Gideros Studio is installed under your applications folder. Gideros Studio comes with 3 more separate applications: Gideros Font Creator, Gideros Player, and Gideros Texture Packer.
=== Gideros Studio IDE ===
Gideros Studio comes with an integrated IDE for fast application development. It has developer-oriented features like code completion, syntax color highlighting, a debugger, and project management. During the build, Gideros Studio translates your code from Lua to the targeted platform native code.
The IDE includes a few tools to make development faster and more efficient: the '''Gideros Player''', a '''Font Creator''' and a '''Texture Packer'''.
Gideros Studio IDE is written in Qt, using Qt Creator IDE and SDK.
=== Gideros Studio SDK ===
Gideros Studio includes a comprehensive, easy to use and understand SDK, with more than 470 API functions. This gives programmers a strong, complete framework to build their applications. The following gives a brief overview of the functions list in Gideros SDK.
'''"Function Category"''' "Definition"</br>
'''Event Dispatcher''' A central mechanism to dispatch events.</br>
'''Event''' The objects of Event class contain information about an event that has occurred.</br>
'''Sprite''' The Sprite class is the base class for all objects that can be placed on the scene tree. It is the basic scene tree building block.</br>
'''Stage''' The Stage class represents the top of the scene tree hierarchy.</br>
'''TextureBase''' TextureBase is the base class for Texture and TexturePack classes. It provides a common functionality to texture related classes.</br>
'''Texture''' The Texture class lets you work with textures in an application. It lets you create a new Texture object to load from an image file and display in scene tree.</br>
'''TextureRegion''' The TextureRegion class specifies a texture and a rectangular region in it. It is used to define independent texture regions within a texture atlas which is a large image containing many smaller sub-images.</br>
'''TexturePack''' The TexturePack class specifies a texture pack (or texture atlas).</br>
'''Bitmap''' The Bitmap class is used to display texture related objects in the scene tree.</br>
'''Font''' The ‘Font’ class is used for fonts created by Gideros Font Creator.</br>
'''TextField''' The TextField class is used to create display objects for text display.</br>
'''Shape''' The Shape class is used to create and display vector graphics.</br>
'''Tilemap''' The TileMap class is used to work with tile maps easily and efficiently.</br>
'''Movieclip''' The MovieClip class is used to create static time lined animations.</br>
'''Application''' The Application class contains the common functions that are available to the current application.</br>
'''OS''' Provides an interface to the OS functions, e.g. timer.</br>
'''Sound''' The Sound class lets you load and play WAV or MP3 sound files.</br>
'''SoundChannel''' The SoundChannel class is used to control and monitor a playing sound.</br>
'''UrlLoader''' The UrlLoader class is used to download data from an URL.</br>
'''Timer''' The Timer class is used to execute a code at specified intervals.</br>
'''Matrix''' The Matrix class specifies 2D or 3D transformation from one coordinate space to another.</br>
'''b2''' Includes b2.World, b2.Body, b2.Fixture, b2.Shape, b2.PolygonShape, b2.CircleShape, b2.EdgeShape, b2.Joint, b2.RevoluteJoint, b2.PrismaticJoint, b2.DistanceJoint, b2.PulleyJoint, b2.MouseJoint, b2.GearJoint, b2.WheelJoint, b2.WeldJoint, b2.FrictionJoint, b2.DebugDraw.</br>
'''Geolocation''' The Geolocation class inherits from the following class: EventDispatcher.</br>
'''Gyroscope''' The Gyroscope class is used to access gyroscope data.</br>
The SDK is always improved by developers. Some of the less used functions are given as plugins, in order not to clutter the core Gideros SDK.
'''PREV.''': [[Lua to Luau conversion guide]]<br/>
'''NEXT''': [[Getting Started]]
{{GIDEROS IMPORTANT LINKS}}__NOTOC__
<languages />
<!-- GIDEROSOBJ:GoogleBilling -->
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
=== <translate>Description</translate> ===
<translate><br />
The [[Special:MyLanguage/GoogleBilling|GoogleBilling]] class is defined in the module "googlebilling". Therefore, you need to call<br />
''require("googlebilling")'' before using it. Loading the Google Billing module <br />
also creates a global variable ''googlebilling'' of type [[Special:MyLanguage/GoogleBilling|GoogleBilling]] for direct use. <br />
<br />
<h3>GoogleBilling Events and Response Codes</h3><br />
<br />
[[Special:MyLanguage/GoogleBilling|GoogleBilling]] class dispatches 5 events: [[Special:MyLanguage/Event.CHECK_BILLING_SUPPORTED_COMPLETE|Event.CHECK_BILLING_SUPPORTED_COMPLETE]],<br />
[[Special:MyLanguage/Event.REQUEST_PURCHASE_COMPLETE|Event.REQUEST_PURCHASE_COMPLETE]],[[Special:MyLanguage/Event.RESTORE_TRANSACTIONS_COMPLETE|Event.RESTORE_TRANSACTIONS_COMPLETE]],<br />
[[Special:MyLanguage/Event.CONFIRM_NOTIFICATION_COMPLETE|Event.CONFIRM_NOTIFICATION_COMPLETE]] and [[Special:MyLanguage/Event.PURCHASE_STATE_CHANGE|Event.PURCHASE_STATE_CHANGE]].<br />
<br />
''Event.*_COMPLETE'' events contains a field ''event.responseCode'' which provides status information <br />
and error information about a request. Response code can be one of these values:<br />
<br />
<ul><br />
<li>[[Special:MyLanguage/GoogleBilling.OK|GoogleBilling.OK]]: Indicates that the request was sent to the server successfully. When this code is returned</li><br />
</ul><br />
in response to a ''checkBillingSupported'' function, indicates that billing is supported.<br />
<ul><br />
<li>[[Special:MyLanguage/GoogleBilling.USER_CANCELED|GoogleBilling.USER_CANCELED]]: Indicates that the user pressed the back button on the checkout page instead of buying the item.</li><br />
<li>[[Special:MyLanguage/GoogleBilling.SERVICE_UNAVAILABLE|GoogleBilling.SERVICE_UNAVAILABLE]]: Indicates that the network connection is down.</li><br />
<li>[[Special:MyLanguage/GoogleBilling.BILLING_UNAVAILABLE|GoogleBilling.BILLING_UNAVAILABLE]]: Indicates that in-app billing is not available because the API version that</li><br />
</ul><br />
you specified is not recognized by the Google Play application or the user is ineligible for in-app billing <br />
(for example, the user resides in a country that prohibits in-app purchases).<br />
<ul><br />
<li>[[Special:MyLanguage/GoogleBilling.ITEM_UNAVAILABLE|GoogleBilling.ITEM_UNAVAILABLE]]: Indicates that Google Play cannot find the requested item in the application's product list.</li><br />
</ul><br />
This can happen if the product ID is misspelled in your ''requestPurchase'' function or if an item is unpublished in the application's product list.<br />
<ul><br />
<li>[[Special:MyLanguage/GoogleBilling.DEVELOPER_ERROR|GoogleBilling.DEVELOPER_ERROR]]: Indicates that an application is trying to make an in-app billing request but the application has not declared the</li><br />
</ul><br />
com.android.vending.BILLING permission in its manifest. Can also indicate that an application is not properly signed, <br />
or that you sent a malformed request, such as a request with missing Bundle keys or a request that uses an unrecognized request type.<br />
<ul><br />
<li>[[Special:MyLanguage/GoogleBilling.ERROR|GoogleBilling.ERROR]]: Indicates an unexpected server error. For example, this error is triggered if you try to purchase an item from yourself, which is not allowed by Google Wallet.</li><br />
</ul><br />
<br />
<h3># Event.CHECK_BILLING_SUPPORTED_COMPLETE</h3><br />
Dispatched when ''checkBillingSuported'' function completes. It contains ''event.responseCode'' and ''event.productType'' fields.<br />
<br />
<h3># Event.REQUEST_PURCHASE_COMPLETE</h3><br />
Dispatched when ''requestPurchase'' function completes. It contains ''event.responseCode'', ''event.productId'', ''event.productType'' and ''event.developerPayload'' fields.<br />
<br />
<h3># Event.RESTORE_TRANSACTIONS_COMPLETE</h3><br />
Dispatched when ''restoreTransactions'' function completes. It contains ''event.responseCode'' fields.<br />
<br />
<h3># Event.CONFIRM_NOTIFICATION_COMPLETE</h3><br />
Dispatched when ''confirmNotification'' function completes. It contains ''event.responseCode'' and ''event.notificationId'' fields.<br />
<br />
<h3># Event.PURCHASE_STATE_CHANGE</h3><br />
Dispatched when information about a transaction is received. It contains ''event.purchaseState'', ''event.productId'', ''event.notificationId'', ''event.purchaseTime'' and ''event.developerPayload'' fields.<br />
<br /></translate>
{|-
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
[[Special:MyLanguage/GoogleBilling:checkBillingSupported|GoogleBilling:checkBillingSupported]] <br/><!-- GIDEROSMTD:GoogleBilling:checkBillingSupported(productType) -->
[[Special:MyLanguage/GoogleBilling:confirmNotification|GoogleBilling:confirmNotification]] <br/><!-- GIDEROSMTD:GoogleBilling:confirmNotification(notificationId) -->
[[Special:MyLanguage/GoogleBilling:requestPurchase|GoogleBilling:requestPurchase]] <br/><!-- GIDEROSMTD:GoogleBilling:requestPurchase(productId,productType,developerPayload) -->
[[Special:MyLanguage/GoogleBilling:restoreTransactions|GoogleBilling:restoreTransactions]] <br/><!-- GIDEROSMTD:GoogleBilling:restoreTransactions() -->
[[Special:MyLanguage/GoogleBilling:setApiVersion|GoogleBilling:setApiVersion]] <br/><!-- GIDEROSMTD:GoogleBilling:setApiVersion(apiVersion) -->
[[Special:MyLanguage/GoogleBilling:setPublicKey|GoogleBilling:setPublicKey]] <br/><!-- GIDEROSMTD:GoogleBilling:setPublicKey(publicKey) -->
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
[[Special:MyLanguage/Event.CHECK_BILLING_SUPPORTED_COMPLETE|Event.CHECK_BILLING_SUPPORTED_COMPLETE]]<br/><!-- GIDEROSEVT:Event.CHECK_BILLING_SUPPORTED_COMPLETE checkBillingSupportedComplete-->
[[Special:MyLanguage/Event.CONFIRM_NOTIFICATION_COMPLETE|Event.CONFIRM_NOTIFICATION_COMPLETE]]<br/><!-- GIDEROSEVT:Event.CONFIRM_NOTIFICATION_COMPLETE confirmNotificationComplete-->
[[Special:MyLanguage/Event.PURCHASE_STATE_CHANGE|Event.PURCHASE_STATE_CHANGE]]<br/><!-- GIDEROSEVT:Event.PURCHASE_STATE_CHANGE purchaseStateChange-->
[[Special:MyLanguage/Event.REQUEST_PURCHASE_COMPLETE|Event.REQUEST_PURCHASE_COMPLETE]]<br/><!-- GIDEROSEVT:Event.REQUEST_PURCHASE_COMPLETE requestPurchaseComplete-->
[[Special:MyLanguage/Event.RESTORE_TRANSACTIONS_COMPLETE|Event.RESTORE_TRANSACTIONS_COMPLETE]]<br/><!-- GIDEROSEVT:Event.RESTORE_TRANSACTIONS_COMPLETE restoreTransactionsComplete-->
=== <translate>Constants</translate> ===
[[Special:MyLanguage/GoogleBilling.BILLING_UNAVAILABLE|GoogleBilling.BILLING_UNAVAILABLE]]<br/><!-- GIDEROSCST:GoogleBilling.BILLING_UNAVAILABLE billingUnavailable-->
[[Special:MyLanguage/GoogleBilling.CANCELED|GoogleBilling.CANCELED]]<br/><!-- GIDEROSCST:GoogleBilling.CANCELED canceled-->
[[Special:MyLanguage/GoogleBilling.DEVELOPER_ERROR|GoogleBilling.DEVELOPER_ERROR]]<br/><!-- GIDEROSCST:GoogleBilling.DEVELOPER_ERROR developerError-->
[[Special:MyLanguage/GoogleBilling.ERROR|GoogleBilling.ERROR]]<br/><!-- GIDEROSCST:GoogleBilling.ERROR error-->
[[Special:MyLanguage/GoogleBilling.EXPIRED|GoogleBilling.EXPIRED]]<br/><!-- GIDEROSCST:GoogleBilling.EXPIRED expired-->
[[Special:MyLanguage/GoogleBilling.INAPP|GoogleBilling.INAPP]]<br/><!-- GIDEROSCST:GoogleBilling.INAPP inapp-->
[[Special:MyLanguage/GoogleBilling.ITEM_UNAVAILABLE|GoogleBilling.ITEM_UNAVAILABLE]]<br/><!-- GIDEROSCST:GoogleBilling.ITEM_UNAVAILABLE itemUnavailable-->
[[Special:MyLanguage/GoogleBilling.OK|GoogleBilling.OK]]<br/><!-- GIDEROSCST:GoogleBilling.OK ok-->
[[Special:MyLanguage/GoogleBilling.PURCHASED|GoogleBilling.PURCHASED]]<br/><!-- GIDEROSCST:GoogleBilling.PURCHASED purchased-->
[[Special:MyLanguage/GoogleBilling.REFUNDED|GoogleBilling.REFUNDED]]<br/><!-- GIDEROSCST:GoogleBilling.REFUNDED refunded-->
[[Special:MyLanguage/GoogleBilling.SERVICE_UNAVAILABLE|GoogleBilling.SERVICE_UNAVAILABLE]]<br/><!-- GIDEROSCST:GoogleBilling.SERVICE_UNAVAILABLE serviceUnavailable-->
[[Special:MyLanguage/GoogleBilling.SUBS|GoogleBilling.SUBS]]<br/><!-- GIDEROSCST:GoogleBilling.SUBS subs-->
[[Special:MyLanguage/GoogleBilling.USER_CANCELED|GoogleBilling.USER_CANCELED]]<br/><!-- GIDEROSCST:GoogleBilling.USER_CANCELED userCanceled-->
|}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.09<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/GoogleBilling|GoogleBilling]]<br/>
=== <translate>Description</translate> ===
<translate><br />
This request retrieves a user's transaction status for managed purchases. You should send this message only when you need to<br />
retrieve a user's transaction status, which is usually only when your application is reinstalled or installed for the first time on a device.<br />
<br /></translate>
<syntaxhighlight lang="lua">
(bool) = GoogleBilling:restoreTransactions()
</syntaxhighlight>
=== <translate>Return values</translate> ===
'''<translate>Returns</translate>''' (bool) <translate>''true'' if in-app billing service is available, ''false'' otherwise.</translate><br/>__NOTOC__
<languages />
<!-- GIDEROSOBJ:Gyroscope -->
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform winrt.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/Object|Object]]<br/>
=== <translate>Description</translate> ===
The [[Special:MyLanguage/Gyroscope|Gyroscope]] class is used to access gyroscope data.
=== <translate>Examples</translate> ===
<syntaxhighlight lang="lua">
local gyroscope = Gyroscope.new()
gyroscope:start()
local angx = 0
local angy = 0
local angz = 0
local function onEnterFrame(event)
local x, y, z = gyroscope:getRotationRate()
angx = angx + x * event.deltaTime
angy = angy + y * event.deltaTime
angz = angz + z * event.deltaTime
print(angx * 180 / math.pi, angy * 180 / math.pi, angz * 180 / math.pi)
end
stage:addEventListener("enterFrame",onEnterFrame,self)
</syntaxhighlight>
{|-
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
[[Special:MyLanguage/Gyroscope.isAvailable|Gyroscope.isAvailable]] ''<translate>does the gyroscope available?</translate>''<br/>
<!-- GIDEROSMTD:Gyroscope.isAvailable() does the gyroscope available? -->
[[Special:MyLanguage/Gyroscope.new|Gyroscope.new]] ''<translate>Creates new Gyroscope instance</translate>''<br/>
<!-- GIDEROSMTD:Gyroscope.new() Creates new Gyroscope instance -->
[[Special:MyLanguage/Gyroscope:getRotationRate|Gyroscope:getRotationRate]] ''<translate>returns the rotation rate in radians per second</translate>''<br/>
<!-- GIDEROSMTD:Gyroscope:getRotationRate() returns the rotation rate in radians per second -->
[[Special:MyLanguage/Gyroscope:start|Gyroscope:start]] ''<translate>starts gyroscope updates</translate>''<br/>
<!-- GIDEROSMTD:Gyroscope:start() starts gyroscope updates -->
[[Special:MyLanguage/Gyroscope:stop|Gyroscope:stop]] ''<translate>stops gyroscope updates</translate>''<br/>
<!-- GIDEROSMTD:Gyroscope:stop() stops gyroscope updates -->
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
=== <translate>Constants</translate> ===
|}
{{GIDEROS IMPORTANT LINKS}}__NOTOC__
<languages />
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Gyroscope|Gyroscope]]<br/>
=== <translate>Description</translate> ===
<translate><br />
Returns ''true'' if gyroscope is available for this platform, ''false'' otherwise.<br />
<br /></translate>
<syntaxhighlight lang="lua">
(bool) = Gyroscope.isAvailable()
</syntaxhighlight>
=== <translate>Return values</translate> ===
'''<translate>Returns</translate>''' (bool) <translate>''true'' if gyroscope is available for this platform, ''false'' otherwise.</translate><br/>
{{Gyroscope}}__NOTOC__
<languages />
<!-- GIDEROSOBJ:iad -->
'''<translate>Supported platforms</translate>:''' [[File:Platform ios.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
=== <translate>Description</translate> ===
<translate><br />
iAd module for iOS allows you to use iAd framework that was introduced in iOS 4.0. To load the iAd module, call ''require "iad"''. After loading iAd module, [[Special:MyLanguage/iad|iad]] table stores all <br />
classes and functions related to iAd framework.<br />
<br /></translate>
{|-
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
[[Special:MyLanguage/iad.isAvailable|iad.isAvailable]] <br/><!-- GIDEROSMTD:iad.isAvailable() -->
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
=== <translate>Constants</translate> ===
|}__NOTOC__
<languages />
<!-- GIDEROSOBJ:iad.Banner -->
'''<translate>Supported platforms</translate>:''' [[File:Platform ios.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/EventDispatcher|EventDispatcher]]<br/>
=== <translate>Description</translate> ===
<translate><br />
The [[Special:MyLanguage/iad.Banner|iad.Banner]] class provides a view that displays banner advertisements to the user. When the user taps a banner view, the view triggers an action <br />
programmed into the advertisement. For example, an advertisement might show a movie, present a modal advertisement, or launch Safari to show a webpage.<br />
Your application is notified when an action starts and stops, but does not otherwise interact with the advertisement. <br />
<br /></translate>
{|-
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
[[Special:MyLanguage/iad.Banner.new|iad.Banner.new]] <br/><!-- GIDEROSMTD:iad.Banner.new(alignment,orientation) -->
[[Special:MyLanguage/iad.Banner:hide|iad.Banner:hide]] <br/><!-- GIDEROSMTD:iad.Banner:hide() -->
[[Special:MyLanguage/iad.Banner:isBannerLoaded|iad.Banner:isBannerLoaded]] <br/><!-- GIDEROSMTD:iad.Banner:isBannerLoaded() -->
[[Special:MyLanguage/iad.Banner:setAlignment|iad.Banner:setAlignment]] <br/><!-- GIDEROSMTD:iad.Banner:setAlignment(alignment) -->
[[Special:MyLanguage/iad.Banner:show|iad.Banner:show]] <br/><!-- GIDEROSMTD:iad.Banner:show() -->
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
[[Special:MyLanguage/Event.BANNER_ACTION_BEGIN|Event.BANNER_ACTION_BEGIN]]<br/><!-- GIDEROSEVT:Event.BANNER_ACTION_BEGIN bannerActionBegin-->
[[Special:MyLanguage/Event.BANNER_ACTION_FINISHED|Event.BANNER_ACTION_FINISHED]]<br/><!-- GIDEROSEVT:Event.BANNER_ACTION_FINISHED bannerActionFinished-->
[[Special:MyLanguage/Event.BANNER_AD_FAILED|Event.BANNER_AD_FAILED]]<br/><!-- GIDEROSEVT:Event.BANNER_AD_FAILED bannerAdFailed-->
[[Special:MyLanguage/Event.BANNER_AD_LOADED|Event.BANNER_AD_LOADED]]<br/><!-- GIDEROSEVT:Event.BANNER_AD_LOADED bannerAdLoaded-->
=== <translate>Constants</translate> ===
[[Special:MyLanguage/iad.Banner.BOTTOM|iad.Banner.BOTTOM]]<br/><!-- GIDEROSCST:iad.Banner.BOTTOM bottom-->
[[Special:MyLanguage/iad.Banner.LANDSCAPE|iad.Banner.LANDSCAPE]]<br/><!-- GIDEROSCST:iad.Banner.LANDSCAPE landscape-->
[[Special:MyLanguage/iad.Banner.PORTRAIT|iad.Banner.PORTRAIT]]<br/><!-- GIDEROSCST:iad.Banner.PORTRAIT portrait-->
[[Special:MyLanguage/iad.Banner.TOP|iad.Banner.TOP]]<br/><!-- GIDEROSCST:iad.Banner.TOP top-->
|}