Sha256: f01fb35908c816f2f30c8ba5affd602a4a1b99128f0a20f87742aae4906dde56

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

module Joybox
  module UI

    class Label < CCLabelTTF

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

      def self.defaults
        {
          text: '',
          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

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.0.0 motion/joybox/ui/label.rb
joybox-0.0.6 motion/joybox/ui/label.rb