Skip to content
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

Fix bug: Not support sprite frame when ignoreContentAdaptWithSize is false #19107

Merged
merged 1 commit into from
Oct 31, 2018

Conversation

chongchaoyu
Copy link

No description provided.

@@ -565,7 +565,7 @@ class CC_GUI_DLL RichText : public Widget
const Color3B& outlineColor = Color3B::WHITE, int outlineSize = -1,
const Color3B& shadowColor = Color3B::BLACK, const Size& shadowOffset = Size(2.0, -2.0), int shadowBlurRadius = 0,
const Color3B& glowColor = Color3B::WHITE);
void handleImageRenderer(const std::string& filePath, const Color3B& color, GLubyte opacity, int width, int height, const std::string& url);
void handleImageRenderer(const std::string& filePath, Widget::TextureResType textureType, const Color3B& color, GLubyte opacity, int width, int height, const std::string& url);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to add a new API, rather than change the current one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, do you mean to provide a new api for using sprite frames?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PatriceJiang
And the current one is a little weird, developer can't use sprite frames when they want to set the content size, they have to use a local sprite which is the same as the one in the plist. In a project, using the same sprite with different size at different places is very normal, do you think so? :)

Copy link
Contributor

@PatriceJiang PatriceJiang Oct 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same sprite with different size

These sprites do share same Texture underlying, but I think they should not be "the same sprite".
A Sprite holds partial render info of a Texture instance. Since the position/size differs, they should be separated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The background is: language is javescript, using createWithXML to create richtext.
The case is that:
There is a file, "res/star.png". I want to create two richtexts using the "star" loading from the file, one richtext's _ignoreSize is true, and the other has to be false, then I can't put "res/star.png" into plist, because when _ignoreSize is true, RichText can't load image from plist.
In my project, almost all of the pngs has been put into plist due to resource management and performance.

Am I clear?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please open a new issue and provide a description there

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, the new issue is #19114

@chongchaoyu chongchaoyu changed the title Fix bug: Not support sprite frame when ignoreContentAdaptWithSize is true Fix bug: Not support sprite frame when ignoreContentAdaptWithSize is false Oct 16, 2018
@drelaptop drelaptop added this to the 3.18 milestone Oct 31, 2018
@drelaptop drelaptop merged commit 18a14fb into cocos2d:v3 Oct 31, 2018
stevetranby added a commit to stevetranby/cocos2d-x that referenced this pull request Nov 11, 2018
STEVE: removed js/lua new files from merge

* commit 'bb32eee94438f92b61799781211ddd3f5afd7736':
  make code more clean and make comment more clear (cocos2d#19155)
  [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#19152)
  prevent cmake in-source-build friendly (cocos2d#19151)
  UIButton fix setTitleLabel memleaks (cocos2d#19148)
  correct lua template cmake build (cocos2d#19149)
  modern cmake, cmake_cleanup_remove_unused_variables (cocos2d#19146)
  refine CCDevice-win32 BitmapDC (cocos2d#19144)
  modern cmake, improve cmake_compiler_flags (cocos2d#19145)
  add ui::LoadingBar support to Progress actions (cocos2d#18748)
  [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#19142)
  modern cmake, compile definitions improvement (cocos2d#19139)
  [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#19141)
  Add `GLView::setCursor` for desktop platforms (cocos2d#19129)
  add line spacing support for system font on iOS and Android (cocos2d#18993)
  Bugfix for aviod reading outside of the buffer. (cocos2d#19098)
  Fix bug: Not support sprite frame when ignoreContentAdaptWithSize is true (cocos2d#19107)
  iPhone X home indicator handling (cocos2d#19132)

# Conflicts:
#	build/cocos2d_tests.xcodeproj/project.pbxproj
#	cocos/base/CCConsole.cpp
#	cocos/scripting/js-bindings/CMakeLists.txt
#	cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp
#	cocos/scripting/js-bindings/proj.android/CMakeLists.txt
#	cocos/scripting/lua-bindings/CMakeLists.txt
#	cocos/scripting/lua-bindings/auto/api/GLView.lua
#	cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp
#	cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp
#	templates/js-template-default/CMakeLists.txt
#	templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle
#	templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm
#	templates/lua-template-default/CMakeLists.txt
#	templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle
#	templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm
#	tests/js-tests/project/CMakeLists.txt
#	tests/js-tests/project/proj.android/app/build.gradle
#	tests/lua-empty-test/project/CMakeLists.txt
#	tests/lua-empty-test/project/proj.android/app/build.gradle
#	tests/lua-tests/project/CMakeLists.txt
#	tests/lua-tests/project/proj.android/app/build.gradle
huangwei1024 pushed a commit to huangwei1024/cocos2d-x that referenced this pull request Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants