Objects don't fit in the browser window

I’m trying to recreate a tutorial for C2 “Memory Match Game”:
scirra.com/tutorials/280/cr … ame/page-1
Now, in part 2 of it when you lay out cards in the native platform, they’re fitting fine, but when you change to web platform you see only part of cards.

I’m using Firefox.
The cards are supposed to readjust their size depending on the browser window size.

Are you sure that events used to resize the cards are not using expressions not available for the web platform? Could you show the events ? :slight_smile:

The problem is that you shall tell the browser somehow to open the game in the window with window size like in the game (640x480), but not in the fullscreen mode with a viewport. In C2 you can do it in the properties of the project (fullscreen Off) but how to do it in GD?

Another question: how to make window of the game for native platform resizable too?

I don’t get your problem.
Games are launched into a canvas that is the size of the “window” specified in GD. This canvas is centered inside the page.
If you activate fullscreen and do not set “keep aspect ratio” to “yes”, the game will take all the space available (and probably be distorted).
If you activate fullscreen and set “keep aspect ratio” to “yes”, the game will take all the width or the height (but won’t be distorted).

In both case (fullscreen or centered), if the size of the game is larger than the window, the canvas will be reduced so that the game fit into the window (and not distorted if you’re not in fullscreen with “keep aspect ratio” to “false”).

So in general, just change nothing (for desktop computers) or just activate fullscreen with aspect ratio kept (for mobile devices) and everything should be nice :slight_smile:

OK, can you try the source and see if you have the same problem and if there is the way to solve it?
memory_match_part4.zip (124 KB)

Works perfectly fine for me. I can see every card in the correct resolution(which you posted above) :slight_smile:

Check a platform you are using for preview: native or web platform. Try to change from one to another (Project manager - Extensions). (There is no problem when the Native platform is selected).

After experimenting a little bit found out that the browser window is opening with the size which it was in the previous session. You need to resize it by mouse to the necessary size (640x480) then the cards will fit fine. Changing the window size or disabling the fullscreen mode in Events have no effect.

Found a workaround for my problem. If I use numbers (640 and 480) instead of expressions SceneWindowWidth() and SceneWindowHeight() everything works fine in web-browser. So, I think there is some bug with those expressions which give you the size of the whole opened browser window instead of the size of your game field.