Setting canvas size changes positioning

0 favourites
  • 11 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • If you use the action 'Set canvas size' to change the size of the canvas, the game won't be horizontally centered anymore in the browser window, but aligned to the left instead.

    <img src="https://dl.dropboxusercontent.com/u/2306601/canvaspos.png" border="0" />

    Just find it irritating and I guess it's unintended behavior. If you have fullscreen set to 'Off' in the project properties, you won't notice this in preview by the way. The exported game will always be aligned to the left though.

    With some manipulation of the exported index.html file this can be countered, but I still thought I'd throw it out there.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Plus one! I gave up trying to manage auto-rotate because of this (thought it was my ineptitude!).

  • Assuming you're talking about exporting with Node-Webkit:

    Construct 2 has just been updated with a bunch of features to move the window position around, so you can realign to the center now I guess :P

  • Assuming you're talking about exporting with Node-Webkit:

    Construct 2 has just been updated with a bunch of features to move the window position around, so you can realign to the center now I guess :P

    I'm afraid I was actually talking about regular HTML5 website export, the issue has nothing to do with Node-Webkit specifically.

  • +1!

  • This has been happening in C2 for quite a while. I've had a long-standing bug report that is still open. Depending on your reason for resizing the canvas, you may be able to get away with using a centered i-frame to display the canvas from another webpage.

  • I am having the same problem. I want to make a menu with predefined resolutions that the user will be able to use if he or she have performance issues, but using the "set canvas size" in combination with letterbox scale aligns the canvas in relation to the top left and not the center of the screen.

    I would have imagined that the set canvas size exists for that reason, yet it renders the whole thing useless since you have to manually scale the browser's window afterwards, in order for the letterbox scale to catch up and realign the project to the center.

    I really want to avoid this for both aesthetic and presentation reasons.

    The iFrame solution that zatyka mentions does not work in my case.

    Example here.

    This behavior is consistent with node web-kit as well.

    Dear Ashley is there a plan to address this issue and, since it has being around for some time now, is there a workaround to this?

  • The biggest problem when we use fullscreen. It would work when we don't use fullscreen, sometimes it's not perfect. :S

  • This has been happening in C2 for quite a while. I've had a long-standing bug report that is still open. Depending on your reason for resizing the canvas, you may be able to get away with using a centered i-frame to display the canvas from another webpage.from April!

  • Oh, I didn't realize there was a long-standing bug report for this. I guess this means I will +1 the question of eli0s:

    Dear Ashley is there a plan to address this issue and, since it has being around for some time now, is there a workaround to this?

  • Any of the sprites I try to load from URL screenshots seem to get doinked on canvas resize.

    My solution is to only let the user go fullscreen from the main menu. I do it before I draw the game board, or load sprites from URL's.

    My only problems seem to stem from trying to set the canvas (or maybe layout?) scale after I have drawn and positioned them on the screen.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)