HTML and CSS Reference
In-Depth Information
All of the code you will be writing should be added between the <script> tags where the comment is right now.
You're going to have a working demo to actually see the output of the buttons pressed in the browser's JavaScript
console (see Figure 10-3 ).
Figure 10-3. Browser's JavaScript console output
Connecting the Gamepad
There's a special object that is exposed with the list of all connected gamepads, so theoretically you'll be able to
connect more than one and play the game with your friends sitting beside you. Now let's see how to do it. You will first
create a JavaScript object that will store the information about the connected gamepads:
var gamepadAPI = {
controllers: {},
active: false
};
 
Search WWH ::




Custom Search