Struct radiant_rs::Renderer [] [src]

pub struct Renderer { /* fields omitted */ }

A renderer is used to render Layers or Textures to the Display.

The renderer itself is not thread-safe. Instead, draw or write onto layers (from any one or more threads) and present those layers using the renderer once your threads have concluded drawing.

Methods

impl Renderer
[src]

[src]

Returns a new renderer instance.

[src]

Returns a reference to the renderers' context. The RenderContext implements send+sync and is required by Font, Sprite and Texture to create new instances.

Important traits for &'a mut W
[src]

Clears the current target.

Important traits for &'a mut W
[src]

Draws given layer to the current target. Component refers to the sprite component to draw. All sprites support at least component 0. Sprites that do not support the given component will not be drawn.

[src]

Draws a rectangle to the current target. See DrawBuilder for available options.

Examples

renderer.rect(((0., 0.), (640., 480.))).blendmode(blendmodes::ALPHA).texture(&tex).draw();

[src]

Fills the current target. See DrawBuilder for available options.

This is a specialization of rect() that simply fills the entire target.

Examples

renderer.fill().blendmode(blendmodes::ALPHA).texture(&tex).draw();

Important traits for &'a mut W
[src]

Reroutes draws issued within draw_func() to given Texture.

Examples

// Create a texture to render to.
let surface = Texture::new(&rendercontext, 640, 480);

// Render something to it.
renderer.render_to(&surface, || {
    renderer.rect(((0., 0.), (640., 480.))).texture(&some_texture).draw();
    renderer.draw_layer(&some_layer, 0);
});

Important traits for &'a mut W
[src]

Reroutes draws issued within draw_func() through the given postprocessor.

The following example uses the Basic postprocessor provided by the library.

Examples

// Load a shader progam.
let my_program = Program::from_string(&rendercontext, &program_source).unwrap();

// Create the postprocessor with the program.
let my_postprocessor = postprocessors::Basic::new(&rendercontext, my_program);

// ... in your renderloop...
renderer.postprocess(&my_postprocessor, &blendmodes::ALPHA, || {
    renderer.clear(Color::BLACK);
    renderer.draw_layer(&my_layer, 0);
});

[src]

Copies a rectangle from the source to the current target.

This is a blitting operation that uses integral pixel coordinates (top/left = 0/0). Coordinates must be entirely contained within their respective sources. No blending is performed.

[src]

Copies the entire source, overwriting the entire current target.

This is a blitting operation, no blending is performed.

[src]

Returns a reference to the default rendering program.

Trait Implementations

impl Clone for Renderer
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl !Send for Renderer

impl !Sync for Renderer