Struct glfw::Window[src]
pub struct Window { pub ptr: *GLFWwindow, pub glfw: Glfw, pub is_shared: bool, // some fields omitted }
A struct that wraps a *GLFWwindow
handle.
Fields
ptr | |
glfw | |
is_shared |
Methods
impl Window
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(&self, value: bool)
Wrapper for glfwSetWindowShouldClose
.
fn set_title(&self, title: &str)
Sets the title of the window.
Wrapper for glfwSetWindowTitle
.
fn get_pos(&self) -> (i32, i32)
Wrapper for glfwGetWindowPos
.
fn set_pos(&self, xpos: i32, ypos: i32)
Wrapper for glfwSetWindowPos
.
fn get_size(&self) -> (i32, i32)
Wrapper for glfwGetWindowSize
.
fn set_size(&self, width: i32, height: i32)
Wrapper for glfwSetWindowSize
.
fn get_framebuffer_size(&self) -> (i32, i32)
Wrapper for glfwGetFramebufferSize
.
fn iconify(&self)
Wrapper for glfwIconifyWindow
.
fn restore(&self)
Wrapper for glfwRestoreWindow
.
fn show(&self)
Wrapper for glfwShowWindow
.
fn hide(&self)
Wrapper for glfwHideWindow
.
fn with_window_mode<T>(&self, f: |WindowMode| -> T) -> T
Returns whether the window is fullscreen or windowed.
Wrapper for glfwGetWindowMonitor
.
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(&self, should_poll: bool)
Wrapper for glfwSetWindowPosCallback
.
fn set_all_polling(&self, should_poll: bool)
fn set_size_polling(&self, should_poll: bool)
Wrapper for glfwSetWindowSizeCallback
.
fn set_close_polling(&self, should_poll: bool)
Wrapper for glfwSetWindowCloseCallback
.
fn set_refresh_polling(&self, should_poll: bool)
Wrapper for glfwSetWindowRefreshCallback
.
fn set_focus_polling(&self, should_poll: bool)
Wrapper for glfwSetWindowFocusCallback
.
fn set_iconify_polling(&self, should_poll: bool)
Wrapper for glfwSetWindowIconifyCallback
.
fn set_framebuffer_size_polling(&self, should_poll: bool)
Wrapper for glfwSetFramebufferSizeCallback
.
fn get_cursor_mode(&self) -> CursorMode
Wrapper for glfwGetInputMode
called with CURSOR
.
fn set_cursor_mode(&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(&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(&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(&self, xpos: f64, ypos: f64)
Wrapper for glfwSetCursorPos
.
fn set_key_polling(&self, should_poll: bool)
Wrapper for glfwSetKeyCallback
.
fn set_char_polling(&self, should_poll: bool)
Wrapper for glfwSetCharCallback
.
fn set_mouse_button_polling(&self, should_poll: bool)
Wrapper for glfwSetMouseButtonCallback
.
fn set_cursor_pos_polling(&self, should_poll: bool)
Wrapper for glfwSetCursorPosCallback
.
fn set_cursor_enter_polling(&self, should_poll: bool)
Wrapper for glfwSetCursorEnterCallback
.
fn set_scroll_polling(&self, should_poll: bool)
Wrapper for glfwSetScrollCallback
.
fn set_clipboard_string(&self, string: &str)
Wrapper for glfwGetClipboardString
.
fn get_clipboard_string(&self) -> ~str
Wrapper for glfwGetClipboardString
.
fn get_cocoa_window(&self) -> *c_void
Wrapper for glfwGetCocoaWindow
fn get_nsgl_context(&self) -> *c_void
Wrapper for glfwGetNSGLContext
Trait Implementations
impl Drop for Window
fn drop(&mut self)
Closes the window and performs the necessary cleanups. This will block
until all associated RenderContext
s were also dropped.
Wrapper for glfwDestroyWindow
.