class Scar::Components::Text
Overview
This component is a wrapper around SF::Text
Example usage:
Assets.default_font = Assets.font "fonts/arial.ttf"
title_text = Scar::Components::Text.new("Game Title")
title = Scar::Entity.new("title", title_text)
title.position = Vec.new(100, 100)Defined in:
scar/components/text.crConstructors
- 
        .new(text : String, font : SF::Font | Nil = nil)
        
          Creates a new text component with the given Stringcontent and font
Instance Method Summary
- 
        #drawable : SF::Text
        
          Returns the underlying SF::Text
- 
        #font : SF::Font?
        
          Returns the SF::Fontthis component uses
- 
        #font=(new_font : SF::Font)
        
          Sets the font this component should use 
- 
        #text : String
        
          Returns the Stringcontents of this component
- 
        #text=(new_text : String)
        
          Replaces the components' Stringcontent with the provided new one
Instance methods inherited from module Scar::Drawable
  
  
    
      blend_mode : SF::BlendMode
    blend_mode, 
    
  
    
      blend_mode=(blend_mode : SF::BlendMode)
    blend_mode=, 
    
  
    
      drawable : SF::Drawable
    drawable, 
    
  
    
      shader : SF::Shader
    shader, 
    
  
    
      shader=(shader : SF::Shader)
    shader=, 
    
  
    
      texture : SF::Texture
    texture, 
    
  
    
      texture=(texture : SF::Texture)
    texture=, 
    
  
    
      visible=(visible)
    visible=, 
    
  
    
      visible?
    visible?
    
  
    
    
  
    
    
    
  
    
    
    
  
    
    
    
  
    
    
    
  
Constructor Detail
        
        def self.new(text : String, font : SF::Font | Nil = nil)
        #
      
      
        Creates a new text component with the given String content and font
If no font is given, the component will try to use Assets#default_font.
This only works if Assets#default_font is set.