Module: SDC::Data
- Extended by:
- SDCMeta::DataStorage
- Defined in:
- lib/core/Data.rb
Constant Summary collapse
- SYMBOL_PREFIX =
If an actual symbol is not needed, e.g. for one-time draw routines
"_UNKNOWN_"
Class Method Summary collapse
Methods included from SDCMeta::DataStorage
clear_containers, create_loading_method, define_new_data_type
Class Method Details
.load_text(index = nil, content: nil, size: 10, font_index: nil, font: nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/core/Data.rb', line 24 def self.load_text(index = nil, content: nil, size: 10, font_index: nil, font: nil) if font && font_index then @fonts[font_index] = font else font = font_index ? self.load_font(font_index) : font end if !index && !content then raise ArgumentError("Neither index nor content given.") elsif !index then # TODO: Use object ID or magic number instead index = (SYMBOL_PREFIX + content).to_sym elsif !content then content = self.texts[index] end if !self.texts[index] then self.add_text(SDC::Text.new(content, font, size), index: index) else # TODO: Update font self.texts[index].string = content self.texts[index].character_size = size end return self.texts[index] end |