Completion of the mouseInfo function
The mouse_b function that is called twice in Listing 4:
Listing 4. Completion of the mouseInfo function.
//Test for a mouse button pressed. Set drawing color
// based on left or right mouse button.
if(mouse_b & 1){//left mouse button
*color = makecol(255,0,0);//red
return true;//signal the requirement to draw
}else if(mouse_b & 2){//right button
*color = makecol(0,255,0);//green
return true;
}else{//no button
return false;//no drawing required
}//end else
}//end mouseInfo
|