mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-09-03 18:14:53 +03:00
Rename demo to project for GDExtension docs (#11658)
* Rename demo to project for GDExtension docs Renames demo to project based on consensus in the GDExtension meeting to convey that GDExtensions and by extension the godot-cpp-template can be used to both write addons but also game code * Update tutorials/scripting/cpp/gdextension_cpp_example.rst Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> --------- Co-authored-by: Max Hilbrunner <mhilbrunner@users.noreply.github.com> Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4ef17136fb
commit
18aed7f3ac
@@ -24,7 +24,7 @@ lib_filename = "{}gdexample{}{}".format(env.subst('$SHLIBPREFIX'), env["suffix"]
|
||||
|
||||
# Creates a SCons target for the path with our sources.
|
||||
library = env.SharedLibrary(
|
||||
"demo/bin/{}".format(lib_filename),
|
||||
"project/bin/{}".format(lib_filename),
|
||||
source=sources,
|
||||
)
|
||||
|
||||
|
||||
@@ -104,15 +104,15 @@ Now it's time to build an actual plugin. We'll start by creating an empty Godot
|
||||
project in which we'll place a few files.
|
||||
|
||||
Open Godot and create a new project. For this example, we will place it in a
|
||||
folder called ``demo`` inside our GDExtension's folder structure.
|
||||
folder called ``project`` inside our GDExtension's folder structure.
|
||||
|
||||
In our demo project, we'll create a scene containing a Node called "Main" and
|
||||
In our project, we'll create a scene containing a Node called "Main" and
|
||||
we'll save it as ``main.tscn``. We'll come back to that later.
|
||||
|
||||
Back in the top-level GDExtension module folder, we're also going to create a
|
||||
subfolder called ``src`` in which we'll place our source files.
|
||||
|
||||
You should now have ``demo``, ``godot-cpp``, and ``src``
|
||||
You should now have ``project``, ``godot-cpp``, and ``src``
|
||||
directories in your GDExtension module.
|
||||
|
||||
Your folder structure should now look like this:
|
||||
@@ -121,7 +121,7 @@ Your folder structure should now look like this:
|
||||
|
||||
gdextension_cpp_example/
|
||||
|
|
||||
+--demo/ # game example/demo to test the extension
|
||||
+--project/ # game example/demo to test the extension
|
||||
|
|
||||
+--godot-cpp/ # C++ bindings
|
||||
|
|
||||
@@ -308,13 +308,13 @@ build files in a subsequent tutorial.
|
||||
refer to the ``SConstruct`` file in the Godot 4.x documentation.
|
||||
|
||||
Once you've downloaded the ``SConstruct`` file, place it in your GDExtension folder
|
||||
structure alongside ``godot-cpp``, ``src`` and ``demo``, then run:
|
||||
structure alongside ``godot-cpp``, ``src``, and ``project``, then run:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
scons platform=<platform>
|
||||
|
||||
You should now be able to find the module in ``demo/bin/<platform>``.
|
||||
You should now be able to find the module in ``project/bin/<platform>``.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -326,7 +326,7 @@ Using the GDExtension module
|
||||
----------------------------
|
||||
|
||||
Before we jump back into Godot, we need to create one more file in
|
||||
``demo/bin/``.
|
||||
``project/bin/``.
|
||||
|
||||
This file lets Godot know what dynamic libraries should be
|
||||
loaded for each platform and the entry function for the module. It is called ``gdexample.gdextension``.
|
||||
@@ -374,7 +374,7 @@ Here is another overview to check the correct file structure:
|
||||
|
||||
gdextension_cpp_example/
|
||||
|
|
||||
+--demo/ # game example/demo to test the extension
|
||||
+--project/ # game example/demo to test the extension
|
||||
| |
|
||||
| +--main.tscn
|
||||
| |
|
||||
|
||||
@@ -39,7 +39,7 @@ To organize our files, we're gonna split into mainly two folders:
|
||||
|
||||
gdextension_c_example/
|
||||
|
|
||||
+--demo/ # game example/demo to test the extension
|
||||
+--project/ # game example/demo to test the extension
|
||||
|
|
||||
+--src/ # source code of the extension we are building
|
||||
|
||||
@@ -96,7 +96,7 @@ to the root folder.
|
||||
env = Environment()
|
||||
|
||||
# Set the target path and name.
|
||||
target_path = "demo/bin/"
|
||||
target_path = "project/bin/"
|
||||
target_name = "libgdexample"
|
||||
|
||||
# Set the compiler and flags.
|
||||
@@ -638,7 +638,7 @@ A demo project
|
||||
|
||||
Now that we can create and free our custom object, we should be able to try it
|
||||
out in an actual project. For this, you need to open Godot and create a new
|
||||
project on the ``demo`` folder. The project manager may warn you the folder
|
||||
project in the ``project`` folder. The project manager may warn you the folder
|
||||
isn't empty if you have compiled the extension before, you can safely ignore
|
||||
this warning this time.
|
||||
|
||||
@@ -647,7 +647,7 @@ that, open a terminal or command prompt, navigate to the root folder of the
|
||||
extension and run ``scons``. It should compile quickly since the extension is
|
||||
very simple.
|
||||
|
||||
Then, create a file called ``gdexample.gdextension`` inside the ``demo`` folder.
|
||||
Then, create a file called ``gdexample.gdextension`` inside the ``project`` folder.
|
||||
This is a Godot resource that describes the extension, allowing the engine to
|
||||
properly load it. Put the following content in this file:
|
||||
|
||||
@@ -1308,7 +1308,7 @@ infrastructure to make this work. You can see that implementing the binding
|
||||
functions inline here would take some space and also be quite repetitive. This
|
||||
also makes it easier to add another method in the future.
|
||||
|
||||
If you compile the code and reopen the demo project, nothing will be different
|
||||
If you compile the code and reopen the Godot project, nothing will be different
|
||||
at first, since we only added two new methods. To ensure those are registered
|
||||
properly, you can search for ``GDExample`` in the editor help and verify they
|
||||
are present in the documentation page.
|
||||
@@ -1618,7 +1618,7 @@ those, replacing the ``NULL`` value used previously:
|
||||
}
|
||||
|
||||
This is enough to bind the virtual method. If you build the extension and run
|
||||
the demo project again, the ``_process()`` function will be called. You just won't
|
||||
the Godot project again, the ``_process()`` function will be called. You just won't
|
||||
be able to tell since the function itself does nothing visible. We will solve
|
||||
this now by making the custom node move following a pattern.
|
||||
|
||||
@@ -2114,7 +2114,7 @@ This updates the time passed for the signal emission and, if it is over one
|
||||
second it calls the ``emit_signal()`` function on the current instance, passing
|
||||
the name of the signal and the new position as arguments.
|
||||
|
||||
Now we're done with our C GDExtension. Build it once more and reopen the demo
|
||||
Now we're done with our C GDExtension. Build it once more and reopen the Godot
|
||||
project in the editor.
|
||||
|
||||
In the documentation page for ``GDExample`` you can see the new signal we bound:
|
||||
|
||||
Reference in New Issue
Block a user