Skip to content
This repository was archived by the owner on Dec 14, 2021. It is now read-only.

Input from imgui in example.cpp doesn't work #22

Open
Mtkn573 opened this issue May 7, 2021 · 1 comment
Open

Input from imgui in example.cpp doesn't work #22

Mtkn573 opened this issue May 7, 2021 · 1 comment

Comments

@Mtkn573
Copy link

Mtkn573 commented May 7, 2021

Input doesn't handle events properly. I used code from example.cpp.

@gwiazdorrr
Copy link

gwiazdorrr commented Sep 7, 2021

The simplest way to get inputs to work reliably is to use the built-in backend (https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_sdl.cpp). Now the problem is the generic ImGui_ImplSDL2_Init is not public - only ImGui_ImplSDL2_InitForOpenGL etc. But at least as of now, these do not do anything really, just forward to ImGui_ImplSDL2_Init. So, to get inputs, resize events etc. working, that's all you need:

ImGui_ImplSDL2_InitForOpenGL(window, nullptr);
(...)
SDL_Event event;
while (SDL_PollEvent(&event)) ImGui_ImplSDL2_ProcessEvent(&event);
(...)
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants