mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-23 20:31:17 +08:00
add support for spritekit atlas files
This commit is contained in:
@@ -333,7 +333,7 @@ EOS
|
||||
end
|
||||
end
|
||||
|
||||
# Compile CoreData Model resources.
|
||||
# Compile CoreData Model resources and SpriteKit atlas files.
|
||||
config.resources_dirs.each do |dir|
|
||||
if File.exist?(dir)
|
||||
Dir.glob(File.join(dir, '*.xcdatamodeld')).each do |model|
|
||||
@@ -345,6 +345,14 @@ EOS
|
||||
sh "\"#{App.config.xcode_dir}/usr/bin/momc\" \"#{model}\" \"#{momd}\""
|
||||
end
|
||||
end
|
||||
if cmd = config.spritekit_texture_atlas_compiler
|
||||
Dir.glob(File.join(dir, '*.atlas')).each do |atlas|
|
||||
if File.directory?(atlas)
|
||||
App.info 'Compile', atlas
|
||||
sh "\"#{cmd}\" \"#{atlas}\" \"#{bundle_path}\""
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -373,7 +381,7 @@ EOS
|
||||
config.resources_dirs.each do |dir|
|
||||
if File.exist?(dir)
|
||||
resources_paths << Dir.chdir(dir) do
|
||||
Dir.glob('**{,/*/**}/*').reject { |x| ['.xib', '.storyboard', '.xcdatamodeld', '.lproj'].include?(File.extname(x)) }.map { |file| File.join(dir, file) }
|
||||
Dir.glob('**{,/*/**}/*').reject { |x| ['.xib', '.storyboard', '.xcdatamodeld', '.lproj', '.atlas'].include?(File.extname(x)) }.map { |file| File.join(dir, file) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -318,5 +318,10 @@ EOS
|
||||
end
|
||||
"rb_define_global_const(\"RUBYMOTION_ENV\", @\"#{rubymotion_env}\");\nrb_define_global_const(\"RUBYMOTION_VERSION\", @\"#{Motion::Version}\");\n"
|
||||
end
|
||||
|
||||
def spritekit_texture_atlas_compiler
|
||||
path = File.join(xcode_dir, 'usr/bin/TextureAtlas')
|
||||
File.exist?(path) ? path : nil
|
||||
end
|
||||
end
|
||||
end; end
|
||||
|
||||
Reference in New Issue
Block a user