Hi, is it possible to toggle “desktop windowed” mode and “mobile or fullscreen mode” in cocos creator. Example: if i were using an android browser i would like to see my app embebed in a web page. This i am able to do. What i not able to do yet is to change to fullscreen so i could see my app using all the screen resolution. Thanks and sorry for my bad english.
PD: what i am trying to do is what youtube does. Change from a embebed app to a fullscreen app just pressing a button. Thanks.
Something like:
new cc.screen().requestFullScreen(null, () => {
cc.log(‘now fullscreen’);
});
But I do understand that this doesn’t work because I think cc.screen is a singleton. You have to somehow getInstance() of it. Did not figure it out yet.
there is also cc.view.enableAutoFullScreen(true); not exactly sure what it does.
@phero_constructs do you have any input on this one? I’m asking you here, since I noticed earlier that you seem to have good control over Cocos Creator and in the Typescript version of it
new cc.screen().requestFullScreen(null, () => {
cc.log('now fullscreen');
});
leads to: Uncaught TypeError: cc.screen is not a constructor in the browser
if you don’t create a new cc.screen you obviously end up with [ts] Value of type 'typeof screen' is not callable. Did you mean to include 'new'? typescript error.
Not sure how to get the instance of cc.screen the correct way to make it work.
Interesting, it did work from the console and also from the code (triggering it from a button). But seems the Typescript types aren’t up to date since it throws a TS-error for it.
It happens that the TS definition file is not 100% correct.
If you wanna avoid the VS Code error you could write cc.screen['requestFullScreen']() and it won’t complain.