ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.08k stars 1.28k forks source link

KeyboardOverlay behind dashboard VR #1372

Open Mvivant opened 4 years ago

Mvivant commented 4 years ago

Hi, I created a Dashboard app VR for SteamVR and when I show the keyboard, it is displayed behind the dashboard.

I try to use the SetKeyboardPositionForOverlay and SetKeyboardTransformAbsolute but not working the position of keybaord it is the same (in direction of gaze).

Is it a bug or I do wrong ?

Thanks!

Efr3D commented 4 years ago

Hi,

I tested again with steamVR 1.11.13. The issue is always here !

SetKeyboardPositionForOverlay and SetKeyboardTransformAbsolute are deprecated ?

Please, someone know a sample which use the Keyboard ?

Thanks

ykeara commented 4 years ago

So they added a new function called SetKeyboardPositionForOverlay

And a full example of how I use it.... This gets the overlay pinned at the bottom like their default one.

void OverlayController::showKeyboard( QString existingText,
                                      unsigned long userValue )
{
    vr::VROverlay()->ShowKeyboardForOverlay(
        m_ulOverlayHandle,
        vr::k_EGamepadTextInputModeNormal,
        vr::k_EGamepadTextInputLineModeSingleLine,
        0,
        "Advanced Settings Overlay",
        1024,
        existingText.toStdString().c_str(),
        userValue );
    setKeyboardPos();
}

void OverlayController::setKeyboardPos()
{
    vr::HmdVector2_t emptyvec;
    emptyvec.v[0] = 0;
    emptyvec.v[1] = 0;
    vr::HmdRect2_t empty;
    empty.vTopLeft = emptyvec;
    empty.vBottomRight = emptyvec;
    vr::VROverlay()->SetKeyboardPositionForOverlay( m_ulOverlayHandle, empty );
}

edit: probably should call SetKeyboardPositionForOverlay before ShowKeyboardForOverlay.

Mvivant commented 4 years ago

Hi, thank you so much, that works but only if I call SetKeyboardPositionForOverlay after ShowKeyboardForOverlay as your sample.

Thanks for the tips :)

if (vr::VROverlay())
{
        vr::HmdVector2_t emptyvec;
        emptyvec.v[0] = 0;
        emptyvec.v[1] = 0;
        vr::HmdRect2_t empty;
        empty.vTopLeft = emptyvec;
        empty.vBottomRight = emptyvec;     
        vr::VROverlay()->ShowKeyboardForOverlay(
           m_ulOverlayHandle, vr::k_EGamepadTextInputModeNormal, 
           vr::k_EGamepadTextInputLineModeSingleLine, 
           "config name", 1024, "", false, 0);        
        vr::VROverlay()->SetKeyboardPositionForOverlay(m_ulOverlayHandle, empty);
}