Fixed resolution fullscreen mode


I’ve been unsuccessfully trying to find out how to go to full screen mode using a specified resolution (like for example most AAA games). What I’m trying to achieve is not scaled fullscreen at the current system resolution, but let’s say for example that I want my game to run in 1024x768, then I want the game to go full screen and switch to that resolution independently of what resolution the system is when the game is not running.
Any ideas how can I achieve this?

Marco Lopes

This would be display mode switching, there’s a hidden method (I forget what it’s called… stage.setResolution or stage.resize, something like that) in legacy for this, we need to formalize it in the Lime 2 API for the newer OpenFL code path

Is this the one you’re referring to?

It’s private and seems to be commented out, how can I use this?

This is what your looking for: stage.setResolution(width, height);

That made it full screen, but the resolution seems to be ignored, I tried 1024x768, 1152x648, 1280x720 and 1366x768 (the last three are all resolutions that I can set my system too manually), the resolution the game ran at was always the same.

Any ideas what I might be missing?

Thanks for your reply

That method is deprecated since lime 2.1.3. You need lime 2.1.2 or below with openfl legacy, in order to use Lib.current.stage.setResolution(w,h) and resize(w,h). setResolution changes the display mode for fullscreen, and resize changes the window size when in window mode.

As singmajesty said, this method is not really thoughtful since it does not handle the case when the video card does not support the resolution you are setting etc. I think they are planning on adding this in the lime 2 API with better support.

Ok, that explains it, I have lime 2.1.3. Is this in the roadmap to be implemented soon, or should I try to downgrade to 2.1.2, and use the openfl legacy?

If so, will this affect the existing code in any way? The game is almost finished and I’m basically just creating levels and making platform specific adjustments (such as fullscreen for desktop platforms), I wonder how changing to openfl legacy and lime 2.1.2 will affect the code…
It might be worth to mention that the game started being developed mid 2014, at which point I think lime’s version was probably 2.1.2 or older.

Marco Lopes


Since OpenFL 3.0.0 is still in beta, and your game is developed with legacy and going to be released soon, I suggest that you use the legacy openfl since it’s pretty stable.

The existing code will not be affected much since I’ve heard that OpenFL 3.0 is designed to be as compatible as possible with previous version codes. One thing I have found tho is the render function of OpenGLView, in legacy “render” is a method to override and in 3.0 “render” is a property to set the function to.

For now the only way to switch display mode is to use legacy with lime 2.1.2, or you can wait until the feature comes out soon. You have to manually check if the display mode is compatible tho, for example give 10 seconds after setting the resolution and if user don’t confirm switch it back.