HTML and CSS Reference
In-Depth Information
Whether this game was ever widely played (or even played at all) is a debatable urban
legend, but the simple concept of clicking squares to highlight them makes for a useful
piece of code that we can build easily and then port to the iPhone. We are not even
going to build the entire game here; we will leave extending it into a full application
(possibly adding multiplayer, which is discussed in Chapter 11 ) for you, the reader.
The Code
Example 10-1 gives the code for our game. We'll discuss the various functions in the
next section before we move on to installing, modifying, and testing it in Xcode using
PhoneGap. This version of the game will work fine on a Safari desktop browser. We
will highlight the modifications necessary to port it to the iPhone in the next section.
Example 10-1. BSBingo.html full source listing
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BS Bingo</title>
<script src="modernizr-1.6.min.js"></script>
<script src="TextButton.js"></script>
<script src="ConsoleLog.js"></script>
<script type="text/javascript">
window.addEventListener('load', eventWindowLoaded, false);
function eventWindowLoaded() {
canvasApp();
}
function canvasSupport () {
return Modernizr.canvas;
}
function canvasApp(){
if (!canvasSupport()) {
return;
}else{
theCanvas = document.getElementById("canvas");
context = theCanvas.getContext("2d");
}
var bingoCard = [];
var buttons = [];
var standardJargonList = [];
var tempButton = {};
var clickSound;
Search WWH ::




Custom Search