Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Document new version defines and remove mentions of old defines #7525

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions tutorials/scripting/c_sharp/c_sharp_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@ Or you can detect which engine your code is in, useful for making cross-engine l
#endif
}

Or you can write scripts that target multiple Godot versions and can take
advantage that are only available on some of those versions:

.. code-block:: csharp

public void UseCoolFeature()
{
#if GODOT4_3_OR_GREATER || GODOT4_2_2_OR_GREATER
// Use CoolFeature, that was added to Godot in 4.3 and cherry-picked into 4.2.2, here.
#else
// Use a workaround for the absence of CoolFeature here.
#endif
}

Full list of defines
~~~~~~~~~~~~~~~~~~~~

Expand All @@ -159,15 +173,30 @@ Full list of defines
:ref:`OS <class_OS>` singleton, but not every possible OS
the method returns is an OS that Godot with .NET runs on.

When **exporting**, the following may also be defined depending on the export features:
* ``GODOTX``, ``GODOTX_Y``, ``GODOTX_Y_Z``, ``GODOTx_OR_GREATER``,
``GODOTX_y_OR_GREATER``, and ``GODOTX_Y_z_OR_GREATER``, where ``X``, ``Y``,
and ``Z`` are replaced by the current major, minor and patch version of Godot.
``x``, ``y``, and ``z`` are replaced by 0 to to the current version for that
component.

* One of ``GODOT_PC``, ``GODOT_MOBILE``, or ``GODOT_WEB`` depending on the platform type.
.. note::

These defines were first added in Godot 4.0.4 and 4.1. Version defines for
prior versions do not exist, regardless of the current Godot version.

* One of ``GODOT_ARM64_V8A`` or ``GODOT_ARMEABI_V7A`` on Android only depending on the architecture.
For example: Godot 4.0.5 defines ``GODOT4``, ``GODOT4_OR_GREATER``,
``GODOT4_0``, ``GODOT4_0_OR_GREATER``, ``GODOT4_0_5``,
``GODOT4_0_4_OR_GREATER``, and ``GODOT4_0_5_OR_GREATER``. Godot 4.3.2 defines
``GODOT4``, ``GODOT4_OR_GREATER``, ``GODOT4_3``, ``GODOT4_0_OR_GREATER``,
``GODOT4_1_OR_GREATER``, ``GODOT4_2_OR_GREATER``, ``GODOT4_3_OR_GREATER``,
``GODOT4_3_2``, ``GODOT4_3_0_OR_GREATER``, ``GODOT4_3_1_OR_GREATER``, and
``GODOT4_3_2_OR_GREATER``.

* One of ``GODOT_ARM64`` or ``GODOT_ARMV7`` on iOS only depending on the architecture.
When **exporting**, the following may also be defined depending on the export features:

* One of ``GODOT_PC``, ``GODOT_MOBILE``, or ``GODOT_WEB`` depending on the platform type.

* Any of ``GODOT_S3TC``, ``GODOT_ETC``, and ``GODOT_ETC2`` depending on the texture compression type.
* One of ``GODOT_WINDOWS``, ``GODOT_LINUXBSD``, ``GODOT_MACOS``, ``GODOT_UWP``, ``GODOT_HAIKU``, ``GODOT_ANDROID``, ``GODOT_IOS``, or ``GODOT_WEB`` depending on the platform.

To see an example project, see the OS testing demo:
https://github.com/godotengine/godot-demo-projects/tree/master/misc/os_test