@ mouse on Window then no deform ??

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

Moroheuz
Just popping in
Just popping in
Posts: 5
Joined: Wed May 21, 2008 22:47

@ mouse on Window then no deform ??

Postby Moroheuz » Sat Jul 19, 2008 14:32

Hello together,

i have a problem.. @ moment i work on a terraineditor ... with CEGUI ... and Ogre
No my Problem... when i click into the Menu ... also an CEGUI window .. in the background the dorming goes away..

how can i say my code...

if on_cegui_window then no deform ??

this are my codes...

Code: Select all

void Deform ()// Code for Deforming the Terrain
{
            const OIS::MouseState state = mMouse->getMouseState();
         CEGUI::System::getSingleton().injectMousePosition(state.X.abs,state.Y.abs);

         CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition();
            Ray ray = mCamera->getCameraToViewportRay(mousePos.d_x/float(state.width),mousePos.d_y/float(state.height));
................


and for mouse Down

Code: Select all

if (mLMouseDown)
      {

         Deform ();
         bDeforming = true;

      }


and now my mousereleaseCode

Code: Select all

bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
    {



      CEGUI::System::getSingleton().injectMouseButtonDown(convertButton(id));

       if (id == OIS::MB_Left)
       {
           mLMouseDown = true;
       } // if
       // Right mouse button down
       else if (id == OIS::MB_Right)
       {
           CEGUI::MouseCursor::getSingleton().hide();
           mRMouseDown = true;
       } // else if
        return true;
    }


Thanks for Help to all

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sat Jul 19, 2008 16:38

Hi, and welcome :)

If you're using CEGUI 0.5.x you can check the return from the injectMouseButtonDown function and if it returns true, do not then pass the input to the rest of your app. So, perhaps:

Code: Select all

bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
    {

      if (CEGUI::System::getSingleton().injectMouseButtonDown(convertButton(id)))
            return true;

       if (id == OIS::MB_Left)
       {
           mLMouseDown = true;
       } // if
       // Right mouse button down
       else if (id == OIS::MB_Right)
       {
           CEGUI::MouseCursor::getSingleton().hide();
           mRMouseDown = true;
       } // else if
        return true;
    }


In CEGUI 0.6.x the above behaviour is broken, and you have to work around the issue. One way is to subscribe a handler to relevant events (so mouse button down, at least) on your root GUI window, in the handler you need to check if the mouse is in the root window itself, or some child of the root window. If the mouse is in the root window itself, return false from the event handler, otherwise return true. This will effectively emulate the old behaviour, and the 0.5.x construct above should continue to function.

HTH

CE.

Moroheuz
Just popping in
Just popping in
Posts: 5
Joined: Wed May 21, 2008 22:47

Postby Moroheuz » Sat Jul 19, 2008 16:53

Ahh Thanks... so simple :-)

@ Moment i use 0.5.X ... but i need the treeoption in some weeks ;-)
also 0.6.x

Then perhaps i make an Hack ... i say i will use an other mousearrow on_window. then it is simple... @ Windows use mousearrow "x" then If use mousearrow "x" bDeforming = false;

is this an idea too ??

i don`t have this code @ moment.. but it can work too ?? or don`t ??

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sun Jul 20, 2008 09:24

The idea of using a different images for the mouse pointer, and subsequently deciding how to react to inputs based upon the image set should definitely work. As hacks go that's actually pretty elegant :)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests