JoystickAPI: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
== Web Joystick API (Draft Recommendation) ==
== Web Joystick API (Draft Recommendation) ==


===== Abstract =====
=== Abstract ===


The HTML5 specification introduces many of the necessary components for rich interactive and game development, from <canvas> and WebGL to <audio> and <video&gt.  At the same time, JavaScript implementations have matured to the point where they can now support many tasks which previously required native code.  The Web Joystick API presents a new way for web and game developers, as well as interaction designers, to access and use joysticks and other controllers for games.
The HTML5 specification introduces many of the necessary components for rich interactive and game development, from <canvas> and WebGL to <audio> and <video&gt.  At the same time, JavaScript implementations have matured to the point where they can now support many tasks which previously required native code.  The Web Joystick API presents a new way for web and game developers, as well as interaction designers, to access and use joysticks and other controllers for games.


===== Authors =====
=== Authors ===


* Ted Mielczarek ([https://twitter.com/#!/TedMielczarek @TedMielczarek])
* Ted Mielczarek ([https://twitter.com/#!/TedMielczarek @TedMielczarek])
Line 133: Line 133:
The Joystick object is often used in conjunction with an animation loop (e.g., requestAnimationFrame), where developers want to make decisions for the current frame based on the state of the joystick or joysticks.
The Joystick object is often used in conjunction with an animation loop (e.g., requestAnimationFrame), where developers want to make decisions for the current frame based on the state of the joystick or joysticks.


Here is a complete example:
=== Complete Example: Displaying Joystick State ===
 
This example shows how to use the Joystick object, as well as the '''MozJoyConnected''' and '''MozJoyDisconnected''' events in order to display the state of all joysticks connected to the system:


<pre>
<pre>
Confirmed users
656

edits

Navigation menu