Struct glfw::Window[][src]

pub struct Window {
    pub is_shared: bool,
    pub glfw: Glfw,
    // some fields omitted
}

A struct that wraps a *GLFWwindow handle.

Fields

is_shared: boolglfw: Glfw

Implementations

impl Window[src]

pub fn get_proc_address(&mut self, procname: &str) -> GLProc[src]

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.

pub fn create_shared(
    &self,
    width: u32,
    height: u32,
    title: &str,
    mode: WindowMode<'_>
) -> Option<(Window, Receiver<(f64, WindowEvent)>)>
[src]

Wrapper for glfwCreateWindow.

pub fn close(self)[src]

Calling this method forces the destructor to be called, closing the window.

pub fn render_context(&mut self) -> RenderContext[src]

Returns a render context that can be shared between tasks, allowing for concurrent rendering.

pub fn should_close(&self) -> bool[src]

Wrapper for glfwWindowShouldClose.

pub fn set_should_close(&mut self, value: bool)[src]

Wrapper for glfwSetWindowShouldClose.

pub fn set_title(&mut self, title: &str)[src]

Sets the title of the window.

Wrapper for glfwSetWindowTitle.

pub fn get_pos(&self) -> (i32, i32)[src]

Wrapper for glfwGetWindowPos.

pub fn set_pos(&mut self, xpos: i32, ypos: i32)[src]

Wrapper for glfwSetWindowPos.

pub fn get_size(&self) -> (i32, i32)[src]

Wrapper for glfwGetWindowSize.

pub fn set_size(&mut self, width: i32, height: i32)[src]

Wrapper for glfwSetWindowSize.

pub fn get_frame_size(&self) -> (i32, i32, i32, i32)[src]

Wrapper for glfwGetWindowFrameSize

Returns (left, top, right, bottom) edge window frame sizes, in screen coordinates.

pub fn get_framebuffer_size(&self) -> (i32, i32)[src]

Wrapper for glfwGetFramebufferSize.

pub fn set_aspect_ratio(&mut self, numer: u32, denum: u32)[src]

Wrapper for glfwSetWindowAspectRatio.

pub fn set_size_limits(
    &mut self,
    minwidth: Option<u32>,
    minheight: Option<u32>,
    maxwidth: Option<u32>,
    maxheight: Option<u32>
)
[src]

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.

pub fn iconify(&mut self)[src]

Wrapper for glfwIconifyWindow.

pub fn restore(&mut self)[src]

Wrapper for glfwRestoreWindow.

pub fn maximize(&mut self)[src]

Wrapper for glfwMaximizeWindow

pub fn show(&mut self)[src]

Wrapper for glfwShowWindow.

pub fn hide(&mut self)[src]

Wrapper for glfwHideWindow.

pub fn with_window_mode<T, F>(&self, f: F) -> T where
    F: Fn(WindowMode<'_>) -> T, 
[src]

Returns whether the window is fullscreen or windowed.

Example

window.with_window_mode(|mode| {
    match mode {
        glfw::Windowed => println!("Windowed"),
        glfw::FullScreen(m) => println!("FullScreen({})", m.get_name()),
    }
});

pub fn with_window_mode_mut<T, F>(&self, f: F) -> T where
    F: FnMut(WindowMode<'_>) -> T, 
[src]

Returns whether the window is fullscreen or windowed.

Variant that can accept an FnMut closure.

Example

window.with_window_mode(|mode| {
    match mode {
        glfw::Windowed => println!("Windowed"),
        glfw::FullScreen(m) => println!("FullScreen({})", m.get_name()),
    }
});

pub fn set_monitor(
    &mut self,
    mode: WindowMode<'_>,
    xpos: i32,
    ypos: i32,
    width: u32,
    height: u32,
    refresh_rate: Option<u32>
)
[src]

Wrapper for glfwSetWindowMonitor

pub fn focus(&mut self)[src]

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.

pub fn is_focused(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with FOCUSED.

pub fn is_iconified(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with ICONIFIED.

pub fn is_maximized(&self) -> bool[src]

Wrapper for glfwGetWindowattrib called with MAXIMIZED.

pub fn get_client_api(&self) -> c_int[src]

Wrapper for glfwGetWindowAttrib called with CLIENT_API.

pub fn get_context_version(&self) -> Version[src]

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.

pub fn get_context_robustness(&self) -> c_int[src]

Wrapper for glfwGetWindowAttrib called with CONTEXT_ROBUSTNESS.

pub fn is_opengl_forward_compat(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with OPENGL_FORWARD_COMPAT.

pub fn is_opengl_debug_context(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with OPENGL_DEBUG_CONTEXT.

pub fn get_opengl_profile(&self) -> c_int[src]

Wrapper for glfwGetWindowAttrib called with OPENGL_PROFILE.

pub fn is_resizable(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with RESIZABLE.

pub fn set_resizable(&mut self, resizable: bool)[src]

Wrapper for glfwSetWindowAttrib called with RESIZABLE.

pub fn is_visible(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with VISIBLE.

pub fn is_decorated(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with DECORATED.

pub fn set_decorated(&mut self, decorated: bool)[src]

Wrapper for glfwSetWindowAttrib called with DECORATED.

pub fn is_auto_iconify(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with AUTO_ICONIFY.

pub fn set_auto_iconify(&mut self, auto_iconify: bool)[src]

Wrapper for glfwSetWindowAttrib called with AUTO_ICONIFY.

pub fn is_floating(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with FLOATING.

pub fn set_floating(&mut self, floating: bool)[src]

Wrapper for glfwSetWindowAttrib called with FLOATING.

pub fn is_framebuffer_transparent(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with TRANSPARENT_FRAMEBUFFER.

pub fn is_focus_on_show(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with FOCUS_ON_SHOW.

pub fn set_focus_on_show(&mut self, focus_on_show: bool)[src]

Wrapper for glfwSetWindowAttrib called with FOCUS_ON_SHOW.

pub fn is_hovered(&self) -> bool[src]

Wrapper for glfwGetWindowAttrib called with HOVERED.

pub fn set_pos_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetWindowPosCallback.

pub fn set_all_polling(&mut self, should_poll: bool)[src]

Starts or stops polling for all available events

pub fn set_size_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetWindowSizeCallback.

pub fn set_close_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetWindowCloseCallback.

pub fn set_refresh_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetWindowRefreshCallback.

pub fn set_focus_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetWindowFocusCallback.

pub fn set_iconify_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetWindowIconifyCallback.

pub fn set_framebuffer_size_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetFramebufferSizeCallback.

pub fn set_drag_and_drop_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetDropCallback.

pub fn set_maximize_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetWindowMaximizeCallback.

pub fn set_content_scale_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetWindowContentScaleCallback.

pub fn get_cursor_mode(&self) -> CursorMode[src]

Wrapper for glfwGetInputMode called with CURSOR.

pub fn set_cursor_mode(&mut self, mode: CursorMode)[src]

Wrapper for glfwSetInputMode called with CURSOR.

pub fn set_cursor(&mut self, cursor: Option<Cursor>) -> Option<Cursor>[src]

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.

pub fn set_icon_from_pixels(&mut self, images: Vec<PixelImage>)[src]

Sets the window icon via glfwSetWindowIcon from a set a set of vectors containing pixels in RGBA format (one pixel per 32-bit integer)

pub fn has_sticky_keys(&self) -> bool[src]

Wrapper for glfwGetInputMode called with STICKY_KEYS.

pub fn set_sticky_keys(&mut self, value: bool)[src]

Wrapper for glfwSetInputMode called with STICKY_KEYS.

pub fn has_sticky_mouse_buttons(&self) -> bool[src]

Wrapper for glfwGetInputMode called with STICKY_MOUSE_BUTTONS.

pub fn set_sticky_mouse_buttons(&mut self, value: bool)[src]

Wrapper for glfwSetInputMode called with STICKY_MOUSE_BUTTONS.

pub fn does_store_lock_key_mods(&self) -> bool[src]

Wrapper for glfwGetInputMode called with LOCK_KEY_MODS

pub fn set_store_lock_key_mods(&mut self, value: bool)[src]

Wrapper for glfwSetInputMode called with LOCK_KEY_MODS

pub fn uses_raw_mouse_motion(&self) -> bool[src]

Wrapper for glfwGetInputMode called with RAW_MOUSE_MOTION

pub fn set_raw_mouse_motion(&mut self, value: bool)[src]

Wrapper for glfwSetInputMode called with RAW_MOUSE_MOTION

pub fn get_key(&self, key: Key) -> Action[src]

Wrapper for glfwGetKey.

pub fn get_mouse_button(&self, button: MouseButton) -> Action[src]

Wrapper for glfwGetMouseButton.

pub fn get_cursor_pos(&self) -> (f64, f64)[src]

Wrapper for glfwGetCursorPos.

pub fn set_cursor_pos(&mut self, xpos: f64, ypos: f64)[src]

Wrapper for glfwSetCursorPos.

pub fn set_key_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetKeyCallback.

pub fn set_char_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetCharCallback.

pub fn set_char_mods_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetCharModsCallback

pub fn set_mouse_button_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetMouseButtonCallback.

pub fn set_cursor_pos_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetCursorPosCallback.

pub fn set_cursor_enter_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetCursorEnterCallback.

pub fn set_scroll_polling(&mut self, should_poll: bool)[src]

Wrapper for glfwSetScrollCallback.

pub fn set_clipboard_string(&mut self, string: &str)[src]

Wrapper for glfwGetClipboardString.

pub fn get_clipboard_string(&self) -> Option<String>[src]

Wrapper for glfwGetClipboardString.

pub fn get_opacity(&self) -> f32[src]

Wrapper for ‘glfwGetWindowOpacity’.

pub fn set_opacity(&mut self, opacity: f32)[src]

Wrapper for ‘glfwSetWindowOpacity’.

pub fn request_attention(&mut self)[src]

Wrapper for glfwRequestWindowAttention.

pub fn get_content_scale(&self) -> (f32, f32)[src]

Wrapper for glfwGetWindowContentScale.

pub fn get_x11_window(&self) -> *mut c_void[src]

Wrapper for glfwGetX11Window

pub fn get_glx_context(&self) -> *mut c_void[src]

Wrapper for glfwGetGLXContext

Trait Implementations

impl Context for Window[src]

impl Debug for Window[src]

impl Drop for Window[src]

fn drop(&mut self)[src]

Closes the window and performs the necessary cleanups. This will block until all associated RenderContexts were also dropped, and emit a debug! message to that effect.

Wrapper for glfwDestroyWindow.

impl HasRawWindowHandle for Window[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.