Sha256: f120d79278fe18098125d10df5dc5779a6f0923afcbcffd074758da4cca90b3f

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module Joybox
  module Core

    class LayerColor < CCLayerColor

      include Joybox::Common

      def self.scene
        define_singleton_method(:scene) do 
          scene = CCScene.new
          menu_layer = self.new
          scene << menu_layer
        end
      end

      def onEnter
        super
        on_enter if defined? (on_enter)
      end

      def onExit
        super
        on_exit if defined? (on_exit)
      end

      def self.defaults
      {
        opacity: 255,
        width: Screen.width,
        height: Screen.height
      }
      end

      def self.new(options = {})
        options = options.nil? ? defaults : defaults.merge!(options)
        options[:color] << options[:opacity]

        layer = CCLayerColor.layerWithColor(options[:color], 
                                            width: options[:width], 
                                            height: options[:height])

        layer.position = options[:position] if options.has_key? :position
        layer
      end
      
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
joybox-1.1.1 motion/joybox/core/layer_color.rb