Struct glfw::Window [−][src]
A struct that wraps a *GLFWwindow
handle.
Fields
glfw: Glfw
Methods
impl Window
[src]
impl Window
pub fn get_proc_address(&mut self, procname: &str) -> GLProc
[src]
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
.
Wrapper for glfwCreateWindow
.
pub fn close(self)
[src]
pub fn close(self)
Calling this method forces the destructor to be called, closing the window.
pub fn render_context(&mut self) -> RenderContext
[src]
pub fn render_context(&mut self) -> RenderContext
Returns a render context that can be shared between tasks, allowing for concurrent rendering.
pub fn should_close(&self) -> bool
[src]
pub fn should_close(&self) -> bool
Wrapper for glfwWindowShouldClose
.
pub fn set_should_close(&mut self, value: bool)
[src]
pub fn set_should_close(&mut self, value: bool)
Wrapper for glfwSetWindowShouldClose
.
pub fn set_title(&mut self, title: &str)
[src]
pub fn set_title(&mut self, title: &str)
Sets the title of the window.
Wrapper for glfwSetWindowTitle
.
pub fn get_pos(&self) -> (i32, i32)
[src]
pub fn get_pos(&self) -> (i32, i32)
Wrapper for glfwGetWindowPos
.
pub fn set_pos(&mut self, xpos: i32, ypos: i32)
[src]
pub fn set_pos(&mut self, xpos: i32, ypos: i32)
Wrapper for glfwSetWindowPos
.
pub fn get_size(&self) -> (i32, i32)
[src]
pub fn get_size(&self) -> (i32, i32)
Wrapper for glfwGetWindowSize
.
pub fn set_size(&mut self, width: i32, height: i32)
[src]
pub fn set_size(&mut self, width: i32, height: i32)
Wrapper for glfwSetWindowSize
.
pub fn get_frame_size(&self) -> (i32, i32, i32, i32)
[src]
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.
pub fn get_framebuffer_size(&self) -> (i32, i32)
[src]
pub fn get_framebuffer_size(&self) -> (i32, i32)
Wrapper for glfwGetFramebufferSize
.
pub fn set_aspect_ratio(&mut self, numer: u32, denum: u32)
[src]
pub fn set_aspect_ratio(&mut self, numer: u32, denum: u32)
Wrapper for glfwSetWindowAspectRatio
.
pub fn set_size_limits(
&mut self,
minwidth: u32,
minheight: u32,
maxwidth: u32,
maxheight: u32
)
[src]
pub fn set_size_limits(
&mut self,
minwidth: u32,
minheight: u32,
maxwidth: u32,
maxheight: u32
)
Wrapper for glfwSetWindowSizeLimits
.
pub fn iconify(&mut self)
[src]
pub fn iconify(&mut self)
Wrapper for glfwIconifyWindow
.
pub fn restore(&mut self)
[src]
pub fn restore(&mut self)
Wrapper for glfwRestoreWindow
.
pub fn maximize(&mut self)
[src]
pub fn maximize(&mut self)
Wrapper for glfwMaximizeWindow
pub fn show(&mut self)
[src]
pub fn show(&mut self)
Wrapper for glfwShowWindow
.
pub fn hide(&mut self)
[src]
pub fn hide(&mut self)
Wrapper for glfwHideWindow
.
pub fn with_window_mode<T, F>(&self, f: F) -> T where
F: Fn(WindowMode) -> T,
[src]
pub 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()), } });
pub fn with_window_mode_mut<T, F>(&self, f: F) -> T where
F: FnMut(WindowMode) -> T,
[src]
pub fn with_window_mode_mut<T, F>(&self, f: F) -> T where
F: FnMut(WindowMode) -> T,
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]
pub fn set_monitor(
&mut self,
mode: WindowMode,
xpos: i32,
ypos: i32,
width: u32,
height: u32,
refresh_rate: Option<u32>
)
Wrapper for glfwSetWindowMonitor
pub fn focus(&mut self)
[src]
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.
pub fn is_focused(&self) -> bool
[src]
pub fn is_focused(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with FOCUSED
.
pub fn is_iconified(&self) -> bool
[src]
pub fn is_iconified(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with ICONIFIED
.
pub fn is_maximized(&self) -> bool
[src]
pub fn is_maximized(&self) -> bool
Wrapper for glfwGetWindowattrib
called with MAXIMIZED
.
pub fn get_client_api(&self) -> c_int
[src]
pub fn get_client_api(&self) -> c_int
Wrapper for glfwGetWindowAttrib
called with CLIENT_API
.
pub fn get_context_version(&self) -> Version
[src]
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.
pub fn get_context_robustness(&self) -> c_int
[src]
pub fn get_context_robustness(&self) -> c_int
Wrapper for glfwGetWindowAttrib
called with CONTEXT_ROBUSTNESS
.
pub fn is_opengl_forward_compat(&self) -> bool
[src]
pub fn is_opengl_forward_compat(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with OPENGL_FORWARD_COMPAT
.
pub fn is_opengl_debug_context(&self) -> bool
[src]
pub fn is_opengl_debug_context(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with OPENGL_DEBUG_CONTEXT
.
pub fn get_opengl_profile(&self) -> c_int
[src]
pub fn get_opengl_profile(&self) -> c_int
Wrapper for glfwGetWindowAttrib
called with OPENGL_PROFILE
.
pub fn is_resizable(&self) -> bool
[src]
pub fn is_resizable(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with RESIZABLE
.
pub fn is_visible(&self) -> bool
[src]
pub fn is_visible(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with VISIBLE
.
pub fn is_decorated(&self) -> bool
[src]
pub fn is_decorated(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with DECORATED
.
pub fn set_pos_polling(&mut self, should_poll: bool)
[src]
pub fn set_pos_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowPosCallback
.
pub fn set_all_polling(&mut self, should_poll: bool)
[src]
pub fn set_all_polling(&mut self, should_poll: bool)
Starts or stops polling for all available events
pub fn set_size_polling(&mut self, should_poll: bool)
[src]
pub fn set_size_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowSizeCallback
.
pub fn set_close_polling(&mut self, should_poll: bool)
[src]
pub fn set_close_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowCloseCallback
.
pub fn set_refresh_polling(&mut self, should_poll: bool)
[src]
pub fn set_refresh_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowRefreshCallback
.
pub fn set_focus_polling(&mut self, should_poll: bool)
[src]
pub fn set_focus_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowFocusCallback
.
pub fn set_iconify_polling(&mut self, should_poll: bool)
[src]
pub fn set_iconify_polling(&mut self, should_poll: bool)
Wrapper for glfwSetWindowIconifyCallback
.
pub fn set_framebuffer_size_polling(&mut self, should_poll: bool)
[src]
pub fn set_framebuffer_size_polling(&mut self, should_poll: bool)
Wrapper for glfwSetFramebufferSizeCallback
.
pub fn set_drag_and_drop_polling(&mut self, should_poll: bool)
[src]
pub fn set_drag_and_drop_polling(&mut self, should_poll: bool)
Wrapper for glfwSetFramebufferSizeCallback
.
pub fn get_cursor_mode(&self) -> CursorMode
[src]
pub fn get_cursor_mode(&self) -> CursorMode
Wrapper for glfwGetInputMode
called with CURSOR
.
pub fn set_cursor_mode(&mut self, mode: CursorMode)
[src]
pub fn set_cursor_mode(&mut self, mode: CursorMode)
Wrapper for glfwSetInputMode
called with CURSOR
.
pub fn set_cursor(&mut self, cursor: Option<Cursor>) -> Option<Cursor>
[src]
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.
pub fn set_icon_from_pixels(&mut self, images: Vec<PixelImage>)
[src]
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)
pub fn has_sticky_keys(&self) -> bool
[src]
pub fn has_sticky_keys(&self) -> bool
Wrapper for glfwGetInputMode
called with STICKY_KEYS
.
pub fn set_sticky_keys(&mut self, value: bool)
[src]
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
.
pub fn get_key(&self, key: Key) -> Action
[src]
pub fn get_key(&self, key: Key) -> Action
Wrapper for glfwGetKey
.
Wrapper for glfwGetMouseButton
.
pub fn get_cursor_pos(&self) -> (f64, f64)
[src]
pub fn get_cursor_pos(&self) -> (f64, f64)
Wrapper for glfwGetCursorPos
.
pub fn set_cursor_pos(&mut self, xpos: f64, ypos: f64)
[src]
pub fn set_cursor_pos(&mut self, xpos: f64, ypos: f64)
Wrapper for glfwSetCursorPos
.
pub fn set_key_polling(&mut self, should_poll: bool)
[src]
pub fn set_key_polling(&mut self, should_poll: bool)
Wrapper for glfwSetKeyCallback
.
pub fn set_char_polling(&mut self, should_poll: bool)
[src]
pub fn set_char_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCharCallback
.
pub fn set_char_mods_polling(&mut self, should_poll: bool)
[src]
pub fn set_char_mods_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCharModsCallback
Wrapper for glfwSetMouseButtonCallback
.
pub fn set_cursor_pos_polling(&mut self, should_poll: bool)
[src]
pub fn set_cursor_pos_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCursorPosCallback
.
pub fn set_cursor_enter_polling(&mut self, should_poll: bool)
[src]
pub fn set_cursor_enter_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCursorEnterCallback
.
pub fn set_scroll_polling(&mut self, should_poll: bool)
[src]
pub fn set_scroll_polling(&mut self, should_poll: bool)
Wrapper for glfwSetScrollCallback
.
pub fn set_clipboard_string(&mut self, string: &str)
[src]
pub fn set_clipboard_string(&mut self, string: &str)
Wrapper for glfwGetClipboardString
.
pub fn get_clipboard_string(&self) -> String
[src]
pub fn get_clipboard_string(&self) -> String
Wrapper for glfwGetClipboardString
.
pub fn get_x11_window(&self) -> *mut c_void
[src]
pub fn get_x11_window(&self) -> *mut c_void
Wrapper for glfwGetX11Window
pub fn get_glx_context(&self) -> *mut c_void
[src]
pub fn get_glx_context(&self) -> *mut c_void
Wrapper for glfwGetGLXContext
Trait Implementations
impl Drop for Window
[src]
impl Drop for Window
fn drop(&mut self)
[src]
fn drop(&mut self)
Closes the window and performs the necessary cleanups. This will block
until all associated RenderContext
s were also dropped, and emit a
debug!
message to that effect.
Wrapper for glfwDestroyWindow
.
impl Context for Window
[src]
impl Context for Window
fn window_ptr(&self) -> *mut GLFWwindow
[src]
fn window_ptr(&self) -> *mut GLFWwindow
Returns the pointer to the underlying GLFWwindow
.
fn swap_buffers(&mut self)
[src]
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
[src]
fn is_current(&self) -> bool
Returns true
if the window is the current context.
fn make_current(&mut self)
[src]
fn make_current(&mut self)
Wrapper for glfwMakeContextCurrent