Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - mousebuttval() return the status of all mouse buttons http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 mousebuttval()      Return the status of all mouse buttons
------------------------------------------------------------------------------
 Declaration
   mouse.hdr

 Syntax
   func uint mousebuttval extern

 Arguments
   None.

 Return
   A number expressing the currently pressed mouse buttons.

 Description
   This function returns the current status of all available mouse buttons.
   The return value corresponds to the currently pressed buttons (any
   combination of buttons is allowed).

   Macros for mouse buttons are declared in mouse.hdr and listed in the
   Mouse button table. They can be used to compare the function return
   values.

 Example
   #define EXAMPLE_MOUSE
   #include example.hdr

   proc Test_mousebuttval
   vardef
      uint uButt
   enddef
   if mouseavail()
      clear
      cursor( .f. )
      @ 0, 0 ?? "Press various mouse buttons, finish with Esc"
      mouseon()
      do while inkey() != K_ESC
         uButt := mousebuttval()
         @ 2, 0 ?? iifc( and( uButt, MB_LEFT   ) > 0, "Left",   space( 4 ) )
         @ 3, 0 ?? iifc( and( uButt, MB_MIDDLE ) > 0, "Middle", space( 6 ) )
         @ 4, 0 ?? iifc( and( uButt, MB_RIGHT  ) > 0, "Right",  space( 5 ) )
      enddo
      mouseoff()
   else
      ? "Mouse is not available"
   endif
   endproc

   proc main
   Test_mousebuttval()
   endproc

See Also: Mouse button table mouseanybutton() mousechkbutton() mouseclick()

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