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
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
.
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_frame_size(&self) -> (i32, i32, i32, i32)
Wrapper for glfwGetWindowFrameSize
Returns (left, top, right, bottom)
edge window frame sizes, in screen coordinates.
fn get_framebuffer_size(&self) -> (i32, i32)
Wrapper for glfwGetFramebufferSize
.
fn set_aspect_ratio(&mut self, numer: u32, denum: u32)
Wrapper for glfwSetWindowAspectRatio
.
fn set_size_limits(&mut self,
minwidth: u32,
minheight: u32,
maxwidth: u32,
maxheight: u32)
minwidth: u32,
minheight: u32,
maxwidth: u32,
maxheight: u32)
Wrapper for glfwSetWindowSizeLimits
.
fn iconify(&mut self)
Wrapper for glfwIconifyWindow
.
fn restore(&mut self)
Wrapper for glfwRestoreWindow
.
fn maximize(&mut self)
Wrapper for glfwMaximizeWindow
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 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()), } });
fn set_monitor(&mut self,
mode: WindowMode,
xpos: i32,
ypos: i32,
width: u32,
height: u32,
refresh_rate: Option<u32>)
mode: WindowMode,
xpos: i32,
ypos: i32,
width: u32,
height: u32,
refresh_rate: Option<u32>)
Wrapper for glfwSetWindowMonitor
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.
fn is_focused(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with FOCUSED
.
fn is_iconified(&self) -> bool
Wrapper for glfwGetWindowAttrib
called with ICONIFIED
.
fn is_maximized(&self) -> bool
Wrapper for glfwGetWindowattrib
called with MAXIMIZED
.
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)
Starts or stops polling for all available events
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 set_drag_and_drop_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 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.
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)
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
.
Wrapper for glfwGetInputMode
called with STICKY_MOUSE_BUTTONS
.
Wrapper for glfwSetInputMode
called with STICKY_MOUSE_BUTTONS
.
fn get_key(&self, key: Key) -> Action
Wrapper for glfwGetKey
.
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_char_mods_polling(&mut self, should_poll: bool)
Wrapper for glfwSetCharModsCallback
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_x11_window(&self) -> *mut c_void
Wrapper for glfwGetX11Window
fn get_glx_context(&self) -> *mut c_void
Wrapper for glfwGetGLXContext
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 RenderContext
s 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