[][src]Struct beryllium::RendererWindow

pub struct RendererWindow<'sdl> { /* fields omitted */ }

This is a [Widow] that also allows SDL2's cross-platform 2D rendering system.

This is 2D only, but if you just want a rectangular bitmap on the screen (eg: an emulator or similar) then it's just fine.

Methods

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

pub fn create_texture_from_surface<'ren>(
    &'ren self,
    surf: &Surface
) -> Result<Texture<'sdl, 'ren>, String>
[src]

Makes a texture with the contents of the surface specified.

The TextureAccess hint for textures from this is "static".

The pixel format might be different from the surface's pixel format.

pub fn draw_color(&self) -> Result<Color, String>[src]

Obtains the current draw color.

pub fn set_draw_color(&self, color: Color) -> Result<(), String>[src]

Assigns the color used for drawing.

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

Clears the render target with the current draw color.

pub fn output_size(&self) -> Result<(i32, i32), String>[src]

Obtains the output area size in physical pixels.

pub fn draw_line(
    &self,
    x1: i32,
    y1: i32,
    x2: i32,
    y2: i32
) -> Result<(), String>
[src]

Draws a line that includes both end points.

pub fn draw_lines(&self, points: &[Point]) -> Result<(), String>[src]

Using the slice of n points, draws n-1 lines end to end.

pub fn copy(
    &self,
    t: &Texture,
    src: Option<Rect>,
    dst: Option<Rect>
) -> Result<(), String>
[src]

Blits the texture to the rendering target.

  • src: Optional clip rect of where to copy from. If None, the whole texture is used.
  • dst: Optional clip rect of where to copy data to. If None, the whole render target is used.

The image is stretched as necessary if the src and dst are different sizes. This is a GPU operation, so it's fast no matter how much upscale or downscale you do.

pub fn present(&self)[src]

Presents the backbuffer to the user.

After a present, all backbuffer data should be assumed to be invalid, and you should also clear the backbuffer before doing the next render pass even if you intend to write to every pixel.

Methods from Deref<Target = Window<'sdl>>

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 fn flags(&self) -> WindowFlags[src]

Use this function to get the window flags.

pub fn resizable(&self) -> bool[src]

Returns the user-resizable state of a window.

pub fn set_resizable(&self, resizable: bool)[src]

Use this function to set the user-resizable state of a window.

pub fn title(&self) -> String[src]

Returns the title of the window in UTF-8 format or "" if there is no title.

pub fn set_title(&self, title: &str)[src]

Sets the title of the window.

pub fn show(&self)[src]

Use this function to show a window.

pub fn hide(&self)[src]

Use this function to hide a window.

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

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

For physical pixel counts use the method appropriate to your backend: GLWindow::drawable_size or RendererWindow::output_size.

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 window_display_mode(&self) -> Result<DisplayMode, String>[src]

Obtains info about the fullscreen settings of the window.

Use this function to get info about the display mode that the Window uses when it's fullscreen.

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

Obtains info about the monitor settings that the center of the window is being displayed on.

Use this function to get information about the Desktop display mode (even if a Window is currently fullscreen).

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.

Trait Implementations

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

impl<'sdl> Deref for RendererWindow<'sdl>[src]

type Target = Window<'sdl>

The resulting type after dereferencing.

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

Auto Trait Implementations

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

impl<'sdl> Unpin for RendererWindow<'sdl>

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

impl<'sdl> UnwindSafe for RendererWindow<'sdl>

impl<'sdl> RefUnwindSafe for RendererWindow<'sdl>

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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