Thread: mouse programming

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    1

    Question mouse programming

    hi ,can anyone tell me how to change the color of the mouse pointer while working with graphics in c.i think it will require the use of interrupts

  2. #2
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    www.brackeen.com

    Go to the VGA tutorial on the site. It has some mouse stuff.
    My Website

    "Circular logic is good because it is."

  3. #3
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    when i do my mousing, i don't use the hw cursor, instead, i just use my own since using most hw cursors [tied to an interrupt] don't allow you to do tricks like animation and they are limited to particular video modes... so, i recommend you do use interrupts for your other mousing variables, [int 33h...] and use your own cursor setup...
    hasafraggin shizigishin oppashigger...

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Excellent doubleanti. He is right. For mouse cursors you should use your own graphics. The hardware cursor is fine for applications, but usually not for games or other types of programming.

    There is not a function in the standard MS/Logitech mouse driver for changing the color of the mouse pointer. However, some drivers provide more (sometimes less) support for various functions. But the standard functions 00h through 09h do not handle mouse cursor color.

    Just use sub-function 03h to retrieve the coords of the mouse and place your own graphic at those coords. If double-buffering just 'put' your mouse graphic in the buffer at those coords. This is done after all other operations (drawing, rendering, etc) are complete. When you copy the buffer to vidmem the mouse cursor will be on top of all of the graphics. If you are not double-buffering, use bit masks to define your mouse cursor.
    I think the order of logical ops is:
    • AND the mouse cursor mask with the screen image
    • XOR the mouse cursor data with the screen image


    Code:
    union REGS regs;
    regs.x.ax=0x03;
    int86(0x33,regs,regs)
    int mousex=regs.cx;   //regs.cx>>1 for 320 width
    int mousey=regs.dx;
    //call your function to put the image at mousex,mousey
    You must have ampersands before the regs in the call to int86().
    For some reason, this board messes up the ampersands which prevents me from using them correctly.

    If you want to change your hardware mouse cursor, use sub-function 09h and the appropriate bit masks. Logical operations are taken care of by the interrupt handler.

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Hmmm no ampersands? I didn't know that...There is probably a way.

    &

    &
    Code:
    &
    lets see if any of those work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need Help in Mouse Pointer
    By obaid in forum C++ Programming
    Replies: 3
    Last Post: 12-07-2006, 03:33 AM
  2. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM
  3. Problem with Mouse Over Menu!!! HELP!!!
    By SweeLeen in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2006, 02:10 AM
  4. Making a mouse hover button, API style
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 05-27-2004, 06:17 AM
  5. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM