pub struct Window { /* private fields */ }Implementations§
Source§impl Window
impl Window
Sourcepub fn new(width: u32, height: u32, title: &str) -> Result<Self, Errors>
pub fn new(width: u32, height: u32, title: &str) -> Result<Self, Errors>
Create a new window with the given width and height and title, and enable polling
for the given window events. If the window cannot be created, returns an error of
type Errors::WindowCreationError.
§Arguments
width- The width of the window in pixels.height- The height of the window in pixels.title- The title of the window.
§Returns
A Result containing a Window instance if successful, or an error of type
Errors::WindowCreationError otherwise.
Sourcepub fn init_gl(&mut self) -> Result<(), Errors>
pub fn init_gl(&mut self) -> Result<(), Errors>
Initialize the OpenGL context for the window.
This function sets the current context to the window’s OpenGL context
and loads the OpenGL function pointers using the gl crate.
§Errors
This function will return an error if there are any OpenGL errors during the initialization process.
Sourcepub fn should_close(&self) -> bool
pub fn should_close(&self) -> bool
Sourcepub fn enable_depth_test(&self)
pub fn enable_depth_test(&self)
Enable depth testing for this window.
§OpenGL Functions
This function is a wrapper around glEnable(GL_DEPTH_TEST).
Sourcepub fn enable_blend(&self)
pub fn enable_blend(&self)
Enable blending for this window.
§OpenGL Functions
This function is a wrapper around glEnable(GL_BLEND) and
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
Auto Trait Implementations§
impl Freeze for Window
impl RefUnwindSafe for Window
impl !Send for Window
impl !Sync for Window
impl Unpin for Window
impl UnsafeUnpin for Window
impl UnwindSafe for Window
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more