Previous,
Next
Mouse Events Tutorial - Page 2/3
The next function returns the mouse status information - whether a mouse button is down and vertical and horizontal locations of the mouse pointer. As you can see the register AX is initially set as 0x3. After the interrupt has been called, register BX holds button information, register CX holds horizontal position, and register DX holds vertical position. If register BX is 0 then it means that no button is being held down, 1 means that left mouse button is down, 2 means that right mouse button and so on. Hence the calling the following function results in x holding horizontal position, y holding vertical position and b holding the button number.
The above functions should be sufficient for most purposes. However to track button presses you can use set register AX as 0x5, register BX as the button number. Register BX will hold the number of presses after the interrupt call. Register CX and DX will hold values of the horizontal and vertical locations of the mouse pointer during the last button press. Similarly for button releases you can set the register AX as 0x6. The mouse pointer can be moved to desired location by setting register AX as 0x4 and registers CX and DX as the horizontal and vertical positions respectively.
The following function uses int86x() and struct SREGS which are explained in detail in the Turbo C++ help files. The function can be used to change the way your graphics mouse pointer looks. 'shape' is a 32 element integer array (where each integer is 2 bytes). What I understand of it is that it forms a 16/16 bitmap and a 16/16 overlay for the bitmap. The combination of the bitmap and overlay will give us 4 possibilities - black, transparent, white and inverse. I've made some pretty good cursors which you might like - similar to cursors in MS Paint. The cursors have also been given below.
See next page for cursor masks - and some free samples.
Previous,
Next