@@ -212,6 +212,12 @@ call to find out which methods can be called and which properties it exposes.
212212The second is our ``_process `` function, which will work exactly the same
213213as the ``_process `` function you're used to in GDScript.
214214
215+ .. note ::
216+
217+ Unlike GDScript, the GDExtension ``_process `` will be run as soon as it is
218+ loaded, not only in game. See also :doc: `Running code in the editor <../../plugins/running_code_in_the_editor >`
219+ for more information on how to handle that.
220+
215221Let's implement our functions by creating our ``gdexample.cpp `` file:
216222
217223.. code-block :: cpp
@@ -327,10 +333,11 @@ At last, we need the header file for the ``register_types.cpp`` named
327333 Compiling the plugin
328334--------------------
329335
330- We cannot easily write by hand a ``SConstruct `` file that SCons would use for
331- building. For the purpose of this example, just use
332- :download: `this hardcoded SConstruct file <files/cpp_example/SConstruct >` we've
333- prepared. We'll cover a more customizable, detailed example on how to use these
336+ To compile the project we need to define it for SCons using another
337+ ``SConstruct `` file which references the one in ``godot-cpp ``.
338+ Writing it from scratch is outside the scope of this tutorial, but you can
339+ :download: `the SConstruct file we prepared <files/cpp_example/SConstruct >`.
340+ We'll cover a more customizable, detailed example on how to use these
334341build files in a subsequent tutorial.
335342
336343.. note ::
@@ -711,6 +718,22 @@ Every second, we output our position to the console.
711718Next steps
712719----------
713720
714- We hope the above example showed you the basics. You can
715- build upon this example to create full-fledged scripts to control nodes in Godot
716- using C++.
721+ We hope the above example showed you the basics. You can build upon this
722+ example to create full-fledged scripts to control nodes in Godot using C++.
723+
724+ If you want to include other C++ libraries, consider using submodules for
725+ getting them into your project, in the same way as we did with ``godot-cpp ``.
726+ Then you will need to add them to the ``SConstruct `` file. For details, consult
727+ the `SCons documentation <https://scons.org/documentation.html >`__, but it may
728+ require as little as adding these lines to the file:
729+
730+ .. code :: python
731+
732+ env.Append(CPPPATH = [" library-path/src/" , " library-path/include/" ])
733+ sources = sources + Glob(" library-path/src/*.cpp" )
734+
735+ If your editor is using `clangd Language Server <https://clangd.llvm.org/ >`__
736+ to provide smart C++ features, but it doesn't know where to find the headers,
737+ you can fix that by `generating compile_commands.json with Scons <https://scons.org/doc/latest/HTML/scons-user/ch27.html >`__.
738+ This should enable actions like "go to definition", also for ``godot-cpp ``
739+ functions and types.
0 commit comments