Class: RenderTexture
- Inherits:
-
Object
- Object
- RenderTexture
- Defined in:
- src/ruby/models/render_texture.rb,
mrb_doc/models/render_texture.rb
Overview
The RenderTexture class is used to draw things to a texture
Instance Attribute Summary collapse
- #height ⇒ Integer readonly
- #texture ⇒ Texture2D readonly
- #width ⇒ Integer readonly
Instance Method Summary collapse
-
#drawing { ... } ⇒ nil
Instead of rending to the screen, render to this RenderTexture.
-
#initialize(width, height) ⇒ RenderTexture
constructor
Creates a new instance of RenderTexture.
-
#to_h ⇒ Hash
Return the object represented by a Hash.
-
#unload ⇒ nil
Unloads the render texture from memory.
Constructor Details
#initialize(width, height) ⇒ RenderTexture
Creates a new instance of RenderTexture
7 8 9 10 11 |
# File 'mrb_doc/models/render_texture.rb', line 7 def initialize(width, height) # mrb_RenderTexture_initialize # src/mruby_integration/models/render_texture.cpp RenderTexture.new end |
Instance Attribute Details
#height ⇒ Integer (readonly)
7 8 9 |
# File 'src/ruby/models/render_texture.rb', line 7 def height @height end |
#texture ⇒ Texture2D (readonly)
4 5 6 |
# File 'src/ruby/models/render_texture.rb', line 4 def texture @texture end |
#width ⇒ Integer (readonly)
7 8 9 |
# File 'src/ruby/models/render_texture.rb', line 7 def width @width end |
Instance Method Details
#drawing { ... } ⇒ nil
Instead of rending to the screen, render to this RenderTexture
22 23 24 25 26 27 |
# File 'src/ruby/models/render_texture.rb', line 22 def drawing(&block) begin_texture_mode(self) block.call ensure end_texture_mode end |
#to_h ⇒ Hash
Return the object represented by a Hash
11 12 13 14 15 16 17 |
# File 'src/ruby/models/render_texture.rb', line 11 def to_h { texture: texture.to_h, width: width, height: height, } end |
#unload ⇒ nil
Unloads the render texture from memory
15 16 17 18 |
# File 'mrb_doc/models/render_texture.rb', line 15 def unload # src/mruby_integration/models/render_texture.cpp nil end |