
This image shows a normal keyboard which can be connected to computer. When this keyboard is hacked it contains micro controller (encoder boards) sandwiched between two plastic layer. (the image is shown below)

The above image shows the keyboard encoder board.
Notice the connectors at the edge of the keyboard encoder boards. Those stripes are the contacts that the circuits on the flimsy come back to. If you start counting, you'll realize that there aren't nearly enough contacts to account for all the keys on the keyboard. Even if every key's circuit used a shared common ground, there are still not enough contacts to account for the 100 or so keys found on a typical keyboard.
If a keyboard was configured to use discrete contacts (one contact per key), there would be over 100 contacts required and a keyboard encoder chip with the same number of pins on it! That would be big and expensive--something manufacturers always try to avoid. Instead, keyboard makers take advantage of a design technique called a matrix.
Some References1. WII like Banana 
Who says you need to buy the hottest video game system to create new forms of interaction? Our group decided to tackle the task of creating a new way to play Space Cadet Pinball. After the basic hacking and routing of two keys from our USB keyboard, we were able to simply connect two tilt sensors to trigger the keys. A quick trip to the market later … we had two bananas that could play a mad game of pinball.
2.Ice tea Madness

Hacking a keyboard to make a virtual 3D controller to control a game , in this case marble madness. The controller was supposed to be ball shaped like the marble in the game however due to time constraints an ice tea can was used. 4 tilt sensors record motion in 4 directions , tilting up down left and right. 4 keyboard buttons were hacked and mapped in the game to the 4 directions.