diff --git a/cocos2dx/cocos2d.cpp b/cocos2dx/cocos2d.cpp index 859af0a34a..2dd8d1b841 100644 --- a/cocos2dx/cocos2d.cpp +++ b/cocos2dx/cocos2d.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN const char* cocos2dVersion() { - return "3.0-pre-alpha0"; + return "3.0-alpha0"; } NS_CC_END diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index 713303d2c7..4ade61819a 100644 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -28,8 +28,8 @@ THE SOFTWARE. #define __COCOS2D_H__ // 0x00 HI ME LO -// 00 02 01 00 -#define COCOS2D_VERSION 0x00020100 +// 00 03 00 00 +#define COCOS2D_VERSION 0x00030000 // // all cocos2d include files diff --git a/cocos2dx/platform/android/nativeactivity.cpp b/cocos2dx/platform/android/nativeactivity.cpp index da63f353de..63846f0ac3 100644 --- a/cocos2dx/platform/android/nativeactivity.cpp +++ b/cocos2dx/platform/android/nativeactivity.cpp @@ -598,9 +598,9 @@ void android_main(struct android_app* state) { // ACONFIGURATION_ORIENTATION_PORT // ACONFIGURATION_ORIENTATION_SQUARE cocos2d::Acceleration acc; - acc.x = event.acceleration.x; - acc.y = event.acceleration.y; - acc.z = event.acceleration.z; + acc.x = event.acceleration.x/10; + acc.y = -event.acceleration.y/10; + acc.z = event.acceleration.z/10; acc.timestamp = 0; cocos2d::AccelerationEvent accEvent(acc); @@ -609,9 +609,9 @@ void android_main(struct android_app* state) { // ACONFIGURATION_ORIENTATION_LAND // swap x and y parameters cocos2d::Acceleration acc; - acc.x = -event.acceleration.y; - acc.y = event.acceleration.x; - acc.z = event.acceleration.z; + acc.x = -event.acceleration.y/10; + acc.y = -event.acceleration.x/10; + acc.z = event.acceleration.z/10; acc.timestamp = 0; cocos2d::AccelerationEvent accEvent(acc); diff --git a/samples/Cpp/TestCpp/Classes/AccelerometerTest/AccelerometerTest.cpp b/samples/Cpp/TestCpp/Classes/AccelerometerTest/AccelerometerTest.cpp index 73f1854947..7fa2e58162 100644 --- a/samples/Cpp/TestCpp/Classes/AccelerometerTest/AccelerometerTest.cpp +++ b/samples/Cpp/TestCpp/Classes/AccelerometerTest/AccelerometerTest.cpp @@ -66,14 +66,16 @@ void AccelerometerTest::onAcceleration(Acceleration* acc, Event* event) auto ballSize = _ball->getContentSize(); - auto ptNow = _ball->getPosition(); + auto ptNow = _ball->getPosition(); + auto ptTemp = pDir->convertToUI(ptNow); - ptNow.x -= acc->x ; - ptNow.y -= acc->y ; + ptTemp.x -= acc->x * 9.81f; + ptTemp.y -= acc->y * 9.81f; - FIX_POS(ptNow.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0)); - FIX_POS(ptNow.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0)); - _ball->setPosition(ptNow); + auto ptNext = pDir->convertToGL(ptTemp); + FIX_POS(ptNext.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0)); + FIX_POS(ptNext.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0)); + _ball->setPosition(ptNext); } //------------------------------------------------------------------ diff --git a/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj.filters b/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj.filters index d02707f9c4..2d24b00d42 100644 --- a/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj.filters +++ b/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj.filters @@ -242,7 +242,8 @@ {0b414789-7971-4a4c-86e3-40cc00936684} - {a83cb042-e3d6-4d3b-a4f6-30a4b3fcb3e9} + {a83cb042-e3d6-4d3b-a4f6-30a4b3fcb3e9} + {9daecd38-37c6-4216-a999-86077af83beb} @@ -631,7 +632,8 @@ Classes\NewEventDispatcherTest - Classes\PhysicsTest + Classes\PhysicsTest + Classes\ExtensionsTest\CocoStudioGUITest\UIButtonTest @@ -1203,7 +1205,8 @@ Classes\NewEventDispatcherTest - Classes\PhysicsTest + Classes\PhysicsTest + Classes\ExtensionsTest\CocoStudioGUITest\UIButtonTest diff --git a/template/multi-platform-cpp/Classes/AppDelegate.cpp b/template/multi-platform-cpp/Classes/AppDelegate.cpp index 27677ac1ad..41659181d6 100644 --- a/template/multi-platform-cpp/Classes/AppDelegate.cpp +++ b/template/multi-platform-cpp/Classes/AppDelegate.cpp @@ -13,8 +13,8 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - Director* director = Director::getInstance(); - EGLView* eglView = EGLView::getInstance(); + auto director = Director::getInstance(); + auto eglView = EGLView::getInstance(); director->setOpenGLView(eglView); @@ -25,7 +25,7 @@ bool AppDelegate::applicationDidFinishLaunching() { director->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object - Scene *scene = HelloWorld::scene(); + auto scene = HelloWorld::createScene(); // run director->runWithScene(scene); diff --git a/template/multi-platform-cpp/Classes/HelloWorldScene.cpp b/template/multi-platform-cpp/Classes/HelloWorldScene.cpp index c2f4896258..9c6f231620 100644 --- a/template/multi-platform-cpp/Classes/HelloWorldScene.cpp +++ b/template/multi-platform-cpp/Classes/HelloWorldScene.cpp @@ -2,13 +2,13 @@ USING_NS_CC; -Scene* HelloWorld::scene() +Scene* HelloWorld::createScene() { // 'scene' is an autorelease object - Scene *scene = Scene::create(); + auto scene = Scene::create(); // 'layer' is an autorelease object - HelloWorld *layer = HelloWorld::create(); + auto layer = HelloWorld::create(); // add layer as a child to scene scene->addChild(layer); @@ -35,16 +35,16 @@ bool HelloWorld::init() // you may modify it. // add a "close" icon to exit the progress. it's an autorelease object - MenuItemImage *closeItem = MenuItemImage::create( - "CloseNormal.png", - "CloseSelected.png", - CC_CALLBACK_1(HelloWorld::menuCloseCallback, this)); + auto closeItem = MenuItemImage::create( + "CloseNormal.png", + "CloseSelected.png", + CC_CALLBACK_1(HelloWorld::menuCloseCallback, this)); closeItem->setPosition(Point(origin.x + visibleSize.width - closeItem->getContentSize().width/2 , origin.y + closeItem->getContentSize().height/2)); // create menu, it's an autorelease object - Menu* menu = Menu::create(closeItem, NULL); + auto menu = Menu::create(closeItem, NULL); menu->setPosition(Point::ZERO); this->addChild(menu, 1); @@ -54,7 +54,7 @@ bool HelloWorld::init() // add a label shows "Hello World" // create and initialize a label - LabelTTF* label = LabelTTF::create("Hello World", "Arial", 24); + auto label = LabelTTF::create("Hello World", "Arial", 24); // position the label on the center of the screen label->setPosition(Point(origin.x + visibleSize.width/2, @@ -64,7 +64,7 @@ bool HelloWorld::init() this->addChild(label, 1); // add "HelloWorld" splash screen" - Sprite* sprite = Sprite::create("HelloWorld.png"); + auto sprite = Sprite::create("HelloWorld.png"); // position the sprite on the center of the screen sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); diff --git a/template/multi-platform-cpp/Classes/HelloWorldScene.h b/template/multi-platform-cpp/Classes/HelloWorldScene.h index 45139f9d67..79ce38afea 100644 --- a/template/multi-platform-cpp/Classes/HelloWorldScene.h +++ b/template/multi-platform-cpp/Classes/HelloWorldScene.h @@ -6,16 +6,16 @@ class HelloWorld : public cocos2d::Layer { public: + // there's no 'id' in cpp, so we recommend returning the class instance pointer + static cocos2d::Scene* createScene(); + // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone virtual bool init(); - - // there's no 'id' in cpp, so we recommend returning the class instance pointer - static cocos2d::Scene* scene(); // a selector callback void menuCloseCallback(Object* pSender); - // implement the "static node()" method manually + // implement the "static create()" method manually CREATE_FUNC(HelloWorld); }; diff --git a/template/multi-platform-cpp/proj.ios/HelloCpp.xcodeproj/project.pbxproj b/template/multi-platform-cpp/proj.ios/HelloCpp.xcodeproj/project.pbxproj index 5bfab9fd8f..66e87292fc 100644 --- a/template/multi-platform-cpp/proj.ios/HelloCpp.xcodeproj/project.pbxproj +++ b/template/multi-platform-cpp/proj.ios/HelloCpp.xcodeproj/project.pbxproj @@ -372,7 +372,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0430; + LastUpgradeCheck = 0500; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloCpp" */; compatibilityVersion = "Xcode 3.2"; @@ -572,7 +572,6 @@ CLANG_CXX_LIBRARY = "libc++"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COMPRESS_PNG_FILES = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; @@ -626,7 +625,6 @@ CLANG_CXX_LIBRARY = "libc++"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COMPRESS_PNG_FILES = NO; COPY_PHASE_STRIP = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -673,11 +671,12 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COMPRESS_PNG_FILES = NO; GCC_C_LANGUAGE_STANDARD = c99; GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; VALID_ARCHS = "armv6 armv7 i386"; }; @@ -686,7 +685,7 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COMPRESS_PNG_FILES = NO; GCC_C_LANGUAGE_STANDARD = c99; GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/template/multi-platform-cpp/proj.mac/HelloCpp.xcodeproj/project.pbxproj b/template/multi-platform-cpp/proj.mac/HelloCpp.xcodeproj/project.pbxproj index da9efca126..cb196c341a 100644 --- a/template/multi-platform-cpp/proj.mac/HelloCpp.xcodeproj/project.pbxproj +++ b/template/multi-platform-cpp/proj.mac/HelloCpp.xcodeproj/project.pbxproj @@ -362,7 +362,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0430; + LastUpgradeCheck = 0500; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloCpp" */; compatibilityVersion = "Xcode 3.2"; @@ -572,11 +572,11 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; @@ -620,11 +620,11 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -664,11 +664,11 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; GCC_C_LANGUAGE_STANDARD = c99; GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; VALID_ARCHS = "x86_64 i386"; }; @@ -677,7 +677,6 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; GCC_C_LANGUAGE_STANDARD = c99; GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES;