Compilation fix when CC_ENABLE_BOX2D_INTEGRATION is enabled.

This commit is contained in:
James Chen 2014-01-26 18:35:35 +08:00
parent 551f95b83c
commit 23c963cbdc
6 changed files with 16 additions and 12 deletions

View File

@ -17,9 +17,12 @@ Box2DTestLayer::Box2DTestLayer()
, world(NULL) , world(NULL)
{ {
#if CC_ENABLE_BOX2D_INTEGRATION #if CC_ENABLE_BOX2D_INTEGRATION
setTouchEnabled( true ); auto dispatcher = Director::getInstance()->getEventDispatcher();
setAccelerometerEnabled( true );
auto touchListener = EventListenerTouchAllAtOnce::create();
touchListener->onTouchesEnded = CC_CALLBACK_2(Box2DTestLayer::onTouchesEnded, this);
dispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
// init physics // init physics
this->initPhysics(); this->initPhysics();
// create reset button // create reset button

View File

@ -23,7 +23,6 @@ public:
void update(float dt); void update(float dt);
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event); void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
//CREATE_NODE(Box2DTestLayer);
#if CC_ENABLE_BOX2D_INTEGRATION #if CC_ENABLE_BOX2D_INTEGRATION
protected: protected:
kmMat4 _modelViewMV; kmMat4 _modelViewMV;

View File

@ -85,15 +85,16 @@ void ChipmunkTestLayer::toggleDebugCallback(Object* sender)
ChipmunkTestLayer::~ChipmunkTestLayer() ChipmunkTestLayer::~ChipmunkTestLayer()
{ {
#if CC_ENABLE_CHIPMUNK_INTEGRATION
// manually Free rogue shapes // manually Free rogue shapes
for( int i=0;i<4;i++) { for( int i=0;i<4;i++) {
cpShapeFree( _walls[i] ); cpShapeFree( _walls[i] );
} }
cpSpaceFree( _space ); cpSpaceFree( _space );
Device::setAccelerometerEnabled(false);
Device::setAccelerometerEnabled(false);
#endif
} }
void ChipmunkTestLayer::initPhysics() void ChipmunkTestLayer::initPhysics()

View File

@ -1,8 +1,9 @@
// enable log
#define COCOS2D_DEBUG 1
#include "TextureCacheTest.h" #include "TextureCacheTest.h"
// enable log
#define COCOS2D_DEBUG 1
USING_NS_CC; USING_NS_CC;
TextureCacheTest::TextureCacheTest() TextureCacheTest::TextureCacheTest()

View File

@ -1,10 +1,10 @@
// enable log
#define COCOS2D_DEBUG 1
#include "UserDefaultTest.h" #include "UserDefaultTest.h"
#include "stdio.h" #include "stdio.h"
#include "stdlib.h" #include "stdlib.h"
// enable log
#define COCOS2D_DEBUG 1
UserDefaultTest::UserDefaultTest() UserDefaultTest::UserDefaultTest()
{ {
auto s = Director::getInstance()->getWinSize(); auto s = Director::getInstance()->getWinSize();

View File

@ -2,4 +2,4 @@ APP_STL := gnustl_static
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix] # add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9 # in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix -fsigned-char APP_CPPFLAGS := -frtti -DCC_ENABLE_BOX2D_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix -fsigned-char