mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3
This commit is contained in:
commit
419fc2a89d
|
@ -34,11 +34,6 @@ script:
|
||||||
before_install:
|
before_install:
|
||||||
- tools/travis-scripts/before-install.sh
|
- tools/travis-scripts/before-install.sh
|
||||||
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
- xiaoming.zhang@cocos2d-x.org
|
|
||||||
- jianhua.chen@cocos2d-x.org
|
|
||||||
|
|
||||||
# whitelist
|
# whitelist
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
|
1
AUTHORS
1
AUTHORS
|
@ -1059,6 +1059,7 @@ Developers:
|
||||||
|
|
||||||
shrimpz
|
shrimpz
|
||||||
Fix two typos in luaval_to_quaternion
|
Fix two typos in luaval_to_quaternion
|
||||||
|
Fix label crashed on android
|
||||||
|
|
||||||
Retired Core Developers:
|
Retired Core Developers:
|
||||||
WenSheng Yang
|
WenSheng Yang
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
cocos2d-x-3.3 ???
|
||||||
|
|
||||||
|
[FIX] Label: when a label is added to a invisible parent node, app will crash if switching from background
|
||||||
|
|
||||||
cocos2d-x-3.3-rc1 Nov.29 2014
|
cocos2d-x-3.3-rc1 Nov.29 2014
|
||||||
[NEW] Vec2: added greater than operator
|
[NEW] Vec2: added greater than operator
|
||||||
[NEW] Tools: Updated cocos console to v1.4 (from 1.2)
|
[NEW] Tools: Updated cocos console to v1.4 (from 1.2)
|
||||||
|
|
|
@ -270,7 +270,14 @@ Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = Te
|
||||||
_batchNodes.clear();
|
_batchNodes.clear();
|
||||||
_batchNodes.push_back(this);
|
_batchNodes.push_back(this);
|
||||||
|
|
||||||
alignText();
|
if (_contentDirty)
|
||||||
|
{
|
||||||
|
updateContent();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alignText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(purgeTextureListener, this);
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(purgeTextureListener, this);
|
||||||
|
|
|
@ -314,6 +314,7 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
|
||||||
FontLetterDefinition tempDefinition;
|
FontLetterDefinition tempDefinition;
|
||||||
Vec2 letterPosition;
|
Vec2 letterPosition;
|
||||||
const auto& kernings = theLabel->_horizontalKernings;
|
const auto& kernings = theLabel->_horizontalKernings;
|
||||||
|
CCASSERT(kernings, "kernings must's be nullptr!!!");
|
||||||
|
|
||||||
float clipTop = 0;
|
float clipTop = 0;
|
||||||
float clipBottom = 0;
|
float clipBottom = 0;
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class Cocos2dxMusic {
|
||||||
private float mLeftVolume;
|
private float mLeftVolume;
|
||||||
private float mRightVolume;
|
private float mRightVolume;
|
||||||
private boolean mPaused;// whether music is paused state.
|
private boolean mPaused;// whether music is paused state.
|
||||||
|
private boolean mIsLoop = false;
|
||||||
private boolean mManualPaused = false;// whether music is paused manually before the program is switched to the background.
|
private boolean mManualPaused = false;// whether music is paused manually before the program is switched to the background.
|
||||||
private String mCurrentPath;
|
private String mCurrentPath;
|
||||||
|
|
||||||
|
@ -89,41 +90,42 @@ public class Cocos2dxMusic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playBackgroundMusic(final String pPath, final boolean isLoop) {
|
public void playBackgroundMusic(final String path, final boolean isLoop) {
|
||||||
if (this.mCurrentPath == null) {
|
if (mCurrentPath == null) {
|
||||||
// it is the first time to play background music or end() was called
|
// it is the first time to play background music or end() was called
|
||||||
this.mBackgroundMediaPlayer = this.createMediaplayer(pPath);
|
mBackgroundMediaPlayer = createMediaplayer(path);
|
||||||
this.mCurrentPath = pPath;
|
mCurrentPath = path;
|
||||||
} else {
|
} else {
|
||||||
if (!this.mCurrentPath.equals(pPath)) {
|
if (!mCurrentPath.equals(path)) {
|
||||||
// play new background music
|
// play new background music
|
||||||
|
|
||||||
// release old resource and create a new one
|
// release old resource and create a new one
|
||||||
if (this.mBackgroundMediaPlayer != null) {
|
if (mBackgroundMediaPlayer != null) {
|
||||||
this.mBackgroundMediaPlayer.release();
|
mBackgroundMediaPlayer.release();
|
||||||
}
|
}
|
||||||
this.mBackgroundMediaPlayer = this.createMediaplayer(pPath);
|
mBackgroundMediaPlayer = createMediaplayer(path);
|
||||||
|
|
||||||
// record the path
|
// record the path
|
||||||
this.mCurrentPath = pPath;
|
mCurrentPath = path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mBackgroundMediaPlayer == null) {
|
if (mBackgroundMediaPlayer == null) {
|
||||||
Log.e(Cocos2dxMusic.TAG, "playBackgroundMusic: background media player is null");
|
Log.e(Cocos2dxMusic.TAG, "playBackgroundMusic: background media player is null");
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// if the music is playing or paused, stop it
|
// if the music is playing or paused, stop it
|
||||||
if (mPaused) {
|
if (mPaused) {
|
||||||
mBackgroundMediaPlayer.seekTo(0);
|
mBackgroundMediaPlayer.seekTo(0);
|
||||||
this.mBackgroundMediaPlayer.start();
|
mBackgroundMediaPlayer.start();
|
||||||
} else if (mBackgroundMediaPlayer.isPlaying()) {
|
} else if (mBackgroundMediaPlayer.isPlaying()) {
|
||||||
mBackgroundMediaPlayer.seekTo(0);
|
mBackgroundMediaPlayer.seekTo(0);
|
||||||
} else {
|
} else {
|
||||||
this.mBackgroundMediaPlayer.start();
|
mBackgroundMediaPlayer.start();
|
||||||
}
|
}
|
||||||
this.mBackgroundMediaPlayer.setLooping(isLoop);
|
mBackgroundMediaPlayer.setLooping(isLoop);
|
||||||
this.mPaused = false;
|
mPaused = false;
|
||||||
|
mIsLoop = isLoop;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
Log.e(Cocos2dxMusic.TAG, "playBackgroundMusic: error state");
|
Log.e(Cocos2dxMusic.TAG, "playBackgroundMusic: error state");
|
||||||
}
|
}
|
||||||
|
@ -132,8 +134,8 @@ public class Cocos2dxMusic {
|
||||||
|
|
||||||
public void stopBackgroundMusic() {
|
public void stopBackgroundMusic() {
|
||||||
if (this.mBackgroundMediaPlayer != null) {
|
if (this.mBackgroundMediaPlayer != null) {
|
||||||
this.mBackgroundMediaPlayer.stop();
|
mBackgroundMediaPlayer.release();
|
||||||
|
mBackgroundMediaPlayer = createMediaplayer(mCurrentPath);
|
||||||
// should set the state, if not, the following sequence will be error
|
// should set the state, if not, the following sequence will be error
|
||||||
// play -> pause -> stop -> resume
|
// play -> pause -> stop -> resume
|
||||||
this.mPaused = false;
|
this.mPaused = false;
|
||||||
|
@ -158,17 +160,7 @@ public class Cocos2dxMusic {
|
||||||
|
|
||||||
public void rewindBackgroundMusic() {
|
public void rewindBackgroundMusic() {
|
||||||
if (this.mBackgroundMediaPlayer != null) {
|
if (this.mBackgroundMediaPlayer != null) {
|
||||||
this.mBackgroundMediaPlayer.stop();
|
playBackgroundMusic(mCurrentPath, mIsLoop);
|
||||||
|
|
||||||
try {
|
|
||||||
this.mBackgroundMediaPlayer.prepare();
|
|
||||||
this.mBackgroundMediaPlayer.seekTo(0);
|
|
||||||
this.mBackgroundMediaPlayer.start();
|
|
||||||
|
|
||||||
this.mPaused = false;
|
|
||||||
} catch (final Exception e) {
|
|
||||||
Log.e(Cocos2dxMusic.TAG, "rewindBackgroundMusic: error state");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,8 @@ static std::function<Layer*()> createFunctions[] =
|
||||||
CL(LabelLineHeightTest),
|
CL(LabelLineHeightTest),
|
||||||
CL(LabelAdditionalKerningTest),
|
CL(LabelAdditionalKerningTest),
|
||||||
CL(LabelIssue8492Test),
|
CL(LabelIssue8492Test),
|
||||||
CL(LabelMultilineWithOutline)
|
CL(LabelMultilineWithOutline),
|
||||||
|
CL(LabelIssue9255Test)
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||||
|
@ -1852,3 +1853,27 @@ std::string LabelMultilineWithOutline::subtitle() const
|
||||||
{
|
{
|
||||||
return "end in string 'outline feature'";
|
return "end in string 'outline feature'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LabelIssue9255Test::LabelIssue9255Test()
|
||||||
|
{
|
||||||
|
Size s = Director::getInstance()->getWinSize();
|
||||||
|
auto parent = Node::create();
|
||||||
|
parent->setPosition(s.width/2, s.height/2);
|
||||||
|
parent->setVisible(false);
|
||||||
|
this->addChild(parent);
|
||||||
|
|
||||||
|
auto label = Label::createWithTTF("Crashed!!!", "fonts/HKYuanMini.ttf", 24);
|
||||||
|
label->setPosition(VisibleRect::center());
|
||||||
|
parent->addChild(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LabelIssue9255Test::title() const
|
||||||
|
{
|
||||||
|
return "Test for Issue #9255";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LabelIssue9255Test::subtitle() const
|
||||||
|
{
|
||||||
|
return "switch to desktop and switch back. Crashed!!!";
|
||||||
|
}
|
||||||
|
|
|
@ -533,4 +533,16 @@ public:
|
||||||
|
|
||||||
// we don't support linebreak mode
|
// we don't support linebreak mode
|
||||||
|
|
||||||
|
class LabelIssue9255Test : public AtlasDemoNew
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(LabelIssue9255Test);
|
||||||
|
|
||||||
|
LabelIssue9255Test();
|
||||||
|
|
||||||
|
virtual std::string title() const override;
|
||||||
|
virtual std::string subtitle() const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue