The result might be that the whole game screen is distorted. Matches the design resolution to the screen but does not keep the aspect ratio. This means that theĬomplete screen will be filled with our game - no borders. The interesting parameter is the last one: ResolutionPolicy::NO_BORDER. The first part of this code setDesignResolutionSize sets the mapping of the defined design resolution size on theĭisplay. SmallResolutionSize.width / designResolutionSize.width)) If (frameSize.height > mediumResolutionSize.height)įileUtils::getInstance()->setSearchPaths() ĭirector->setContentScaleFactor(MIN(smallResolutionSize.height / designResolutionSize.height, if the frame's height is larger than the height of medium size. GlView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, Then your game is started, applicationDidFinishLaunching() is called first. The sizes have to correspond to the scaling variants set up in TexturePacker. Represent the screen sizes scaled down for different devices. The following 3 values smallResolutionSize, mediumResolutionSize and largeResolutionSize This might sound like a problem but since there isĪdditional scaling from the design resolution to the device resolution it's not a real restriction. Trigger sub-pixel rendering on lower resolution devices. Placed on a coordinate that is not divisible by the scaling factor 4 will be placed between pixels and You to measure sizes and positions in your graphics program. I personally prefer using the higher resolution as designResolutionSize because it allows Getting pixel perfect designs working with cocos2d-x is hard - simply because you'll have to deal withĪ bunch of different target sizes - especially if you want to run your game on Android.īut even the iOS devices come with all different sizes and screen ratios. Static ax::Size designResolutionSize = largeResolutionSize Static ax::Size smallResolutionSize = ax::Size(512, 384) // scale factor 0.25 Static ax::Size mediumResolutionSize = ax::Size(1024, 768) // scale factor 0.5 Static ax::Size largeResolutionSize = ax::Size(2048, 1536) // scale factor 1 On the other platforms you want to support from time to time to make sure it runs on all of them. It does not matter which platform you choose for development. Supported development environments - which includes Visual Studio and XCode - and some platform specific code You find a bunch of folders, all starting with the prefix "proj." These folders contain files for the different You could also create games using Lua or Javascript - this Inside the folder, a project is created called Cocos2dx-SpriteSheetTutorial. This line creates a new cocos2d-x project in a subfolder of your home directory called cocos2d-x-games. With a MyProject.xcodeproj that you can open in XCode. when running the command for macOS you'll get a directory called build The result of these commands is a new directory called build that contains the files required toĬompile the project. See Axmol's description on how to build for Android.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |