HTML and CSS Reference
In-Depth Information
Examining the Code for BSBingo.html
NOTE
When designing an application for the iOS platform, we are actually targeting the Safari Mobile
browser. This means that we can make concessions rather than having to target all available
HTML5-compatible devices. You will notice this especially when we discuss <audio> tag usage.
The TextButton.js file
OurBSBingogame will beplayed onagridof25squares.Wehavecreated aclass (anobject
prototype, actually) called TextButton.js t o help us create buttons with the text, as well as
a “press” state that we can use to show that the button has been clicked. You will want to save
this file in the project folder along with the BSBingo.html file. Here is the code for this file:
function
function TextButton ( x , y , text , width , height , backColor , strokeColor ,
overColor , textColor ){
this
this . x = x ;
this
this . y = y ;
this
this . text = text ;
this
this . width = width ;
this
this . height = height ;
this
this . backColor = backColor ;
this
this . strokeColor = strokeColor ;
this
this . overColor = overColor ;
this
this . textColor = textColor ;
this
this . press = false
false ;
}
TextButton . prototype . pressDown = function
function () {
iif ( this
this . press == true
true ){
this
this . press = false
false ;
} else
else {
this
this . press = true
true ;
}
}
TextButton . prototype . draw = function
function ( context ){
context . save ();
context . setTransform ( 1 , 0 , 0 , 1 , 0 , 0 ); // reset to identity
context . translate ( this
this . x , this
this . y );
Search WWH ::




Custom Search