Page 1 of 1

ClickTimeout - How are they set?

Posted: Sat Jan 06, 2007 18:06
by Das Gurke
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?

Posted: Sat Jan 13, 2007 16:01
by Das Gurke
Anyone? :?

Posted: Sun Jan 14, 2007 18:01
by Rackle
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.

Posted: Mon Jan 15, 2007 08:56
by Das Gurke
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.

Posted: Mon Jan 15, 2007 12:26
by Rackle
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.

Posted: Mon Jan 15, 2007 14:50
by Das Gurke
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.

Posted: Mon Jan 15, 2007 17:43
by Rackle
>> 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.

Posted: Tue Jan 16, 2007 11:33
by Das Gurke
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.