Method: Ruby2D::Text#initialize
- Defined in:
- lib/ruby2d/text.rb
#initialize(text, size: 20, style: nil, font: Font.default, x: 0, y: 0, z: 0, rotate: 0, color: nil, colour: nil, opacity: nil, show: true) ⇒ Text
Create a text string
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ruby2d/text.rb', line 25 def initialize(text, size: 20, style: nil, font: Font.default, x: 0, y: 0, z: 0, rotate: 0, color: nil, colour: nil, opacity: nil, show: true) @x = x @y = y @z = z @text = text.to_s @size = size @rotate = rotate @style = style self.color = color || colour || 'white' self.color.opacity = opacity unless opacity.nil? @font_path = font @texture = nil create_font create_texture add if show end |