Next: , Previous: ScratchPadCamera, Up: Functions



12.14 ScratchPadInput

Input functions availible in the fluxus scratchpad.

Example
     

12.14.1 (key-pressed key-string)

Returns

boolean

Description

Returns true if the specified key is currently pressed down.

Example
      (if (key-pressed "q") (display "q pressed!))
     

12.14.2 (keys-down)

Returns

keys-list

Description

Returns a list of keys pressed down

Example
      (display (keys-down))
     

12.14.3 (key-special-pressed key-number)

Returns

boolean

Description

Returns true if the specified special key is currently pressed down. Special keys are ones which do not map to ascii values. The easiest way of finding what they are is to print out the result of key-special-pressed while holding down the key you are after.

Example
     
      (if (key-special-pressed 100) (display "left cursor pressed"))
      (if (key-special-pressed 102) (display "right cursor pressed"))
      (if (key-special-pressed 101) (display "up cursor pressed"))
      (if (key-special-pressed 103) (display "down cursor pressed"))
     

12.14.4 (keys-special-down)

Returns

keys-list

Description

Returns a list of special keys pressed down

Example
      (display (keys-special-down))
     

12.14.5 (mouse-x)

Returns

coord-number

Description

Returns the x position of the mouse

Example
      (display (mouse-x))
     

12.14.6 (mouse-y)

Returns

coord-number

Description

Returns the y position of the mouse

Example
      (display (mouse-y))
     

12.14.7 (mouse-button)

Returns

boolean

Description

Returns true if the specifed mouse button is pressed

Example
      (display (mouse-button 1))
     

12.14.8 (mouse-over)

Returns

primitiveid-number

Description

Returns the object the mouse is currently over.

Example
      (grab (mouse-over))
      (colour (vector 1 0 0)) ; paints objects the mouse is over red
      (ungrab)
     
     (define (mouse-over)
     	(select (vector-ref mouse 0) (vector-ref mouse 1) 3))