Is it possible to use Unbuffered input with CEGUI?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

majc
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Sat Apr 12, 2008 20:55

Is it possible to use Unbuffered input with CEGUI?

Postby majc » Fri Aug 15, 2008 17:02

Im using unbuffered input.
When i click in my exit button nothing happens.
This is my code:

cGUIInterface.cpp

bool cGUIInterface::handleQuit(const CEGUI::EventArgs& e)
{
vendorWindow->hide();
return true;
}

void cGUIInterface::vendorMenu()
{
mGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
if (!loadGUILayout)
{
loadGUILayout = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"DFgui.layout");
mGUISystem->setGUISheet(loadGUILayout);
}
loadGUILayout->hide();
vendorWindow = winMgr->getWindow((CEGUI::utf8*)"MainWindow");
vendorWindow->show();
winMgr->getWindow((CEGUI::utf8*)"QuitButton")->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&cGUIInterface::handleQuit, this));
}

and this is my OgreNewtFrameListener code:

Code: Select all

if( ms.buttonDown( MB_Left ) )
   {
      if (timer2 <= 0.0)
      {
         if(FPSmode)
         {
            Ray ray = mBulletGraph->fireCameraRay(0.5,0.5);
            mBullet->update(evt.timeSinceLastFrame, mPlayerCollision, 1000, 5000, 10, ray.getOrigin(), ray.getDirection(), true, mWorld);
            timer2 = 0.5;
         }
         else
         {
            CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition();
            CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);
            Ray ray = mBulletGraph->fireCameraRay(mousePos.d_x/float(ms.width), mousePos.d_y/float(ms.height));
            mBullet->update(evt.timeSinceLastFrame, mPlayerCollision, 1000, 5000, 10, ray.getOrigin(), ray.getDirection(), false, mWorld);
            timer2 = 0.5;
         }
      }
   }


but when i click quit never enters in the handlequit function :s
Thanks in advance!

User avatar
malachy1681
Just popping in
Just popping in
Posts: 19
Joined: Thu Sep 01, 2005 05:29
Contact:

Postby malachy1681 » Fri Aug 15, 2008 18:22

I don't see in your code where you are injecting a mouse button up event. Since a clicked event is not fired until a mouse down/up combo is received, the clicked event handler will never get called.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Fri Aug 15, 2008 19:47

As malachy says, you need to inject input into CEGUI. It does not "automagically" handle input. I suppose you haven't read this tutorial yet: http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Injecting_Inputs

In case you missed any other tutorials:
http://www.cegui.org.uk/wiki/index.php/Tutorials

majc
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Sat Apr 12, 2008 20:55

Postby majc » Fri Aug 15, 2008 22:03

I read it but i thought with unbuffered input its behavior was different but i solved the problem using buffered input and for what you said i can only use buffered input with cegui.
Thanks guys.

User avatar
malachy1681
Just popping in
Just popping in
Posts: 19
Joined: Thu Sep 01, 2005 05:29
Contact:

Postby malachy1681 » Sat Aug 16, 2008 06:36

It is possible to detect a mouse key up event in unbuffered mode, but it would take more code than simply using buffered. Unless you have some real need to catch GUI input in unbuffered mode, there shouldn't be a reason to go to the trouble of implementing it.

majc
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Sat Apr 12, 2008 20:55

Postby majc » Sat Aug 16, 2008 10:21

Yes you right :) Everything is working fine now :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 6 guests