require 'osx/cocoa' def load_bridge_support(name) OSX.load_bridge_support_file( OSX::NSBundle.mainBundle.pathForResource_ofType( name, 'bridgesupport')) end # RubyCocoa crashes if these go after "include OSX"... load_bridge_support('mach_time') load_bridge_support('NSGraphicsContextWorkaround') load_bridge_support('OpenAL') include OSX require_framework '/System/Library/Frameworks/OpenAL.framework' require_framework '/System/Library/Frameworks/OpenGL.framework' require_framework '/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ImageIO.framework' def rb_main_init path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation rbfiles = Dir.entries(path).select {|x| /\.rb\z/ =~ x} rbfiles -= [ File.basename(__FILE__) ] rbfiles.each do |path| require( File.basename(path) ) end end if $0 == __FILE__ then rb_main_init NSApplicationMain(0, nil) end