mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-14 23:18:28 +00:00
imgui: Add method to set/get mouse cursor
Include some documentation as well.
This commit is contained in:
parent
e90a92c582
commit
785f773966
25
src/lib.rs
25
src/lib.rs
@ -9,8 +9,8 @@ use std::str;
|
||||
use sys::ImGuiStyleVar;
|
||||
|
||||
pub use sys::{ImDrawIdx, ImDrawVert, ImGuiColorEditFlags, ImGuiHoveredFlags, ImGuiInputTextFlags,
|
||||
ImGuiKey, ImGuiSelectableFlags, ImGuiCond, ImGuiCol, ImGuiStyle, ImGuiTreeNodeFlags,
|
||||
ImGuiWindowFlags, ImVec2, ImVec4};
|
||||
ImGuiKey, ImGuiMouseCursor, ImGuiSelectableFlags, ImGuiCond, ImGuiCol, ImGuiStyle,
|
||||
ImGuiTreeNodeFlags, ImGuiWindowFlags, ImVec2, ImVec4};
|
||||
pub use child_frame::ChildFrame;
|
||||
pub use color_editors::{ColorButton, ColorEdit, ColorEditMode, ColorFormat, ColorPicker,
|
||||
ColorPickerMode, ColorPreview, EditableColor};
|
||||
@ -198,10 +198,31 @@ impl ImGui {
|
||||
let io = self.io_mut();
|
||||
io.mouse_wheel = value;
|
||||
}
|
||||
/// Set to `true` to have ImGui draw the cursor in software.
|
||||
/// If `false`, the OS cursor is used (default to `false`).
|
||||
pub fn set_mouse_draw_cursor(&mut self, value: bool) {
|
||||
let io = self.io_mut();
|
||||
io.mouse_draw_cursor = value;
|
||||
}
|
||||
pub fn mouse_draw_cursor(&self) -> bool {
|
||||
let io = self.io();
|
||||
io.mouse_draw_cursor
|
||||
}
|
||||
/// Set currently displayed cursor.
|
||||
/// Requires support in the windowing back-end if OS cursor is used.
|
||||
/// OS cursor is used if `mouse_draw_cursor` is set to `false` with
|
||||
/// [set_mouse_draw_cursor](#method.set_mouse_draw_cursor).
|
||||
pub fn set_mouse_cursor(&self, cursor: ImGuiMouseCursor) {
|
||||
unsafe {
|
||||
sys::igSetMouseCursor(cursor);
|
||||
}
|
||||
}
|
||||
/// Get currently displayed cursor.
|
||||
pub fn mouse_cursor(&self) -> ImGuiMouseCursor {
|
||||
unsafe {
|
||||
sys::igGetMouseCursor()
|
||||
}
|
||||
}
|
||||
pub fn key_ctrl(&self) -> bool {
|
||||
let io = self.io();
|
||||
io.key_ctrl
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user