0 Favourites

How do I add my game to responsive website?

  • For some reason iframe is not good for responsive sites, its aby other metod to add game?

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

    Something like:

    <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>
    [/code:2h8i8r3g]
  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • gumshoe2029 i check this we will see

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