ENIGMA Forums

General fluff => General ENIGMA => Topic started by: sorlok_reaves on September 10, 2014, 10:20:50 pm

Title: Need some advice on fullscreen + views
Post by: sorlok_reaves on September 10, 2014, 10:20:50 pm
Hello all,

I've got a pretty simple question: what's the "correct" (from a GM point of view) way of saying "make the game fullscreen, and stretch all views to fit"?

Basically, I know that window_set_fullscreen(true) works fine when views are off, but if views are in use then the game screen will never expand to fill the entire window. Is there some magic number for views/ports that causes the views to behave this way, or do I have to resize every view's port to fit the new window size when I trigger fullscreen?

Would appreciate any advice on this.
Title: Re: Need some advice on fullscreen + views
Post by: Goombert on September 10, 2014, 10:27:35 pm
I think you may be thinking of the scaling options, in Unity3D they just fullscreen the application and let the display handle black bars and aspect ratio. In GM they render everything to a surface allegedly which is scaled when it is finally drawn allowing you to emulate and have more control over the behavior of a display. This is a little more tricky though because in ENIGMA someone got the bright idea of making Win32 create two window in order to accomplish this, the embedded window is scaled with the scaling options and the parent window has the black bars. We do not do this on Mac or Linux and currently the scaling options do not work on these platforms. I made an attempt at emulating the scaling through viewports but that doesn't work out so well because there is no way to clip clearing the background color.

This is actually a major issue which needs sorted out so we have the same consistent cross-platform behavior. As I stated before I was more in favor of just fullscreening the application and letting the user do the scaling themselves, but that wouldn't be GM compatible.
Title: Re: Need some advice on fullscreen + views
Post by: Josh @ Dreamland on September 10, 2014, 10:52:51 pm
I'm actually annoyed by the ill-defined, uncustomizable behavior of the engine when the screen size changes. There's no reason to force rendering on a fixed-size canvas to up- or down-scale. I believe GM allowed options to scale or render at (0, 0), which is stupid; why can't we center it? Why can't we allow users to let the card scale the textures and draw the lines as normal? Why can't we offer threshold scaling, eg, take the largest fitting of .5x, 1x, 2x, 3x..., then render it centered? Why not just let the user define the render logic around the drawing size? There are a lot of modes that make sense.

Handling view boundaries for users complicates this, because we logically need to be in charge of that until the user manually assigns to the view variables, which we don't facilitate. So we have the classic UI problem of "how do we scale these widgets?" (here, views). Once we've scaled to get accurate view coordinates, we then have the problem of how we want to project the world onto this space. GM's answer is surfaces; ENIGMA originally let the user handle that, but now, as I understand, also uses surfaces. It's annoying.

Anyway, that concludes my rant. The short version is, I don't have an answer for you because the current answer is ill-specified and generally lousy. Sorry.
Title: Re: Need some advice on fullscreen + views
Post by: sorlok_reaves on September 10, 2014, 11:33:04 pm
Thanks for the comments; seems that full-screen is a lot more complicated than it should be. I can see how views+ports complicates things, and it seems that the new "application_surface" variable in GM just adds to the complexity.

I noticed that the window-within-a-window approach on Win32 breaks down when window_set_region_scale() is used in conjunction with window_set_fullscreen() ---or perhaps it's just my graphics card. Anyway, I think for now I'll just manually resize all the views+ports in Iji when fullscreen mode is activated, since there seems to be no easy answer.
Title: Re: Need some advice on fullscreen + views
Post by: Goombert on September 11, 2014, 10:06:01 am
Sorlok, I believe Josh is basically saying that the way Unity3D does it is best by just using the native scaling with the default frame buffer, and letting you manually scale with surfaces or stuff yourself. This I think honestly should just be the behavior of ENIGMA/GM in my opinion too because there is no one size fits all. For 3D games you really shouldn't be doing any scaling anyway they should in fact just be handled by the display.
Title: Re: Need some advice on fullscreen + views
Post by: sorlok_reaves on September 11, 2014, 10:51:49 am
Yeah, that seems reasonable. Regardless, I'll probably just fake it with Views for Iji.