SceneGraph

Home About XEngine Engine API SceneGraph Changelog Programming Guide

Index

| Scene Description Language | camera | directory | eventmessage | geometry | group | input | light | node | primitives | root | spinner | transformation | user |

Input

Derived from: Node3D
Class name: Input3D
Placement: Anywhere
Description: Represents the control input from a user interface or device. It provides enumerated axes with normalized values as well as a set of buttons which can be polled at any time. When a user node is attached to an input node, it modifies its internal transformation according to the values polled at each frame cycle from the input node. If you are planning to implement behabioral simulation for the control of individual users in the virtual environment, it is advised to subclass this node.
Since the input node is linked to an abstract device and the device type handling is handled externally, the Input3D node is agnostic to the explicit device type (mouse/keyboard, joystick, etc.)

 

Function List

Name XE_input_attach_device
Arguments int node_id, int device_id
Return Type bool
Description Attaches a device id to an input node.

Parameters:
- node_id, the node's id
- device_id, a unique number containing the id of the registered device, which was supplied to XE_device_register

Returns true if the node id was found
Notes:  

 

Scene Description Language Declaration

XML node name input
Placement: Anywhere
Special notes: -
Inherited attributes: name
New attributes:
attribute type description
devicename STRING Defines the name of the input device. For example, device0 indicates the first device with id 0.
Events:
event name condition
button[x]down Issued continually when the left mouse button or joystick button x is down.
x is a value between 1 and 12
button[x]pressed Fired when the left mouse button or the joystick button x is pressed.
x is a value between 1 and 12
button[x]released Fired when the left mouse button or the joystick button x is released.
x is a value between 1 and 12
   
- -
Inherited events: -
New messages:
attribute value description
- - -
Inherited messages: -
Redefined messages: -
Obsolete messages: active, visible, hide, show, deactivate, enable, activate, disable

Example

<world ambient="0.3 0.3 0.3" background="0.2 0.2 0.2">
  
    <camera name="first_person" aperture="50.0"
            near="2.0" far="1000" follow="Myself" primary="true">
    </camera> 

    <object name="castle" file="castledoom.obj"></object>
    
    <user name="Myself" control="navigate" speed="2.0" turn="0.5"
          position="0,10,100" lookat="0,10,0" input="MouseKeyboard">
    </user>

    <input name="MouseKeyboard" devicename="device0">
        <eventmessage event="button3pressed" recipient="%Myself" message="input none">
        </eventmessage>    
        <eventmessage event="button1pressed" recipient="%Myself" message="input MouseKeyboard">
        </eventmessage>
    </input>
<input name="Joystick1" devicename="device1"> </input>

</world>

Last updated: 3 Jun. 2013