checking mouseclicks... [bubba especially for you]

This is a discussion on checking mouseclicks... [bubba especially for you] within the C++ Programming forums, part of the General Programming Boards category; i use 0x33 function 5 and 6 for mouseclicks. but i get nothing in the bx [for number of clicks] ...

  1. #1
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459

    checking mouseclicks... [bubba especially for you]

    i use 0x33 function 5 and 6 for mouseclicks. but i get nothing in the bx [for number of clicks] on return. i have a continuous polling loop for this, and the coordinate values are fine... so checking for press and release within a given bounds works, except that those coordinates stay on each subsequent call until another click displaces them. here's some of my code... please forgive the shorthands... [bubba you know about it...]

    Code:
    // snippet 2
    /***************************** press *******************************************
    
    This function retrieves the button press data.
    
    *******************************************************************************/
    
      vo HE::MF::press (vo)
      {
        for (un u0 = 0; u0 < 3; u0++)
        {
          __dpmi_regs io;
    
          io.x.ax = 0x0005;
          io.x.bx = u0;
          __dpmi_int (0x33, &io);
    
          HE::MF::VARS::press_n [u0] = io.x.bx >> 3;
          HE::MF::VARS::press_x [u0] = io.x.cx >> 3;
          HE::MF::VARS::press_y [u0] = io.x.dx >> 3;
        }
      }
    
    /***************************** release *****************************************
    
    This function retrieves the button release data.
    
    *******************************************************************************/
    
      vo HE::MF::release (vo)
      {
        for (un u0 = 0; u0 < 3; u0++)
        {
          __dpmi_regs io;
    
          io.x.ax = 0x0006;
          io.x.bx = u0;
          __dpmi_int (0x33, &io);
    
          HE::MF::VARS::rel_n [u0] = io.x.bx >> 3;
          HE::MF::VARS::rel_x [u0] = io.x.cx >> 3;
          HE::MF::VARS::rel_y [u0] = io.x.dx >> 3;
        }
      }
    i would just not have a continuous polling loop but i would still need to check for clicks and stop checking upon a release [which might be difficult and tedius if i can find out why bx is returning nothing]. i appreciate any help you can give... thank you very much...
    hasafraggin shizigishin oppashigger...

  2. #2
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    and here's...

    Code:
    // snippet 1
    /***************************** button_bounds_check *****************************
    
    This function returns 1 if the mouse position is within the passed boundaries.
    Else it returns zero.
    
    *******************************************************************************/
    
      un F5::PROTOCOL::button_bounds_check (un xl, un yl, un xh, un yh)
      {
        if ( (MX_POS <  xl) ||
             (MX_POS >= xh) ||
             (MY_POS <  yl) ||
             (MY_POS >= yh) ) return (0);
        else                  return (1);
      }
    
    /***************************** check_click *************************************
    
    This function returns 1 if a button has been clicked [and released] within the
    boundaries.  It's used to get that nice user interface feel.
    
    *******************************************************************************/
    
      un F5::PROTOCOL::check_click (un xl, un yl, un xh, un yh, un btn_stat)
      {
        un ox, oy;
    
        HE::MF::b_check ();
    //    if (M_BTN)
        {
          HE::MF::press ();
          HE::MF::release ();
        }
    
    //    if (HE::MF::VARS::press_n [btn_stat] == 0) return (0);
    
        ox = MX_POS;
        oy = MY_POS;
    
        MX_POS = HE::MF::VARS::press_x [btn_stat];
        MY_POS = HE::MF::VARS::press_y [btn_stat];
    
        if (F5::PROTOCOL::button_bounds_check (xl, yl, xh, yh) == 0)
        {
          MX_POS = ox;
          MY_POS = oy;
          return (0);
        }
    
        MX_POS = HE::MF::VARS::rel_x [btn_stat];
        MY_POS = HE::MF::VARS::rel_y [btn_stat];
        if (F5::PROTOCOL::button_bounds_check (xl, yl, xh, yh) == 0)
        {
          MX_POS = ox;
          MY_POS = oy;
          return (0);
        }
    
        relpress ();
    
        for (un u0 = 0; u0 < 4; u0++)
        {
          HE::MF::VARS::press_n [u0] = 0;
          HE::MF::VARS::press_x [u0] = 0;
          HE::MF::VARS::press_y [u0] = 0;
          HE::MF::VARS::rel_n [u0] = 0;
          HE::MF::VARS::rel_x [u0] = 0;
          HE::MF::VARS::rel_y [u0] = 0;
        }
    
        return (1);
    /*
    //    if (button_bounds_check (xl, yl, xh, yh) == 0) return (0);
    
        //  new click, non-source to source, + must be within bounds
        HE::MF::b_check ();
        if ((M_BTN == btn_stat))
        {
          //  wait until non-source
          while (M_BTN == btn_stat)
          {
            HE::MF::b_check ();             //  update status, and graphics
            F5::OUTPUT::standard_graphics_loop (0);
          }
    
          //  if still in bounds success, if out during non-source, fail
          if (button_bounds_check (xl, yl, xh, yh)) return (1);
          else return (0);
        }
        //  if not on status after btn switch, or not within bounds after btn switch
        else return (0);
    */
      }
    it complains about IMG tags, and i don't know why, i guess it was just too much...
    hasafraggin shizigishin oppashigger...

  3. #3
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    okay figured out the problem, trashing bx [button press] data by shifting... hehe...

    and about the IMG tags, we talked about that on the mod board, so that's resolved, and yes smiles are treated as IMG tags apparently...

    and about this... so now i can't get the interface to work correctly... still working, and still need help. can anyone answer? thanks...

    /*edit by doubleanti, moved by modship for sake of traffic advant. previously to this it was on the DOS board */
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. Overflow and range checking for mul/div
    By Elysia in forum C++ Programming
    Replies: 28
    Last Post: 06-06-2008, 02:09 PM
  3. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  4. Forced moves trouble!!
    By Zishaan in forum Game Programming
    Replies: 0
    Last Post: 03-27-2007, 06:57 PM
  5. Problems about gcc installation
    By kevin_cat in forum Linux Programming
    Replies: 4
    Last Post: 08-09-2005, 09:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21