Sfoglia il codice sorgente

[godot] Fixes for latest 4.0 commits, automatically install MoltenVK on macOS via setup.sh

Mario Zechner 3 anni fa
parent
commit
1c150203ab

+ 10 - 0
spine-godot/build/install-macos-vulkan-sdk.sh

@@ -0,0 +1,10 @@
+set -euo pipefail
+IFS=$'\n\t'
+
+# Download and install the Vulkan SDK.
+curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg" -o /tmp/vulkan-sdk.dmg
+hdiutil attach /tmp/vulkan-sdk.dmg -mountpoint /Volumes/vulkan-sdk
+/Volumes/vulkan-sdk/InstallVulkan.app/Contents/MacOS/InstallVulkan \
+    --accept-licenses --default-answer --confirm-command install
+hdiutil detach /Volumes/vulkan-sdk
+rm -f /tmp/vulkan-sdk.dmg

+ 4 - 0
spine-godot/build/setup.sh

@@ -32,6 +32,10 @@ if [ $dev = "true" ]; then
 		git apply ../build/livepp-v4.patch
 		popd
 	fi
+
+	if [ `uname` == 'Darwin' ] && [ ! -d "$HOME/VulkanSDK" ]; then
+		./build/install-macos-vulkan-sdk.sh
+	fi
 fi
 cp -r ../spine-cpp/spine-cpp spine_godot
 popd

+ 3 - 3
spine-godot/spine_godot/SpineSprite.cpp

@@ -831,16 +831,16 @@ void SpineSprite::draw() {
 	auto global_scale = get_global_scale();
 	draw_set_transform(mouse_position + Vector2(20, 0), -get_global_rotation(), Vector2(inverse_zoom * (1 / global_scale.x), inverse_zoom * (1 / global_scale.y)));
 
-	float line_height = default_font->get_height() + default_font->get_descent();
+	float line_height = default_font->get_height(Font::DEFAULT_FONT_SIZE) + default_font->get_descent(Font::DEFAULT_FONT_SIZE);
 	float rect_width = 0;
 	for (int i = 0; i < hover_text_lines.size(); i++) {
 		rect_width = MAX(rect_width, default_font->get_string_size(hover_text_lines[i]).x);
 	}
-	Rect2 background_rect(0, -default_font->get_height() - 5, rect_width + 20, line_height * hover_text_lines.size() + 10);
+	Rect2 background_rect(0, -default_font->get_height(Font::DEFAULT_FONT_SIZE) - 5, rect_width + 20, line_height * hover_text_lines.size() + 10);
 	if (hover_text_lines.size() > 0) draw_rect(background_rect, Color(0, 0, 0, 0.8));
 	for (int i = 0; i < hover_text_lines.size(); i++) {
 #if VERSION_MAJOR > 3
-		draw_string(default_font, Vector2(10, 0 + i * default_font->get_height()), hover_text_lines[i], HORIZONTAL_ALIGNMENT_LEFT, -1, Font::DEFAULT_FONT_SIZE, Color(1, 1, 1, 1));
+		draw_string(default_font, Vector2(10, 0 + i * default_font->get_height(Font::DEFAULT_FONT_SIZE)), hover_text_lines[i], HORIZONTAL_ALIGNMENT_LEFT, -1, Font::DEFAULT_FONT_SIZE, Color(1, 1, 1, 1));
 #else
 		draw_string(default_font, Vector2(10, 0 + i * default_font->get_height()), hover_text_lines[i], Color(1, 1, 1, 1));
 #endif