Internet Explorer and Xbox Controller support for games


 

image 

xbox-controller

Internet Explorer Developer Channel went experimental implementation of W3C Gamepad API and you can use your controller to create games on HTML / JavaScript as for Web applications and for Windows 8:

<!DOCTYPE html>
<html>
<head>
<title>Gamepad API Sample</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script> function gameLoop() { var gamepads = navigator.getGamepads(); for (var playerIndex = 0;
playerIndex < gamepads.length; playerIndex++) { var gamepad = gamepads[playerIndex];
if (gamepad) { if (gamepad.buttons[6].pressed || gamepad.buttons[7].pressed)
{
// A trigger is pressed, fire weapon. fireWeapon(playerIndex);
}

} 
} window.requestAnimationFrame(gameLoop); 
} 
gameLoop(); 

</script>
</head>
<body>


If you want to implement gamepad support in the game to HTML5 for Windows 8 now, not waiting for the release of the next version of Internet Explorer, you can use the wrapper over XInput for Javasctipt.

Resources

Windows 8 XInput and JavaScript controller sketch sample

https://code.msdn.microsoft.com/windowsapps/XInput-and-JavaScript-c72fe535

Building games with controller support?

Love to hear from you..

Comments (1)

  1. roee says:

    Any idea when this API will be implemented on the main version ?