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:
|
||||
- tools/travis-scripts/before-install.sh
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- xiaoming.zhang@cocos2d-x.org
|
||||
- jianhua.chen@cocos2d-x.org
|
||||
|
||||
# whitelist
|
||||
branches:
|
||||
only:
|
||||
|
|
1
AUTHORS
1
AUTHORS
|
@ -1059,6 +1059,7 @@ Developers:
|
|||
|
||||
shrimpz
|
||||
Fix two typos in luaval_to_quaternion
|
||||
Fix label crashed on android
|
||||
|
||||
Retired Core Developers:
|
||||
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
|
||||
[NEW] Vec2: added greater than operator
|
||||
[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.push_back(this);
|
||||
|
||||
alignText();
|
||||
if (_contentDirty)
|
||||
{
|
||||
updateContent();
|
||||
}
|
||||
else
|
||||
{
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
});
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(purgeTextureListener, this);
|
||||
|
|
|
@ -314,6 +314,7 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
|
|||
FontLetterDefinition tempDefinition;
|
||||
Vec2 letterPosition;
|
||||
const auto& kernings = theLabel->_horizontalKernings;
|
||||
CCASSERT(kernings, "kernings must's be nullptr!!!");
|
||||
|
||||
float clipTop = 0;
|
||||
float clipBottom = 0;
|
||||
|
|
|
@ -48,6 +48,7 @@ public class Cocos2dxMusic {
|
|||
private float mLeftVolume;
|
||||
private float mRightVolume;
|
||||
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 String mCurrentPath;
|
||||
|
||||
|
@ -89,41 +90,42 @@ public class Cocos2dxMusic {
|
|||
}
|
||||
}
|
||||
|
||||
public void playBackgroundMusic(final String pPath, final boolean isLoop) {
|
||||
if (this.mCurrentPath == null) {
|
||||
public void playBackgroundMusic(final String path, final boolean isLoop) {
|
||||
if (mCurrentPath == null) {
|
||||
// it is the first time to play background music or end() was called
|
||||
this.mBackgroundMediaPlayer = this.createMediaplayer(pPath);
|
||||
this.mCurrentPath = pPath;
|
||||
mBackgroundMediaPlayer = createMediaplayer(path);
|
||||
mCurrentPath = path;
|
||||
} else {
|
||||
if (!this.mCurrentPath.equals(pPath)) {
|
||||
if (!mCurrentPath.equals(path)) {
|
||||
// play new background music
|
||||
|
||||
// release old resource and create a new one
|
||||
if (this.mBackgroundMediaPlayer != null) {
|
||||
this.mBackgroundMediaPlayer.release();
|
||||
if (mBackgroundMediaPlayer != null) {
|
||||
mBackgroundMediaPlayer.release();
|
||||
}
|
||||
this.mBackgroundMediaPlayer = this.createMediaplayer(pPath);
|
||||
mBackgroundMediaPlayer = createMediaplayer(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");
|
||||
} else {
|
||||
try {
|
||||
// if the music is playing or paused, stop it
|
||||
if (mPaused) {
|
||||
mBackgroundMediaPlayer.seekTo(0);
|
||||
this.mBackgroundMediaPlayer.start();
|
||||
mBackgroundMediaPlayer.start();
|
||||
} else if (mBackgroundMediaPlayer.isPlaying()) {
|
||||
mBackgroundMediaPlayer.seekTo(0);
|
||||
} else {
|
||||
this.mBackgroundMediaPlayer.start();
|
||||
mBackgroundMediaPlayer.start();
|
||||
}
|
||||
this.mBackgroundMediaPlayer.setLooping(isLoop);
|
||||
this.mPaused = false;
|
||||
mBackgroundMediaPlayer.setLooping(isLoop);
|
||||
mPaused = false;
|
||||
mIsLoop = isLoop;
|
||||
} catch (final Exception e) {
|
||||
Log.e(Cocos2dxMusic.TAG, "playBackgroundMusic: error state");
|
||||
}
|
||||
|
@ -132,8 +134,8 @@ public class Cocos2dxMusic {
|
|||
|
||||
public void stopBackgroundMusic() {
|
||||
if (this.mBackgroundMediaPlayer != null) {
|
||||
this.mBackgroundMediaPlayer.stop();
|
||||
|
||||
mBackgroundMediaPlayer.release();
|
||||
mBackgroundMediaPlayer = createMediaplayer(mCurrentPath);
|
||||
// should set the state, if not, the following sequence will be error
|
||||
// play -> pause -> stop -> resume
|
||||
this.mPaused = false;
|
||||
|
@ -158,17 +160,7 @@ public class Cocos2dxMusic {
|
|||
|
||||
public void rewindBackgroundMusic() {
|
||||
if (this.mBackgroundMediaPlayer != null) {
|
||||
this.mBackgroundMediaPlayer.stop();
|
||||
|
||||
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");
|
||||
}
|
||||
playBackgroundMusic(mCurrentPath, mIsLoop);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,8 @@ static std::function<Layer*()> createFunctions[] =
|
|||
CL(LabelLineHeightTest),
|
||||
CL(LabelAdditionalKerningTest),
|
||||
CL(LabelIssue8492Test),
|
||||
CL(LabelMultilineWithOutline)
|
||||
CL(LabelMultilineWithOutline),
|
||||
CL(LabelIssue9255Test)
|
||||
};
|
||||
|
||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||
|
@ -1852,3 +1853,27 @@ std::string LabelMultilineWithOutline::subtitle() const
|
|||
{
|
||||
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
|
||||
|
||||
class LabelIssue9255Test : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelIssue9255Test);
|
||||
|
||||
LabelIssue9255Test();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue