cocoslicer 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +4 -1
- data/lib/cocoslicer.rb +9 -9
- data/lib/cocoslicer/version.rb +1 -1
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b47bf49c966b55e5a3c23fff59bf85f9dbfa9e2b
|
4
|
+
data.tar.gz: 3212e78b7210552ca66761dc4bbe7180327c20df
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a1f752a1fe03848a557d876e4b08775f7c73e220e97d2741b6d516170399e223c2e8cee96d3a64bef96cf7b226ab502f287fcd2536870b268107690ffaefff3a
|
7
|
+
data.tar.gz: f1554518354e0be9cf50126aa484655e288860bd4d730955cc0f337475a9b43f7266acc0f381b9446f8540ec865b007e679cef976a9ad97e633b2559efcec326
|
data/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# Cocoslicer
|
2
2
|
|
3
|
-
Slicer the packed cocos2d resources(with tool TexturePacker) into the original ones.
|
3
|
+
Slicer the packed cocos2d resources(with tool TexturePacker) into the original ones. Can't slice the files zwoptex packed."
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
+
First. Install the [Imagemagick](http://www.imagemagick.org/script/index.php) command line tools.
|
8
|
+
Then
|
9
|
+
|
7
10
|
Add this line to your application's Gemfile:
|
8
11
|
|
9
12
|
gem 'cocoslicer'
|
data/lib/cocoslicer.rb
CHANGED
@@ -11,6 +11,7 @@ module Cocoslicer
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def import_from_str(str)
|
14
|
+
p str
|
14
15
|
match = @@re.match(str)
|
15
16
|
@x = match[1].to_i
|
16
17
|
@y = match[2].to_i
|
@@ -26,7 +27,7 @@ module Cocoslicer
|
|
26
27
|
end
|
27
28
|
|
28
29
|
private
|
29
|
-
@@re = /\{(-?\d
|
30
|
+
@@re = /\{(-?\d+\.?\d?),(-?\d+\.?\d?)\}/
|
30
31
|
|
31
32
|
end
|
32
33
|
|
@@ -40,6 +41,7 @@ module Cocoslicer
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def import_from_str(str)
|
44
|
+
p str
|
43
45
|
match = @@re.match(str)
|
44
46
|
@width = match[1].to_i
|
45
47
|
@height = match[2].to_i
|
@@ -92,7 +94,7 @@ module Cocoslicer
|
|
92
94
|
end
|
93
95
|
|
94
96
|
class ImageInfo
|
95
|
-
attr_accessor :name, :frame, :offset, :rotated, :
|
97
|
+
attr_accessor :name, :frame, :offset, :rotated, :source_size
|
96
98
|
|
97
99
|
def slice_img(tex_name)
|
98
100
|
cmd = "convert #{tex_name} -crop " + frame.to_cmd_str(@rotated)
|
@@ -128,7 +130,7 @@ module Cocoslicer
|
|
128
130
|
end
|
129
131
|
|
130
132
|
def to_s
|
131
|
-
return "name=#{@name},frame=#{@frame},offset=#{@offset},rotated=#{@rotated},
|
133
|
+
return "name=#{@name},frame=#{@frame},offset=#{@offset},rotated=#{@rotated},source_size=#{@source_size}"
|
132
134
|
end
|
133
135
|
end
|
134
136
|
|
@@ -172,17 +174,15 @@ module Cocoslicer
|
|
172
174
|
exit
|
173
175
|
end
|
174
176
|
|
175
|
-
infos = []
|
176
177
|
frames.each { |key, value|
|
177
178
|
puts "#{key} => #{value}"
|
178
179
|
info = ImageInfo.new
|
179
180
|
info.name = path + key
|
180
181
|
|
181
|
-
info.
|
182
|
-
info.
|
183
|
-
info.
|
184
|
-
info.
|
185
|
-
info.source_size = Size.new.import_from_str(value['sourceSize'])
|
182
|
+
info.source_size = Size.new.import_from_str(value['spriteSourceSize'])
|
183
|
+
info.frame = Rect.new.import_from_str(value['textureRect'])
|
184
|
+
info.offset = Point.new.import_from_str(value['spriteOffset'])
|
185
|
+
info.rotated = value['textureRotated']
|
186
186
|
|
187
187
|
puts info
|
188
188
|
|
data/lib/cocoslicer/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoslicer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- jtianling
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Slicer the packed cocos2d resources(with tool TexturePacker) into the
|
15
14
|
original ones. Don't support zwoptex now.
|
@@ -31,28 +30,27 @@ files:
|
|
31
30
|
- lib/cocoslicer/version.rb
|
32
31
|
homepage: http://www.jtianling.com
|
33
32
|
licenses: []
|
33
|
+
metadata: {}
|
34
34
|
post_install_message:
|
35
35
|
rdoc_options: []
|
36
36
|
require_paths:
|
37
37
|
- lib
|
38
38
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
39
|
requirements:
|
41
|
-
- -
|
40
|
+
- - '>='
|
42
41
|
- !ruby/object:Gem::Version
|
43
42
|
version: 1.8.6
|
44
43
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
44
|
requirements:
|
47
|
-
- -
|
45
|
+
- - '>='
|
48
46
|
- !ruby/object:Gem::Version
|
49
47
|
version: '0'
|
50
48
|
requirements:
|
51
49
|
- libmagick, v6.0
|
52
50
|
- plist
|
53
51
|
rubyforge_project:
|
54
|
-
rubygems_version:
|
52
|
+
rubygems_version: 2.6.4
|
55
53
|
signing_key:
|
56
|
-
specification_version:
|
54
|
+
specification_version: 4
|
57
55
|
summary: Slicer the packed cocos2d resources into the original ones.
|
58
56
|
test_files: []
|