Exemple #1
0
void OgreImGui::Init(Ogre::SceneManager* scenemgr)
{
    mSceneMgr = scenemgr;
    ImGuiIO& io = ImGui::GetIO();

    io.KeyMap[ImGuiKey_Tab] = OIS::KC_TAB;                       // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.
    io.KeyMap[ImGuiKey_LeftArrow] = OIS::KC_LEFT;
    io.KeyMap[ImGuiKey_RightArrow] = OIS::KC_RIGHT;
    io.KeyMap[ImGuiKey_UpArrow] = OIS::KC_UP;
    io.KeyMap[ImGuiKey_DownArrow] = OIS::KC_DOWN;
    io.KeyMap[ImGuiKey_PageUp] = OIS::KC_PGUP;
    io.KeyMap[ImGuiKey_PageDown] = OIS::KC_PGDOWN;
    io.KeyMap[ImGuiKey_Home] = OIS::KC_HOME;
    io.KeyMap[ImGuiKey_End] = OIS::KC_END;
    io.KeyMap[ImGuiKey_Delete] = OIS::KC_DELETE;
    io.KeyMap[ImGuiKey_Backspace] = OIS::KC_BACK;
    io.KeyMap[ImGuiKey_Enter] = OIS::KC_RETURN;
    io.KeyMap[ImGuiKey_Escape] = OIS::KC_ESCAPE;
    io.KeyMap[ImGuiKey_A] = OIS::KC_A;
    io.KeyMap[ImGuiKey_C] = OIS::KC_C;
    io.KeyMap[ImGuiKey_V] = OIS::KC_V;
    io.KeyMap[ImGuiKey_X] = OIS::KC_X;
    io.KeyMap[ImGuiKey_Y] = OIS::KC_Y;
    io.KeyMap[ImGuiKey_Z] = OIS::KC_Z;

    createFontTexture();
    createMaterial();
}
Exemple #2
0
void TextRenderer::init()
{
    initializeOpenGLFunctions();
    createFontTexture();

    glGenBuffers( 1, vboIds );
    initGeometry();
}
void Init(RenderTarget& target, Texture* fontTexture)
{
    ImGuiIO& io = ImGui::GetIO();

    // init keyboard mapping
    io.KeyMap[ImGuiKey_Tab] = Input::Tab;
	io.KeyMap[ImGuiKey_LeftArrow] = Input::Left;
    io.KeyMap[ImGuiKey_RightArrow] = Input::Right;
    io.KeyMap[ImGuiKey_UpArrow] = Input::Up;
    io.KeyMap[ImGuiKey_DownArrow] = Input::Down;
    io.KeyMap[ImGuiKey_PageUp] = Input::PageUp;
    io.KeyMap[ImGuiKey_PageDown] = Input::PageDown;
    io.KeyMap[ImGuiKey_Home] = Input::Home;
    io.KeyMap[ImGuiKey_End] = Input::End;
    io.KeyMap[ImGuiKey_Delete] = Input::Delete;
    io.KeyMap[ImGuiKey_Backspace] = Input::Backspace;
    io.KeyMap[ImGuiKey_Enter] = Input::Return;
    io.KeyMap[ImGuiKey_Escape] = Input::Escape;
    io.KeyMap[ImGuiKey_A] = Input::A;
    io.KeyMap[ImGuiKey_C] = Input::C;
    io.KeyMap[ImGuiKey_V] = Input::V;
    io.KeyMap[ImGuiKey_X] = Input::X;
    io.KeyMap[ImGuiKey_Y] = Input::Y;
    io.KeyMap[ImGuiKey_Z] = Input::Z;

    // init rendering
    io.DisplaySize = static_cast<Vector2f>(target.getSize());
    io.RenderDrawListsFn = RenderDrawLists; // set render callback

    if (fontTexture == NULL) {
        if (s_fontTexture) { // delete previously created texture
            delete s_fontTexture;
        }

        s_fontTexture = new Texture;
        createFontTexture(*s_fontTexture);
        setFontTexture(*s_fontTexture);
    } else {
        setFontTexture(*fontTexture);
    }
}