class Graphics::Drawing

A drawing. Like a Simulation, but on a canvas that doesn’t have double buffering or clearing on each tick.

See AbstractSimulation for most methods.

Attributes

texture[RW]

The canvas used for all drawing.

Public Instance Methods

draw_on(texture) { || ... } click to toggle source

Temporarily render to a texture instead of the renderer’s window, then copy that texture to the renderer and present it.

# File lib/graphics/simulation.rb, line 751
def draw_on texture
  renderer.target = texture

  yield if block_given?
ensure
  renderer.target = nil
  renderer.copy_texture texture
  renderer.present
end