Skip to content

Commit

Permalink
Site changes [skip-ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
defold-services committed Feb 3, 2025
1 parent 263449d commit 39c733c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions _data/ref/alpha/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,44 @@
"tparams": [],
"type": "FUNCTION"
},
{
"brief": "Creates a sound data resource (.oggc/.wavc)",
"description": "Creates a sound data resource\nSupported formats are .oggc and .wavc",
"error": "",
"examples": "<div class=\"codehilite\"><pre><span></span><code><span class=\"kr\">function</span> <span class=\"nf\">init</span><span class=\"p\">(</span><span class=\"n\">self</span><span class=\"p\">)</span>\n <span class=\"c1\">-- create a new sound resource, given the initial chunk of the file</span>\n <span class=\"kd\">local</span> <span class=\"n\">relative_path</span> <span class=\"o\">=</span> <span class=\"s2\">&quot;/a/unique/resource/name.oggc&quot;</span>\n <span class=\"kd\">local</span> <span class=\"n\">hash</span> <span class=\"o\">=</span> <span class=\"n\">resource</span><span class=\"p\">.</span><span class=\"n\">create_sound_data</span><span class=\"p\">(</span><span class=\"n\">relative_path</span><span class=\"p\">,</span> <span class=\"p\">{</span> <span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"n\">data</span><span class=\"p\">,</span> <span class=\"n\">filesize</span> <span class=\"o\">=</span> <span class=\"n\">filesize</span><span class=\"p\">,</span> <span class=\"n\">partial</span> <span class=\"o\">=</span> <span class=\"kc\">true</span> <span class=\"p\">})</span>\n <span class=\"n\">go</span><span class=\"p\">.</span><span class=\"n\">set</span><span class=\"p\">(</span><span class=\"s2\">&quot;#music&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;sound&quot;</span><span class=\"p\">,</span> <span class=\"n\">hash</span><span class=\"p\">)</span> <span class=\"c1\">-- override the previous sound resource</span>\n <span class=\"n\">sound</span><span class=\"p\">.</span><span class=\"n\">play</span><span class=\"p\">(</span><span class=\"s2\">&quot;#music&quot;</span><span class=\"p\">)</span> <span class=\"c1\">-- start the playing</span>\n<span class=\"kr\">end</span>\n</code></pre></div>",
"language": "",
"members": [],
"name": "resource.create_sound_data",
"notes": [],
"parameters": [
{
"doc": "the path to the resource. Must not already exist.",
"name": "path",
"types": [
"string"
]
},
{
"doc": "A table containing parameters for the text. Supported entries:\n<dl>\n<dt><code>data</code></dt>\n<dd><span class=\"type\">string</span> The raw data of the file. May be partial, but must include the header of the file</dd>\n<dt><code>filesize</code></dt>\n<dd><span class=\"type\">number</span> If the file is partial, it must also specify the full size of the complete file.</dd>\n<dt><code>partial</code></dt>\n<dd><span class=\"type\">boolean</span> Is the data not representing the full file, but just the initial chunk?</dd>\n</dl>",
"name": "[options]",
"types": [
"table"
]
}
],
"replaces": "",
"returnvalues": [
{
"doc": "the resulting path hash to the resource",
"name": "path_hash",
"types": [
"hash"
]
}
],
"tparams": [],
"type": "FUNCTION"
},
{
"brief": "create a texture",
"description": "Creates a new texture resource that can be used in the same way as any texture created during build time.\nThe path used for creating the texture must be unique, trying to create a resource at a path that is already\nregistered will trigger an error. If the intention is to instead modify an existing texture, use the <a href=\"/ref/resource#resource.set_texture\">resource.set_texture</a>\nfunction. Also note that the path to the new texture resource must have a '.texturec' extension,\nmeaning \"/path/my_texture\" is not a valid path but \"/path/my_texture.texturec\" is.\nIf the texture is created without a buffer, the pixel data will be blank.",
Expand Down

0 comments on commit 39c733c

Please sign in to comment.