summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile50
-rw-r--r--README.md58
-rw-r--r--SConstruct112
-rw-r--r--binding_generator.py14
-rw-r--r--include/core/Array.hpp6
-rw-r--r--include/core/Defs.hpp36
-rw-r--r--include/core/Dictionary.hpp5
-rw-r--r--include/core/Godot.hpp5
-rw-r--r--include/core/GodotGlobal.hpp6
-rw-r--r--include/core/NodePath.hpp2
-rw-r--r--include/core/PoolArrays.hpp14
-rw-r--r--include/core/String.hpp2
-rw-r--r--src/core/NodePath.cpp12
-rw-r--r--src/core/PoolArrays.cpp14
-rw-r--r--src/core/String.cpp11
15 files changed, 258 insertions, 89 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f8f4d1f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,50 @@
+
+GODOT_BIN_PATH = ../godot_fork/bin/godot.x11.tools.64.llvm
+REGENERATE_BINDINGS = no
+HEADERS = ../godot_headers
+TARGET = debug
+NAME = godot-cpp
+USE_CLANG = no
+
+BASE = scons n=$(NAME) use_llvm=$(USE_CLANG) regenerate_bindings=$(REGENERATE_BINDINGS) target=$(TARGET) headers=$(HEADERS) godotbinpath=$(GODOT_BIN_PATH) -j4
+LINUX = $(BASE) p=linux
+WINDOWS = $(BASE) p=windows
+OSX = $(BASE) p=osx
+
+
+all:
+ make linux
+ make windows
+
+
+linux:
+ make linux32
+ make linux64
+
+linux32: SConstruct
+ $(LINUX) a=32
+
+linux64: SConstruct
+ $(LINUX) a=64
+
+
+windows:
+ make windows32
+ make windows64
+
+windows32: SConstruct
+ $(WINDOWS) a=32
+
+windows64: SConstruct
+ $(WINDOWS) a=64
+
+
+osx:
+ make osx32
+ make osx64
+
+osx32: SConstruct
+ $(OSX) a=32
+
+osx64: SConstruct
+ $(OSX) a=64
diff --git a/README.md b/README.md
index 918c39f..e2d4163 100644
--- a/README.md
+++ b/README.md
@@ -1,54 +1,45 @@
-# cpp_bindings
+# godot-cpp
C++ bindings for the Godot script API
# Creating a GDNative library (Linux)
Create a directory named `SimpleLibrary` with subdirectories `lib, src`
-Getting latest `cpp_bindings` and `godot_headers`
+Getting latest `godot-cpp` and `godot_headers`
```
-$ cd SimpleLibrary
-$ git clone https://github.com/GodotNativeTools/cpp_bindings
+$ git clone https://github.com/GodotNativeTools/godot-cpp
$ git clone https://github.com/GodotNativeTools/godot_headers
```
-right now our directory structure should look like this
+right now our directory structure should look like this:
```
-[SimpleLibrary]
- ├── cpp_bindings/
- ├── godot_headers/
- ├── lib/
- └── src/
+godot-cpp
+godot_headers
+SimpleLibrary
+├── lib/
+└── src/
```
Now to generate cpp bindings
```
-$ cd cpp_bindings
-```
-
-Edit `SConstruct` file and assign your godot executable path at line:7 `godot_bin_path = "../godot_fork/bin/"`,
-
-Building cpp_bindings
-```
-$ scons godotbinpath="../godot_fork/bin/godot_binary" headers="../godot_headers/" p=linux generate_bindings=yes
+$ cd godot-cpp
+$ scons godotbinpath="../godot_fork/bin/godot_binary" p=linux
+$ cd ..
```
resulting libraries will be placed under `bin/` and the generated headers will be placed under `include/*`
**Note:**
-> `generate_bindings=yes` is used to generate C++ bindings (`godot_api.json` - Godot API)
+> `regenerate_bindings=yes` is used to force regenerating C++ bindings (`godot_api.json` - Godot API)
+
> Include `use_llvm=yes` for using clang++
-Copy binding libraries into the `SimpleLibrary/lib` folder
-```
-$ cd ..
-$ cp cpp_bindings/bin/libgodot_cpp_bindings.a lib/
-```
+
And our directory structure will be
```
-[SimpleLibrary]
- ├── cpp_bindings/
- ├── godot_headers/
- ├── lib/
- │ └──libgodot_cpp_bindings.a
- └── src/
+godot-cpp
+└── bin/libgodot-cpp.a
+godot_headers
+SimpleLibrary
+├── lib/
+└── src/
```
# Creating simple class
@@ -87,6 +78,7 @@ public:
/** For registering signal **/
// register_signal<SimpleClass>("signal_name");
+ // register_signal<SimpleClass>("signal_name", "string_argument", GODOT_VARIANT_TYPE_STRING)
}
String _name;
@@ -115,9 +107,9 @@ extern "C" void GDN_EXPORT godot_nativescript_init(void *handle)
# Compiling
```
-$ cd ..
-$ clang -fPIC -o src/init.os -c src/init.cpp -g -O3 -std=c++14 -Icpp_bindings/include -Igodot_headers
-$ clang -o lib/libtest.so -shared src/init.os -Llib -lgodot_cpp_bindings
+$ cd SimpleLibrary
+$ clang -fPIC -o src/init.os -c src/init.cpp -g -O3 -std=c++14 -I../godot-cpp/include -Igodot_headers
+$ clang -o lib/libtest.so -shared src/init.os -L../godot-cpp/lib -lgodot-cpp
```
This creates the file `libtest.so` in your `SimpleLibrary/lib` directory. For windows you need to find out what compiler flags need to be used.
diff --git a/SConstruct b/SConstruct
index 50a63cd..fdec6b7 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,62 +1,102 @@
#!python
-import os, subprocess
+import os, subprocess, platform
-# Local dependency paths, adapt them to your setup
-godot_headers_path = ARGUMENTS.get("headers", os.getenv("GODOT_HEADERS", "../godot_headers/"))
-godot_bin_path = ARGUMENTS.get("godotbinpath", os.getenv("GODOT_BIN_PATH", "../godot_fork/bin/godot.x11.tools.64.llvm"))
-target = ARGUMENTS.get("target", "debug")
-platform = ARGUMENTS.get("p", ARGUMENTS.get("platform", "linux"))
+def add_sources(sources, dir, extension):
+ for f in os.listdir(dir):
+ if f.endswith('.' + extension):
+ sources.append(dir + '/' + f)
+
-# 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 = Environment()
-if platform == "windows":
- env = Environment(ENV = os.environ)
+host_platform = platform.system()
+target_platform = ARGUMENTS.get('p', ARGUMENTS.get('platform', 'linux'))
+target_arch = ARGUMENTS.get('a', ARGUMENTS.get('arch', '64'))
+# default to debug build, must be same setting as used for cpp_bindings
+target = ARGUMENTS.get('target', 'debug')
+# Local dependency paths, adapt them to your setup
+godot_headers = ARGUMENTS.get('headers', '../godot_headers')
+godot_bin_path = ARGUMENTS.get('godotbinpath', os.getenv('GODOT_BIN_PATH', '../godot_fork/bin/godot.x11.tools.64.llvm'))
+result_path = 'bin'
+result_name = ARGUMENTS.get('n', ARGUMENTS.get('name', os.path.relpath('.', '..')))
+
+
+if target_platform == 'linux':
+ result_name += '.linux.' + target_arch
+
+ env['CXX']='gcc-5'
+ if ARGUMENTS.get('use_llvm', 'no') == 'yes':
+ env['CXX'] = 'clang++'
+
+ env.Append(CCFLAGS = [ '-fPIC', '-g', '-O3', '-std=c++14', '-Wwrite-strings' ])
+ env.Append(LINKFLAGS = [ '-Wl,-R,\'$$ORIGIN\'' ])
+
+ if target_arch == '32':
+ env.Append(CCFLAGS = [ '-m32' ])
+ env.Append(LINKFLAGS = [ '-m32' ])
+ elif target_arch == '64':
+ env.Append(CCFLAGS = [ '-m64' ])
+ env.Append(LINKFLAGS = [ '-m64' ])
+
+elif target_platform == '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
+ if (target_arch == '64'):
+ env = Environment(ENV = os.environ, TARGET_ARCH='amd64')
+ else:
+ env = Environment(ENV = os.environ, TARGET_ARCH='x86')
-if ARGUMENTS.get("use_llvm", "no") == "yes":
- env["CXX"] = "clang++"
+ result_name += '.windows.' + target_arch
-def add_sources(sources, directory):
- for file in os.listdir(directory):
- if file.endswith('.cpp'):
- sources.append(directory + '/' + file)
+ if host_platform == 'Windows':
+ result_name += '.lib'
+ env.Append(LINKFLAGS = [ '/WX' ])
+ if target == 'debug':
+ env.Append(CCFLAGS = ['/EHsc', '/D_DEBUG', '/MDd' ])
+ else:
+ env.Append(CCFLAGS = ['/O2', '/EHsc', '/DNDEBUG', '/MD' ])
+ else:
+ if target_arch == '32':
+ env['CXX']='i686-w64-mingw32-g++'
+ elif target_arch == '64':
+ env['CXX']='x86_64-w64-mingw32-g++'
-if platform == "osx":
- env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-arch', 'x86_64'])
- env.Append(LINKFLAGS = ['-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup'])
+ env.Append(CCFLAGS = [ '-g', '-O3', '-std=c++14', '-Wwrite-strings' ])
+ env.Append(LINKFLAGS = [ '--static', '-Wl,--no-undefined', '-static-libgcc', '-static-libstdc++' ])
-if platform == "linux":
- env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++14'])
+elif target_platform == 'osx':
+ if ARGUMENTS.get('use_llvm', 'no') == 'yes':
+ env['CXX'] = 'clang++'
-env.Append(CPPPATH=['.', godot_headers_path, 'include', 'include/core'])
+ # Only 64-bits is supported for OS X
+ target_arch = '64'
+ result_name += '.osx.' + target_arch
-if platform == "windows":
- if target == "debug":
- env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '/MDd'])
- else:
- env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '/MD'])
+ env.Append(CCFLAGS = [ '-g','-O3', '-std=c++14', '-arch', 'x86_64' ])
+ env.Append(LINKFLAGS = [ '-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup' ])
-sources = []
-add_sources(sources, "src/core")
-if ARGUMENTS.get("generate_bindings", "no") == "yes":
- # TODO Generating the API should be done only if the Godot build is more recent than the JSON file
- json_api_file = os.path.join(os.getcwd(), 'godot_api.json')
+env.Append(CPPPATH=['.', godot_headers, 'include', 'include/core'])
+
+# Generate bindings
+json_api_file = os.path.join(os.getcwd(), 'godot_api.json')
+if os.path.exists(json_api_file) == False or ARGUMENTS.get('regenerate_bindings', 'no') == 'yes':
subprocess.call([os.path.expanduser(godot_bin_path), '--gdnative-generate-json-api', json_api_file])
# actually create the bindings here
import binding_generator
-
binding_generator.generate_bindings(json_api_file)
-add_sources(sources, "src")
-library = env.StaticLibrary(target='bin/godot_cpp_bindings', source=sources)
-Default(library)
+sources = []
+add_sources(sources, 'src/core', 'cpp')
+add_sources(sources, 'src', 'cpp')
+
+library = env.StaticLibrary(target=result_path + '/' + result_name, source=sources)
+Default(library)
diff --git a/binding_generator.py b/binding_generator.py
index 9337156..0a1d2ff 100644
--- a/binding_generator.py
+++ b/binding_generator.py
@@ -115,6 +115,7 @@ def generate_class_header(used_classes, c):
source.append("")
+ vararg_templates = ""
# generate the class definition here
source.append("class " + class_name + ("" if c["base_class"] == "" else (" : public " + strip_name(c["base_class"])) ) + " {")
@@ -157,14 +158,18 @@ def generate_class_header(used_classes, c):
method_signature += "static " if c["singleton"] else ""
method_signature += make_gdnative_type(method["return_type"])
- method_signature += escape_cpp(method["name"]) + "("
+ method_name = escape_cpp(method["name"])
+ method_signature += method_name + "("
has_default_argument = False
+ method_arguments = ""
for i, argument in enumerate(method["arguments"]):
method_signature += "const " + make_gdnative_type(argument["type"])
- method_signature += escape_cpp(argument["name"])
+ argument_name = escape_cpp(argument["name"])
+ method_signature += argument_name
+ method_arguments += argument_name
# default arguments
@@ -210,10 +215,13 @@ def generate_class_header(used_classes, c):
if i != len(method["arguments"]) - 1:
method_signature += ", "
+ method_arguments += ","
if method["has_varargs"]:
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"""
method_signature += "const Array& __var_args = Array()"
method_signature += ")" + (" const" if method["is_const"] and not c["singleton"] else "")
@@ -221,7 +229,7 @@ def generate_class_header(used_classes, c):
source.append("\t" + method_signature + ";")
-
+ source.append(vararg_templates)
source.append("};")
source.append("")
diff --git a/include/core/Array.hpp b/include/core/Array.hpp
index 2320568..ead3ba3 100644
--- a/include/core/Array.hpp
+++ b/include/core/Array.hpp
@@ -3,6 +3,7 @@
#include <gdnative/array.h>
+#include "Defs.hpp"
#include "String.hpp"
namespace godot {
@@ -39,6 +40,11 @@ public:
Array(const PoolColorArray& a);
+ template <class... Args>
+ static Array make(Args... args) {
+ return helpers::append_all(Array(), args...);
+ }
+
Variant& operator [](const int idx);
Variant operator [](const int idx) const;
diff --git a/include/core/Defs.hpp b/include/core/Defs.hpp
index 4b73cfa..245e32c 100644
--- a/include/core/Defs.hpp
+++ b/include/core/Defs.hpp
@@ -58,6 +58,42 @@ enum class Error {
ERR_WTF = ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above
};
+ namespace helpers {
+ template <typename T, typename ValueT>
+ T append_all (T appendable, ValueT value) {
+ appendable.append(value);
+ return appendable;
+ }
+
+ template <typename T, typename ValueT, typename... Args>
+ T append_all (T appendable, ValueT value, Args... args) {
+ appendable.append(value);
+ return append_all(appendable, args...);
+ }
+
+ template <typename T>
+ T append_all (T appendable) {
+ return appendable;
+ }
+
+ template <typename KV, typename KeyT, typename ValueT>
+ KV add_all (KV kv, KeyT key, ValueT value) {
+ kv[key] = value;
+ return kv;
+ }
+
+ template <typename KV, typename KeyT, typename ValueT, typename... Args>
+ KV add_all (KV kv, KeyT key, ValueT value, Args... args) {
+ kv[key] = value;
+ return add_all(kv, args...);
+ }
+
+ template <typename KV>
+ KV add_all (KV kv) {
+ return kv;
+ }
+ }
+
}
#include <stdio.h>
diff --git a/include/core/Dictionary.hpp b/include/core/Dictionary.hpp
index ec496af..613d6ce 100644
--- a/include/core/Dictionary.hpp
+++ b/include/core/Dictionary.hpp
@@ -16,6 +16,11 @@ public:
Dictionary(const Dictionary & other);
Dictionary & operator=(const Dictionary & other);
+ template <class... Args>
+ static Dictionary make(Args... args) {
+ return helpers::add_all(Dictionary(), args...);
+ }
+
void clear();
bool empty() const;
diff --git a/include/core/Godot.hpp b/include/core/Godot.hpp
index f710658..4686c7f 100644
--- a/include/core/Godot.hpp
+++ b/include/core/Godot.hpp
@@ -484,6 +484,11 @@ void register_signal(String name, Dictionary args = Dictionary())
}
}
+template<class T, class... Args>
+void register_signal(String name, Args... varargs)
+{
+ register_signal<T>(name, Dictionary::make(varargs...));
+}
}
diff --git a/include/core/GodotGlobal.hpp b/include/core/GodotGlobal.hpp
index 7d28dba..a913359 100644
--- a/include/core/GodotGlobal.hpp
+++ b/include/core/GodotGlobal.hpp
@@ -3,6 +3,7 @@
#include <gdnative_api_struct.gen.h>
#include "String.hpp"
+#include "Array.hpp"
namespace godot {
@@ -20,6 +21,11 @@ public:
static void gdnative_init(godot_gdnative_init_options *o);
static void gdnative_terminate(godot_gdnative_terminate_options *o);
static void nativescript_init(void *handle);
+
+ template <class... Args>
+ static void print(const String& fmt, Args... values) {
+ print(fmt.format(Array::make(values...)));
+ }
};
diff --git a/include/core/NodePath.hpp b/include/core/NodePath.hpp
index 026414b..e9e60ac 100644
--- a/include/core/NodePath.hpp
+++ b/include/core/NodePath.hpp
@@ -36,6 +36,8 @@ public:
void operator =(const NodePath& other);
+ bool operator ==(const NodePath& other);
+
~NodePath();
};
diff --git a/include/core/PoolArrays.hpp b/include/core/PoolArrays.hpp
index 4d22fd7..eba7b9c 100644
--- a/include/core/PoolArrays.hpp
+++ b/include/core/PoolArrays.hpp
@@ -104,7 +104,7 @@ public:
void set(const int idx, const uint8_t data);
- uint8_t operator [](const int idx);
+ const uint8_t operator [](const int idx);
int size() const;
@@ -200,7 +200,7 @@ public:
void set(const int idx, const int data);
- int operator [](const int idx);
+ const int operator [](const int idx);
int size() const;
@@ -296,7 +296,7 @@ public:
void set(const int idx, const real_t data);
- real_t operator [](const int idx);
+ const real_t operator [](const int idx);
int size() const;
@@ -392,7 +392,7 @@ public:
void set(const int idx, const String& data);
- String operator [](const int idx);
+ const String operator [](const int idx);
int size() const;
@@ -489,7 +489,7 @@ public:
void set(const int idx, const Vector2& data);
- Vector2 operator [](const int idx);
+ const Vector2 operator [](const int idx);
int size() const;
@@ -585,7 +585,7 @@ public:
void set(const int idx, const Vector3& data);
- Vector3 operator [](const int idx);
+ const Vector3 operator [](const int idx);
int size() const;
@@ -681,7 +681,7 @@ public:
void set(const int idx, const Color& data);
- Color operator [](const int idx);
+ const Color operator [](const int idx);
int size() const;
diff --git a/include/core/String.hpp b/include/core/String.hpp
index de65f3c..7826fcb 100644
--- a/include/core/String.hpp
+++ b/include/core/String.hpp
@@ -81,6 +81,7 @@ public:
int find(String what, int from = 0) const;
int find_last(String what) const;
int findn(String what, int from = 0) const;
+ String format(Variant values) const;
String format(Variant values, String placeholder) const;
String get_base_dir() const;
String get_basename() const;
@@ -128,6 +129,7 @@ public:
String to_upper() const;
String xml_escape() const;
String xml_unescape() const;
+
};
String operator+(const char *a, const String &b);
diff --git a/src/core/NodePath.cpp b/src/core/NodePath.cpp
index 25ce882..b1fb9cc 100644
--- a/src/core/NodePath.cpp
+++ b/src/core/NodePath.cpp
@@ -17,7 +17,6 @@ NodePath::NodePath(const NodePath &other)
{
String from = other;
godot::api->godot_node_path_new(&_node_path, (godot_string *) &from);
- godot::api->godot_node_path_operator_equal(&_node_path, &other._node_path);
}
NodePath::NodePath(const String &from)
@@ -71,9 +70,18 @@ NodePath::operator String() const
return *(String *) &str;
}
+bool NodePath::operator ==(const NodePath& other)
+{
+ return godot::api->godot_node_path_operator_equal(&_node_path, &other._node_path);
+}
+
void NodePath::operator =(const NodePath& other)
{
- godot::api->godot_node_path_operator_equal(&_node_path, &other._node_path);
+ godot::api->godot_node_path_destroy(&_node_path);
+
+ String other_string = (String) other;
+
+ godot::api->godot_node_path_new(&_node_path, (godot_string *) &other_string);
}
NodePath::~NodePath()
diff --git a/src/core/PoolArrays.cpp b/src/core/PoolArrays.cpp
index d66de4c..8a6f9f8 100644
--- a/src/core/PoolArrays.cpp
+++ b/src/core/PoolArrays.cpp
@@ -86,7 +86,7 @@ void PoolByteArray::set(const int idx, const uint8_t data)
godot::api->godot_pool_byte_array_set(&_godot_array, idx, data);
}
-uint8_t PoolByteArray::operator [](const int idx)
+const uint8_t PoolByteArray::operator [](const int idx)
{
return godot::api->godot_pool_byte_array_get(&_godot_array, idx);
}
@@ -180,7 +180,7 @@ void PoolIntArray::set(const int idx, const int data)
godot::api->godot_pool_int_array_set(&_godot_array, idx, data);
}
-int PoolIntArray::operator [](const int idx)
+const int PoolIntArray::operator [](const int idx)
{
return godot::api->godot_pool_int_array_get(&_godot_array, idx);
}
@@ -273,7 +273,7 @@ void PoolRealArray::set(const int idx, const real_t data)
godot::api->godot_pool_real_array_set(&_godot_array, idx, data);
}
-real_t PoolRealArray::operator [](const int idx)
+const real_t PoolRealArray::operator [](const int idx)
{
return godot::api->godot_pool_real_array_get(&_godot_array, idx);
}
@@ -367,7 +367,7 @@ void PoolStringArray::set(const int idx, const String& data)
godot::api->godot_pool_string_array_set(&_godot_array, idx, (godot_string *) &data);
}
-String PoolStringArray::operator [](const int idx)
+const String PoolStringArray::operator [](const int idx)
{
String s;
godot_string str = godot::api->godot_pool_string_array_get(&_godot_array, idx);
@@ -465,7 +465,7 @@ void PoolVector2Array::set(const int idx, const Vector2& data)
godot::api->godot_pool_vector2_array_set(&_godot_array, idx, (godot_vector2 *) &data);
}
-Vector2 PoolVector2Array::operator [](const int idx)
+const Vector2 PoolVector2Array::operator [](const int idx)
{
Vector2 v;
*(godot_vector2 *) &v = godot::api->godot_pool_vector2_array_get(&_godot_array, idx);
@@ -561,7 +561,7 @@ void PoolVector3Array::set(const int idx, const Vector3& data)
godot::api->godot_pool_vector3_array_set(&_godot_array, idx, (godot_vector3 *) &data);
}
-Vector3 PoolVector3Array::operator [](const int idx)
+const Vector3 PoolVector3Array::operator [](const int idx)
{
Vector3 v;
*(godot_vector3 *) &v = godot::api->godot_pool_vector3_array_get(&_godot_array, idx);
@@ -656,7 +656,7 @@ void PoolColorArray::set(const int idx, const Color& data)
godot::api->godot_pool_color_array_set(&_godot_array, idx, (godot_color *) &data);
}
-Color PoolColorArray::operator [](const int idx)
+const Color PoolColorArray::operator [](const int idx)
{
Color v;
*(godot_color *) &v = godot::api->godot_pool_color_array_get(&_godot_array, idx);
diff --git a/src/core/String.cpp b/src/core/String.cpp
index 3d822b1..737c040 100644
--- a/src/core/String.cpp
+++ b/src/core/String.cpp
@@ -267,13 +267,22 @@ int String::findn(String what, int from) const {
return godot::api->godot_string_findn(&_godot_string, what._godot_string);
}
-String String::format(Variant values, String placeholder) const {
+String String::format(Variant values) const {
String new_string;
new_string._godot_string = godot::api->godot_string_format(&_godot_string, (godot_variant *)&values);
return new_string;
}
+String String::format(Variant values, String placeholder) const {
+ String new_string;
+ godot_char_string contents = godot::api->godot_string_utf8(&placeholder._godot_string);
+ new_string._godot_string = godot::api->godot_string_format_with_custom_placeholder(&_godot_string, (godot_variant *)&values, godot::api->godot_char_string_get_data(&contents));
+ godot::api->godot_char_string_destroy(&contents);
+
+ return new_string;
+}
+
String String::get_base_dir() const {
String new_string;
new_string._godot_string = godot::api->godot_string_get_base_dir(&_godot_string);