Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SuperLib 3.50 - function rat_event() *changed* http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FUNCTION RAT_EVENT()          *changed*

  Short:
  ------
  RAT_EVENT() Event handler - inkey() with mouse awareness

  Returns:
  --------
  <nEvent> => Event value - either inkey() value or
  mouse value

  Syntax:
  -------
  RAT_EVENT([nTimeout],[lClearkb])

  Description:
  ------------
  Event handler - inkey() with mouse awareness

  <nTimeout>   is the   # seconds to wait before
  timeout. Zero (0) means indefinately . If you don't pass
  anything, default is 0. Slight difference from inkey() there.

  Returns values are:

     If keystroke                                   inkey() value
     If left mouse button has been depressed        K_MOUSELEFT
     If right mouse button has been depressed       500
     If timeout                                      0


  [lClearkb]   optional clear keyboard True (default)
  or False. If a keystroke is gotten, and this is True, clear the
  keyboard with:
                     while inkey()#0
                     end

  Examples:
  ---------
   e := 0

   while  e#27
      e := rat_event(30)
      do case
      case e == 0
        ? "Timed out after 30 seconds"
      case e < 400
        ? "Key press with inkey() value of :",e
      case e == 400
        ? "Left mouse button pressed at :"
        ?? "row-> ",rat_eqmrow(),  "col-> ",rat_eqmcol()
      case e == 500
        ? "Right mouse button pressed at :"
        ?? "row-> ",rat_eqmrow(),  "col-> ",rat_eqmcol()
      endcase
   end

  Source:
  -------
  S_MOOSE.PRG


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson