Class: Engine::Components::UISpriteRenderer
- Inherits:
-
Engine::Component
- Object
- Engine::Component
- Engine::Components::UISpriteRenderer
- Defined in:
- lib/engine/components/ui_sprite_renderer.rb
Instance Attribute Summary collapse
-
#material ⇒ Object
readonly
Returns the value of attribute material.
-
#v1 ⇒ Object
readonly
Returns the value of attribute v1.
-
#v2 ⇒ Object
readonly
Returns the value of attribute v2.
-
#v3 ⇒ Object
readonly
Returns the value of attribute v3.
-
#v4 ⇒ Object
readonly
Returns the value of attribute v4.
Attributes inherited from Engine::Component
Instance Method Summary collapse
-
#initialize(tl, tr, br, bl, material) ⇒ UISpriteRenderer
constructor
A new instance of UISpriteRenderer.
- #start ⇒ Object
- #ui_renderer? ⇒ Boolean
- #update(delta_time) ⇒ Object
Methods inherited from Engine::Component
#_erase!, #destroy, #destroy!, #destroyed?, destroyed_components, erase_destroyed_components, method_added, #renderer?, #set_game_object
Constructor Details
#initialize(tl, tr, br, bl, material) ⇒ UISpriteRenderer
Returns a new instance of UISpriteRenderer.
11 12 13 14 15 16 17 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 11 def initialize(tl, tr, br, bl, material) @v1 = tl @v2 = tr @v3 = br @v4 = bl @material = material end |
Instance Attribute Details
#material ⇒ Object (readonly)
Returns the value of attribute material.
5 6 7 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 5 def material @material end |
#v1 ⇒ Object (readonly)
Returns the value of attribute v1.
5 6 7 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 5 def v1 @v1 end |
#v2 ⇒ Object (readonly)
Returns the value of attribute v2.
5 6 7 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 5 def v2 @v2 end |
#v3 ⇒ Object (readonly)
Returns the value of attribute v3.
5 6 7 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 5 def v3 @v3 end |
#v4 ⇒ Object (readonly)
Returns the value of attribute v4.
5 6 7 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 5 def v4 @v4 end |
Instance Method Details
#start ⇒ Object
19 20 21 22 23 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 19 def start setup_vertex_attribute_buffer setup_vertex_buffer setup_index_buffer end |
#ui_renderer? ⇒ Boolean
7 8 9 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 7 def ui_renderer? true end |
#update(delta_time) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/engine/components/ui_sprite_renderer.rb', line 25 def update(delta_time) GL.BindVertexArray(@vao) GL.BindBuffer(GL::ELEMENT_ARRAY_BUFFER, @ebo) set_material_per_frame_data GL.DrawElements(GL::TRIANGLES, 6, GL::UNSIGNED_INT, 0) GL.BindVertexArray(0) GL.BindBuffer(GL::ELEMENT_ARRAY_BUFFER, 0) end |