Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss2087-new-event-dispatcher

This commit is contained in:
James Chen 2013-09-19 09:22:31 +08:00
commit e051903b38
10 changed files with 48 additions and 45 deletions

View File

@ -30,7 +30,7 @@ NS_CC_BEGIN
const char* cocos2dVersion()
{
return "3.0-pre-alpha0";
return "3.0-alpha0";
}
NS_CC_END

View File

@ -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

View File

@ -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);

View File

@ -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);
}
//------------------------------------------------------------------

View File

@ -242,7 +242,8 @@
<UniqueIdentifier>{0b414789-7971-4a4c-86e3-40cc00936684}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\PhysicsTest">
<UniqueIdentifier>{a83cb042-e3d6-4d3b-a4f6-30a4b3fcb3e9}</UniqueIdentifier>
<UniqueIdentifier>{a83cb042-e3d6-4d3b-a4f6-30a4b3fcb3e9}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest">
<UniqueIdentifier>{9daecd38-37c6-4216-a999-86077af83beb}</UniqueIdentifier>
</Filter>
@ -631,7 +632,8 @@
<Filter>Classes\NewEventDispatcherTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\PhysicsTest\PhysicsTest.cpp">
<Filter>Classes\PhysicsTest</Filter>
<Filter>Classes\PhysicsTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIButtonTest\UIButtonTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIButtonTest</Filter>
</ClCompile>
@ -1203,7 +1205,8 @@
<Filter>Classes\NewEventDispatcherTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\PhysicsTest\PhysicsTest.h">
<Filter>Classes\PhysicsTest</Filter>
<Filter>Classes\PhysicsTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIButtonTest\UIButtonTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIButtonTest</Filter>
</ClInclude>

View File

@ -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);

View File

@ -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));

View File

@ -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);
};

View File

@ -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;

View File

@ -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;