-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v3.8.5] Fix enum type conversion and support closure compiler to minify wasm glue code. #17767
[v3.8.5] Fix enum type conversion and support closure compiler to minify wasm glue code. #17767
Conversation
-s EXPORTED_FUNCTIONS=['_spineListenerCallBackFromJS','_spineTrackListenerCallback'] \ | ||
--js-library ../library_spine.js \ | ||
--closure=1 \ | ||
--closure-args=--externs=../library_spine_externs.js") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add closure compiler option
#include <math.h> | ||
namespace spine { | ||
|
||
Vector2::Vector2(): x(0), y(0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy from ../spine-creator-support/Vector2.cpp
to make spine-wasm
project independent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it conflict with spine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector2.h/.cpp was not the code in spine-runtime
.
spine-creator-support
directory is for JSB and spine-wasm
is for WASM.
We should not include a file (Vector2.h/.cpp) in spine-creator-support
directory since it is used for JSB.
@@ -14,6 +14,6 @@ mergeInto(LibraryManager.library, { | |||
var eventType = wasmUtil.getCurrentEventType(); | |||
var trackEntry = wasmUtil.getCurrentTrackEntry(); | |||
var event = wasmUtil.getCurrentEvent(); | |||
globalThis.TrackEntryListeners.emitTrackEntryListener(listenerID, trackEntry, event, eventType.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eventType is number
now, so doesn't need to add .value
.
SpineWasmUtil.getCurrentListenerID = function() {}; | ||
SpineWasmUtil.getCurrentTrackEntry = function() {}; | ||
SpineWasmUtil.getCurrentEvent = function() {}; | ||
SpineWasmUtil.getCurrentEventType = function() {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tell closure compiler that these methods should not be obfuscated.
✅ Package size is not changedInterface Check ReportThis pull request does not change any public interfaces ! |
REGISTER_SPINE_ENUM(RotateMode); | ||
REGISTER_SPINE_ENUM(TextureFilter); | ||
REGISTER_SPINE_ENUM(TextureWrap); | ||
REGISTER_SPINE_ENUM(AttachmentType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle enums like integers.
Re: #17715
And add a script for generating compile commands which used for writing embind code in VS Code.
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: