• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 [Resolved] HTML5 Aspect Ratio Scaling Issues

J

JunoStrker

Guest
After using programs like GDevelop and Construct 2 for my HTML5 needs, I decided to give GameMaker Studio's HTML5 exporter to see how it compares.

UNLIKE GDevelop and Construct 2, when I play the HTML5 file, the size of the play area doesn't scale up or down to fit the screen at all.

Example of one of my games that scales properly.

The game made on GMS that isn't scaling properly.

I've tried searching for a solution online, but most didn't work out the way I needed it to. To be specific, these are the requirements that I need for it to work:

  • I don't care about letterboxing. Black spaces are totally fine. I do not want the player to see past the play area if the frame becomes too wide or too tall.
  • The resizing should be automatic, without needing the player to manually set it. When I upload my other games on itch.io, the games scale up by themselves accordingly when I use the fullscreen function.
  • The graphics and GUI should simply scale along with resizing. Not sure if GMS works like this, but so far from what I can tell, the GUI seems to remain a constant size when implementing some of the suggestions online.
If any further details are needed, like screenshots, examples, clarification, or uploading my file (which might not be possible with my NDA), do let me know.
 
J

JunoStrker

Guest
This tech blog may help you out.
Unfortunately, it does not. Or perhaps I'm doing something wrong. This was one of the first things I found when searching my problem, but it doesn't seem to work.

After putting in the script and following the instructions to the letter and putting it on itch.io, not only does it NOT scale up at all when in fullscreen mode, but exiting fullscreen mode makes it focus on the top left corner of the game screen (presumably) instead of the middle, which results in a black screen.



Note this was using the "SCALING A SINGLE ROOM" section. The 2nd one didn't even work at all, showing me a fully blank screen. The last Fullscreen section wasn't needed, since I don't want to ever crop my game.
 
J

JunoStrker

Guest
Sorry, I forget something... If you want to put it fullscreen you have to run those codes:
Code:
Fullscreen = !Fullscreen;
scr_display_resize();
Browser_W = browser_width;
Browser_H = browser_height;
Here is a GMZ: HTML5_stretch.zip
Found a solution in the forums. Basically just copy-pasted the scripts from the GMZ provided here, and it worked like a charm (after a little tweaking). Consider the issue resolved.
 
Top