-
JETeranLikes 0Problem Description
Greetings!
I am following the Flappy Bird in Cocos2d-x and so far so good. But what I came up with is that the background image is not showing completely in the simulator. I am working with the Windows 32 solution, in Visual Studio.
I changed the size of the output, like this
glview = GLViewImpl::createWithRect("SonarFlappyBird", Rect(0, 0, 414, 736)); // so it matches the lastest iPhone
But the image appears with a different size, making a portion of the top and bottom part of the simulator to showing in black.
What should I do? Do I have to use the Android Studio or xCode versions only?
Thanks for your time!
-
Sonar Systems adminLikes 0
Can you show us the rest of the code in the AppDelegate.cpp file
-
JETeranLikes 0
Sure thing, here:
#include "AppDelegate.h" #include "SplashScene.h" USING_NS_CC; AppDelegate::AppDelegate() { } AppDelegate::~AppDelegate() { } //if you want a different context,just modify the value of glContextAttrs //it will takes effect on all platforms void AppDelegate::initGLContextAttrs() { //set OpenGL context attributions,now can only set six attributions: //red,green,blue,alpha,depth,stencil GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8}; GLView::setGLContextAttrs(glContextAttrs); } bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); auto glview = director->getOpenGLView(); if(!glview) { glview = GLViewImpl::createWithRect("SonarFlappyBird", Rect(0, 0, 414, 736)); director->setOpenGLView(glview); } director->getOpenGLView()->setDesignResolutionSize(960, 640, ResolutionPolicy::SHOW_ALL); // turn on display FPS director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this director->setAnimationInterval(1.0 / 60); FileUtils::getInstance()->addSearchPath("res"); // create a scene. it's an autorelease object auto scene = SplashScene::createScene(); // run director->runWithScene(scene); return true; } // This function will be called when the app is inactive. When comes a phone call,it's be invoked too void AppDelegate::applicationDidEnterBackground() { Director::getInstance()->stopAnimation(); // if you use SimpleAudioEngine, it must be pause // SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); } // this function will be called when the app is active again void AppDelegate::applicationWillEnterForeground() { Director::getInstance()->startAnimation(); // if you use SimpleAudioEngine, it must resume here // SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); }
Thanks once again.
-
Sonar Systems adminLikes 0
Have your tried this on Android or iOS?
-
JETeranLikes 0
Hello guys.
I haven’t. I saw your tutorial using the Android Studio, I am going to check it out.
About the Windows version, you think there is nothing we can do about it? I want to continue working the way I am doing and following your guidance through the tutorials
By the way, look also that the information about the app from the lower left corner of the scene, is also small.
Keep having a great one!
-
Sonar Systems adminLikes 0
I’m sure we can sort out the windows side, by seeing if the issue persists on other platforms alows us to work out if its platform specific aka Windows or a general more likely Cocos related issue.
Login to reply