HTML and CSS Reference
In-Depth Information
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 testing it in a desktop browser and then modifying it to run full
screenonaniOSdevice.ThisversionofthegamewillworkfineonaSafaridesktopbrowser.
We will highlight the modifications necessary to port it to the iPhone/iPad in the next section.
Example 10-1. BSBingo.html full source listing
<!doctype html>
<html
<html lang=
"en"
>
<head>
<head>
<meta
<meta charset=
"UTF-8"
>
<title>
</title>
<
script src
=
"modernizr-min.js"
><
/script>
<
script src
=
"TextButton.js"
><
/script>
<
script src
=
"ConsoleLog.js"
><
/script>
<
script type
=
"text/javascript"
>
<title>
BS Bingo
</title>
window
.
addEventListener
(
'load'
,
eventWindowLoaded
,
false
false
);
function
function
eventWindowLoaded
() {
canvasApp
();
}
function
function
canvasSupport
() {
return
return
Modernizr
.
canvas
;
}
function
function
canvasApp
(){
iif
(
!
canvasSupport
()) {
return
return
;
}
else
else
{
theCanvas
=
document
.
getElementById
(
"canvas"
);
context
=
theCanvas
.
getContext
(
"2d"
);
}
var
var
bingoCard
=
[];
var
var
buttons
=
[];
var
var
standardJargonList
=
[];
var
var
tempButton
=
{};