FlixelCommunity / flixel

Community fork of Adam “Atomic” Saltsman's popular game engine Flixel. Distilled from a variety of Flash games he worked on over the last couple years, including Gravity Hook, Fathom and Canabalt, its primary function is to provide some useful base classes that you can extend to make your own game objects.
http://flixelcommunity.org/
Other
84 stars 17 forks source link

Finish full-screen support #93

Open IQAndreas opened 12 years ago

IQAndreas commented 12 years ago

2c1e5dc790e74b1ebeeb2ccd28a677a640c00f10 introduced a function to trigger full-screen support. The code is not complete, but still requires some way of handling exiting out of full-screen.

IQAndreas commented 12 years ago

I'm not sure what milestone to use. The new function was an enhancement, so it should actually be saved for a future release, but since it's in now, perhaps it's a better idea to "finish the job" in this release.

Dovyski commented 12 years ago

If it's not a complex process, I see no problem if we "finish the job" in this release. However if it takes some deeper analysis, I think we should work on it in the next milestone.

I had no chance to play with Flash fullscreen capabilities so far.

Dovyski commented 11 years ago

I've just found this blog post about Flixel fullscreen mode. It might be useful when working on this issue.

IQAndreas commented 11 years ago

That blog post's method assumes that all objects on the stage are re-positioned whenever the game changes dimensions.

Should we go so far as to add a Flixel equivalent of AS3's scaleMode?

If so, I think it should default to just zooming everything (keeping the same aspect ratio) and "clipping" all objects outside of the visible camera area. That will ensure that if your game is 400x600, even if you go fullscreen, the dimensions will still be the same proportions, and players with different screen sizes won't be affected differently by switching to fullscreen.

Developers could of course manually choose NO_SCALE instead, then handing the positioning of each component manually, just as they would in AS3.

This would add a lot of extra code. Is it better to start with only the default (zooming and clipping), then adding the additional scale modes later.

Dovyski commented 11 years ago

I noticed that too. About the Flixel scaleMode, I think we will end up implementing that in the future. I like your suggestion of implementing the zooming and clipping now and leave all other cases (and possible features) to the future.

The zooming to fit fullscreen state is connected to mobile development using Flixel. Right now, you must use Flash scaleMode to work-around resolution problems. We should discuss that in the future too.

moly commented 11 years ago

There's a port of flixel to a language called Monkey. The author has implemented something similar to scaleMode for it and you can see a demo here: http://lab.devolonter.ru/libs/monkey-flixel/resolutionpolicy/html5.html

It might be worth looking through his code and seeing if it's worth copying any of his ideas: https://github.com/devolonter/flixel-monkey/blob/master/flxg.monkey#L810

IQAndreas commented 10 years ago

There were a few relevant comments added by @noio to this commit:

Dovyski commented 10 years ago

Those comments are really useful. As @noio pointed out, we don`t need to calculate the aspect ratio every frame, we could listen to some events and adjust the aspect ratio accordingly.