SVG Keyboard Adapter

If you include svgdreams-keyboard.js file, the document will detect all keys pressed. The code in this file does several things:
1. Converts the key value into human readable format (0-9 numbers, english alphabet letters, arrows are among those keys).
2. Package the key value as an instruction stack data and put it into the instruction stack. (See: SvgAjaxAdapter for more details).

In the "svgdreams-keyboard.js" file you'll see some important parameters:
1. keyboardAjaxRequestUrl: This is the path of the ajax request. Instruction resolver will send an AJAX request to this URL. So as you start your project, set this parameter as you wish.
2. pushIntoInstructionStack: This value is a boolean value. If you set this false, the keyboard activity will not be inserted into the instruction stack.

In the later versions we plan to specialize keyboard detection with the help of a PHP class and provide more ajax request methods.

Type within image

Example:Press different keys, the code will place it to a random place in the svg image. Note that, all the keyboard interactions are sent to the ajax layer first. What you see in the example are text tags.
You can review the codes of this example in "keyboard_1.php" file in the downloadable package.

Keyboard arrows

In the following example, you can find move the space ship by keyboard arrows.

All rights reserved. See license