HTML and CSS Reference
In-Depth Information
}
return Q;
};
};
This code takes only one parameter, a boolean option about whether to turn on the joypad or just use the
keypad.
Next, this code needs to be tested. Create a file called input_test.html and fill in the code from Listing 10-9 .
Listing 10-9: input_test.html input test
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Input Test</title>
<meta name='viewport' content='width=device-width,
user-scalable=no'>
<script src='jquery.min.js'></script>
<script src='underscore.js'></script>
<script src='quintus.js'></script>
<script src='quintus_input.js'></script>
</head>
<body>
<script>
var Q = Quintus()
.include("Input")
.setup("quintus",{ "maximize": true })
.controls(true);
Q.input.bind('fire',function() {
console.log('fire!');
});
Q.input.bind('fireUp',function() {
console.log('fire up');
});
Q.gameLoop(function() {
Q.clear();
Q.input.drawCanvas();
});
Q.el.css('backgroundColor','#666');
</script>
</body>
</html>
You'll see this code walks through the steps of setting up Quintus, including the Quintus.Input module
you just wrote, and then turning on the controls with the joypad. It also binds a couple of event handlers to test
that events are triggered. You can try binding some additional inputs, including the movement inputs left, right,
up, and down. On a mobile device you should see the console logs if you turn the console on.
 
 
 
Search WWH ::




Custom Search