Commit Graph

239 Commits (acee69a3f6c121b77e4372aaa3ba11eb4df94c22)

Author SHA1 Message Date
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
DhruvMaroo 7a1890345b edited according to clang-format 2021-06-01 23:16:09 +05:30
DhruvMaroo 67e2c6145c used godot_string_new_copy to copy 2021-05-31 09:31:11 +05:30
DhruvMaroo b44b98a94c removed _deleted class member 2021-05-31 09:10:59 +05:30
DhruvMaroo cd05371ce8 added class member, safety check in the destructor 2021-05-31 00:52:36 +05:30
DhruvMaroo 492285f681 changed spaces to tabs 2021-05-30 22:29:41 +05:30
DhruvMaroo bdc5674ace added move assignment operator 2021-05-30 12:33:40 +05:30
DhruvMaroo 689b5fb98b added mover constructor 2021-05-30 12:30:11 +05:30
kb1000 3fe276c02f
Stop including iostream in Variant.hpp (to produce smaller binaries) 2021-05-23 16:28:11 +02:00
Erik Abair 2ccc5e08f2 Populates incorrect constants for Vector2 and 3 types. 2021-05-02 15:35:21 -07:00
George Marques cba90d6301
Update clang-format to version 11
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.
2021-02-28 16:57:34 -03:00
Hrishikesh 8558d2360a Removed redundant function definitions in CameraMatrix and used the ones in Math.hpp 2021-02-03 06:32:44 +05:30
Marc b400dba875
Merge branch 'master' into container_leaks 2021-01-31 20:06:56 +00:00
Marc 05ba977cc6
Merge pull request #485 from colugomusic/fix-array-const
Fix constness of Array::find, Array::find_last and Array::rfind
2021-01-31 20:03:47 +00:00
Marc e76efdd3ab
Merge pull request #481 from Zylann/vec_constants
Added missing constants to Vector2, Vector3, Basis and Quat
2021-01-31 20:02:06 +00:00
Marc 1aab5e3962
Merge branch 'master' into master 2021-01-31 19:32:56 +00:00
Marc Gilleron fb71edd45b Fix container and string leaks
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.
2021-01-07 01:05:12 +00:00
Colugo 38c9b624db Fix constness of Array::find, Array::find_last and Array::rfind 2020-12-20 16:53:40 +00:00
Marc Gilleron 8e1cc29c66 Added missing constants to Vector2, Vector3, Basis and Quat 2020-12-08 23:35:17 +00:00
Marc c9a740be34
Merge pull request #451 from Zylann/math
Added Godot's math functions
2020-09-08 19:31:54 +01:00
Marc Gilleron 0d1511695d Added Godot's math functions 2020-09-04 02:14:45 +01:00
Marc e5334579db
Merge branch 'master' into arcore_support 2020-08-31 15:05:09 +01:00
Fredia Huya-Kouadio 31b0ca80d5 Additions to the library to support the ARCore plugin 2020-08-23 14:11:47 -07:00
Marc Gilleron 469e9da86c Rename `RID::get_rid()` => `get_id()` to match Godot 2020-08-23 21:32:05 +01:00
Marc a3fe496ad6
Merge pull request #441 from TerraAr/master
Create an operator
2020-08-16 17:36:49 +01:00
TerraAr 7d347edb12
Updated operator
I've updated the operator that I had created to use the private constructor of the class.
2020-08-15 15:10:16 -03:00
Marc 756c1e1c79
Merge pull request #307 from aqnuep/string_memory_leak_fix
Fixed memory leak with String objects
2020-08-15 17:57:02 +01:00
Daniel Rakos 0939d0f6d1 Fixed memory leak with String objects
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.
2020-08-15 09:46:23 +02:00
TerraAr 5e656923cf
Fixed operator
Fixed String::operator+=(const wchar_t). The problem was that a temporary variable don't have an address.
2020-08-14 23:32:38 -03:00
TerraAr a1ba843f36
Created operator.
Created String::operator+=(const wchar_t), that was mark as Todo.
2020-08-14 21:42:10 -03:00
Marc ceae5be727
Merge pull request #356 from sheepandshepherd/variantleak2
Add C conversion constructors and fix new leak
2020-06-05 21:16:37 +01:00
Bastiaan Olij e2a5fdee3b
Merge pull request #406 from Zylann/color_operators
Added missing Color operators
2020-06-02 20:31:24 +10:00
Marc Gilleron 0f4ea6cc35 Added missing Color operators 2020-05-29 20:38:14 +01:00
Fredia Huya-Kouadio 3747ffe871 Fix godot-cpp types registration
A initialization bug was causing the registration to occur prior to a key required field being set (see https://github.com/GodotNativeTools/godot-cpp/issues/394#issuecomment-613636985 for more details).

Fixes #394
2020-04-14 13:51:02 -07:00
Mika Pi 2559c70e27 Fix compilation warnings about unused vars 2020-02-23 07:40:54 -08:00
sheepandshepherd 66c671b59d Add C conversion constructors to fix leak of default-constructed empty arrays 2020-01-31 00:08:02 +01:00
Rémi Verschelde 81783c6045
Merge pull request #333 from sheepandshepherd/string-plus-leak
Fix String::operator+ memory leak
2020-01-19 23:35:06 +01:00
sheepandshepherd 95feb486c9 Fix leaks caused by implicitly called copy constructors 2019-12-04 03:27:39 +01:00
sheepandshepherd 9560cbff09 Fix String::operator+ memory leak 2019-10-05 01:14:23 +02:00
Bastiaan Olij 8443486a19 Call register types and init earlier 2019-09-14 11:24:15 +10:00
Bastiaan Olij fc1fe720c3 Store all main entry points to the currently available APIs 2019-08-12 19:55:29 +10:00
Thomas Herzog c2ec46f64a
Merge pull request #296 from lupoDharkael/missing
Add missing class methods
2019-08-05 10:39:56 +02:00
lupoDharkael b895d3c326 Add missing class methods 2019-08-05 00:23:42 +02:00
shaderbeast 041b97e5b2 Fixed wrong implementation of Quat multiplication
Obeyed Clang format rules
2019-05-06 11:01:31 +02:00
RameshRavone ca85ab244f
Fix snapped from Vector2 2019-05-02 09:57:28 +05:30
RameshRavone 761d62c9c8
Fix #272 2019-04-21 06:55:49 +05:30
Daniel Rakos 4be7fcdde5 Fix bug in Basis [] operator and add missing Transform-Vector3 * operator
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).
2019-04-11 19:59:34 +02:00
Daniel Rakos abccf9a050 Make Basis look column-major while retaining a row-major representation
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.
2019-04-08 16:28:41 +02:00
Bastiaan Olij 459d3d28e4 Synced with Godot 3.1 stable 2019-04-07 17:59:53 +10:00
bruvzg aad175aa09
Renamed Rect2::pos to Rect2::position 2018-12-13 11:10:25 +02:00
Marcelo Fernandez 209dd56cb0 Profiling support 2018-11-27 09:45:56 -03:00
Bastiaan Olij fc20fa3fce Implementing clang-format and applying it to all classes 2018-11-24 09:09:41 +11:00
bruvzg c2b59773af
Fix NULL pointer dereferencing on uninstantiated Ref<T>() conversion to Variant 2018-11-22 23:41:33 +02:00
Bastiaan Olij d7982cfac3 Redid PR 190 for master now that nativescript 1.1 has been merged 2018-11-22 22:14:28 +11:00
Bastiaan Olij 5f3d6bc233
Merge pull request #198 from bruvzg/fix_str_find_and_cmp
Add missing String::find from argument, and missing String::casecmp_to functions
2018-11-19 21:29:39 +11:00
Bastiaan Olij 987cca0d4d Redid kirsanium xform fix 2018-11-19 21:16:01 +11:00
bruvzg 39445f144c
Add missing String::(r)find(n) form argument
Add missing String::(*)casecmp_to functions
2018-11-18 14:37:06 +02:00
karroffel 200bf226bf Nativescript 1.1
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)
2018-11-07 21:23:08 +11:00
Christoffer ffb087caed Fix issue where Vector2::normalize() did not normalize correctly 2018-09-03 19:19:56 +02:00
Marcelo Fernandez baddc2ae66 Fix clang warning: 'const' type qualifier on return type has no effect 2018-06-23 12:15:53 -03:00
Timothy Werquin 1a32997a0f Fix const for += operator in string 2018-05-15 22:24:53 +02:00
Timothy Werquin 1803ca43fa Fix String const operators.
Added const to various operators.
2018-05-15 22:23:03 +02:00
Nickolai Korshunov ef37d8d76e Merge branch 'master' of https://github.com/GodotNativeTools/godot-cpp 2018-04-25 11:40:49 +03:00
Gary Oberbrunner a6689b2132 Make all Pool*Array::operator[] as const
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.
2018-03-13 11:00:25 -04:00
danielytics e74b8f593e adds variadic printing function, makes String.format custom placeholder work 2018-03-07 12:21:33 +00:00
karroffel 2343a8a54c fix #101 2018-03-02 19:04:57 +01:00
Nickolai Korshunov f1c35f24f6 NULL -> nullptr 2018-02-23 16:08:36 +03:00
lupoDharkael 756510563b Add const qualifier to PoolArray's size() 2018-02-12 22:38:25 +01:00
Marc Gilleron 4f4bb8deff String and math fixes
- Added missing static String constructors
- Implemented String operator for math types
- Added XYZ and YXZ euler angles methods
- Fixed wrong det checks in Basis
- Fixed operator Quat in Basis
2018-01-23 00:24:23 +01:00
Marc Gilleron 06c61b6535 Added RID::is_valid() and comparison operators
- is_valid() is worked around by comparing a default RID()
2018-01-20 19:37:23 +01:00
Marc Gilleron 835233fb71 Added missing copy constructors and assign operators to PoolVectors 2018-01-17 23:58:28 +01:00
Thomas Herzog 02b9b2592a
Merge pull request #67 from Zylann/rename_aabb_position
Renamed AABB::pos --> AABB::position
2018-01-17 08:46:19 +01:00
Marc Gilleron 00f089d7ed Added copy constructors and assignment operators to Array and Dictionary 2018-01-17 01:57:01 +01:00
Marc Gilleron b9ba10a717 Renamed AABB::pos --> AABB::position 2018-01-17 01:45:48 +01:00
karroffel e3b20a28a9 Added Read and Write access for PoolArrays 2018-01-11 21:26:37 +01:00
karroffel 5dac1b5887 caller-defined entry methods and string API update 2018-01-11 17:58:06 +01:00
Bastiaan Olij d8faa4ec76 Added alloc_c_string 2017-11-25 10:22:36 +11:00
BastiaanOlij 0f773c2d72 Update bindings to use new Api extensions and rename Rect3->AABB 2017-11-23 22:50:05 +11:00
Bastiaan Olij 6452ba6e88 Implemented using api struct 2017-10-23 21:20:14 +11:00
Ramesh Ravone 3ddd85d9a2
Fixes #41 2017-10-03 20:40:36 +05:30
Ramesh Ravone 4adf3db60b
String bindings updated (at most) 2017-10-03 16:27:33 +05:30
Ramesh Ravone 10bb24cfbc
updated bindings 2017-10-03 16:07:34 +05:30
Karroffel c27af379b8 updated to use the new NativeScript and GDNative interface 2017-07-24 17:08:52 +02:00
Karroffel 4769f49cb4 Use static linking instead of dynamic linking 2017-07-23 17:53:50 +02:00
Ramesh Ravone 36561b5853
String operator_plus fix 2017-07-22 19:16:10 +05:30
Karroffel ebe9d9de6a updated core to new GDNative interface 2017-06-18 13:21:36 +02:00
Karroffel ad3720440e removed InputEvent and Image 2017-05-23 23:03:57 +02:00
Karroffel fad8f7c9eb made script "inheritance" less OOP 2017-05-13 13:55:04 +02:00
Karroffel cf30b0f39d rewrote binding generator in python 2017-05-12 21:53:07 +02:00