Struct sdl2::render::CanvasBuilder
source · pub struct CanvasBuilder { /* private fields */ }
Expand description
The type that allows you to build Window-based renderers.
By default, the renderer builder will prioritize for a hardware-accelerated renderer, which is probably what you want.
Implementations§
source§impl CanvasBuilder
impl CanvasBuilder
sourcepub fn new(window: Window) -> CanvasBuilder
pub fn new(window: Window) -> CanvasBuilder
Initializes a new CanvasBuilder
.
sourcepub fn build(self) -> Result<WindowCanvas, IntegerOrSdlError>
pub fn build(self) -> Result<WindowCanvas, IntegerOrSdlError>
Builds the renderer.
sourcepub fn index(self, index: u32) -> CanvasBuilder
pub fn index(self, index: u32) -> CanvasBuilder
Sets the index of the rendering driver to initialize.
If you desire the first rendering driver to support the flags provided,
or if you’re translating code from C which passes -1 for the index,
do not invoke the index
method.
sourcepub fn software(self) -> CanvasBuilder
pub fn software(self) -> CanvasBuilder
Set the renderer to a software fallback. This flag is accumulative, and may be specified with other flags.
sourcepub fn accelerated(self) -> CanvasBuilder
pub fn accelerated(self) -> CanvasBuilder
Set the renderer to use hardware acceleration. This flag is accumulative, and may be specified with other flags.
sourcepub fn present_vsync(self) -> CanvasBuilder
pub fn present_vsync(self) -> CanvasBuilder
Synchronize renderer present
method calls with the refresh rate.
This flag is accumulative, and may be specified with other flags.
sourcepub fn target_texture(self) -> CanvasBuilder
pub fn target_texture(self) -> CanvasBuilder
Set the renderer to support rendering to a texture. This flag is accumulative, and may be specified with other flags.