Class: Engine::Components::UIFontRenderer
Instance Attribute Summary collapse
#game_object
Instance Method Summary
collapse
#_erase!, #destroy, #destroy!, #destroyed?, destroyed_components, erase_destroyed_components, method_added, #renderer?, #set_game_object
Constructor Details
9
10
11
12
13
14
|
# File 'lib/engine/components/ui_font_renderer.rb', line 9
def initialize(font, string)
@mesh = Engine::PolygonMesh.new([Vector[-0.5, 0.5], Vector[0.5, 0.5], Vector[0.5, -0.5], Vector[-0.5, -0.5]], [[0, 0], [1, 0], [1, 1], [0, 1]])
@texture = font.texture.texture
@string = string
@font = font
end
|
Instance Attribute Details
#mesh ⇒ Object
Returns the value of attribute mesh.
3
4
5
|
# File 'lib/engine/components/ui_font_renderer.rb', line 3
def mesh
@mesh
end
|
#texture ⇒ Object
Returns the value of attribute texture.
3
4
5
|
# File 'lib/engine/components/ui_font_renderer.rb', line 3
def texture
@texture
end
|
Instance Method Details
#start ⇒ Object
16
17
18
19
20
|
# File 'lib/engine/components/ui_font_renderer.rb', line 16
def start
setup_vertex_attribute_buffer
setup_vertex_buffer
setup_index_buffer
end
|
#ui_renderer? ⇒ Boolean
5
6
7
|
# File 'lib/engine/components/ui_font_renderer.rb', line 5
def ui_renderer?
true
end
|
#update(delta_time) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/engine/components/ui_font_renderer.rb', line 27
def update(delta_time)
shader.use
GL.BindVertexArray(@vao)
GL.BindBuffer(GL::ELEMENT_ARRAY_BUFFER, @ebo)
set_shader_per_frame_data
GL.DrawElementsInstanced(GL::TRIANGLES, mesh.index_data.length, GL::UNSIGNED_INT, 0, @string.length)
GL.BindVertexArray(0)
GL.BindBuffer(GL::ELEMENT_ARRAY_BUFFER, 0)
end
|
#update_string(string) ⇒ Object
22
23
24
25
|
# File 'lib/engine/components/ui_font_renderer.rb', line 22
def update_string(string)
@string = string
update_vbo_buf
end
|