Struct ytesrev::prelude::Window

source ·
pub struct Window { /* private fields */ }
Expand description

Represents the “shell” of a Window.

You can set get and set many of the SDL_Window properties (i.e., border, size, PixelFormat, etc)

However, you cannot directly access the pixels of the Window. It needs to be converted to a Canvas to access the rendering functions.

Note: If a Window goes out of scope but it cloned its context, then the SDL_Window will not be destroyed until there are no more references to the WindowContext. This may happen when a TextureCreator<Window> outlives the Canvas<Window>

Implementations

Create a new Window without taking ownership of the WindowContext

Initializes a new CanvasBuilder; a convenience method that calls CanvasBuilder::new().

Set the window’s OpenGL context to the current context on the thread.

Returns a WindowSurfaceRef, which can be used like a regular Surface. This is an alternative way to the Renderer (Canvas) way to modify pixels directly in the Window.

For this to happen, simply create a WindowSurfaceRef via this method, use the underlying Surface however you like, and when the changes of the Surface must be applied to the screen, call update_window if you intend to keep using the WindowSurfaceRef afterwards, or finish if you don’t intend to use it afterwards.

The Renderer way is of course much more flexible and recommended; even though you only want to support Software Rendering (which is what using Surface is), you can still create a Renderer which renders in a Software-based manner, so try to rely on a Renderer as much as possible !

Trait Implementations

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.