Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into 2345 and fix the per premultipied tag

This commit is contained in:
boyu0 2013-07-30 11:10:05 +08:00
commit afde1e57b2
82 changed files with 1292 additions and 178 deletions

View File

@ -1,6 +1,91 @@
cocos2d-x-3.0alpha0-pre @Jul.24 2013
cocos2d-x-3.0alpha0-pre @Jul.30 2013
[all platforms]
Feature #XXXX: Add support for std::function<> in CCMemuItem and CCCallFunc
[FIX] #2124: Image::initWithImageFileThreadSafe is not thread safe
[FIX] #2230: Node::onEnterTransitionDidFinish was called twice when a node is added in Node::onEnter
[FIX] #2237: calculation offset in font rendering
[FIX] #2303: missing precision when getting strokeColor and fontFillColor
[FIX] #2312: WebSocket can not parse url like "ws://domain.com/websocket"
[FIX] #2327: implement Node::isScheduled
[FIX] #2338: ccbRootPath is not passed to sub ccb nodes
[FIX] #2346: OpenGL error 0x0502 in TextureAtlas::drawNumberOfQuads
[FIX] #2359: Sprite will become white block when using ControlSwitch
[FIX] #2361: some bug fixed of the Set class
[FIX] #2366: text shadow
[FIX] #2367: ClippingNode works differently on different platforms
[FIX] #2370: Pivotjoint constructor and pointQueryFirst in Space class will return false instead of invalid shape object
[FIX] #2381: ControlSwitch wasn't displayed correctly when adding more than one switch
[FIX] #2384: The submenu of ExtensionTest in TestCpp can't scroll
[FIX] #2386: ClippingNode works wrongly when being set as a child
[FIX] #2396: Scale9Sprite::setInsetLeft/XXX can't work for rotated sprite frame
[FIX] #2401: LabelBMFont crashes in glDrawElements of CCTextureAtlas::drawNumberOfQuads randombly
[FIX] #2410: Black screen appears on android randomly
[FIX] #2411: Opacity option for shadow in CCLabelTTF is not working
[FIX] #2406: Color and Opacity of Scale9Sprite will not be changed when it's added to NodeRGBA and run with FadeIn/Out actions
[FIX] #2415: Warning of AL_INVALID_NAME and AL_INVALID_OPERATION in SimpleAudioEngineOpenAL.cpp
[FIX] #2418: Unused spriteframes also need to be removed when purgeCachedData
[FIX] #2431: Potential crash when loading js files
[FIX] #2229: Explicitly initialising CCAcceleration structure
[FIX] #2234: Add destructor to CCGLBufferedNode
[Feature] #2232: adding Norwegian language support
[Feature] #2235: Ability to save/retrieve CCData into/from CCUserDefault
[Feature] #2250: add support for std::function<> in CCMemuItem and CCCallFunc
[Feature] #2273: Hardware keyboard support
[Feature] #2278: Adds CALLBACK_0, CALLBACK_1 and CALLBACK_2 macros for MenuItems
[Feature] #2279: Updates chipmunk2d to v6.1.5
[Feature] #2283: Adds Polish language support
[Feature] #2289: Uses clone() pattern for actions
[Feature] #2332: Adding project for QtCreator
[Feature] #2364: Adds DrawPrimitives::DrawSolidCircle
[Feature] #2365: Adds Rect::unionWithRect
[Feature] #2385: Implemented pitch, pan and gain for SimpleAudioEngine
[Feature] #2389: Adding cookie support for HttpClient
[Feature] #2392: Adds append() function for String class
[Feature] #2395: Adds Scale9SpriteTest for TestCpp
[Feature] #2399: Adds SocketIO support
[Feature] #2408: Adds String::componentsSeparatedByString function for splitting string
[Feature] #2414: Bindings-generator could bind std::function<> argument
[Refactor] #2129: Removes Hungarian notation from ivars. Removes CC and cc prefixes from name classes and free functions.
[Refactor] #2242: Enables c++11
[Refactor] #2300: Using clone() pattern instead of 'copyWithZone' pattern
[Refactor] #2305: Use std::thread instead of pthread
[Refactor] #2328: ETC support for all platforms
[Refactor] #2373: Change some member functions to const
[Refactor] #2378: Remove the usage of CC_PROPERTY_XXX in engine code
[Refactor] #2388: Creating a default texture for CCSprite if setTexture(nullptr) is invoked
[Refactor] #2397: Singleton refactor, sharedXXX --> getInstance, purgeXXX --> destroyInstance
[Refactor] #2404: Move all deprecated global functions and variables into CCDeprecated.h
[Refactor] #2430: Uses strongly typed enums (enum class) instead of simple enums
[iOS]
[FIX] #2274: compile and run for iOS7 and Xcode5
[Refactor] #2371: use one single Xcode project for iOS and Mac projects
[Android]
[FIX] #2306: CCLabelTTF::setString crash
[Refactor] #2329: use Android "asset manager" to improve file system read performance
[Refactor] #2400: use onWindowFocusChanged(bool) instead of onResume()/onPause()
[OS X]
[FIX] #2275: LabelTTF vertical alignment
[FIX] #2398: Add support for initializing Image with raw data
[windows]
[FIX] #2322: link error becasue of using multiply inheritance
[javascript binding]
[FIX] #2307: PhysicsSprite::getCPBody return wrong type
[FIX] #2313: bind cc.ClippingNode
[FIX] #2315: iterating through cc.Node children crash
[Feature] #2285: bind MontionStreak
[Feature] #2340: Updates SpiderMonekey to Firefox v22 (JS Bindings)
[Feature] #2427: bind FileUtils.getInstance().createDictionaryWithContentsOfFile
[lua binding]
[Feature] #2276: Add CCScrollView lua binding and corresponding test sample
[Feature] #2277: Add OpenGL lua binding and corresponding test sample
[Feature] #2324: Add OpenGL lua module
[Feature] #2343: Redesign the mechanism of invoking lua func from c++
[Feature] #2344: make some execute functions into one function in ScriptEngineProtocol
[Feature] #2426: Add DrawPrimitives test sample
[Feature] #2429: LuaWebSocket supports sending binary string
[plugin-x]
[FIX] #2348: event will not be sent to server when paramMap argument of logEvent function is nil
[Emscript]
[Feature] #2289: Asynchronous Image loading
2.1rc0-x-2.1.4 @Jnue.12 2013

View File

@ -0,0 +1,246 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
Copyright (c) 2013 Lee, Jae-Hong
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "OspPlayer.h"
using namespace Tizen::Media;
OspPlayer::OspPlayer()
: __pPlayer(null)
, m_nSoundID(0)
{
Initialize();
}
OspPlayer::~OspPlayer()
{
Close();
}
result
OspPlayer::Initialize()
{
result r = E_SUCCESS;
__pPlayer = new (std::nothrow) Player();
if (__pPlayer == null)
{
AppLogException("pPlyaer = new (std::nothrow) Player() has failed");
return E_FAILURE;
}
r = __pPlayer->Construct(*this, null);
if (IsFailed(r))
{
AppLog("pPlayer->Construct has failed\n");
return E_FAILURE;
}
return r;
}
void
OspPlayer::Open(const char* pFileName, unsigned int uId)
{
result r = E_SUCCESS;
Close();
r = __pPlayer->OpenFile(pFileName);
if (IsFailed(r))
{
AppLog("pPlayer->OpenFile has failed\n");
}
m_nSoundID = uId;
}
void
OspPlayer::Play(bool bLoop)
{
result r = E_SUCCESS;
r = __pPlayer->SetLooping(bLoop);
if (IsFailed(r))
{
AppLog("pPlayer->SetLooping has failed\n");
return;
}
r = __pPlayer->Play();
if (IsFailed(r))
{
AppLog("pPlayer->Play has failed\n");
}
}
void
OspPlayer::Pause()
{
result r = E_SUCCESS;
r = __pPlayer->Pause();
if (IsFailed(r))
{
AppLog("pPlayer->Pause has failed\n");
}
}
void
OspPlayer::Stop()
{
result r = E_SUCCESS;
r = __pPlayer->Stop();
if (IsFailed(r))
{
AppLog("pPlayer->Stop has failed\n");
}
}
void
OspPlayer::Resume()
{
result r = E_SUCCESS;
if (__pPlayer->GetState() == PLAYER_STATE_PAUSED)
{
r = __pPlayer->Play();
if (IsFailed(r))
{
AppLog("pPlayer->Play has failed\n");
}
}
}
void
OspPlayer::Rewind()
{
result r = E_SUCCESS;
r = __pPlayer->SeekTo(0);
if (IsFailed(r))
{
AppLog("pPlayer->SeekTo has failed\n");
}
}
bool
OspPlayer::IsPlaying()
{
PlayerState state = __pPlayer->GetState();
return (state == PLAYER_STATE_PLAYING) ? true : false;
}
void
OspPlayer::Close()
{
result r = E_SUCCESS;
if (__pPlayer->GetState() == PLAYER_STATE_PLAYING)
{
r = __pPlayer->Stop();
if (IsFailed(r))
{
AppLog("pPlayer->Stop has failed\n");
}
}
r = __pPlayer->Close();
if (IsFailed(r))
{
AppLog("pPlayer->Close has failed\n");
}
}
unsigned int
OspPlayer::GetSoundID()
{
return m_nSoundID;
}
void
OspPlayer::SetVolume(int volume)
{
result r = E_SUCCESS;
if (volume > 100 || volume < 0)
{
return;
}
r = __pPlayer->SetVolume(volume);
if (IsFailed(r))
{
AppLog("pPlayer->SetVolume has failed\n");
}
}
int
OspPlayer::GetVolume()
{
return __pPlayer->GetVolume();
}
void
OspPlayer::OnPlayerOpened(result r)
{
}
void
OspPlayer::OnPlayerEndOfClip(void)
{
}
void
OspPlayer::OnPlayerBuffering(int percent)
{
}
void
OspPlayer::OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r)
{
}
void
OspPlayer::OnPlayerInterrupted(void)
{
}
void
OspPlayer::OnPlayerReleased(void)
{
}
void
OspPlayer::OnPlayerSeekCompleted(result r)
{
}
void
OspPlayer::OnPlayerAudioFocusChanged(void)
{
}

View File

@ -0,0 +1,65 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
Copyright (c) 2013 Lee, Jae-Hong
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef _OSP_PLAYER_H_
#define _OSP_PLAYER_H_
#include <FMedia.h>
class OspPlayer : public Tizen::Media::IPlayerEventListener
{
public:
OspPlayer();
~OspPlayer();
result Initialize();
void Open(const char* pFileName, unsigned int uId);
void Play(bool bLoop);
void Pause();
void Stop();
void Resume();
void Rewind();
bool IsPlaying();
void SetVolume(int volume);
int GetVolume();
void Close();
unsigned int GetSoundID();
protected:
void OnPlayerOpened(result r);
void OnPlayerEndOfClip(void);
void OnPlayerBuffering(int percent);
void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r);
void OnPlayerInterrupted(void);
void OnPlayerReleased(void);
void OnPlayerSeekCompleted(result r);
void OnPlayerAudioFocusChanged(void);
private:
Tizen::Media::Player* __pPlayer;
unsigned int m_nSoundID;
};
#endif // _OSP_PLAYER_H_

View File

@ -0,0 +1,295 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
Copyright (c) 2013 Lee, Jae-Hong
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "SimpleAudioEngine.h"
#include "OspPlayer.h"
#include "cocos2d.h"
#include <map>
USING_NS_CC;
using namespace std;
namespace CocosDenshion {
typedef map<unsigned int, OspPlayer *> EffectList;
typedef pair<unsigned int, OspPlayer *> Effect;
static std::string _FullPath(const char * szPath);
static unsigned int _Hash(const char *key);
#define BREAK_IF(cond) if (cond) break;
static EffectList& sharedList()
{
static EffectList s_List;
return s_List;
}
static OspPlayer& sharedMusic()
{
static OspPlayer s_Music;
return s_Music;
}
SimpleAudioEngine::SimpleAudioEngine()
{
}
SimpleAudioEngine::~SimpleAudioEngine()
{
}
SimpleAudioEngine* SimpleAudioEngine::getInstance()
{
static SimpleAudioEngine s_SharedEngine;
return &s_SharedEngine;
}
void SimpleAudioEngine::end()
{
sharedMusic().Close();
EffectList::iterator p = sharedList().begin();
while (p != sharedList().end())
{
delete p->second;
p->second = NULL;
p++;
}
sharedList().clear();
}
void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath)
{
}
void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop)
{
if (!pszFilePath)
{
return;
}
sharedMusic().Open(_FullPath(pszFilePath).c_str(), _Hash(pszFilePath));
sharedMusic().Play(bLoop);
}
void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData)
{
if (bReleaseData)
{
sharedMusic().Close();
}
else
{
sharedMusic().Stop();
}
}
void SimpleAudioEngine::pauseBackgroundMusic()
{
sharedMusic().Pause();
}
void SimpleAudioEngine::resumeBackgroundMusic()
{
sharedMusic().Resume();
}
void SimpleAudioEngine::rewindBackgroundMusic()
{
sharedMusic().Rewind();
}
bool SimpleAudioEngine::willPlayBackgroundMusic()
{
return false;
}
bool SimpleAudioEngine::isBackgroundMusicPlaying()
{
return sharedMusic().IsPlaying();
}
float SimpleAudioEngine::getBackgroundMusicVolume()
{
return float(sharedMusic().GetVolume()) / 100.f;
}
void SimpleAudioEngine::setBackgroundMusicVolume(float volume)
{
sharedMusic().SetVolume(int(volume * 100));
}
float SimpleAudioEngine::getEffectsVolume()
{
EffectList::iterator iter;
iter = sharedList().begin();
if (iter != sharedList().end())
{
return float(iter->second->GetVolume()) / 100.f;
}
return 0.0f;
}
void SimpleAudioEngine::setEffectsVolume(float volume)
{
EffectList::iterator iter;
for (iter = sharedList().begin(); iter != sharedList().end(); iter++)
{
iter->second->SetVolume(int(volume * 100));
}
}
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop/* = false*/,
float pitch/* = 1.0f*/, float pan/* = 0.0f*/, float gain/* = 1.0f*/)
{
unsigned int nRet = _Hash(pszFilePath);
preloadEffect(pszFilePath);
EffectList::iterator p = sharedList().find(nRet);
if (p != sharedList().end())
{
p->second->Play(bLoop);
}
return nRet;
}
void SimpleAudioEngine::stopEffect(unsigned int nSoundId)
{
EffectList::iterator p = sharedList().find(nSoundId);
if (p != sharedList().end())
{
p->second->Stop();
}
}
void SimpleAudioEngine::preloadEffect(const char* pszFilePath)
{
int nRet = 0;
do
{
BREAK_IF(! pszFilePath);
nRet = _Hash(pszFilePath);
BREAK_IF(sharedList().end() != sharedList().find(nRet));
sharedList().insert(Effect(nRet, new (std::nothrow) OspPlayer()));
OspPlayer * pPlayer = sharedList()[nRet];
pPlayer->Open(_FullPath(pszFilePath).c_str(), nRet);
BREAK_IF(nRet == pPlayer->GetSoundID());
sharedList().erase(nRet);
nRet = 0;
}
while (0);
}
void SimpleAudioEngine::unloadEffect(const char* pszFilePath)
{
unsigned nId = _Hash(pszFilePath);
EffectList::iterator p = sharedList().find(nId);
if (p != sharedList().end())
{
delete p->second;
p->second = NULL;
sharedList().erase(nId);
}
}
void SimpleAudioEngine::pauseEffect(unsigned int nSoundId)
{
EffectList::iterator p = sharedList().find(nSoundId);
if (p != sharedList().end())
{
p->second->Pause();
}
}
void SimpleAudioEngine::pauseAllEffects()
{
EffectList::iterator iter;
for (iter = sharedList().begin(); iter != sharedList().end(); iter++)
{
iter->second->Pause();
}
}
void SimpleAudioEngine::resumeEffect(unsigned int nSoundId)
{
EffectList::iterator p = sharedList().find(nSoundId);
if (p != sharedList().end())
{
p->second->Resume();
}
}
void SimpleAudioEngine::resumeAllEffects()
{
EffectList::iterator iter;
for (iter = sharedList().begin(); iter != sharedList().end(); iter++)
{
iter->second->Resume();
}
}
void SimpleAudioEngine::stopAllEffects()
{
EffectList::iterator iter;
for (iter = sharedList().begin(); iter != sharedList().end(); iter++)
{
iter->second->Stop();
}
}
//////////////////////////////////////////////////////////////////////////
// static function
//////////////////////////////////////////////////////////////////////////
static std::string _FullPath(const char * szPath)
{
return CCFileUtils::getInstance()->fullPathForFilename(szPath);
}
unsigned int _Hash(const char *key)
{
unsigned int len = strlen(key);
const char *end=key+len;
unsigned int hash;
for (hash = 0; key < end; key++)
{
hash *= 16777619;
hash ^= (unsigned int) (unsigned char) toupper(*key);
}
return (hash);
}
}

View File

@ -1273,7 +1273,7 @@ void JumpTo::startWithTarget(Node *target)
// Bezier cubic formula:
// ((1 - t) + t)3 = 1
// Expands to¡­
// Expands to ...
// (1 - t)3 + 3t(1-t)2 + 3t2(1 - t) + t3 = 1
static inline float bezierat( float a, float b, float c, float d, float t )
{
@ -1987,11 +1987,11 @@ Animate* Animate::create(Animation *pAnimation)
}
Animate::Animate()
: _animation(NULL)
, _splitTimes(new std::vector<float>)
: _splitTimes(new std::vector<float>)
, _nextFrame(0)
, _origFrame(NULL)
, _executedLoops(0)
, _animation(NULL)
{
}
@ -2155,8 +2155,8 @@ Animate* Animate::reverse() const
// TargetedAction
TargetedAction::TargetedAction()
: _forcedTarget(NULL)
, _action(NULL)
: _action(NULL)
, _forcedTarget(NULL)
{
}

View File

@ -64,6 +64,11 @@ Node::Node(void)
, _anchorPoint(Point::ZERO)
, _contentSize(Size::ZERO)
, _additionalTransform(AffineTransformMakeIdentity())
, _transform(AffineTransformMakeIdentity())
, _inverse(AffineTransformMakeIdentity())
, _additionalTransformDirty(false)
, _transformDirty(true)
, _inverseDirty(true)
, _camera(NULL)
// children (lazy allocs)
// lazy alloc
@ -79,9 +84,6 @@ Node::Node(void)
, _shaderProgram(NULL)
, _orderOfArrival(0)
, _running(false)
, _transformDirty(true)
, _inverseDirty(true)
, _additionalTransformDirty(false)
, _visible(true)
, _ignoreAnchorPointForPosition(false)
, _reorderChildDirty(false)

View File

@ -412,8 +412,8 @@ public:
: _fontSize(0)
, _alignment(Label::HAlignment::CENTER)
, _vertAlignment(Label::VAlignment::TOP)
, _dimensions(Size::ZERO)
, _fontFillColor(Color3B::WHITE)
, _dimensions(Size::ZERO)
{}
// font name

View File

@ -128,8 +128,8 @@ public:
static MenuItemLabel* create(Node *label);
MenuItemLabel()
: _label(NULL)
, _originalScale(0.0)
: _originalScale(0.0)
, _label(NULL)
{}
virtual ~MenuItemLabel();

View File

@ -37,6 +37,7 @@ MotionStreak::MotionStreak()
: _fastMode(false)
, _startingPositionInitialized(false)
, _texture(NULL)
, _blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED)
, _positionR(Point::ZERO)
, _stroke(0.0f)
, _fadeDelta(0.0f)
@ -49,7 +50,6 @@ MotionStreak::MotionStreak()
, _vertices(NULL)
, _colorPointer(NULL)
, _texCoords(NULL)
, _blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED)
{
}

View File

@ -46,12 +46,12 @@ const char kProgressTextureCoords = 0x4b;
ProgressTimer::ProgressTimer()
:_type(Type::RADIAL)
,_midpoint(0,0)
,_barChangeRate(0,0)
,_percentage(0.0f)
,_sprite(NULL)
,_vertexDataCount(0)
,_vertexData(NULL)
,_midpoint(0,0)
,_barChangeRate(0,0)
,_reverseDirection(false)
{}

View File

@ -44,8 +44,7 @@ NS_CC_BEGIN
// implementation RenderTexture
RenderTexture::RenderTexture()
: _sprite(NULL)
, _FBO(0)
: _FBO(0)
, _depthRenderBufffer(0)
, _oldFBO(0)
, _texture(0)
@ -57,6 +56,7 @@ RenderTexture::RenderTexture()
, _clearDepth(0.0f)
, _clearStencil(0)
, _autoDraw(false)
, _sprite(NULL)
{
#if CC_ENABLE_CACHE_TEXTURE_DATA
// Listen this event to save render texture before come to background.

View File

@ -81,7 +81,9 @@ NS_CC_BEGIN
//
ParticleSystem::ParticleSystem()
: _plistFile("")
: _isBlendAdditive(false)
, _isAutoRemoveOnFinish(false)
, _plistFile("")
, _elapsed(0)
, _particles(NULL)
, _emitCounter(0)
@ -99,6 +101,7 @@ ParticleSystem::ParticleSystem()
, _lifeVar(0)
, _angle(0)
, _angleVar(0)
, _emitterMode(Mode::GRAVITY)
, _startSize(0)
, _startSizeVar(0)
, _endSize(0)
@ -110,12 +113,9 @@ ParticleSystem::ParticleSystem()
, _emissionRate(0)
, _totalParticles(0)
, _texture(NULL)
, _opacityModifyRGB(false)
, _isBlendAdditive(false)
, _positionType(PositionType::FREE)
, _isAutoRemoveOnFinish(false)
, _emitterMode(Mode::GRAVITY)
, _blendFunc(BlendFunc::ALPHA_PREMULTIPLIED)
, _opacityModifyRGB(false)
, _positionType(PositionType::FREE)
{
modeA.gravity = Point::ZERO;
modeA.speed = 0;

View File

@ -174,11 +174,12 @@ public:
inline int getHeight() { return _height; }
inline bool isPremultipliedAlpha() { return _preMulti; }
inline int getNumberOfMipmaps() { return _numberOfMipmaps; }
inline MipmapInfo* getMipmaps() { return _mipmaps; }
inline MipmapInfo* getMipmaps() { return _mipmaps; }
inline bool hasPremultipliedAlpha() { return _hasPremultipliedAlpha; }
int getBitPerPixel();
bool hasAlpha();
bool isCompressed();
int getBitPerPixel();
bool hasAlpha();
bool isCompressed();
/**
@ -214,6 +215,8 @@ protected:
bool _preMulti;
MipmapInfo _mipmaps[CC_MIPMAP_MAX]; // pointer to mipmap images
int _numberOfMipmaps;
// false if we cann't auto detect the image is premultiplied or not.
bool _hasPremultipliedAlpha;
private:

View File

@ -242,6 +242,7 @@ Image::Image()
, _fileType(Format::UNKOWN)
, _renderFormat(Texture2D::PixelFormat::NONE)
, _preMulti(false)
, _hasPremultipliedAlpha(true)
, _numberOfMipmaps(0)
{
@ -954,6 +955,7 @@ bool Image::initWithPVRv2Data(void *data, int dataLen)
Configuration *configuration = Configuration::getInstance();
_hasPremultipliedAlpha = false;
flags = CC_SWAP_INT32_LITTLE_TO_HOST(header->flags);
formatFlags = flags & PVR_TEXTURE_FLAG_TYPE_MASK;
bool flipped = (flags & kPVR2TextureFlagVerticalFlip) ? true : false;

View File

@ -51,7 +51,7 @@ void log(const char * pszFormat, ...)
vsnprintf(buf, MAX_LEN, pszFormat, args);
va_end(args);
__android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf);
__android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf);
}
void MessageBox(const char * pszMsg, const char * pszTitle)

View File

@ -284,7 +284,7 @@ bool Image::initWithString(
const char * pText,
int nWidth/* = 0*/,
int nHeight/* = 0*/,
TextAlign eAlignMask/* = kAlignCenter*/,
TextAlign eAlignMask/* = kAlignCenter*/,
const char * pFontName/* = nil*/,
int nSize/* = 0*/)
{

View File

@ -244,7 +244,7 @@ public:
int lineWidth = textLines.at(line).lineWidth;
if (eAlignMask == Image::TextAlign::CENTER || eAlignMask == Image::TextAlign::TOP || eAlignMask == Image::TextAlign::BOTTOM) {
return (iMaxLineWidth - lineWidth) / 2;
} else if (eAlignMask == Image::TextAlign::RIGHT || eAlignMask == Image::TextAlign::TO_RIGHT || eAlignMask == Image::TextAlign::BOTTOM_RIGHT) {
} else if (eAlignMask == Image::TextAlign::RIGHT || eAlignMask == Image::TextAlign::TOP_RIGHT || eAlignMask == Image::TextAlign::BOTTOM_RIGHT) {
return (iMaxLineWidth - lineWidth);
}
@ -428,7 +428,7 @@ bool Image::initWithString(
const char * pText,
int nWidth/* = 0*/,
int nHeight/* = 0*/,
ETextAlign eAlignMask/* = kAlignCenter*/,
TextAlign eAlignMask/* = kAlignCenter*/,
const char * pFontName/* = nil*/,
int nSize/* = 0*/)
{

View File

@ -43,6 +43,36 @@ static void _checkPath()
}
}
// D:/aaa/bbb/ccc/ddd/abc.txt --> D:\aaa\bbb\ccc\ddd\abc.txt
static inline std::string convertPathFormatToWindowStyle(const std::string& path)
{
std::string ret = path;
int len = ret.length();
for (int i = 0; i < len; ++i)
{
if (ret[i] == '/')
{
ret[i] = '\\';
}
}
return ret;
}
// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt
static inline std::string convertPathFormatToUnixStyle(const std::string& path)
{
std::string ret = path;
int len = ret.length();
for (int i = 0; i < len; ++i)
{
if (ret[i] == '\\')
{
ret[i] = '/';
}
}
return ret;
}
FileUtils* FileUtils::getInstance()
{
if (s_sharedFileUtils == NULL)
@ -81,7 +111,12 @@ bool FileUtilsWin32::isFileExist(const std::string& strFilePath)
{ // Not absolute path, add the default root path at the beginning.
strPath.insert(0, _defaultResRootPath);
}
return GetFileAttributesA(strPath.c_str()) != -1 ? true : false;
convertPathFormatToWindowStyle(strPath);
WCHAR wszBuf[MAX_PATH] = {0};
MultiByteToWideChar(CP_UTF8, 0, strPath.c_str(), -1, wszBuf, sizeof(wszBuf));
return GetFileAttributesW(wszBuf) != -1 ? true : false;
}
bool FileUtilsWin32::isAbsolutePath(const std::string& strPath)
@ -95,6 +130,68 @@ bool FileUtilsWin32::isAbsolutePath(const std::string& strPath)
return false;
}
unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, unsigned long* size)
{
unsigned char * pBuffer = NULL;
CCASSERT(filename != NULL && size != NULL && mode != NULL, "Invalid parameters.");
*size = 0;
do
{
// read the file from hardware
std::string fullPath = fullPathForFilename(filename);
WCHAR wszBuf[MAX_PATH] = {0};
MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf));
HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, NULL);
CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE);
*size = ::GetFileSize(fileHandle, NULL);
pBuffer = new unsigned char[*size];
DWORD sizeRead = 0;
BOOL successed = FALSE;
successed = ::ReadFile(fileHandle, pBuffer, *size, &sizeRead, NULL);
::CloseHandle(fileHandle);
if (!successed)
{
CC_SAFE_DELETE_ARRAY(pBuffer);
}
} while (0);
if (! pBuffer)
{
std::string msg = "Get data from file(";
// Gets error code.
DWORD errorCode = ::GetLastError();
char errorCodeBuffer[20] = {0};
snprintf(errorCodeBuffer, sizeof(errorCodeBuffer), "%d", errorCode);
msg = msg + filename + ") failed, error code is " + errorCodeBuffer;
CCLOG("%s", msg.c_str());
}
return pBuffer;
}
std::string FileUtilsWin32::getPathForFilename(const std::string& filename, const std::string& resolutionDirectory, const std::string& searchPath)
{
std::string unixFileName = convertPathFormatToUnixStyle(filename);
std::string unixResolutionDirector = convertPathFormatToUnixStyle(resolutionDirectory);
std::string unixSearchPath = convertPathFormatToUnixStyle(searchPath);
return FileUtils::getPathForFilename(unixFileName, unixResolutionDirector, unixSearchPath);
}
std::string FileUtilsWin32::getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename)
{
std::string dosDirectory = convertPathFormatToWindowStyle(strDirectory);
std::string dosFilename = convertPathFormatToWindowStyle(strFilename);
return FileUtils::getFullPathForDirectoryAndFilename(dosDirectory, dosFilename);
}
string FileUtilsWin32::getWritablePath()
{
// Get full path of executable, e.g. c:\Program Files (x86)\My Game Folder\MyGame.exe

View File

@ -49,6 +49,39 @@ public:
virtual std::string getWritablePath();
virtual bool isFileExist(const std::string& strFilePath);
virtual bool isAbsolutePath(const std::string& strPath);
protected:
/**
* Gets resource file data
*
* @param[in] filename The resource file name which contains the path.
* @param[in] pszMode The read mode of the file.
* @param[out] pSize If the file read operation succeeds, it will be the data size, otherwise 0.
* @return Upon success, a pointer to the data is returned, otherwise NULL.
* @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
*/
virtual unsigned char* getFileData(const char* filename, const char* mode, unsigned long * size) override;
/**
* Gets full path for filename, resolution directory and search path.
*
* @param filename The file name.
* @param resolutionDirectory The resolution directory.
* @param searchPath The search path.
* @return The full path of the file. It will return an empty string if the full path of the file doesn't exist.
*/
virtual std::string getPathForFilename(const std::string& filename, const std::string& resolutionDirectory, const std::string& searchPath) override;
/**
* Gets full path for the directory and the filename.
*
* @note Only iOS and Mac need to override this method since they are using
* `[[NSBundle mainBundle] pathForResource: ofType: inDirectory:]` to make a full path.
* Other platforms will use the default implementation of this method.
* @param strDirectory The directory contains the file we are looking for.
* @param strFilename The name of the file.
* @return The full path of the file, if the file can't be found, it will return an empty string.
*/
virtual std::string getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) override;
};
// end of platform group

View File

@ -66,7 +66,6 @@ SOURCES = ../actions/CCAction.cpp \
../particle_nodes/CCParticleBatchNode.cpp \
../platform/CCSAXParser.cpp \
../platform/CCThread.cpp \
../platform/platform.cpp \
../platform/CCImageCommonWebp.cpp \
../platform/CCEGLViewProtocol.cpp \
../platform/CCFileUtils.cpp \

View File

@ -7,8 +7,11 @@
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?children?</key>
<value>?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\||</value>
</dictionary>
<dictionary>
<key>?name?</key>
<value></value>
@ -31,7 +34,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/cocos2dx/Debug-Tizen-Device}</value>
<value>${workspace_loc:/cocos2dx/Debug-Tizen-Emulator}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
@ -43,7 +46,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
@ -347,16 +350,6 @@
<type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/platform/CCThread.h</locationURI>
</link>
<link>
<name>src/platform/platform.cpp</name>
<type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/platform/platform.cpp</locationURI>
</link>
<link>
<name>src/platform/platform.h</name>
<type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/platform/platform.h</locationURI>
</link>
<link>
<name>src/platform/tizen</name>
<type>2</type>

View File

@ -55,8 +55,7 @@ NS_CC_BEGIN
// Default is: RGBA8888 (32-bit textures)
static Texture2D::PixelFormat g_defaultAlphaPixelFormat = Texture2D::PixelFormat::DEFAULT;
// By default PVR images are treated as if they don't have the alpha channel premultiplied
static bool PVRHaveAlphaPremultiplied_ = false;
static bool _PVRHaveAlphaPremultiplied = false;
//////////////////////////////////////////////////////////////////////////
//conventer function
@ -349,10 +348,9 @@ void Texture2D::convertRGBA8888ToRGB5A1(const unsigned char* in, int len, unsign
//////////////////////////////////////////////////////////////////////////
Texture2D::Texture2D()
: _PVRHaveAlphaPremultiplied(true)
: _pixelFormat(Texture2D::PixelFormat::DEFAULT)
, _pixelsWide(0)
, _pixelsHigh(0)
, _pixelFormat(Texture2D::PixelFormat::NONE)
, _name(0)
, _maxS(0.0)
, _maxT(0.0)
@ -679,7 +677,21 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format)
delete [] outTempData;
}
_hasPremultipliedAlpha = image->isPremultipliedAlpha();
// set the premultiplied tag
if (!image->hasPremultipliedAlpha())
{
if (image->getFileType() == Image::Format::PVR)
{
_hasPremultipliedAlpha = _PVRHaveAlphaPremultiplied;
}else
{
CCLOG("wanning: We cann't find the data is premultiplied or not, we will assume it's false.");
_hasPremultipliedAlpha = false;
}
}else
{
_hasPremultipliedAlpha = image->isPremultipliedAlpha();
}
return true;
}
}
@ -1142,7 +1154,7 @@ void Texture2D::drawInRect(const Rect& rect)
void Texture2D::PVRImagesHavePremultipliedAlpha(bool haveAlphaPremultiplied)
{
PVRHaveAlphaPremultiplied_ = haveAlphaPremultiplied;
_PVRHaveAlphaPremultiplied = haveAlphaPremultiplied;
}

View File

@ -336,7 +336,7 @@ private:
static void convertRGBA8888ToRGB5A1(const unsigned char* in, int len, unsigned char* out);
// By default PVR images are treated as if they don't have the alpha channel premultiplied
bool _PVRHaveAlphaPremultiplied;
static bool _PVRHaveAlphaPremultiplied;
protected:
/** pixel format of the texture */

View File

@ -98,14 +98,21 @@ bool TMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *la
}
TMXLayer::TMXLayer()
:_layerSize(Size::ZERO)
:_layerName("")
,_opacity(0)
,_minGID(0)
,_maxGID(0)
,_vertexZvalue(0)
,_useAutomaticVertexZ(false)
,_reusedTile(NULL)
,_atlasIndexArray(NULL)
,_contentScaleFactor(1.0f)
,_layerSize(Size::ZERO)
,_mapTileSize(Size::ZERO)
,_tiles(NULL)
,_tileSet(NULL)
,_layerOrientation(TMXOrientationOrtho)
,_properties(NULL)
,_layerName("")
,_reusedTile(NULL)
,_atlasIndexArray(NULL)
{}
TMXLayer::~TMXLayer()

View File

@ -32,8 +32,8 @@ NS_CC_BEGIN
//implementation TMXObjectGroup
TMXObjectGroup::TMXObjectGroup()
:_positionOffset(Point::ZERO)
,_groupName("")
: _groupName("")
, _positionOffset(Point::ZERO)
{
_objects = Array::create();
_objects->retain();

View File

@ -65,9 +65,9 @@ bool TileMapAtlas::initWithTileFile(const char *tile, const char *mapFile, int t
}
TileMapAtlas::TileMapAtlas()
:_TGAInfo(NULL)
,_posToAtlasIndex(NULL)
,_itemsToRender(0)
: _posToAtlasIndex(NULL)
, _itemsToRender(0)
, _TGAInfo(NULL)
{
}

View File

@ -41,7 +41,7 @@ public:
class ContactListener : public b2ContactListener
{
//! Callbacks for derived classes.
virtual void BeginContact(b2Contact *contact)
virtual void BeginContact(b2Contact *contact) override
{
if (contact)
{
@ -53,17 +53,17 @@ class ContactListener : public b2ContactListener
}
B2_NOT_USED(contact);
}
virtual void EndContact(b2Contact *contact)
virtual void EndContact(b2Contact *contact) override
{
contact_list.clear();
B2_NOT_USED(contact);
}
virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold)
virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold) override
{
B2_NOT_USED(contact);
B2_NOT_USED(oldManifold);
}
virtual void PostSolve(const b2Contact *contact, const b2ContactImpulse *impulse)
virtual void PostSolve(b2Contact *contact, const b2ContactImpulse *impulse) override
{
B2_NOT_USED(contact);
B2_NOT_USED(impulse);

View File

@ -17,7 +17,9 @@ NS_CC_EXT_BEGIN
// Implementation of CCBAinmationManager
CCBAnimationManager::CCBAnimationManager()
: _sequences(NULL)
: _jsControlled(false)
, _owner(NULL)
, _sequences(NULL)
, _nodeSequences(NULL)
, _baseValues(NULL)
, _autoPlaySequenceId(0)
@ -25,8 +27,7 @@ CCBAnimationManager::CCBAnimationManager()
, _rootContainerSize(Size::ZERO)
, _delegate(NULL)
, _runningSequence(NULL)
, _jsControlled(false)
, _owner(NULL)
{
init();
}

View File

@ -37,13 +37,13 @@
NS_CC_EXT_BEGIN
Control::Control()
: _isOpacityModifyRGB(false)
, _state(State::NORMAL)
, _hasVisibleParents(false)
, _enabled(false)
: _enabled(false)
, _selected(false)
, _highlighted(false)
, _hasVisibleParents(false)
, _dispatchTable(NULL)
, _isOpacityModifyRGB(false)
, _state(State::NORMAL)
{
}

View File

@ -42,14 +42,14 @@ enum
};
ControlButton::ControlButton()
: _currentTitle(NULL)
, _currentTitleColor(Color3B::WHITE)
: _isPushed(false)
, _parentInited(false)
, _doesAdjustBackgroundImage(false)
, _currentTitle(NULL)
, _currentTitleColor(Color3B::WHITE)
, _titleLabel(NULL)
, _backgroundSprite(NULL)
, _zoomOnTouchDown(false)
, _isPushed(false)
, _parentInited(false)
, _titleDispatchTable(NULL)
, _titleColorDispatchTable(NULL)
, _titleLabelDispatchTable(NULL)

View File

@ -31,11 +31,11 @@
NS_CC_EXT_BEGIN
ControlPotentiometer::ControlPotentiometer()
: _thumbSprite(NULL)
, _progressTimer(NULL)
, _value(0.0f)
: _value(0.0f)
, _minimumValue(0.0f)
, _maximumValue(0.0f)
, _thumbSprite(NULL)
, _progressTimer(NULL)
{
}

View File

@ -39,11 +39,7 @@ NS_CC_EXT_BEGIN
#define kAutorepeatIncreaseTimeIncrement 12
ControlStepper::ControlStepper()
: _minusSprite(NULL)
, _plusSprite(NULL)
, _minusLabel(NULL)
, _plusLabel(NULL)
, _value(0.0)
: _value(0.0)
, _continuous(false)
, _autorepeat(false)
, _wraps(false)
@ -53,6 +49,10 @@ ControlStepper::ControlStepper()
, _touchInsideFlag(false)
, _touchedPart(Part::NONE)
, _autorepeatCount(0)
, _minusSprite(NULL)
, _plusSprite(NULL)
, _minusLabel(NULL)
, _plusLabel(NULL)
{
}

View File

@ -43,11 +43,7 @@ enum positions
};
Scale9Sprite::Scale9Sprite()
: _insetLeft(0)
, _insetTop(0)
, _insetRight(0)
, _insetBottom(0)
, _spritesGenerated(false)
: _spritesGenerated(false)
, _spriteFrameRotated(false)
, _positionsAreDirty(false)
, _scale9Image(NULL)
@ -61,6 +57,10 @@ Scale9Sprite::Scale9Sprite()
, _bottom(NULL)
, _bottomRight(NULL)
, _opacityModifyRGB(false)
, _insetLeft(0)
, _insetTop(0)
, _insetRight(0)
, _insetBottom(0)
{
}

View File

@ -257,8 +257,8 @@ EditBoxImplIOS::EditBoxImplIOS(EditBox* pEditText)
: EditBoxImpl(pEditText)
, _label(NULL)
, _labelPlaceHolder(NULL)
, _systemControl(NULL)
, _anchorPoint(Point(0.5f, 0.5f))
, _systemControl(NULL)
, _maxTextLength(-1)
{
_inRetinaMode = [[CCEAGLView sharedEGLView] contentScaleFactor] == 2.0f ? true : false;

View File

@ -234,8 +234,10 @@ EditBoxImpl* __createSystemEditBox(EditBox* pEditBox)
}
EditBoxImplMac::EditBoxImplMac(EditBox* pEditText)
: EditBoxImpl(pEditText), _sysEdit(NULL), _maxTextLength(-1)
: EditBoxImpl(pEditText)
, _anchorPoint(Point(0.5f, 0.5f))
, _maxTextLength(-1)
, _sysEdit(NULL)
{
//! TODO: Retina on Mac
//! _inRetinaMode = [[CCEAGLView sharedEGLView] contentScaleFactor] == 2.0f ? true : false;

View File

@ -46,7 +46,7 @@ EditBoxImplTizen::EditBoxImplTizen(EditBox* pEditText)
, _labelPlaceHolder(NULL)
, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE)
, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS)
, _keyboardReturnType(kKeyboardReturnTypeDefault)
, _keyboardReturnType(EditBox::KeyboardReturnType::DEFAULT)
, _colText(Color3B::WHITE)
, _colPlaceHolder(Color3B::GRAY)
, _maxLength(-1)
@ -65,7 +65,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
bool EditBoxImplTizen::initWithSize(const Size& size)
{
int fontSize = (int)size.height-12;
// int fontSize = (int)size.height-12;
_label = LabelTTF::create("", "", size.height-12);
// align the text vertically center
_label->setAnchorPoint(Point(0, 0.5f));
@ -160,7 +160,7 @@ void EditBoxImplTizen::setText(const char* pText)
std::string strToShow;
if (kEditBoxInputFlagPassword == _editBoxInputFlag)
if (EditBox::InputFlag::PASSWORD == _editBoxInputFlag)
{
long length = cc_utf8_strlen(_text.c_str(), -1);
for (long i = 0; i < length; i++)
@ -284,21 +284,21 @@ void EditBoxImplTizen::openKeyboard()
bool bSingleLineEnabled = false;
switch (_editBoxInputMode)
{
case kEditBoxInputModeAny:
case EditBox::InputMode::ANY:
keypadStyle = KEYPAD_STYLE_NORMAL;
break;
case kEditBoxInputModeEmailAddr:
case EditBox::InputMode::EMAIL_ADDRESS:
keypadStyle = KEYPAD_STYLE_EMAIL;
break;
case kEditBoxInputModeNumeric:
case kEditBoxInputModeDecimal:
case EditBox::InputMode::NUMERIC:
case EditBox::InputMode::DECIMAL:
keypadStyle = KEYPAD_STYLE_NUMBER;
keypadCategory = KEYPAD_MODE_NUMERIC;
break;
case kEditBoxInputModePhoneNumber:
case EditBox::InputMode::PHONE_NUMBER:
keypadStyle = KEYPAD_STYLE_PHONE_NUMBER;
break;
case kEditBoxInputModeUrl:
case EditBox::InputMode::URL:
keypadStyle = KEYPAD_STYLE_URL;
break;
case EditBox::InputMode::SINGLE_LINE:
@ -312,10 +312,10 @@ void EditBoxImplTizen::openKeyboard()
bool bTextPrediction = true;
switch (_editBoxInputFlag)
{
case kEditBoxInputFlagPassword:
case EditBox::InputFlag::PASSWORD:
keypadStyle = KEYPAD_STYLE_PASSWORD;
break;
case kEditBoxInputFlagSensitive:
case EditBox::InputFlag::SENSITIVE:
bTextPrediction = false;
break;
default:

View File

@ -490,11 +490,11 @@ void SIOClientImpl::onError(cocos2d::extension::WebSocket* ws, const cocos2d::ex
//begin SIOClient methods
SIOClient::SIOClient(const std::string& host, int port, const std::string& path, SIOClientImpl* impl, SocketIO::SIODelegate& delegate)
: _host(host)
, _port(port)
: _port(port)
, _host(host)
, _path(path)
, _connected(false)
, _socket(impl)
, _connected(false)
, _delegate(&delegate)
{

View File

@ -88,7 +88,7 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \
../CCArmature/utils/CCTransformHelp.cpp \
../CCArmature/utils/CCTweenFunction.cpp \
../CCArmature/utils/CCUtilMath.cpp \
../CCDprecated-ext.cpp
../CCDeprecated-ext.cpp
include $(COCOS_ROOT)/cocos2dx/proj.emscripten/cocos2dx.mk

View File

@ -7,7 +7,6 @@
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
@ -31,7 +30,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/chipmunk/Debug-Tizen-Device}</value>
<value>${workspace_loc:/chipmunk/Debug-Tizen-Emulator}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
@ -43,7 +42,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>

View File

@ -742,10 +742,18 @@ JSBool js_pluginx_protocols_ProtocolAds_showAds(JSContext *cx, uint32_t argc, js
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TAdsInfo arg0;
ok &= jsval_to_TAdsInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->showAds(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
if (argc == 2) {
TAdsInfo arg0;
cocos2d::plugin::ProtocolAds::AdsPos arg1;
#pragma warning NO CONVERSION TO NATIVE FOR TAdsInfo;
ok &= jsval_to_TAdsInfo(cx, argv[0], &arg0);
ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->showAds(arg0, arg1);
@ -753,7 +761,7 @@ JSBool js_pluginx_protocols_ProtocolAds_showAds(JSContext *cx, uint32_t argc, js
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return JS_FALSE;
}
JSBool js_pluginx_protocols_ProtocolAds_hideAds(JSContext *cx, uint32_t argc, jsval *vp)
@ -766,7 +774,7 @@ JSBool js_pluginx_protocols_ProtocolAds_hideAds(JSContext *cx, uint32_t argc, js
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TAdsInfo arg0;
#pragma warning NO CONVERSION TO NATIVE FOR TAdsInfo;
ok &= jsval_to_TAdsInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->hideAds(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
@ -893,7 +901,7 @@ void js_register_pluginx_protocols_ProtocolAds(JSContext *cx, JSObject *global)
};
static JSFunctionSpec funcs[] = {
JS_FN("showAds", js_pluginx_protocols_ProtocolAds_showAds, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("showAds", js_pluginx_protocols_ProtocolAds_showAds, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("hideAds", js_pluginx_protocols_ProtocolAds_hideAds, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("queryPoints", js_pluginx_protocols_ProtocolAds_queryPoints, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("spendPoints", js_pluginx_protocols_ProtocolAds_spendPoints, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -1143,7 +1151,7 @@ JSBool js_pluginx_protocols_ProtocolSocial_configDeveloperInfo(JSContext *cx, ui
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TSocialDeveloperInfo arg0;
#pragma warning NO CONVERSION TO NATIVE FOR TSocialDeveloperInfo;
ok &= jsval_to_TSocialDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
@ -1163,7 +1171,7 @@ JSBool js_pluginx_protocols_ProtocolSocial_unlockAchievement(JSContext *cx, uint
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TAchievementInfo arg0;
#pragma warning NO CONVERSION TO NATIVE FOR TAchievementInfo;
ok &= jsval_to_TAchievementInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->unlockAchievement(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
@ -1295,7 +1303,7 @@ JSBool js_pluginx_protocols_ProtocolUser_configDeveloperInfo(JSContext *cx, uint
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
if (argc == 1) {
TUserDeveloperInfo arg0;
#pragma warning NO CONVERSION TO NATIVE FOR TUserDeveloperInfo;
ok &= jsval_to_TUserDeveloperInfo(cx, argv[0], &arg0);
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
cobj->configDeveloperInfo(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);

View File

@ -61,8 +61,8 @@ bool AppDelegate::applicationDidFinishLaunching()
void AppDelegate::applicationDidEnterBackground()
{
Director::getInstance()->stopAnimation();
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
SimpleAudioEngine::sharedEngine()->pauseAllEffects();
SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
SimpleAudioEngine::getInstance()->pauseAllEffects();
ScriptingCore* sc = ScriptingCore::getInstance();
jsval nsval;
@ -76,8 +76,8 @@ void AppDelegate::applicationDidEnterBackground()
void AppDelegate::applicationWillEnterForeground()
{
Director::getInstance()->startAnimation();
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
SimpleAudioEngine::sharedEngine()->resumeAllEffects();
SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
SimpleAudioEngine::getInstance()->resumeAllEffects();
ScriptingCore* sc = ScriptingCore::getInstance();
jsval nsval;

View File

@ -35,6 +35,20 @@ echo "please define NDK_ROOT"
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
PLUGIN_ROOT="$DIR/../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -35,6 +35,20 @@ echo "please define NDK_ROOT"
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
PLUGIN_ROOT="$DIR/../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -40,7 +40,7 @@ void AppDelegate::applicationDidEnterBackground() {
Director::getInstance()->stopAnimation();
// if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
// SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
}
// this function will be called when the app is active again
@ -48,5 +48,5 @@ void AppDelegate::applicationWillEnterForeground() {
Director::getInstance()->startAnimation();
// if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
// SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
}

View File

@ -118,7 +118,7 @@ bool TestAnalytics::init()
std::string strVer = _pluginAnalytics->getSDKVersion();
char ret[256] = { 0 };
sprintf(ret, "Plugin : %s, Ver : %s", strName.c_str(), strVer.c_str());
LabelTTF* pLabel = LabelTTF::create(ret, "Arial", 18, Point(visibleSize.width, 0), kTextAlignmentCenter);
LabelTTF* pLabel = LabelTTF::create(ret, "Arial", 18, Point(visibleSize.width, 0), Label::HAlignment::CENTER);
pLabel->setPosition(Point(visibleSize.width / 2, yPos - 80));
addChild(pLabel);

View File

@ -35,6 +35,20 @@ echo "please define NDK_ROOT"
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
PLUGIN_ROOT="$DIR/../../.."

View File

@ -1,3 +1,3 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -40,8 +40,12 @@ conversions:
TIAPDeveloperInfo: "ok &= jsval_to_TIAPDeveloperInfo(cx, ${in_value}, &${out_value})"
TPaymentInfo: "ok &= jsval_to_TPaymentInfo(cx, ${in_value}, &${out_value})"
TAdsDeveloperInfo: "ok &= jsval_to_TAdsDeveloperInfo(cx, ${in_value}, &${out_value})"
TAdsInfo: "ok &= jsval_to_TAdsInfo(cx, ${in_value}, &${out_value})"
TShareDeveloperInfo: "ok &= jsval_to_TShareDeveloperInfo(cx, ${in_value}, &${out_value})"
TShareInfo: "ok &= jsval_to_TShareInfo(cx, ${in_value}, &${out_value})"
TUserDeveloperInfo: "ok &= jsval_to_TUserDeveloperInfo(cx, ${in_value}, &${out_value})"
TSocialDeveloperInfo: "ok &= jsval_to_TSocialDeveloperInfo(cx, ${in_value}, &${out_value})"
TAchievementInfo: "ok &= jsval_to_TAchievementInfo(cx, ${in_value}, &${out_value})"
LogEventParamMap*: |
LogEventParamMap ${out_value}_tmp;
${($level + 0) * '\t'}do {
@ -62,11 +66,6 @@ conversions:
float: "${out_value} = DOUBLE_TO_JSVAL(${in_value})"
double: "${out_value} = DOUBLE_TO_JSVAL(${in_value})"
TProductInfo: "${out_value} = TProductInfo_to_jsval(cx, ${in_value})"
TIAPDeveloperInfo: "${out_value} = TIAPDeveloperInfo_to_jsval(cx, ${in_value})"
TPaymentInfo: "${out_value} = TPaymentInfo_to_jsval(cx, ${in_value})"
TAdsDeveloperInfo: "${out_value} = TAdsDeveloperInfo_to_jsval(cx, ${in_value})"
TShareDeveloperInfo: "${out_value} = TShareDeveloperInfo_to_jsval(cx, ${in_value})"
TShareInfo: "${out_value} = TShareInfo_to_jsval(cx, ${in_value})"
LogEventParamMap*: "${out_value} = LogEventParamMap_to_jsval(cx, ${in_value})"
long: "${out_value} = long_to_jsval(cx, ${in_value})"

View File

@ -49,6 +49,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,4 +1,3 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -49,6 +49,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,3 +1,2 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -49,6 +49,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,3 +1,2 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -448,15 +448,13 @@ RenderTextureTestDepthStencil::RenderTextureTestDepthStencil()
//! mark sprite quad into stencil buffer
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 1, 0xFF);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glColorMask(0, 0, 0, 1);
glStencilFunc(GL_NEVER, 1, 0xFF);
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
sprite->visit();
//! move sprite half width and height, and draw only where not marked
sprite->setPosition(sprite->getPosition() + Point(sprite->getContentSize().width * sprite->getScale(), sprite->getContentSize().height * sprite->getScale() * 0.5));
sprite->setPosition(sprite->getPosition() + Point(sprite->getContentSize().width * sprite->getScale() * 0.5, sprite->getContentSize().height * sprite->getScale() * 0.5));
glStencilFunc(GL_NOTEQUAL, 1, 0xFF);
glColorMask(1, 1, 1, 1);
sprite->visit();
rend->end();

View File

@ -49,6 +49,21 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,3 +1,3 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -58,6 +58,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -58,6 +58,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -57,6 +57,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT= -std=c++11
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
NDK_TOOLCHAIN_VERSION=4.7

@ -1 +1 @@
Subproject commit 50a20327a933283d1a9f5bb2d305f33c9a1eb257
Subproject commit 714ea9482432a94a2d58ca265c97c61b5b369919

View File

@ -57,6 +57,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -57,6 +57,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -49,6 +49,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11
APP_CPPFLAGS += -fexceptions
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -284,18 +284,6 @@ end
--------------------------------------
-- ActionCardinalSpline
--------------------------------------
local function drawCardinalSpline(array)
kmGLPushMatrix()
kmGLTranslatef(50, 50, 0)
CCDrawPrimitives.ccDrawCardinalSpline(array, 0, 100)
kmGLPopMatrix()
kmGLPushMatrix()
kmGLTranslatef(size.width / 2, 50, 0)
CCDrawPrimitives.ccDrawCardinalSpline(array, 1, 100)
kmGLPopMatrix()
end
local function ActionCardinalSpline()
local layer = CCLayer:create()
initWithLayer(layer)
@ -323,7 +311,25 @@ local function ActionCardinalSpline()
kathia:setPosition(CCPoint(size.width / 2, 50))
kathia:runAction(seq2)
drawCardinalSpline(array)
local function drawCardinalSpline()
kmGLPushMatrix()
kmGLTranslatef(50, 50, 0)
CCDrawPrimitives.ccDrawCardinalSpline(array, 0, 100)
kmGLPopMatrix()
kmGLPushMatrix()
kmGLTranslatef(size.width / 2, 50, 0)
CCDrawPrimitives.ccDrawCardinalSpline(array, 1, 100)
kmGLPopMatrix()
end
array:retain()
local glNode = gl.glNodeCreate()
glNode:setContentSize(CCSize(size.width, size.height))
glNode:setAnchorPoint(CCPoint(0.5, 0.5))
glNode:registerScriptDrawHandler(drawCardinalSpline)
layer:addChild(glNode,-10)
glNode:setPosition( size.width / 2, size.height / 2)
Helper.titleLabel:setString("CardinalSplineBy / CardinalSplineAt")
Helper.subtitleLabel:setString("Cardinal Spline paths.\nTesting different tensions for one array")
@ -333,15 +339,6 @@ end
--------------------------------------
-- ActionCatmullRom
--------------------------------------
local function drawCatmullRom(array1, array2)
kmGLPushMatrix()
kmGLTranslatef(50, 50, 0)
CCDrawPrimitives.ccDrawCatmullRom(array1, 50)
kmGLPopMatrix()
CCDrawPrimitives.ccDrawCatmullRom(array2,50)
end
local function ActionCatmullRom()
local layer = CCLayer:create()
initWithLayer(layer)
@ -376,10 +373,26 @@ local function ActionCatmullRom()
local seq2 = CCSequence:createWithTwoActions(action2, reverse2)
kathia:runAction(seq2)
drawCatmullRom(array, array2)
local function drawCatmullRom()
kmGLPushMatrix()
kmGLTranslatef(50, 50, 0)
CCDrawPrimitives.ccDrawCatmullRom(array, 50)
kmGLPopMatrix()
Helper.titleLabel:setString("CatmullRomBy / CatmullRomTo")
Helper.subtitleLabel:setString("Catmull Rom spline paths. Testing reverse too")
CCDrawPrimitives.ccDrawCatmullRom(array2,50)
end
array:retain()
array2:retain()
local glNode = gl.glNodeCreate()
glNode:setContentSize(CCSize(size.width, size.height))
glNode:setAnchorPoint(CCPoint(0.5, 0.5))
glNode:registerScriptDrawHandler(drawCatmullRom)
layer:addChild(glNode,-10)
glNode:setPosition( size.width / 2, size.height / 2)
Helper.titleLabel:setString("CatmullRomBy / CatmullRomTo")
Helper.subtitleLabel:setString("Catmull Rom spline paths. Testing reverse too")
return layer
end
@ -957,6 +970,21 @@ local function ActionFollow()
layer:runAction(CCFollow:create(grossini, CCRect(0, 0, size.width * 2 - 100, size.height)))
local function draw()
local winSize = CCDirector:getInstance():getWinSize()
local x = winSize.width * 2 - 100
local y = winSize.height
local vertices = { CCPoint(5, 5), CCPoint(x - 5, 5), CCPoint(x - 5,y - 5), CCPoint(5,y - 5) }
CCDrawPrimitives.ccDrawPoly(vertices, 4, true)
end
local glNode = gl.glNodeCreate()
glNode:setContentSize(CCSize(size.width, size.height))
glNode:setAnchorPoint(CCPoint(0.5, 0.5))
glNode:registerScriptDrawHandler(draw)
layer:addChild(glNode,-10)
glNode:setPosition( size.width / 2, size.height / 2)
Helper.subtitleLabel:setString("Follow action")
return layer
end

View File

@ -49,6 +49,21 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
# ... if COCOS2DX_ROOT is not set
# ... find current working directory

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11
APP_CPPFLAGS += -fexceptions
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -55,5 +55,9 @@ var cc = cc || {};
return cc.Node.prototype.getNumberOfRunningActionsInTarget.apply(this, arguments);
};
cc.TMXTiledMap.prototype.propertiesForGID = function() {
logW("cc.TMXTiledMap.propertiesForGID", "cc.TMXTiledMap.getPropertiesForGID");
return cc.TMXTiledMap.prototype.getPropertiesForGID.apply(this, arguments);
};
})();

View File

@ -35,6 +35,20 @@ echo "please define NDK_ROOT"
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../.."

View File

@ -1,3 +1,2 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -43,6 +43,20 @@ echo "please define NDK_ROOT"
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -35,6 +35,20 @@ echo "please define NDK_ROOT"
exit 1
fi
# For compatibility of android-ndk-r9, 4.7 was removed from r9
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
export NDK_TOOLCHAIN_VERSION=4.7
echo "The Selected NDK toolchain version was 4.7 !"
else
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
export NDK_TOOLCHAIN_VERSION=4.8
echo "The Selected NDK toolchain version was 4.8 !"
else
echo "Couldn't find the gcc toolchain."
exit 1
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../.."

View File

@ -1,4 +1,4 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11
APP_CPPFLAGS += -fexceptions
NDK_TOOLCHAIN_VERSION=4.7