playMaker

Author Topic: [SOLVED] Mouse Button Down not triggered when mouse cursor is hidden.  (Read 3818 times)

tnaseem

  • Playmaker Newbie
  • *
  • Posts: 7
Hi,

I've noticed that if I hide my mouse cursor, by adding the 'Mouse Set Cursor' and setting it to Hide and Lock, the game no longer responds to mouse button presses. Is there any way around this?

I need to hide the mouse cursor as the game is running in a browser window, but I still need my other FSM to respond to a 'Mouse Button Down' action.

Any help would be most appreciated.

Cheers,
Tarique.
« Last Edit: June 25, 2012, 07:56:30 AM by tnaseem »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mouse Button Down not triggered when mouse cursor is hidden.
« Reply #1 on: June 25, 2012, 01:15:15 AM »
Hi,

 not sure I am following. If your cursor is hidden, how would the user now where the mouse is in order to click on a button?
I think games that hide cursors are games that rely purely on keyboard input and mouse movement and abstract mous clicks, the position on screen where the click happen has no effect,it would be a simple "fire" call

 Or are you saying that when the cursore is revealed again it doesn't work then?

bye,

 Jean

 

tnaseem

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Mouse Button Down not triggered when mouse cursor is hidden.
« Reply #2 on: June 25, 2012, 07:02:33 AM »
Hi Jean,

I have a crosshair (using EZ GUI) in the center of the screen. But that's irrelevant, as I'm not using the mouse cursor to actually select things. All I want to do is respond to a mouse button press.

However, any button presses on the mouse are not being registered if I set the mouse cursor to 'Hide' and 'Lock'.
« Last Edit: June 25, 2012, 07:05:18 AM by tnaseem »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mouse Button Down not triggered when mouse cursor is hidden.
« Reply #3 on: June 25, 2012, 07:11:24 AM »
Hi,

 Then you need to have a state that watch for the button state, not implement the built in event "MOUSE DOWN"

https://hutonggames.fogbugz.com/default.asp?W195

 have you tried that?

Bye,

 Jean

tnaseem

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Mouse Button Down not triggered when mouse cursor is hidden.
« Reply #4 on: June 25, 2012, 07:44:35 AM »
Thanks. Will try that.

However, I think I've realised what the problem is. The issue only occurs if it's 'Locked'.

I added a texture in the 'Set Mouse Cursor' action, as a test. I noticed that the cursor was positioned slightly off the window at the top. Which meant that any button presses wouldn't get registered in the app. I'm confused as to why it doesn't lock the cursor position to the centre of the view though.

I tried the 'NoExit' demo and noticed that the cursor there doesn't lock to the centre either. It's near the top of the view! Same goes for one of the other PlayMaker examples. Very strange...

If I can get that cursor locked position to sit in the centre of the screen I know it will work. Something's amis with my set up here. Just not sure what.

tnaseem

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Mouse Button Down not triggered when mouse cursor is hidden.
« Reply #5 on: June 25, 2012, 07:55:10 AM »
Ok. Figured it out...

It appears that if I place the 'Game' window on my secondary monitor, the Mouse Set Cursor doesn't position the mouse cursor in the centre of the screen when Locked. Doesn't even do this for the Playmaker Examples.

If I drag the Game view to the main screen, the cursor is positioned correctly! This also means that the mouse events are being registered again in my game.

So, something is amis with the Locked mouse cursor position when the game view is on a secondary monitor.