motion/joybox-ios/configuration/gl_view.rb in joybox-1.0.0 vs motion/joybox-ios/configuration/gl_view.rb in joybox-1.1.0
- old
+ new
@@ -1,44 +1,38 @@
module Joybox
module Configuration
class GLView < CCGLView
- def self.defaults
- {
+ extend Joybox::Common::Initialize
+ def 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)
-
+ def initialize(options)
options = options.nil? ? defaults : defaults.merge!(options)
-
bounds = options[:bounds]
- if bounds.class == Hash
+ bounds = [[bounds[:x], bounds[:y]], [bounds[:width], bounds[:height]]] 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])
+ initWithFrame(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
\ No newline at end of file
+end