Jump to content

CEGUI Mouse and Keyboard


ParaToxic
 Share

Recommended Posts

Hey guys I would like to use CEGUI and made a layout with the help of the tutorial.But now I going to make userinput.

Until now I injected the Mouseposition with MouseX,Y from LE.

But how can I inject Mouseclicks ans Keyboard input???

 

A code sample would be nice ;D

 

Thanks

 

http://www.cegui.org.uk/docs/current/input_tutorial.html

Blog & Portfolio

 

Current project: moon.chase.star

Link to comment
Share on other sites

Thanks I worte that:

 

CEGUI::System::getSingleton().injectMousePosition(MouseX(), MouseY());
	if(MouseHit(1))
	{
	    CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::LeftButton);
	}
	else if(MouseHit(2))
	{
		CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::RightButton);
	}
	else
	{
		CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::NoButton);
	}

 

But it doesn't work :)

Why?

Link to comment
Share on other sites

Thanks I worte that:

 

CEGUI::System::getSingleton().injectMousePosition(MouseX(), MouseY());
	if(MouseHit(1))
	{
	    CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::LeftButton);
	}
	else if(MouseHit(2))
	{
		CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::RightButton);
	}
	else
	{
		CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::NoButton);
	}

 

But it doesn't work :)

Why?

 

MouseHit() returns true or false based on if Mouse was pressed since the last hit function was called. (From wiki, "Holding the tested button down does not return true, as it is only true if the button has been released and pressed again.".) You'll be injecting every frame, so I think you should use MouseDown().

Blog & Portfolio

 

Current project: moon.chase.star

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...