Struct glfw::Window [] [src]

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

A struct that wraps a *GLFWwindow handle.

Fields

glfw: Glfw is_shared: bool

Methods

impl Window
[src]

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.

fn create_shared(&self, width: u32, height: u32, title: &str, mode: WindowMode) -> Option<(Window, Receiver<(f64, WindowEvent)>)>

Wrapper for glfwCreateWindow.

fn close(self)

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

fn render_context(&mut self) -> RenderContext

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

fn should_close(&self) -> bool

Wrapper for glfwWindowShouldClose.

fn set_should_close(&mut self, value: bool)

Wrapper for glfwSetWindowShouldClose.

fn set_title(&mut self, title: &str)

Sets the title of the window.

Wrapper for glfwSetWindowTitle.

fn get_pos(&self) -> (i32, i32)

Wrapper for glfwGetWindowPos.

fn set_pos(&mut self, xpos: i32, ypos: i32)

Wrapper for glfwSetWindowPos.

fn get_size(&self) -> (i32, i32)

Wrapper for glfwGetWindowSize.

fn set_size(&mut self, width: i32, height: i32)

Wrapper for glfwSetWindowSize.

fn get_framebuffer_size(&self) -> (i32, i32)

Wrapper for glfwGetFramebufferSize.

fn iconify(&mut self)

Wrapper for glfwIconifyWindow.

fn restore(&mut self)

Wrapper for glfwRestoreWindow.

fn show(&mut self)

Wrapper for glfwShowWindow.

fn hide(&mut self)

Wrapper for glfwHideWindow.

fn with_window_mode<T, F>(&self, f: F) -> T where F: Fn(WindowMode) -> T

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()),
    }
});

fn is_focused(&self) -> bool

Wrapper for glfwGetWindowAttrib called with FOCUSED.

fn is_iconified(&self) -> bool

Wrapper for glfwGetWindowAttrib called with ICONIFIED.

fn get_client_api(&self) -> c_int

Wrapper for glfwGetWindowAttrib called with CLIENT_API.

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.

fn get_context_robustness(&self) -> c_int

Wrapper for glfwGetWindowAttrib called with CONTEXT_ROBUSTNESS.

fn is_opengl_forward_compat(&self) -> bool

Wrapper for glfwGetWindowAttrib called with OPENGL_FORWARD_COMPAT.

fn is_opengl_debug_context(&self) -> bool

Wrapper for glfwGetWindowAttrib called with OPENGL_DEBUG_CONTEXT.

fn get_opengl_profile(&self) -> c_int

Wrapper for glfwGetWindowAttrib called with OPENGL_PROFILE.

fn is_resizable(&self) -> bool

Wrapper for glfwGetWindowAttrib called with RESIZABLE.

fn is_visible(&self) -> bool

Wrapper for glfwGetWindowAttrib called with VISIBLE.

fn is_decorated(&self) -> bool

Wrapper for glfwGetWindowAttrib called with DECORATED.

fn set_pos_polling(&mut self, should_poll: bool)

Wrapper for glfwSetWindowPosCallback.

fn set_all_polling(&mut self, should_poll: bool)

fn set_size_polling(&mut self, should_poll: bool)

Wrapper for glfwSetWindowSizeCallback.

fn set_close_polling(&mut self, should_poll: bool)

Wrapper for glfwSetWindowCloseCallback.

fn set_refresh_polling(&mut self, should_poll: bool)

Wrapper for glfwSetWindowRefreshCallback.

fn set_focus_polling(&mut self, should_poll: bool)

Wrapper for glfwSetWindowFocusCallback.

fn set_iconify_polling(&mut self, should_poll: bool)

Wrapper for glfwSetWindowIconifyCallback.

fn set_framebuffer_size_polling(&mut self, should_poll: bool)

Wrapper for glfwSetFramebufferSizeCallback.

fn get_cursor_mode(&self) -> CursorMode

Wrapper for glfwGetInputMode called with CURSOR.

fn set_cursor_mode(&mut self, mode: CursorMode)

Wrapper for glfwSetInputMode called with CURSOR.

fn has_sticky_keys(&self) -> bool

Wrapper for glfwGetInputMode called with STICKY_KEYS.

fn set_sticky_keys(&mut self, value: bool)

Wrapper for glfwSetInputMode called with STICKY_KEYS.

fn has_sticky_mouse_buttons(&self) -> bool

Wrapper for glfwGetInputMode called with STICKY_MOUSE_BUTTONS.

fn set_sticky_mouse_buttons(&mut self, value: bool)

Wrapper for glfwSetInputMode called with STICKY_MOUSE_BUTTONS.

fn get_key(&self, key: Key) -> Action

Wrapper for glfwGetKey.

fn get_mouse_button(&self, button: MouseButton) -> Action

Wrapper for glfwGetMouseButton.

fn get_cursor_pos(&self) -> (f64, f64)

Wrapper for glfwGetCursorPos.

fn set_cursor_pos(&mut self, xpos: f64, ypos: f64)

Wrapper for glfwSetCursorPos.

fn set_key_polling(&mut self, should_poll: bool)

Wrapper for glfwSetKeyCallback.

fn set_char_polling(&mut self, should_poll: bool)

Wrapper for glfwSetCharCallback.

fn set_mouse_button_polling(&mut self, should_poll: bool)

Wrapper for glfwSetMouseButtonCallback.

fn set_cursor_pos_polling(&mut self, should_poll: bool)

Wrapper for glfwSetCursorPosCallback.

fn set_cursor_enter_polling(&mut self, should_poll: bool)

Wrapper for glfwSetCursorEnterCallback.

fn set_scroll_polling(&mut self, should_poll: bool)

Wrapper for glfwSetScrollCallback.

fn set_clipboard_string(&mut self, string: &str)

Wrapper for glfwGetClipboardString.

fn get_clipboard_string(&self) -> String

Wrapper for glfwGetClipboardString.

fn get_win32_window(&self) -> *mut c_void

Wrapper for glfwGetWin32Window

fn get_wgl_context(&self) -> *mut c_void

Wrapper for glfwGetWGLContext

Trait Implementations

impl Drop for Window
[src]

fn drop(&mut self)

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 Context for Window
[src]

fn window_ptr(&self) -> *mut GLFWwindow

Returns the pointer to the underlying GLFWwindow.

fn swap_buffers(&mut self)

Swaps the front and back buffers of the window. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers. Read more

fn is_current(&self) -> bool

Returns true if the window is the current context.

fn make_current(&mut self)

Wrapper for glfwMakeContextCurrent