Sha256: 8dbd25705b2d87dfd222eb176dc31cbb2e31427505e7e44dba9269cba89b9272

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

module Joybox
  class Director < CCDirectorDisplayLink

    alias_method :push_scene, :pushScene
    alias_method :pop_scene, :popScene
    alias_method :pop_to_root_scene, :popToRootScene
    alias_method :replace_scene, :replaceScene
    alias_method :stop_animation, :stopAnimation
    alias_method :start_animation, :startAnimation
    alias_method :purge_cached_data, :purgeCachedData
    alias_method :set_next_delta_time_zero, :setNextDeltaTimeZero

    def self.default_configuration
      {
        wants_full_screen_layout: true,
        display_stats: false,
        animation_interval: 1.0/60,
        projection: KCCDirectorProjection2D,
        enable_retina_display: true,
        delegate: nil
      }
    end

    def self.configure(options = {})
      options = options.nil? ? default_configuration : default_configuration.merge!(options)

      director = Director.sharedDirector

      director.wantsFullScreenLayout = options.fetch(:wants_full_screen_layout)
      director.displayStats = options.fetch(:display_stats)
      director.animationInterval = options.fetch(:animation_interval)
      director.projection = options.fetch(:projection)
      director.enableRetinaDisplay(options.fetch(:enable_retina_display))
      director.delegate = options.fetch(:delegate)
    end


    def << (scene)
      self.push_scene(scene)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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