Class R.components.input.Wiimote
Extends
R.components.input.Keyboard.
A component which responds to the Wiimote (in the Opera browser)
is notifies its host object by calling a number of methods. The host object
should implement any of the following methods to receive the corresponding events.
The next few events are fired on the host object, if they exist, when
the corresponding button is pressed and released. All methods take three
arguments: the controller number, a boolean indicating true
if the button has been pressed or false when released, and
the event object that caused the method to be invoked.
- onWiimoteLeft() - Direction pad left
- onWiimoteRight() - Direction pad right
- onWiimoteUp() - Direction pad up
- onWiimoteDown() - Direction pad down
- onWiimotePlus() - Plus button pressed/released
- onWiimoteMinus() - Minus button pressed/released
- onWiimoteButton1() - Button 1 pressed/released
- onWiimoteButton2() - Button 2 pressed/released
- onWiimoteButtonA() - Button A pressed/released
- onWiimoteButtonB() - Button B pressed/released
- onWiimoteButtonC() - Button C pressed/released
- onWiimoteButtonZ() - Button Z pressed/released
The following events are status events and take different arguments:
- onWiimoteEnabled() - Enabled/disabled status (controller, state)
- onWiimoteValidity() - Validity of data transfer (controller, validity)
- onWiimoteDistance() - Distance from screen in meters (controller, dist)
- onWiimotePosition() - X/Y position (controller, x, y)
- onWiimoteRoll() - X-axis roll in radians (controller, roll)
- onWiimoteOffscreen() - Triggered instead of onWiimotePosition if the remote isn't pointing at the screen.
Defined in: wiimote.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.components.input.Wiimote(name, priority)
Create a Wii remote input component.
|
Field Attributes | Field Name and Description |
---|---|
For second argument to onWiimoteValidity(): the data is extremely poor (garbage)
|
|
For second argument to onWiimoteValidity(): the data is good
|
|
For second argument to onWiimoteValidity(): the Wiimote isn't pointing at the screen
|
|
For second argument to onWiimoteValidity(): the data is poor
|
|
For second argument to onWiimoteValidity(): the data is very poor (unreliable)
|
|
Keycode for button "1"
|
|
Keycode for button "2"
|
|
Keycode for button "A"
|
|
Keycode for button "B"
|
|
Keycode for button "C"
|
|
Keycode for dpad down
|
|
Keycode for dpad left
|
|
Keycode for button "-"
|
|
Keycode for button "+"
|
|
Keycode for dpad right
|
|
Keycode for dpad up
|
|
Keycode for button "Z"
|
- Fields borrowed from class R.components.Base:
- TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Attributes | Method Name and Description |
---|---|
destroy()
Destroy this instance and remove all references.
|
|
Get the class name of this object
|
|
release()
Releases the component back into the object pool.
|
|
setGameObject(gameObject)
Establishes the link between this component and its game object.
|
|
setHostObject(hostObj)
Deprecated in favor of #setGameObject
|
- Methods borrowed from class R.components.Base:
- execute, getGameObject, getHostObject, getPriority, getType, getTypeString, setPriority
- Methods borrowed from class R.engine.BaseObject:
- addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent, update
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.components.input.Wiimote(name, priority)
Create a Wii remote input component.
- Parameters:
- name
- {String} The name of the component
- priority Optional, Default: 0.1
- {Number} The priority of the component
Field Detail
DATA_EXTREMELY_POOR
For second argument to onWiimoteValidity(): the data is extremely poor (garbage)
DATA_GOOD
For second argument to onWiimoteValidity(): the data is good
DATA_INVALID
For second argument to onWiimoteValidity(): the Wiimote isn't pointing at the screen
DATA_POOR
For second argument to onWiimoteValidity(): the data is poor
DATA_VERY_POOR
For second argument to onWiimoteValidity(): the data is very poor (unreliable)
KEYCODE_1
Keycode for button "1"
KEYCODE_2
Keycode for button "2"
KEYCODE_A
Keycode for button "A"
KEYCODE_B
Keycode for button "B"
KEYCODE_C
Keycode for button "C"
KEYCODE_DOWN
Keycode for dpad down
KEYCODE_LEFT
Keycode for dpad left
KEYCODE_MINUS
Keycode for button "-"
KEYCODE_PLUS
Keycode for button "+"
KEYCODE_RIGHT
Keycode for dpad right
KEYCODE_UP
Keycode for dpad up
KEYCODE_Z
Keycode for button "Z"
Method Detail
destroy()
Destroy this instance and remove all references.
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} "R.components.input.Wiimote"
release()
Releases the component back into the object pool. See R.engine.PooledObject#release
for more information.
setGameObject(gameObject)
Establishes the link between this component and its game object.
When you assign components to a game object, it will call this method
so that each component can refer to its game object, the same way
a game object can refer to a component with R.engine.GameObject#getComponent.
- Parameters:
- gameObject
- {R.engine.GameObject} The object which hosts this component
setHostObject(hostObj)
Deprecated in favor of #setGameObject
- Parameters:
- hostObj