home *** CD-ROM | disk | FTP | other *** search
- File: MOUSE.TXT
- Path: ...\REHACK\TEXT\MOUSE.TXT
- Version: 0.01
- Author: Pat Reilly
- CIS Id: 71333,2764
- Created On: 6/26/93
- Modified On:
- Description: Documentation on classes in MOUSE.HPP.
- Tabs: 4
-
- The Mouse class in MOUSE.HPP and MOUSE.CPP were mainly developed so
- that I could test the window classes and the event classes. I'll document
- it here in case we want to use some/most/all of it.
-
- MOUSE.CPP was written for Borland's BC++. I don't think it will compile
- under MSC++ without a lot of modification. It uses Borland's register
- macros (_AX, _BX, etc) and the asm directive (asm int 0x33;).
-
- The Mouse class is designed to work with the REHACK Event, EventQueue
- and Game classes (see EVENT.TXT, EVENTQ.TXT and GAME.TXT respectively). It
- has the normal gamut of mouse class functions, and installs a user function
- to the driver which gets called whenever the mouse moves or a button is
- depressed or released. Mouse supports the dblClicked member in the
- PosDeviceEvent class.
- All the methods for Mouse are static. That means that if MOUSE.HPP is
- included in a module, then you can call the functions directly:
- if(Mouse::isPresent()) ...
-
- Methods
- =======
-
- ~Mouse() virtual destructor
- Calls remove() to remove the callback function.
-
- bool isPresent() static
- Returns true if the mouse driver is present, else false.
-
- bool install() static
- Installs the callback function and readies the mouse for use; returns
- true if a mouse driver is present, else false (failed install).
-
- void remove() static
- Removes the callback function and clears the mouse driver (if the
- mouse driver is installed).
-
- void setBounds(const Rect& rect) static
- Sets the bounding rect for the mouse (if installed). Note that this
- can be misleading; even in 320x200 mode, my Logitech wanted a rect
- width of 640 (instead of 320).
-
- void show() static
- If installed, calls the mouse driver's show function. Note that
- mouse driver's use an incremental hide(), so this function won't
- necessarily make the mouse visible; it 'pops' one hide() call from
- the driver. So if you call hide() twice and then call show(), the
- mouse cursor will not be displayed; you have to call show() again.
-
- void hide() static
- If installed, calls the mouse driver's hide function. See show().
-
- void moveTo(const Point& pt) static
- Moves the mouse cursor to pt's location, or the nearest point to it
- that's in the bounding rectangle for the mouse (see setBounds). Note
- that some older mouse drivers also will call hide() when this
- function is called, but newer ones won't.
-
- void setCursor(const Point& hotSpot, void* buffer)
- Changes the mouse cursor to the masks in buffer, with a hotspot at
- hotSpot.
-
- void setDblClickInterval(word w) static
- Changes the interval used to determine if a double-click has occured.
- This value is in system time ticks (18.2 per second). The default
- value is 8, which is just short of 1/2 second.
-
- void getStatus(PosDeviceEvent& pd) static
- Sets pd to the current mouse values. See EVENT.TXT for more info on
- the PosDeviceEvent class.
-
- void huge callbackFunction() static protected
- This is the function called by the mouse driver when a mouse change
- occurs. It builds an appropriate Event and calls Game::eventQueue to
- insert the event. The huge modifier is required so that the #pragma
- saveregs can be used to ensure that the registers aren't modified.
-
- bool checkFor() static protected
- Used internally to check the driver status.
-
- Members
- =======
-
- bool checked static protected
- true if the class has already checked for driver presence. Since a
- presence test requires a call which resets the mouse, we only want
- to perform this once.
-
- bool present static protected
- true if a mouse driver is present, else false.
-
- bool installed static protected
- true if callbackFunction() has been registered with the mouse driver.
-
- Event curEvent static protected
- Used by callbackFunction() to build the event which is passed to
- the event queue.
-
- word dblClickInterval static protected
- The maximum number of time ticks (18.2 per second) between depresses
- of a mouse button for it to be considered a double-click. Default
- value is 8 (a little less than 1/2 second).
-
- dword lastLBDown static protected
- The value of the system time counter for the last occurance of a
- left button depress.
-
- dword lastRBDown static protected
- The value of the system time counter for the last occurance of a
- right button depress.
-
- dword lastCBDown static protected
- The value of the system time counter for the last occurance of a
- center button depress.
-
-