Class: SlideField::ObjectManager::Text
- Defined in:
- lib/slidefield/objects/text.rb
Instance Method Summary collapse
Methods inherited from Base
#execute, #initialize, #method_missing, #on_activate, #on_deactivate
Constructor Details
This class inherits a constructor from SlideField::ObjectManager::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SlideField::ObjectManager::Base
Instance Method Details
#on_draw(animator) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/slidefield/objects/text.rb', line 44 def on_draw(animator) tr = animator.transform @obj return if tr.skip_draw? x = @x + tr.x_offset y = @y + tr.y_offset color = @color.dup color.alpha = tr.opacity * @color.alpha @image.draw x, y, @z, tr.scale, tr.scale, color end |
#on_load ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/slidefield/objects/text.rb', line 19 def on_load @x, @y = @obj.get :position @z = @obj.get :z_order @color = Gosu::Color.rgba *@obj.get(:color) content = @obj.get :content font = @obj.get :font height = @obj.get :height spacing = @obj.get :spacing width = @obj.get :width align = @obj.get(:align).to_sym if font.include? '/' font = File. font, @obj.include_path end if width < 1 # automatic width temp = Gosu::Image.from_text @window, content, font, height width = temp.width end @image = Gosu::Image.from_text @window, content, font, height, spacing, width, align end |
#on_unload ⇒ Object
57 58 59 |
# File 'lib/slidefield/objects/text.rb', line 57 def on_unload @image = nil end |