pub struct Window {
pub is_shared: bool,
pub glfw: Glfw,
/* private fields */
}
Expand description
A struct that wraps a *GLFWwindow
handle.
Fields§
§glfw: Glfw
Implementations§
source§impl Window
impl Window
sourcepub fn get_proc_address(&mut self, procname: &str) -> GLProc
pub fn get_proc_address(&mut self, procname: &str) -> GLProc
Returns the address of the specified client API or extension function if it is supported by the context associated with this Window. If this Window is not the current context, it will make it the current context.
Wrapper for glfwGetProcAddress
.
Creates a new shared window.
Wrapper for glfwCreateWindow
.
sourcepub fn render_context(&mut self) -> PRenderContext
pub fn render_context(&mut self) -> PRenderContext
Returns a render context that can be shared between tasks, allowing for concurrent rendering.
sourcepub fn should_close(&self) -> bool
pub fn should_close(&self) -> bool
Wrapper for glfwWindowShouldClose
.
sourcepub fn set_should_close(&mut self, value: bool)
pub fn set_should_close(&mut self, value: bool)
Wrapper for glfwSetWindowShouldClose
.
sourcepub fn set_title(&mut self, title: &str)
pub fn set_title(&mut self, title: &str)
Sets the title of the window.
Wrapper for glfwSetWindowTitle
.
sourcepub fn get_frame_size(&self) -> (i32, i32, i32, i32)
pub fn get_frame_size(&self) -> (i32, i32, i32, i32)
Wrapper for glfwGetWindowFrameSize
Returns (left, top, right, bottom)
edge window frame sizes, in screen coordinates.
sourcepub fn get_framebuffer_size(&self) -> (i32, i32)
pub fn get_framebuffer_size(&self) -> (i32, i32)
Wrapper for glfwGetFramebufferSize
.
sourcepub fn set_aspect_ratio(&mut self, numer: u32, denum: u32)
pub fn set_aspect_ratio(&mut self, numer: u32, denum: u32)
Wrapper for glfwSetWindowAspectRatio
.
sourcepub fn set_size_limits(
&mut self,
minwidth: Option<u32>,
minheight: Option<u32>,
maxwidth: Option<u32>,
maxheight: Option<u32>
)
pub fn set_size_limits( &mut self, minwidth: Option<u32>, minheight: Option<u32>, maxwidth: Option<u32>, maxheight: Option<u32> )
Wrapper for glfwSetWindowSizeLimits
.
A value of None
is equivalent to GLFW_DONT_CARE
.
If minwidth
or minheight
are None
, no minimum size is enforced.
If maxwidth
or maxheight
are None
, no maximum size is enforced.
sourcepub fn with_window_mode<T, F>(&self, f: F) -> Twhere
F: FnOnce(WindowMode<'_>) -> T,
pub fn with_window_mode<T, F>(&self, f: F) -> Twhere
F: FnOnce(WindowMode<'_>) -> T,
sourcepub fn set_monitor(
&mut self,
mode: WindowMode<'_>,
xpos: i32,
ypos: i32,
width: u32,
height: u32,
refresh_rate: Option<u32>
)
pub fn set_monitor( &mut self, mode: WindowMode<'_>, xpos: i32, ypos: i32, width: u32, height: u32, refresh_rate: Option<u32> )
Wrapper for glfwSetWindowMonitor
sourcepub fn focus(&mut self)
pub fn focus(&mut self)
Wrapper for glfwFocusWindow
It is NOT recommended to use this function, as it steals focus from other applications and can be extremely disruptive to the user.
sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with FOCUSED
.
sourcepub fn is_iconified(&self) -> bool
pub fn is_iconified(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with ICONIFIED
.
sourcepub fn is_maximized(&self) -> bool
pub fn is_maximized(&self) -> bool
Wrapper for glfwGetWindowattrib
called with MAXIMIZED
.
sourcepub fn get_client_api(&self) -> c_int
pub fn get_client_api(&self) -> c_int
Wrapper for glfwGetWindowAttrib
called with CLIENT_API
.
sourcepub fn get_context_version(&self) -> Version
pub fn get_context_version(&self) -> Version
Wrapper for glfwGetWindowAttrib
called with
CONTEXT_VERSION_MAJOR
, CONTEXT_VERSION_MINOR
and CONTEXT_REVISION
.
§Returns
The client API version of the window’s context in a version struct.
sourcepub fn get_context_robustness(&self) -> c_int
pub fn get_context_robustness(&self) -> c_int
Wrapper for glfwGetWindowAttrib
called with CONTEXT_ROBUSTNESS
.
sourcepub fn is_opengl_forward_compat(&self) -> bool
pub fn is_opengl_forward_compat(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with OPENGL_FORWARD_COMPAT
.
sourcepub fn is_opengl_debug_context(&self) -> bool
pub fn is_opengl_debug_context(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with OPENGL_DEBUG_CONTEXT
.
sourcepub fn get_opengl_profile(&self) -> c_int
pub fn get_opengl_profile(&self) -> c_int
Wrapper for glfwGetWindowAttrib
called with OPENGL_PROFILE
.
sourcepub fn is_resizable(&self) -> bool
pub fn is_resizable(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with RESIZABLE
.
sourcepub fn set_resizable(&mut self, resizable: bool)
pub fn set_resizable(&mut self, resizable: bool)
Wrapper for glfwSetWindowAttrib
called with RESIZABLE
.
sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with VISIBLE
.
sourcepub fn is_decorated(&self) -> bool
pub fn is_decorated(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with DECORATED
.
sourcepub fn set_decorated(&mut self, decorated: bool)
pub fn set_decorated(&mut self, decorated: bool)
Wrapper for glfwSetWindowAttrib
called with DECORATED
.
sourcepub fn is_auto_iconify(&self) -> bool
pub fn is_auto_iconify(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with AUTO_ICONIFY
.
sourcepub fn set_auto_iconify(&mut self, auto_iconify: bool)
pub fn set_auto_iconify(&mut self, auto_iconify: bool)
Wrapper for glfwSetWindowAttrib
called with AUTO_ICONIFY
.
sourcepub fn is_floating(&self) -> bool
pub fn is_floating(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with FLOATING
.
sourcepub fn set_floating(&mut self, floating: bool)
pub fn set_floating(&mut self, floating: bool)
Wrapper for glfwSetWindowAttrib
called with FLOATING
.
sourcepub fn is_framebuffer_transparent(&self) -> bool
pub fn is_framebuffer_transparent(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with TRANSPARENT_FRAMEBUFFER
.
sourcepub fn is_focus_on_show(&self) -> bool
pub fn is_focus_on_show(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with FOCUS_ON_SHOW
.
sourcepub fn set_focus_on_show(&mut self, focus_on_show: bool)
pub fn set_focus_on_show(&mut self, focus_on_show: bool)
Wrapper for glfwSetWindowAttrib
called with FOCUS_ON_SHOW
.
sourcepub fn is_hovered(&self) -> bool
pub fn is_hovered(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with HOVERED
.
sourcepub fn set_pos_callback<T>(&mut self, callback: T)
pub fn set_pos_callback<T>(&mut self, callback: T)
Wrapper for glfwSetWindowPosCallback
.
sourcepub fn unset_pos_callback(&mut self)
pub fn unset_pos_callback(&mut self)
Wrapper for glfwSetWindowPosCallback
.
sourcepub fn set_pos_polling(&mut self, should_poll: bool)
pub fn set_pos_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowPosCallback
.
sourcepub fn set_size_callback<T>(&mut self, callback: T)
pub fn set_size_callback<T>(&mut self, callback: T)
Wrapper for glfwSetWindowSizeCallback
.
sourcepub fn unset_size_callback(&mut self)
pub fn unset_size_callback(&mut self)
Wrapper for glfwSetWindowSizeCallback
.
sourcepub fn set_size_polling(&mut self, should_poll: bool)
pub fn set_size_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowSizeCallback
.
sourcepub fn set_close_callback<T>(&mut self, callback: T)
pub fn set_close_callback<T>(&mut self, callback: T)
Wrapper for glfwSetWindowCloseCallback
.
sourcepub fn unset_close_callback(&mut self)
pub fn unset_close_callback(&mut self)
Wrapper for glfwSetWindowCloseCallback
.
sourcepub fn set_close_polling(&mut self, should_poll: bool)
pub fn set_close_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowCloseCallback
.
sourcepub fn set_refresh_callback<T>(&mut self, callback: T)
pub fn set_refresh_callback<T>(&mut self, callback: T)
Wrapper for glfwSetWindowRefreshCallback
.
sourcepub fn unset_refresh_callback(&mut self)
pub fn unset_refresh_callback(&mut self)
Wrapper for glfwSetWindowRefreshCallback
.
sourcepub fn set_refresh_polling(&mut self, should_poll: bool)
pub fn set_refresh_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowRefreshCallback
.
sourcepub fn set_focus_callback<T>(&mut self, callback: T)
pub fn set_focus_callback<T>(&mut self, callback: T)
Wrapper for glfwSetWindowFocusCallback
.
sourcepub fn unset_focus_callback(&mut self)
pub fn unset_focus_callback(&mut self)
Wrapper for glfwSetWindowFocusCallback
.
sourcepub fn set_focus_polling(&mut self, should_poll: bool)
pub fn set_focus_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowFocusCallback
.
sourcepub fn set_iconify_callback<T>(&mut self, callback: T)
pub fn set_iconify_callback<T>(&mut self, callback: T)
Wrapper for glfwSetWindowIconifyCallback
.
sourcepub fn unset_iconify_callback(&mut self)
pub fn unset_iconify_callback(&mut self)
Wrapper for glfwSetWindowIconifyCallback
.
sourcepub fn set_iconify_polling(&mut self, should_poll: bool)
pub fn set_iconify_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowIconifyCallback
.
sourcepub fn set_framebuffer_size_callback<T>(&mut self, callback: T)
pub fn set_framebuffer_size_callback<T>(&mut self, callback: T)
Wrapper for glfwSetFramebufferSizeCallback
.
sourcepub fn unset_framebuffer_size_callback(&mut self)
pub fn unset_framebuffer_size_callback(&mut self)
Wrapper for glfwSetFramebufferSizeCallback
.
sourcepub fn set_framebuffer_size_polling(&mut self, should_poll: bool)
pub fn set_framebuffer_size_polling(&mut self, should_poll: bool)
Wrapper for glfwSetFramebufferSizeCallback
.
sourcepub fn set_key_callback<T>(&mut self, callback: T)
pub fn set_key_callback<T>(&mut self, callback: T)
Wrapper for glfwSetKeyCallback
.
sourcepub fn unset_key_callback(&mut self)
pub fn unset_key_callback(&mut self)
Wrapper for glfwSetKeyCallback
.
sourcepub fn set_key_polling(&mut self, should_poll: bool)
pub fn set_key_polling(&mut self, should_poll: bool)
Wrapper for glfwSetKeyCallback
.
sourcepub fn set_char_callback<T>(&mut self, callback: T)
pub fn set_char_callback<T>(&mut self, callback: T)
Wrapper for glfwSetCharCallback
.
sourcepub fn unset_char_callback(&mut self)
pub fn unset_char_callback(&mut self)
Wrapper for glfwSetCharCallback
.
sourcepub fn set_char_polling(&mut self, should_poll: bool)
pub fn set_char_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCharCallback
.
sourcepub fn set_char_mods_callback<T>(&mut self, callback: T)
pub fn set_char_mods_callback<T>(&mut self, callback: T)
Wrapper for glfwSetCharModsCallback
.
sourcepub fn unset_char_mods_callback(&mut self)
pub fn unset_char_mods_callback(&mut self)
Wrapper for glfwSetCharModsCallback
.
sourcepub fn set_char_mods_polling(&mut self, should_poll: bool)
pub fn set_char_mods_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCharModsCallback
.
Wrapper for glfwSetMouseButtonCallback
.
Wrapper for glfwSetMouseButtonCallback
.
Wrapper for glfwSetMouseButtonCallback
.
sourcepub fn set_cursor_pos_callback<T>(&mut self, callback: T)
pub fn set_cursor_pos_callback<T>(&mut self, callback: T)
Wrapper for glfwSetCursorPosCallback
.
sourcepub fn unset_cursor_pos_callback(&mut self)
pub fn unset_cursor_pos_callback(&mut self)
Wrapper for glfwSetCursorPosCallback
.
sourcepub fn set_cursor_pos_polling(&mut self, should_poll: bool)
pub fn set_cursor_pos_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCursorPosCallback
.
sourcepub fn set_cursor_enter_callback<T>(&mut self, callback: T)
pub fn set_cursor_enter_callback<T>(&mut self, callback: T)
Wrapper for glfwSetCursorEnterCallback
.
sourcepub fn unset_cursor_enter_callback(&mut self)
pub fn unset_cursor_enter_callback(&mut self)
Wrapper for glfwSetCursorEnterCallback
.
sourcepub fn set_cursor_enter_polling(&mut self, should_poll: bool)
pub fn set_cursor_enter_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCursorEnterCallback
.
sourcepub fn set_scroll_callback<T>(&mut self, callback: T)
pub fn set_scroll_callback<T>(&mut self, callback: T)
Wrapper for glfwSetScrollCallback
.
sourcepub fn unset_scroll_callback(&mut self)
pub fn unset_scroll_callback(&mut self)
Wrapper for glfwSetScrollCallback
.
sourcepub fn set_scroll_polling(&mut self, should_poll: bool)
pub fn set_scroll_polling(&mut self, should_poll: bool)
Wrapper for glfwSetScrollCallback
.
sourcepub fn set_drag_and_drop_callback<T>(&mut self, callback: T)
pub fn set_drag_and_drop_callback<T>(&mut self, callback: T)
Wrapper for glfwSetDropCallback
.
sourcepub fn unset_drag_and_drop_callback(&mut self)
pub fn unset_drag_and_drop_callback(&mut self)
Wrapper for glfwSetDropCallback
.
sourcepub fn set_drag_and_drop_polling(&mut self, should_poll: bool)
pub fn set_drag_and_drop_polling(&mut self, should_poll: bool)
Wrapper for glfwSetDropCallback
.
sourcepub fn set_maximize_callback<T>(&mut self, callback: T)
pub fn set_maximize_callback<T>(&mut self, callback: T)
Wrapper for glfwSetWindowMaximizeCallback
.
sourcepub fn unset_maximize_callback(&mut self)
pub fn unset_maximize_callback(&mut self)
Wrapper for glfwSetWindowMaximizeCallback
.
sourcepub fn set_maximize_polling(&mut self, should_poll: bool)
pub fn set_maximize_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowMaximizeCallback
.
sourcepub fn set_content_scale_callback<T>(&mut self, callback: T)
pub fn set_content_scale_callback<T>(&mut self, callback: T)
Wrapper for glfwSetWindowContentScaleCallback
.
sourcepub fn unset_content_scale_callback(&mut self)
pub fn unset_content_scale_callback(&mut self)
Wrapper for glfwSetWindowContentScaleCallback
.
sourcepub fn set_content_scale_polling(&mut self, should_poll: bool)
pub fn set_content_scale_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowContentScaleCallback
.
sourcepub fn set_all_polling(&mut self, should_poll: bool)
pub fn set_all_polling(&mut self, should_poll: bool)
Starts or stops polling for all available events
sourcepub fn get_cursor_mode(&self) -> CursorMode
pub fn get_cursor_mode(&self) -> CursorMode
Wrapper for glfwGetInputMode
called with CURSOR
.
sourcepub fn set_cursor_mode(&mut self, mode: CursorMode)
pub fn set_cursor_mode(&mut self, mode: CursorMode)
Wrapper for glfwSetInputMode
called with CURSOR
.
sourcepub fn set_cursor(&mut self, cursor: Option<Cursor>) -> Option<Cursor>
pub fn set_cursor(&mut self, cursor: Option<Cursor>) -> Option<Cursor>
Wrapper for glfwSetCursor
using Cursor
The window will take ownership of the cursor, and will not Drop it until it is replaced or the window itself is destroyed.
Returns the previously set Cursor or None if no cursor was set.
sourcepub fn set_icon_from_pixels(&mut self, images: Vec<PixelImage>)
pub fn set_icon_from_pixels(&mut self, images: Vec<PixelImage>)
Sets the window icon via glfwSetWindowIcon
from a set a set of vectors
containing pixels in RGBA format (one pixel per 32-bit integer)
sourcepub fn has_sticky_keys(&self) -> bool
pub fn has_sticky_keys(&self) -> bool
Wrapper for glfwGetInputMode
called with STICKY_KEYS
.
sourcepub fn set_sticky_keys(&mut self, value: bool)
pub fn set_sticky_keys(&mut self, value: bool)
Wrapper for glfwSetInputMode
called with STICKY_KEYS
.
Wrapper for glfwGetInputMode
called with STICKY_MOUSE_BUTTONS
.
Wrapper for glfwSetInputMode
called with STICKY_MOUSE_BUTTONS
.
sourcepub fn does_store_lock_key_mods(&self) -> bool
pub fn does_store_lock_key_mods(&self) -> bool
Wrapper for glfwGetInputMode
called with LOCK_KEY_MODS
sourcepub fn set_store_lock_key_mods(&mut self, value: bool)
pub fn set_store_lock_key_mods(&mut self, value: bool)
Wrapper for glfwSetInputMode
called with LOCK_KEY_MODS
sourcepub fn uses_raw_mouse_motion(&self) -> bool
pub fn uses_raw_mouse_motion(&self) -> bool
Wrapper for glfwGetInputMode
called with RAW_MOUSE_MOTION
sourcepub fn set_raw_mouse_motion(&mut self, value: bool)
pub fn set_raw_mouse_motion(&mut self, value: bool)
Wrapper for glfwSetInputMode
called with RAW_MOUSE_MOTION
Wrapper for glfwGetMouseButton
.
sourcepub fn get_cursor_pos(&self) -> (f64, f64)
pub fn get_cursor_pos(&self) -> (f64, f64)
Wrapper for glfwGetCursorPos
.
sourcepub fn set_cursor_pos(&mut self, xpos: f64, ypos: f64)
pub fn set_cursor_pos(&mut self, xpos: f64, ypos: f64)
Wrapper for glfwSetCursorPos
.
sourcepub fn set_clipboard_string(&mut self, string: &str)
pub fn set_clipboard_string(&mut self, string: &str)
Wrapper for glfwGetClipboardString
.
sourcepub fn get_clipboard_string(&self) -> Option<String>
pub fn get_clipboard_string(&self) -> Option<String>
Wrapper for glfwGetClipboardString
.
sourcepub fn get_opacity(&self) -> f32
pub fn get_opacity(&self) -> f32
Wrapper for glfwGetWindowOpacity
.
sourcepub fn set_opacity(&mut self, opacity: f32)
pub fn set_opacity(&mut self, opacity: f32)
Wrapper for glfwSetWindowOpacity
.
sourcepub fn request_attention(&mut self)
pub fn request_attention(&mut self)
Wrapper for glfwRequestWindowAttention
.
sourcepub fn get_content_scale(&self) -> (f32, f32)
pub fn get_content_scale(&self) -> (f32, f32)
Wrapper for glfwGetWindowContentScale
.
sourcepub fn get_x11_window(&self) -> *mut c_void
pub fn get_x11_window(&self) -> *mut c_void
Wrapper for glfwGetX11Window
sourcepub fn get_glx_context(&self) -> *mut c_void
pub fn get_glx_context(&self) -> *mut c_void
Wrapper for glfwGetGLXContext
Trait Implementations§
source§impl Context for Window
impl Context for Window
source§fn window_ptr(&self) -> *mut GLFWwindow
fn window_ptr(&self) -> *mut GLFWwindow
GLFWwindow
.source§fn swap_buffers(&mut self)
fn swap_buffers(&mut self)
source§fn is_current(&self) -> bool
fn is_current(&self) -> bool
true
if the window is the current context.source§fn make_current(&mut self)
fn make_current(&mut self)
glfwMakeContextCurrent
source§fn should_close(&self) -> bool
fn should_close(&self) -> bool
glfwWindowShouldClose
.source§fn set_should_close(&mut self, value: bool)
fn set_should_close(&mut self, value: bool)
glfwSetWindowShouldClose
.source§fn post_empty_event(&self)
fn post_empty_event(&self)
glfwPostEmptyEvent
.source§impl HasDisplayHandle for Window
impl HasDisplayHandle for Window
source§fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
source§impl HasWindowHandle for Window
impl HasWindowHandle for Window
source§fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
Auto Trait Implementations§
impl RefUnwindSafe for Window
impl !Send for Window
impl !Sync for Window
impl Unpin for Window
impl UnwindSafe for Window
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> HasRawDisplayHandle for Twhere
T: HasDisplayHandle + ?Sized,
impl<T> HasRawDisplayHandle for Twhere
T: HasDisplayHandle + ?Sized,
source§fn raw_display_handle(&self) -> Result<RawDisplayHandle, HandleError>
fn raw_display_handle(&self) -> Result<RawDisplayHandle, HandleError>
HasDisplayHandle
insteadsource§impl<T> HasRawWindowHandle for Twhere
T: HasWindowHandle + ?Sized,
impl<T> HasRawWindowHandle for Twhere
T: HasWindowHandle + ?Sized,
source§fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError>
fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError>
HasWindowHandle
instead