Airconsole controller maker

0 favourites
From the Asset Store
Small pixel icons for the 3 most popular controller types.
  • arod17pr Try this code :

    // Rewritten version
    	// By @mathias, @cheeaun and @jdalton
    
    	(function (doc) {
    
    		var addEvent = 'addEventListener',
    		type = 'gesturestart',
    		qsa = 'querySelectorAll',
    		scales = [1, 1],
    		meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
    
    		function fix() {
    			meta.content = 'width=device-width,height=device-height,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
    			doc.removeEventListener(type, fix, true);
    		}
    
    		if ((meta = meta[meta.length - 1]) && addEvent in doc) {
    			fix();
    			scales = [.25, 1.6];
    			doc[addEvent](type, fix, true);
    		}
    
    	}
    		(document));
    [/code:2geekdmg]
    
    Put it before [code:2geekdmg]instanceProto.onCreate = function () {[/code:2geekdmg]
    
    If it doesn't work, try adding this code : 
    [code:2geekdmg]
    	$(this.runtime.canvasdiv).width(window.screen.width/2);
    	$(this.runtime.canvasdiv).height(window.screen.height/2);
    [/code:2geekdmg]
    
    After [code:2geekdmg]instanceProto.tick = function () {[/code:2geekdmg]
  • Psychokiller1888 hey and yes i've been using alerts actually. Had issues where despite the alerts popped up the function still didn't work but i figured out how to resolve it by using a state machine.

  • arod17pr Try this code :

    > // Rewritten version
    	// By @mathias, @cheeaun and @jdalton
    
    	(function (doc) {
    
    		var addEvent = 'addEventListener',
    		type = 'gesturestart',
    		qsa = 'querySelectorAll',
    		scales = [1, 1],
    		meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
    
    		function fix() {
    			meta.content = 'width=device-width,height=device-height,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
    			doc.removeEventListener(type, fix, true);
    		}
    
    		if ((meta = meta[meta.length - 1]) && addEvent in doc) {
    			fix();
    			scales = [.25, 1.6];
    			doc[addEvent](type, fix, true);
    		}
    
    	}
    		(document));
    [/code:3ijd6inc]
    
    Put it before [code:3ijd6inc]instanceProto.onCreate = function () {[/code:3ijd6inc]
    
    If it doesn't work, try adding this code : 
    [code:3ijd6inc]
    	$(this.runtime.canvasdiv).width(window.screen.width/2);
    	$(this.runtime.canvasdiv).height(window.screen.height/2);
    [/code:3ijd6inc]
    
    After [code:3ijd6inc]instanceProto.tick = function () {[/code:3ijd6inc]
    

    X3M

    I added them and still does not work. Am I the only one with the problem?

    Thank you for the help!

  • arod17pr No, I've tried it in my prototype and it doesn't scale correctly on iOS but on Android it works great. No idea why though :/

  • Step 3 (3- Run Magicwand.cmd as Administrator. It will do all the work for you.) doesn't work

    Error: "File not found"

  • 3lmanov Have you followed all the steps before running it ? Remember that you should export the controller project first , run Magicwand and then export your screen project.

  • controller project I exported, but still the same inscription(

  • 3lmanov you can try not running as a admin,that worked for me.

  • X3M Any progress on the iPad/iPhone scaling issue? I am also running into this. Has anyone reached out to the Airconsole team? Thanks!

  • Here is the fix for the scaling issue ( after several tests with ) :

    1- Open your controller.html

    2- Replace this portion [Line 4 to Line 40] :

    <meta charset="UTF-8" />
    	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    	<title>Whatever you have</title>
    	
    	<!-- Standardised web app manifest -->
    	<link rel="manifest" href="appmanifest.json" />
    	
    	<!-- Allow fullscreen mode on iOS devices. (These are Apple specific meta tags.) -->
    	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui" />
    	<meta name="apple-mobile-web-app-capable" content="yes" />
    	<meta name="apple-mobile-web-app-status-bar-style" content="black" />
    	<link rel="apple-touch-icon" sizes="256x256" href="icon-256.png" />
    	<meta name="HandheldFriendly" content="true" />
    	
    	<!-- Chrome for Android web app tags -->
    	<meta name="mobile-web-app-capable" content="yes" />
    	<link rel="shortcut icon" sizes="256x256" href="icon-256.png" />
    
        <!-- All margins and padding must be zero for the canvas to fill the screen. -->
    	<style type="text/css">
    		* {
    			padding: 0;
    			margin: 0;
    		}
    		html, body {
    			background: #000;
    			color: #fff;
    			overflow: hidden;
    			touch-action: none;
    			-ms-touch-action: none;
    		}
    		canvas {
    			touch-action-delay: none;
    			touch-action: none;
    			-ms-touch-action: none;
    		}
        </style>[/code:3xqgoayx]
    
    With this : 
    [code:3xqgoayx]<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
      <style type="text/css">
        html, body {
          height: 100%;
          overflow: hidden;
        }
        body {
          background-color: #222;
        }
        button {
          margin-bottom: 1px;
          width: 100%;
          height: 48%;
          border: 0;
          box-sizing: border-box;
          font-size: 40px;
          color: #FFFFFF;
          background-color: #333333;
          outline: none;
        }
      </style>[/code:3xqgoayx]
  • ishmaelmoreno tnx! thats work!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • X3M Thank You!!! for the fix and for the controller plugin! You rock!

  • X3M Ah, the scaling fix is not working for me. I get a js error and the controller continues to scale up and makes it unusable. Error says "Uncaught TypeError: Cannot use 'in' operator to search for '4' in Pause. Any ideas of what I could try? I've tried it using Scale Inner and Scale Outer within Construct2 and neither work correctly for me. I will keep looking at it, but any advice would be much appreciated. Thanks!!

  • StillSarah have you updated to the latest version version of the aiconsole plugin? Cannot use 'in' operator to search error was fixed in version 1.4.8.1.

    https://github.com/AirConsole/airconsole-construct2

  • StillSarah Also set Use HTML Elements to False in the controller plugin properties tab.

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