Sha256: 02fb794b9a63a71add2a186a57affffb72b1e32a8f0296407abdcf1ef518621f

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

module Joybox
  module Configuration

    class GLView < CCGLView

      def self.defaults
        {

          bounds: UIScreen.mainScreen.bounds,
          pixel_format: KEAGLColorFormatRGB565,
          depth_format: 0,
          preserve_backbuffer: 0,
          share_group: nil,
          multi_sampling: false,
          number_of_samples: 0
        }
      end


      def self.new(options)

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

        bounds = options[:bounds]

        if bounds.class == Hash

          bounds = [[bounds[:x], bounds[:y]], [bounds[:width], bounds[:height]]]
        end


        GLView.viewWithFrame(UIScreen.mainScreen.bounds,
         pixelFormat: options[:pixel_format],
         depthFormat: options[:depth_format],
         preserveBackbuffer: options[:preserve_backbuffer],
         sharegroup: options[:share_group],
         multiSampling: options[:multi_sampling],
         numberOfSamples: options[:number_of_samples])
      end

    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
joybox-1.0.0 motion/joybox-ios/configuration/gl_view.rb
joybox-0.0.6 motion/joybox-ios/configuration/gl_view.rb
joybox-0.0.5 lib/joybox/cocos2d/configuration/gl_view.rb
joybox-0.0.4 lib/joybox/cocos2d/configuration/gl_view.rb
joybox-0.0.3 lib/joybox/cocos2d/configuration/gl_view.rb