[][src]Struct beryllium::Window

#[repr(transparent)]
pub struct Window<'sdl> { /* fields omitted */ }

Handle to a window on the screen.

Methods

impl<'sdl> Window<'sdl>[src]

pub fn modal_message_box(
    &self,
    box_type: MessageBox,
    title: &str,
    message: &str
) -> Result<(), String>
[src]

Like the lone_message_box function, but modal to this Window.

Because you need a valid Window to call this method, we don't need to mark it as unsafe.

pub unsafe fn create_renderer<'win>(
    &'win self,
    driver_index: Option<usize>,
    flags: RendererFlags
) -> Result<Renderer<'sdl, 'win>, String>
[src]

Makes a renderer for the window.

Safety

  • Each renderer must only be used with its own window
  • Each renderer must only be used with textures that it created

If you only have a single renderer then this is trivially proved, if you make more than one renderer it's up to you to verify this.

pub fn size(&self) -> (i32, i32)[src]

Gets the logical size of the window (in screen coordinates).

Use the GL Drawable Size or Renderer Output Size checks to get the physical pixel count, if you need that.

pub fn set_size(&self, width: i32, height: i32)[src]

Sets the logical size of the window.

Note that fullscreen windows automatically match the size of the display mode, so use set_display_mode instead.

pub fn display_mode(&self) -> Result<DisplayMode, String>[src]

Obtains info about the fullscreen settings of the window.

pub fn set_display_mode(
    &self,
    opt_mode: Option<DisplayMode>
) -> Result<(), String>
[src]

Assigns the fullscreen display mode for the window.

  • If Some(mode), attempts to set the mode given.
  • If None, it will use the window's dimensions, and the desktop's current format and refresh rate.

pub fn set_fullscreen_style(&self, style: FullscreenStyle) -> Result<(), String>[src]

Sets the window's fullscreen style.

  • Fullscreen: Performs an actual video mode change.
  • Fullscreen Desktop: "fake" fullscreen with full resolution but no video mode change.
  • Windowed: Don't use fullscreen.

pub unsafe fn gl_create_context<'win>(
    &'win self
) -> Result<GLContext<'sdl, 'win>, String>
[src]

Creates a context for this window and makes it current.

pub fn gl_get_drawable_size(&self) -> (i32, i32)[src]

Obtains the size of the drawable space in the window.

This gives you a number of "physical pixels", so it might be different from the "logical pixels" value you get when you call size. This is primarily for use with glViewport

pub unsafe fn gl_swap_window(&self)[src]

Swaps the window's OpenGL buffers.

If double buffering isn't enabled this just does nothing.

pub unsafe fn gl_make_current(&self, ctx: &GLContext) -> Result<(), String>[src]

Makes the given context the current context in this window.

Trait Implementations

impl<'sdl> Drop for Window<'sdl>[src]

impl<'sdl> Debug for Window<'sdl>[src]

Auto Trait Implementations

impl<'sdl> !Send for Window<'sdl>

impl<'sdl> !Sync for Window<'sdl>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]