Section Index


1. OpenAL || 2. Debugging || 3. String Manipulation || 4. Networking || 5. Console || 6. Device I/O || 7. File I/O
8. Packages || 9. Objects || 10. Event Scheduling || 11. Datablocks || 12. Video / Texturing || 13. Special || 14. Resource Management
15. Scene || 16. Containers and Raycasts || 17. Editors || 18. Build || 19. Time || 20. GUIs || 21. Math


This quick reference guide was taken directly out of The Game Programmer's Guide to Torque by Edward Maurina. It's an outstanding resource - a must for anyone wanting to get serious about programming in Torque.



Contents

Device IO

activateDirectInput()

Purpose
Use the activateDirectInput function to activate polling of direct input devices (keyboard, mouse, joystick, et cetera).

Returns
No return value.


See Also
deactivateDirectInput

activateDirectInput();



activateKeyboard()

Purpose
Use the activateKeyboard function to enable directInput polling of the keyboard.

Returns
Returns a true if polling was succesfully enabled.

See Also
deactivateKeyboard

if(activateKeyboard())
{
   echo(“Keyboard has been activated”);
}



deactivateDirectInput()

Purpose
Use the deactivateDirectInput function to de-activate polling of direct input devices (keyboard, mouse, joystick, et cetera).

Returns
No return value.

See Also
activateDirectInput

deactivateDirectInput();



deactivateKeyboard()

Purpose
Use the deactivateKeyboard function to disable directInput polling of the keyboard.

Returns
No return value.

See Also
activateKeyboard

deactivateKeyboard();



disableJoystick()

Purpose
Use the disableJoystick function to disable joystick input.

Returns
No return value.

See Also
enableJoystick, getJoystickAxes, isJoystickEnabled



disableMouse()

Purpose
Use the disableMouse function to disable mouse input.

Returns
No return value.

See Also
enableMouse

disableMouse();



echoInputState()

Purpose
Use the echoInputState function to dump the input state of the mouse, keyboard, and joystick to the console.

Returns
No return value.

See Also
activateDirectInput, deactivateDirectInput, activateKeyboard, deactivateKeyboard, disableJoystick, enableJoystick, enableMouse, disableMouse

echoInputState();

DirectInput is enabled but inactive.
- Keyboard is enabled and inactive.
- Mouse is disabled and inactive.
- Joystick is disabled and inactive.



enableJoystick()

Purpose
Use the enableJoystick function to enable joystick input if it is present.

Returns
Will return true if the joystick is present and was successfully enabled, false otherwise.

See Also
disableJoystick, getJoystickAxes, isJoystickDetected

enableJoystick();



enableMouse()

Purpose
Use the enableMouse function to enable mouse input.

Returns
Returns true if a mouse is present and it was enabled, false otherwise.

See Also
disableMouse

enableMouse();



getJoystickAxes( instance )

Purpose
Use the getJoystickAxes function to get the current axes position (x and y ) of any intance of a joystick.

Syntax
instance
– A non-negative number value selecting a specific joystick instance attached to this computer.

Returns
Returns a string containg the "x y" position of the joystick.

See Also
disableJoystick, enableJoystick, isJoystickDetected

Used to get the current axes of the joystick pointed to by instance, where instance is a numeric value specifying the joystick number.

%joyAxes = getJoystickAxes( 3 );



isJoystickDetected()

Purpose
Use the isJoystickDetected function to determine if one or more joysticks are connected to the system.

Returns
Returns true if one or more joysticks are attached and detected, false otherwise.

Notes
This doesn't tell us how many joysticks there are, just that there are joysticks. It is our job to find out how many and to attach them.

See Also
disableJoystick, enableJoystick, getJoystickAxes

if( !isJoystickDetected() ) 
{
   echo( "No Joystick was detected" );
}




lockMouse( isLocked )

Purpose
Use the lockMouse function to un/lock the mouse.

Syntax
isLocked
– A boolean value

Returns
No return value.

function cursorOff()
{
   if ( $cursorControlled )
   {
      lockMouse(true);
      Canvas.cursorOff();
   }
}


Section Index


1. OpenAL || 2. Debugging || 3. String Manipulation || 4. Networking || 5. Console || 6. Device I/O || 7. File I/O
8. Packages || 9. Objects || 10. Event Scheduling || 11. Datablocks || 12. Video / Texturing || 13. Special || 14. Resource Management
15. Scene || 16. Containers and Raycasts || 17. Editors || 18. Build || 19. Time || 20. GUIs || 21. Math