Canvas size less than 100%

Get help using Construct 2

Post » Wed Nov 18, 2015 7:23 pm

How do I get the exported game to show up as a percentage of the window width instead of defaulting to "full?"
I want my canvas to be 53% of the width of the window, and to resize vertically, keeping the correct aspect ratio.

I tried changing the code in the html file, but it doesn't want to listen - it just keeps resetting to full size.

Code: Select all
      jQuery(window).resize(function() {
         var theCanvas = document.getElementById("c2canvas");
         var theWidth = window.innerWidth * .53;
         var theHeight = theWidth * 224/256;
         
         
         cr_sizeCanvas(theWidth, theHeight);
         theCanvas.setAttribute('width', theWidth);
         theCanvas.setAttribute('height', theHeight);
         document.write(window.innerWidth);
         
      });
B
4
Posts: 4
Reputation: 208

Post » Thu Nov 19, 2015 7:31 am

Try using the Sytem object set WindowWidth width/2.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273


Return to How do I....?

Who is online

Users browsing this forum: jhjconstruct, Tuiii and 6 guests