Skip to content

Commit

Permalink
GDExtension docs
Browse files Browse the repository at this point in the history
Renames from GDNative to GDExtension


Add Pictures/Gifs and clarified compatability


Remove GDNative language bindings from GDExtension docs


Update SConstruct and AddingProperties section


updated with suggestions


Added property hint example + updated to API naming changes


Fixed redirect.csv
  • Loading branch information
paddy-exe committed Feb 26, 2023
1 parent 6c80dbd commit 98268b9
Show file tree
Hide file tree
Showing 15 changed files with 796 additions and 17 deletions.
10 changes: 7 additions & 3 deletions _tools/redirects/redirects.csv
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ source,destination
/tutorials/platform/android_in_app_purchases.html,/tutorials/platform/android/android_in_app_purchases.html
/tutorials/plugins/android/android_plugin.html,/tutorials/platform/android/android_plugin.html
/tutorials/plugins/android/index.html,/tutorials/platform/android/index.html
/tutorials/plugins/gdnative/gdnative-c-example.html,/tutorials/scripting/gdnative/gdnative_c_example.html
/tutorials/plugins/gdnative/gdnative-cpp-example.html,/tutorials/scripting/gdnative/gdnative_cpp_example.html
/tutorials/plugins/gdnative/index.html,/tutorials/scripting/gdnative/index.html
/tutorials/plugins/gdextension/gdextension-c-example.html,/tutorials/scripting/gdextension/gdextension_c_example.html
/tutorials/plugins/gdextension/gdextension-cpp-example.html,/tutorials/scripting/gdextension/gdextension_cpp_example.html
/tutorials/plugins/gdextension/index.html,/tutorials/scripting/gdextension/index.html
/tutorials/shading/advanced_postprocessing.html,/tutorials/shaders/advanced_postprocessing.html
/tutorials/shading/godot_shader_language_style_guide.html,/tutorials/shaders/shaders_style_guide.html
/tutorials/shading/index.html,/tutorials/shaders/index.html
Expand All @@ -402,3 +402,7 @@ source,destination
/tutorials/physics/using_kinematic_body_2d.html,/tutorials/physics/using_character_body_2d.html
/tutorials/plugins/editor/spatial_gizmos.html,/tutorials/plugins/editor/3d_gizmos.html
/tutorials/3d/procedural_geometry/immediategeometry.html,/tutorials/3d/procedural_geometry/immediatemesh.html
/tutorials/plugins/gdnative/index.html,/tutorials/plugins/gdextension/index.html
/tutorials/scripting/gdnative/what_is_gdnative.html,/tutorials/scripting/gdnative/what_is_gdextension.html
/tutorials/scripting/gdnative/gdnative_c_example.html,/tutorials/plugins/gdextension/gdextension_cpp_example.html
/tutorials/scripting/gdnative/gdnative_cpp_example.html,/tutorials/plugins/gdextension/gdextension_cpp_example.html
1 change: 1 addition & 0 deletions about/docs_changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Scripting
- :ref:`doc_debugger_panel`
- :ref:`doc_creating_script_templates`
- :ref:`doc_evaluating_expressions`
- :ref:`doc_what_is_gdextension`
- :ref:`doc_gdscript_warning_system` (split from :ref:`doc_gdscript_static_typing`)

User Interface (UI)
Expand Down
2 changes: 1 addition & 1 deletion getting_started/first_2d_game/06.heads_up_display.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ We also need to process what happens when the player loses. The code below will
.. code-tab:: cpp

// This code goes in `hud.cpp`.
// There is no `yield` in GDNative, so we need to have every
// There is no `yield` in GDExtension, so we need to have every
// step be its own method that is called on timer timeout.
void HUD::show_get_ready() {
_message_label->set_text("Get Ready");
Expand Down
6 changes: 3 additions & 3 deletions getting_started/step_by_step/scripting_languages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ officially supported .NET option.
in GDScript, C#, or C++ won't have a significant impact on
performance.

C and C++ via GDExtension
~~~~~~~~~~~~~~~~~~~~~~~~~
C++ via GDExtension
~~~~~~~~~~~~~~~~~~~

GDExtension allows you to write game code in C or C++ without needing to recompile
GDExtension allows you to write game code in C++ without needing to recompile
or even restart Godot.

.. image:: img/scripting_cpp.png
Expand Down
2 changes: 1 addition & 1 deletion tutorials/export/feature_tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ Customizing the build
---------------------

Feature tags can be used to customize a build process too, by writing a custom **ExportPlugin**.
They are also used to specify which shared library is loaded and exported in **GDNative**.
They are also used to specify which shared library is loaded and exported in **GDExtension**.
2 changes: 1 addition & 1 deletion tutorials/networking/webrtc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Using WebRTC in Godot

WebRTC is implemented in Godot via two main classes :ref:`WebRTCPeerConnection <class_WebRTCPeerConnection>` and :ref:`WebRTCDataChannel <class_WebRTCDataChannel>`, plus the multiplayer API implementation :ref:`WebRTCMultiplayerPeer <class_WebRTCMultiplayerPeer>`. See section on :ref:`high-level multiplayer <doc_high_level_multiplayer>` for more details.

.. note:: These classes are available automatically in HTML5, but **require an external GDNative plugin on native (non-HTML5) platforms**. Check out the `webrtc-native plugin repository <https://github.com/godotengine/webrtc-native>`__ for instructions and to get the latest `release <https://github.com/godotengine/webrtc-native/releases>`__.
.. note:: These classes are available automatically in HTML5, but **require an external GDExtension plugin on native (non-HTML5) platforms**. Check out the `webrtc-native plugin repository <https://github.com/godotengine/webrtc-native>`__ for instructions and to get the latest `release <https://github.com/godotengine/webrtc-native/releases>`__.

.. warning::

Expand Down
16 changes: 8 additions & 8 deletions tutorials/platform/android/android_plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,19 @@ From your script::
print(singleton.myPluginFunction("World"))


Bundling GDNative resources
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bundling GDExtension resources
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

An Android plugin can define and provide C/C++ GDNative resources, either to provide and/or access functionality from the game logic.
The GDNative resources can be bundled within the plugin ``aar`` file which simplifies the distribution and deployment process:
An Android plugin can define and provide C/C++ GDExtension resources, either to provide and/or access functionality from the game logic.
The GDExtension resources can be bundled within the plugin ``aar`` file which simplifies the distribution and deployment process:

- The shared libraries (``.so``) for the defined GDNative libraries will be automatically bundled by the ``aar`` build system.
- The shared libraries (``.so``) for the defined GDExtension libraries will be automatically bundled by the ``aar`` build system.
- Godot ``*.gdnlib`` and ``*.gdns`` resource files must be manually defined in the plugin ``assets`` directory.
The recommended path for these resources relative to the ``assets`` directory should be: ``godot/plugin/v1/[PluginName]/``.

For GDNative libraries, the plugin singleton object must override the ``org.godotengine.godot.plugin.GodotPlugin::getPluginGDNativeLibrariesPaths()`` method,
and return the paths to the bundled GDNative libraries config files (``*.gdnlib``). The paths must be relative to the ``assets`` directory.
At runtime, the plugin will provide these paths to Godot core which will use them to load and initialize the bundled GDNative libraries.
For GDExtension libraries, the plugin singleton object must override the ``org.godotengine.godot.plugin.GodotPlugin::getPluginGDNativeLibrariesPaths()`` method,
and return the paths to the bundled GDExtension libraries config files (``*.gdextension``). The paths must be relative to the ``assets`` directory.
At runtime, the plugin will provide these paths to Godot core which will use them to load and initialize the bundled GDExtension libraries.

Reference implementations
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
32 changes: 32 additions & 0 deletions tutorials/scripting/gdextension/files/cpp_example/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python
import os
import sys

env = SConscript("godot-cpp/SConstruct")

# For reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
# - CXXFLAGS are for C++-specific compilation flags
# - CPPFLAGS are for pre-processor flags
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags

# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")

if env["platform"] == "macos":
library = env.SharedLibrary(
"demo/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
source=sources,
)
else:
library = env.SharedLibrary(
"demo/bin/libgdexample{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
)

Default(library)
Loading

0 comments on commit 98268b9

Please sign in to comment.