XNA Game Development Forums
2012/05/21 20:15:27 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Mouse Input Issues  (Read 2466 times)
Silvo
Newbie
*
Offline Offline

Posts: 10


View Profile
« on: 2008/04/19 03:51:33 »

Howdy! I am a little concerned right now. It is probably my code, but I just want to check. Do any of you also get extra occurances of mouse clicking? (specifically, I right-click the mouse and hold it down, and it looks like the HMInput component keeps sending out Mouse Click messages to the OnClick event, in other words i press the mouse once, but whilst I'm holding it down, my game thinks it is getting new clicks all the time). Do you get this, or is something dodgy in my source code? (Well, obviously you don't know what my source code is, but you get the gist.)
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #1 on: 2008/04/20 11:31:47 »

are you for sure calling the mouse clicked and not the mouse held event? they are two very different things Wink
Logged
Silvo
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #2 on: 2008/04/21 18:20:50 »

I'm positive. What I want to happen is when you hold down the right mouse button, and move the mouse, the camera rotates. This currently happens, but I also want the camera to zoom out a little when you first right-click. But what is happening is that the zoom-out code is constantly executed -- even though I'm holding the button down. I have triple-checked that the code is in the OnClick event, so now I'm worried that there's something wrong with the HMInput code.
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #3 on: 2008/09/15 00:10:11 »

Figured this one out by the way. The CheckPressedState function was wrong (oops!). Here's the new code for it:

        internal static HMPressedState CheckPressedState(ButtonState currentState, HMPressedState lastState) {
            if (currentState == ButtonState.Pressed) {
                if (lastState == HMPressedState.Pressed || lastState == HMPressedState.Held) {
                    return HMPressedState.Held;
                } else {
                    return HMPressedState.Pressed;
                }
            } else {
                if (lastState != HMPressedState.Released && lastState != HMPressedState.Idle) {
                    return HMPressedState.Released;
                }
            }

            return HMPressedState.Idle;
        }
 
This one is used in version  3 of the tutorials. Hope that helps.
Logged
Pages: [1]
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Tutorial 4 :: Moving Cameras and a Simple Input Component Tutorial Discussion « 1 2 » mikeschuld 21 8463 Last post 2008/12/11 10:42:13
by mikeschuld
Having issues with tutorial 3 Hazy Mind XNA Engine siferion 4 2377 Last post 2006/11/26 14:04:03
by mikeschuld
Not good - issues in the first tutorial. Hazy Mind XNA Engine « 1 2 » Jeddak 20 5375 Last post 2007/03/26 19:31:08
by mikeschuld
Camera Issues Hazy Mind XNA Engine minich21 6 3047 Last post 2007/08/14 21:27:30
by mikeschuld
J.I Styles skin shader implementation issues Hazy Mind 3D Engine DX 1 2117 Last post 2007/03/30 07:53:25
by Nemo Krad
Camera Issues Hazy Mind XNA Engine Trano 3 2811 Last post 2008/09/17 08:27:25
by mikeschuld
Mouse selection (collision?) Hazy Mind XNA Engine Requests Zan 2 2699 Last post 2007/05/19 16:32:50
by Zan
Tutorial 9 - issues with some code Hazy Mind XNA Engine Mike2 3 2003 Last post 2007/08/31 22:30:19
by ChunkyBrewster
GameTime issues General Discussion Mike2 2 2021 Last post 2007/09/14 15:22:07
by Mike2
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.091 seconds with 18 queries.