Recognizing mouse movement???

This is a discussion on Recognizing mouse movement??? within the C++ Programming forums, part of the General Programming Boards category; Ok so here's the deal. I'm trying to create an "eye" program with c++. Basically what the program should do ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    1

    Recognizing mouse movement???

    Ok so here's the deal. I'm trying to create an "eye" program with c++. Basically what the program should do is draw an eye within a graphics window and then the eye will follow the movement of the mouse and when clicked the color of the eye changes. The only thing that i just can't figure out how to do is to get the eye to follow the mouse. I've tried everything on the internet but i can't find any resources that actually make sense. any help would be appreciated

  2. #2
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    use flash

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    There's a Linux program called X-Eyes. Do a search for that, and since it's for Linux, you should be able to get source code. It's a common practice where my brother-in-law works, since you can start it remotely, to use X-Eyes as a prank. They just all get together and try to open X-Eyes on "the new guy's" computer.

    Another option is to learn about event handlers in C++. That will give you what you need to have your program react everytime the mouse moves or clicks something. They will also allow to get the location of the mouse/cursor, and to know exactly where the mouse is clicking.

    Hope this helps!

  4. #4
    Registered User
    Join Date
    Nov 2003
    Posts
    168
    Quote Originally Posted by sean_mackrory
    Another option is to learn about event handlers in C++. That will give you what you need to have your program react everytime the mouse moves or clicks something. They will also allow to get the location of the mouse/cursor, and to know exactly where the mouse is clicking.
    Exactly that. I started scripting on a simpler version of C++, more of a game engine. There were variables like mousex,mousey, and if codes like if (leftmousebutton){}. If these can be used on that game, I'm positive it is possible to get mouse coordinates with C++ too.

    Scripting the follow-system of the mouse would require something that measures the distance from the mouse to the center of the eye, and then move the eye to the mouse at a speed of, say, 1 pixel per .05 second.
    -Felix
    Rots Soft
    If the facts don't fit the theory, change the facts.
    Albert Einstein (1879 - 1955)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simulating mouse movement in other windows
    By Wiretron in forum Windows Programming
    Replies: 11
    Last Post: 10-13-2007, 09:11 AM
  2. simple mouse movement program
    By skankles in forum Windows Programming
    Replies: 3
    Last Post: 05-27-2007, 08:54 PM
  3. Controlling Mouse movement?
    By raum in forum Windows Programming
    Replies: 6
    Last Post: 07-02-2004, 09:46 AM
  4. Mouse Movement
    By Extol in forum Windows Programming
    Replies: 6
    Last Post: 04-22-2003, 09:48 PM
  5. Need to read mouse movement in program
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 01-03-2002, 03:15 PM

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