Comments (5)
Mattias: I suspect that your underlying question is that you'd like to know when to pass your inputs to ImGui, i am right ?
In the IO structure you can find:
bool WantCaptureMouse; // Mouse is hovering a window or widget is active (= ImGui will use your mouse input)
bool WantCaptureKeyboard; // Widget is active (= ImGui will use your keyboard input)
This is updated by NewFrame() so the idea is that you pass your raw inputs to ImGui but it doesn't necessary use them. If the flag aren't set you can pass the inputs back to the rest of your application.
Now, through various feedbacks it appears that this was confusing to some engine architecture, e.g. if you are trying to dispatch inputs events directly to the right target. My suggestion would be to just store data and pass it to ImGui before NewFrame().
You can set io.MousePos and call ImGui::IsMouseHoveringAnyWindow() to test if a position is over a window. Detect if a widget has focus for keyboard is IO.WantCaptureKeyboard.
I think I need to revamp those API to be a little more clear. Perhaps adding an explicit WidgetHasFocus thing?
from imgui.
Additionally, I would really like a way to give keyboard focus to a specific text field...
from imgui.
xythobuz: separate issue/thread please.
from imgui.
Yes, thanks for the information! This setup sounds good to me, since I just need to know when to block input to my code.
from imgui.
I want to do something similar to this. (using sfml) i render my main application to a sf::RenderTexture that i then display on ImGui::Image(). So basically my dockspace and my whole window is at all times completely covered by ImGui windows.
So when i try to dispatch mouse clicks to my application i want to check if io.WantCaptureMouse.
The problem is that i also want to be able to move my "application" window around. So setting the flag ImGuiWindowFlags_NoMouseInputs does not work.
I read at many places that io.WantCaptureMouse is prefered over IsWindowHovered().
Is this still the case for my use case? Or would a new flag with a name like
ImGuiWindowFlags_OnlyMouseInputsOnTitlebar be a useful addition to the API?
Edit:
Basically i want to create something similiar looking to the "Canvas" demo. But instead of rendering the canvas in ImGui i want to render in SFML to a texture and then display that on a ImGui windows.
from imgui.
Related Issues (20)
- Drag drop does not work with Child HOT 6
- When ImGuiChildFlags_AlwaysUseWindowPadding is enabled, the left and right padding widths of the Child are different, but the Parent window is the same HOT 5
- No scrolling region or selectable items inside Child HOT 3
- Can't write in any field. (1.90.5-docking with SDL3) HOT 1
- `BeginGroup`/`EndGroup` with table inside reports incorrect item size
- Delay in Combo Popup Opening with glfwWaitEventsTimeout HOT 4
- Where's the binaries? HOT 4
- Mouse scrolling not working HOT 6
- Imgui community HOT 1
- Rendering vertices with the D3DPT_LINESTRIP type. HOT 1
- Can't access some stuff from imgui.h HOT 1
- Suggestion: Consider Adding Title Bar Text to Popups HOT 2
- SDL3 Multi-Viewports not creating windows when main window is hidden
- Recommended way to expand / collapse tree nodes with keyboard shortcuts? HOT 3
- VuIkan: invalid Dynamic Rendering functions from the Instance-level loader HOT 3
- Text Bottom Padding Bug HOT 1
- Power savings & hardware usage HOT 3
- Add RGFW backend implementation HOT 2
- Text wrapping: how does it work? HOT 1
- ImDrawList rects aren't perfect HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.