home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / pascal / FLASHPAC.ZIP / CH6_1.DOC < prev    next >
Encoding:
Text File  |  1991-03-15  |  17.0 KB  |  742 lines

  1. ..pgno01
  2. ..foot60A6-##
  3. ..head02L──────────────────────────────────────────────────────────────────────
  4. ..head04L──────────────────────────────────────────────────────────────────────
  5. ..head03LGlobal Variables
  6. UINT NEvents       contains the number of events waiting in the mouse
  7.                    event handler queue.
  8. ..page
  9. ..head03AMButtonPress
  10. ■ Mouse Driver Version     [1.xx+]
  11.  
  12. ■ Source Module Name  mbutinfo.asm
  13.  
  14. ■ Description
  15.  
  16.   Returns the current button status information.
  17.  
  18.  
  19. ■ Summary
  20.  
  21.   INT2 FPENTRY MButtonPress( INT2   Button,
  22.                  INT2  *ButPress,
  23.                  INT2  *x,
  24.                  INT2  *y  );
  25.  
  26.   Button      specifies the button to check.
  27.                  0 - left button
  28.                  1 - right button
  29.                  2 - middle button
  30.  
  31.   ButPress    number of button presses since the last call to
  32.               MButtonPress.
  33.  
  34.   x           column the mouse cursor was in the last time the button
  35.               was pressed.
  36.  
  37.   y           row the mouse cursor was in the last time the button was
  38.               pressed.
  39.  
  40.  
  41. ■ Remarks
  42.  
  43.   MButtonPress will return an integer indicating the current state of
  44.   the mouse button requested.
  45.  
  46.      0 - Button is released
  47.      1 - Button is pressed
  48. ..page
  49. ■ Example
  50.  
  51.   #include <fpclib.h>
  52.  
  53.   main()
  54.   {
  55.      INT NBut,ButPresses,x,y
  56.      if ( MResetMouse( &NBut ) ) {
  57.  
  58.         MInitEventHandler( 14 );
  59.         while ( NEvents < 10 )
  60.         ;
  61.  
  62.         printf( "left button status is ==> " );
  63.  
  64.         switch ( MButtonPress( 0, &ButPresses, &x, &y ) ) {
  65.            case 0 : printf( "UP" );
  66.            case 1 : printf( "DOWN" );
  67.         }
  68.  
  69.         printf( "\n\nTotal Button presses = %u", ButPresses );
  70.      }
  71.   }
  72.  
  73.   This example will report the number of times the left button was
  74.   pressed and also the current state of the left button.
  75. ..page
  76. ..head03AMButtonRel
  77. ■ Mouse Driver Version     [1.xx+]
  78.  
  79. ■ Source Module Name  mbutinfo.asm
  80.  
  81.  
  82. ■ Description
  83.  
  84.   Returns the current button status information.
  85.  
  86.  
  87. ■ Summary
  88.  
  89.   INT2 FPENTRY MButtonRel( INT2   Button,
  90.                INT2  *ButPress,
  91.                INT2  *x,
  92.                INT2  *y  );
  93.  
  94.   Button      specifies the button to check.
  95.                  0 - left button
  96.                  1 - right button
  97.                  2 - middle button
  98.  
  99.   ButPress    number of button releases since the last call to
  100.               MButtonRel.
  101.  
  102.   x           column the mouse cursor was in the last time the button
  103.               was released.
  104.  
  105.   y           row the mouse cursor was in the last time the button was
  106.               released.
  107.  
  108.  
  109. ■ Remarks
  110.  
  111.   MButtonReleased will return an integer indicating the current state
  112.   of the mouse button requested.
  113.      0 - Button is released
  114.      1 - Button is pressed
  115. ..page
  116. ■ Example
  117.  
  118.   #include <fpclib.h>
  119.  
  120.   main()
  121.   {
  122.      INT NBut,ButPresses,x,y
  123.      if ( MResetMouse( &NBut ) ) {
  124.  
  125.         MInitEventHandler( 14 );
  126.         while ( NEvents < 10 )
  127.         ;
  128.  
  129.         printf( "left button status is ==> " );
  130.  
  131.         switch ( MButtonRel( 0, &ButPresses, &x, &y ) ) {
  132.            case 0 : printf( "UP" );
  133.            case 1 : printf( "DOWN" );
  134.         }
  135.  
  136.         printf( "\n\nTotal Button releases = %u", ButPresses );
  137.      }
  138.   }
  139.  
  140.   This example will report the number of times the left button was
  141.   released and also the current state of the left button.
  142. ..page
  143. ..head03AMGetPos
  144. ■ Mouse Driver Version     [1.xx+]
  145.  
  146. ■ Source Module Name  mgetpos.asm
  147.  
  148.  
  149. ■ Description
  150.  
  151.   Returns the current button status and the location of the mouse
  152.   cursor.
  153.  
  154.  
  155. ■ Summary
  156.  
  157.   VOID FPENTRY MGetPos( INT2 *Button, INt2 *x, INT2 *y );
  158.  
  159.   Button      returns the status of each button by its corresponding
  160.               bit value. If a bit is 0 then that button is up.  If a
  161.               bit is 1 then that button is pressed.
  162.  
  163.               Bit  Value  Button
  164.               ───  ───── ─────────────
  165.               0     1    left button
  166.               1     2    right button
  167.               2     4    middle button
  168.  
  169.   x           column the mouse cursor is in.
  170.  
  171.   y           row the mouse cursor is in.
  172.  
  173.  
  174. ■ Remarks
  175.  
  176.   In 80 column text mode the upper left corner of the screen is 1,1
  177.   and the lower right corner is 80,25.
  178.  
  179.  
  180. ■ Example
  181.  
  182.   MGetPos( &ButStat, &x, &y );
  183.  
  184.   if ( ButStat & 1 )
  185.      printf( "button is pressed" );
  186.  
  187.   if ( ButStat & 2 )
  188.      printf( "button is pressed" );
  189.  
  190.   if ( ButStat & 4 )
  191.      printf( "button is pressed" );
  192.  
  193.   printf( "The cursor is located at %u,%u", x, y );
  194. ..page
  195. ..head03AMGetSpeed
  196. ■ Mouse Driver Version     [1.xx+]
  197.  
  198. ■ Source Module Name  mgspeed.asm
  199.  
  200.  
  201. ■ Description
  202.  
  203.   Returns the distance the mouse has moved since the last call to this
  204.   routine.
  205.  
  206.  
  207. ■ Summary
  208.  
  209.   VOID FPENTRY MGetSpeed( INT2 *HorCnt, INt2 *VerCnt );
  210.  
  211.   HorCnt      returns horizontal step count since last call.
  212.  
  213.   VerCnt      returns vertical step count since last call.
  214.  
  215.  
  216. ■ Remarks
  217.  
  218.   The step count is always in the range -32768 to 32767. A positive
  219.   value specifies movements to the right and down while negative
  220.   values specify movements to the left and up.  After the call is
  221.   completed the step counts are reset to zero.
  222.  
  223. ■ Example
  224.  
  225.   MGetSpeed( &HorCnt, &VerCnt );
  226.  
  227.   if ( HorCnt > 0 )
  228.      printf(" Mouse moved to the right ")
  229.   else if ( HorCnt < 0 )
  230.      printf(" Mouse moved to the left ")
  231.   else
  232.      printf(" Mouse did not move horizontally" );
  233.  
  234.   This example will report the horizontal direction the mouse has
  235.   moved since the last call to this routine.
  236. ..page
  237. ..head03AMGraphCursor
  238. ■ Mouse Driver Version     [1.xx+]
  239.  
  240. ■ Source Module Name  mgraphcu.asm
  241.  
  242.  
  243. ■ Description
  244.  
  245.   Defines the shape and color of the mouse cursor when in graphics
  246.   mode.
  247.  
  248. ■ Summary
  249.  
  250.   VOID FPENTRY MGraphCursor( INT2  XHotSpot, INT2  YHotSpot,
  251.                  UINT2 CMaskSeg, UINT2 CMaskOfs );
  252.  
  253.   XHotSpot    a value in the range -16 to 16 used to define the X
  254.               pixel within or outside the cursor block
  255.  
  256.   YHotSpot    a value in the range -16 to 16 used to define the Y
  257.               pixel within or outside the cursor block.
  258.  
  259.   CMaskSeg    the segment of the cursor mask description variable.
  260.  
  261.   CMaskOfs    the offset of the cursor mask description variable.
  262.  
  263.  
  264. ■ Remarks
  265.  
  266.   The cursor mask variable is two arrays of 16 words each.  The first
  267.   16 words define the screen mask and the second 16 words define the
  268.   cursor mask.  Each array of 16 words defines the set of pixels that
  269.   are 16x16.
  270.  
  271.   The screen mask is used to determine which pixels become part of the
  272.   cursor shape while the cursor mask is used to determine the
  273.   color/shape of the cursor.
  274.  
  275. ■ Example
  276.  
  277.   UINT CMask[32] =
  278.      {
  279.      0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
  280.      0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
  281.  
  282.      0xffff, 0xffff, 0xf00f, 0xf00f, 0xf00f, 0xf00f, 0xf00f, 0xf00f,
  283.      0xf00f, 0xf00f, 0xf00f, 0xf00f, 0xf00f, 0xf00f, 0xffff, 0xffff
  284.      };
  285.  
  286.   MGraphCursor( -5, 5, FP_SEG( CMask ), FP_OFF( CMask ) );
  287.  
  288.   The cursor defined by CMask will be a solid block with a smaller
  289.   block inside being a different color.
  290. ..page
  291. ..head03AMHideCursor
  292. ■ Mouse Driver Version     [1.xx+]
  293.  
  294. ■ Source Module Name  mhidecur.asm
  295.  
  296.  
  297. ■ Description
  298.  
  299.   Removes the mouse cursor from the screen.
  300.  
  301.  
  302. ■ Summary
  303.  
  304.   VOID FPENTRY MHideCursor( VOID );
  305.  
  306.  
  307. ■ Remarks
  308.  
  309.   Although the mouse cursor is hidden from view its motion is still
  310.   tracked.
  311.  
  312.  
  313. ■ Example
  314.  
  315.   MHideCursor();
  316. ..page
  317. ..head03AMInitEventHandler
  318. ■ Mouse Driver Version     [1.xx+]
  319.  
  320. ■ Source Module Name  minithan.asm
  321.  
  322.  
  323. ■ Description
  324.  
  325.   Initializes the mouse interrupt event handler.
  326.  
  327.  
  328. ■ Summary
  329.  
  330.   VOID FPENTRY MInitEventHandler( INT2 EventMask );
  331.  
  332.   EventMask   defines the event types the mouse event handler will
  333.               place in its queue.
  334.  
  335.  
  336. ■ Remarks
  337.  
  338.   Each bit in the event mask corresponds to a specific event:
  339.  
  340.   Bit     Value   Event
  341.   ───     ─────   ────────────────────────────────────────
  342.    0         1    cursor position moved
  343.    1         2    left button pressed
  344.    2         4    left button released
  345.    3         8    right button pressed
  346.    4        16    right button released
  347.    5        32    middle button pressed
  348.    6        64    middle button released
  349.    7-15           not used
  350.  
  351.  
  352. ■ Example
  353.  
  354.   MInitEventHandler( 4 );
  355.  
  356.   In this example the only time an event is recorded in the event
  357.   handler queue is when the left button of the mouse is released.
  358.   When this happens the global variable NEvents will be incremented.
  359.   The maximum number of events that is kept in the event queue at one
  360.   time is 20. MRetQue must be used to empty the queue. DO NOT change
  361.   the value of NEvents as this may cause severe problems.
  362.  
  363.   When you have finished using the event handler you must uninstall
  364.   the event handler with:
  365.  
  366.   MInitEventHandler( 0 );
  367. ..page
  368. ..head03AMPollQue
  369. ■ Mouse Driver Version     [1.xx+]
  370.  
  371. ■ Source Module Name  mpollque.asm
  372.  
  373.  
  374. ■ Description
  375.  
  376.   Returns a copy of the oldest event in the mouse event queue.  The
  377.   event queue is left unchanged.
  378.  
  379.  
  380. ■ Summary
  381.  
  382.   VOID FPENTRY MPollQue( INT2 *Event, INT2 *ButStat,
  383.              INT2 *x,     INT2 *y       );
  384.  
  385.   Event       an integer describing the event that occurred (See
  386.               MInitEventHandler).
  387.  
  388.   ButStat     button status at time of event.
  389.  
  390.   x           column mouse cursor was located in at the time of event.
  391.  
  392.   y           row mouse cursor was located in at the time of event.
  393.  
  394.  
  395. ■ Remarks
  396.  
  397.   If the number of events in the queue is zero when this procedure is
  398.   called the values in the return variables will be -1.  Use the
  399.   global variable NEvents to determine if an event is in the queue.
  400.  
  401. ■ Example
  402.  
  403.   MPollQue( &Event, &ButStat, &x, &y );
  404.  
  405.   In this example MPollQue is called to get the oldest event
  406.   information without removing the event from the queue.
  407. ..page
  408. ..head03AMResetMouse
  409. ■ Mouse Driver Version     [1.xx+]
  410.  
  411. ■ Source Module Name  mresetm.asm
  412.  
  413.  
  414. ■ Description
  415.  
  416.   Determines if the mouse hardware and software are installed.
  417.  
  418.  
  419. ■ Summary
  420.  
  421.   INT2 FPENTRY MResetMouse( INT2 NBut );
  422.  
  423.   Button      returns the number of buttons on the mouse.
  424.  
  425.  
  426. ■ Remarks
  427.  
  428.   MResetMouse will return:
  429.       0 - Mouse hardware and software are not installed.
  430.      -1 - Mouse hardware and software are installed.
  431.  
  432.   Every call to MResetMouse will also reset the position of the mouse
  433.   cursor to the middle of the video dispaly.
  434.  
  435.  
  436. ■ Example
  437.  
  438.   #include <fpclib.h>
  439.  
  440.   main()
  441.   {
  442.      INT NBut;
  443.  
  444.      if ( !MResetMouse( &NBut ) )
  445.         printf( "Mouse NOT installed on your computer" );
  446.      else {
  447.         printf( "You have a mouse in your computer" );
  448.         printf( "Squeak Squeak Squeak..." );
  449.      }
  450.   }
  451. ..page
  452. ..head03AMRetQue
  453. ■ Mouse Driver Version     [1.xx+]
  454.  
  455. ■ Source Module Name  mretque.asm
  456.  
  457.  
  458. ■ Description
  459.  
  460.   Returns the oldest event in the mouse event queue and removes the
  461.   event from the queue.
  462.  
  463.  
  464. ■ Summary
  465.  
  466.   VOID FPENTRY MRetQue( INT2 *Event, INT2 *ButStat
  467.             INT2 *x,     INT2 *y      );
  468.  
  469.   Event       returns the event that occurred (see MInitEventHandler).
  470.  
  471.   ButStat     button status at the time of this event.
  472.  
  473.   x           column mouse cursor was located in at time of event.
  474.  
  475.   y           row mouse cursor was located in at time of event.
  476.  
  477.  
  478. ■ Remarks
  479.  
  480.   If the number of events in the queue is zero when this procedure is
  481.   called the values in the return variables will be -1.  Use the
  482.   global variable NEvents to determine if an event is in the queue.
  483.  
  484.  
  485. ■ Example
  486.  
  487.   #include <fpclib.h>
  488.  
  489.   main()
  490.   {
  491.      INT NBut;
  492.  
  493.      if ( MResetMouse( &NBut ) ) {
  494.         MInitEventHandler( 2 );
  495.  
  496.         while ( NEvents > 0 )
  497.            MRetQue( &Event, &ButStat, &x, &y );
  498.      }
  499.   }
  500.  
  501.   In this example MRetQue is called until the mouse event queue is
  502.   empty.
  503. ..page
  504. ..head03AMSetEvent
  505. ■ Mouse Driver Version     [1.xx+]
  506.  
  507. ■ Source Module Name  msetevnt.asm
  508.  
  509.  
  510. ■ Description
  511.  
  512.   Simulates a mouse event.
  513.  
  514.  
  515. ■ Summary
  516.  
  517.  
  518.   void MRetQue( INT PTR Event, INT PTR ButStat,
  519.                 INT PTR x,     INT PTR y       );
  520.  
  521.   Event       event that should occur (see MInitEventHandler).
  522.  
  523.   ButStat     button status for this event.
  524.  
  525.   x           column of the mouse cursor for this event.
  526.  
  527.   y           row of the mouse cursor for this event.
  528.  
  529.  
  530. ■ Remarks
  531.  
  532.   If the number of events in the queue is less than the maximum number
  533.   of events allowed in the queue then the event will be placed as the
  534.   newest or last mouse event to occur.  All global and local variables
  535.   used for this procedure will be updated exactly the same as if an
  536.   actual mouse event had occurred.
  537.  
  538. ■ Example
  539.  
  540.   MSetEvent( 1, 0, 80, 25 );
  541.  
  542.   In this example MSetEvent will place in the mouse event queue an
  543.   event that says the left button was pressed with the position of the
  544.   mouse cursor being at column 80 row 25.
  545. ..page
  546. ..head03AMSetPos
  547. ■ Mouse Driver Version     [1.xx+]
  548.  
  549. ■ Source Module Name  msetpos.asm
  550.  
  551.  
  552. ■ Description
  553.  
  554.   Set the position of the mouse cursor.
  555.  
  556.  
  557. ■ Summary
  558.  
  559.   VOID FPENTRY MSetPos( INT2 x, INT2 y );
  560.  
  561.   x           column to put mouse cursor in
  562.  
  563.   y           row to put mouse cursor in
  564.  
  565.  
  566. ■ Remarks
  567.  
  568.   Checks for valid X and Y values are NOT performed.  In 80 column
  569.   text mode the upper left corner of the screen is 1,1 and the lower
  570.   right corner is 80,25.
  571.  
  572. ■ Example
  573.  
  574.   MSetPos( 1, 1 );
  575.  
  576.   Assuming text mode this example will place the mouse cursor in row
  577.   one column one of the display screen.
  578. ..page
  579. ..head03AMSetSpeed
  580. ■ Mouse Driver Version     [1.xx+]
  581.  
  582. ■ Source Module Name  msspeed.asm
  583.  
  584.  
  585. ■ Description
  586.  
  587.   Sets mouse motion to screen pixel ratio.
  588.  
  589.  
  590. ■ Summary
  591.  
  592.   VOID FPENTRY MSetSpeed( INT2 HorCnt, INT2 VerCnt );
  593.  
  594.   HorCnt      the horizontal step ratio.  The value is in the range of
  595.               1 to 32767 where the ratio will be HorCnt steps to 8
  596.               pixels horizontally.
  597.  
  598.   VerCnt      the vertical step ratio.  The value is in the range of 1
  599.               to 32767 where the ratio will be VerCnt steps to 8
  600.               pixels vertically.
  601.  
  602.  
  603. ■ Remarks
  604.  
  605.   The step values refer to the amount of mouse movement.
  606.  
  607. ■ Example
  608.  
  609.   MSetSpeed( 16, 8 );
  610.  
  611.   This example sets the ratios as follows:
  612.      Horizontal - 16 steps to 8 pixels
  613.      Vertical   - 8 steps to 8 pixels
  614. ..page
  615. ..head03AMSetXRange
  616. ■ Mouse Driver Version     [1.xx+]
  617.  
  618. ■ Source Module Name  msetxy.asm
  619.  
  620.  
  621. ■ Description
  622.  
  623.   Sets the column boundaries the mouse cursor will be allowed to move
  624.   within.
  625.  
  626.  
  627. ■ Summary
  628.  
  629.   VOID FPENTRY MSetXRange( INT2 Min, INT2 Max );
  630.  
  631.   Min         left column boundary for the mouse cursor.
  632.  
  633.   Max         right column boundary for the mosue cursor.
  634.  
  635.  
  636. ■ Remarks
  637.  
  638.   Range checks are not performed on the parameters.
  639.  
  640.  
  641. ■ Example
  642.  
  643.   MSetXRange( 10, 20 );
  644.  
  645.   In this example the mouse cursor will not be allowed to move to the
  646.   left of column 10 and to the right of column 20.
  647. ..page
  648. ..head03AMSetYRange
  649. ■ Mouse Driver Version     [1.xx+]
  650.  
  651. ■ Source Module Name  msetxy.asm
  652.  
  653.  
  654. ■ Description
  655.  
  656.   Sets the row boundaries the mouse cursor will be allowed to move
  657.   within.
  658.  
  659.  
  660. ■ Summary
  661.  
  662.   VOID FPENTRY MSetYRange( INT2 Min, INT2 Max );
  663.  
  664.   Min         top row boundary of mouse cursor.
  665.  
  666.   Max         bottom row boundary of mouse cursor.
  667.  
  668.  
  669. ■ Remarks
  670.  
  671.   Range checks are not performed on the parameters.
  672.  
  673.  
  674. ■ Example
  675.  
  676.   MSetYRange( 3, 20 );
  677.  
  678.   In this example the mouse cursor will not be allowed to move above
  679.   row 3 and below row 20.
  680. ..page
  681. ..head03AMShowCursor
  682. ■ Mouse Driver Version     [1.xx+]
  683.  
  684. ■ Source Module Name  mshowcur.asm
  685.  
  686.  
  687. ■ Description
  688.  
  689.   Display the mouse cursor on the screen
  690.  
  691.  
  692. ■ Summary
  693.  
  694.   VOID FPENTRY MShowCursor( VOID );
  695.  
  696.  
  697. ■ Example
  698.  
  699.   MShowCursor()
  700. ..page
  701. ..head03AMTextCursor
  702. ■ Mouse Driver Version     [1.xx+]
  703.  
  704. ■ Source Module Name  mtextcur.asm
  705.  
  706.  
  707. ■ Description
  708.  
  709.   Defines the mouse text cursor
  710.  
  711.  
  712. ■ Summary
  713.  
  714.   VOID FPENTRY MTextCursor( INT2 CType, INT2 SMask, INT2 CMask );
  715.  
  716.   CType       selects the type of mouse cursor to use.
  717.                  0 - software cursor
  718.                  1 - hardware cursor
  719.  
  720.   SMask       if the software cursor is selected the screen mask is
  721.               defined.  If the hardware cursor is selected the
  722.               starting scan line is defined.
  723.  
  724.   CMask       if the software cursor is selected the cursor mask is
  725.               defined.  If the hardware cursor is selected the ending
  726.               scan line is defined.
  727.  
  728. ■ Remarks
  729.  
  730.   The screen mask is an integer that defines which of the character
  731.   attributes are preserved.  The cursor mask is used to determine
  732.   which of the characteristics are changed by the cursor.
  733.  
  734.   See SetCursor Size in chapter two for a description of the starting
  735.   and ending scan lines.
  736.  
  737.  
  738. ■ Example
  739.  
  740.   MTextCursor( CType, SMask, CMask );
  741. ..page
  742.