cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
7.18k stars 1.83k forks source link

Full Screen For Mobile Web #12477

Open arathore-gaming opened 2 years ago

arathore-gaming commented 2 years ago

Use Case

I am working on a mobile web game which will work on browsers like safari, chrome etc. The game looks best when the gam is in full screen

Problem Description

Currently browsers like Safari doesn't provide a simple way to go full screen and chrome has got a simple but diffrent way of full screen

Proposed Solution

Proposed solution is to develop a generic solution within cocos creator to create a simple interface which can be used to go full screen.

For Safari: a Swipe up overlay which will work across diffrent iOS versions For Chrome, etc. - an overlay to touch and go full screen

How it works

No response

Alternatives Considered

Alternatively a plugin can also be introduced for the same but heaving it in cocos creator itself would make more sense

Additional Information

No response

minggo commented 2 years ago

@arathore-gaming how about enter full screen by default? Do you need a way to exit full screen mode?

arathore-gaming commented 2 years ago

@minggo, yes agree -

minggo commented 2 years ago

enter full screen by default (is it possible on iOS safari???)

I am not sure, just collect requirements, then we will do research to finish it.

An event to notify back in code about full screen enter and exit

Yep, i think can reuse resize event.

arathore-gaming commented 2 years ago

I am not sure, just collect requirements, then we will do research to finish it.

Okay, so just checked and the browsers doesn't allow enter full screen by default.

So the req would be - iOS - Swipe to full screen (An overlay to swipe up) & a button to Exit full screen (Dev's should be able to customize Swipe up message) Android & Other OS: Touch to full screen (An overlay on which user can touch to go full screen)

I hope this clarifies the req!

minggo commented 2 years ago

How about add a method named setFullScreen(bool)? Then can just invoke it to enter/exit full screen?

arathore-gaming commented 2 years ago

Just a method won't work as for iOS a swipe up div would be required. The most important part is to create the div with required additional height to achieve a smooth swipe behavior and remove the div as soon as game enters full screen

minggo commented 2 years ago

Is there any documentation about it?

arathore-gaming commented 2 years ago

nope, can't find a document around this requirement