getCursorControl()->setVisible dose not work.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

Post by instinct »

Im sorry for bringing back a dead topic but im having the same problem and thought i would be overkill to start a new topic about the same subject :)

I want to hide my mouse cursor when the user has held down the left mouse button for 250ms and want to show it again when he releases it. However, it wont hide for some reason. Does anybody know if the code CuteAlien posted works? Im a bit scared of changing Irrlicht sourcecode so i'd like to know if somebody tested it with positive results.
Alucard344
Posts: 21
Joined: Wed May 20, 2009 8:17 pm
Location: Qc, Canada

Post by Alucard344 »

i also have the same problem. what i want to do is, if left click is pressed, hide the cursor and when left click is released show the cursor again. but it looks like the cursor dont get updated if i dont release the click


i am using

Code: Select all

ICursorControl* cursor = device->getCursorControl(); 
cursor->setVisible(false); 
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

instinct wrote:Im sorry for bringing back a dead topic but im having the same problem and thought i would be overkill to start a new topic about the same subject :)
Don't worry - it's not dead, it's just sleeping :-) I wanted to look further into this anyway, I just couldn't reproduce the problem anymore last time I tried. But maybe with your new info I can.

You haven't by chance already written a small example which I can just compile and test to reproduce this?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Alucard344
Posts: 21
Joined: Wed May 20, 2009 8:17 pm
Location: Qc, Canada

Post by Alucard344 »

i am not sure how i can send you a working project via the forum but its very simple to test it, just adding this in the "05.UserInterface" demo project

Code: Select all

virtual bool OnEvent(const SEvent& event)

//...

else if (event.EventType == irr::EET_MOUSE_INPUT_EVENT)
		{
			switch(event.MouseInput.Event)
			{
			case EMIE_LMOUSE_PRESSED_DOWN:
				device->getCursorControl()->setVisible(false);
				break;

			case EMIE_LMOUSE_LEFT_UP:
				device->getCursorControl()->setVisible(true);
				break;

			case EMIE_MOUSE_MOVED:
				
				break;

			default:
				// We won't use the wheel
				break;
			}
		}
the cursor does not become invisible, like if it does not get updated until you do a mouse up.
But, if i alt tab, keeping left click down and alt tab again now the cursor as diseapered and will reappear when i left click up

and sorry for my english, it is not my primary language :D
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Thx Alucard344, I could reproduce it with that.

I have added the fix to the svn trunk (my very first official bugfix - I hope I didn't mess up anything).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

Post by instinct »

sounds good CuteAlien! Could you please read your inbox?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Hmmm... it`s not working if we use a mouse input event only. If we use a key input event it works as expected. So the problem may have sth to do with the mouseinput, right? :?
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Post Reply