Compare commits

..

42 Commits

Author SHA1 Message Date
Rémi Verschelde
f4f6fac4c7 CI: Install MinGW via egor-tensin/setup-mingw
Scoop install is being problematic since their 0.1.0 release.

(cherry picked from commit 3846201fbb)
2022-04-04 12:32:13 +02:00
Rémi Verschelde
b1ce0d7860 Update copyright year
(cherry picked from commit 7a3ad31dc4)
2022-04-04 12:32:08 +02:00
Rémi Verschelde
ced274fbe6 Merge pull request #711 from aaronfranke/3.4-black
[3.4] Run black format on SConstruct files and bindings generator
2022-02-26 23:45:40 +01:00
Aaron Franke
a706fdb10c [3.4] Run black format on SConstruct files and bindings generator 2022-02-26 15:04:26 -06:00
Rémi Verschelde
8b01d969c6 headers: Track tag godot-3.4.3-stable 2022-02-24 10:28:17 +01:00
Ivorius
45943c8476 In CMakeLists, use the new FindPython3 instead of FindPython 2022-01-26 18:48:56 +01:00
Rémi Verschelde
59ecf3b990 headers: Track tag godot-3.4.1-stable 2021-12-17 11:27:46 +01:00
Rémi Verschelde
4efceefe13 Merge pull request #666 from BimDav/fix_variant_operator= 2021-12-03 12:09:51 +01:00
BimDav
a93f7f9e73 Call Variant destructor in operator= 2021-12-03 11:11:32 +01:00
Rémi Verschelde
b31e690a91 Merge pull request #665 from akien-mga/3.x-ci-godot-3.4 2021-12-02 10:42:15 +01:00
Rémi Verschelde
a0f2ab1f31 CI: Update Godot binary to 3.4-stable for tests 2021-12-02 10:32:56 +01:00
Rémi Verschelde
68ce78179f headers: Track tag godot-3.4-stable 2021-11-04 15:39:20 +01:00
Rémi Verschelde
c12e9a3195 test: Style cleanup after opening in 3.4 2021-11-04 15:38:05 +01:00
Rémi Verschelde
1070a29d77 Add .gitignore for test, ignore potential log files 2021-11-04 15:32:51 +01:00
Rémi Verschelde
8366761930 Merge pull request #637 from Faless/osx/3.x_universal 2021-10-04 09:13:17 +02:00
Fabio Alessandrelli
de89011ca4 [CI] Use MacOS universal build instead of 2 builds.
Switch to the now available macOS 11 for building.
2021-10-02 14:01:13 +02:00
Fabio Alessandrelli
a1337a2dd7 [OSX] Add universal build support. 2021-10-02 14:01:13 +02:00
Rémi Verschelde
99e9dd1d93 Merge pull request #621 from akien-mga/3.4-beta5 2021-09-27 13:12:10 +02:00
Rémi Verschelde
68372606b5 headers: Sync with Godot 3.4 beta 5 2021-09-27 12:51:47 +02:00
Rémi Verschelde
bfdf55afd9 Merge pull request #620 from akien-mga/bindgen-fix-NodePath-escape 2021-09-27 12:51:07 +02:00
Rémi Verschelde
b8658d3733 Merge pull request #619 from BastiaanOlij/update_godot_3_info 2021-09-27 12:43:50 +02:00
Rémi Verschelde
83ef64079b bindgen: Properly escape NodePath in default args 2021-09-27 12:41:46 +02:00
Bastiaan Olij
74cee6e6b7 Updating readme for new branch info 2021-09-27 20:28:16 +10:00
Rémi Verschelde
4e8508ad53 Fixup style after #563 2021-09-27 12:26:32 +02:00
Rémi Verschelde
407710b622 Merge pull request #513 from beroso/fix/windows_cpp_17 2021-09-27 11:50:12 +02:00
Rémi Verschelde
907d35126e Merge pull request #538 from anunknowperson/patch-1 2021-09-27 11:44:43 +02:00
Rémi Verschelde
228014bec8 Merge pull request #547 from piiertho/hotfix/add-android-missing-toolchain-elements 2021-09-27 11:42:39 +02:00
Rémi Verschelde
3de367920f Merge pull request #563 from LinwoodCloud/master 2021-09-27 11:41:41 +02:00
Rémi Verschelde
055f3141f8 Merge pull request #588 from aaronfranke/signal-no-arg 2021-09-27 11:34:08 +02:00
Rémi Verschelde
7a693df988 Merge pull request #601 from colugomusic/fix-string-args-constness 2021-09-27 11:31:56 +02:00
Rémi Verschelde
0fba89df67 Merge pull request #595 from Calinou/add-license-headers 2021-09-27 11:31:31 +02:00
Rémi Verschelde
c109d4e5dc Merge pull request #607 from samsface/master 2021-09-27 11:24:07 +02:00
Rémi Verschelde
654836a135 Merge pull request #587 from Faless/fix/osx_names 2021-09-27 11:22:13 +02:00
Sam
6b31e67dd3 Fix Clang 11 build failure over -Wabsolute-value 2021-09-01 23:08:30 +01:00
Colugo
bba8393af7 Fix argument constness in String::begins_with, String::ends_with 2021-08-22 16:02:14 +01:00
Hugo Locurcio
cf5428e103 Add license headers to all source and header files
This is consistent with the core Godot source code, and ensures the
license isn't detached from its original code when individual files
are distributed.
2021-08-02 18:34:58 +02:00
Aaron Franke
95ff72706d Add ability to easily register signals with no arguments 2021-07-10 19:23:36 -04:00
Fabio Alessandrelli
1db7630d01 Fix OSX library name for arm64.
Was always `.64`, it's now `.arm64` for M1.
2021-07-10 19:02:52 +02:00
kb1000
3fe276c02f Stop including iostream in Variant.hpp (to produce smaller binaries) 2021-05-23 16:28:11 +02:00
Pierre-Thomas Meisels
f579039a0a Fix: add missing toolchain elements for android 2021-04-25 21:24:38 +02:00
anunknowperson
a3f1175f1c Update godot version in README.MD
3.2.4 -> 3.3
2021-03-25 12:42:52 +07:00
André Sousa
5f24388b04 Add -std:c++17 flag on test windows build 2021-02-14 20:41:59 -03:00
60 changed files with 2079 additions and 607 deletions

View File

@@ -21,8 +21,8 @@ jobs:
sudo apt-get update -qq
sudo apt-get install -qqq build-essential pkg-config
python -m pip install scons
curl -LO https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_linux_server.64.zip
unzip Godot_v3.3.3-stable_linux_server.64.zip
curl -LO https://downloads.tuxfamily.org/godotengine/3.4/Godot_v3.4-stable_linux_server.64.zip
unzip Godot_v3.4-stable_linux_server.64.zip
- name: Build godot-cpp
run: |
@@ -41,7 +41,7 @@ jobs:
- name: Run test GDNative library
run: |
./Godot_v3.3.3-stable_linux_server.64 --path test -s script.gd
./Godot_v3.4-stable_linux_server.64 --path test -s script.gd
windows-msvc:
name: Build (Windows, MSVC)
@@ -90,13 +90,11 @@ jobs:
run: |
python -m pip install scons
- name: Setup MinGW for Windows/MinGW build
uses: egor-tensin/setup-mingw@v2
- name: Build godot-cpp
# Install GCC from Scoop as the default supplied GCC doesn't work ("Error 1").
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install gcc
g++ --version
gcc --version
scons target=release generate_bindings=yes use_mingw=yes -j $env:NUMBER_OF_PROCESSORS
- name: Upload artifact
@@ -108,7 +106,7 @@ jobs:
macos:
name: Build (macOS, Clang)
runs-on: macos-10.15
runs-on: macos-11
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -123,8 +121,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install scons
curl -LO https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_osx.universal.zip
unzip Godot_v3.3.3-stable_osx.universal.zip
curl -LO https://downloads.tuxfamily.org/godotengine/3.4/Godot_v3.4-stable_osx.universal.zip
unzip Godot_v3.4-stable_osx.universal.zip
- name: Build godot-cpp
run: |
@@ -133,45 +131,18 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: godot-cpp-macos-x86_64-release
name: godot-cpp-macos-universal-release
path: bin/libgodot-cpp.osx.release.64.a
if-no-files-found: error
- name: Build test GDNative library
run: |
scons target=release platform=osx bits=64 -j $(sysctl -n hw.logicalcpu) -C test
scons target=release platform=osx bits=64 macos_arch=universal -j $(sysctl -n hw.logicalcpu) -C test
- name: Run test GDNative library
run: |
./Godot.app/Contents/MacOS/Godot --path test -s script.gd
macos-arm64:
name: Build (macOS, Clang, cross-compile arm64)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python (for SCons)
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install scons
- name: Build godot-cpp
run: |
# The default SDK in github the actions environemnt seems to have problems compiling for arm64.
# Use the latest 11.x SDK.
SDK_BASE=/Library/Developer/CommandLineTools/SDKs
SDK_VER=$(ls $SDK_BASE | grep "MacOSX11." | sort -r | head -n1)
echo $SDK_BASE/$SDK_VER/
scons target=release generate_bindings=yes macos_arch=arm64 macos_deployment_target=10.15 macos_sdk_path="$SDK_BASE/$SDK_VER/" -j $(sysctl -n hw.logicalcpu)
static-checks:
name: Static Checks (clang-format)
runs-on: ubuntu-20.04

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
# Misc
logs/*
*.log
# Binaries
*.o

View File

@@ -133,7 +133,7 @@ else()
endif()
# Generate source from the bindings file
find_package(PythonInterp REQUIRED)
find_package(Python3 3.4 REQUIRED) # pathlib should be present
if(GENERATE_TEMPLATE_GET_NODE)
set(GENERATE_BINDING_PARAMETERS "True")
else()
@@ -141,14 +141,14 @@ else()
endif()
message(STATUS "Generating Bindings")
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", headers=True)"
execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", headers=True)"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE HEADERS_FILE_LIST_RESULT
OUTPUT_VARIABLE HEADERS_FILE_LIST
)
set(HEADERS_FILE_LIST ${HEADERS_FILE_LIST})
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", sources=True)"
execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", sources=True)"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE SOURCES_FILE_LIST_RESULT
OUTPUT_VARIABLE SOURCES_FILE_LIST
@@ -156,7 +156,7 @@ execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import binding_generator; b
set(SOURCES_FILE_LIST ${SOURCES_FILE_LIST})
add_custom_command(OUTPUT ${HEADERS_FILE_LIST} ${SOURCES_FILE_LIST}
COMMAND "${PYTHON_EXECUTABLE}" "-c" "import binding_generator; binding_generator.generate_bindings(\"${GODOT_CUSTOM_API_FILE}\", \"${GENERATE_BINDING_PARAMETERS}\", \"${CMAKE_CURRENT_BINARY_DIR}\")"
COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.generate_bindings(\"${GODOT_CUSTOM_API_FILE}\", \"${GENERATE_BINDING_PARAMETERS}\", \"${CMAKE_CURRENT_BINARY_DIR}\")"
VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
MAIN_DEPENDENCY ${GODOT_CUSTOM_API_FILE}

View File

@@ -1,6 +1,6 @@
# MIT License
Copyright (c) 2017-2021 Godot Engine contributors.
Copyright (c) 2017-2022 Godot Engine contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,27 +1,41 @@
# godot-cpp
**C++ bindings for the Godot script API.**
The instructions below feature the new NativeScript 1.1 class structure and will only work for modules created for Godot 3.1 and later. Use the following branches for older implementations:
Version | Branch
--- | ---
**Godot 3.0 Nativescript 1.0** | [3.0](https://github.com/godotengine/godot-cpp/tree/3.0)
**Godot 3.1 Nativescript 1.0** | [nativescript-1.0](https://github.com/godotengine/godot-cpp/tree/nativescript-1.0)
## Table of contents
This repository contains the *C++ bindings* for the [**Godot Engine**](https://github.com/godotengine/godot)'s GDNative API.
- [**Versioning**](#versioning)
- [**Contributing**](#contributing)
- [**Getting Started**](#getting-started)
- [**Creating a simple class**](#creating-a-simple-class)
## Versioning
This repositories follows the same branch versioning as the main [Godot Engine
repository](https://github.com/godotengine/godot):
- `master` tracks the current development branch.
- `3.x` tracks the development of the next 3.x minor release.
- Other versioned branches (e.g. `3.3`, `3.2`) track the latest stable release
in the corresponding branch.
Stable releases are also tagged on this repository:
[**Tags**](https://github.com/godotengine/godot-cpp/tags).
**For any project built against a stable release of Godot, we recommend using
this repository as a Git submodule, checking out the specific tag matching your
Godot version.**
> As the `master` and `3.x` branches are constantly getting updates, if you are
> using `godot-cpp` against a more current version of Godot, see the instructions
> in [**godot-headers**](https://github.com/godotengine/godot-headers) for
> updating the relevant files.
## Contributing
We greatly appreciate help in maintaining and extending this project. If you
wish to help out, ensure you have an account on GitHub and create a "fork" of
this repository. Rémi "Akien" Verschelde wrote an excellent bit of documentation
for the main Godot project on this:
[Pull request workflow](https://docs.godotengine.org/en/3.0/community/contributing/pr_workflow.html)
[Pull request workflow](https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html)
Please install clang-format and copy the files in `misc/hooks` into `.git/hooks`
so formatting is done before your changes are submitted.
@@ -275,7 +289,7 @@ Godot headers repository for more information.
#### HTML5
GDNative is supported on [specific exports](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_web.html#export-options) for the HTML5 platform since Godot `3.2.4`. Linking webassembly modules is currently underspecified in the standard, but [emscripten](https://emscripten.org/), which Godot uses to build the HTML5 version, implements its own linking system.
GDNative is supported on [specific exports](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_web.html#export-options) for the HTML5 platform since Godot `3.3`. Linking webassembly modules is currently underspecified in the standard, but [emscripten](https://emscripten.org/), which Godot uses to build the HTML5 version, implements its own linking system.
To build GDNative libraries, you will need a recent version of [Emscripten](https://emscripten.org/).

View File

@@ -5,24 +5,35 @@ import sys
import subprocess
if sys.version_info < (3,):
def decode_utf8(x):
return x
else:
import codecs
def decode_utf8(x):
return codecs.utf_8_decode(x)[0]
# Workaround for MinGW. See:
# http://www.scons.org/wiki/LongCmdLinesOnWin32
if (os.name=="nt"):
if os.name == "nt":
import subprocess
def mySubProcess(cmdline,env):
#print "SPAWNED : " + cmdline
def mySubProcess(cmdline, env):
# print "SPAWNED : " + cmdline
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
proc = subprocess.Popen(
cmdline,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
startupinfo=startupinfo,
shell=False,
env=env,
)
data, err = proc.communicate()
rv = proc.wait()
if rv:
@@ -33,158 +44,104 @@ if (os.name=="nt"):
def mySpawn(sh, escape, cmd, args, env):
newargs = ' '.join(args[1:])
newargs = " ".join(args[1:])
cmdline = cmd + " " + newargs
rv=0
if len(cmdline) > 32000 and cmd.endswith("ar") :
rv = 0
if len(cmdline) > 32000 and cmd.endswith("ar"):
cmdline = cmd + " " + args[1] + " " + args[2] + " "
for i in range(3,len(args)) :
rv = mySubProcess( cmdline + args[i], env )
if rv :
for i in range(3, len(args)):
rv = mySubProcess(cmdline + args[i], env)
if rv:
break
else:
rv = mySubProcess( cmdline, env )
rv = mySubProcess(cmdline, env)
return rv
def add_sources(sources, dir, extension):
for f in os.listdir(dir):
if f.endswith('.' + extension):
sources.append(dir + '/' + f)
if f.endswith("." + extension):
sources.append(dir + "/" + f)
# Try to detect the host platform automatically.
# This is used if no `platform` argument is passed
if sys.platform.startswith('linux'):
host_platform = 'linux'
elif sys.platform.startswith('freebsd'):
host_platform = 'freebsd'
elif sys.platform == 'darwin':
host_platform = 'osx'
elif sys.platform == 'win32' or sys.platform == 'msys':
host_platform = 'windows'
if sys.platform.startswith("linux"):
host_platform = "linux"
elif sys.platform.startswith("freebsd"):
host_platform = "freebsd"
elif sys.platform == "darwin":
host_platform = "osx"
elif sys.platform == "win32" or sys.platform == "msys":
host_platform = "windows"
else:
raise ValueError(
'Could not detect platform automatically, please specify with '
'platform=<platform>'
)
raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
env = Environment(ENV = os.environ)
env = Environment(ENV=os.environ)
is64 = sys.maxsize > 2**32
is64 = sys.maxsize > 2 ** 32
if (
env['TARGET_ARCH'] == 'amd64' or
env['TARGET_ARCH'] == 'emt64' or
env['TARGET_ARCH'] == 'x86_64' or
env['TARGET_ARCH'] == 'arm64-v8a'
env["TARGET_ARCH"] == "amd64"
or env["TARGET_ARCH"] == "emt64"
or env["TARGET_ARCH"] == "x86_64"
or env["TARGET_ARCH"] == "arm64-v8a"
):
is64 = True
opts = Variables([], ARGUMENTS)
opts.Add(EnumVariable(
'platform',
'Target platform',
host_platform,
allowed_values=('linux', 'freebsd', 'osx', 'windows', 'android', 'ios', 'javascript'),
ignorecase=2
))
opts.Add(EnumVariable(
'bits',
'Target platform bits',
'64' if is64 else '32',
('32', '64')
))
opts.Add(BoolVariable(
'use_llvm',
'Use the LLVM compiler - only effective when targeting Linux or FreeBSD',
False
))
opts.Add(BoolVariable(
'use_mingw',
'Use the MinGW compiler instead of MSVC - only effective on Windows',
False
))
opts.Add(
EnumVariable(
"platform",
"Target platform",
host_platform,
allowed_values=("linux", "freebsd", "osx", "windows", "android", "ios", "javascript"),
ignorecase=2,
)
)
opts.Add(EnumVariable("bits", "Target platform bits", "64" if is64 else "32", ("32", "64")))
opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler - only effective when targeting Linux or FreeBSD", False))
opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False))
# Must be the same setting as used for cpp_bindings
opts.Add(EnumVariable(
'target',
'Compilation target',
'debug',
allowed_values=('debug', 'release'),
ignorecase=2
))
opts.Add(PathVariable(
'headers_dir',
'Path to the directory containing Godot headers',
'godot-headers',
PathVariable.PathIsDir
))
opts.Add(PathVariable(
'custom_api_file',
'Path to a custom JSON API file',
None,
PathVariable.PathIsFile
))
opts.Add(EnumVariable(
'generate_bindings',
'Generate GDNative API bindings',
'auto',
allowed_values = ['yes', 'no', 'auto', 'true'],
ignorecase = 2
))
opts.Add(EnumVariable(
'android_arch',
'Target Android architecture',
'armv7',
['armv7','arm64v8','x86','x86_64']
))
opts.Add(EnumVariable("target", "Compilation target", "debug", allowed_values=("debug", "release"), ignorecase=2))
opts.Add(
'macos_deployment_target',
'macOS deployment target',
'default'
PathVariable(
"headers_dir", "Path to the directory containing Godot headers", "godot-headers", PathVariable.PathIsDir
)
)
opts.Add(PathVariable("custom_api_file", "Path to a custom JSON API file", None, PathVariable.PathIsFile))
opts.Add(
EnumVariable(
"generate_bindings",
"Generate GDNative API bindings",
"auto",
allowed_values=["yes", "no", "auto", "true"],
ignorecase=2,
)
)
opts.Add(EnumVariable("android_arch", "Target Android architecture", "armv7", ["armv7", "arm64v8", "x86", "x86_64"]))
opts.Add("macos_deployment_target", "macOS deployment target", "default")
opts.Add("macos_sdk_path", "macOS SDK path", "")
opts.Add(EnumVariable("macos_arch", "Target macOS architecture", "universal", ["universal", "x86_64", "arm64"]))
opts.Add(EnumVariable("ios_arch", "Target iOS architecture", "arm64", ["armv7", "arm64", "x86_64"]))
opts.Add(BoolVariable("ios_simulator", "Target iOS Simulator", False))
opts.Add(
"IPHONEPATH",
"Path to iPhone toolchain",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain",
)
opts.Add(
'macos_sdk_path',
'macOS SDK path',
''
)
opts.Add(EnumVariable(
'macos_arch',
'Target macOS architecture',
'x86_64',
['x86_64', 'arm64']
))
opts.Add(EnumVariable(
'ios_arch',
'Target iOS architecture',
'arm64',
['armv7', 'arm64', 'x86_64']
))
opts.Add(BoolVariable(
'ios_simulator',
'Target iOS Simulator',
False
))
opts.Add(
'IPHONEPATH',
'Path to iPhone toolchain',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain',
"android_api_level",
"Target Android API level",
"18" if ARGUMENTS.get("android_arch", "armv7") in ["armv7", "x86"] else "21",
)
opts.Add(
'android_api_level',
'Target Android API level',
'18' if ARGUMENTS.get("android_arch", 'armv7') in ['armv7', 'x86'] else '21'
"ANDROID_NDK_ROOT",
"Path to your Android NDK installation. By default, uses ANDROID_NDK_ROOT from your defined environment variables.",
os.environ.get("ANDROID_NDK_ROOT", None),
)
opts.Add(
'ANDROID_NDK_ROOT',
'Path to your Android NDK installation. By default, uses ANDROID_NDK_ROOT from your defined environment variables.',
os.environ.get("ANDROID_NDK_ROOT", None)
)
opts.Add(BoolVariable(
'generate_template_get_node',
"Generate a template version of the Node class's get_node.",
True
))
opts.Add(BoolVariable("generate_template_get_node", "Generate a template version of the Node class's get_node.", True))
opts.Update(env)
Help(opts.GenerateHelpText(env))
@@ -192,209 +149,241 @@ Help(opts.GenerateHelpText(env))
# This makes sure to keep the session environment variables on Windows.
# This way, you can run SCons in a Visual Studio 2017 prompt and it will find
# all the required tools
if host_platform == 'windows' and env['platform'] != 'android':
if env['bits'] == '64':
env = Environment(TARGET_ARCH='amd64')
elif env['bits'] == '32':
env = Environment(TARGET_ARCH='x86')
if host_platform == "windows" and env["platform"] != "android":
if env["bits"] == "64":
env = Environment(TARGET_ARCH="amd64")
elif env["bits"] == "32":
env = Environment(TARGET_ARCH="x86")
opts.Update(env)
if env['platform'] == 'linux' or env['platform'] == 'freebsd':
if env['use_llvm']:
env['CXX'] = 'clang++'
if env["platform"] == "linux" or env["platform"] == "freebsd":
if env["use_llvm"]:
env["CXX"] = "clang++"
env.Append(CCFLAGS=['-fPIC', '-std=c++14', '-Wwrite-strings'])
env.Append(CCFLAGS=["-fPIC", "-std=c++14", "-Wwrite-strings"])
env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
if env['target'] == 'debug':
env.Append(CCFLAGS=['-Og', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
if env["target"] == "debug":
env.Append(CCFLAGS=["-Og", "-g"])
elif env["target"] == "release":
env.Append(CCFLAGS=["-O3"])
if env['bits'] == '64':
env.Append(CCFLAGS=['-m64'])
env.Append(LINKFLAGS=['-m64'])
elif env['bits'] == '32':
env.Append(CCFLAGS=['-m32'])
env.Append(LINKFLAGS=['-m32'])
if env["bits"] == "64":
env.Append(CCFLAGS=["-m64"])
env.Append(LINKFLAGS=["-m64"])
elif env["bits"] == "32":
env.Append(CCFLAGS=["-m32"])
env.Append(LINKFLAGS=["-m32"])
elif env['platform'] == 'osx':
elif env["platform"] == "osx":
# Use Clang on macOS by default
env['CXX'] = 'clang++'
env["CXX"] = "clang++"
if env['bits'] == '32':
raise ValueError(
'Only 64-bit builds are supported for the macOS target.'
)
if env["bits"] == "32":
raise ValueError("Only 64-bit builds are supported for the macOS target.")
env.Append(CCFLAGS=['-std=c++14', '-arch', env['macos_arch']])
if env['macos_deployment_target'] != 'default':
env.Append(CCFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
env.Append(LINKFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
if env['macos_sdk_path']:
env.Append(CCFLAGS=['-isysroot', env['macos_sdk_path']])
env.Append(LINKFLAGS=['-isysroot', env['macos_sdk_path']])
env.Append(LINKFLAGS=[
'-arch',
env['macos_arch'],
'-framework',
'Cocoa',
'-Wl,-undefined,dynamic_lookup',
])
if env['target'] == 'debug':
env.Append(CCFLAGS=['-Og', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
elif env['platform'] == 'ios':
if env['ios_simulator']:
sdk_name = 'iphonesimulator'
env.Append(CCFLAGS=['-mios-simulator-version-min=10.0'])
env['LIBSUFFIX'] = ".simulator" + env['LIBSUFFIX']
if env["macos_arch"] == "universal":
env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"])
else:
sdk_name = 'iphoneos'
env.Append(CCFLAGS=['-miphoneos-version-min=10.0'])
env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
env.Append(CCFLAGS=["-arch", env["macos_arch"]])
env.Append(CCFLAGS=["-std=c++14"])
if env["macos_deployment_target"] != "default":
env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
if env["macos_sdk_path"]:
env.Append(CCFLAGS=["-isysroot", env["macos_sdk_path"]])
env.Append(LINKFLAGS=["-isysroot", env["macos_sdk_path"]])
env.Append(
LINKFLAGS=[
"-framework",
"Cocoa",
"-Wl,-undefined,dynamic_lookup",
]
)
if env["target"] == "debug":
env.Append(CCFLAGS=["-Og", "-g"])
elif env["target"] == "release":
env.Append(CCFLAGS=["-O3"])
elif env["platform"] == "ios":
if env["ios_simulator"]:
sdk_name = "iphonesimulator"
env.Append(CCFLAGS=["-mios-simulator-version-min=10.0"])
env["LIBSUFFIX"] = ".simulator" + env["LIBSUFFIX"]
else:
sdk_name = "iphoneos"
env.Append(CCFLAGS=["-miphoneos-version-min=10.0"])
try:
sdk_path = decode_utf8(subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip())
sdk_path = decode_utf8(subprocess.check_output(["xcrun", "--sdk", sdk_name, "--show-sdk-path"]).strip())
except (subprocess.CalledProcessError, OSError):
raise ValueError("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name))
compiler_path = env['IPHONEPATH'] + '/usr/bin/'
env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
compiler_path = env["IPHONEPATH"] + "/usr/bin/"
env["ENV"]["PATH"] = env["IPHONEPATH"] + "/Developer/usr/bin/:" + env["ENV"]["PATH"]
env['CC'] = compiler_path + 'clang'
env['CXX'] = compiler_path + 'clang++'
env['AR'] = compiler_path + 'ar'
env['RANLIB'] = compiler_path + 'ranlib'
env["CC"] = compiler_path + "clang"
env["CXX"] = compiler_path + "clang++"
env["AR"] = compiler_path + "ar"
env["RANLIB"] = compiler_path + "ranlib"
env.Append(CCFLAGS=['-std=c++14', '-arch', env['ios_arch'], '-isysroot', sdk_path])
env.Append(LINKFLAGS=[
'-arch',
env['ios_arch'],
'-framework',
'Cocoa',
'-Wl,-undefined,dynamic_lookup',
'-isysroot', sdk_path,
'-F' + sdk_path
])
env.Append(CCFLAGS=["-std=c++14", "-arch", env["ios_arch"], "-isysroot", sdk_path])
env.Append(
LINKFLAGS=[
"-arch",
env["ios_arch"],
"-framework",
"Cocoa",
"-Wl,-undefined,dynamic_lookup",
"-isysroot",
sdk_path,
"-F" + sdk_path,
]
)
if env['target'] == 'debug':
env.Append(CCFLAGS=['-Og', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
if env["target"] == "debug":
env.Append(CCFLAGS=["-Og", "-g"])
elif env["target"] == "release":
env.Append(CCFLAGS=["-O3"])
elif env['platform'] == 'windows':
if host_platform == 'windows' and not env['use_mingw']:
elif env["platform"] == "windows":
if host_platform == "windows" and not env["use_mingw"]:
# MSVC
env.Append(LINKFLAGS=['/WX'])
if env['target'] == 'debug':
env.Append(CCFLAGS=['/Z7', '/Od', '/EHsc', '/D_DEBUG', '/MDd'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['/O2', '/EHsc', '/DNDEBUG', '/MD'])
env.Append(LINKFLAGS=["/WX"])
if env["target"] == "debug":
env.Append(CCFLAGS=["/Z7", "/Od", "/EHsc", "/D_DEBUG", "/MDd"])
elif env["target"] == "release":
env.Append(CCFLAGS=["/O2", "/EHsc", "/DNDEBUG", "/MD"])
elif host_platform == 'linux' or host_platform == 'freebsd' or host_platform == 'osx':
elif host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx":
# Cross-compilation using MinGW
if env['bits'] == '64':
env['CXX'] = 'x86_64-w64-mingw32-g++'
env['AR'] = "x86_64-w64-mingw32-ar"
env['RANLIB'] = "x86_64-w64-mingw32-ranlib"
env['LINK'] = "x86_64-w64-mingw32-g++"
elif env['bits'] == '32':
env['CXX'] = 'i686-w64-mingw32-g++'
env['AR'] = "i686-w64-mingw32-ar"
env['RANLIB'] = "i686-w64-mingw32-ranlib"
env['LINK'] = "i686-w64-mingw32-g++"
elif host_platform == 'windows' and env['use_mingw']:
if env["bits"] == "64":
env["CXX"] = "x86_64-w64-mingw32-g++"
env["AR"] = "x86_64-w64-mingw32-ar"
env["RANLIB"] = "x86_64-w64-mingw32-ranlib"
env["LINK"] = "x86_64-w64-mingw32-g++"
elif env["bits"] == "32":
env["CXX"] = "i686-w64-mingw32-g++"
env["AR"] = "i686-w64-mingw32-ar"
env["RANLIB"] = "i686-w64-mingw32-ranlib"
env["LINK"] = "i686-w64-mingw32-g++"
elif host_platform == "windows" and env["use_mingw"]:
# Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
env = Environment(ENV = os.environ, tools=["mingw"])
env = Environment(ENV=os.environ, tools=["mingw"])
opts.Update(env)
#env = env.Clone(tools=['mingw'])
# env = env.Clone(tools=['mingw'])
env["SPAWN"] = mySpawn
# Native or cross-compilation using MinGW
if host_platform == 'linux' or host_platform == 'freebsd' or host_platform == 'osx' or env['use_mingw']:
if host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx" or env["use_mingw"]:
# These options are for a release build even using target=debug
env.Append(CCFLAGS=['-O3', '-std=c++14', '-Wwrite-strings'])
env.Append(LINKFLAGS=[
'--static',
'-Wl,--no-undefined',
'-static-libgcc',
'-static-libstdc++',
])
env.Append(CCFLAGS=["-O3", "-std=c++14", "-Wwrite-strings"])
env.Append(
LINKFLAGS=[
"--static",
"-Wl,--no-undefined",
"-static-libgcc",
"-static-libstdc++",
]
)
elif env['platform'] == 'android':
if host_platform == 'windows':
elif env["platform"] == "android":
if host_platform == "windows":
# Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
env = Environment(ENV = os.environ, tools=["mingw"])
env = Environment(ENV=os.environ, tools=["mingw"])
opts.Update(env)
#env = env.Clone(tools=['mingw'])
# env = env.Clone(tools=['mingw'])
env["SPAWN"] = mySpawn
# Verify NDK root
if not 'ANDROID_NDK_ROOT' in env:
raise ValueError("To build for Android, ANDROID_NDK_ROOT must be defined. Please set ANDROID_NDK_ROOT to the root folder of your Android NDK installation.")
if not "ANDROID_NDK_ROOT" in env:
raise ValueError(
"To build for Android, ANDROID_NDK_ROOT must be defined. Please set ANDROID_NDK_ROOT to the root folder of your Android NDK installation."
)
# Validate API level
api_level = int(env['android_api_level'])
if env['android_arch'] in ['x86_64', 'arm64v8'] and api_level < 21:
api_level = int(env["android_api_level"])
if env["android_arch"] in ["x86_64", "arm64v8"] and api_level < 21:
print("WARN: 64-bit Android architectures require an API level of at least 21; setting android_api_level=21")
env['android_api_level'] = '21'
env["android_api_level"] = "21"
api_level = 21
# Setup toolchain
toolchain = env['ANDROID_NDK_ROOT'] + "/toolchains/llvm/prebuilt/"
toolchain = env["ANDROID_NDK_ROOT"] + "/toolchains/llvm/prebuilt/"
if host_platform == "windows":
toolchain += "windows"
import platform as pltfm
if pltfm.machine().endswith("64"):
toolchain += "-x86_64"
elif host_platform == "linux":
toolchain += "linux-x86_64"
elif host_platform == "osx":
toolchain += "darwin-x86_64"
env.PrependENVPath('PATH', toolchain + "/bin") # This does nothing half of the time, but we'll put it here anyways
env.PrependENVPath("PATH", toolchain + "/bin") # This does nothing half of the time, but we'll put it here anyways
# Get architecture info
arch_info_table = {
"armv7" : {
"march":"armv7-a", "target":"armv7a-linux-androideabi", "tool_path":"arm-linux-androideabi", "compiler_path":"armv7a-linux-androideabi",
"ccflags" : ['-mfpu=neon']
},
"arm64v8" : {
"march":"armv8-a", "target":"aarch64-linux-android", "tool_path":"aarch64-linux-android", "compiler_path":"aarch64-linux-android",
"ccflags" : []
},
"x86" : {
"march":"i686", "target":"i686-linux-android", "tool_path":"i686-linux-android", "compiler_path":"i686-linux-android",
"ccflags" : ['-mstackrealign']
},
"x86_64" : {"march":"x86-64", "target":"x86_64-linux-android", "tool_path":"x86_64-linux-android", "compiler_path":"x86_64-linux-android",
"ccflags" : []
}
"armv7": {
"march": "armv7-a",
"target": "armv7a-linux-androideabi",
"tool_path": "arm-linux-androideabi",
"compiler_path": "armv7a-linux-androideabi",
"ccflags": ["-mfpu=neon"],
},
"arm64v8": {
"march": "armv8-a",
"target": "aarch64-linux-android",
"tool_path": "aarch64-linux-android",
"compiler_path": "aarch64-linux-android",
"ccflags": [],
},
"x86": {
"march": "i686",
"target": "i686-linux-android",
"tool_path": "i686-linux-android",
"compiler_path": "i686-linux-android",
"ccflags": ["-mstackrealign"],
},
"x86_64": {
"march": "x86-64",
"target": "x86_64-linux-android",
"tool_path": "x86_64-linux-android",
"compiler_path": "x86_64-linux-android",
"ccflags": [],
},
}
arch_info = arch_info_table[env['android_arch']]
arch_info = arch_info_table[env["android_arch"]]
# Setup tools
env['CC'] = toolchain + "/bin/clang"
env['CXX'] = toolchain + "/bin/clang++"
env['AR'] = toolchain + "/bin/" + arch_info['tool_path'] + "-ar"
env["CC"] = toolchain + "/bin/clang"
env["CXX"] = toolchain + "/bin/clang++"
env["AR"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ar"
env["AS"] = toolchain + "/bin/" + arch_info["tool_path"] + "-as"
env["LD"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ld"
env["STRIP"] = toolchain + "/bin/" + arch_info["tool_path"] + "-strip"
env["RANLIB"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ranlib"
env.Append(CCFLAGS=['--target=' + arch_info['target'] + env['android_api_level'], '-march=' + arch_info['march'], '-fPIC'])#, '-fPIE', '-fno-addrsig', '-Oz'])
env.Append(CCFLAGS=arch_info['ccflags'])
env.Append(
CCFLAGS=["--target=" + arch_info["target"] + env["android_api_level"], "-march=" + arch_info["march"], "-fPIC"]
)
env.Append(CCFLAGS=arch_info["ccflags"])
if env['target'] == 'debug':
env.Append(CCFLAGS=['-Og', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
if env["target"] == "debug":
env.Append(CCFLAGS=["-Og", "-g"])
elif env["target"] == "release":
env.Append(CCFLAGS=["-O3"])
elif env["platform"] == "javascript":
env["ENV"] = os.environ
@@ -421,61 +410,62 @@ elif env["platform"] == "javascript":
env["LIBSUFFIX"] = ".a"
env["LIBPREFIXES"] = ["$LIBPREFIX"]
env["LIBSUFFIXES"] = ["$LIBSUFFIX"]
env.Replace(SHLINKFLAGS='$LINKFLAGS')
env.Replace(SHLINKFLAGS='$LINKFLAGS')
env.Replace(SHLINKFLAGS="$LINKFLAGS")
env.Replace(SHLINKFLAGS="$LINKFLAGS")
if env['target'] == 'debug':
env.Append(CCFLAGS=['-O0', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
if env["target"] == "debug":
env.Append(CCFLAGS=["-O0", "-g"])
elif env["target"] == "release":
env.Append(CCFLAGS=["-O3"])
env.Append(CPPPATH=[
'.',
env['headers_dir'],
'include',
'include/gen',
'include/core',
])
env.Append(
CPPPATH=[
".",
env["headers_dir"],
"include",
"include/gen",
"include/core",
]
)
# Generate bindings?
json_api_file = ''
json_api_file = ""
if 'custom_api_file' in env:
json_api_file = env['custom_api_file']
if "custom_api_file" in env:
json_api_file = env["custom_api_file"]
else:
json_api_file = os.path.join(os.getcwd(), env['headers_dir'], 'api.json')
json_api_file = os.path.join(os.getcwd(), env["headers_dir"], "api.json")
if env['generate_bindings'] == 'auto':
if env["generate_bindings"] == "auto":
# Check if generated files exist
should_generate_bindings = not os.path.isfile(os.path.join(os.getcwd(), 'src', 'gen', 'Object.cpp'))
should_generate_bindings = not os.path.isfile(os.path.join(os.getcwd(), "src", "gen", "Object.cpp"))
else:
should_generate_bindings = env['generate_bindings'] in ['yes', 'true']
should_generate_bindings = env["generate_bindings"] in ["yes", "true"]
if should_generate_bindings:
# Actually create the bindings here
import binding_generator
binding_generator.generate_bindings(json_api_file, env['generate_template_get_node'])
binding_generator.generate_bindings(json_api_file, env["generate_template_get_node"])
# Sources to compile
sources = []
add_sources(sources, 'src/core', 'cpp')
add_sources(sources, 'src/gen', 'cpp')
add_sources(sources, "src/core", "cpp")
add_sources(sources, "src/gen", "cpp")
arch_suffix = env['bits']
if env['platform'] == 'android':
arch_suffix = env['android_arch']
if env['platform'] == 'ios':
arch_suffix = env['ios_arch']
if env['platform'] == 'javascript':
arch_suffix = 'wasm'
arch_suffix = env["bits"]
if env["platform"] == "android":
arch_suffix = env["android_arch"]
elif env["platform"] == "ios":
arch_suffix = env["ios_arch"]
elif env["platform"] == "osx":
if env["macos_arch"] != "universal":
arch_suffix = env["macos_arch"]
elif env["platform"] == "javascript":
arch_suffix = "wasm"
library = env.StaticLibrary(
target='bin/' + 'libgodot-cpp.{}.{}.{}{}'.format(
env['platform'],
env['target'],
arch_suffix,
env['LIBSUFFIX']
), source=sources
target="bin/" + "libgodot-cpp.{}.{}.{}{}".format(env["platform"], env["target"], arch_suffix, env["LIBSUFFIX"]),
source=sources,
)
Default(library)

View File

@@ -17,11 +17,11 @@ classes = []
def print_file_list(api_filepath, output_dir, headers=False, sources=False):
global classes
end = ';'
end = ";"
with open(api_filepath) as api_file:
classes = json.load(api_file)
include_gen_folder = Path(output_dir) / 'include' / 'gen'
source_gen_folder = Path(output_dir) / 'src' / 'gen'
include_gen_folder = Path(output_dir) / "include" / "gen"
source_gen_folder = Path(output_dir) / "src" / "gen"
for _class in classes:
header_filename = include_gen_folder / (strip_name(_class["name"]) + ".hpp")
source_filename = source_gen_folder / (strip_name(_class["name"]) + ".cpp")
@@ -29,9 +29,9 @@ def print_file_list(api_filepath, output_dir, headers=False, sources=False):
print(str(header_filename.as_posix()), end=end)
if sources:
print(str(source_filename.as_posix()), end=end)
icall_header_filename = include_gen_folder / '__icalls.hpp'
register_types_filename = source_gen_folder / '__register_types.cpp'
init_method_bindings_filename = source_gen_folder / '__init_method_bindings.cpp'
icall_header_filename = include_gen_folder / "__icalls.hpp"
register_types_filename = source_gen_folder / "__register_types.cpp"
init_method_bindings_filename = source_gen_folder / "__init_method_bindings.cpp"
if headers:
print(str(icall_header_filename.as_posix()), end=end)
if sources:
@@ -45,8 +45,8 @@ def generate_bindings(api_filepath, use_template_get_node, output_dir="."):
classes = json.load(api_file)
icalls = set()
include_gen_folder = Path(output_dir) / 'include' / 'gen'
source_gen_folder = Path(output_dir) / 'src' / 'gen'
include_gen_folder = Path(output_dir) / "include" / "gen"
source_gen_folder = Path(output_dir) / "src" / "gen"
try:
include_gen_folder.mkdir(parents=True)
@@ -82,27 +82,28 @@ def generate_bindings(api_filepath, use_template_get_node, output_dir="."):
with source_filename.open("w+") as source_file:
source_file.write(impl)
icall_header_filename = include_gen_folder / '__icalls.hpp'
icall_header_filename = include_gen_folder / "__icalls.hpp"
with icall_header_filename.open("w+") as icall_header_file:
icall_header_file.write(generate_icall_header(icalls))
register_types_filename = source_gen_folder / '__register_types.cpp'
register_types_filename = source_gen_folder / "__register_types.cpp"
with register_types_filename.open("w+") as register_types_file:
register_types_file.write(generate_type_registry(classes))
init_method_bindings_filename = source_gen_folder / '__init_method_bindings.cpp'
init_method_bindings_filename = source_gen_folder / "__init_method_bindings.cpp"
with init_method_bindings_filename.open("w+") as init_method_bindings_file:
init_method_bindings_file.write(generate_init_method_bindings(classes))
def is_reference_type(t):
for c in classes:
if c['name'] != t:
if c["name"] != t:
continue
if c['is_reference']:
if c["is_reference"]:
return True
return False
def make_gdnative_type(t, ref_allowed):
if is_enum(t):
return remove_enum_prefix(t) + " "
@@ -131,7 +132,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
source.append("#include <cstdint>")
source.append("")
source.append("#include <core/CoreTypes.hpp>")
class_name = strip_name(c["name"])
@@ -145,7 +145,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
source.append("#include <core/TagDB.hpp>")
ref_allowed = False
included = []
for used_class in used_classes:
@@ -153,36 +152,38 @@ def generate_class_header(used_classes, c, use_template_get_node):
used_class_name = remove_enum_prefix(extract_nested_type(used_class))
if used_class_name not in included:
included.append(used_class_name)
source.append("#include \"" + used_class_name + ".hpp\"")
source.append('#include "' + used_class_name + '.hpp"')
elif is_enum(used_class) and is_nested_type(used_class) and not is_nested_type(used_class, class_name):
used_class_name = remove_enum_prefix(used_class)
if used_class_name not in included:
included.append(used_class_name)
source.append("#include \"" + used_class_name + ".hpp\"")
source.append('#include "' + used_class_name + '.hpp"')
source.append("")
if c["base_class"] != "":
source.append("#include \"" + strip_name(c["base_class"]) + ".hpp\"")
source.append('#include "' + strip_name(c["base_class"]) + '.hpp"')
source.append("namespace godot {")
source.append("")
for used_type in used_classes:
if is_enum(used_type) or is_nested_type(used_type, class_name):
continue
else:
source.append("class " + strip_name(used_type) + ";")
source.append("")
vararg_templates = ""
# generate the class definition here
source.append("class " + class_name + (" : public _Wrapped" if c["base_class"] == "" else (" : public " + strip_name(c["base_class"])) ) + " {")
source.append(
"class "
+ class_name
+ (" : public _Wrapped" if c["base_class"] == "" else (" : public " + strip_name(c["base_class"])))
+ " {"
)
if c["base_class"] == "":
source.append("public: enum { ___CLASS_IS_SCRIPT = 0, };")
@@ -213,7 +214,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
source.append("")
if c["singleton"]:
source.append("\tstatic inline " + class_name + " *get_singleton()")
source.append("\t{")
@@ -229,10 +229,18 @@ def generate_class_header(used_classes, c, use_template_get_node):
# class name:
# Two versions needed needed because when the user implements a custom class,
# we want to override `___get_class_name` while `___get_godot_class_name` can keep returning the base name
source.append("\tstatic inline const char *___get_class_name() { return (const char *) \"" + strip_name(c["name"]) + "\"; }")
source.append("\tstatic inline const char *___get_godot_class_name() { return (const char *) \"" + strip_name(c["name"]) + "\"; }")
source.append(
'\tstatic inline const char *___get_class_name() { return (const char *) "' + strip_name(c["name"]) + '"; }'
)
source.append(
'\tstatic inline const char *___get_godot_class_name() { return (const char *) "'
+ strip_name(c["name"])
+ '"; }'
)
source.append("\tstatic inline Object *___get_from_variant(Variant a) { godot_object *o = (godot_object*) a; return (o) ? (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, o) : nullptr; }")
source.append(
"\tstatic inline Object *___get_from_variant(Variant a) { godot_object *o = (godot_object*) a; return (o) ? (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, o) : nullptr; }"
)
enum_values = []
@@ -250,7 +258,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
if name not in enum_values:
source.append("\tconst static int " + name + " = " + str(c["constants"][name]) + ";")
if c["instanciable"]:
source.append("")
source.append("")
@@ -258,7 +265,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
source.append("\n\t// methods")
if class_name == "Object":
source.append("#ifndef GODOT_CPP_NO_OBJECT_CAST")
source.append("\ttemplate<class T>")
@@ -273,8 +279,7 @@ def generate_class_header(used_classes, c, use_template_get_node):
# method_signature += "virtual " if method["is_virtual"] else ""
method_signature += make_gdnative_type(method["return_type"], ref_allowed)
method_name = escape_cpp(method["name"])
method_signature += method_name + "("
method_signature += method_name + "("
has_default_argument = False
method_arguments = ""
@@ -285,7 +290,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
method_signature += argument_name
method_arguments += argument_name
# default arguments
def escape_default_arg(_type, default_value):
if _type == "Color":
@@ -294,7 +298,15 @@ def generate_class_header(used_classes, c, use_template_get_node):
return default_value.lower()
if _type == "Array":
return "Array()"
if _type in ["PoolVector2Array", "PoolStringArray", "PoolVector3Array", "PoolColorArray", "PoolIntArray", "PoolRealArray", "PoolByteArray"]:
if _type in [
"PoolVector2Array",
"PoolStringArray",
"PoolVector3Array",
"PoolColorArray",
"PoolIntArray",
"PoolRealArray",
"PoolByteArray",
]:
return _type + "()"
if _type == "Vector2":
return "Vector2" + default_value
@@ -308,8 +320,8 @@ def generate_class_header(used_classes, c, use_template_get_node):
return "Rect2" + default_value
if _type == "Variant":
return "Variant()" if default_value == "Null" else default_value
if _type == "String":
return "\"" + default_value + "\""
if _type == "String" or _type == "NodePath":
return '"' + default_value + '"'
if _type == "RID":
return "RID()"
@@ -318,15 +330,10 @@ def generate_class_header(used_classes, c, use_template_get_node):
return default_value
if argument["has_default_value"] or has_default_argument:
method_signature += " = " + escape_default_arg(argument["type"], argument["default_value"])
has_default_argument = True
if i != len(method["arguments"]) - 1:
method_signature += ", "
method_arguments += ","
@@ -335,12 +342,20 @@ def generate_class_header(used_classes, c, use_template_get_node):
if len(method["arguments"]) > 0:
method_signature += ", "
method_arguments += ", "
vararg_templates += "\ttemplate <class... Args> " + method_signature + "Args... args){\n\t\treturn " + method_name + "(" + method_arguments + "Array::make(args...));\n\t}\n"""
vararg_templates += (
"\ttemplate <class... Args> "
+ method_signature
+ "Args... args){\n\t\treturn "
+ method_name
+ "("
+ method_arguments
+ "Array::make(args...));\n\t}\n"
""
)
method_signature += "const Array& __var_args = Array()"
method_signature += ")" + (" const" if method["is_const"] else "")
source.append("\t" + method_signature + ";")
source.append(vararg_templates)
@@ -370,20 +385,16 @@ def generate_class_header(used_classes, c, use_template_get_node):
source.append("#endif")
return "\n".join(source)
def generate_class_implementation(icalls, used_classes, c, use_template_get_node):
class_name = strip_name(c["name"])
ref_allowed = class_name != "Object" and class_name != "Reference"
source = []
source.append("#include \"" + class_name + ".hpp\"")
source.append('#include "' + class_name + '.hpp"')
source.append("")
source.append("")
@@ -394,8 +405,7 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
source.append("#include <core/Godot.hpp>")
source.append("")
source.append("#include \"__icalls.hpp\"")
source.append('#include "__icalls.hpp"')
source.append("")
source.append("")
@@ -403,17 +413,15 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
if is_enum(used_class):
continue
else:
source.append("#include \"" + strip_name(used_class) + ".hpp\"")
source.append('#include "' + strip_name(used_class) + '.hpp"')
source.append("")
source.append("")
source.append("namespace godot {")
core_object_name = "this"
source.append("")
source.append("")
@@ -424,7 +432,7 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
# FIXME Test if inlining has a huge impact on binary size
source.append(class_name + "::" + class_name + "() {")
source.append("\t_owner = godot::api->godot_global_get_singleton((char *) \"" + strip_name(c["name"]) + "\");")
source.append('\t_owner = godot::api->godot_global_get_singleton((char *) "' + strip_name(c["name"]) + '");')
source.append("}")
source.append("")
@@ -440,10 +448,18 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
source.append("void " + class_name + "::___init_method_bindings() {")
for method in c["methods"]:
source.append("\t___mb.mb_" + method["name"] + " = godot::api->godot_method_bind_get_method(\"" + c["name"] + "\", \"" + ("get_node" if use_template_get_node and method["name"] == "get_node_internal" else method["name"]) + "\");")
source.append(
"\t___mb.mb_"
+ method["name"]
+ ' = godot::api->godot_method_bind_get_method("'
+ c["name"]
+ '", "'
+ ("get_node" if use_template_get_node and method["name"] == "get_node_internal" else method["name"])
+ '");'
)
source.append("\tgodot_string_name class_name;")
source.append("\tgodot::api->godot_string_name_new_data(&class_name, \"" + c["name"] + "\");")
source.append('\tgodot::api->godot_string_name_new_data(&class_name, "' + c["name"] + '");')
source.append("\t_detail_class_tag = godot::core_1_2_api->godot_get_class_tag(&class_name);")
source.append("\tgodot::api->godot_string_name_destroy(&class_name);")
@@ -453,7 +469,13 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
if c["instanciable"]:
source.append(class_name + " *" + strip_name(c["name"]) + "::_new()")
source.append("{")
source.append("\treturn (" + class_name + " *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, godot::api->godot_get_class_constructor((char *)\"" + c["name"] + "\")());")
source.append(
"\treturn ("
+ class_name
+ ' *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, godot::api->godot_get_class_constructor((char *)"'
+ c["name"]
+ '")());'
)
source.append("}")
for method in c["methods"]:
@@ -478,7 +500,6 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
source.append(method_signature + " {")
if method["name"] == "free":
# dirty hack because Object::free is marked virtual but doesn't actually exist...
source.append("\tgodot::api->godot_object_destroy(_owner);")
@@ -496,7 +517,9 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
elif return_type_is_ref:
return_statement += "return Ref<" + strip_name(method["return_type"]) + ">::__internal_constructor("
else:
return_statement += "return " + ("(" + strip_name(method["return_type"]) + " *) " if is_class_type(method["return_type"]) else "")
return_statement += "return " + (
"(" + strip_name(method["return_type"]) + " *) " if is_class_type(method["return_type"]) else ""
)
else:
return_statement += "return "
@@ -507,8 +530,6 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
return "Object"
return name
if method["has_varargs"]:
if len(method["arguments"]) != 0:
@@ -519,7 +540,6 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
source.append("")
for i, argument in enumerate(method["arguments"]):
source.append("\t__given_args[" + str(i) + "] = " + escape_cpp(argument["name"]) + ";")
@@ -531,7 +551,9 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
else:
size = "(" + str(len(method["arguments"])) + ")"
source.append("\tgodot_variant **__args = (godot_variant **) alloca(sizeof(godot_variant *) * " + size + ");")
source.append(
"\tgodot_variant **__args = (godot_variant **) alloca(sizeof(godot_variant *) * " + size + ");"
)
source.append("")
@@ -542,24 +564,35 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
if method["has_varargs"]:
source.append("\tfor (int i = 0; i < __var_args.size(); i++) {")
source.append("\t\t__args[i + " + str(len(method["arguments"])) + "] = (godot_variant *) &((Array &) __var_args)[i];")
source.append(
"\t\t__args[i + "
+ str(len(method["arguments"]))
+ "] = (godot_variant *) &((Array &) __var_args)[i];"
)
source.append("\t}")
source.append("")
source.append("\tVariant __result;")
source.append("\t*(godot_variant *) &__result = godot::api->godot_method_bind_call(___mb.mb_" + method["name"] + ", ((const Object *) " + core_object_name + ")->_owner, (const godot_variant **) __args, " + size + ", nullptr);")
source.append(
"\t*(godot_variant *) &__result = godot::api->godot_method_bind_call(___mb.mb_"
+ method["name"]
+ ", ((const Object *) "
+ core_object_name
+ ")->_owner, (const godot_variant **) __args, "
+ size
+ ", nullptr);"
)
source.append("")
if is_class_type(method["return_type"]):
source.append("\tObject *obj = Object::___get_from_variant(__result);")
source.append("\tif (obj->has_method(\"reference\"))")
source.append("\t\tobj->callv(\"reference\", Array());")
source.append('\tif (obj->has_method("reference"))')
source.append('\t\tobj->callv("reference", Array());')
source.append("")
for i, argument in enumerate(method["arguments"]):
source.append("\tgodot::api->godot_variant_destroy((godot_variant *) &__given_args[" + str(i) + "]);")
@@ -571,12 +604,17 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
if return_type_is_ref:
cast += "Ref<" + strip_name(method["return_type"]) + ">::__internal_constructor(__result);"
else:
cast += "(" + strip_name(method["return_type"]) + " *) " + strip_name(method["return_type"] + "::___get_from_variant(") + "__result);"
cast += (
"("
+ strip_name(method["return_type"])
+ " *) "
+ strip_name(method["return_type"] + "::___get_from_variant(")
+ "__result);"
)
else:
cast += "__result;"
source.append("\treturn " + cast)
else:
args = []
@@ -607,17 +645,11 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
source.append("}")
source.append("")
source.append("}")
return "\n".join(source)
def generate_icall_header(icalls):
source = []
@@ -632,7 +664,7 @@ def generate_icall_header(icalls):
source.append("#include <core/GodotGlobal.hpp>")
source.append("#include <core/CoreTypes.hpp>")
source.append("#include \"Object.hpp\"")
source.append('#include "Object.hpp"')
source.append("")
source.append("")
@@ -645,7 +677,9 @@ def generate_icall_header(icalls):
method_signature = "static inline "
method_signature += get_icall_return_type(ret_type) + get_icall_name(icall) + "(godot_method_bind *mb, const Object *inst"
method_signature += (
get_icall_return_type(ret_type) + get_icall_name(icall) + "(godot_method_bind *mb, const Object *inst"
)
for i, arg in enumerate(args):
method_signature += ", const "
@@ -668,11 +702,12 @@ def generate_icall_header(icalls):
source.append(method_signature + " {")
if ret_type != "void":
source.append("\t" + ("godot_object *" if is_class_type(ret_type) else get_icall_return_type(ret_type)) + "ret;")
source.append(
"\t" + ("godot_object *" if is_class_type(ret_type) else get_icall_return_type(ret_type)) + "ret;"
)
if is_class_type(ret_type):
source.append("\tret = nullptr;")
source.append("\tconst void *args[" + ("1" if len(args) == 0 else "") + "] = {")
for i, arg in enumerate(args):
@@ -689,12 +724,18 @@ def generate_icall_header(icalls):
source.append("\t};")
source.append("")
source.append("\tgodot::api->godot_method_bind_ptrcall(mb, inst->_owner, args, " + ("nullptr" if ret_type == "void" else "&ret") + ");")
source.append(
"\tgodot::api->godot_method_bind_ptrcall(mb, inst->_owner, args, "
+ ("nullptr" if ret_type == "void" else "&ret")
+ ");"
)
if ret_type != "void":
if is_class_type(ret_type):
source.append("\tif (ret) {")
source.append("\t\treturn (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, ret);")
source.append(
"\t\treturn (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, ret);"
)
source.append("\t}")
source.append("")
source.append("\treturn (Object *) ret;")
@@ -715,7 +756,7 @@ def generate_icall_header(icalls):
def generate_type_registry(classes):
source = []
source.append("#include \"TagDB.hpp\"")
source.append('#include "TagDB.hpp"')
source.append("#include <typeinfo>")
source.append("\n")
@@ -741,14 +782,21 @@ def generate_type_registry(classes):
if base_class_name == "":
base_class_type_hash = "0"
source.append("\tgodot::_TagDB::register_global_type(\"" + c["name"] + "\", " + class_type_hash + ", " + base_class_type_hash + ");")
source.append(
'\tgodot::_TagDB::register_global_type("'
+ c["name"]
+ '", '
+ class_type_hash
+ ", "
+ base_class_type_hash
+ ");"
)
source.append("}")
source.append("")
source.append("}")
return "\n".join(source)
@@ -799,9 +847,6 @@ def get_icall_name(sig):
return name
def get_used_classes(c):
classes = []
for method in c["methods"]:
@@ -814,86 +859,91 @@ def get_used_classes(c):
return classes
def strip_name(name):
if len(name) == 0:
return name
if name[0] == '_':
if name[0] == "_":
return name[1:]
return name
def extract_nested_type(nested_type):
return strip_name(nested_type[:nested_type.find("::")])
return strip_name(nested_type[: nested_type.find("::")])
def remove_nested_type_prefix(name):
return name if name.find("::") == -1 else strip_name(name[name.find("::") + 2:])
return name if name.find("::") == -1 else strip_name(name[name.find("::") + 2 :])
def remove_enum_prefix(name):
return strip_name(name[name.find("enum.") + 5:])
return strip_name(name[name.find("enum.") + 5 :])
def is_nested_type(name, type = ""):
def is_nested_type(name, type=""):
return name.find(type + "::") != -1
def is_enum(name):
return name.find("enum.") == 0
def is_class_type(name):
return not is_core_type(name) and not is_primitive(name)
def is_core_type(name):
core_types = ["Array",
"Basis",
"Color",
"Dictionary",
"Error",
"NodePath",
"Plane",
"PoolByteArray",
"PoolIntArray",
"PoolRealArray",
"PoolStringArray",
"PoolVector2Array",
"PoolVector3Array",
"PoolColorArray",
"PoolIntArray",
"PoolRealArray",
"Quat",
"Rect2",
"AABB",
"RID",
"String",
"Transform",
"Transform2D",
"Variant",
"Vector2",
"Vector3"]
core_types = [
"Array",
"Basis",
"Color",
"Dictionary",
"Error",
"NodePath",
"Plane",
"PoolByteArray",
"PoolIntArray",
"PoolRealArray",
"PoolStringArray",
"PoolVector2Array",
"PoolVector3Array",
"PoolColorArray",
"PoolIntArray",
"PoolRealArray",
"Quat",
"Rect2",
"AABB",
"RID",
"String",
"Transform",
"Transform2D",
"Variant",
"Vector2",
"Vector3",
]
return name in core_types
def is_primitive(name):
core_types = ["int", "bool", "real", "float", "void"]
return name in core_types
def escape_cpp(name):
escapes = {
"class": "_class",
"enum": "_enum",
"char": "_char",
"short": "_short",
"bool": "_bool",
"int": "_int",
"default": "_default",
"case": "_case",
"switch": "_switch",
"export": "_export",
"class": "_class",
"enum": "_enum",
"char": "_char",
"short": "_short",
"bool": "_bool",
"int": "_int",
"default": "_default",
"case": "_case",
"switch": "_switch",
"export": "_export",
"template": "_template",
"new": "new_",
"new": "new_",
"operator": "_operator",
"typename": "_typename"
"typename": "_typename",
}
if name in escapes:
return escapes[name]

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* AABB.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef AABB_H
#define AABB_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Array.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef ARRAY_H
#define ARRAY_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Basis.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef BASIS_H
#define BASIS_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* CameraMatrix.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef CAMERA_MATRIX_H
#define CAMERA_MATRIX_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Color.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef COLOR_H
#define COLOR_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* CoreTypes.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef CORETYPES_H
#define CORETYPES_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Defs.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef DEFS_H
#define DEFS_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Dictionary.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef DICTIONARY_H
#define DICTIONARY_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Godot.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GODOT_HPP
#define GODOT_HPP
@@ -17,6 +47,8 @@
#include "GodotGlobal.hpp"
#include <type_traits>
namespace godot {
namespace detail {
@@ -496,7 +528,7 @@ void register_property(const char *name, void (T::*setter)(P), P (T::*getter)()
}
template <class T>
void register_signal(String name, Dictionary args = Dictionary()) {
void register_signal(String name, Dictionary args) {
static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes");
godot_signal signal = {};
@@ -540,6 +572,17 @@ void register_signal(String name, Args... varargs) {
register_signal<T>(name, Dictionary::make(varargs...));
}
template <class T>
void register_signal(String name) {
static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes");
godot_signal signal = {};
signal.name = *(godot_string *)&name;
godot::nativescript_api->godot_nativescript_register_signal(godot::_RegisterState::nativescript_handle,
T::___get_class_name(), &signal);
}
#ifndef GODOT_CPP_NO_OBJECT_CAST
template <class T>
T *Object::cast_to(const Object *obj) {

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* GodotGlobal.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GODOT_GLOBAL_HPP
#define GODOT_GLOBAL_HPP

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* GodotProfiling.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GODOT_PROFILING_HPP
#define GODOT_PROFILING_HPP

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Math.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GODOT_MATH_H
#define GODOT_MATH_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* NodePath.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef NODEPATH_H
#define NODEPATH_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Plane.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PLANE_H
#define PLANE_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* PoolArrays.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef POOLARRAYS_H
#define POOLARRAYS_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Quat.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef QUAT_H
#define QUAT_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* RID.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RID_H
#define RID_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Rect2.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RECT2_H
#define RECT2_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Ref.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef REF_H
#define REF_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* String.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef STRING_H
#define STRING_H
@@ -75,14 +105,14 @@ public:
CharString utf8() const;
CharString ascii(bool p_extended = false) const;
bool begins_with(String &s) const;
bool begins_with(const String &s) const;
bool begins_with_char_array(const char *p_char_array) const;
PoolStringArray bigrams() const;
String c_escape() const;
String c_unescape() const;
String capitalize() const;
bool empty() const;
bool ends_with(String &text) const;
bool ends_with(const String &text) const;
void erase(int position, int chars);
int find(String what, int from = 0) const;
int find_last(String what) const;

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* TagDB.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef TAGDB_HPP
#define TAGDB_HPP

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Transform.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef TRANSFORM_H
#define TRANSFORM_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Transform2D.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef TRANSFORM2D_H
#define TRANSFORM2D_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Variant.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VARIANT_H
#define VARIANT_H
@@ -20,8 +50,6 @@
#include "Vector2.hpp"
#include "Vector3.hpp"
#include <iostream>
namespace godot {
class Dictionary;

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Vector2.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR2_H
#define VECTOR2_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Vector3.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR3_H
#define VECTOR3_H

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Wrapped.hpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef WRAPPED_HPP
#define WRAPPED_HPP

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* AABB.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "AABB.hpp"
#include "Plane.hpp"
#include "Vector3.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Array.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Array.hpp"
#include "GodotGlobal.hpp"
#include "Variant.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Basis.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Basis.hpp"
#include "Defs.hpp"
#include "Quat.hpp"

View File

@@ -1,12 +1,12 @@
/*************************************************************************/
/* camera_matrix.cpp */
/* CameraMatrix.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -561,7 +561,7 @@ real_t CameraMatrix::get_fov() const {
right_plane.normalize();
if ((matrix[8] == 0) && (matrix[9] == 0)) {
return Math::rad2deg(acos(abs(right_plane.normal.x))) * 2.0;
return Math::rad2deg(acos(std::abs(right_plane.normal.x))) * 2.0;
} else {
// our frustum is asymmetrical need to calculate the left planes angle separately..
Plane left_plane = Plane(matrix[3] + matrix[0],
@@ -570,7 +570,7 @@ real_t CameraMatrix::get_fov() const {
matrix[15] + matrix[12]);
left_plane.normalize();
return Math::rad2deg(acos(abs(left_plane.normal.x))) + Math::rad2deg(acos(abs(right_plane.normal.x)));
return Math::rad2deg(acos(std::abs(left_plane.normal.x))) + Math::rad2deg(acos(std::abs(right_plane.normal.x)));
}
}

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Color.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Color.hpp"
#include "Defs.hpp"
#include "String.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Dictionary.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Dictionary.hpp"
#include "Array.hpp"
#include "GodotGlobal.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* GodotGlobal.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "GodotGlobal.hpp"
#include "String.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* NodePath.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "NodePath.hpp"
#include "GodotGlobal.hpp"
#include "String.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Plane.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Plane.hpp"
#include "Vector3.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* PoolArrays.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "PoolArrays.hpp"
#include "Color.hpp"
#include "Defs.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Quat.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Quat.hpp"
#include "Basis.hpp"
#include "Defs.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* RID.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "RID.hpp"
#include <gdnative/rid.h>

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Rect2.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Rect2.hpp"
#include "String.hpp"
#include "Transform2D.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* String.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "String.hpp"
#include "Array.hpp"
@@ -192,7 +222,7 @@ String operator+(const wchar_t *a, const String &b) {
return String(a) + b;
}
bool String::begins_with(String &p_string) const {
bool String::begins_with(const String &p_string) const {
return godot::api->godot_string_begins_with(&_godot_string, &p_string._godot_string);
}
@@ -221,7 +251,7 @@ bool String::empty() const {
return godot::api->godot_string_empty(&_godot_string);
}
bool String::ends_with(String &p_string) const {
bool String::ends_with(const String &p_string) const {
return godot::api->godot_string_ends_with(&_godot_string, &p_string._godot_string);
}

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* TagDP.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "TagDB.hpp"
#include <unordered_map>

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Transform.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Transform.hpp"
#include "Basis.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Transform2D.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Transform2D.hpp"
#include "Rect2.hpp"
#include "String.hpp"

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Variant.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Variant.hpp"
#include <gdnative/variant.h>
@@ -7,8 +37,6 @@
#include "GodotGlobal.hpp"
#include "Object.hpp"
#include <iostream>
namespace godot {
Variant::Variant() {
@@ -160,6 +188,7 @@ Variant::Variant(const PoolColorArray &p_color_array) {
}
Variant &Variant::operator=(const Variant &v) {
godot::api->godot_variant_destroy(&_godot_variant);
godot::api->godot_variant_new_copy(&_godot_variant, &v._godot_variant);
return *this;
}

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Vector2.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Vector2.hpp"
#include <gdnative/vector2.h>

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* Vector3.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "Vector3.hpp"
#include "String.hpp"

21
test/.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
# Godot 4+ specific ignores
.godot/
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# Dummy HTML5 export presets file for continuous integration
!.github/dist/export_presets.cfg
# Imported translations (automatically generated from CSV files)
*.translation
# Mono-specific ignores
.mono/
data_*/
mono_crash.*.json
# System/tool-specific ignores
.directory
*~

View File

@@ -4,30 +4,29 @@ import sys
# Try to detect the host platform automatically.
# This is used if no `platform` argument is passed
if sys.platform.startswith('linux'):
host_platform = 'linux'
elif sys.platform == 'darwin':
host_platform = 'osx'
elif sys.platform == 'win32' or sys.platform == 'msys':
host_platform = 'windows'
if sys.platform.startswith("linux"):
host_platform = "linux"
elif sys.platform == "darwin":
host_platform = "osx"
elif sys.platform == "win32" or sys.platform == "msys":
host_platform = "windows"
else:
raise ValueError(
'Could not detect platform automatically, please specify with '
'platform=<platform>'
)
raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
env = Environment(ENV = os.environ)
env = Environment(ENV=os.environ)
opts = Variables([], ARGUMENTS)
# Define our options
opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r', 'release']))
opts.Add(EnumVariable('platform', "Compilation platform", host_platform, ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", host_platform, ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(EnumVariable('bits', 'Target platform bits', '64', ('32', '64')))
opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no'))
opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bin/', PathVariable.PathAccept))
opts.Add(PathVariable('target_name', 'The library name.', 'libgdexample', PathVariable.PathAccept))
opts.Add(EnumVariable("target", "Compilation target", "debug", ["d", "debug", "r", "release"]))
opts.Add(EnumVariable("platform", "Compilation platform", host_platform, ["", "windows", "x11", "linux", "osx"]))
opts.Add(
EnumVariable("p", "Compilation target, alias for 'platform'", host_platform, ["", "windows", "x11", "linux", "osx"])
)
opts.Add(EnumVariable("bits", "Target platform bits", "64", ("32", "64")))
opts.Add(BoolVariable("use_llvm", "Use the LLVM / Clang compiler", "no"))
opts.Add(PathVariable("target_path", "The path where the lib is installed.", "bin/", PathVariable.PathAccept))
opts.Add(PathVariable("target_name", "The library name.", "libgdexample", PathVariable.PathAccept))
# Local dependency paths, adapt them to your setup
godot_headers_path = "../godot-headers/"
@@ -45,25 +44,25 @@ Help(opts.GenerateHelpText(env))
# This makes sure to keep the session environment variables on Windows.
# This way, you can run SCons in a Visual Studio 2017 prompt and it will find
# all the required tools
if host_platform == 'windows' and env['platform'] != 'android':
if env['bits'] == '64':
env = Environment(TARGET_ARCH='amd64')
elif env['bits'] == '32':
env = Environment(TARGET_ARCH='x86')
if host_platform == "windows" and env["platform"] != "android":
if env["bits"] == "64":
env = Environment(TARGET_ARCH="amd64")
elif env["bits"] == "32":
env = Environment(TARGET_ARCH="x86")
opts.Update(env)
# Process some arguments
if env['use_llvm']:
env['CC'] = 'clang'
env['CXX'] = 'clang++'
if env["use_llvm"]:
env["CC"] = "clang"
env["CXX"] = "clang++"
if env['p'] != '':
env['platform'] = env['p']
if env["p"] != "":
env["platform"] = env["p"]
if env['platform'] == '':
if env["platform"] == "":
print("No valid target platform selected.")
quit();
quit()
# For the reference:
# - CCFLAGS are compilation flags shared between C and C++
@@ -74,61 +73,69 @@ if env['platform'] == '':
# - LINKFLAGS are for linking flags
# Check our platform specifics
if env['platform'] == "osx":
env['target_path'] += 'osx/'
cpp_library += '.osx'
env.Append(CCFLAGS=['-arch', 'x86_64'])
env.Append(CXXFLAGS=['-std=c++17'])
env.Append(LINKFLAGS=['-arch', 'x86_64'])
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS=['-g', '-O2'])
if env["platform"] == "osx":
env["target_path"] += "osx/"
cpp_library += ".osx"
env.Append(CCFLAGS=["-arch", "x86_64"])
env.Append(CXXFLAGS=["-std=c++17"])
env.Append(LINKFLAGS=["-arch", "x86_64"])
if env["target"] in ("debug", "d"):
env.Append(CCFLAGS=["-g", "-O2"])
else:
env.Append(CCFLAGS=['-g', '-O3'])
env.Append(CCFLAGS=["-g", "-O3"])
elif env['platform'] in ('x11', 'linux'):
env['target_path'] += 'x11/'
cpp_library += '.linux'
env.Append(CCFLAGS=['-fPIC'])
env.Append(CXXFLAGS=['-std=c++17'])
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS=['-g3', '-Og'])
elif env["platform"] in ("x11", "linux"):
env["target_path"] += "x11/"
cpp_library += ".linux"
env.Append(CCFLAGS=["-fPIC"])
env.Append(CXXFLAGS=["-std=c++17"])
if env["target"] in ("debug", "d"):
env.Append(CCFLAGS=["-g3", "-Og"])
else:
env.Append(CCFLAGS=['-g', '-O3'])
env.Append(CCFLAGS=["-g", "-O3"])
elif env['platform'] == "windows":
env['target_path'] += 'win64/'
cpp_library += '.windows'
elif env["platform"] == "windows":
env["target_path"] += "win64/"
cpp_library += ".windows"
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
env.Append(ENV=os.environ)
env.Append(CPPDEFINES=['WIN32', '_WIN32', '_WINDOWS', '_CRT_SECURE_NO_WARNINGS'])
env.Append(CCFLAGS=['-W3', '-GR'])
if env['target'] in ('debug', 'd'):
env.Append(CPPDEFINES=['_DEBUG'])
env.Append(CCFLAGS=['-EHsc', '-MDd', '-ZI'])
env.Append(LINKFLAGS=['-DEBUG'])
env.Append(CPPDEFINES=["WIN32", "_WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS"])
env.Append(CCFLAGS=["-W3", "-GR"])
env.Append(CXXFLAGS=["-std:c++17"])
if env["target"] in ("debug", "d"):
env.Append(CPPDEFINES=["_DEBUG"])
env.Append(CCFLAGS=["-EHsc", "-MDd", "-ZI"])
env.Append(LINKFLAGS=["-DEBUG"])
else:
env.Append(CPPDEFINES=['NDEBUG'])
env.Append(CCFLAGS=['-O2', '-EHsc', '-MD'])
env.Append(CPPDEFINES=["NDEBUG"])
env.Append(CCFLAGS=["-O2", "-EHsc", "-MD"])
if env['target'] in ('debug', 'd'):
cpp_library += '.debug'
if env["target"] in ("debug", "d"):
cpp_library += ".debug"
else:
cpp_library += '.release'
cpp_library += ".release"
cpp_library += '.' + str(bits)
cpp_library += "." + str(bits)
# make sure our binding library is properly includes
env.Append(CPPPATH=['.', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/'])
env.Append(LIBPATH=[cpp_bindings_path + 'bin/'])
env.Append(
CPPPATH=[
".",
godot_headers_path,
cpp_bindings_path + "include/",
cpp_bindings_path + "include/core/",
cpp_bindings_path + "include/gen/",
]
)
env.Append(LIBPATH=[cpp_bindings_path + "bin/"])
env.Append(LIBS=[cpp_library])
# 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')
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")
library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources)
library = env.SharedLibrary(target=env["target_path"] + env["target_name"], source=sources)
Default(library)

View File

@@ -10,10 +10,8 @@ config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Test CI project"

View File

@@ -1,30 +1,30 @@
extends MainLoop
func _initialize():
OS.exit_code = 1
var native_script = load("res://gdexample.gdns")
print("Native Script ", native_script)
if native_script == null || !is_instance_valid(native_script):
return
print("Library ", native_script.library)
if native_script.library == null || !is_instance_valid(native_script.library):
return
var ref = native_script.new()
print("Reference ", ref)
if ref == null || !is_instance_valid(ref):
return
print("Reference name ", ref.name)
if ref.name != "SimpleClass":
return
print("Reference value ", ref.value)
if ref.value != 0:
return
print("Call method ", ref.method(1))
if ref.method(1) != 1:
return
OS.exit_code = 0
OS.exit_code = 1
var native_script = load("res://gdexample.gdns")
print("Native Script ", native_script)
if not native_script || !is_instance_valid(native_script):
return
print("Library ", native_script.library)
if not native_script.library || !is_instance_valid(native_script.library):
return
var ref = native_script.new()
print("Reference ", ref)
if not ref || !is_instance_valid(ref):
return
print("Reference name ", ref.name)
if ref.name != "SimpleClass":
return
print("Reference value ", ref.value)
if ref.value != 0:
return
print("Call method ", ref.method(1))
if ref.method(1) != 1:
return
OS.exit_code = 0
func _idle(_delta):
return true
return true

View File

@@ -1,3 +1,33 @@
/*************************************************************************/
/* init.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include <Godot.hpp>
#include <Reference.hpp>