How do I add my game to responsive website?

Get help using Construct 2

Post » Mon Aug 17, 2015 3:24 pm

For some reason iframe is not good for responsive sites, its aby other metod to add game?
B
110
S
27
G
47
Posts: 1,887
Reputation: 35,799

Post » Mon Aug 17, 2015 9:54 pm

maybe add a <div> with a c2canvasdiv id? and the JavaScript to load it?

Something like:
Code: Select all
<div id="c2canvasdiv">
<canvas id="c2canvas" width="1024" height="768"></canvas>
</div>
<script src="jquery-2.1.1.min.js"></script>
<script src="c2runtime.js"></script>
<script>
      // Size the canvas to fill the browser viewport.
      jQuery(window).resize(function() {
         cr_sizeCanvas(jQuery(window).width(), jQuery(window).height());
      });
      
      // Start the Construct 2 project running on window load.
      jQuery(document).ready(function ()
      {         
         // Create new runtime using the c2canvas
         cr_createRuntime("c2canvas");
      });
      
      // Pause and resume on page becoming visible/invisible
      function onVisibilityChanged() {
         if (document.hidden || document.mozHidden || document.webkitHidden || document.msHidden)
            cr_setSuspended(true);
         else
            cr_setSuspended(false);
      };
      
      document.addEventListener("visibilitychange", onVisibilityChanged, false);
      document.addEventListener("mozvisibilitychange", onVisibilityChanged, false);
      document.addEventListener("webkitvisibilitychange", onVisibilityChanged, false);
      document.addEventListener("msvisibilitychange", onVisibilityChanged, false);
      
    </script>
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830

Post » Tue Aug 18, 2015 5:27 am

@gumshoe2029 i check this we will see
B
110
S
27
G
47
Posts: 1,887
Reputation: 35,799


Return to How do I....?

Who is online

Users browsing this forum: Apollo14 and 39 guests