-
Notifications
You must be signed in to change notification settings - Fork 297
Description
This would be useful when conrod is used alongside other non-conrod user interface code (i.e within turbine).
To achieve this, we could simply add a CaptureSource
enum, i.e.
/// Indicates where the user input is being captured from.
pub enum CaptureSource {
/// The user input is captured by external means.
External,
/// The user input is captured by an internal widget.
Internal(widget::Index),
}
We could use this within the Capturing
enum's Captured
variant in place of the widget::Index
.
I imagine the methods would look something like this:
ui.capture_mouse();
ui.uncapture_mouse();
ui.capture_keyboard();
ui.uncapture_keyboard();
When capture_mouse
or capture_keyboard
are called, the Ui
would force its maybe_captured_mouse/keyboard
field to Some(Captured(External))
whether or not the user input was captured or not. The methods return a bool
, indicating whether or not the user input was already captured.
We could also add try_capture_mouse
and try_capture_keyboard
methods which would only capture the input if they were not already captured, returning a bool
indicating whether or not the user input was successfully captured.