Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into fix-crash

This commit is contained in:
minggo 2014-07-01 10:01:24 +08:00
commit eb6ddea26e
25 changed files with 264 additions and 96 deletions

View File

@ -1042,12 +1042,6 @@
3E6176781960F89B00DE83F5 /* CCGameController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176651960F89B00DE83F5 /* CCGameController.h */; };
3E6176791960F89B00DE83F5 /* CCGamepad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176661960F89B00DE83F5 /* CCGamepad.cpp */; };
3E61767A1960F89B00DE83F5 /* CCGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176671960F89B00DE83F5 /* CCGamepad.h */; };
3E6176831960F9C400DE83F5 /* CCNSLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E61767C1960F9C400DE83F5 /* CCNSLog.h */; };
3E6176841960F9C400DE83F5 /* CCNSLog.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E61767E1960F9C400DE83F5 /* CCNSLog.mm */; };
3E6176851960F9C400DE83F5 /* LoggerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E61767F1960F9C400DE83F5 /* LoggerClient.h */; };
3E6176861960F9C400DE83F5 /* LoggerClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176801960F9C400DE83F5 /* LoggerClient.m */; };
3E6176871960F9C400DE83F5 /* LoggerCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176811960F9C400DE83F5 /* LoggerCommon.h */; };
3E6176881960F9C400DE83F5 /* NSLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E6176821960F9C400DE83F5 /* NSLogger.h */; };
3EA0FB6B191C841D00B170C8 /* UIVideoPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */; };
3EA0FB6C191C841D00B170C8 /* UIVideoPlayerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */; };
3EA47870195478E00068D9D1 /* CCBundleReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA4786E195478E00068D9D1 /* CCBundleReader.cpp */; };
@ -2393,12 +2387,6 @@
3E6176651960F89B00DE83F5 /* CCGameController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCGameController.h; path = ../base/CCGameController.h; sourceTree = "<group>"; };
3E6176661960F89B00DE83F5 /* CCGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCGamepad.cpp; path = ../base/CCGamepad.cpp; sourceTree = "<group>"; };
3E6176671960F89B00DE83F5 /* CCGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCGamepad.h; path = ../base/CCGamepad.h; sourceTree = "<group>"; };
3E61767C1960F9C400DE83F5 /* CCNSLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNSLog.h; sourceTree = "<group>"; };
3E61767E1960F9C400DE83F5 /* CCNSLog.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCNSLog.mm; sourceTree = "<group>"; };
3E61767F1960F9C400DE83F5 /* LoggerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggerClient.h; sourceTree = "<group>"; };
3E6176801960F9C400DE83F5 /* LoggerClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoggerClient.m; sourceTree = "<group>"; };
3E6176811960F9C400DE83F5 /* LoggerCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggerCommon.h; sourceTree = "<group>"; };
3E6176821960F9C400DE83F5 /* NSLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSLogger.h; sourceTree = "<group>"; };
3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIVideoPlayer.h; sourceTree = "<group>"; };
3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIVideoPlayerIOS.mm; sourceTree = "<group>"; };
3EA4786E195478E00068D9D1 /* CCBundleReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBundleReader.cpp; sourceTree = "<group>"; };
@ -3505,7 +3493,6 @@
1A57033E180BD0490088DEC7 /* external */ = {
isa = PBXGroup;
children = (
3E61767B1960F9C400DE83F5 /* nslog */,
1AC026971914068200FA920D /* ConvertUTF */,
46C02E0418E91123004B7456 /* xxhash */,
46A168B21807AF9C005B8026 /* Box2D */,
@ -4189,28 +4176,6 @@
path = internal;
sourceTree = "<group>";
};
3E61767B1960F9C400DE83F5 /* nslog */ = {
isa = PBXGroup;
children = (
3E61767C1960F9C400DE83F5 /* CCNSLog.h */,
3E61767D1960F9C400DE83F5 /* ios */,
);
name = nslog;
path = ../external/nslog;
sourceTree = "<group>";
};
3E61767D1960F9C400DE83F5 /* ios */ = {
isa = PBXGroup;
children = (
3E61767E1960F9C400DE83F5 /* CCNSLog.mm */,
3E61767F1960F9C400DE83F5 /* LoggerClient.h */,
3E6176801960F9C400DE83F5 /* LoggerClient.m */,
3E6176811960F9C400DE83F5 /* LoggerCommon.h */,
3E6176821960F9C400DE83F5 /* NSLogger.h */,
);
path = ios;
sourceTree = "<group>";
};
46A15FD01807A56F005B8026 /* audio */ = {
isa = PBXGroup;
children = (
@ -5663,7 +5628,6 @@
50ABBD411925AB0000A911A9 /* CCMath.h in Headers */,
1A5701A0180BCB590088DEC7 /* CCFont.h in Headers */,
50ABBD9A1925AB4100A911A9 /* CCGLProgramStateCache.h in Headers */,
3E6176881960F9C400DE83F5 /* NSLogger.h in Headers */,
50ABBD3F1925AB0000A911A9 /* CCGeometry.h in Headers */,
50ABBFFE1926664800A911A9 /* CCFileUtilsApple.h in Headers */,
1A5701A4180BCB590088DEC7 /* CCFontAtlas.h in Headers */,
@ -5744,7 +5708,6 @@
1A570303180BCE890088DEC7 /* CCParallaxNode.h in Headers */,
50ABBE2A1925AB6F00A911A9 /* CCAutoreleasePool.h in Headers */,
1A57030F180BCF190088DEC7 /* CCComponent.h in Headers */,
3E6176851960F9C400DE83F5 /* LoggerClient.h in Headers */,
3E61766F1960F89B00DE83F5 /* CCControllerDirectionPad.h in Headers */,
1A570313180BCF190088DEC7 /* CCComponentContainer.h in Headers */,
0634A4DF194B19E400E608AF /* CCNodeReader.h in Headers */,
@ -5759,7 +5722,6 @@
50ABBD4B1925AB0000A911A9 /* Mat4.h in Headers */,
1A01C69B18F57BE800EFE3A6 /* CCSet.h in Headers */,
50ABBED61925AB6F00A911A9 /* utlist.h in Headers */,
3E6176871960F9C400DE83F5 /* LoggerCommon.h in Headers */,
1A57035B180BD0B00088DEC7 /* unzip.h in Headers */,
5034CA48191D591100CE6051 /* ccShader_Label_normal.frag in Headers */,
50ABBD531925AB0000A911A9 /* Quaternion.h in Headers */,
@ -5789,7 +5751,6 @@
50E6D33B18E174130051CA34 /* UIRelativeBox.h in Headers */,
503DD8EB1926736A00CD74DD /* CCGL.h in Headers */,
50ABBE3C1925AB6F00A911A9 /* CCData.h in Headers */,
3E6176831960F9C400DE83F5 /* CCNSLog.h in Headers */,
1AD71DD8180E26E600808F54 /* CCLabelTTFLoader.h in Headers */,
503DD8FA1926B0DB00CD74DD /* CCIMEDispatcher.h in Headers */,
1AD71DDC180E26E600808F54 /* CCLayerColorLoader.h in Headers */,
@ -6757,7 +6718,6 @@
2AC795E318628746005EC8E1 /* SkeletonBounds.cpp in Sources */,
2AC795E418628746005EC8E1 /* Event.cpp in Sources */,
2AC795E518628746005EC8E1 /* EventData.cpp in Sources */,
3E6176861960F9C400DE83F5 /* LoggerClient.m in Sources */,
2AC795E618628746005EC8E1 /* BoundingBoxAttachment.cpp in Sources */,
46A171001807CECB005B8026 /* CCPhysicsJoint.cpp in Sources */,
46A171051807CECB005B8026 /* CCPhysicsWorld.cpp in Sources */,
@ -6842,7 +6802,6 @@
2905FA4B18CF08D100240AA3 /* UICheckBox.cpp in Sources */,
1A5701BE180BCB5A0088DEC7 /* CCLabelAtlas.cpp in Sources */,
1A5701C2180BCB5A0088DEC7 /* CCLabelBMFont.cpp in Sources */,
3E6176841960F9C400DE83F5 /* CCNSLog.mm in Sources */,
1A087AE91860400400196EF5 /* edtaa3func.cpp in Sources */,
B375107E1823ACA100B3BA6A /* CCPhysicsContactInfo_chipmunk.cpp in Sources */,
1A5701C8180BCB5A0088DEC7 /* CCLabelTextFormatter.cpp in Sources */,

View File

@ -180,7 +180,7 @@ void FastTMXLayer::onDraw(int offset, int count)
GL::bindTexture2D(_texture->getName());
getGLProgramState()->apply(_modelViewTransform);
glBindVertexArray(0);
GL::bindVAO(0);
glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]);

View File

@ -225,6 +225,7 @@
<ClCompile Include="..\3d\CCAnimate3D.cpp" />
<ClCompile Include="..\3d\CCAnimation3D.cpp" />
<ClCompile Include="..\3d\CCBundle3D.cpp" />
<ClCompile Include="..\3d\CCBundleReader.cpp" />
<ClCompile Include="..\3d\CCMesh.cpp" />
<ClCompile Include="..\3d\CCMeshSkin.cpp" />
<ClCompile Include="..\3d\CCObjLoader.cpp" />
@ -378,6 +379,8 @@
<ClCompile Include="CCComponentContainer.cpp" />
<ClCompile Include="CCDrawingPrimitives.cpp" />
<ClCompile Include="CCDrawNode.cpp" />
<ClCompile Include="CCFastTMXLayer.cpp" />
<ClCompile Include="CCFastTMXTiledMap.cpp" />
<ClCompile Include="CCFont.cpp" />
<ClCompile Include="CCFontAtlas.cpp" />
<ClCompile Include="CCFontAtlasCache.cpp" />
@ -433,6 +436,7 @@
<ClInclude Include="..\3d\CCAnimationCurve.h" />
<ClInclude Include="..\3d\CCBundle3D.h" />
<ClInclude Include="..\3d\CCBundle3DData.h" />
<ClInclude Include="..\3d\CCBundleReader.h" />
<ClInclude Include="..\3d\CCMesh.h" />
<ClInclude Include="..\3d\CCMeshSkin.h" />
<ClInclude Include="..\3d\CCObjLoader.h" />
@ -591,6 +595,8 @@
<ClInclude Include="CCComponentContainer.h" />
<ClInclude Include="CCDrawingPrimitives.h" />
<ClInclude Include="CCDrawNode.h" />
<ClInclude Include="CCFastTMXLayer.h" />
<ClInclude Include="CCFastTMXTiledMap.h" />
<ClInclude Include="CCFont.h" />
<ClInclude Include="CCFontAtlas.h" />
<ClInclude Include="CCFontAtlasCache.h" />

View File

@ -608,6 +608,15 @@
<ClCompile Include="..\3d\CCSprite3DMaterial.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="..\3d\CCBundleReader.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="CCFastTMXLayer.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="CCFastTMXTiledMap.cpp">
<Filter>2d</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -1241,6 +1250,15 @@
<ClInclude Include="..\3d\CCSprite3DMaterial.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="..\3d\CCBundleReader.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="CCFastTMXLayer.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="CCFastTMXTiledMap.h">
<Filter>2d</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -463,11 +463,19 @@ bool Bundle3D::loadBinary(const std::string& path)
// Read version
unsigned char ver[2];
if (_binaryReader.read(ver, 1, 2) != 2 || ver[0] != 0 || ver[1] != 1)
if (_binaryReader.read(ver, 1, 2) == 2)
{
clear();
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
return false;
if (ver[0] != 0) {
clear();
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
return false;
}
if (ver[1] <= 0 || ver[1] > 2) {
clear();
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
return false;
}
}
// Read ref table size
@ -542,12 +550,12 @@ bool Bundle3D::loadMeshDataBinary(MeshData* meshdata)
}
// Read index data
ssize_t meshPartCount = 1;
unsigned int meshPartCount = 1;
//_binaryReader.read(&meshPartCount, 4, 1);
for (ssize_t i = 0; i < meshPartCount; ++i)
for (unsigned int i = 0; i < meshPartCount; ++i)
{
ssize_t nIndexCount;
unsigned int nIndexCount;
if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
{
CCLOGINFO("Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
@ -600,7 +608,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
if (!_binaryReader.readMatrix(bindpos))
{
CCLOGINFO("Failed to load SkinData: bindpos '%s'.", _path.c_str());
return nullptr;
return false;
}
skindata->inverseBindPoseMatrices.push_back(bindpos);
}
@ -641,7 +649,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
if (!_binaryReader.readMatrix(transform))
{
CCLOGINFO("Failed to load SkinData: transform '%s'.", _path.c_str());
return nullptr;
return false;
}
if(index < 0)
@ -702,24 +710,24 @@ bool Bundle3D::loadAnimationDataBinary(Animation3DData* animationdata)
return false;
}
ssize_t animNum;
unsigned int animNum;
if (!_binaryReader.read(&animNum))
{
CCLOGINFO("Failed to read AnimationData: animNum '%s'.", _path.c_str());
return false;
}
for (ssize_t i = 0; i < animNum; ++i)
for (unsigned int i = 0; i < animNum; ++i)
{
std::string boneName = _binaryReader.readString();
ssize_t keyframeNum;
unsigned int keyframeNum;
if (!_binaryReader.read(&keyframeNum))
{
CCLOGINFO("Failed to read AnimationData: keyframeNum '%s'.", _path.c_str());
return false;
}
for (ssize_t j = 0; j < keyframeNum; ++j)
for (unsigned int j = 0; j < keyframeNum; ++j)
{
float keytime;
if (!_binaryReader.read(&keytime))
@ -808,7 +816,7 @@ unsigned int Bundle3D::parseGLProgramAttribute(const std::string& str)
void Bundle3D::getModelRelativePath(const std::string& path)
{
int index = path.find_last_of('/');
ssize_t index = path.find_last_of('/');
std::string fullModelPath;
fullModelPath = path.substr(0, index + 1);

View File

@ -173,7 +173,7 @@ protected:
// for binary reading
Data* _binaryBuffer;
BundleReader _binaryReader;
size_t _referenceCount;
unsigned int _referenceCount;
Reference* _references;
bool _isBinary;

View File

@ -15,7 +15,7 @@ BundleReader::~BundleReader()
};
void BundleReader::init(char* lpbuffer, unsigned int length)
void BundleReader::init(char* lpbuffer, ssize_t length)
{
m_position = 0;
m_buffer = lpbuffer;

View File

@ -55,7 +55,7 @@ public:
* @param lpbuffer The data buffer pointer
* @param length The data buffer size
*/
void init(char* lpbuffer, unsigned int length);
void init(char* lpbuffer, ssize_t length);
/**
* Reads an array of elements.

View File

@ -41,8 +41,6 @@
#import <GameController/GameController.h>
#include "CCNSLog.h"
@interface GCControllerConnectionEventHandler : NSObject
typedef void (^GCControllerConnectionBlock)(GCController* controller);
@ -153,8 +151,6 @@ const std::vector<Controller*>& Controller::getControllers()
void Controller::startDiscoveryController()
{
CCNSLOG("startDiscoveryController...: %s", "hello");
[GCController startWirelessControllerDiscoveryWithCompletionHandler: nil];
[[GCControllerConnectionEventHandler getInstance] observerConnection: ^(GCController* gcController) {
@ -163,7 +159,6 @@ void Controller::startDiscoveryController()
gcController.controllerPausedHandler = ^(GCController* gcCon){
CCNSLOG("Controller(%p)'s paused handler was invoked.", gcCon);
auto iter = std::find_if(_controllers.begin(), _controllers.end(), [gcCon](Controller* c){ return c->_impl->_gcController == gcCon; });
CCASSERT(iter != _controllers.end(), "Could not find the controller");
@ -177,7 +172,6 @@ void Controller::startDiscoveryController()
button->setPressed(false);
};
CCNSLOG("controller %p was connnected!", gcController);
_controllers.push_back(controller);
@ -185,7 +179,6 @@ void Controller::startDiscoveryController()
Director::getInstance()->getEventDispatcher()->dispatchEvent(&evt);
} disconnection: ^(GCController* gcController) {
CCNSLOG("controller %p was disconnected!", gcController);
auto iter = std::find_if(_controllers.begin(), _controllers.end(), [gcController](Controller* c){ return c->_impl->_gcController == gcController; });
@ -256,22 +249,18 @@ Gamepad* Controller::getGamepad() const
if (_impl->_gcController.extendedGamepad != nil)
{
_impl->_gcController.extendedGamepad.dpad.up.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
CCNSLOG("dpad up %d, %f", button.pressed, button.value);
sendEventButton(_gamepad->getDirectionPad()->getUp(), button);
};
_impl->_gcController.extendedGamepad.dpad.down.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
CCNSLOG("dpad down %d, %f", button.pressed, button.value);
sendEventButton(_gamepad->getDirectionPad()->getDown(), button);
};
_impl->_gcController.extendedGamepad.dpad.left.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
CCNSLOG("dpad left %d, %f", button.pressed, button.value);
sendEventButton(_gamepad->getDirectionPad()->getLeft(), button);
};
_impl->_gcController.extendedGamepad.dpad.right.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
CCNSLOG("dpad right %d, %f", button.pressed, button.value);
sendEventButton(_gamepad->getDirectionPad()->getRight(), button);
};
@ -329,22 +318,18 @@ Gamepad* Controller::getGamepad() const
else
{
_impl->_gcController.gamepad.dpad.up.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
CCNSLOG("dpad up %d, %f", button.pressed, button.value);
sendEventButton(_gamepad->getDirectionPad()->getUp(), button);
};
_impl->_gcController.gamepad.dpad.down.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
CCNSLOG("dpad down %d, %f", button.pressed, button.value);
sendEventButton(_gamepad->getDirectionPad()->getDown(), button);
};
_impl->_gcController.gamepad.dpad.left.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
CCNSLOG("dpad left %d, %f", button.pressed, button.value);
sendEventButton(_gamepad->getDirectionPad()->getLeft(), button);
};
_impl->_gcController.gamepad.dpad.right.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed){
CCNSLOG("dpad right %d, %f", button.pressed, button.value);
sendEventButton(_gamepad->getDirectionPad()->getRight(), button);
};

View File

@ -28,7 +28,6 @@
#include "CCControllerButtonInput.h"
#include "CCControllerAxisInput.h"
#include "ccMacros.h"
#include "CCNSLog.h"
NS_CC_BEGIN
@ -72,7 +71,6 @@ bool EventListenerController::init()
{
auto button = static_cast<ControllerButtonInput*>(evtController->getControllerElement());
CCNSLOG("button event: %d, %d, %f", button->isPressed(), button->isPrevStatusPressed(), button->getValue());
if (this->onButtonPressed && button->isPressed() && !button->isPrevStatusPressed())
{
this->onButtonPressed(evtController->getController(), button, event);

View File

@ -102,10 +102,16 @@ void ActionTimeline::gotoFrameAndPlay(int startIndex, bool loop)
void ActionTimeline::gotoFrameAndPlay(int startIndex, int endIndex, bool loop)
{
_startFrame = _currentFrame = startIndex;
_endFrame = endIndex;
_loop = loop;
_time = _currentFrame * _frameInternal;
gotoFrameAndPlay(startIndex, endIndex, startIndex, loop);
}
void ActionTimeline::gotoFrameAndPlay(int startIndex, int endIndex, int currentFrameIndex, bool loop)
{
_startFrame = startIndex;
_endFrame = endIndex;
_currentFrame = currentFrameIndex;
_loop = loop;
_time = _currentFrame*_frameInternal;
resume();
gotoFrame(_currentFrame);
@ -135,6 +141,19 @@ bool ActionTimeline::isPlaying() const
return _playing;
}
void ActionTimeline::setCurrentFrame(int frameIndex)
{
if (frameIndex >= _startFrame && frameIndex >= _endFrame)
{
_currentFrame = frameIndex;
_time = _currentFrame*_frameInternal;
}
else
{
CCLOG("frame index is not between start frame and end frame");
}
}
ActionTimeline* ActionTimeline::clone() const
{
ActionTimeline* newAction = ActionTimeline::create();

View File

@ -75,6 +75,14 @@ public:
*/
virtual void gotoFrameAndPlay(int startIndex, int endIndex, bool loop);
/** Goto the specified frame index, and start playing from start index, end at end index.
* @param startIndex The animation will play from this index.
* @param endIndex The animation will end at this index.
* @param currentFrameIndex set current frame index.
* @param loop Whether or not the animation need loop.
*/
virtual void gotoFrameAndPlay(int startIndex, int endIndex, int currentFrameIndex, bool loop);
/** Goto the specified frame index, and pause at this index.
* @param startIndex The animation will pause at this index.
*/
@ -105,6 +113,8 @@ public:
* or it will play from start frame again. */
virtual int getEndFrame() const { return _endFrame; }
/** Set current frame index, this will cause action plays to this frame. */
virtual void setCurrentFrame(int frameIndex);
/** Get current frame. */
virtual int getCurrentFrame() const { return _currentFrame; }

View File

@ -61,7 +61,7 @@ namespace {
typedef Texture2D::PixelFormatInfoMap::value_type PixelFormatInfoMapValue;
static const PixelFormatInfoMapValue TexturePixelFormatInfoTablesValue[] =
{
PixelFormatInfoMapValue(Texture2D::PixelFormat::BGRA8888, Texture2D::PixelFormatInfo(GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, 32, false, true)),
PixelFormatInfoMapValue(Texture2D::PixelFormat::BGRA8888, Texture2D::PixelFormatInfo(GL_BGRA, GL_BGRA, GL_UNSIGNED_BYTE, 32, false, true)),
PixelFormatInfoMapValue(Texture2D::PixelFormat::RGBA8888, Texture2D::PixelFormatInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 32, false, true)),
PixelFormatInfoMapValue(Texture2D::PixelFormat::RGBA4444, Texture2D::PixelFormatInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 16, false, true)),
PixelFormatInfoMapValue(Texture2D::PixelFormat::RGB5A1, Texture2D::PixelFormatInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 16, false, true)),
@ -1032,6 +1032,14 @@ rgba(1) -> 12345678
*/
Texture2D::PixelFormat Texture2D::convertDataToFormat(const unsigned char* data, ssize_t dataLen, PixelFormat originFormat, PixelFormat format, unsigned char** outData, ssize_t* outDataLen)
{
// don't need to convert
if (format == originFormat || format == PixelFormat::AUTO)
{
*outData = (unsigned char*)data;
*outDataLen = dataLen;
return originFormat;
}
switch (originFormat)
{
case PixelFormat::I8:

View File

@ -47,6 +47,11 @@
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#ActionTimeline] setCurrentFrame
-- @param self
-- @param #int int
--------------------------------
-- @function [parent=#ActionTimeline] setTimeSpeed
-- @param self
@ -84,10 +89,13 @@
--
-- overload function: gotoFrameAndPlay(int, int, bool)
--
-- overload function: gotoFrameAndPlay(int, int, int, bool)
--
-- @function [parent=#ActionTimeline] gotoFrameAndPlay
-- @param self
-- @param #int int
-- @param #int int
-- @param #int int
-- @param #bool bool
--------------------------------

View File

@ -19605,6 +19605,52 @@ int lua_cocos2dx_studio_ActionTimeline_getEndFrame(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_studio_ActionTimeline_setCurrentFrame(lua_State* tolua_S)
{
int argc = 0;
cocostudio::timeline::ActionTimeline* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocostudio::timeline::ActionTimeline*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0);
if(!ok)
return 0;
cobj->setCurrentFrame(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setCurrentFrame",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimeline_setCurrentFrame'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_studio_ActionTimeline_setTimeSpeed(lua_State* tolua_S)
{
int argc = 0;
@ -19941,7 +19987,30 @@ int lua_cocos2dx_studio_ActionTimeline_gotoFrameAndPlay(lua_State* tolua_S)
}
}while(0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "gotoFrameAndPlay",argc, 3);
do{
if (argc == 4) {
int arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0);
if (!ok) { break; }
int arg1;
ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1);
if (!ok) { break; }
int arg2;
ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2);
if (!ok) { break; }
bool arg3;
ok &= luaval_to_boolean(tolua_S, 5,&arg3);
if (!ok) { break; }
cobj->gotoFrameAndPlay(arg0, arg1, arg2, arg3);
return 0;
}
}while(0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "gotoFrameAndPlay",argc, 4);
return 0;
#if COCOS2D_DEBUG >= 1
@ -20127,6 +20196,7 @@ int lua_register_cocos2dx_studio_ActionTimeline(lua_State* tolua_S)
tolua_function(tolua_S,"getDuration",lua_cocos2dx_studio_ActionTimeline_getDuration);
tolua_function(tolua_S,"addTimeline",lua_cocos2dx_studio_ActionTimeline_addTimeline);
tolua_function(tolua_S,"getEndFrame",lua_cocos2dx_studio_ActionTimeline_getEndFrame);
tolua_function(tolua_S,"setCurrentFrame",lua_cocos2dx_studio_ActionTimeline_setCurrentFrame);
tolua_function(tolua_S,"setTimeSpeed",lua_cocos2dx_studio_ActionTimeline_setTimeSpeed);
tolua_function(tolua_S,"init",lua_cocos2dx_studio_ActionTimeline_init);
tolua_function(tolua_S,"setDuration",lua_cocos2dx_studio_ActionTimeline_setDuration);

View File

@ -489,6 +489,7 @@ int register_all_cocos2dx_studio(lua_State* tolua_S);
#endif // __cocos2dx_studio_h__

View File

@ -894,7 +894,7 @@ bool ScrollView::scrollChildrenVertical(float touchOffsetX, float touchOffsetY)
bool ScrollView::scrollChildrenHorizontal(float touchOffsetX, float touchOffestY)
{
bool scrollenabled;
bool scrollenabled = false;
float realOffset = touchOffsetX;
if (_bounceEnabled)
{

View File

@ -278,6 +278,19 @@
"cocos/base/CCConfiguration.h",
"cocos/base/CCConsole.cpp",
"cocos/base/CCConsole.h",
"cocos/base/CCController-android.cpp",
"cocos/base/CCController-iOS.mm",
"cocos/base/CCController.h",
"cocos/base/CCControllerAxisInput.cpp",
"cocos/base/CCControllerAxisInput.h",
"cocos/base/CCControllerButtonInput.cpp",
"cocos/base/CCControllerButtonInput.h",
"cocos/base/CCControllerDirectionPad.cpp",
"cocos/base/CCControllerDirectionPad.h",
"cocos/base/CCControllerElement.cpp",
"cocos/base/CCControllerElement.h",
"cocos/base/CCControllerThumbstick.cpp",
"cocos/base/CCControllerThumbstick.h",
"cocos/base/CCData.cpp",
"cocos/base/CCData.h",
"cocos/base/CCDataVisitor.cpp",
@ -288,6 +301,8 @@
"cocos/base/CCEvent.h",
"cocos/base/CCEventAcceleration.cpp",
"cocos/base/CCEventAcceleration.h",
"cocos/base/CCEventController.cpp",
"cocos/base/CCEventController.h",
"cocos/base/CCEventCustom.cpp",
"cocos/base/CCEventCustom.h",
"cocos/base/CCEventDispatcher.cpp",
@ -300,6 +315,8 @@
"cocos/base/CCEventListener.h",
"cocos/base/CCEventListenerAcceleration.cpp",
"cocos/base/CCEventListenerAcceleration.h",
"cocos/base/CCEventListenerController.cpp",
"cocos/base/CCEventListenerController.h",
"cocos/base/CCEventListenerCustom.cpp",
"cocos/base/CCEventListenerCustom.h",
"cocos/base/CCEventListenerFocus.cpp",
@ -315,6 +332,9 @@
"cocos/base/CCEventTouch.cpp",
"cocos/base/CCEventTouch.h",
"cocos/base/CCEventType.h",
"cocos/base/CCGameController.h",
"cocos/base/CCGamepad.cpp",
"cocos/base/CCGamepad.h",
"cocos/base/CCIMEDelegate.h",
"cocos/base/CCIMEDispatcher.cpp",
"cocos/base/CCIMEDispatcher.h",
@ -727,12 +747,45 @@
"cocos/platform/android/CCGLView.h",
"cocos/platform/android/CCPlatformDefine.h",
"cocos/platform/android/CCStdC.h",
"cocos/platform/android/ControllerDelegate/.classpath",
"cocos/platform/android/ControllerDelegate/.project",
"cocos/platform/android/ControllerDelegate/.settings/org.eclipse.jdt.core.prefs",
"cocos/platform/android/ControllerDelegate/AndroidManifest.xml",
"cocos/platform/android/ControllerDelegate/ant.properties",
"cocos/platform/android/ControllerDelegate/build.xml",
"cocos/platform/android/ControllerDelegate/proguard-project.txt",
"cocos/platform/android/ControllerDelegate/src/org/cocos2dx/lib/GameControllerDelegate.java",
"cocos/platform/android/ControllerMoga/.classpath",
"cocos/platform/android/ControllerMoga/.project",
"cocos/platform/android/ControllerMoga/.settings/org.eclipse.jdt.core.prefs",
"cocos/platform/android/ControllerMoga/AndroidManifest.xml",
"cocos/platform/android/ControllerMoga/ant.properties",
"cocos/platform/android/ControllerMoga/build.xml",
"cocos/platform/android/ControllerMoga/proguard-project.txt",
"cocos/platform/android/ControllerMoga/src/org/cocos2dx/lib/GameControllerMoga.java",
"cocos/platform/android/ControllerNibiru/.classpath",
"cocos/platform/android/ControllerNibiru/.project",
"cocos/platform/android/ControllerNibiru/.settings/org.eclipse.jdt.core.prefs",
"cocos/platform/android/ControllerNibiru/AndroidManifest.xml",
"cocos/platform/android/ControllerNibiru/ant.properties",
"cocos/platform/android/ControllerNibiru/build.xml",
"cocos/platform/android/ControllerNibiru/proguard-project.txt",
"cocos/platform/android/ControllerNibiru/src/org/cocos2dx/lib/GameControllerNibiru.java",
"cocos/platform/android/ControllerOuya/.classpath",
"cocos/platform/android/ControllerOuya/.project",
"cocos/platform/android/ControllerOuya/.settings/org.eclipse.jdt.core.prefs",
"cocos/platform/android/ControllerOuya/AndroidManifest.xml",
"cocos/platform/android/ControllerOuya/ant.properties",
"cocos/platform/android/ControllerOuya/build.xml",
"cocos/platform/android/ControllerOuya/proguard-project.txt",
"cocos/platform/android/ControllerOuya/src/org/cocos2dx/lib/GameControllerOuya.java",
"cocos/platform/android/java/.classpath",
"cocos/platform/android/java/.project",
"cocos/platform/android/java/.settings/org.eclipse.jdt.core.prefs",
"cocos/platform/android/java/AndroidManifest.xml",
"cocos/platform/android/java/ant.properties",
"cocos/platform/android/java/build.xml",
"cocos/platform/android/java/lint.xml",
"cocos/platform/android/java/proguard-project.txt",
"cocos/platform/android/java/project.properties",
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAccelerometer.java",
@ -753,6 +806,12 @@
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxTypefaces.java",
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoHelper.java",
"cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoView.java",
"cocos/platform/android/java/src/org/cocos2dx/lib/GameControllerAdapter.java",
"cocos/platform/android/java/src/org/cocos2dx/lib/GameControllerHelper.java",
"cocos/platform/android/java/src/org/cocos2dx/lib/GameControllerUtils.java",
"cocos/platform/android/java/src/org/cocos2dx/lib/inputmanagercompat/InputManagerCompat.java",
"cocos/platform/android/java/src/org/cocos2dx/lib/inputmanagercompat/InputManagerV16.java",
"cocos/platform/android/java/src/org/cocos2dx/lib/inputmanagercompat/InputManagerV9.java",
"cocos/platform/android/javaactivity.cpp",
"cocos/platform/android/jni/DPIJni.cpp",
"cocos/platform/android/jni/DPIJni.h",
@ -1991,6 +2050,12 @@
"external/linux-specific/fmod/prebuilt/64-bit/libfmodex64.so",
"external/linux-specific/fmod/prebuilt/64-bit/libfmodexL64-4.38.00.so",
"external/linux-specific/fmod/prebuilt/64-bit/libfmodexL64.so",
"external/nslog/CCNSLog.h",
"external/nslog/ios/CCNSLog.mm",
"external/nslog/ios/LoggerClient.h",
"external/nslog/ios/LoggerClient.m",
"external/nslog/ios/LoggerCommon.h",
"external/nslog/ios/NSLogger.h",
"external/png/include/android/png.h",
"external/png/include/android/pngconf.h",
"external/png/include/android/pnglibconf.h",

View File

@ -1183,6 +1183,7 @@ void ScheduleUpdatePriority::onEnter()
void ScheduleUpdatePriority::onExit()
{
Node::onExit();
unscheduleUpdate();
}

View File

@ -24,12 +24,10 @@ void main()
accum += texture2D(CC_Texture0, vec2(v_texCoord.x - radius, v_texCoord.y + radius));
accum *= u_threshold;
accum.rgb = u_outlineColor * accum.a;
accum.a = 1.0;
accum.r = u_outlineColor.x;
accum.g = u_outlineColor.y;
accum.b = u_outlineColor.z;
normal = (accum * (1.0 - normal.a)) + (normal * normal.a);
normal = ( accum * (1.0 - normal.a)) + (normal * normal.a);
gl_FragColor = v_fragmentColor * normal;
}

View File

@ -230,6 +230,7 @@
<ClCompile Include="..\..\Classes\SpineTest\SpineTest.cpp" />
<ClCompile Include="..\..\Classes\Sprite3DTest\Sprite3DTest.cpp" />
<ClCompile Include="..\..\Classes\TexturePackerEncryptionTest\TextureAtlasEncryptionTest.cpp" />
<ClCompile Include="..\..\Classes\TileMapTest\TileMapTest2.cpp" />
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\CocosGUIScene.cpp" />
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\CocoStudioGUITest.cpp" />
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\CustomGUIScene.cpp" />
@ -427,6 +428,7 @@
<ClInclude Include="..\..\Classes\SpineTest\SpineTest.h" />
<ClInclude Include="..\..\Classes\Sprite3DTest\Sprite3DTest.h" />
<ClInclude Include="..\..\Classes\TexturePackerEncryptionTest\TextureAtlasEncryptionTest.h" />
<ClInclude Include="..\..\Classes\TileMapTest\TileMapTest2.h" />
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\CocosGUIScene.h" />
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\CocoStudioGUITest.h" />
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\CustomGUIScene.h" />

View File

@ -846,6 +846,9 @@
<ClCompile Include="..\..\Classes\ExtensionsTest\CocoStudioActionTimelineTest\ActionTimelineTestScene.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioActionTimelineTest</Filter>
</ClCompile>
<ClCompile Include="..\..\Classes\TileMapTest\TileMapTest2.cpp">
<Filter>Classes\TileMapTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Classes\AppDelegate.h">
@ -1566,6 +1569,9 @@
<ClInclude Include="..\..\Classes\ExtensionsTest\CocoStudioActionTimelineTest\ActionTimelineTestScene.h">
<Filter>Classes\ExtensionsTest\CocoStudioActionTimelineTest</Filter>
</ClInclude>
<ClInclude Include="..\..\Classes\TileMapTest\TileMapTest2.h">
<Filter>Classes\TileMapTest</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\..\external\curl\prebuilt\wp8\arm\libcurl.dll" />

View File

@ -1,6 +1,5 @@
#include "GameControllerTest.h"
#include "AppMacros.h"
#include "nslog/CCNSLog.h"
#include "ui/CocosGUI.h"
USING_NS_CC;
@ -52,13 +51,11 @@ bool GameControllerTest::init()
_listener = EventListenerController::create();
_listener->onConnected = [=](Controller* controller, Event* event){
CCNSLOG("%p connected", controller);
_player1 = controller;
_statusLabel->setString("controller connected!");
};
_listener->onDisconnected = [=](Controller* controller, Event* event){
CCNSLOG("%p disconnected", controller);
_player1 = nullptr;
_statusLabel->setString("controller disconnected!");
};
@ -86,8 +83,6 @@ bool GameControllerTest::init()
void GameControllerTest::onButtonPressed(cocos2d::Controller *controller, cocos2d::ControllerButtonInput *button, cocos2d::Event *event)
{
CCNSLOG("GameControllerTest::onButtonPressed: %p, %d, %f", button, button->isPressed(), button->getValue());
if (controller == nullptr)
{
return;
@ -149,8 +144,6 @@ void GameControllerTest::onButtonPressed(cocos2d::Controller *controller, cocos2
void GameControllerTest::onButtonReleased(cocos2d::Controller *controller, cocos2d::ControllerButtonInput *button, cocos2d::Event *event)
{
CCNSLOG("GameControllerTest::onButtonReleased: %p, %d, %f", button, button->isPressed(), button->getValue());
if (controller == nullptr)
{
return;

View File

@ -0,0 +1,13 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-10
android.library.reference.1=../../../cocos/platform/android/java

@ -1 +1 @@
Subproject commit b911aa4504bc15b04c8e4cd5719a6c9aebbe9bc6
Subproject commit f0ff6e6eb0c28a1733f086e554bb4fadb91e1cfc