Different view for browser and mobile devices

Different view for browser and mobile devices
0

@slackmoehrle @zzf520 @jare @StudioAMK

it’s possible to landscape view for browser and portrait view for Mobile Devices?
UI


You need to paralally create two scenes one for mobile and one for Web/Desktop deployment and edit them as per your feature set needs and check/uncheck required scenes in your build scene setting while compiling a build. Another possibility is having a common scene for all the platforms and hot load the platform specific assets as per needs(while scene switching or launching by checking the host platfrom). For this to work you might also want to have a layout json containing all the required assets placement information(position and % dt retative to parent nodes) and use that to position your textures after scenes gets loaded(refer here https://docs.cocos2d-x.org/creator/manual/en/components/layout.html)

@Lazy_Gamer @slackmoehrle @jare @StudioAMK @zzf520

How can i mange one canvas for two different Scene UI, Portrait and Landscape ?

Can you be more specific? What strategy you have in mind and What would be your final approach? The abstract of it is defined in my above post. Choose a strategy and start quick experimenting keeping your requirements in mind, if stuck then explain what you have tried and at what point you are encountering the problem. You don’t need to manually manage canvas in a multi-scene UI setup as the canvas would be your default node in both the scene setup. You just need to check/uncheck right scene in build options while compiling the build and a simple check-in you main.js would do the trick.

if(cc.sys.isMobile){
cc.director.loadScene(“My_Mobile_Scene”);
} else if (cc.sys.isBrowser){
cc.director.loadScene(“My_Browser_Scene”);
}

Refer these to get more clearer idea.
https://docs.cocos2d-x.org/api-ref/creator/v1.3/classes/sys.html#property_isBrowser
https://docs.cocos2d-x.org/creator/manual/en/scripting/scene-managing.html
https://docs.cocos2d-x.org/creator/manual/en/asset-workflow/scene-managing.html

1 Like