Update master documentation for changeset c34a2174fa

This commit is contained in:
Travis CI 2017-08-03 04:45:49 +00:00
commit 24aea17963
463 changed files with 42787 additions and 2037 deletions

View file

@ -1205,6 +1205,7 @@ function main() {
<ul class="simple simple-toc" id="toc-list">
<li><a class="reference" id="getting-started_toc" href="#getting-started">Getting Started</a></li>
<ul class="simple"><li><a class="reference" id="getting-started-building-godot_toc" href="#getting-started-building-godot">Building Godot</a></li>
<li><a class="reference" id="getting-started-building-nim_toc" href="#getting-started-building-nim">Building Nim</a></li>
<li><a class="reference" id="getting-started-creating-project_toc" href="#getting-started-creating-project">Creating Project</a></li>
<li><a class="reference" id="getting-started-adding-nim-to-existing-project_toc" href="#getting-started-adding-nim-to-existing-project">Adding Nim to Existing Project</a></li>
<li><a class="reference" id="getting-started-next-steps_toc" href="#getting-started-next-steps">Next Steps</a></li>
@ -1219,19 +1220,22 @@ function main() {
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"><table class="docinfo" frame="void" rules="none"><col class="docinfo-name" /><col class="docinfo-content" /><tbody valign="top"><tr><th class="docinfo-name">Author:</th><td> Ruslan Mustakov</td></tr>
<tr><th class="docinfo-name">Version:</th><td> 0.3.0</td></tr>
<tr><th class="docinfo-name">Version:</th><td> 0.4.0</td></tr>
<tr><th class="docinfo-name">GitHub:</th><td> <a class="reference external" href="https://github.com/pragmagic/godot-nim">https://github.com/pragmagic/godot-nim</a></td></tr>
</tbody></table><p><tt class="docutils literal"><span class="pre">godot-nim</span></tt> library allows to create games on <a class="reference external" href="https://godotengine.org/">Godot Engine</a> with <a class="reference external" href="https://nim-lang.org/">Nim programming language</a>. Nim is a statically typed language with an elegant Python-like syntax that compiles to native code. It is garbage-collected, but its GC supports real-time mode which this library makes use of. It means the GC will never run during game frames and will use fixed amount of frame idle time to collect garbage. This leads to no stalls and close to zero compromise on performance comparing to native languages with manual memory management.</p>
<p>The documentation assumes basic knowledge of Nim. If you are not familiar with it, it is recommended to go through the <a class="reference external" href="https://nim-lang.org/docs/tut1.html">official tutorial</a>.</p>
<p>If you are not familiar with Nim yet, it is recommended to go through the <a class="reference external" href="https://nim-lang.org/docs/tut1.html">official tutorial</a>.</p>
<p><a class="reference external" href="https://code.visualstudio.com/">VSCode</a> is the recommended editor for working with Nim code. It is cross-platform and has the excellent <a class="reference external" href="https://marketplace.visualstudio.com/items?itemName=kosz78.nim">nim plugin</a> that supports most of the features you would expect from an IDE. It also has <a class="reference external" href="https://marketplace.visualstudio.com/items?itemName=geequlim.godot-tools">godot-tools plugin</a> which adds features for editing GDScript and Godot resource files.</p>
<h1><a class="toc-backref" id="getting-started" href="#getting-started">Getting Started</a></h1>
<h2><a class="toc-backref" id="getting-started-building-godot" href="#getting-started-building-godot">Building Godot</a></h2><p>The library requires a not yet released Godot version 3.0, which you can build yourself by running the commands below (requires <a class="reference external" href="https://git-scm.com/downloads">Git</a>, <a class="reference external" href="https://www.python.org/downloads/">Python 2.7</a>, <a class="reference external" href="http://www.scons.org/">SCons</a>):</p>
<pre class="listing">git clone https://github.com/godotengine/godot.git cd godot scons
platform=&lt;your_platform&gt;</pre><p>where <tt class="docutils literal"><span class="pre">&lt;your_platform&gt;</span></tt> can be <tt class="docutils literal"><span class="pre">windows</span></tt>, <tt class="docutils literal"><span class="pre">osx</span></tt>, <tt class="docutils literal"><span class="pre">x11</span></tt>. After build is finished, Godot binaries will be under the <tt class="docutils literal"><span class="pre">bin</span></tt> folder. More details about compiling Godot can be found in <a class="reference external" href="https://godot.readthedocs.io/en/stable/development/compiling/index.html">Godot documentation</a>.</p>
<pre class="listing">git clone https://github.com/godotengine/godot.git
cd godot
scons platform=&lt;your_platform&gt;</pre><p>where <tt class="docutils literal"><span class="pre">&lt;your_platform&gt;</span></tt> can be <tt class="docutils literal"><span class="pre">windows</span></tt>, <tt class="docutils literal"><span class="pre">osx</span></tt>, <tt class="docutils literal"><span class="pre">x11</span></tt>. After build is finished, Godot binaries will be under the <tt class="docutils literal"><span class="pre">bin</span></tt> folder. More details about compiling Godot can be found in <a class="reference external" href="https://godot.readthedocs.io/en/stable/development/compiling/index.html">Godot documentation</a>.</p>
<h2><a class="toc-backref" id="getting-started-building-nim" href="#getting-started-building-nim">Building Nim</a></h2><p>The library requires a not yet released Nim version 0.17.1, which you can build yourself by following instructions in the <a class="reference external" href="https://github.com/nim-lang/Nim">Nim repository</a>. Make sure to also run <tt class="docutils literal"><span class="pre">./koch tools -d:release</span></tt> after the steps described there to build <tt class="docutils literal"><span class="pre">nimble</span></tt> (package manager) and <tt class="docutils literal"><span class="pre">nimsuggest</span></tt> (IDE helper tool, used by VSCode Nim plugin)</p>
<h2><a class="toc-backref" id="getting-started-creating-project" href="#getting-started-creating-project">Creating Project</a></h2><p>The fastest way to set up a Godot-Nim project is to use an existing stub:</p>
<pre class="listing">git clone --depth=1 https://github.com/pragmagic/godot-nim-stub.git
myproject</pre><p>(you can then delete the .git directory within to untie the project from the stub repository)</p>
<pre class="listing">git clone --depth=1 https://github.com/pragmagic/godot-nim-stub.git myproject</pre><p>(you can then delete the .git directory within to untie the project from the stub repository)</p>
<p>The stub contains the necessary build configuration to compile your code for desktop and mobile platforms, as well as a couple of very simple scenes to help you get started. Consult the stub's <a class="reference external" href="https://github.com/pragmagic/godot-nim-stub">README</a> for information about compiling the project.</p>
<h2><a class="toc-backref" id="getting-started-adding-nim-to-existing-project" href="#getting-started-adding-nim-to-existing-project">Adding Nim to Existing Project</a></h2><p>If you would like to use Nim in an existing project:</p>
@ -1239,17 +1243,19 @@ myproject</pre><p>(you can then delete the .git directory within to untie the pr
<li>Copy <tt class="docutils literal"><span class="pre">project/nimlib.tres</span></tt> to your Godot project folder. It is a GDNative library resource that contains paths to dynamic libraries compiled by Nim.</li>
<li>Add <tt class="docutils literal"><span class="pre">NimRuntime</span></tt> as an <a class="reference external" href="https://godot.readthedocs.io/en/stable/learning/step_by_step/singletons_autoload.html">AutoLoad singleton</a> to your project. To do this, copy <tt class="docutils literal"><span class="pre">project/scripts/NimRuntime.gdns</span></tt> into your project and add these lines to <tt class="docutils literal"><span class="pre">project.godot</span></tt>, adjusting path to <tt class="docutils literal"><span class="pre">NimRuntime.gdns</span></tt> as necessary:</li>
</ol>
<pre class="listing">[autoload] NimRuntime=&quot;*res://scripts/NimRuntime.gdns&quot;</pre>
<pre class="listing">[autoload]
NimRuntime=&quot;*res://scripts/NimRuntime.gdns&quot;</pre>
<h2><a class="toc-backref" id="getting-started-next-steps" href="#getting-started-next-steps">Next Steps</a></h2><p>Once you are familiarized with the build process (it's as simple as running <tt class="docutils literal"><span class="pre">nake build</span></tt> after you are set up), it is recommended to go through <a class="reference external" href="godotmacros.html">godotmacros</a> and <a class="reference external" href="godotnim.html">godotnim</a> module documentations. They describe special macros and procedures needed to define or instantiate Godot objects. After you learned that, the rest is similar to using any Nim library. These bindings do not limit any of Nim's capabilities, and you can use any Nim types as fields or parameters of Godot objects and their procedures (but, obviously, you may not be able to export some of them to Godot editor or GDScript, unless you define your own converters).</p>
<h1><a class="toc-backref" id="modules" href="#modules">Modules</a></h1><p>The binding library consists of three major modules:</p>
<ul class="simple"><li><a class="reference external" href="#godot_module">godot</a> - Contains core types and macro definitions. You need to import this in any module that defines or makes use of Godot types.</li>
<li><a class="reference external" href="#godotinternal_module">godotinternal</a> - Contains raw wrappers over few core types, such as <tt class="docutils literal"><span class="pre">GodotVariant</span></tt>, <tt class="docutils literal"><span class="pre">GodotString</span></tt>, <tt class="docutils literal"><span class="pre">GodotDictionary</span></tt>, <tt class="docutils literal"><span class="pre">GodotNodePath</span></tt>, pool arrays. These are used by <tt class="docutils literal"><span class="pre">godotapigen</span></tt> and macro implementations, and you don't have to use them at all in your code, unless you want to go into low-level details for some reason. Each of those types needs to be destructed manually with <tt class="docutils literal"><span class="pre">deinit</span></tt> procedure.</li>
<li><a class="reference external" href="godotapigen.html">godotapigen</a> - Wrapper generator based on data from Godot's ClassDB. You only need to use it as a part of the build process.</li>
<ul class="simple"><li><a class="reference external" href="#modules-godot-module">godot</a> - Contains core types and macro definitions. You need to import this in any module that defines or makes use of Godot types.</li>
<li><a class="reference external" href="#modules-godotinternal-module">godotinternal</a> - Contains raw wrappers over few core types, such as <tt class="docutils literal"><span class="pre">GodotVariant</span></tt>, <tt class="docutils literal"><span class="pre">GodotString</span></tt>, <tt class="docutils literal"><span class="pre">GodotNodePath</span></tt>, <tt class="docutils literal"><span class="pre">GodotDictionary</span></tt>, pool arrays. These are used by <tt class="docutils literal"><span class="pre">godotapigen</span></tt> and macro implementations, and you don't have to use them at all in your code, unless you want to go into low-level details for some reason. Each of those types needs to be destructed manually with <tt class="docutils literal"><span class="pre">deinit</span></tt> procedure.</li>
<li><a class="reference external" href="godotapigen.html">godotapigen</a> - Wrapper generator based on data from Godot's <tt class="docutils literal"><span class="pre">ClassDB</span></tt>. You only need to use it as a part of the build process.</li>
</ul>
<h2><a class="toc-backref" id="modules-godot-module" href="#modules-godot-module">godot Module</a></h2><p>Contains core types and macro definitions. You need to import this in any module that defines or makes use of Godot types. The sumbodules below are exported and you don't have to import any of them directly.</p>
<ul class="simple"><li><a class="reference external" href="godotnim.html">godotnim</a> Procedures and macros for defining and instantiating Godot objects.</li>
<ul class="simple"><li><a class="reference external" href="godotnim.html">godotnim</a> Defines <tt class="docutils literal"><span class="pre">NimGodotObject</span></tt> and Varaint converters for standard Nim types.</li>
<li><a class="reference external" href="godotmacros.html">godotmacros</a> Defines <tt class="docutils literal"><span class="pre">gdobj</span></tt> macro for defining Godot objects.</li>
<li><a class="reference external" href="variants.html">variants</a> <tt class="docutils literal"><span class="pre">Variant</span></tt> type represents a &quot;dynamic object&quot; that many Godot procedures make use of.</li>
<li><a class="reference external" href="arrays.html">arrays</a> Defines <tt class="docutils literal"><span class="pre">Array</span></tt> of Variants.</li>
<li><a class="reference external" href="basis.html">basis</a> Defines 3D <tt class="docutils literal"><span class="pre">Basis</span></tt>.</li>
@ -1269,7 +1275,7 @@ myproject</pre><p>(you can then delete the .git directory within to untie the pr
<li><a class="reference external" href="godotbase.html">godotbase</a> Defines <tt class="docutils literal"><span class="pre">Error</span></tt> type and few common math procedures missing in Nim's standard library.</li>
</ul>
<h2><a class="toc-backref" id="modules-godot-api" href="#modules-godot-api">Godot API</a></h2><p>This is an auto-generated list of Godot API modules. It's built from Godot changeset <a class="reference external" href="https://github.com/godotengine/godot/commit/76005a8e75d4e63ad0477e11dbc8cc1c86666875">76005a8e75d4e63ad0477e11dbc8cc1c86666875</a>.</p>
<h2><a class="toc-backref" id="modules-godot-api" href="#modules-godot-api">Godot API</a></h2><p>This is an auto-generated list of Godot API modules. It's built from Godot changeset <a class="reference external" href="https://github.com/godotengine/godot/commit/aef974e7a8577f857be8cf89f02844575d0839bb">aef974e7a8577f857be8cf89f02844575d0839bb</a>.</p>
<ul class="simple"><li><a class="reference external" href="godotapi/a_star.html">a_star</a></li>
<li><a class="reference external" href="godotapi/accept_dialog.html">accept_dialog</a></li>
<li><a class="reference external" href="godotapi/animated_sprite.html">animated_sprite</a></li>
@ -1280,6 +1286,13 @@ myproject</pre><p>(you can then delete the .git directory within to untie the pr
<li><a class="reference external" href="godotapi/area.html">area</a></li>
<li><a class="reference external" href="godotapi/area_2d.html">area_2d</a></li>
<li><a class="reference external" href="godotapi/array_mesh.html">array_mesh</a></li>
<li><a class="reference external" href="godotapi/arvr_camera.html">arvr_camera</a></li>
<li><a class="reference external" href="godotapi/arvr_controller.html">arvr_controller</a></li>
<li><a class="reference external" href="godotapi/arvr_interface.html">arvr_interface</a></li>
<li><a class="reference external" href="godotapi/arvr_origin.html">arvr_origin</a></li>
<li><a class="reference external" href="godotapi/arvr_positional_tracker.html">arvr_positional_tracker</a></li>
<li><a class="reference external" href="godotapi/arvr_script_interface.html">arvr_script_interface</a></li>
<li><a class="reference external" href="godotapi/arvr_server.html">arvr_server</a></li>
<li><a class="reference external" href="godotapi/atlas_texture.html">atlas_texture</a></li>
<li><a class="reference external" href="godotapi/audio_bus_layout.html">audio_bus_layout</a></li>
<li><a class="reference external" href="godotapi/audio_effect.html">audio_effect</a></li>
@ -1714,7 +1727,7 @@ myproject</pre><p>(you can then delete the .git directory within to untie the pr
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small>Made with Nim. Generated: 2017-08-01 12:16:01 UTC</small>
<small>Made with Nim. Generated: 2017-08-03 04:45:44 UTC</small>
</div>
</div>
</div>