From 53be008dcf174584507bf54cbcd3a3bf28728312 Mon Sep 17 00:00:00 2001 From: Edward Zhou Date: Mon, 17 Jun 2013 18:28:12 +0800 Subject: [PATCH 1/6] fix url parse error for 'ws://domain.com/websocket' pattern --- extensions/network/WebSocket.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extensions/network/WebSocket.cpp b/extensions/network/WebSocket.cpp index 18f40d8987..1b61acb054 100644 --- a/extensions/network/WebSocket.cpp +++ b/extensions/network/WebSocket.cpp @@ -281,7 +281,7 @@ bool WebSocket::init(const Delegate& delegate, port = atoi(host.substr(pos+1, host.size()).c_str()); } - pos = host.find("/", pos); + pos = host.find("/", 0); std::string path = "/"; if(pos >= 0){ path += host.substr(pos + 1, host.size()); @@ -290,14 +290,17 @@ bool WebSocket::init(const Delegate& delegate, pos = host.find(":"); if(pos >= 0){ host.erase(pos, host.size()); + }else if((pos = host.find("/"))>=0) { + host.erase(pos, host.size()); } - _host = host; _port = port; _path = path; _SSLConnection = useSSL ? 1 : 0; + CCLOG("[WebSocket::init] _host: %s, _port: %d, _path: %s", _host.c_str(), _port, _path.c_str()); + int protocolCount = 0; if (protocols && protocols->size() > 0) { From 7939c3d73fc35597e78738e7d43d61d53281ec03 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Tue, 18 Jun 2013 15:53:56 +0800 Subject: [PATCH 2/6] Add advertisement type for more Ads plugins. --- plugin/.gitignore | 1 + .../src/org/cocos2dx/plugin/AdsAdmob.java | 10 +++++++++- plugin/plugins/admob/proj.ios/AdsAdmob.h | 1 + plugin/plugins/admob/proj.ios/AdsAdmob.m | 19 ++++++++++++++++--- plugin/protocols/include/ProtocolAds.h | 6 ++++++ .../platform/android/ProtocolAds.cpp | 5 +++++ plugin/protocols/platform/ios/AdsWrapper.h | 1 + plugin/protocols/platform/ios/InterfaceAds.h | 1 + .../src/org/cocos2dx/plugin/AdsWrapper.java | 1 + .../src/org/cocos2dx/plugin/InterfaceAds.java | 1 + .../HelloAds/Classes/HelloWorldScene.cpp | 1 + 11 files changed, 43 insertions(+), 4 deletions(-) diff --git a/plugin/.gitignore b/plugin/.gitignore index 26284a528f..89803f5e7e 100644 --- a/plugin/.gitignore +++ b/plugin/.gitignore @@ -94,4 +94,5 @@ tools/toolsForPublish/environment.sh .settings plugins/china* plugins/punchbox* +plugins/touchpay* samplesPrivate* diff --git a/plugin/plugins/admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java b/plugin/plugins/admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java index 98f524e999..1f5689c465 100644 --- a/plugin/plugins/admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java +++ b/plugin/plugins/admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java @@ -99,6 +99,9 @@ public class AdsAdmob implements InterfaceAds { case AdsWrapper.ADS_TYPE_FULL_SCREEN: LogD("Now not support full screen view in Admob"); break; + case AdsWrapper.ADS_TYPE_MORE_APP: + LogD("Now not support more app ads in Admob"); + break; default: break; } @@ -106,7 +109,7 @@ public class AdsAdmob implements InterfaceAds { @Override public void spendPoints(int points) { - // do nothing, Admob don't have this function + LogD("Admob not support spend points!"); } @Override @@ -261,4 +264,9 @@ public class AdsAdmob implements InterfaceAds { public String getPluginVersion() { return "0.2.0"; } + + @Override + public void queryPoints() { + LogD("Admob not support query points!"); + } } diff --git a/plugin/plugins/admob/proj.ios/AdsAdmob.h b/plugin/plugins/admob/proj.ios/AdsAdmob.h index 50f7de8176..ffebe758d4 100644 --- a/plugin/plugins/admob/proj.ios/AdsAdmob.h +++ b/plugin/plugins/admob/proj.ios/AdsAdmob.h @@ -50,6 +50,7 @@ typedef enum { - (void) configDeveloperInfo: (NSMutableDictionary*) devInfo; - (void) showAds: (int) type size:(int) sizeEnum position:(int) pos; - (void) hideAds: (int) type; +- (void) queryPoints; - (void) spendPoints: (int) points; - (void) setDebugMode: (BOOL) isDebugMode; - (NSString*) getSDKVersion; diff --git a/plugin/plugins/admob/proj.ios/AdsAdmob.m b/plugin/plugins/admob/proj.ios/AdsAdmob.m index 351651c635..f1128e37fc 100644 --- a/plugin/plugins/admob/proj.ios/AdsAdmob.m +++ b/plugin/plugins/admob/proj.ios/AdsAdmob.m @@ -62,10 +62,18 @@ return; } - if (type == kTypeBanner) { + switch (type) { + case kTypeBanner: [self showBanner:sizeEnum atPos:pos]; - } else { + break; + case kTypeFullScreen: OUTPUT_LOG(@"Now not support full screen view in Admob"); + break; + case kTypeMoreApp: + OUTPUT_LOG(@"Now not support more app ads in Admob"); + break; + default: + break; } } @@ -82,9 +90,14 @@ } } +- (void) queryPoints +{ + OUTPUT_LOG(@"Admob not support query points!"); +} + - (void) spendPoints: (int) points { - + OUTPUT_LOG(@"Admob not support spend points!"); } - (void) setDebugMode: (BOOL) isDebugMode diff --git a/plugin/protocols/include/ProtocolAds.h b/plugin/protocols/include/ProtocolAds.h index 4ca675cf1d..f485eb2adb 100644 --- a/plugin/protocols/include/ProtocolAds.h +++ b/plugin/protocols/include/ProtocolAds.h @@ -72,6 +72,7 @@ public: typedef enum { kBannerAd = 0, kFullScreenAd, + kMoreApp, } AdsType; typedef enum { @@ -111,6 +112,11 @@ public: */ void hideAds(AdsType type); + /** + @brief Query the points of player + */ + void queryPoints(); + /** @brief Spend the points. Use this method to notify server spend points. diff --git a/plugin/protocols/platform/android/ProtocolAds.cpp b/plugin/protocols/platform/android/ProtocolAds.cpp index 8bdc34029c..fead515b40 100644 --- a/plugin/protocols/platform/android/ProtocolAds.cpp +++ b/plugin/protocols/platform/android/ProtocolAds.cpp @@ -119,6 +119,11 @@ void ProtocolAds::hideAds(AdsType type) PluginUtils::callJavaFunctionWithName_oneParam(this, "hideAds", "(I)V", type); } +void ProtocolAds::queryPoints() +{ + PluginUtils::callJavaFunctionWithName(this, "queryPoints"); +} + void ProtocolAds::spendPoints(int points) { PluginUtils::callJavaFunctionWithName_oneParam(this, "spendPoints", "(I)V", points); diff --git a/plugin/protocols/platform/ios/AdsWrapper.h b/plugin/protocols/platform/ios/AdsWrapper.h index b8686f2e4f..550c284028 100644 --- a/plugin/protocols/platform/ios/AdsWrapper.h +++ b/plugin/protocols/platform/ios/AdsWrapper.h @@ -41,6 +41,7 @@ typedef enum { typedef enum { kTypeBanner = 0, kTypeFullScreen, + kTypeMoreApp, } AdsTypeEnum; typedef enum { diff --git a/plugin/protocols/platform/ios/InterfaceAds.h b/plugin/protocols/platform/ios/InterfaceAds.h index 7fb01971ed..f15b7ab03d 100644 --- a/plugin/protocols/platform/ios/InterfaceAds.h +++ b/plugin/protocols/platform/ios/InterfaceAds.h @@ -29,6 +29,7 @@ THE SOFTWARE. - (void) configDeveloperInfo: (NSMutableDictionary*) devInfo; - (void) showAds: (int) type size:(int) sizeEnum position:(int) pos; - (void) hideAds: (int) type; +- (void) queryPoints; - (void) spendPoints: (int) points; - (void) setDebugMode: (BOOL) debug; - (NSString*) getSDKVersion; diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java index 42978cad90..cd14e6224f 100644 --- a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java @@ -39,6 +39,7 @@ public class AdsWrapper { public static final int ADS_TYPE_BANNER = 0; public static final int ADS_TYPE_FULL_SCREEN = 1; + public static final int ADS_TYPE_MORE_APP = 2; public static final int POS_CENTER = 0; public static final int POS_TOP = 1; diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAds.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAds.java index 6d7f85f1f9..cd740b9d73 100644 --- a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAds.java +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAds.java @@ -32,6 +32,7 @@ public interface InterfaceAds { public void configDeveloperInfo(Hashtable devInfo); public void showAds(int type, int sizeEnum, int pos); public void hideAds(int type); + public void queryPoints(); public void spendPoints(int points); public void setDebugMode(boolean debug); public String getSDKVersion(); diff --git a/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp b/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp index 27393f1d83..a4949daa1f 100644 --- a/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp +++ b/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp @@ -34,6 +34,7 @@ const std::string s_aTestCases[] = { const std::string s_aTestTypes[] = { "Banner", "Full Screen", + "More App", }; const std::string s_aTestPoses[] = { From ccbd0a831d8d2552e32a673d57b690f50e066d66 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 19 Jun 2013 16:10:53 +0800 Subject: [PATCH 3/6] issue #2304:use function to simplify acceremeter call back --- .../CCLayer.cpp | 8 +- .../layers_scenes_transitions_nodes/CCLayer.h | 2 +- cocos2dx/platform/CCAccelerometerDelegate.h | 11 -- cocos2dx/platform/android/CCAccelerometer.cpp | 12 +- cocos2dx/platform/android/CCAccelerometer.h | 7 +- .../platform/blackberry/CCAccelerometer.cpp | 10 +- .../platform/blackberry/CCAccelerometer.h | 5 +- .../platform/emscripten/CCAccelerometer.h | 7 +- .../ios/AccelerometerDelegateWrapper.h | 43 ------ .../ios/AccelerometerDelegateWrapper.mm | 115 ---------------- cocos2dx/platform/ios/CCAccelerometer.h | 7 +- cocos2dx/platform/ios/CCAccelerometer.mm | 124 ++++++++++++++++-- cocos2dx/platform/ios/CCImage.mm | 27 +--- cocos2dx/platform/linux/CCAccelerometer.h | 7 +- .../platform/marmalade/CCAccelerometer.cpp | 12 +- cocos2dx/platform/marmalade/CCAccelerometer.h | 6 +- cocos2dx/platform/nacl/CCAccelerometer.h | 5 +- cocos2dx/platform/tizen/CCAccelerometer.cpp | 14 +- cocos2dx/platform/tizen/CCAccelerometer.h | 5 +- cocos2dx/platform/win32/CCAccelerometer.cpp | 12 +- cocos2dx/platform/win32/CCAccelerometer.h | 5 +- .../project.pbxproj.REMOVED.git-id | 2 +- extensions/Components/CCInputDelegate.cpp | 4 +- extensions/Components/CCInputDelegate.h | 2 +- 24 files changed, 185 insertions(+), 267 deletions(-) delete mode 100644 cocos2dx/platform/ios/AccelerometerDelegateWrapper.h delete mode 100644 cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index 97a4c93d41..5ecbe61e74 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -235,11 +235,11 @@ void CCLayer::setAccelerometerEnabled(bool enabled) CCDirector* pDirector = CCDirector::sharedDirector(); if (enabled) { - pDirector->getAccelerometer()->setDelegate(this); + pDirector->getAccelerometer()->setDelegate(CC_CALLBACK_1(CCLayer::didAccelerate, this)); } else { - pDirector->getAccelerometer()->setDelegate(NULL); + pDirector->getAccelerometer()->setDelegate(nullptr); } } } @@ -379,7 +379,7 @@ void CCLayer::onEnter() // add this layer to concern the Accelerometer Sensor if (_accelerometerEnabled) { - pDirector->getAccelerometer()->setDelegate(this); + pDirector->getAccelerometer()->setDelegate(CC_CALLBACK_1(CCLayer::didAccelerate, this)); } // add this layer to concern the keypad msg @@ -419,7 +419,7 @@ void CCLayer::onEnterTransitionDidFinish() if (_accelerometerEnabled) { CCDirector* pDirector = CCDirector::sharedDirector(); - pDirector->getAccelerometer()->setDelegate(this); + pDirector->getAccelerometer()->setDelegate(CC_CALLBACK_1(CCLayer::didAccelerate, this)); } CCNode::onEnterTransitionDidFinish(); diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index 08575fa9ce..0b70a8993d 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -60,7 +60,7 @@ All features from CCNode are valid, plus the following new features: - It can receive iPhone Touches - It can receive Accelerometer input */ -class CC_DLL CCLayer : public CCNode, public CCTouchDelegate, public CCAccelerometerDelegate, public CCKeypadDelegate +class CC_DLL CCLayer : public CCNode, public CCTouchDelegate, public CCKeypadDelegate { public: CCLayer(); diff --git a/cocos2dx/platform/CCAccelerometerDelegate.h b/cocos2dx/platform/CCAccelerometerDelegate.h index 584c651cff..aff3ea3629 100644 --- a/cocos2dx/platform/CCAccelerometerDelegate.h +++ b/cocos2dx/platform/CCAccelerometerDelegate.h @@ -43,17 +43,6 @@ public: CCAcceleration(): x(0), y(0), z(0), timestamp(0) {} }; -/** -@brief -The CCAccelerometerDelegate defines a single method for -receiving acceleration-related data from the system. -*/ -class CC_DLL CCAccelerometerDelegate -{ -public: - virtual void didAccelerate(CCAcceleration* pAccelerationValue) {CC_UNUSED_PARAM(pAccelerationValue);} -}; - NS_CC_END #endif diff --git a/cocos2dx/platform/android/CCAccelerometer.cpp b/cocos2dx/platform/android/CCAccelerometer.cpp index ff367e7e2f..9f52331c9f 100644 --- a/cocos2dx/platform/android/CCAccelerometer.cpp +++ b/cocos2dx/platform/android/CCAccelerometer.cpp @@ -32,7 +32,7 @@ THE SOFTWARE. namespace cocos2d { - CCAccelerometer::CCAccelerometer() : _accelDelegate(NULL) + CCAccelerometer::CCAccelerometer() : _function(nullptr) { } @@ -41,11 +41,11 @@ namespace cocos2d } - void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) + void CCAccelerometer::setDelegate(std::function function) { - _accelDelegate = pDelegate; + _function = function; - if (pDelegate) + if (_function) { enableAccelerometerJNI(); } @@ -63,14 +63,14 @@ namespace cocos2d void CCAccelerometer::update(float x, float y, float z, long sensorTimeStamp) { - if (_accelDelegate) + if (_function) { _accelerationValue.x = -((double)x / TG3_GRAVITY_EARTH); _accelerationValue.y = -((double)y / TG3_GRAVITY_EARTH); _accelerationValue.z = -((double)z / TG3_GRAVITY_EARTH); _accelerationValue.timestamp = (double)sensorTimeStamp; - _accelDelegate->didAccelerate(&_accelerationValue); + _function(&_accelerationValue); } } } // end of namespace cococs2d diff --git a/cocos2dx/platform/android/CCAccelerometer.h b/cocos2dx/platform/android/CCAccelerometer.h index f9b1597676..6bffa3b88a 100644 --- a/cocos2dx/platform/android/CCAccelerometer.h +++ b/cocos2dx/platform/android/CCAccelerometer.h @@ -27,21 +27,22 @@ THE SOFTWARE. #include "platform/CCCommon.h" #include "platform/CCAccelerometerDelegate.h" +#include namespace cocos2d { -class CC_DLL CCAccelerometer +class CCAccelerometer { public: CCAccelerometer(); ~CCAccelerometer(); - void setDelegate(CCAccelerometerDelegate* pDelegate); + void setDelegate(std::function function); void setAccelerometerInterval(float interval); void update(float x, float y, float z, long sensorTimeStamp); private: - CCAccelerometerDelegate* _accelDelegate; + std::function _function; CCAcceleration _accelerationValue; }; diff --git a/cocos2dx/platform/blackberry/CCAccelerometer.cpp b/cocos2dx/platform/blackberry/CCAccelerometer.cpp index 0625e41432..0e43237697 100644 --- a/cocos2dx/platform/blackberry/CCAccelerometer.cpp +++ b/cocos2dx/platform/blackberry/CCAccelerometer.cpp @@ -31,7 +31,7 @@ int CCAccelerometer::_initialOrientationAngle = 0; CCAccelerometer::CCAccelerometer() { - _accelDelegate = NULL; + _function = nullptr; _initialOrientationAngle = atoi(getenv("ORIENTATION")); } @@ -40,14 +40,14 @@ CCAccelerometer::~CCAccelerometer() } -void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) +void CCAccelerometer::setDelegate(std::function function) { - _accelDelegate = pDelegate; + _function = function; } void CCAccelerometer::update(long timeStamp, double x, double y, double z) { - if ( _accelDelegate != NULL) + if ( _function != NULL) { if (getenv("WIDTH")) { @@ -81,7 +81,7 @@ void CCAccelerometer::update(long timeStamp, double x, double y, double z) _accelerationValue.z = z; _accelerationValue.timestamp = (double)timeStamp; - _accelDelegate->didAccelerate(&_accelerationValue); + _function(&_accelerationValue); } } diff --git a/cocos2dx/platform/blackberry/CCAccelerometer.h b/cocos2dx/platform/blackberry/CCAccelerometer.h index f84683ade3..37af3981b2 100644 --- a/cocos2dx/platform/blackberry/CCAccelerometer.h +++ b/cocos2dx/platform/blackberry/CCAccelerometer.h @@ -25,6 +25,7 @@ THE SOFTWARE. #ifndef __PLATFORM_CCACCELEROMETER_BLACKBERRY_H__ #define __PLATFORM_CCACCELEROMETER_BLACKBERRY_H__ +#include #include "platform/CCAccelerometerDelegate.h" NS_CC_BEGIN @@ -35,12 +36,12 @@ public: CCAccelerometer(); ~CCAccelerometer(); - void setDelegate(CCAccelerometerDelegate* pDelegate); + void setDelegate(std::function function); void setAccelerometerInterval(float interval) {CC_UNUSED_PARAM(interval);}; void update(long sensorTimeStamp, double x, double y, double z); private: - CCAccelerometerDelegate* _accelDelegate; + std::function _function; CCAcceleration _accelerationValue; static int _initialOrientationAngle; }; diff --git a/cocos2dx/platform/emscripten/CCAccelerometer.h b/cocos2dx/platform/emscripten/CCAccelerometer.h index 0a738fc5de..be806a06ef 100644 --- a/cocos2dx/platform/emscripten/CCAccelerometer.h +++ b/cocos2dx/platform/emscripten/CCAccelerometer.h @@ -9,6 +9,7 @@ #define CCACCELEROMETER_H_ #include "platform/CCAccelerometerDelegate.h" +#include namespace cocos2d { @@ -20,9 +21,9 @@ public: static CCAccelerometer* sharedAccelerometer() { return NULL; }; - void removeDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; - void addDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; - void setDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; + void removeDelegate(std::function function) {CC_UNUSED_PARAM(function);}; + void addDelegate(std::function function) {CC_UNUSED_PARAM(function);}; + void setDelegate(std::function function) {CC_UNUSED_PARAM(function);}; void setAccelerometerInterval(float interval) {CC_UNUSED_PARAM(interval);}; }; diff --git a/cocos2dx/platform/ios/AccelerometerDelegateWrapper.h b/cocos2dx/platform/ios/AccelerometerDelegateWrapper.h deleted file mode 100644 index fc0c18bd29..0000000000 --- a/cocos2dx/platform/ios/AccelerometerDelegateWrapper.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** - Copyright (c) 2010 cocos2d-x.org - - 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. - ****************************************************************************/ - -#import -#import "CCAccelerometerDelegate.h" -#import - -@interface AccelerometerDispatcher : NSObject -{ - cocos2d::CCAccelerometerDelegate *delegate_; - cocos2d::CCAcceleration *acceleration_; -} - -@property(readwrite) cocos2d::CCAccelerometerDelegate *delegate_; -@property(readwrite) cocos2d::CCAcceleration *acceleration_; - -+ (id) sharedAccelerometerDispather; -- (id) init; -- (void) addDelegate: (cocos2d::CCAccelerometerDelegate *) delegate; -- (void) setAccelerometerInterval:(float)interval; - -@end diff --git a/cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm b/cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm deleted file mode 100644 index f219e4cdb6..0000000000 --- a/cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - Copyright (c) 2010 cocos2d-x.org - - 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. - ****************************************************************************/ - -#import "AccelerometerDelegateWrapper.h" - -@implementation AccelerometerDispatcher - -static AccelerometerDispatcher* s_pAccelerometerDispatcher; - -@synthesize delegate_; -@synthesize acceleration_; - -+ (id) sharedAccelerometerDispather -{ - if (s_pAccelerometerDispatcher == nil) { - s_pAccelerometerDispatcher = [[self alloc] init]; - } - - return s_pAccelerometerDispatcher; -} - -- (id) init -{ - acceleration_ = new cocos2d::CCAcceleration(); - return self; -} - -- (void) dealloc -{ - s_pAccelerometerDispatcher = 0; - delegate_ = 0; - delete acceleration_; - [super dealloc]; -} - -- (void) addDelegate: (cocos2d::CCAccelerometerDelegate *) delegate -{ - delegate_ = delegate; - - if (delegate_) - { - [[UIAccelerometer sharedAccelerometer] setDelegate:self]; - } - else - { - [[UIAccelerometer sharedAccelerometer] setDelegate:nil]; - } -} - --(void) setAccelerometerInterval:(float)interval -{ - [[UIAccelerometer sharedAccelerometer] setUpdateInterval:interval]; -} - -- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration -{ - if (! delegate_) - { - return; - } - - acceleration_->x = acceleration.x; - acceleration_->y = acceleration.y; - acceleration_->z = acceleration.z; - acceleration_->timestamp = acceleration.timestamp; - - double tmp = acceleration_->x; - - switch ([[UIApplication sharedApplication] statusBarOrientation]) - { - case UIInterfaceOrientationLandscapeRight: - acceleration_->x = -acceleration_->y; - acceleration_->y = tmp; - break; - - case UIInterfaceOrientationLandscapeLeft: - acceleration_->x = acceleration_->y; - acceleration_->y = -tmp; - break; - - case UIInterfaceOrientationPortraitUpsideDown: - acceleration_->x = -acceleration_->y; - acceleration_->y = -tmp; - break; - - case UIInterfaceOrientationPortrait: - break; - } - - delegate_->didAccelerate(acceleration_); -} - -@end - diff --git a/cocos2dx/platform/ios/CCAccelerometer.h b/cocos2dx/platform/ios/CCAccelerometer.h index c5274fb7cb..c8011bc169 100644 --- a/cocos2dx/platform/ios/CCAccelerometer.h +++ b/cocos2dx/platform/ios/CCAccelerometer.h @@ -25,17 +25,18 @@ THE SOFTWARE. #ifndef __PLATFORM_IPHONE_CCACCELEROMETER_H__ #define __PLATFORM_IPHONE_CCACCELEROMETER_H__ +#include #include "platform/CCAccelerometerDelegate.h" NS_CC_BEGIN -class CC_DLL CCAccelerometer +class CCAccelerometer { public: CCAccelerometer(); ~CCAccelerometer(); - - void setDelegate(CCAccelerometerDelegate* pDelegate); + + void setDelegate(std::function function); void setAccelerometerInterval(float interval); }; diff --git a/cocos2dx/platform/ios/CCAccelerometer.mm b/cocos2dx/platform/ios/CCAccelerometer.mm index 8ffaa4f2c4..d87ffdfbca 100644 --- a/cocos2dx/platform/ios/CCAccelerometer.mm +++ b/cocos2dx/platform/ios/CCAccelerometer.mm @@ -23,21 +23,124 @@ ****************************************************************************/ #include "CCAccelerometer.h" -#include "AccelerometerDelegateWrapper.h" + +#import +#import "CCAccelerometerDelegate.h" +#import +#import + +@interface AccelerometerDispatcher : NSObject +{ + std::function _function; + cocos2d::CCAcceleration *_acceleration; +} + ++ (id) sharedAccelerometerDispather; +- (id) init; +- (void) addDelegate: (std::function) function; +- (void) setAccelerometerInterval:(float)interval; + +@end + +@implementation AccelerometerDispatcher + +static AccelerometerDispatcher* s_pAccelerometerDispatcher; + ++ (id) sharedAccelerometerDispather +{ + if (s_pAccelerometerDispatcher == nil) { + s_pAccelerometerDispatcher = [[self alloc] init]; + } + + return s_pAccelerometerDispatcher; +} + +- (id) init +{ + _acceleration = new cocos2d::CCAcceleration(); + return self; +} + +- (void) dealloc +{ + s_pAccelerometerDispatcher = nullptr; + _function = nullptr; + delete _acceleration; + [super dealloc]; +} + +- (void) addDelegate: (std::function) function +{ + _function = function; + + if (_function) + { + [[UIAccelerometer sharedAccelerometer] setDelegate:self]; + } + else + { + [[UIAccelerometer sharedAccelerometer] setDelegate:nil]; + } +} + +-(void) setAccelerometerInterval:(float)interval +{ + [[UIAccelerometer sharedAccelerometer] setUpdateInterval:interval]; +} + +- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration +{ + if (! _function) + { + return; + } + + _acceleration->x = acceleration.x; + _acceleration->y = acceleration.y; + _acceleration->z = acceleration.z; + _acceleration->timestamp = acceleration.timestamp; + + double tmp = _acceleration->x; + + switch ([[UIApplication sharedApplication] statusBarOrientation]) + { + case UIInterfaceOrientationLandscapeRight: + _acceleration->x = -_acceleration->y; + _acceleration->y = tmp; + break; + + case UIInterfaceOrientationLandscapeLeft: + _acceleration->x = _acceleration->y; + _acceleration->y = -tmp; + break; + + case UIInterfaceOrientationPortraitUpsideDown: + _acceleration->x = -_acceleration->y; + _acceleration->y = -tmp; + break; + + case UIInterfaceOrientationPortrait: + break; + } + + _function(_acceleration); +} + +@end + +/** Implementation of CCAccelerometer + */ NS_CC_BEGIN - -CCAccelerometer::CCAccelerometer() -{ -} -CCAccelerometer::~CCAccelerometer() -{ -} -void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) +CCAccelerometer::CCAccelerometer() {} + +CCAccelerometer::~CCAccelerometer() {} + +void CCAccelerometer::setDelegate(std::function function) { - [[AccelerometerDispatcher sharedAccelerometerDispather] addDelegate:pDelegate]; + [[AccelerometerDispatcher sharedAccelerometerDispather] addDelegate:function]; } void CCAccelerometer::setAccelerometerInterval(float interval) @@ -46,4 +149,3 @@ void CCAccelerometer::setAccelerometerInterval(float interval) } NS_CC_END - diff --git a/cocos2dx/platform/ios/CCImage.mm b/cocos2dx/platform/ios/CCImage.mm index dd996746f6..a07b4a363b 100644 --- a/cocos2dx/platform/ios/CCImage.mm +++ b/cocos2dx/platform/ios/CCImage.mm @@ -123,29 +123,6 @@ static bool _initWithImage(CGImageRef cgImage, tImageInfo *pImageinfo) return true; } -static bool _initWithFile(const char* path, tImageInfo *pImageinfo) -{ - CGImageRef CGImage; - UIImage *jpg; - UIImage *png; - bool ret; - - // convert jpg to png before loading the texture - - NSString *fullPath = [NSString stringWithUTF8String:path]; - jpg = [[UIImage alloc] initWithContentsOfFile: fullPath]; - png = [[UIImage alloc] initWithData:UIImagePNGRepresentation(jpg)]; - CGImage = png.CGImage; - - ret = _initWithImage(CGImage, pImageinfo); - - [png release]; - [jpg release]; - - return ret; -} - - static bool _initWithData(void * pBuffer, int length, tImageInfo *pImageinfo) { bool ret = false; @@ -482,7 +459,7 @@ bool CCImage::initWithImageData(void * pData, CC_BREAK_IF(! pData || nDataLen <= 0); if (eFmt == kFmtRawData) { - bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent, false); + bRet = initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent, false); } else if (eFmt == kFmtWebp) { @@ -506,7 +483,7 @@ bool CCImage::initWithImageData(void * pData, return bRet; } -bool CCImage::_initWithRawData(void *pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent, bool bPreMulti) +bool CCImage::initWithRawData(void *pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent, bool bPreMulti) { bool bRet = false; do diff --git a/cocos2dx/platform/linux/CCAccelerometer.h b/cocos2dx/platform/linux/CCAccelerometer.h index 0a738fc5de..be806a06ef 100644 --- a/cocos2dx/platform/linux/CCAccelerometer.h +++ b/cocos2dx/platform/linux/CCAccelerometer.h @@ -9,6 +9,7 @@ #define CCACCELEROMETER_H_ #include "platform/CCAccelerometerDelegate.h" +#include namespace cocos2d { @@ -20,9 +21,9 @@ public: static CCAccelerometer* sharedAccelerometer() { return NULL; }; - void removeDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; - void addDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; - void setDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; + void removeDelegate(std::function function) {CC_UNUSED_PARAM(function);}; + void addDelegate(std::function function) {CC_UNUSED_PARAM(function);}; + void setDelegate(std::function function) {CC_UNUSED_PARAM(function);}; void setAccelerometerInterval(float interval) {CC_UNUSED_PARAM(interval);}; }; diff --git a/cocos2dx/platform/marmalade/CCAccelerometer.cpp b/cocos2dx/platform/marmalade/CCAccelerometer.cpp index 7017cf6d9e..14fb5a7302 100644 --- a/cocos2dx/platform/marmalade/CCAccelerometer.cpp +++ b/cocos2dx/platform/marmalade/CCAccelerometer.cpp @@ -30,7 +30,7 @@ namespace cocos2d CCAccelerometer* CCAccelerometer::_spCCAccelerometer = NULL; -CCAccelerometer::CCAccelerometer() : _accelDelegate(NULL) +CCAccelerometer::CCAccelerometer() : _function(nullptr) { } @@ -53,11 +53,11 @@ CCAccelerometer* CCAccelerometer::sharedAccelerometer() return _spCCAccelerometer; } -void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) +void CCAccelerometer::setDelegate(std::function function) { - _accelDelegate = pDelegate; + _function = function; - if (pDelegate) + if (_function) { if (s3eAccelerometerStart() != S3E_RESULT_SUCCESS) { @@ -72,14 +72,14 @@ void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) void CCAccelerometer::update(float x, float y, float z, uint64 sensorTimeStamp) { - if (_accelDelegate) + if (_function) { _accelerationValue.x = ((double)x)/S3E_ACCELEROMETER_1G ; _accelerationValue.y = ((double)y)/S3E_ACCELEROMETER_1G ; _accelerationValue.z = ((double)z)/S3E_ACCELEROMETER_1G ; _accelerationValue.timestamp = (double)(sensorTimeStamp / 1000.0); - _accelDelegate->didAccelerate(&_accelerationValue); + _function(&_accelerationValue); } } diff --git a/cocos2dx/platform/marmalade/CCAccelerometer.h b/cocos2dx/platform/marmalade/CCAccelerometer.h index b2bd704e9b..0a4ea0a9d3 100644 --- a/cocos2dx/platform/marmalade/CCAccelerometer.h +++ b/cocos2dx/platform/marmalade/CCAccelerometer.h @@ -27,7 +27,7 @@ #include "CCAccelerometerDelegate.h" //#include "CCMutableArray.h" #include "ccCommon.h" - +#include namespace cocos2d { @@ -47,13 +47,13 @@ public: */ static CCAccelerometer* sharedAccelerometer(); - void setDelegate(CCAccelerometerDelegate* pDelegate); + void setDelegate(std::function function); void setAccelerometerInterval(float interval) {CC_UNUSED_PARAM(interval);}; void update(float x, float y, float z, uint64 sensorTimeStamp); private: static CCAccelerometer* _spCCAccelerometer; - CCAccelerometerDelegate* _accelDelegate; + std::function _function; CCAcceleration _accelerationValue; }; diff --git a/cocos2dx/platform/nacl/CCAccelerometer.h b/cocos2dx/platform/nacl/CCAccelerometer.h index a64e33cdeb..7a477a7e20 100644 --- a/cocos2dx/platform/nacl/CCAccelerometer.h +++ b/cocos2dx/platform/nacl/CCAccelerometer.h @@ -26,6 +26,7 @@ THE SOFTWARE. #define __CCACCELEROMETER_H__ #include "platform/CCAccelerometerDelegate.h" +#include namespace cocos2d { @@ -37,8 +38,8 @@ public: static CCAccelerometer* sharedAccelerometer() { return NULL; }; - void removeDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; - void addDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; + void removeDelegate(std::function function) {CC_UNUSED_PARAM(function);}; + void addDelegate(std::function function) {CC_UNUSED_PARAM(function);}; void setDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; void setAccelerometerInterval(float interval) {CC_UNUSED_PARAM(interval);}; }; diff --git a/cocos2dx/platform/tizen/CCAccelerometer.cpp b/cocos2dx/platform/tizen/CCAccelerometer.cpp index 71e282907d..5f1d4b97c5 100644 --- a/cocos2dx/platform/tizen/CCAccelerometer.cpp +++ b/cocos2dx/platform/tizen/CCAccelerometer.cpp @@ -30,8 +30,8 @@ using namespace Tizen::Uix::Sensor; NS_CC_BEGIN CCAccelerometer::CCAccelerometer() - : _accelDelegate(NULL) - , __sensorMgr(NULL) + : _function(nullptr) + , __sensorMgr(nullptr) { } @@ -40,11 +40,11 @@ CCAccelerometer::~CCAccelerometer() } -void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) +void CCAccelerometer::setDelegate(std::function function) { - _accelDelegate = pDelegate; + _function = function; - if (pDelegate) + if (_function) { startSensor(); } @@ -97,7 +97,7 @@ void CCAccelerometer::stopSensor() void CCAccelerometer::OnDataReceived(SensorType sensorType, SensorData& sensorData , result r) { - if (_accelDelegate) + if (_function) { AccelerationSensorData& data = static_cast(sensorData); AppLog("AccelerationSensorData x = %5.4f , y = %5.4f, z = %5.4f ", data.x,data.y,data.z); @@ -107,7 +107,7 @@ void CCAccelerometer::OnDataReceived(SensorType sensorType, SensorData& sensorDa _accelerationValue.z = -data.z; _accelerationValue.timestamp = data.timestamp; - _accelDelegate->didAccelerate(&_accelerationValue); + _function(&_accelerationValue); } } diff --git a/cocos2dx/platform/tizen/CCAccelerometer.h b/cocos2dx/platform/tizen/CCAccelerometer.h index 744a982ad7..9e225e33f2 100644 --- a/cocos2dx/platform/tizen/CCAccelerometer.h +++ b/cocos2dx/platform/tizen/CCAccelerometer.h @@ -29,6 +29,7 @@ THE SOFTWARE. #include "platform/CCCommon.h" #include "platform/CCAccelerometerDelegate.h" #include +#include NS_CC_BEGIN @@ -38,7 +39,7 @@ public: CCAccelerometer(); ~CCAccelerometer(); - void setDelegate(CCAccelerometerDelegate* pDelegate); + void setDelegate(std::function function); void setAccelerometerInterval(float interval); void startSensor(); void stopSensor(); @@ -46,7 +47,7 @@ public: virtual void OnDataReceived(Tizen::Uix::Sensor::SensorType sensorType, Tizen::Uix::Sensor::SensorData& sensorData , result r); private: - CCAccelerometerDelegate* _accelDelegate; + std::function _function; CCAcceleration _accelerationValue; Tizen::Uix::Sensor::SensorManager* __sensorMgr; }; diff --git a/cocos2dx/platform/win32/CCAccelerometer.cpp b/cocos2dx/platform/win32/CCAccelerometer.cpp index d4461c56f1..b8757c359a 100644 --- a/cocos2dx/platform/win32/CCAccelerometer.cpp +++ b/cocos2dx/platform/win32/CCAccelerometer.cpp @@ -148,7 +148,7 @@ namespace NS_CC_BEGIN CCAccelerometer::CCAccelerometer() : - _accelDelegate(NULL) + _function(nullptr) { memset(&_accelerationValue, 0, sizeof(_accelerationValue)); } @@ -158,14 +158,14 @@ CCAccelerometer::~CCAccelerometer() } -void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) +void CCAccelerometer::setDelegate(std::function function) { - _accelDelegate = pDelegate; + _function = function; // Enable/disable the accelerometer. // Well, there isn't one on Win32 so we don't do anything other than register // and deregister ourselves from the Windows Key handler. - if (pDelegate) + if (_function) { // Register our handler CCEGLView::sharedOpenGLView()->setAccelerometerKeyHook( &myAccelerometerKeyHook ); @@ -185,7 +185,7 @@ void CCAccelerometer::setAccelerometerInterval(float interval) void CCAccelerometer::update( double x,double y,double z,double timestamp ) { - if (_accelDelegate) + if (_function) { _accelerationValue.x = x; _accelerationValue.y = y; @@ -193,7 +193,7 @@ void CCAccelerometer::update( double x,double y,double z,double timestamp ) _accelerationValue.timestamp = timestamp; // Delegate - _accelDelegate->didAccelerate(&_accelerationValue); + _function(&_accelerationValue); } } diff --git a/cocos2dx/platform/win32/CCAccelerometer.h b/cocos2dx/platform/win32/CCAccelerometer.h index 66dec38a41..5de77a7228 100644 --- a/cocos2dx/platform/win32/CCAccelerometer.h +++ b/cocos2dx/platform/win32/CCAccelerometer.h @@ -26,6 +26,7 @@ THE SOFTWARE. #define __PLATFORM_WIN32_UIACCELEROMETER_H__ #include "platform/CCAccelerometerDelegate.h" +#include NS_CC_BEGIN @@ -35,12 +36,12 @@ public: CCAccelerometer(); ~CCAccelerometer(); - void setDelegate(CCAccelerometerDelegate* pDelegate); + void setDelegate(std::function function); void setAccelerometerInterval(float interval); void update( double x,double y,double z,double timestamp ); private: CCAcceleration _accelerationValue; - CCAccelerometerDelegate* _accelDelegate; + std::function _function; }; NS_CC_END diff --git a/cocos2dx/proj.ios/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id b/cocos2dx/proj.ios/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id index 481079f24d..96fb4148fa 100644 --- a/cocos2dx/proj.ios/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/cocos2dx/proj.ios/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -06a3716ff2fdcaa883bed71ffe53793daf0f3980 \ No newline at end of file +08c5c5cd8dcd5b6d72678c72cd156682e33f8553 \ No newline at end of file diff --git a/extensions/Components/CCInputDelegate.cpp b/extensions/Components/CCInputDelegate.cpp index e92d3f1862..5a58b70b42 100644 --- a/extensions/Components/CCInputDelegate.cpp +++ b/extensions/Components/CCInputDelegate.cpp @@ -174,11 +174,11 @@ void CCInputDelegate::setAccelerometerEnabled(bool enabled) CCDirector* pDirector = CCDirector::sharedDirector(); if (enabled) { - pDirector->getAccelerometer()->setDelegate(this); + pDirector->getAccelerometer()->setDelegate(CC_CALLBACK_1(CCInputDelegate::didAccelerate, this)); } else { - pDirector->getAccelerometer()->setDelegate(NULL); + pDirector->getAccelerometer()->setDelegate(nullptr); } } } diff --git a/extensions/Components/CCInputDelegate.h b/extensions/Components/CCInputDelegate.h index c3758bbe88..b067de5d24 100644 --- a/extensions/Components/CCInputDelegate.h +++ b/extensions/Components/CCInputDelegate.h @@ -30,7 +30,7 @@ THE SOFTWARE. NS_CC_EXT_BEGIN -class CCInputDelegate : public CCTouchDelegate, public CCAccelerometerDelegate, public CCKeypadDelegate +class CCInputDelegate : public CCTouchDelegate, public CCKeypadDelegate { protected: CCInputDelegate(void); From 776efaf458b03382ce34cd29081c2e131e258437 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Wed, 19 Jun 2013 16:41:15 +0800 Subject: [PATCH 4/6] Adjust ProtocolAds for more Ads plugins. --- .../admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java | 4 ++-- plugin/protocols/include/ProtocolAds.h | 4 ++-- plugin/protocols/platform/ios/AdsWrapper.h | 4 ++-- .../proj.android/src/org/cocos2dx/plugin/AdsWrapper.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugin/plugins/admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java b/plugin/plugins/admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java index 1f5689c465..d69ccf83c4 100644 --- a/plugin/plugins/admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java +++ b/plugin/plugins/admob/proj.android/src/org/cocos2dx/plugin/AdsAdmob.java @@ -216,7 +216,7 @@ public class AdsAdmob implements InterfaceAds { @Override public void onDismissScreen(Ad arg0) { LogD("onDismissScreen invoked"); - AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_FullScreenViewDismissed, "Full screen ads view dismissed!"); + AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_AdsDismissed, "Ads view dismissed!"); } @Override @@ -250,7 +250,7 @@ public class AdsAdmob implements InterfaceAds { @Override public void onPresentScreen(Ad arg0) { LogD("onPresentScreen invoked"); - AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_FullScreenViewShown, "Full screen ads view shown!"); + AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_AdsShown, "Ads view shown!"); } @Override diff --git a/plugin/protocols/include/ProtocolAds.h b/plugin/protocols/include/ProtocolAds.h index f485eb2adb..2d2393c74f 100644 --- a/plugin/protocols/include/ProtocolAds.h +++ b/plugin/protocols/include/ProtocolAds.h @@ -36,8 +36,8 @@ typedef enum { kAdsReceived = 0, // The ad is received - kFullScreenViewShown, // The full screen advertisement shown - kFullScreenViewDismissed, // The full screen advertisement dismissed + kAdsShown, // The advertisement shown + kAdsDismissed, // The advertisement dismissed kPointsSpendSucceed, // The points spend succeed kPointsSpendFailed, // The points spend failed diff --git a/plugin/protocols/platform/ios/AdsWrapper.h b/plugin/protocols/platform/ios/AdsWrapper.h index 550c284028..ff7d176835 100644 --- a/plugin/protocols/platform/ios/AdsWrapper.h +++ b/plugin/protocols/platform/ios/AdsWrapper.h @@ -28,8 +28,8 @@ THE SOFTWARE. typedef enum { kAdsReceived = 0, - kFullScreenViewShown, - kFullScreenViewDismissed, + kAdsShown, + kAdsDismissed, kPointsSpendSucceed, kPointsSpendFailed, diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java index cd14e6224f..6803baa0d2 100644 --- a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java @@ -30,8 +30,8 @@ import android.view.WindowManager; public class AdsWrapper { public static final int RESULT_CODE_AdsReceived = 0; // The ad is received - public static final int RESULT_CODE_FullScreenViewShown = 1; // The full screen advertisement shown - public static final int RESULT_CODE_FullScreenViewDismissed = 2; // The full screen advertisement dismissed + public static final int RESULT_CODE_AdsShown = 1; // The advertisement shown + public static final int RESULT_CODE_AdsDismissed = 2; // The advertisement dismissed public static final int RESULT_CODE_PointsSpendSucceed = 3; // The points spend succeed public static final int RESULT_CODE_PointsSpendFailed = 4; // The points spend failed public static final int RESULT_CODE_NetworkError = 5; // Network error From bcd2701b843313b32231073513c0027589644f09 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 19 Jun 2013 20:05:38 +0800 Subject: [PATCH 5/6] Update AUTHORS [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 883419881f..4e5f15795f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -474,6 +474,7 @@ Developers: edwardzhou (Edward Zhou) Correcting the type detecting order for Lua CCBProxy::getNodeTypeName. Casting variables to their own type, and print warning info if no corresponding lua callback function instead of crash. + fix of WebSocket url parse error for 'ws://domain.com/websocket' pattern. musikov Fixing a bug that missing precision when getting strokeColor and fontFillColor From 76188585b85b0ddaae01e8170df999f486d333d5 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 19 Jun 2013 21:10:34 +0900 Subject: [PATCH 6/6] [emscripten] Updating .travis.yml, export environment variables for emscripten port. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 39a3229ee6..e5eaaee8f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,9 @@ script: - export NACL_SDK_ROOT=$HOME/bin/nacl_sdk/pepper_canary - export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin - export NDK_ROOT=$HOME/bin/android-ndk +- export PYTHON=/usr/bin/python +- export LLVM=$HOME/bin/clang+llvm-3.2/bin +- export LLVM_ROOT=$LLVM - ./tools/travis-scripts/run-script.sh before_install: