Merge branch 'master' into template_get_node
commit
2b14529de6
|
@ -16,3 +16,159 @@ bin
|
|||
*.creator.user
|
||||
*.files
|
||||
*.includes
|
||||
|
||||
# Gprof output
|
||||
gmon.out
|
||||
|
||||
# Vim temp files
|
||||
*.swo
|
||||
*.swp
|
||||
|
||||
# Qt project files
|
||||
*.config
|
||||
*.creator
|
||||
*.creator.*
|
||||
*.files
|
||||
*.includes
|
||||
*.cflags
|
||||
*.cxxflags
|
||||
|
||||
# Eclipse CDT files
|
||||
.cproject
|
||||
.settings/
|
||||
|
||||
# Geany/geany-plugins files
|
||||
*.geany
|
||||
.geanyprj
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
logs/
|
||||
|
||||
# for projects that use SCons for building: http://http://www.scons.org/
|
||||
.sconf_temp
|
||||
.sconsign.dblite
|
||||
*.pyc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.opendb
|
||||
*.VC.VC.opendb
|
||||
enc_temp_folder/
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# CodeLite project files
|
||||
*.project
|
||||
*.workspace
|
||||
.codelite/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
__pycache__/
|
||||
|
||||
# KDE
|
||||
.directory
|
||||
|
||||
#Kdevelop project files
|
||||
*.kdev4
|
||||
|
||||
# xCode
|
||||
xcuserdata
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
logo.h
|
||||
*.autosave
|
||||
|
||||
# https://github.com/github/gitignore/blob/master/Global/Tags.gitignore
|
||||
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
|
||||
TAGS
|
||||
!TAGS/
|
||||
tags
|
||||
*.tags
|
||||
!tags/
|
||||
gtags.files
|
||||
GTAGS
|
||||
GRTAGS
|
||||
GPATH
|
||||
cscope.files
|
||||
cscope.out
|
||||
cscope.in.out
|
||||
cscope.po.out
|
||||
godot.creator.*
|
||||
|
||||
# Visual Studio 2017 and Visual Studio Code workspace folder
|
||||
/.vs
|
||||
/.vscode
|
||||
|
||||
# Visual Studio Code workspace file
|
||||
*.code-workspace
|
||||
|
||||
# Scons progress indicator
|
||||
.scons_node_count
|
||||
|
||||
# ccls cache (https://github.com/MaskRay/ccls)
|
||||
.ccls-cache/
|
||||
|
||||
# compile commands (https://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
||||
compile_commands.json
|
||||
|
|
|
@ -52,11 +52,11 @@ def is_reference_type(t):
|
|||
return True
|
||||
return False
|
||||
|
||||
def make_gdnative_type(t):
|
||||
def make_gdnative_type(t, ref_allowed):
|
||||
if is_enum(t):
|
||||
return remove_enum_prefix(t) + " "
|
||||
elif is_class_type(t):
|
||||
if is_reference_type(t):
|
||||
if is_reference_type(t) and ref_allowed:
|
||||
return "Ref<" + strip_name(t) + "> "
|
||||
else:
|
||||
return strip_name(t) + " *"
|
||||
|
@ -89,8 +89,10 @@ def generate_class_header(used_classes, c, use_template_get_node):
|
|||
# so don't include it here because it's not needed
|
||||
if class_name != "Object" and class_name != "Reference":
|
||||
source.append("#include <core/Ref.hpp>")
|
||||
ref_allowed = True
|
||||
else:
|
||||
source.append("#include <core/TagDB.hpp>")
|
||||
ref_allowed = False
|
||||
|
||||
|
||||
included = []
|
||||
|
@ -215,7 +217,7 @@ def generate_class_header(used_classes, c, use_template_get_node):
|
|||
|
||||
# TODO decide what to do about virtual methods
|
||||
# method_signature += "virtual " if method["is_virtual"] else ""
|
||||
method_signature += make_gdnative_type(method["return_type"])
|
||||
method_signature += make_gdnative_type(method["return_type"], ref_allowed)
|
||||
method_name = escape_cpp(method["name"])
|
||||
method_signature += method_name + "("
|
||||
|
||||
|
@ -224,7 +226,7 @@ def generate_class_header(used_classes, c, use_template_get_node):
|
|||
method_arguments = ""
|
||||
|
||||
for i, argument in enumerate(method["arguments"]):
|
||||
method_signature += "const " + make_gdnative_type(argument["type"])
|
||||
method_signature += "const " + make_gdnative_type(argument["type"], ref_allowed)
|
||||
argument_name = escape_cpp(argument["name"])
|
||||
method_signature += argument_name
|
||||
method_arguments += argument_name
|
||||
|
@ -325,6 +327,9 @@ def generate_class_header(used_classes, c, use_template_get_node):
|
|||
|
||||
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("")
|
||||
|
@ -398,12 +403,11 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
|
|||
correct_method_name(class_name, method)
|
||||
method_signature = ""
|
||||
|
||||
|
||||
method_signature += make_gdnative_type(method["return_type"])
|
||||
method_signature += make_gdnative_type(method["return_type"], ref_allowed)
|
||||
method_signature += strip_name(c["name"]) + "::" + escape_cpp(method["name"]) + "("
|
||||
|
||||
for i, argument in enumerate(method["arguments"]):
|
||||
method_signature += "const " + make_gdnative_type(argument["type"])
|
||||
method_signature += "const " + make_gdnative_type(argument["type"], ref_allowed)
|
||||
method_signature += escape_cpp(argument["name"])
|
||||
|
||||
if i != len(method["arguments"]) - 1:
|
||||
|
@ -427,12 +431,13 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
|
|||
continue
|
||||
|
||||
return_statement = ""
|
||||
return_type_is_ref = is_reference_type(method["return_type"]) and ref_allowed
|
||||
|
||||
if method["return_type"] != "void":
|
||||
if is_class_type(method["return_type"]):
|
||||
if is_enum(method["return_type"]):
|
||||
return_statement += "return (" + remove_enum_prefix(method["return_type"]) + ") "
|
||||
elif is_reference_type(method["return_type"]):
|
||||
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 "")
|
||||
|
@ -507,7 +512,7 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
|
|||
if method["return_type"] != "void":
|
||||
cast = ""
|
||||
if is_class_type(method["return_type"]):
|
||||
if is_reference_type(method["return_type"]):
|
||||
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);"
|
||||
|
@ -516,7 +521,6 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
|
|||
source.append("\treturn " + cast)
|
||||
|
||||
|
||||
|
||||
else:
|
||||
|
||||
args = []
|
||||
|
@ -534,11 +538,15 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
|
|||
return_statement += icall_name + "(___mb.mb_" + method["name"] + ", (const Object *) " + core_object_name
|
||||
|
||||
for arg in method["arguments"]:
|
||||
return_statement += ", " + escape_cpp(arg["name"]) + (".ptr()" if is_reference_type(arg["type"]) else "")
|
||||
arg_is_ref = is_reference_type(arg["type"]) and ref_allowed
|
||||
return_statement += ", " + escape_cpp(arg["name"]) + (".ptr()" if arg_is_ref else "")
|
||||
|
||||
return_statement += ")"
|
||||
|
||||
source.append("\t" + return_statement + (")" if is_reference_type(method["return_type"]) else "") + ";")
|
||||
if return_type_is_ref:
|
||||
return_statement += ")"
|
||||
|
||||
source.append("\t" + return_statement + ";")
|
||||
|
||||
source.append("}")
|
||||
source.append("")
|
||||
|
@ -740,7 +748,6 @@ def get_icall_name(sig):
|
|||
|
||||
|
||||
|
||||
|
||||
def get_used_classes(c, use_template_get_node):
|
||||
classes = []
|
||||
for method in c["methods"]:
|
||||
|
@ -758,9 +765,6 @@ def get_used_classes(c, use_template_get_node):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def strip_name(name):
|
||||
if len(name) == 0:
|
||||
return name
|
||||
|
|
|
@ -62,8 +62,10 @@ enum class Error {
|
|||
#include <GodotGlobal.hpp>
|
||||
|
||||
// alloca() is non-standard. When using MSVC, it's in malloc.h.
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__MINGW32__)
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <alloca.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
typedef float real_t;
|
||||
|
|
|
@ -29,6 +29,9 @@ public:
|
|||
class String {
|
||||
godot_string _godot_string;
|
||||
|
||||
String(godot_string contents) :
|
||||
_godot_string(contents) {}
|
||||
|
||||
public:
|
||||
String();
|
||||
String(const char *contents);
|
||||
|
|
|
@ -178,6 +178,13 @@ struct Vector2 {
|
|||
|
||||
Vector2 cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
|
||||
|
||||
Vector2 move_toward(const Vector2 &p_to, const real_t p_delta) const {
|
||||
Vector2 v = *this;
|
||||
Vector2 vd = p_to - v;
|
||||
real_t len = vd.length();
|
||||
return len <= p_delta || len < CMP_EPSILON ? p_to : v + vd / len * p_delta;
|
||||
}
|
||||
|
||||
inline Vector2 slide(const Vector2 &p_vec) const {
|
||||
return p_vec - *this * this->dot(p_vec);
|
||||
}
|
||||
|
|
|
@ -167,6 +167,13 @@ struct Vector3 {
|
|||
|
||||
Vector3 cubic_interpolate(const Vector3 &b, const Vector3 &pre_a, const Vector3 &post_b, const real_t t) const;
|
||||
|
||||
Vector3 move_toward(const Vector3 &p_to, const real_t p_delta) const {
|
||||
Vector3 v = *this;
|
||||
Vector3 vd = p_to - v;
|
||||
real_t len = vd.length();
|
||||
return len <= p_delta || len < CMP_EPSILON ? p_to : v + vd / len * p_delta;
|
||||
}
|
||||
|
||||
Vector3 bounce(const Vector3 &p_normal) const {
|
||||
return -reflect(p_normal);
|
||||
}
|
||||
|
|
|
@ -25,52 +25,31 @@ const char *godot::CharString::get_data() const {
|
|||
}
|
||||
|
||||
String String::num(double p_num, int p_decimals) {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_num_with_decimals(p_num, p_decimals);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_num_with_decimals(p_num, p_decimals));
|
||||
}
|
||||
|
||||
String String::num_scientific(double p_num) {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_num_scientific(p_num);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_num_scientific(p_num));
|
||||
}
|
||||
|
||||
String String::num_real(double p_num) {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_num_real(p_num);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_num_real(p_num));
|
||||
}
|
||||
|
||||
String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_num_int64_capitalized(p_num, base, capitalize_hex);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_num_int64_capitalized(p_num, base, capitalize_hex));
|
||||
}
|
||||
|
||||
String String::chr(godot_char_type p_char) {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_chr(p_char);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_chr(p_char));
|
||||
}
|
||||
|
||||
String String::md5(const uint8_t *p_md5) {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_md5(p_md5);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_md5(p_md5));
|
||||
}
|
||||
|
||||
String String::hex_encode_buffer(const uint8_t *p_buffer, int p_len) {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_hex_encode_buffer(p_buffer, p_len);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_hex_encode_buffer(p_buffer, p_len));
|
||||
}
|
||||
|
||||
godot::String::String() {
|
||||
|
@ -124,18 +103,16 @@ bool String::operator!=(const String &s) const {
|
|||
}
|
||||
|
||||
String String::operator+(const String &s) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_operator_plus(&_godot_string, &s._godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_operator_plus(&_godot_string, &s._godot_string));
|
||||
}
|
||||
|
||||
void String::operator+=(const String &s) {
|
||||
_godot_string = godot::api->godot_string_operator_plus(&_godot_string, &s._godot_string);
|
||||
*this = String(godot::api->godot_string_operator_plus(&_godot_string, &s._godot_string));
|
||||
}
|
||||
|
||||
void String::operator+=(const wchar_t c) {
|
||||
// @Todo
|
||||
String _to_be_added = String(c);
|
||||
*this = String(godot::api->godot_string_operator_plus(&_godot_string, &_to_be_added._godot_string));
|
||||
}
|
||||
|
||||
bool String::operator<(const String &s) const {
|
||||
|
@ -223,24 +200,15 @@ PoolStringArray String::bigrams() const {
|
|||
}
|
||||
|
||||
String String::c_escape() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_c_escape(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_c_escape(&_godot_string));
|
||||
}
|
||||
|
||||
String String::c_unescape() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_c_unescape(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_c_unescape(&_godot_string));
|
||||
}
|
||||
|
||||
String String::capitalize() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_capitalize(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_capitalize(&_godot_string));
|
||||
}
|
||||
|
||||
bool String::empty() const {
|
||||
|
@ -268,41 +236,31 @@ int String::findn(String p_what, int p_from) 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;
|
||||
return String(godot::api->godot_string_format(&_godot_string, (godot_variant *)&values));
|
||||
}
|
||||
|
||||
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));
|
||||
String new_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);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_get_base_dir(&_godot_string));
|
||||
}
|
||||
|
||||
String String::get_basename() const {
|
||||
godot_string new_string = godot::api->godot_string_get_basename(&_godot_string);
|
||||
return *(String *)&new_string;
|
||||
return String(godot::api->godot_string_get_basename(&_godot_string));
|
||||
}
|
||||
|
||||
String String::get_extension() const {
|
||||
godot_string new_string = godot::api->godot_string_get_extension(&_godot_string);
|
||||
return *(String *)&new_string;
|
||||
return String(godot::api->godot_string_get_extension(&_godot_string));
|
||||
}
|
||||
|
||||
String String::get_file() const {
|
||||
godot_string new_string = godot::api->godot_string_get_file(&_godot_string);
|
||||
return *(String *)&new_string;
|
||||
return String(godot::api->godot_string_get_file(&_godot_string));
|
||||
}
|
||||
|
||||
int String::hash() const {
|
||||
|
@ -314,10 +272,7 @@ int String::hex_to_int() const {
|
|||
}
|
||||
|
||||
String String::insert(int position, String what) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_insert(&_godot_string, position, what._godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_insert(&_godot_string, position, what._godot_string));
|
||||
}
|
||||
|
||||
bool String::is_abs_path() const {
|
||||
|
@ -357,17 +312,11 @@ bool String::is_valid_ip_address() const {
|
|||
}
|
||||
|
||||
String String::json_escape() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_json_escape(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_json_escape(&_godot_string));
|
||||
}
|
||||
|
||||
String String::left(int position) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_left(&_godot_string, position);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_left(&_godot_string, position));
|
||||
}
|
||||
|
||||
bool String::match(String expr) const {
|
||||
|
@ -384,10 +333,7 @@ PoolByteArray String::md5_buffer() const {
|
|||
}
|
||||
|
||||
String String::md5_text() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_md5_text(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_md5_text(&_godot_string));
|
||||
}
|
||||
|
||||
int String::ord_at(int at) const {
|
||||
|
@ -395,52 +341,31 @@ int String::ord_at(int at) const {
|
|||
}
|
||||
|
||||
String String::pad_decimals(int digits) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_pad_decimals(&_godot_string, digits);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_pad_decimals(&_godot_string, digits));
|
||||
}
|
||||
|
||||
String String::pad_zeros(int digits) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_pad_zeros(&_godot_string, digits);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_pad_zeros(&_godot_string, digits));
|
||||
}
|
||||
|
||||
String String::percent_decode() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_percent_decode(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_percent_decode(&_godot_string));
|
||||
}
|
||||
|
||||
String String::percent_encode() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_percent_encode(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_percent_encode(&_godot_string));
|
||||
}
|
||||
|
||||
String String::plus_file(String file) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_plus_file(&_godot_string, &file._godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_plus_file(&_godot_string, &file._godot_string));
|
||||
}
|
||||
|
||||
String String::replace(String p_key, String p_with) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_replace(&_godot_string, p_key._godot_string, p_with._godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_replace(&_godot_string, p_key._godot_string, p_with._godot_string));
|
||||
}
|
||||
|
||||
String String::replacen(String what, String forwhat) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_replacen(&_godot_string, what._godot_string, forwhat._godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_replacen(&_godot_string, what._godot_string, forwhat._godot_string));
|
||||
}
|
||||
|
||||
int String::rfind(String p_what, int p_from) const {
|
||||
|
@ -452,10 +377,7 @@ int String::rfindn(String p_what, int p_from) const {
|
|||
}
|
||||
|
||||
String String::right(int position) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_right(&_godot_string, position);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_right(&_godot_string, position));
|
||||
}
|
||||
|
||||
PoolByteArray String::sha256_buffer() const {
|
||||
|
@ -465,10 +387,7 @@ PoolByteArray String::sha256_buffer() const {
|
|||
}
|
||||
|
||||
String String::sha256_text() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_sha256_text(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_sha256_text(&_godot_string));
|
||||
}
|
||||
|
||||
float String::similarity(String text) const {
|
||||
|
@ -494,17 +413,11 @@ PoolRealArray String::split_floats(String divisor, bool allow_empty) const {
|
|||
}
|
||||
|
||||
String String::strip_edges(bool left, bool right) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_strip_edges(&_godot_string, left, right);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_strip_edges(&_godot_string, left, right));
|
||||
}
|
||||
|
||||
String String::substr(int from, int len) const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_substr(&_godot_string, from, len);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_substr(&_godot_string, from, len));
|
||||
}
|
||||
|
||||
float String::to_float() const {
|
||||
|
@ -516,31 +429,19 @@ int64_t String::to_int() const {
|
|||
}
|
||||
|
||||
String String::to_lower() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_to_lower(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_to_lower(&_godot_string));
|
||||
}
|
||||
|
||||
String String::to_upper() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_to_upper(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_to_upper(&_godot_string));
|
||||
}
|
||||
|
||||
String String::xml_escape() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_xml_escape(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_xml_escape(&_godot_string));
|
||||
}
|
||||
|
||||
String String::xml_unescape() const {
|
||||
String new_string;
|
||||
new_string._godot_string = godot::api->godot_string_xml_unescape(&_godot_string);
|
||||
|
||||
return new_string;
|
||||
return String(godot::api->godot_string_xml_unescape(&_godot_string));
|
||||
}
|
||||
|
||||
signed char String::casecmp_to(String p_str) const {
|
||||
|
|
Loading…
Reference in New Issue