If you want to to get physics node integration, chipmunk is used by default. But if you want to use box2d for the PhysicsNode extension, you have to set those variables for the preprocessor stage. Turning off chipmunk and turning on box2d.
CC_ENABLE_CHIPMUNK_INTEGRATION=0
CC_ENABLE_BOX2D_INTEGRATION=1
Where you set these depends on the IDE. You can also set them directly in the compiler options with -D as prefix.
E.g. VS you open the project’s propertie’s: Configuration Properties -> C/C++ -> Preprocessor. On the right winow pane you will see Preprocessor Definitions, where you add them.
I’m just using kResolutionFixedHeight here, of yourse you could also use your ResolutionPolicy::NO_BORDER
.
Normally you are just having to do this:
In your main function you set it to your target design resolution, e.g. 640/690
auto glview = director->getOpenGLView();
if (!glview) {
glview = GLView::createWithRect("BHJ", Rect(0, 0, 640, 690));
director->setOpenGLView(glview);
}
In AppMacros.h
you will find some settings you could use.
Just adopt it, if you want to switch between target design resolutions.
#define TARGET_DESIGN_RESOLUTION_SIZE DESIGN_RESOLUTION_640X690
#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_640X690)
static cocos2d::Size designResolutionSize = cocos2d::Size::Size(640, 690);
In your delegate you are scaling down your content to the resolution:
// Set the design resolution; kResolutionFixedHeight if you want a fixed height.
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionFixedHeight);
Or just use a fixed one in AppDelegate.cpp
:
glview->setDesignResolutionSize(640, 690, kResolutionFixedHeight);
You define different designResolutions for your game: e.g. large, medium, small and then scale it to the screen.
This way your coordinates are always the same, but just your assets are scaled.
vector<string> searchPath;
// In this demo, we select resource according to the frame's height.
// If the resource size is different from design resolution size, you need to set contentScaleFactor.
// We use the ratio of resource's height to the height of design resolution,
// this can make sure that the resource's height could fit for the height of design resolution.
// if the frame's height is larger than the height of medium resource size, select large resource.
if (frameSize.width > mediumResource.size.width)
{
searchPath.push_back(largeResource.directory);
director->setContentScaleFactor(largeResource.size.height/designResolutionSize.height);
}
// if the frame's height is larger than the height of small resource size, select medium resource.
else if (frameSize.width > smallResource.size.width)
{
searchPath.push_back(mediumResource.directory);
director->setContentScaleFactor(mediumResource.size.height/designResolutionSize.height);
}
// if the frame's height is smaller than the height of medium resource size, select small resource.
else
{
searchPath.push_back(smallResource.directory);
director->setContentScaleFactor(smallResource.size.height/designResolutionSize.height);
}
// set searching path
FileUtils::sharedFileUtils()->setSearchPaths(searchPath);
Look here for the codesnippets http://www.cocos2d-x.org/wiki/Multi_resolution_support
These warnings are OK. The first one is cause you have set the minimum SDK version to 9, but are using 19. Just set it in your AndroidManifest.xml
: <uses-sdk android:minSdkVersion="19"/>
to get rid of the warning. But remember, that your game is then only compatible with SDK version 19 at minimum
See here http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
The other warning are because you are including the objects from the lib, and so does not need linking.
Look at the quote from here http://stackoverflow.com/questions/22396294/android-ndk-warning-on-compiling-jni-directory-in-r9d
You probably have include $(BUILD_STATIC_LIBRARY) in your Android.mk: this module does not use linker, therefore it does not need LOCAL_LDLIBS neither LOCAL_LDFLAGS. I would not worry about this warning, if this is the only problem in your build.
And he is totally right. No needs to worry about. Hence it is just a warning, so you get reminded about it.