gamepad.html
author Scott Graham <scottmg@google.com>
Tue, 20 Sep 2011 13:29:10 -0700
changeset 108 d1f13495dcea
child 109 3d086bcaabe9
permissions -rw-r--r--
initial prototype, still called joystick in document, rather than gamepad
108
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     1
<!DOCTYPE html>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     2
<html lang="en">
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     3
  <head>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     4
    <title>Joystick</title>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     5
    <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     6
    <meta name="viewport" content="width=device-width">
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     7
    <!--
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     8
      === NOTA BENE ===
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
     9
      For the three scripts below, if your spec resides on dev.w3 you can check them
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    10
      out in the same tree and use relative links so that they'll work offline,
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    11
     -->
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    12
    <script src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    13
    <script class='remove'>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    14
      var respecConfig = {
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    15
          // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    16
          specStatus:           "ED",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    17
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    18
          // the specification's short name, as in http://www.w3.org/TR/short-name/
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    19
          shortName:            "gamepad",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    20
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    21
          // if your specification has a subtitle that goes below the main
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    22
          // formal title, define it here
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    23
          // subtitle   :  "an excellent document",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    24
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    25
          // if you wish the publication date to be other than today, set this
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    26
          //publishDate:  "2011-01-01",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    27
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    28
          // if the specification's copyright date is a range of years, specify
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    29
          // the start date here:
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    30
          // copyrightStart: "2005"
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    31
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    32
          // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    33
          // and its maturity status
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    34
          // previousPublishDate:  "1977-03-15",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    35
          // previousMaturity:  "WD",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    36
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    37
          // if there a publicly available Editor's Draft, this is the link
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    38
          edDraftURI:           "http://dvcs.w3.org/hg/webevents/raw-file/default/gamepad.html",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    39
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    40
          // if this is a LCWD, uncomment and set the end of its review period
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    41
          // lcEnd: "2009-08-05",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    42
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    43
          // if you want to have extra CSS, append them to this list
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    44
          // it is recommended that the respec.css stylesheet be kept
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    45
          extraCSS:             ["http://www.w3.org/StyleSheets/TR/W3C-TR.css", "http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"],
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    46
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    47
          // editors, add as many as you like
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    48
          // only "name" is required
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    49
          editors:  [
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    50
              { name: "Scott Graham", url: "http://h4ck3r.net/",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    51
                company: "Google", companyURL: "http://www.google.com/" },
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    52
              { name: "Ted Mielczarek", url: "http://ted.mielczarek.org/",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    53
                company: "Mozilla", companyURL: "http://www.mozilla.org/" },
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    54
          ],
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    55
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    56
          // authors, add as many as you like.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    57
          // This is optional, uncomment if you have authors as well as editors.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    58
          // only "name" is required. Same format as editors.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    59
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    60
          //authors:  [
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    61
          //    { name: "Your Name", url: "http://example.org/",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    62
          //      company: "Your Company", companyURL: "http://example.com/" },
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    63
          //],
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    64
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    65
          // name of the WG
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    66
          wg:           "Web Events Working Group",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    67
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    68
          // URI of the public WG page
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    69
          wgURI:        "http://www.w3.org/2010/webevents/",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    70
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    71
          // name (with the @w3c.org) of the public mailing to which comments are due
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    72
          wgPublicList: "public-webevents",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    73
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    74
          // URI of the patent status for this WG, for Rec-track documents
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    75
          // !!!! IMPORTANT !!!!
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    76
          // This is important for Rec-track documents, do not copy a patent URI from a random
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    77
          // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    78
          // Team Contact.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    79
          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/45559/status",
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    80
      };
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    81
    </script>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    82
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    83
    <style type="text/css">
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    84
      .event {
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    85
        font-family: monospace;
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    86
        color: #459900;
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    87
      }
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    88
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    89
      pre.idl {
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    90
        white-space: pre-wrap;
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    91
      }
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    92
    </style>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    93
  </head>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    94
  <body>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    95
    <section id='abstract'>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    96
      The Joystick specification defines a low-level interface that represents
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    97
      joystick devices (also known as game pads).
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    98
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
    99
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   100
    <section id='introduction' class='informative'>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   101
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   102
      <h2>Introduction</h2>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   103
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   104
      <p>Some <a>user agent</a>s have connected joystick devices (also known
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   105
      as gamepads). These devices are desirable and suited to input for gaming
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   106
      applications, and for &quot;10 foot&quot; user interfaces
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   107
      (presentations, media viewers).</p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   108
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   109
      <p>Currently, the only way for a joystick to be used as input would be
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   110
      to emulate mouse or keyboard events, however this would lose information
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   111
      and require additional software outside of the <a>user agent</a> to
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   112
      accomplish emulation.</p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   113
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   114
      <p>Meanwhile, native applications are capable of accessing these devices
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   115
      via system APIs.</p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   116
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   117
      <p>The Joystick API provides a solution to this problem by specifying
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   118
      interfaces that allow web applications to directly act on joystick
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   119
      data.</p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   120
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   121
      <p>This specification references interfaces from a number of other
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   122
      specifications:</p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   123
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   124
      <ul>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   125
      <li><a class="externalDFN">Document</a> [[!DOM-LEVEL-3-CORE]]</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   126
      <li><a class="externalDFN">DOMTimeStamp</a> [[!WEBIDL]]</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   127
      <li><a class="externalDFN">WindowAnimationTiming</a> [[ANIMATION-TIMING]]</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   128
      </ul>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   129
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   130
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   131
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   132
    <section id='conformance'>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   133
      <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   134
        This specification defines conformance criteria that apply to a single
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   135
        product: the <dfn id="dfn-user-agent">user agent</dfn> that implements
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   136
        the interfaces that it contains.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   137
      </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   138
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   139
      <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   140
        Implementations that use ECMAScript to implement the APIs defined in
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   141
        this specification MUST implement them in a manner consistent with the
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   142
        ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]] as
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   143
        this specification uses that specification and terminology.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   144
      </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   145
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   146
      <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   147
        A conforming implementation is required to implement all fields
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   148
        defined in this specification.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   149
      </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   150
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   151
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   152
    <section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   153
      <h2><a>Joystick</a> Interface</h2>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   154
      <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   155
        This interface defines an individual joystick device.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   156
      </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   157
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   158
      <dl title='interface Joystick' class='idl'>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   159
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   160
        <dt>readonly attribute string id</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   161
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   162
          An identification string for the joystick.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   163
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   164
          This string identifies the brand or style of connected joystick
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   165
          device. Typically, this will include the USB vendor and a product
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   166
          ID.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   167
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   168
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   169
        <dt>readonly attribute long index</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   170
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   171
          The index of the joystick in the <a>DocumentJoysticks</a>.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   172
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   173
          When multiple joysticks are connected to a <a>user agent</a>,
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   174
          indices MUST be assigned on a first-come, first-serve basis,
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   175
          starting at zero. If a joystick is disconnected, previously assigned
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   176
          indices MUST NOT be reassigned to joysticks that continue to be
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   177
          connected. However, if a joystick is disconnected, and subsequently
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   178
          the same or a different joystick is then connected, index entries
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   179
          MUST be reused.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   180
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   181
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   182
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   183
        <dt>readonly attribute DOMTimeStamp timestamp</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   184
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   185
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   186
          Last time the data for this joystick was updated.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   187
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   188
          Timestamp is a monotonically increasing value that allows the author
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   189
          to determine if the <code>axes</code> and <code>button</code> data
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   190
          have been updated from the hardware, relative to a previously saved
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   191
          timestamp.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   192
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   193
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   194
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   195
        <dt>readonly attribute float[] axes</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   196
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   197
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   198
          Array of values for all axes of the joystick.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   199
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   200
          All axis values MUST be linearly normalized to the range [-1.0 ..
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   201
          1.0]. As appropriate, -1.0 SHOULD correspond to "up" or "left", and
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   202
          1.0 SHOULD correspond to "down" or "right".
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   203
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   204
          Axes that are drawn from a 2D input device SHOULD appear next to
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   205
          each other in the axes array, X then Y.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   206
          
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   207
          It is RECOMMENDED that axes appear in decreasing order of
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   208
          importance, such that element 0 and 1 typically represent the X and
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   209
          Y axis of a directional stick.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   210
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   211
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   212
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   213
        <dt>readonly attribute float[] buttons</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   214
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   215
          Array of values for all buttons of the joystick.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   216
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   217
          All button values MUST be linearly normalized to the range [0.0 ..
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   218
          1.0]. 0.0 MUST mean fully unpressed, and 1.0 MUST mean fully
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   219
          pressed.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   220
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   221
          It is RECOMMENDED that buttons appear in decreasing importance such
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   222
          that the primary button, secondary button, tertiary button, and so
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   223
          on appear as elements 0, 1, 2, ... in the buttons array.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   224
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   225
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   226
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   227
        <dt>readonly attribute float[] suggestedAxesDeadZone</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   228
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   229
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   230
          Array of values that represent suggested amount of input to ignore
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   231
          for corresponding values in the axes array. These values are
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   232
          hardware dependent and reflect tolerances for sampling (sometimes
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   233
          low-quality) analog inputs.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   234
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   235
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   236
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   237
        <dt>readonly attribute float[] suggestedButtonsDeadZone</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   238
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   239
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   240
          Array of values that represent suggested amount of input to ignore
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   241
          for corresponding values in the buttons array. These values are
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   242
          hardware dependent and reflect tolerances for sampling (sometimes
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   243
          low-quality) analog inputs.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   244
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   245
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   246
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   247
      </dl>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   248
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   249
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   250
    <section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   251
      <h2><a>DocumentJoysticks</a> Interface</h2>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   252
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   253
      <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   254
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   255
        This interface defines a collection of Joysticks. The
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   256
        <a>DocumentJoysticks</a> interface MUST be implemented on the
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   257
        <a>Document</a> object.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   258
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   259
      </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   260
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   261
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   262
      <dl title='interface DocumentJoysticks' class='idl'>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   263
        <dt>readonly attribute Joystick[] joysticks</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   264
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   265
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   266
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   267
          The currently connected and interacted-with joysticks.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   268
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   269
          Joysticks MUST only appear in the list if they are currently
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   270
          connected to the <a>user agent</a>, and have been interacted with by
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   271
          the user. Otherwise, they MUST not appear in the list to avoid a
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   272
          malicious page from fingerprinting the user based on connected
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   273
          devices.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   274
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   275
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   276
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   277
      </dl>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   278
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   279
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   280
    <section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   281
      <h2><a>JoystickEvent</a> Interface</h2>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   282
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   283
      <dl title='interface JoystickEvent' class='idl'>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   284
        <dt>readonly attribute Joystick joystick</dt>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   285
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   286
        <dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   287
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   288
            The single joystick attribute provides access to the associated
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   289
            joystick data for this event.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   290
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   291
        </dd>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   292
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   293
      </dl>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   294
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   295
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   296
      
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   297
    <section class="informative">
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   298
        <h2>Usage Examples</h2>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   299
          
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   300
          <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   301
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   302
            The example below demonstrates typical access to joysticks. Note
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   303
            the relationship with the <a>WindowAnimationTiming</a>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   304
            [[!ANIMATION-TIMING]] interface.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   305
          </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   306
          
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   307
          <section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   308
              <pre class="example">
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   309
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   310
function runAnimation()
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   311
{
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   312
    window.requestAnimationFrame(runAnimation);
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   313
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   314
    for (var i = 0; i < document.joysticks.length; ++i)
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   315
    {
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   316
        var joy = document.joysticks[i];
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   317
        // todo; simple demo of displaying joy.axes and joy.buttons
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   318
    }
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   319
}
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   320
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   321
window.requestAnimationFrame(runAnimation);
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   322
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   323
              </pre>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   324
          </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   325
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   326
          <div class="practice"> 
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   327
              <p> 
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   328
              <span id="practice-timing" class="practicelab">Coordination with
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   329
              WindowAnimationTiming</span></p> 
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   330
              <p class="practicedesc"> 
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   331
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   332
              Interactive applications will typically be using the
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   333
              <a>WindowAnimationTiming</a> interface to drive animation, and
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   334
              will want coordinate animation with user joystick input. As
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   335
              such, the joystick data should be polled as closely as possible
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   336
              to immediately before the animation callbacks are executed, and
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   337
              with frequency matching that of the animation. That is, if the
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   338
              animation callbacks are running at 60Hz, the joystick inputs
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   339
              should also be sampled at that rate.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   340
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   341
              </p> 
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   342
          </div> 
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   343
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   344
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   345
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   346
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   347
    <section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   348
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   349
      <h3 id="event-joystickconnected">The <dfn class="event">joystickconnected</dfn> event</h3>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   350
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   351
        <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   352
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   353
          A <a>user agent</a> MUST dispatch this event type to indicate the
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   354
          user has connected a joystick. If a joystick was already connected
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   355
          when the page was loaded, the <a>joystickconnected</a> event will be
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   356
          dispatched when the user presses a button or moves an axis.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   357
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   358
        </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   359
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   360
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   361
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   362
    <section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   363
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   364
        <h3 id="event-joystickdisconnected">The <dfn class="event">joystickdisconnected</dfn> event</h3>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   365
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   366
        <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   367
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   368
          When a joystick is disconnected from the <a>user agent</a>, if the
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   369
          <a>user agent</a> has previously dispatched a
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   370
          <a>joystickconnected</a> event, a <a>joystickdisconnected</a> event
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   371
          MUST be dispatched.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   372
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   373
        </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   374
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   375
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   376
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   377
    <section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   378
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   379
        <h3>Other events</h3>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   380
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   381
        <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   382
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   383
        <i>More discussion needed, on whether to include or exclude axis and button
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   384
        changed events, and whether to roll them more together
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   385
        (<code>joystickchanged</code>?), separate somewhat
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   386
        (<code>joystickaxischanged</code>?), or separate by individual axis
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   387
        and button.</i>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   388
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   389
        </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   390
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   391
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   392
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   393
    <section class='appendix informative'>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   394
      <h2>Acknowledgements</h2>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   395
      <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   396
        Many have made contributions in code, comments, or documentation: 
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   397
      </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   398
        <ul>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   399
            <li>David Humphrey</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   400
            <li>Gregg Tavares</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   401
            <li>Jason Orendorff</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   402
            <li>Olli Pettay</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   403
            <li>Rick Waldron</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   404
            <li>Ted Mielczarek</li>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   405
        </ul>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   406
      <p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   407
        Please let me know if I have inadvertently omitted your name.
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   408
      </p>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   409
    </section>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   410
  </body>
d1f13495dcea initial prototype, still called joystick in document, rather than gamepad
Scott Graham <scottmg@google.com>
parents:
diff changeset
   411
</html>