Line 104:
Line 104:
Some of these functions can be disabled by markup on a web page.
Some of these functions can be disabled by markup on a web page.
+
== Wii U Scripting Functionality ==
== Wii U Scripting Functionality ==
Line 109:
Line 110:
=== wiiu.gamepad ===
=== wiiu.gamepad ===
−
The <tt>wiiu.gamepad</tt> object allows Javascript functions to read the current state of the primary Game Pad.
+
The <tt>wiiu.gamepad</tt> object allows Javascript functions to read the current state of the primary GamePad.
−
−
<b>TODO:</b> <i>Figure out what contentX, contentY, and isDataValid are.</i>
==== Reading values ====
==== Reading values ====
Line 117:
Line 116:
Once enabled, the function <tt>wiiu.gamepad.update()</tt> will populate all of the properties on the <tt>wiiu.gamepad</tt> object with the current information about the sticks, accelerometers, gyroscopes, buttons, and touch screen. It is safe to invoke this function in a timer for real-time updates.
Once enabled, the function <tt>wiiu.gamepad.update()</tt> will populate all of the properties on the <tt>wiiu.gamepad</tt> object with the current information about the sticks, accelerometers, gyroscopes, buttons, and touch screen. It is safe to invoke this function in a timer for real-time updates.
+
+
After a successful update, <tt>wiiu.gamepad.isDataValid</tt> will be set to 1. If no update has happened yet, or if the GamePad is not connected, it will be set to 0.
==== Touch Screen ====
==== Touch Screen ====
−
The <tt>wiiu.gamepad.tpTouch</tt> variable indicates whether or not there is currently an active touch on the screen. If this variable is 1, the variables <tt>wiiu.gamepad.tpX</tt> and <tt>wiiu.gamepad.tpY</tt> track the coordinates of this touch. The Game Pad's touch screen is not multitouch.
+
The <tt>wiiu.gamepad.tpTouch</tt> variable indicates whether or not there is currently an active touch on the screen. If this variable is 1, the following variables will be set:
+
{| class='wikitable'
+
! Variable
+
! Value
+
|-
+
|<tt>wiiu.gamepad.tpX</tt>
+
|X position in screen coordinates
+
|-
+
|<tt>wiiu.gamepad.tpY</tt>
+
|Y position in screen coordinates
+
|-
+
|<tt>wiiu.gamepad.contentX</tt>
+
|X position in page coordinates
+
|-
+
|<tt>wiiu.gamepad.contentX</tt>
+
|Y position in page coordinates
+
|}
−
<b>TODO:</b> <i>Document range of tpX and tpY. Determine meaning of tpValidity.</i>
+
<b>TODO:</b> <i>Determine meaning of tpValidity. It has a value of 3 when there is no touch and a value of 0 when there is a touch.</i>
==== Analog Sticks ====
==== Analog Sticks ====
−
The left analog stick is tracked by the <tt>wiiu.gamepad.lStickX</tt> and <tt>wiiu.gamepad.lStickY</tt> variables, and the right analog stick is tracked by the <tt>wiiu.gamepad.rStickX</tt> and <tt>wiiu.gamepad.rStickY</tt> variables. These values range from -1.0 to +1.0.
+
The following variables store the current state of the left and right analog sticks. Each value ranges from -1.0 to +1.0.
+
{| class='wikitable'
+
! Variable
+
! Value
+
|-
+
|<tt>wiiu.gamepad.lStickX
+
|Left stick X deflection
+
|-
+
|<tt>wiiu.gamepad.lStickY
+
|Left stick Y deflection
+
|-
+
|<tt>wiiu.gamepad.rStickX
+
|Right stick X deflection
+
|-
+
|<tt>wiiu.gamepad.rStickY
+
|Right stick Y deflection
+
|}
==== Buttons ====
==== Buttons ====
−
The variable <tt>wiiu.gamepad.held</tt> is a bitmask indicating all buttons currently being depressed on the Game Pad, including the click states of the analog sticks. All buttons are represented by in this bitmask although the browser's default behaviors may cause some values to be unusable.
+
The variable <tt>wiiu.gamepad.hold</tt> is a bitmask indicating all buttons currently being depressed on the GamePad, including the click states of the analog sticks. Almost all buttons are represented by in this bitmask although the browser's default behaviors may cause some values to be unusable.
+
+
{| class='wikitable'
+
! Button
+
! Decimal
+
! Hex
+
|-
+
|Left Stick Left
+
|1073741824
+
|0x40000000
+
|-
+
|Left Stick Right
+
|536870912
+
|0x20000000
+
|-
+
|Left Stick Up
+
|268435456
+
|0x10000000
+
|-
+
|Left Stick Down
+
|134217728
+
|0x08000000
+
|-
+
|Right Stick Left
+
|67108864
+
|0x04000000
+
|-
+
|Right Stick Right
+
|33554432
+
|0x02000000
+
|-
+
|Right Stick Up
+
|16777216
+
|0x01000000
+
|-
+
|Right Stick Down
+
|8388608
+
|0x00800000
+
|-
+
|Left Stick Click
+
|262144
+
|0x00040000
+
|-
+
|Right Stick Click
+
|131072
+
|0x00020000
+
|-
+
|TV
+
|65536
+
|0x00010000
+
|-
+
|A
+
|32768
+
|0x00008000
+
|-
+
|B
+
|16384
+
|0x00004000
+
|-
+
|X
+
|8192
+
|0x00002000
+
|-
+
|Y
+
|4096
+
|0x00001000
+
|-
+
|D-Pad Left
+
|2048
+
|0x00000800
+
|-
+
|D-Pad Right
+
|1024
+
|0x00000400
+
|-
+
|D-Pad Up
+
|512
+
|0x00000200
+
|-
+
|D-Pad Down
+
|256
+
|0x00000100
+
|-
+
|LR
+
|128
+
|0x00000080
+
|-
+
|ZR
+
|64
+
|0x00000040
+
|-
+
|L
+
|32
+
|0x00000020
+
|-
+
|R
+
|16
+
|0x00000010
+
|-
+
| +
+
|8
+
|0x00000008
+
|-
+
| -
+
|4
+
|0x00000004
+
|}
−
<b>TODO:</b> <i>Record what values in the bitmask correspond to which buttons on the Game Pad.</i>
+
The Power button does not appear in the <tt>hold</tt> variable in the browser. Presumably the Home button would be 0x01 or 0x02 but this cannot be tested as pressing the Home button closes the browser without updating the screen.
==== Accelerometer ====
==== Accelerometer ====
−
The variables <tt>wiiu.gamepad.accX</tt>, <tt>wiiu.gamepad.accY</tt>, and <tt>wiiu.gamepad.accZ</tt> are a vector showing the current acceleration forces on the Game Pad, measured in Gs. When held level and motionless, the force of gravity will cause these variables to contain the vector (0.0, -1.0, 0.0).
+
The variables <tt>wiiu.gamepad.accX</tt>, <tt>wiiu.gamepad.accY</tt>, and <tt>wiiu.gamepad.accZ</tt> are a vector showing the current acceleration forces on the GamePad, measured in Gs. When held level and motionless, the force of gravity will cause these variables to contain the vector (0.0, -1.0, 0.0).
==== Gyroscope ====
==== Gyroscope ====
−
The variables <tt>wiiu.gamepad.gyroX</tt>, <tt>wiiu.gamepad.gyroY</tt>, and <tt>wiiu.gamepad.gyroZ</tt> contain the current readings of the Game Pad gyroscopes.
+
The variables <tt>wiiu.gamepad.gyroX</tt>, <tt>wiiu.gamepad.gyroY</tt>, and <tt>wiiu.gamepad.gyroZ</tt> contain the current readings of the GamePad gyroscopes.
<b>TODO:</b> <i>Determine range and geometric interpretation of these variables.</i>
<b>TODO:</b> <i>Determine range and geometric interpretation of these variables.</i>
==== Angle ====
==== Angle ====
−
The variables <tt>wiiu.gamepad.angleX</tt>, <tt>wiiu.gamepad.angleY</tt>, and <tt>wiiu.gamepad.angleZ</tt> contain the current angle of the Game Pad.
+
The variables <tt>wiiu.gamepad.angleX</tt>, <tt>wiiu.gamepad.angleY</tt>, and <tt>wiiu.gamepad.angleZ</tt> contain the current angle of the GamePad.
<b>TODO:</b> <i>Determine range and geometric interpretation of these variables.</i>
<b>TODO:</b> <i>Determine range and geometric interpretation of these variables.</i>
==== Direction Tracking ====
==== Direction Tracking ====
−
There are nine variables that tie into the Game Pad's direction tracking, organized into three triplets:
+
There are nine variables that tie into the GamePad's direction tracking, organized into three triplets:
* <tt>wiiu.gamepad.dirXx</tt>, <tt>wiiu.gamepad.dirXy</tt>, <tt>wiiu.gamepad.dirXz</tt>
* <tt>wiiu.gamepad.dirXx</tt>, <tt>wiiu.gamepad.dirXy</tt>, <tt>wiiu.gamepad.dirXz</tt>
* <tt>wiiu.gamepad.dirYx</tt>, <tt>wiiu.gamepad.dirYy</tt>, <tt>wiiu.gamepad.dirYz</tt>
* <tt>wiiu.gamepad.dirYx</tt>, <tt>wiiu.gamepad.dirYy</tt>, <tt>wiiu.gamepad.dirYz</tt>
Line 167:
Line 306:
The variable <tt>wiiu.remote.held</tt> is a bitmask indicating all buttons currently being depressed on the Wii Remote.
The variable <tt>wiiu.remote.held</tt> is a bitmask indicating all buttons currently being depressed on the Wii Remote.
−
<b>TODO:</b> <i>Record what values in the bitmask correspond to which buttons on the Game Pad.</i>
+
<b>TODO:</b> <i>Record what values in the bitmask correspond to which buttons on the GamePad.</i>
==== Accelerometer ====
==== Accelerometer ====