Sha256: cfa1253cd096795d68f849519ac306956f5ba439dd5b403e1343d95a2ff668a3

Contents?: true

Size: 683 Bytes

Versions: 3

Compression:

Stored size: 683 Bytes

Contents

module Joybox
  module UI

    class Label < CCLabelTTF

      alias_method :text=, :setString
      alias_method :set_text, :setString

      def self.defaults
        {
          font_name: 'Marker Felt',
          font_size: 12
        }
      end


      def self.new(options = {})

        options = options.nil? ? defaults : defaults.merge!(options)

        label = Label.labelWithString(options[:text], 
          fontName: options[:font_name], 
          fontSize: options[:font_size])

        label.position = options[:position] if options.has_key? (:position)
        label.color = options[:color] if options.has_key? (:color)

        label
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
joybox-0.0.5 lib/joybox/cocos2d/ui/label.rb
joybox-0.0.4 lib/joybox/cocos2d/ui/label.rb
joybox-0.0.3 lib/joybox/cocos2d/ui/label.rb