Răsfoiți Sursa

[godot] Fix compilation for 3.x, update to 3.5-stable

Mario Zechner 3 ani în urmă
părinte
comite
ffe4ad8538

+ 2 - 2
.github/workflows/spine-godot.yml

@@ -13,8 +13,8 @@ env:
   AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
   AWS_EC2_METADATA_DISABLED: true
   EM_VERSION: 3.1.10
-  GODOT_TAG: 3.4.4-stable
-  GODOT_VERSION: 3.4.4.stable
+  GODOT_TAG: 3.5-stable
+  GODOT_VERSION: 3.5.stable
 
 jobs:
 

+ 8 - 8
spine-godot/README.md

@@ -22,18 +22,18 @@ spine-godot supports all Spine features, except two-color tinting and the screen
 
 ## Setup
 
-spine-godot works with the latest stable Godot 3.4 release. It requires compilation of Godot, as spine-godot is implemented as a module.
+spine-godot works with the latest stable Godot 3.5 release. It requires compilation of Godot, as spine-godot is implemented as a module.
 
 > *NOTE:* spine-godot also compiles and works against Godot 4.x. However, we currently can not guarantee stability, as Godot 4.x is still heavily in flux.
 
 ### Pre-built Godot editor and export template binaries
 
-We provide prebuilt Godot editor and export template binaries for Godot 3.4.4-stable:
+We provide prebuilt Godot editor and export template binaries for Godot 3.5-stable:
 
-* [Godot Editor Windows](https://spine-godot.s3.eu-central-1.amazonaws.com/4.1/3.4.4-stable/godot-editor-windows.zip)
-* [Godot Editor Linux](https://spine-godot.s3.eu-central-1.amazonaws.com/4.1/3.4.4-stable/godot-editor-linux.zip)
-* [Godot Editor macOS](https://spine-godot.s3.eu-central-1.amazonaws.com/4.1/3.4.4-stable/godot-editor-macos.zip)
-* [Godot export templates for Windows, Linux, macOS, Web, Android, iOS](https://spine-godot.s3.eu-central-1.amazonaws.com/4.1/3.4.4-stable/spine-godot-templates-4.1-3.4.4-stable.tpz)
+* [Godot Editor Windows](https://spine-godot.s3.eu-central-1.amazonaws.com/4.1/3.5-stable/godot-editor-windows.zip)
+* [Godot Editor Linux](https://spine-godot.s3.eu-central-1.amazonaws.com/4.1/3.5-stable/godot-editor-linux.zip)
+* [Godot Editor macOS](https://spine-godot.s3.eu-central-1.amazonaws.com/4.1/3.5-stable/godot-editor-macos.zip)
+* [Godot export templates for Windows, Linux, macOS, Web, Android, iOS](https://spine-godot.s3.eu-central-1.amazonaws.com/4.1/3.5-stable/spine-godot-templates-4.1-3.5-stable.tpz)
 
 ### Building the Godot editor and export templates locally
 
@@ -59,7 +59,7 @@ To build the export template for a specific platform, run the following in a Bas
 
 ```
 cd spine-godot
-./build/setup.sh 3.4.4-stable false
+./build/setup.sh 3.5-stable false
 ./build/build-templates.sh windows
 ```
 
@@ -79,7 +79,7 @@ This repository contains a GitHub workflow in `.github/workflows/spine-godot.yml
 The resulting binaries will be attached as artifacts to a sucessful workflow run.
 
 ## Example
-Sample projects for both Godot 3.4.x and Godot 4.x are provided in the `example/` and `example-v4/` folders respectively. They illustrate all spine-godot functionality and can be opened and exported with the pre-built or custom build Godot editor and export template binaries.
+Sample projects for both Godot 3.5.x and Godot 4.x are provided in the `example/` and `example-v4/` folders respectively. They illustrate all spine-godot functionality and can be opened and exported with the pre-built or custom build Godot editor and export template binaries.
 
 
 

+ 9 - 0
spine-godot/spine_godot/SpineSprite.cpp

@@ -831,12 +831,21 @@ 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)));
 
+#if VERSION_MAJOR > 3
 	float line_height = default_font->get_height(Font::DEFAULT_FONT_SIZE) + default_font->get_descent(Font::DEFAULT_FONT_SIZE);
+#else
+	float line_height = default_font->get_height() + default_font->get_descent();
+#endif
 	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);
 	}
+
+#if VERSION_MAJOR > 3
 	Rect2 background_rect(0, -default_font->get_height(Font::DEFAULT_FONT_SIZE) - 5, rect_width + 20, line_height * hover_text_lines.size() + 10);
+#else
+Rect2 background_rect(0, -default_font->get_height() - 5, rect_width + 20, line_height * hover_text_lines.size() + 10);
+#endif
 	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