ClickTimeout - How are they set?

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

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

ClickTimeout - How are they set?

Postby Das Gurke » Sat Jan 06, 2007 18:06

Well, I am confused (again ...). Currently my CEGUI keeps to "flicker" elements when pressing the frame window bar. This sort of hints, that the timouts for doubleclick or singleclick events are somehow wrong. Every click of mine is taken as a double click, probably because I dont release the button quick enough (complicated at ~ 230 FPS). Sadly the Doxygen Documentation could not tell me which timeformat (?) I should pass, but i guess it should be seconds in the following format

1.02f == 1.02 Seconds

So far my situation. But now I am in a kinda weird situation. Currently I am injecting the time every frame in the format described above. Result: The described flickering. If i do not inject the time pulse the flickering still goes on.

And for my comprehension:
Calling setMultiClickTimeout(0.3f); means that the two clicks have to be done in 0.3 seconds?

And what is the singleClickTimeout for? What happens if I set it to 0.3f and hold the button for 0.4s ? Is that not regarded as a click?

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

Postby Das Gurke » Sat Jan 13, 2007 16:01

Anyone? :?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Sun Jan 14, 2007 18:01

Cegui's injectTimePulse() wants to receive seconds. Are you injecting both the pressed and release for the mouse and keyboard events? Hard to be more helpful; you may have to post some of your code.

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

Postby Das Gurke » Mon Jan 15, 2007 08:56

Sure, I am injecting input like this (DInput is used to gain input)

Code: Select all

// Reinreichen des aktuellen Inputstatus im DX Format
// #############################################################
int GUI::receiveInput(DIMOUSESTATE2 *MouseMap, unsigned char *BoardMap)
{
   // Erstmal die Bewegung an CeGUI übergeben, aber nur wenn die Maus auch
   // sichtbar ist
   if(CEGUI::MouseCursor::getSingleton().isVisible())
   {
      theOgreInst->mGUIManager->mGUISystem->injectMouseMove(MouseMap->lX, MouseMap->lY);
   }

   // Dann die Mausbuttons, wir gehen die ersten 5 durch und ermitteln jeden
   // Frame den aktuellen Status.
   //
   // Anmerkung:
   // CeGUI wird es garnicht gefallen mehr als 5 Buttons drücken zu wollen.
   for(int i = 0; i < 5; i++)
   {
      // Taste gedrückt, also runter mit dem Key
      if(MouseMap->rgbButtons[i] & 0x80)
      {
         mGUISystem->injectMouseButtonDown((CEGUI::MouseButton)i);
         
      }
      // Taste nicht gedrückt, Key nach oben.
      else
      {
         mGUISystem->injectMouseButtonUp((CEGUI::MouseButton)i);
      }
   }

   // Nun das ganze analog fürs Keyboard
   for(int i = 0; i < 256; i++)
   {
      if(BoardMap[i] & 0x80)
      {
         mGUISystem->injectKeyDown(i);
      }
      else
      {
         mGUISystem->injectKeyUp(i);
      }
   }

   return (0);
}

I am injecting time in seconds, so that should not be the trouble. To be precise:

Code: Select all

theGUIManager->injectFrameTime(mFrameTimeFloat);

mFrameTimeFloat would be 1.2f for 1.2 seconds.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Jan 15, 2007 12:26

When is this super function called, at regular interval?

Here's what I see. Each frame you call this super function, which repeatedly injects mouse and key down when they are pressed or repeatedly injects mouse and key up when they are not pressed, rather than during their transitional states.

Code: Select all

// Defined AND initialized somewhere
bool MouseButtonDown[5] = false



// Mouse button handling code

for(int i = 0; i < 5; i++)
{
    // Taste gedrückt, also runter mit dem Key
    if(MouseMap->rgbButtons[i] & 0x80 != MouseButtonDown[i])
    {
        MouseButtonDown[i] = MouseMap->rgbButtons[i] & 0x80;
        if(MouseButtonDown[i])
            mGUISystem->injectMouseButtonDown((CEGUI::MouseButton)i);
        else
            mGUISystem->injectMouseButtonUp((CEGUI::MouseButton)i);
    }
}


And you would perform similar code to handle the keyboad up/down events.

Finally, I see that you are using Ogre. You should consider using OIS to handle input. It works quite well with Cegui and as a bonus you obtain Unicode support, which should allow you to type those special german characters.

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

Postby Das Gurke » Mon Jan 15, 2007 14:50

Ah, well that makes sense ... So I have to inject the stuff only on change, not on a regular base. :idea:

Unicode Support? Already implented =) I must admit I have never worked with OIS, but I pretty much like my one framework. It is able to set timeouts for buttons or functions called via a button, it is possible to register Callbacks for certain buttons and some stuff more (which is Joystick related). I wrote that thing for some kind of exam and am pretty happy with it.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Jan 15, 2007 17:43

>> Unicode Support? Already implented

I'd be interested to know how it compares to the code within DirectInput to CEGUI utf32, which is essentially the same code used within OIS.

This is becoming an advertisement but OIS now supports Wiimote. Find out more here.

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

Postby Das Gurke » Tue Jan 16, 2007 11:33

Just flew over it, my approach is similar. But currently I am off trying something different ... The Windowsmessages ^^ More a matter of interest then something usefull.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 28 guests