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.
This is taken from the Godot repository, so formatting is similar. This
updates the style rules as well.
Also fix style in files to conform with this version.
Some functions return a new instance of such containers,
but instead we made a copy of them, without taking ownership of the
original created by the function.
Now we use a specific constructor taking ownership on the godot_* struct.
The member _godot_string should never be straight out overwritten ever without
first destroying the underlying string object's memory. This change solves the
problem through the introduction of a new private constructor to create String
objects with a pre-existing godot_string handle.
The [] operator of Basis was returning a reference to a temporary, so fixed it.
There was no * operator in Transform equivalent to the xform function, which is
not in line with GDScript behavior.
Also fixed remaining cases where Transform relied on the old behavior of the
[] operator of Basis (i.e. that it returns the row, not the column).
Per https://github.com/godotengine/godot/issues/14553:
Godot stores Basis in row-major layout for more change for efficiently
taking advantage of SIMD instructions, but in scripts Basis looks like and
is accessible in a column-major format.
This change modifies the C++ binding so that from the script's perspective
Basis does look like if it was column-major while retaining a row-major
in-memory representation. This is achieved using a set of helper template
classes which allow accessing individual columns whose components are
non-continues in memory as if it was a Vector3 type. This ensures script
interface compatibility without needing to transpose the Basis every time
it is passed over the script-engine boundary.
Also made most of the Vector2 and Vector3 class interfaces inlined in the
process for increased performance.
While unrelated (but didn't want to file a separate PR for it), this change
adds the necessary flags to have debug symbol information under MSVC.
Fixes#241.
implemented instance binding data usage
This commit changes the way C++ wrapper classes work.
Previously, wrapper classes were merely wrapper *interfaces*.
They used the `this` pointer to store the actual foreign Godot
Object.
With the NativeScript 1.1 extension it is now possible to have
low-overhead language binding data attached to Objects.
The C++ bindings use that feature to implement *proper* wrappers
and enable regular C++ inheritance usage that way.
Some things might still be buggy and untested, but the C++
SimpleDemo works with those changes.
new and free change, custom free will crash engine, be wary
fix exporting of non-object types
fix free() crash with custom resources
added type tags and safe object casting
fix global type registration order
fix cast_to
changed build system to be more self contained
updated .gitignore
use typeid() for type tags now
fix indentation in bindings generator
remove accidentally added files
fix gitignore
Fixed up registering tool and updated godot_headers
Fix crash when calling String::split/split_floats
Was casting to the wrong object type.
Also adds parse_ints function to String with the same logic
Better warning/error macros
Change gitignore so we get our gen folders
New documentation based on nativescript 1.1
Fixed GODOT_SUBCLASS macro
Preventing crash when function returned null ptr
Adds needed include <typeinfo>
Solves this issue #168 due to not having the include of typeinfo
Fix compile error of 'WARN_PRINT' and 'ERR_PRINT'.
cannot pass non-trivial object of type 'godot::String' to variadic function; expected type from format string was 'char *' [-Wnon-pod-varargs]
update vector3::distance_to
Remove godot_api.json as its now in the godot_headers submodule (api.json)
This is needed since that operator returns a local copy, not
an lvalue. Attempting to write to the return value of these operators
wouldn't change the array element. PoolVectors need locking when
writing, so this operator can't return a writable reference.
To update a Pool*Array, use the `set()` method which locks and unlocks
the array. For multiple writes, use the `write()` method which returns
a locked writable view, and unlocks when it goes out of scope.