Thread: Mouse + Animation Trouble

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    10

    Question Mouse + Animation Trouble

    I am trying to program a mouse into my program. My mouse function stores all of the pixels under the cursor into a matrix called umouse. It then draws the cursor. Whenever the mouse moves, the mouse is erased using the umouse data, then umouse stores the new data while the cursor is being drawn.

    Only one problem...
    Whenever some other object moves over the mouse, i.e. a moving colored tile moves over the cursor, when the cursor moves, it deletes part of the other object (colored tile) and replaces it with the umouse data.

    How can I make a decent mouse function that doesn't change any other part of the screen?

    I am using Turbo C++ 1.00

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    10

    Code

    Attached is the code that I used.

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    129
    First you must realize most people dont care about your other code, if you could clean it up a bit and just have the mouse code Im sure people would help out more. Are you making an editor for a tile rpg or something?
    flashdaddee.com rocks!!!

  4. #4
    Registered User Sunny's Avatar
    Join Date
    Nov 2001
    Posts
    101

    ...

    It would be nice if you told us a little bit more information. Like, what kind of compiler are you using, what video mode.
    Oyherwise, you could try (if you are using a borland) downloading the svgacc lib file from :
    http://www.zephyrsoftware.com
    and adding it to your project for compilation.

    tell us more


    Stef

  5. #5
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    hmm....

    does that show how to capture mouse clicks??

    Is it hard to do that?
    What is C++?

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The original mouse handler use XOR and AND to do this.

    However, if you use a double buffer you can do this as well.




    To trap mouse clicks use subfuntion 03h.


    void GetMousePosition(void)
    {
    union REGS regs;
    regs.x.ax=0x03;
    int86(0x33,& regs, & regs);

    int ButtonDown=regs.x.bx;
    int XPos=regs.x.cx;
    int YPos=regs.x.dx;
    }


    For graphic mode resolutions below 640 you must divide CX by 2 to get the correct result. int XPos=regs.x.cx>>1;

  7. #7
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    Uhh... Oke?

    What is C++?

  8. #8
    is GetMousePosition() a function from the svgacc-lib-thingy that was mentioned, or is it elsewhere?

  9. #9
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    No, I just coded that for my post.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM
  2. Animation class not working
    By VirtualAce in forum Game Programming
    Replies: 5
    Last Post: 03-02-2005, 06:48 AM
  3. Making a mouse hover button, API style
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 05-27-2004, 06:17 AM
  4. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM
  5. Trouble with animation using Sleep
    By QuestionC in forum Windows Programming
    Replies: 6
    Last Post: 02-06-2002, 11:08 AM