Sha256: b7668ef2c7b61a93a426b00de581103700fb35acedebd8f0af8a06396f8967e7

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

module Joybox
  class Director < CCDirectorDisplayLink

    attr_accessor :should_enable_retina_display

    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

    Projection2D = KCCDirectorProjection2D
    Projection3D = KCCDirectorProjection3D

    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[:wants_full_screen_layout]
      director.displayStats = options[:display_stats]
      director.animationInterval = options[:animation_interval]
      director.projection = options[:projection]
      director.should_enable_retina_display = options[:enable_retina_display]
      director.delegate = options[:delegate]
    end

    def view=(view)
      super
      enableRetinaDisplay(@should_enable_retina_display)
    end

    def << (scene)
      push_scene(scene)
    end

    def set_next_delta_time_zero(delta_time_zero)
      setNextDeltaTimeZero(delta_time_zero)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.1.1 motion/joybox-ios/director.rb
joybox-1.1.0 motion/joybox-ios/director.rb