Skip to content

Commit 4cbb34e

Browse files
committed
Adapt code to new godot internals
1 parent 7bf2e93 commit 4cbb34e

18 files changed

+194
-229
lines changed

src/editor/dialog/about_dialog.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#include "editor/strings.h"
88

99
#include <editor/editor_interface.h>
10+
#include <editor/settings/editor_settings.h>
1011
#include <editor/themes/editor_scale.h>
12+
#include <scene/gui/check_box.h>
1113
#include <scene/gui/rich_text_label.h>
1214
#include <scene/gui/texture_rect.h>
1315

@@ -30,7 +32,6 @@ void AboutDialog::_notification(int notification) {
3032
VBoxContainer* about_vbox {memnew(VBoxContainer)};
3133
add_child(about_vbox);
3234

33-
3435
RichTextLabel* about_label {memnew(RichTextLabel)};
3536
about_label->set_custom_minimum_size(Size2 {600, 150} * EDSCALE);
3637
about_label->set_v_size_flags(Control::SizeFlags::SIZE_EXPAND_FILL);
@@ -58,4 +59,4 @@ void AboutDialog::_notification(int notification) {
5859
}
5960
}
6061

61-
#endif// TOOLS_ENABLED
62+
#endif // TOOLS_ENABLED

src/editor/dialog/about_dialog.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#ifndef GODOT_JVM_ABOUT_DIALOG_H
55
#define GODOT_JVM_ABOUT_DIALOG_H
66

7-
#include <editor/editor_settings.h>
8-
#include <scene/gui/check_box.h>
97
#include <scene/gui/dialogs.h>
108

119
class AboutDialog : public AcceptDialog {

src/editor/godot_kotlin_jvm_editor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
#include "strings.h"
99

1010
#include <core/config/project_settings.h>
11+
#include <editor/settings/editor_settings.h>
1112
#include <editor/editor_interface.h>
12-
#include <editor/filesystem_dock.h>
13+
#include <editor/file_system/editor_file_system.h>
1314
#include <gd_kotlin.h>
1415

1516
void GodotKotlinJvmEditor::on_menu_option_pressed(int option_id) {
@@ -20,6 +21,7 @@ void GodotKotlinJvmEditor::on_menu_option_pressed(int option_id) {
2021
case ABOUT:
2122
about_dialog->popup_centered();
2223
break;
24+
default:;
2325
}
2426
}
2527

@@ -155,6 +157,7 @@ void GodotKotlinJvmEditor::_notification(int notification) {
155157
remove_control_from_container(CustomControlContainer::CONTAINER_TOOLBAR, tool_bar_gradle_task_choice);
156158
remove_control_from_container(CustomControlContainer::CONTAINER_TOOLBAR, tool_bar_gradle_task_button);
157159
break;
160+
default:;
158161
}
159162
}
160163

src/editor/project/project_generator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void ProjectGenerator::generate_jvm_files(bool erase_existing) {
1818

1919
String root = String("res://");
2020
Ref<DirAccess> root_directory = DirAccess::open(root);
21-
core_bind::Marshalls* marshall = memnew(core_bind::Marshalls);
21+
CoreBind::Marshalls* marshall = memnew(CoreBind::Marshalls);
2222

2323
for (int i = 0; i < number_of_files; ++i) {
2424
String file_location = String(file_names[i]);

src/jni/env.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace jni {
2828

2929
//Support fully qualified class names with "a/b/c" and "a.b.c" format
3030
JClass Env::find_class(const char* name) {
31-
jclass cls = env->FindClass(String(name).replace(".", "/").utf8());
31+
jclass cls = env->FindClass(String(name).replace(".", "/").utf8().get_data());
3232
JVM_DEV_ASSERT(cls, "Class not found: %s", name);
3333
handle_exception();
3434
return JClass(cls);

src/jvm_wrapper/registration/kt_function.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ KtFunctionInfo::~KtFunctionInfo() {
8080
MethodInfo KtFunctionInfo::to_method_info() const {
8181
MethodInfo methodInfo;
8282
methodInfo.name = name;
83-
List<PropertyInfo> pInfoList;
83+
Vector<PropertyInfo> pInfoList;
8484
for (auto argument : arguments) {
8585
pInfoList.push_back(argument->toPropertyInfo());
8686
}

src/kotlin_editor_export_plugin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ void KotlinEditorExportPlugin::_export_begin(const HashSet<String>& p_features,
137137

138138
_generate_export_configuration_file(jni::JvmType::GRAAL_NATIVE_IMAGE);
139139

140-
add_ios_project_static_lib(
140+
add_apple_embedded_platform_project_static_lib(
141141
ProjectSettings::get_singleton()->globalize_path(base_ios_jdk_dir.path_join("libjava-release.a"))
142142
);
143-
add_ios_project_static_lib(
143+
add_apple_embedded_platform_project_static_lib(
144144
ProjectSettings::get_singleton()->globalize_path(base_ios_jdk_dir.path_join("libjvm-release.a"))
145145
);
146-
add_ios_project_static_lib(ProjectSettings::get_singleton()->globalize_path(base_ios_build_dir.path_join(IOS_GRAAL_NATIVE_IMAGE_FILE)));
146+
add_apple_embedded_platform_project_static_lib(ProjectSettings::get_singleton()->globalize_path(base_ios_build_dir.path_join(IOS_GRAAL_NATIVE_IMAGE_FILE)));
147147
} else {
148148
JVM_ERR_FAIL_MSG("Godot Kotlin/JVM doesn't handle this platform");
149149
}

src/kt_variant.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@ class VariantToBuffer {
5656
String str {src};
5757
const CharString& char_string {str.utf8()};
5858
set_variant_type(des, Variant::Type::STRING);
59-
int size = char_string.size();
60-
if (unlikely(size > LongStringQueue::max_string_size)) {
59+
if (int size = char_string.size(); unlikely(size > LongStringQueue::max_string_size)) {
6160
des->increment_position(encode_uint32(true, des->get_cursor()));
6261
jni::Env env = jni::Jvm::current_env();
6362
LongStringQueue::get_instance().send_string_to_jvm(env, str);
6463
} else {
6564
des->increment_position(encode_uint32(false, des->get_cursor()));
6665
des->increment_position(encode_uint32(char_string.size(), des->get_cursor()));
67-
if (likely(size > 0)) { des->increment_position(encode_cstring(char_string, des->get_cursor())); }
66+
if (likely(size > 0)) { des->increment_position(encode_cstring(char_string.get_data(), des->get_cursor())); }
6867
}
6968
}
7069

src/language/gdj_language.cpp

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,36 +112,30 @@ String GdjLanguage::get_global_class_name(const String& p_path, String* r_base_t
112112
return {};
113113
}
114114

115-
void GdjLanguage::get_reserved_words(List<String>* p_words) const {
116-
static const char* _reserved_words[] = {// RESERVED KEYWORDS
117-
"registeredName",
118-
"fqName",
119-
"relativeSourcePath ",
120-
"baseType ",
121-
"supertypes",
122-
"signals",
123-
"properties",
124-
"functions",
125-
nullptr
115+
Vector<String> GdjLanguage::get_reserved_words() const {
116+
return {
117+
"registeredName",
118+
"fqName",
119+
"relativeSourcePath ",
120+
"baseType ",
121+
"supertypes",
122+
"signals",
123+
"properties",
124+
"functions"
126125
};
127-
const char** w = _reserved_words;
128-
while (*w) {
129-
p_words->push_back(*w);
130-
w++;
131-
}
132126
}
133127

134128
bool GdjLanguage::is_control_flow_keyword(const String& p_keyword) const {
135129
return false;
136130
}
137131

138-
void GdjLanguage::get_comment_delimiters(List<String>* p_delimiters) const {
139-
p_delimiters->push_back("//");
132+
Vector<String> GdjLanguage::get_comment_delimiters() const {
133+
return {"//"};
140134
}
141135

142-
void GdjLanguage::get_doc_comment_delimiters(List<String>* p_delimiters) const {}
136+
Vector<String> GdjLanguage::get_doc_comment_delimiters() const {return {};}
143137

144-
void GdjLanguage::get_string_delimiters(List<String>* p_delimiters) const {}
138+
Vector<String> GdjLanguage::get_string_delimiters() const {return {};}
145139

146140
Ref<Script> GdjLanguage::make_template(const String& p_template, const String& p_class_name, const String& p_base_class_name) const {
147141
Ref<GdjScript> gdj_script;

src/language/gdj_language.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ class GdjLanguage : public JvmLanguage {
3030
bool supports_builtin_mode() const override;
3131
Script* create_script() const override;
3232

33-
void get_reserved_words(List<String>* p_words) const override;
33+
Vector<String> get_reserved_words() const override;
3434
bool is_control_flow_keyword(const String& p_keyword) const override;
35-
void get_comment_delimiters(List<String>* p_delimiters) const override;
36-
void get_doc_comment_delimiters(List<String>* p_delimiters) const override;
37-
void get_string_delimiters(List<String>* p_delimiters) const override;
35+
Vector<String> get_comment_delimiters() const override;
36+
Vector<String> get_doc_comment_delimiters() const override;
37+
Vector<String> get_string_delimiters() const override;
3838
Ref<Script> make_template(const String& p_template, const String& p_class_name, const String& p_base_class_name) const override;
3939
Vector<ScriptTemplate> get_built_in_templates(const StringName& p_object) override;
4040
bool is_using_templates() override;

0 commit comments

Comments
 (0)