Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,52 @@ matrix:
sudo: required
# android ndk-build
- os: linux
dist: xenial
env: BUILD_TARGET=android_cpp_ndk-build
language: android
sudo: required
# android_lua ndk-build
- os: linux
dist: xenial
env: BUILD_TARGET=android_lua_ndk-build
language: android
sudo: required
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
# android cmake
- os: linux
dist: xenial
env: BUILD_TARGET=android_cpp_cmake
language: android
sudo: required
# android_lua cmake
- os: linux
dist: xenial
env: BUILD_TARGET=android_lua_cmake
language: android
sudo: required
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
# android_js cmake
- os: linux
dist: xenial
env: BUILD_TARGET=android_js_cmake
language: android
sudo: required
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
# mac
- os: osx
env: BUILD_TARGET=mac
Expand All @@ -67,6 +90,7 @@ matrix:
osx_image: xcode9.3
sudo: required
- os: linux
dist: xenial
env: BUILD_TARGET=android_cocos_new_cpp_test
language: android
sudo: required
Expand Down
9 changes: 3 additions & 6 deletions cocos/audio/AudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void AudioEngine::remove(int audioID)
it->second.profileHelper->audioIDs.remove(audioID);
}
_audioPathIDMap[*it->second.filePath].remove(audioID);
_audioIDInfoMap.erase(audioID);
_audioIDInfoMap.erase(it);
}
}

Expand Down Expand Up @@ -394,16 +394,13 @@ void AudioEngine::uncache(const std::string &filePath)
{
itInfo->second.profileHelper->audioIDs.remove(audioID);
}
_audioIDInfoMap.erase(audioID);
_audioIDInfoMap.erase(itInfo);
}
}
_audioPathIDMap.erase(filePath);
}

if (_audioEngineImpl)
{
_audioEngineImpl->uncache(filePath);
}
_audioEngineImpl->uncache(filePath);
}

void AudioEngine::uncacheAll()
Expand Down
15 changes: 6 additions & 9 deletions cocos/audio/linux/AudioEngine-linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ AudioEngineImpl::AudioEngineImpl()
AudioEngineImpl::~AudioEngineImpl()
{
FMOD_RESULT result;
result = pSystem->close();
ERRCHECKWITHEXIT(result);
result = pSystem->release();
ERRCHECKWITHEXIT(result);
}
Expand Down Expand Up @@ -109,7 +107,8 @@ int AudioEngineImpl::play2d(const std::string &fileFullPath, bool loop, float vo
int id = preload(fileFullPath, nullptr);
if (id >= 0) {
mapChannelInfo[id].loop=loop;
mapChannelInfo[id].channel->setPaused(true);
// channel is null here. Don't dereference it. It's only set in resume(id).
//mapChannelInfo[id].channel->setPaused(true);
mapChannelInfo[id].volume = volume;
AudioEngine::_audioIDInfoMap[id].state = AudioEngine::AudioState::PAUSED;
resume(id);
Expand Down Expand Up @@ -287,8 +286,7 @@ void AudioEngineImpl::uncache(const std::string& path)
}
mapSound.erase(it);
}
if (mapId.find(path) != mapId.end())
mapId.erase(path);
mapId.erase(path);
}

void AudioEngineImpl::uncacheAll()
Expand Down Expand Up @@ -320,10 +318,9 @@ int AudioEngineImpl::preload(const std::string& filePath, std::function<void(boo
}

int id = static_cast<int>(mapChannelInfo.size()) + 1;
if (mapId.find(filePath) == mapId.end())
mapId.insert({filePath, id});
else
id = mapId.at(filePath);
// std::map::insert returns std::pair<iter, bool>
auto channelInfoIter = mapId.insert({filePath, id});
id = channelInfoIter.first->second;

auto& chanelInfo = mapChannelInfo[id];
chanelInfo.sound = sound;
Expand Down
30 changes: 5 additions & 25 deletions cocos/math/CCGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,18 @@ NS_CC_BEGIN

// implementation of Size

Size::Size() : width(0), height(0)
Size::Size() : Size(0.0f, 0.0f)
{
}

Size::Size(float w, float h) : width(w), height(h)
{
}

Size::Size(const Size& other) : width(other.width), height(other.height)
{
}

Size::Size(const Vec2& point) : width(point.x), height(point.y)
{
}

Size& Size::operator= (const Size& other)
{
setSize(other.width, other.height);
return *this;
}

Size& Size::operator= (const Vec2& point)
{
setSize(point.x, point.y);
Expand Down Expand Up @@ -101,28 +91,18 @@ const Size Size::ZERO = Size(0, 0);
// implementation of Rect

Rect::Rect()
: Rect(0.0f, 0.0f, 0.0f, 0.0f)
{
setRect(0.0f, 0.0f, 0.0f, 0.0f);
}

Rect::Rect(float x, float y, float width, float height)
: origin(x, y), size(width, height)
{
setRect(x, y, width, height);
}
Rect::Rect(const Vec2& pos, const Size& dimension)
{
setRect(pos.x, pos.y, dimension.width, dimension.height);
}

Rect::Rect(const Rect& other)
{
setRect(other.origin.x, other.origin.y, other.size.width, other.size.height);
}

Rect& Rect::operator= (const Rect& other)
Rect::Rect(const Vec2& pos, const Size& dimension)
: origin(pos), size(dimension)
{
setRect(other.origin.x, other.origin.y, other.size.width, other.size.height);
return *this;
}

void Rect::setRect(float x, float y, float width, float height)
Expand Down
21 changes: 2 additions & 19 deletions cocos/math/CCGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CC_DLL Size
/**Height of the Size.*/
float height;
public:
/**Conversion from Vec2 to Size.*/
/**Conversion from Size to Vec2.*/
operator Vec2() const
{
return Vec2(width, height);
Expand All @@ -63,15 +63,9 @@ class CC_DLL Size
*/
Size();
Size(float width, float height);
Size(const Size& other);
explicit Size(const Vec2& point);
/**@}*/

/**
* @js NA
* @lua NA
*/
Size& operator= (const Size& other);
/**
* @js NA
* @lua NA
Expand Down Expand Up @@ -119,7 +113,7 @@ class CC_DLL Rect
/**Low left point of rect.*/
Vec2 origin;
/**Width and height of the rect.*/
Size size;
Size size;

public:
/**
Expand All @@ -138,17 +132,6 @@ class CC_DLL Rect
*/
Rect(const Vec2& pos, const Size& dimension);
/**
Copy constructor.
* @js NA
* @lua NA
*/
Rect(const Rect& other);
/**
* @js NA
* @lua NA
*/
Rect& operator= (const Rect& other);
/**
Set the x, y, width and height of Rect.
* @js NA
* @lua NA
Expand Down
2 changes: 1 addition & 1 deletion tools/cocos2d-console
Submodule cocos2d-console updated 0 files